| Routines

35211: Draw the remaining lives

Used by the routine at 35245.
35211 | LD A,(34252) | Pick up the number of lives remaining from 34252
35214 | LD HL,20640 | Set HL to the display file address at which to draw the first Willy sprite
35217 | OR A | Are there any lives remaining?
35218 | RET Z | Return if not
35219 | LD B,A | Initialise B to the number of lives remaining
The sprite-drawing loop begins.
35220 | LD C,0 | C=0; this tells the sprite-drawing routine at 37974 to overwrite any existing graphics
35222 | PUSH HL | Save HL and BC briefly
35223 | PUSH BC
35224 | LD A,(34273) | Pick up the in-game music note index from 34273; this will determine the animation frame for the Willy sprites
35227 | RLCA | Now A=0 (frame 0), 32 (frame 1), 64 (frame 2) or 96 (frame 3)
35228 | RLCA
35229 | RLCA
35230 | AND 96
35232 | LD E,A | Point DE at the corresponding Willy sprite (at 40192+A)
35233 | LD D,157
35235 | CALL 37974 | Draw the Willy sprite on the screen
35238 | POP BC | Restore HL and BC
35239 | POP HL
35240 | INC HL | Move HL along to the location at which to draw the next Willy sprite
35241 | INC HL
35242 | DJNZ 35220 | Jump back to draw any remaining sprites
35244 | RET |