Routines |
Prev: 56737 | Up: Map | Next: 56959 |
|
||||||||||||
This routine uses the room object table at 29551 and has a dual function:
Depending on which check is needed, the B or C register is set before this routine is called, with the other set to zero.
In either case, once the item data is found, its details & current 'state' are copied into the object data set buffer at 60293.
|
||||||||||||
56908 | LD A,(60292) | Counter. Starts at 0. | ||||||||||
56911 | INC A | Room/object numbers start from 1 so we need to immediately increment the counter for the first data set... | ||||||||||
56912 | LD (60292),A | ...and re-store | ||||||||||
56915 | LD A,(HL) | First byte of data set | ||||||||||
56916 | CP 255 | |||||||||||
56918 | JR NZ,56925 | |||||||||||
56920 | LD (60292),A | We've reached the end of the list - set counter byte to 255... | ||||||||||
56923 | JR 57014 | ...and jump straight to RET | ||||||||||
There are data sets still to check:
|
||||||||||||
56925 | LD A,C | Are we doing the check against an object number or a room number? | ||||||||||
56926 | CP 0 | |||||||||||
56928 | JR NZ,56936 | Run one of the next two checks depending on whether the B or the C register contains the value to check | ||||||||||
ROOM NUMBER CHECK
|
||||||||||||
56930 | LD A,(HL) | C register is 0 so it's a room number check. Get the first byte of the room object set (this is the room number of the object) | ||||||||||
56931 | CP B | Current room number - is the object in this room? | ||||||||||
56932 | JR Z,56959 | If so, we've found an object in the room so jump to next routine to deal with it | ||||||||||
56934 | JR 56942 | |||||||||||
OBJECT NUMBER CHECK
|
||||||||||||
56936 | LD A,(60292) | As we know the object number (data set number), we just need to perform the check against the incremental counter to find its data | ||||||||||
56939 | CP C | Check object number set against counter | ||||||||||
56940 | JR Z,56959 | If we've found it, jump to the next routine to handle its data | ||||||||||
Object not found in this set after one of the above checks. Skip forward to next data set.
Data sets vary in size, so this routine identifies the number of bytes that need skipping to get to the next set.
|
||||||||||||
56942 | LD DE,7 | Jump forward to 8th byte in original data set | ||||||||||
56945 | ADD HL,DE | |||||||||||
56946 | LD A,(HL) | Byte indicates number of additional 4 byte data sets this item has | ||||||||||
56947 | INC HL | |||||||||||
56948 | LD DE,4 | 4 bytes for each set to skip | ||||||||||
56951 | CP 0 | Have we skipped all the additional 4-byte sets for this item? | ||||||||||
56953 | JR Z,56908 | If so, go and check for the next object in the list | ||||||||||
56955 | ADD HL,DE | Skip this 4-byte data set | ||||||||||
56956 | DEC A | Decrement the data set counter | ||||||||||
56957 | JR 56951 | ...Until they're all skipped. |
Prev: 56737 | Up: Map | Next: 56959 |