Prev: E662 Up: Map Next: E6D9
E663: Update any teleporter in this room
Used by the routine at C800.
E663 LD IY,$EDBC Point IY at the table of teleporters. (E663)
E667 LD B,$0A 10 entries to check.
E669 LD A,($CFCA) Get the current room. (CFCA)
E66C CP (IY+$00) Is this entry for this room?
E66F JR Z,$E679 If so, jump forward and handle it.
E671 LD DE,$0006 Move to the next entry in the table.
E674 ADD IY,DE
E676 DJNZ $E66C Loop until all entries have been looked at.
E678 RET
This room has a teleporter, update it
E679 LD HL,$E662 Point HL at the current colour sequence for the teleporter.
E67C INC (HL) Increment it and put the result in A.
E67D LD A,(HL)
E67E LD L,(IY+$01) Put the teleporter co-ordinates in HL.
E681 LD H,(IY+$02)
E684 LD B,$04 4 rows to draw.
E686 AND $07
E688 JR NZ,$E68B
E68A INC A
E68B LD (HL),A
E68C INC A
E68D INC L
E68E DJNZ $E686
E690 DEC A
E691 LD C,A
E692 LD A,($E662)
E695 CP $C8
E697 RET C
E698 BIT 1,A
E69A JR NZ,$E6A0
E69C LD A,$45
E69E JR $E6A4
E6A0 LD A,C
E6A1 RLCA
E6A2 RLCA
E6A3 RLCA
E6A4 CALL $ECA4 Flash the teleporter.
E6A7 LD C,A
E6A8 RRCA
E6A9 CALL $DB01 Play the sound effect.
E6AC LD DE,($C872) Put Dan's position in DE.
E6B0 CALL $E909 Convert this to an attribute address and put it in HL.
E6B3 EX DE,HL
E6B4 LD DE,$0040 Move down one row in the attribute buffer.
E6B7 ADD HL,DE
E6B8 INC L
E6B9 LD A,($E662) Get the current colour sequence for the teleporter.
E6BC CP $FF Return if it is not active.
E6BE RET NZ
E6BF LD A,(HL)
E6C0 CP C
E6C1 LD A,$45 Set bright cyan on black.
E6C3 JP NZ,$ECA4
The teleporter has flashed and Dan is standing under it.
E6C6 LD A,(IY+$04) Set the new Y co-ordinate (C872).
E6C9 LD ($C872),A
E6CC LD A,(IY+$05) Set the new X co-ordinate (C873).
E6CF LD ($C873),A
E6D2 LD A,(IY+$03) Put the new room number in A.
E6D5 CALL $CBBD Switch to the new room and return.
E6D8 RET
Prev: E662 Up: Map Next: E6D9