Prev: 9E71 Up: Map Next: 9E93
9E76: Find the exit that leads to a room
Searches the actor's room for an exit whose destination (byte 2) is room A; see 9E71.
9E76 PUSH AF FIND EXIT TO A ROOM: save AF
9E77 LD A,$02 2 picks out an exit's DESTINATION byte instead
This entry point is used by the routine at 9E71.
9E79 LD ($9E8B),A Poke that choice into the instruction below, so the very same code can compare either byte depending on which entry point was used
9E7C POP AF Restore AF
9E7D PUSH BC Save the caller's BC and IY
9E7E PUSH IY
9E80 LD B,A B = the door (or destination room) we are looking for
9E81 CALL $9DDE IX = the start of the actor's room's exits
9E84 CALL $9AEE Look at the next exit; Z set once there are no more
9E87 JR Z,$9E8F No more exits: give up
9E89 LD A,(IX+$02) A = this exit's door, or its destination, whichever this call was asked to check
9E8C CP B Does it match?
9E8D JR NZ,$9E84 No: try the next exit
9E8F POP IY Found it (or ran out): restore the caller's IY and BC
9E91 POP BC
9E92 RET
Prev: 9E71 Up: Map Next: 9E93