![]() |
Routines |
Prev: 36101 | Up: Map |
Used by the routine at 34574.
|
|||||||
36111 | LD IY,32958 | Point IY at the first byte of the first horizontal guardian definition at 32958 | |||||
36115 | LD DE,7 | Prepare DE for addition (there are 7 bytes in a guardian definition) | |||||
The guardian-moving loop begins here.
|
|||||||
36118 | LD A,(IY+0) | Pick up the first byte of the guardian definition | |||||
36121 | CP 255 | Have we dealt with all the guardians yet? | |||||
36123 | RET Z | Return if so | |||||
36124 | OR A | Is this guardian definition blank? | |||||
36125 | JR Z,36207 | If so, skip it and consider the next one | |||||
36127 | LD A,(32957) | Pick up the value of the game clock at 32957 | |||||
36130 | AND 4 | Move bit 2 (which is toggled on each pass through the main loop) to bit 7 and clear all the other bits | |||||
36132 | RRCA | ||||||
36133 | RRCA | ||||||
36134 | RRCA | ||||||
36135 | AND (IY+0) | Combine this bit with bit 7 of the first byte of the guardian definition, which specifies the guardian's animation speed: 0=normal, 1=slow | |||||
36138 | JR NZ,36207 | Jump to consider the next guardian if this one is not due to be moved on this pass | |||||
The guardian will be moved on this pass.
|
|||||||
36140 | LD A,(IY+4) | Pick up the current animation frame (0-7) | |||||
36143 | CP 3 | Is it 3 (the terminal frame for a guardian moving right)? | |||||
36145 | JR Z,36163 | Jump if so to move the guardian right across a cell boundary or turn it round | |||||
36147 | CP 4 | Is the current animation frame 4 (the terminal frame for a guardian moving left)? | |||||
36149 | JR Z,36186 | Jump if so to move the guardian left across a cell boundary or turn it round | |||||
36151 | JR NC,36158 | Jump if the animation frame is 5, 6 or 7 | |||||
36153 | INC (IY+4) | Increment the animation frame (this guardian is moving right) | |||||
36156 | JR 36207 | Jump forward to consider the next guardian | |||||
36158 | DEC (IY+4) | Decrement the animation frame (this guardian is moving left) | |||||
36161 | JR 36207 | Jump forward to consider the next guardian | |||||
36163 | LD A,(IY+1) | Pick up the LSB of the address of the guardian's location in the attribute buffer at 23552 | |||||
36166 | CP (IY+6) | Has the guardian reached the rightmost point in its path? | |||||
36169 | JR NZ,36177 | Jump if not | |||||
36171 | LD (IY+4),7 | Set the animation frame to 7 (turning the guardian round to face left) | |||||
36175 | JR 36207 | Jump forward to consider the next guardian | |||||
36177 | LD (IY+4),0 | Set the animation frame to 0 (the initial frame for a guardian moving right) | |||||
36181 | INC (IY+1) | Increment the guardian's x-coordinate (moving it right across a cell boundary) | |||||
36184 | JR 36207 | Jump forward to consider the next guardian | |||||
36186 | LD A,(IY+1) | Pick up the LSB of the address of the guardian's location in the attribute buffer at 23552 | |||||
36189 | CP (IY+5) | Has the guardian reached the leftmost point in its path? | |||||
36192 | JR NZ,36200 | Jump if not | |||||
36194 | LD (IY+4),0 | Set the animation frame to 0 (turning the guardian round to face right) | |||||
36198 | JR 36207 | Jump forward to consider the next guardian | |||||
36200 | LD (IY+4),7 | Set the animation frame to 7 (the initial frame for a guardian moving left) | |||||
36204 | DEC (IY+1) | Decrement the guardian's x-coordinate (moving it left across a cell boundary) | |||||
The current guardian definition has been dealt with. Time for the next one.
|
|||||||
36207 | ADD IY,DE | Point IY at the first byte of the next horizontal guardian definition | |||||
36209 | JR 36118 | Jump back to deal with the next horizontal guardian |
Prev: 36101 | Up: Map |