Prev: 46361 Up: Map Next: 46385
46368: Find Object Address
Used by the routines at DrawChangedObjects and DrawObjectsInOrder.
Finds the address of an object record, from its number. Bit 7 of the number is ignored, as that is used as a flag in the draw list.
Input
A Object number
Output
HL Address of the object record
Turn the object number into an address in the object table.
FindObjectAddress 46368 PUSH BC Stash BC on the stack.
46369 AND %01111111 Ignore bit 7 of the object number.
Set HL to the object number.
46371 LD L,A Copy it to L.
46372 LD H,0 Set H to 0.
46374 ADD HL,HL Multiply it by 32, the size of an object record.
46375 ADD HL,HL
46376 ADD HL,HL
46377 ADD HL,HL
46378 ADD HL,HL
46379 LD BC,42863 Start from the object table, ObjectsTable.
46382 ADD HL,BC Add BC to HL.
46383 POP BC Restore BC from the stack.
46384 RET Return.
View the equivalent code in;
Prev: 46361 Up: Map Next: 46385