| Routines

898B: Draw the remaining lives

Used by the routine at 89AD.
898B | LD A,($85CC) | Pick up the number of lives remaining from 85CC
898E | LD HL,$50A0 | Set HL to the display file address at which to draw the first Willy sprite
8991 | OR A | Are there any lives remaining?
8992 | RET Z | Return if not
8993 | LD B,A | Initialise B to the number of lives remaining
The sprite-drawing loop begins.
8994 | LD C,$00 | C=0; this tells the sprite-drawing routine at 9456 to overwrite any existing graphics
8996 | PUSH HL | Save HL and BC briefly
8997 | PUSH BC
8998 | LD A,($85E1) | Pick up the in-game music note index from 85E1; this will determine the animation frame for the Willy sprites
899B | RLCA | Now A=0x00 (frame 0), 0x20 (frame 1), 0x40 (frame 2) or 0x60 (frame 3)
899C | RLCA
899D | RLCA
899E | AND $60
89A0 | LD E,A | Point DE at the corresponding Willy sprite (at 9D00+A)
89A1 | LD D,$9D
89A3 | CALL $9456 | Draw the Willy sprite on the screen
89A6 | POP BC | Restore HL and BC
89A7 | POP HL
89A8 | INC HL | Move HL along to the location at which to draw the next Willy sprite
89A9 | INC HL
89AA | DJNZ $8994 | Jump back to draw any remaining sprites
89AC | RET |