Prev: 26614 Up: Map Next: 26693
26652: Print Lives
Used by the routines at PrintHeader, 29184, 29385 and 31154.
PrintLives 26652 LD DE,16392 Set the screen buffer position to 16392 (where the life icons start being displayed).
26655 LD A,(26352) Load the number of lives from *Player_Lives, subtract one and store the result in C.
26658 DEC A
26659 LD C,A
26660 LD B,5 Set a counter in B for 5 icon positions.
PrintLives_Loop 26662 DEC C Decrease the lives counter by one.
26663 PUSH BC Stash the loop counters and screen buffer position on the stack.
26664 PUSH DE
26665 LD A,5 Jump to PrintLifeIcon if the position should show a life icon.
26667 CP C
26668 JR NC,PrintLifeIcon
26670 LD HL,24893 Point HL to the blank mask graphic at Mask_LivesIcon.
26673 JR PrintLives_DrawIcon Jump to PrintLives_DrawIcon.
Print a "life" icon.
udg24614_66x4
PrintLifeIcon 26675 LD HL,24614 HL=Graphics_LivesIcon.
PrintLives_DrawIcon 26678 LD B,8 Set a line counter in B (8 lines in a UDG).
PrintLives_LineLoop 26680 LD A,(HL) Copy the UDG data to the screen buffer.
26681 LD (DE),A
26682 INC HL Move to the next UDG graphic data byte.
26683 INC D Move down one pixel line in the screen buffer.
26684 DJNZ PrintLives_LineLoop Decrease the line counter by one and loop back to PrintLives_LineLoop until all 8 lines of the UDG character have been drawn.
26686 POP DE Restore the original screen buffer position from the stack.
26687 INC DE Move right two character blocks, ready for printing the next life icon.
26688 INC DE
26689 POP BC Restore the lives counter from the stack.
26690 DJNZ PrintLives_Loop Decrease the lives counter by one and loop back to PrintLives_Loop until all the remaining lives have an icon displayed in the header.
26692 RET Return.
Prev: 26614 Up: Map Next: 26693