Prev: 7317 Up: Map Next: 73B5
7378: Display Lives
Used by the routines at StartLevel and StartLife.
Shows the number of lives which each of the players has, at the top of the screen; the number is followed by the icon for a life. If a player has no lives then their space is blanked. Charlie's last movement (CharlieLastMovement) is also reset to be 02 pixels to the right.
Before After
display-lives-before display-lives-after
DisplayPlayerLives 7378 LD HL,$0002 Write 0002 to CharlieLastMovement (Charlie's last movement).
737B LD ($5F2B),HL
Controller for 1UP lives.
DisplayPlayerLives_1UP 737E LD HL,$0040 Call ScreenAddress with 0040 (the pixel co-ordinates for the 1UP lives) to get the screen address.
7381 CALL ScreenAddress
7384 CALL FetchLives_1UP Fetch the lives of 1UP using FetchLives_1UP.
7387 AND A If 1UP lives are zero, jump to Handler1UPNoLives.
7388 JR Z,Handler1UPNoLives
738A CALL HandlerDisplayLives Else, there are lives to display so call HandlerDisplayLives.
Controller for 2UP lives.
Controller2UPLives 738D LD HL,$00B0 Call ScreenAddress with 00B0 (the pixel co-ordinates for the 2UP lives) to get the screen address.
7390 CALL ScreenAddress
7393 CALL FetchLives_2UP Fetch the lives of 2UP using FetchLives_2UP.
7396 AND A If 2UP lives are zero, jump to Handler2UPNoLives.
7397 JR Z,Handler2UPNoLives
Handles displaying the lives count and UDG character.
HandlerDisplayLives 7399 ADD A,$30 Add 30 to convert to an ASCII character (starting at "0").
739B CALL PrintScreen Print the digit using PrintScreen.
739E LD DE,$73B5 Point DE at the lives icon (UDG_Life).
73A1 PUSH BC Stash BC and DE on the stack.
73A2 PUSH DE
73A3 JP PrintCharacter_Draw Jump to PrintCharacter_Draw to print the icon.
1UP has no lives.
Handler1UPNoLives 73A6 CALL Handler2UPNoLives Print two spaces using Handler2UPNoLives.
73A9 JR Controller2UPLives Jump to Controller2UPLives.
2UP has no lives.
Handler2UPNoLives 73AB LD A,$20 Fetch a space.
73AD CALL PrintScreen Print the space using PrintScreen.
73B0 LD A,$20 Fetch a space.
73B2 JP PrintScreen Print a second space using PrintScreen.
View the equivalent code in;
Prev: 7317 Up: Map Next: 73B5