Prev: 62622 Up: Map Next: 62812
62778: Get index of destination room for a character and load into A
Used by the routine at 62622.
Input
A A room index
HL Points to one of the two bytes of the first entry of the room connectivity data table at 48811
IY 23610
Output
A New room index
62778 ADD A,A Load double room index into BC...
62779 LD C,A ...
62780 LD B,0 ...
62782 ADD HL,BC Add BC to HL as offset
62783 PUSH HL Store HL (pointer to room's left or right exit data)
The operand of the instruction at 62784 represents the base address of the movement restriction data (table at 48915), and may be 48913 (when character tries to move one room to the left) or 48917 (when character tries to move one room to the right). This is modified by the instructions at 62695 and 62739.
62784 LD HL,0 Load HL with base address of movement restriction data
62787 ADD HL,BC Add BC to HL as offset
62788 LD A,(HL) If movement restriction data is 98...
62789 CP 98 ...then set zero flag
62791 POP HL Restore HL (pointer to room's left or right exit data)
62792 JR Z,62807 If zero flag is set (i.e. movement restriction data was 98) then skip ahead to 62807
62794 LD B,(HL) Load B with index of room to the left or right of room of interest
62795 LD A,(23702) If Magic Knight's current room is not the same as that in B...
62798 CP B ...
62799 JR NZ,62810 ...then skip ahead to 62810
62801 BIT 1,(IY+65) If characters-movement-unrestricted flag is reset...
62805 JR Z,62810 ...then skip ahead to 62810
62807 LD A,255 Load A with 255
62809 RET Return
62810 LD A,(HL) Load A with room index at HL
62811 RET Return
Prev: 62622 Up: Map Next: 62812