Manic Miner: Routine at 36266

| Routines

36266: Draw the horizontal guardians in the current cavern

Used by the routine at 34574.
36266 | LD IY,32958 | Point IY at the first byte of the first horizontal guardian definition at 32958
The guardian-drawing loop begins here.
36270 | LD A,(IY+0) | Pick up the first byte of the guardian definition
36273 | CP 255 | Have we dealt with all the guardians yet?
36275 | RET Z | Return if so
36276 | OR A | Is this guardian definition blank?
36277 | JR Z,36337 | If so, skip it and consider the next one
36279 | LD DE,31 | Prepare DE for addition
36282 | LD L,(IY+1) | Point HL at the address of the guardian's location in the attribute buffer at 23552
36285 | LD H,(IY+2)
36288 | AND 127 | Reset bit 7 (which specifies the animation speed) of the attribute byte, ensuring no FLASH
36290 | LD (HL),A | Set the attribute bytes for the guardian in the buffer at 23552
36291 | INC HL
36292 | LD (HL),A
36293 | ADD HL,DE
36294 | LD (HL),A
36295 | INC HL
36296 | LD (HL),A
36297 | LD C,1 | Prepare C for the call to the drawing routine at 36852 later on
36299 | LD A,(IY+4) | Pick up the animation frame (0-7)
36302 | RRCA | Multiply it by 32
36303 | RRCA
36304 | RRCA
36305 | LD E,A | Copy the result to E
36306 | LD A,(33799) | Pick up the number of the current cavern from 33799
36309 | CP 7 | Are we in one of the first seven caverns?
36311 | JR C,36323 | Jump if so
36313 | CP 9 | Are we in The Endorian Forest?
36315 | JR Z,36323 | Jump if so
36317 | CP 15 | Are we in The Sixteenth Cavern?
36319 | JR Z,36323 | Jump if so
36321 | SET 7,E | Add 128 to E (the horizontal guardians in this cavern use frames 4-7 only)
36323 | LD D,129 | Point DE at the graphic data for the appropriate guardian sprite (at 33024+E)
36325 | LD L,(IY+1) | Point HL at the address of the guardian's location in the screen buffer at 24576
36328 | LD H,(IY+3)
36331 | CALL 36852 | Draw the guardian to the screen buffer at 24576
36334 | JP NZ,36102 | Kill Willy if the guardian collided with him
The current guardian definition has been dealt with. Time for the next one.
36337 | LD DE,7 | Point IY at the first byte of the next horizontal guardian definition
36340 | ADD IY,DE
36342 | JR 36270 | Jump back to deal with the next horizontal guardian