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) The search key is the room plus 80.
5FD1 ADD A,$80
5FD3 LD ($5B84),A
5FD6 XOR A Nothing has matched yet.
5FD7 LD ($5B7A),A
5FDA LD DE,$AB67
5FDD LD HL,$5B84
FindExits_Scan 5FE0 LD A,(DE) A matching key is this room.
5FE1 CP (HL)
5FE2 JR Z,FindExits_Found
5FE4 INC DE The table wraps when the pointer reaches 34CE.
5FE5 LD A,E
5FE6 CP $CE
5FE8 JR NZ,FindExits_Scan
5FEA LD A,D Otherwise keep scanning.
5FEB CP $34
5FED JR NZ,FindExits_Scan
FindExits_Found 5FEF EX DE,HL Return.
5FF0 RET
Prev: 5FAA Up: Map Next: 5FF1