![]() |
Routines |
Prev: 67F6 | Up: Map | Next: 6845 |
|
||||
PrintLives | 681C | LD DE,$4008 | Set the screen buffer position to 4008 (where the life icons start being displayed). | |
681F | LD A,($66F0) | Load the number of lives from *Player_Lives, subtract one and store the result in C. | ||
6822 | DEC A | |||
6823 | LD C,A | |||
6824 | LD B,$05 | Set a counter in B for 05 icon positions. | ||
PrintLives_Loop | 6826 | DEC C | Decrease the lives counter by one. | |
6827 | PUSH BC | Stash the loop counters and screen buffer position on the stack. | ||
6828 | PUSH DE | |||
6829 | LD A,$05 | Jump to PrintLifeIcon if the position should show a life icon. | ||
682B | CP C | |||
682C | JR NC,PrintLifeIcon | |||
682E | LD HL,$613D | Point HL to the blank mask graphic at Mask_LivesIcon. | ||
6831 | JR PrintLives_DrawIcon | Jump to PrintLives_DrawIcon. | ||
Print a "life" icon.
![]() |
||||
PrintLifeIcon | 6833 | LD HL,$6026 | HL=Graphics_LivesIcon. | |
PrintLives_DrawIcon | 6836 | LD B,$08 | Set a line counter in B (08 lines in a UDG). | |
PrintLives_LineLoop | 6838 | LD A,(HL) | Copy the UDG data to the screen buffer. | |
6839 | LD (DE),A | |||
683A | INC HL | Move to the next UDG graphic data byte. | ||
683B | INC D | Move down one pixel line in the screen buffer. | ||
683C | DJNZ PrintLives_LineLoop | Decrease the line counter by one and loop back to PrintLives_LineLoop until all 08 lines of the UDG character have been drawn. | ||
683E | POP DE | Restore the original screen buffer position from the stack. | ||
683F | INC DE | Move right two character blocks, ready for printing the next life icon. | ||
6840 | INC DE | |||
6841 | POP BC | Restore the lives counter from the stack. | ||
6842 | 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. | ||
6844 | RET | Return. |
Prev: 67F6 | Up: Map | Next: 6845 |