Routines |
Prev: 54524 | Up: Map | Next: 54782 |
Follows setup of foreground scenery objects at 54524.
|
||||
The room's 'events-to-check' sets at 32691 contain any items in the current room that will need checking for events/collisions - for example if the servant, or a warlock, is present.
|
||||
54740 | LD HL,(60268) | Pointer to room item event data sets at 32691 | ||
54743 | LD D,H | Copy into DE register pair - this is the address pointer ready for a later set to be copied here | ||
54744 | LD E,L | |||
54745 | LD A,(HL) | Get first byte of event set | ||
54746 | INC HL | (and move the pointer along) | ||
This loop DECrements the first byte of each event set by 1:
|
||||
54747 | CP 255 | Have we reached the end of the event sets? | ||
54749 | JR Z,54771 | If so, skip out at this point | ||
54751 | DEC A | The first byte for these will be 1 or 2 | ||
54752 | JR Z,54764 | ...So after the DEC, skip the next set of instructions if it was 1, as it'll now be zero no longer needs checking | ||
First byte of set (after the decrement) = 1 - it's still not zero, so we need to keep this set:
|
||||
54754 | LD B,4 | Copy the DEC'd byte back into the first byte of the previously stored address | ||
54756 | LD (DE),A | |||
54757 | LD A,(HL) | ...followed by the rest of the bytes in the set | ||
54758 | INC DE | |||
54759 | INC HL | |||
54760 | DJNZ 54756 | |||
54762 | JR 54747 | Keep checking sets until all sets dealt with (byte value of 255 found) | ||
First byte of set (after the decrement) = 0 - no need to keep this set, move on to the next:
|
||||
54764 | INC HL | HL is pointing at the second byte of the set, so move it along 3... | ||
54765 | INC HL | |||
54766 | INC HL | ...To get to the first byte of the next set | ||
54767 | LD A,(HL) | |||
54768 | INC HL | |||
54769 | JR 54747 | ...And repeat the check for the next set. | ||
All event sets now dealt with. Set termination (end-of-data) byte of 255 at the start of what would be the next set.
|
||||
54771 | LD (DE),A | At this instruction, the A register contains 255 and DE points to the start of the next event data set at 54524, so this stores a 255 (end-of-data) byte at the start of the next set. | ||
54772 | EX DE,HL | Swap DE (start of data sets) back into HL | ||
54773 | LD (60077),HL | Store pointer to end of event table (byte 1 of new set) | ||
54776 | LD HL,(60274) | Retrieve address pointer for the end of the room element data sets at 31744 | ||
54779 | LD (60094),HL | Copy to data buffer | ||
The following routine (54782) determines if any creatures should enter Maroc's current room.
|
Prev: 54524 | Up: Map | Next: 54782 |