Prev: 8947 Up: Map Next: 899C
894F: Display Lives
Used by the routines at 8FF4, 9EDC and LevelNew.
Controller for 1UP lives.
DisplayPlayerLives 894F LD HL,$0040 Call ScreenAddress with 0040 (screen buffer address) for 1UP lives.
8952 CALL ScreenAddress
8955 CALL ControllerActiveLives A=1UP lives remaining (by calling ControllerActiveLives).
8958 AND A If 1UP lives are zero, jump to Handler1UPNoLives.
8959 JR Z,Handler1UPNoLives
895B CALL HandlerDisplayLives Else, there are lives to display so call HandlerDisplayLives.
Controller for 2UP lives.
Controller2UPLives 895E LD HL,$00B0 Call ScreenAddress with 00B0 (screen buffer address) for 2UP lives.
8961 CALL ScreenAddress
8964 CALL ControllerInactiveLives A=2UP lives remaining (by calling ControllerInactiveLives).
8967 AND A If 2UP lives are zero, jump to Handler2UPNoLives.
8968 JR Z,Handler2UPNoLives
Handles displaying the lives count and UDG character.
HandlerDisplayLives 896A ADD A,$30 Add 30 to convert to an ASCII character (starting at "0" character).
896C CALL PrintScreen Call PrintScreen.
896F LD DE,$D151 DE=UDG_Life.
8972 PUSH BC Stash BC and DE on the stack.
8973 PUSH DE
8974 JP PrintScreen_0 Jump to PrintScreen_0.
1UP has no lives.
Handler1UPNoLives 8977 CALL Handler2UPNoLives Call Handler2UPNoLives.
897A JR Controller2UPLives Jump to Controller2UPLives.
2UP has no lives.
Handler2UPNoLives 897C LD A,$20 A=ASCII " " (SPACE).
897E CALL PrintScreen Call PrintScreen.
8981 LD A,$20 A=ASCII " " (SPACE).
8983 JP PrintScreen Jump to PrintScreen.
Controller for the currently active player.
ControllerActiveLives 8986 LD A,($5E65) If Flag_ActivePlayer is not zero then jump to InactivePlayerLives.
8989 AND A
898A JR NZ,InactivePlayerLives
Return currently active players lives left.
ActivePlayerLives 898C LD A,($5EA1) A=ActivePlayer_Lives.
898F RET Return.
Return inactive players lives left.
InactivePlayerLives 8990 LD A,($5EA5) A=InactivePlayer_Lives.
8993 RET Return.
Controller for the inactive player.
ControllerInactiveLives 8994 LD A,($5E65) If Flag_ActivePlayer is zero then jump to InactivePlayerLives.
8997 AND A
8998 JR Z,InactivePlayerLives
899A JR ActivePlayerLives Jump to ActivePlayerLives.
View the equivalent code in;
Prev: 8947 Up: Map Next: 899C