Prev: D38C Up: Map Next: D3C6
D3B5: Find Object Address
Used by the routines at DrawObjectsInOrder and DrawChangedObjects.
Finds the address of an object in the objects table from its index.
Input
A Index of the object (bit 7 is ignored)
Output
HL Address of the object
Multiply the index by 20 and add it to ObjectsTable.
FindObjectAddress D3B5 PUSH BC Stash BC on the stack.
D3B6 AND %01111111 Keep bits 0 to 6.
D3B8 LD L,A Copy it to L.
D3B9 LD H,$00 Set H to 00.
D3BB ADD HL,HL Multiply HL by 20.
D3BC ADD HL,HL
D3BD ADD HL,HL
D3BE ADD HL,HL
D3BF ADD HL,HL
D3C0 LD BC,$5C08 Point BC at ObjectsTable.
D3C3 ADD HL,BC Add BC to HL.
D3C4 POP BC Restore BC from the stack.
D3C5 RET Return.
View the equivalent code in;
Prev: D38C Up: Map Next: D3C6