Prev: 41883 Up: Map Next: 41982
41947: 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 8 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 41947 LD C,(IX+8) Fetch the number of the group.
41950 SLA C Double it to make the offset into the table.
41952 LD B,0 Clear B.
41954 LD HL,35761 Point HL at GroupTable.
41957 ADD HL,BC Add the offset to find the entry in the table.
41958 LD E,(HL) Fetch the low byte of the address of the group.
41959 INC HL Move onto the high byte.
41960 LD D,(HL) Fetch the high byte.
41961 PUSH DE Copy the address of the group into IX (using the stack).
41962 POP IX
41964 LD A,(IX+0) Fetch the first byte of the group.
41967 AND %00011111 Keep the number of objects.
41969 LD B,A Copy it into B.
41970 INC IX Skip the first byte of the group.
41972 INC IX Skip the second byte.
41974 INC IX Skip the third byte.
41976 AND %01110000 Use bits 4-6.
41978 RET Z Return if they are all zero.
41979 INC IX Skip a fourth byte.
41981 RET Return.
Prev: 41883 Up: Map Next: 41982