Prev: 40741 Up: Map Next: 40778
40749: 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 2).
ExitsFindTheExitToALocation 40749 PUSH AF Search on the destination byte (offset 2).
40750 LD A,2
This entry point is used by the routine at ExitsFindTheExitThroughAnObject.
ExitsFindTheExitToALocation_PatchTheOffset 40752 LD (40770),A Patch the offset of the LD A,(IX+n) at 40768.
40755 POP AF Restore A from the stack, save BC and IY, and keep the id being sought in B.
40756 PUSH BC
40757 PUSH IY
40759 LD B,A
40760 CALL ExitsPointAtTheExitList Call ExitsPointAtTheExitList to point IX at the exit list.
ExitsFindTheExitToALocation_Loop 40763 CALL Table_StepThroughThreeByteRecords Call Table_StepThroughThreeByteRecords to step to the next exit.
40766 JR Z,ExitsFindTheExitToALocation_RestoreAndReturn Jump to ExitsFindTheExitToALocation_RestoreAndReturn at the end of the exit list.
40768 LD A,(IX+2) Read the patched byte of this exit.
40771 CP B Jump back to ExitsFindTheExitToALocation_Loop unless it matches the id in B.
40772 JR NZ,ExitsFindTheExitToALocation_Loop
ExitsFindTheExitToALocation_RestoreAndReturn 40774 POP IY Restore IY and BC from the stack.
40776 POP BC
40777 RET Return.
View the equivalent code in;
Prev: 40741 Up: Map Next: 40778