Prev: 5FAA Up: Map Next: 5FF1
5FCE: Find Room In Exit Table
Used by the routines at TakeExit and DescribeLocation.
Looks through ExitTable for the current room. The room is stored as itself plus 80.
Output
HL The matching room key, or the end of a full sweep of the table
FindExits 5FCE LD A,($5D87) Fetch CurrentRoom.
5FD1 ADD A,$80 Write that room plus 80 to ExitKey.
5FD3 LD ($5B84),A
5FD6 XOR A Write 00 to SearchHit.
5FD7 LD ($5B7A),A
5FDA LD DE,$AB67 Point DE at ExitTable.
5FDD LD HL,$5B84 Point HL at ExitKey.
Scan the exit table.
FindExits_Scan 5FE0 LD A,(DE) Fetch this key.
5FE1 CP (HL) Jump to FindExits_Found if it matches this room.
5FE2 JR Z,FindExits_Found
5FE4 INC DE Advance the table pointer.
5FE5 LD A,E Jump to FindExits_Scan until DE is 34CE.
5FE6 CP $CE
5FE8 JR NZ,FindExits_Scan
5FEA LD A,D
5FEB CP $34
5FED JR NZ,FindExits_Scan
The matching room key, or the end of the table.
FindExits_Found 5FEF EX DE,HL Put the table pointer in HL.
5FF0 RET Return.
Prev: 5FAA Up: Map Next: 5FF1