Prev: 9ED6 Up: Map Next: 9F25
9F08: Table: Find An Exit In A Direction
Used by the routines at Action_Direction and Action_Run.
Finds the exit that leaves in a given direction.
TableFindAnExitInADirection 9F08 PUSH BC Keep the direction.
9F09 PUSH IY
9F0B LD B,A
9F0C CALL ExitsPointAtTheExitList Call ExitsPointAtTheExitList to point IX at the exit list.
TableFindAnExitInADirection_Loop 9F0F CALL Table_StepThroughThreeByteRecords Call Table_StepThroughThreeByteRecords to step to the next exit.
9F12 JR Z,TableFindAnExitInADirection_RestoreAndReturn Jump to TableFindAnExitInADirection_RestoreAndReturn at the end of the exit list.
9F14 LD A,(IX+$02) Read this exit's destination.
9F17 AND A Jump back to TableFindAnExitInADirection_Loop if byte 2 of this record is zero.
9F18 JR Z,TableFindAnExitInADirection_Loop
9F1A LD A,(IX+$00) Read this exit's direction.
9F1D CP B Jump back to TableFindAnExitInADirection_Loop unless this exit's direction is the one in B.
9F1E JP NZ,TableFindAnExitInADirection_Loop
TableFindAnExitInADirection_RestoreAndReturn 9F21 POP IY Restore IY and BC from the stack.
9F23 POP BC
9F24 RET Return.
View the equivalent code in;
Prev: 9ED6 Up: Map Next: 9F25