Prev: C77D Up: Map Next: C7CF
C794: Draw Lives Display
Used by the routines at CheckScoreAwardLife and RenderHUD.
Refreshes the on-screen life icons. Runs 07 passes of Erase_Life_Icon_Cells (masked clear) with glyph code 1B vertical seed *Wave and step *Lives_Display_Vertical_Step. If *Lives is zero, returns; else D is the lives count capped at 07 the vertical seed is reloaded from *Wave, and that many OR-blits run via Draw_Life_Icon_Cells with the same glyph and stride. Called from RenderHUD and CheckScoreAwardLife.
DrawLivesDisplay C794 LD D,$07 D=07 (fixed passes for the clear / background phase).
C796 LD A,($C416) E=*Wave (initial vertical parameter for the first phase).
C799 LD E,A
Seven stacked clears using Erase_Life_Icon_Cells (CPL and AND into the display file).
DrawLivesDisplay_ClearLoop C79A PUSH DE Stash DE on the stack.
C79B LD A,$1B A=1B (life-icon character / glyph selector).
C79D LD B,E B=E (vertical argument for the blit helper).
C79E LD C,$00 C=00.
C7A0 CALL Erase_Life_Icon_Cells Call Erase_Life_Icon_Cells (masked clear at this cell).
C7A3 POP DE Restore DE from the stack.
C7A4 LD A,($C417) A=*Lives_Display_Vertical_Step (vertical spacing between stacked slots).
C7A7 ADD A,E Add E to A.
C7A8 LD E,A E=A (advance the vertical parameter).
C7A9 DEC D Decrement D.
C7AA JP NZ,DrawLivesDisplay_ClearLoop Loop back to DrawLivesDisplay_ClearLoop until all 07 clear passes finish.
C7AD LD HL,$C415 HL=Lives (lives counter).
C7B0 LD A,(HL) A=*HL.
C7B1 AND A Return if there are no lives to draw.
C7B2 RET Z
C7B3 CP $08 Compare with 08.
C7B5 JR C,DrawLivesDisplay_CountReady Jump to DrawLivesDisplay_CountReady if the count is below 08 (use it as-is).
C7B7 LD A,$07 A=07 (cap at seven visible life icons).
DrawLivesDisplay_CountReady C7B9 LD D,A D=A (number of OR-blits to perform).
C7BA INC HL Advance HL to Wave (vertical seed for the draw phase).
C7BB LD E,(HL) E=*HL.
Each iteration OR-merges a life glyph via Draw_Life_Icon_Cells (see Draw_Life_Icon_Cells).
DrawLivesDisplay_DrawLoop C7BC PUSH DE Stash DE on the stack.
C7BD LD A,$1B A=1B.
C7BF LD B,E B=E.
C7C0 LD C,$00 C=00.
C7C2 CALL Draw_Life_Icon_Cells Call Draw_Life_Icon_Cells (OR-blit at this cell).
C7C5 POP DE Restore DE from the stack.
C7C6 LD A,($C417) A=*Lives_Display_Vertical_Step.
C7C9 ADD A,E Add E to A.
C7CA LD E,A E=A (advance the vertical parameter).
C7CB DEC D Decrement D.
C7CC JR NZ,DrawLivesDisplay_DrawLoop Loop back to DrawLivesDisplay_DrawLoop while more icons remain.
C7CE RET Return.
Prev: C77D Up: Map Next: C7CF