Prev: 9BA9 Up: Map Next: 9BCA
9BB1: Find a location's record
Anything from $50 up is not a location and gets zero back; otherwise the record's address is read straight out of ROOM_POINTERS, two bytes per location. Unlike objects there is no search: locations are numbered densely, so a table indexed by number is cheaper than FIND_RECORD.
Input
A The location
Output
IX Its record
GET_ROOM 9BB1 CP $50 $50 and above is not a location: return zero
9BB3 JR C,GET_ROOM_0
9BB5 XOR A
9BB6 RET
GET_ROOM_0 9BB7 PUSH DE DE = ROOM_POINTERS, keeping HL
9BB8 LD DE,ROOM_POINTERS
9BBB PUSH HL
9BBC LD L,A HL = ROOM_POINTERS + 2 x location
9BBD LD H,$00
9BBF ADD HL,HL
9BC0 ADD HL,DE
9BC1 LD E,(HL) DE = the pointer there
9BC2 INC HL
9BC3 LD D,(HL)
9BC4 PUSH DE IX = the room's record
9BC5 POP IX
9BC7 POP HL
9BC8 POP DE
9BC9 RET
Prev: 9BA9 Up: Map Next: 9BCA