Prev: 39959 Up: Map Next: 40056
40001: Table: Find An Exit
Used by the routine at Action_CheckTheObjectFlags.
Finds an exit out of the current location.
TableFindAnExit 40001 PUSH IX Save IX, IY and BC, and keep the location id in B.
40003 PUSH IY
40005 PUSH BC
40006 LD B,A
40007 CALL LocateLocation Call LocateLocation to locate location.
40010 LD A,(IX+1) Read the location's volume.
40013 LD C,A Copy the result into C.
40014 LD IX,49248 Point IX at the slot before the object table.
TableFindAnExit_Loop 40018 CALL Table_StepThroughThreeByteRecords Call Table_StepThroughThreeByteRecords to step to the next index entry.
40021 JR Z,TableFindAnExit_ReturnTheCount Jump to TableFindAnExit_ReturnTheCount at the end of the object index.
40023 LD A,(IY+0) Jump back to TableFindAnExit_Loop unless this object has one copy.
40026 CP 1
40028 JR NZ,TableFindAnExit_Loop
This object has one copy. Compare its location with the one being sought.
40030 LD A,B Jump back to TableFindAnExit_Loop if the object's location is not the location being sought.
40031 CP (IY+16)
40034 JR NZ,TableFindAnExit_Loop
40036 LD A,C Jump to TableFindAnExit_ReturnAZeroCount if the object's volume is above the location's volume.
40037 SUB (IY+2)
40040 JR C,TableFindAnExit_ReturnAZeroCount
40042 LD C,A Copy the result into C.
40043 JR TableFindAnExit_Loop Jump back to TableFindAnExit_Loop for the next index entry.
TableFindAnExit_ReturnTheCount 40045 LD A,C Return what C was holding.
40046 POP BC
40047 POP IY
40049 POP IX
40051 RET
TableFindAnExit_ReturnAZeroCount 40052 LD C,0 Take a count of zero.
40054 JR TableFindAnExit_ReturnTheCount Jump back to TableFindAnExit_ReturnTheCount to return the count in C.
Prev: 39959 Up: Map Next: 40056