Prev: A39B Up: Map Next: A3FE
A3DB: Find Group Objects
Used by the routines at RestoreBottles and CollectBottle.
Finds the objects of the group which an entry in the list of a level refers to. The group is found in the table at GroupTable from the byte at offset 08 from the entry, and its first byte holds the number of objects in the low five bits.
Input
IX The address of the entry in the list of the level
Output
B The number of objects
IX The address of the first object (which is three bytes long)
FindGroupObjects A3DB LD C,(IX+$08) Fetch the number of the group.
A3DE SLA C Double it to make the offset into the table.
A3E0 LD B,$00 Clear B.
A3E2 LD HL,$8BB1 Point HL at GroupTable.
A3E5 ADD HL,BC Add the offset to find the entry in the table.
A3E6 LD E,(HL) Fetch the low byte of the address of the group.
A3E7 INC HL Move onto the high byte.
A3E8 LD D,(HL) Fetch the high byte.
A3E9 PUSH DE Copy the address of the group into IX (using the stack).
A3EA POP IX
A3EC LD A,(IX+$00) Fetch the first byte of the group.
A3EF AND %00011111 Keep the number of objects.
A3F1 LD B,A Copy it into B.
A3F2 INC IX Skip the first byte of the group.
A3F4 INC IX Skip the second byte.
A3F6 INC IX Skip the third byte.
A3F8 AND %01110000 Use bits 4-6.
A3FA RET Z Return if they are all zero.
A3FB INC IX Skip a fourth byte.
A3FD RET Return.
Prev: A39B Up: Map Next: A3FE