Prev: 9B0C Up: Map Next: 9B37
9B25: Get the address of an object record
Looks up object number A in the object index table at BF53 (using 9D12) and returns the address of its record in IX. Everything that can be manipulated - Bilbo himself (object 0), the other characters, doors, food, weapons, keys - is an 'object' with a record in C00B.
Input
A Object number
Output
IX Object record
9B25 LD IX,$BF53 IX = the start of the object index, the master list of every object and its record address
9B29 CALL $9D12 Search the index for object A
9B2C PUSH HL Save HL for a moment
9B2D LD L,(IX+$01) HL = the object's record address, read from the matching entry (low byte)...
9B30 LD H,(IX+$02) ...then the high byte
9B33 EX (SP),HL Swap it onto the stack in place of the saved HL, so the address can be...
9B34 POP IX ...popped straight into IX, the register the rest of the game expects an object record in
9B36 RET
Prev: 9B0C Up: Map Next: 9B37