Prev: 9F25 Up: Map Next: 9F4A
9F2D: Exits: Find The Exit To A Location
Used by the routines at Action_Enter, Action_Follow and Event_GiveTheLunch.
As ExitsFindTheExitThroughAnObject, but matches the destination byte (offset 02).
ExitsFindTheExitToALocation 9F2D PUSH AF Search on the destination byte (offset 02).
9F2E LD A,$02
This entry point is used by the routine at ExitsFindTheExitThroughAnObject.
ExitsFindTheExitToALocation_PatchTheOffset 9F30 LD ($9F42),A Patch the offset of the LD A,(IX+n) at 9F40.
9F33 POP AF Restore A from the stack, save BC and IY, and keep the id being sought in B.
9F34 PUSH BC
9F35 PUSH IY
9F37 LD B,A
9F38 CALL ExitsPointAtTheExitList Call ExitsPointAtTheExitList to point IX at the exit list.
ExitsFindTheExitToALocation_Loop 9F3B CALL Table_StepThroughThreeByteRecords Call Table_StepThroughThreeByteRecords to step to the next exit.
9F3E JR Z,ExitsFindTheExitToALocation_RestoreAndReturn Jump to ExitsFindTheExitToALocation_RestoreAndReturn at the end of the exit list.
9F40 LD A,(IX+$02) Read the patched byte of this exit.
9F43 CP B Jump back to ExitsFindTheExitToALocation_Loop unless it matches the id in B.
9F44 JR NZ,ExitsFindTheExitToALocation_Loop
ExitsFindTheExitToALocation_RestoreAndReturn 9F46 POP IY Restore IY and BC from the stack.
9F48 POP BC
9F49 RET Return.
View the equivalent code in;
Prev: 9F25 Up: Map Next: 9F4A