Prev: 9C17 Up: Map Next: 9C78
9C41: Table: Find An Exit
Used by the routine at Action_CheckTheObjectFlags.
Finds an exit out of the current location.
TableFindAnExit 9C41 PUSH IX Save IX, IY and BC, and keep the location id in B.
9C43 PUSH IY
9C45 PUSH BC
9C46 LD B,A
9C47 CALL LocateLocation Call LocateLocation to locate location.
9C4A LD A,(IX+$01) Read the location's volume.
9C4D LD C,A Copy the result into C.
9C4E LD IX,$C060 Point IX at the slot before the object table.
TableFindAnExit_Loop 9C52 CALL Table_StepThroughThreeByteRecords Call Table_StepThroughThreeByteRecords to step to the next index entry.
9C55 JR Z,TableFindAnExit_ReturnTheCount Jump to TableFindAnExit_ReturnTheCount at the end of the object index.
9C57 LD A,(IY+$00) Jump back to TableFindAnExit_Loop unless this object has one copy.
9C5A CP $01
9C5C JR NZ,TableFindAnExit_Loop
This object has one copy. Compare its location with the one being sought.
9C5E LD A,B Jump back to TableFindAnExit_Loop if the object's location is not the location being sought.
9C5F CP (IY+$10)
9C62 JR NZ,TableFindAnExit_Loop
9C64 LD A,C Jump to TableFindAnExit_ReturnAZeroCount if the object's volume is above the location's volume.
9C65 SUB (IY+$02)
9C68 JR C,TableFindAnExit_ReturnAZeroCount
9C6A LD C,A Copy the result into C.
9C6B JR TableFindAnExit_Loop Jump back to TableFindAnExit_Loop for the next index entry.
TableFindAnExit_ReturnTheCount 9C6D LD A,C Return what C was holding.
9C6E POP BC
9C6F POP IY
9C71 POP IX
9C73 RET
TableFindAnExit_ReturnAZeroCount 9C74 LD C,$00 Take a count of zero.
9C76 JR TableFindAnExit_ReturnTheCount Jump back to TableFindAnExit_ReturnTheCount to return the count in C.
Prev: 9C17 Up: Map Next: 9C78