Prev: 24490 Up: Map Next: 24561
24526: 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 128.
Output
HL The matching room key, or the end of a full sweep of the table.
FindExits 24526 LD A,(23943) The search key is the room plus 128.
24529 ADD A,128
24531 LD (23428),A
24534 XOR A Nothing has matched yet.
24535 LD (23418),A
24538 LD DE,43879
24541 LD HL,23428
FindExits_Scan 24544 LD A,(DE) A matching key is this room.
24545 CP (HL)
24546 JR Z,FindExits_Found
24548 INC DE The table wraps when the pointer reaches 13518.
24549 LD A,E
24550 CP 206
24552 JR NZ,FindExits_Scan
24554 LD A,D Otherwise keep scanning.
24555 CP 52
24557 JR NZ,FindExits_Scan
FindExits_Found 24559 EX DE,HL Return.
24560 RET
Prev: 24490 Up: Map Next: 24561