Prev: 29463 Up: Map Next: 29621
29560: 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 2 pixels to the right.
Before After
display-lives-before display-lives-after
DisplayPlayerLives 29560 LD HL,2 Write 0002 to CharlieLastMovement (Charlie's last movement).
29563 LD (24363),HL
Controller for 1UP lives.
DisplayPlayerLives_1UP 29566 LD HL,64 Call ScreenAddress with 0064 (the pixel co-ordinates for the 1UP lives) to get the screen address.
29569 CALL ScreenAddress
29572 CALL FetchLives_1UP Fetch the lives of 1UP using FetchLives_1UP.
29575 AND A If 1UP lives are zero, jump to Handler1UPNoLives.
29576 JR Z,Handler1UPNoLives
29578 CALL HandlerDisplayLives Else, there are lives to display so call HandlerDisplayLives.
Controller for 2UP lives.
Controller2UPLives 29581 LD HL,176 Call ScreenAddress with 0176 (the pixel co-ordinates for the 2UP lives) to get the screen address.
29584 CALL ScreenAddress
29587 CALL FetchLives_2UP Fetch the lives of 2UP using FetchLives_2UP.
29590 AND A If 2UP lives are zero, jump to Handler2UPNoLives.
29591 JR Z,Handler2UPNoLives
Handles displaying the lives count and UDG character.
HandlerDisplayLives 29593 ADD A,48 Add 48 to convert to an ASCII character (starting at "0").
29595 CALL PrintScreen Print the digit using PrintScreen.
29598 LD DE,29621 Point DE at the lives icon (UDG_Life).
29601 PUSH BC Stash BC and DE on the stack.
29602 PUSH DE
29603 JP PrintCharacter_Draw Jump to PrintCharacter_Draw to print the icon.
1UP has no lives.
Handler1UPNoLives 29606 CALL Handler2UPNoLives Print two spaces using Handler2UPNoLives.
29609 JR Controller2UPLives Jump to Controller2UPLives.
2UP has no lives.
Handler2UPNoLives 29611 LD A,32 Fetch a space.
29613 CALL PrintScreen Print the space using PrintScreen.
29616 LD A,32 Fetch a space.
29618 JP PrintScreen Print a second space using PrintScreen.
View the equivalent code in;
Prev: 29463 Up: Map Next: 29621