Prev: 9273 Up: Map Next: 9291
9286: Swap IX to the far side of a door
Used by the routines at ENTER_ROOM, OPEN_DOOR and SHUT_DOOR.
A door is two records, one for each room it joins, and they are deliberately put eight bytes apart so that the other side is found by flipping one bit of the address. No pointer, no table, no search: XOR the low byte with $08 and IX is looking at the other half.
That pairing is why the door records read out of a running game sit at $EEE0 and $EEE8, $EEF0 and $EEF8. Each side carries the destination and arrival position for going that way, so walking through is a matter of reading the record you did not touch.
Input
IX A door; on exit, its other side
DOOR_OTHER_SIDE 9286 PUSH IX IX into HL, where its low byte can be got at.
9288 POP HL
9289 LD A,L One bit is the whole of it.
928A XOR $08
928C LD L,A
928D PUSH HL And back into IX.
928E POP IX
9290 RET
Prev: 9273 Up: Map Next: 9291