Routines |
Prev: 69DC | Up: Map | Next: 6A27 |
This is called by a few routines to turn a door index into a pointer to a door structure (a door_t). The doors[] array contains pairs of door structures. If the door_REVERSE flag is set in bit 7, the first of the pair is returned, otherwise the second is.
|
||||||||||||
get_door | 6A12 | LD C,A | Save the original A so we can test its flag bit in a moment | |||||||||
6A13 | ADD A,A | First double A since doors[] contains pairs of doors. This also discards the door_REVERSE flag in bit 7 | ||||||||||
6A14 | LD L,A | Form the address of doors[A] in HL | ||||||||||
6A15 | LD H,$00 | |||||||||||
6A17 | ADD HL,HL | |||||||||||
6A18 | ADD HL,HL | |||||||||||
6A19 | LD DE,$78D6 | |||||||||||
6A1C | ADD HL,DE | |||||||||||
6A1D | BIT 7,C | Was the door_REVERSE flag (bit 7) set on entry? | ||||||||||
6A1F | RET Z | If not, return with HL pointing to the entry | ||||||||||
6A20 | LD A,L | Otherwise, point to the next entry along | ||||||||||
6A21 | ADD A,$04 | |||||||||||
6A23 | LD L,A | |||||||||||
6A24 | RET NC | |||||||||||
6A25 | INC H | |||||||||||
6A26 | RET | Return |
Prev: 69DC | Up: Map | Next: 6A27 |