Prev: 40662 Up: Map Next: 40741
40712: 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 40712 PUSH BC Keep the direction.
40713 PUSH IY
40715 LD B,A
40716 CALL ExitsPointAtTheExitList Call ExitsPointAtTheExitList to point IX at the exit list.
TableFindAnExitInADirection_Loop 40719 CALL Table_StepThroughThreeByteRecords Call Table_StepThroughThreeByteRecords to step to the next exit.
40722 JR Z,TableFindAnExitInADirection_RestoreAndReturn Jump to TableFindAnExitInADirection_RestoreAndReturn at the end of the exit list.
40724 LD A,(IX+2) Read this exit's destination.
40727 AND A Jump back to TableFindAnExitInADirection_Loop if byte 2 of this record is zero.
40728 JR Z,TableFindAnExitInADirection_Loop
40730 LD A,(IX+0) Read this exit's direction.
40733 CP B Jump back to TableFindAnExitInADirection_Loop unless this exit's direction is the one in B.
40734 JP NZ,TableFindAnExitInADirection_Loop
TableFindAnExitInADirection_RestoreAndReturn 40737 POP IY Restore IY and BC from the stack.
40739 POP BC
40740 RET Return.
View the equivalent code in;
Prev: 40662 Up: Map Next: 40741