Prev: F5E3 Up: Map Next: F641
F5EC: Print 1UP/ 2UP Levels
Colours the level display for each player green, then prints each player's level as "L" followed by two digits (1UP on the left, 2UP on the right). Flag_ActivePlayer decides which of the active and inactive player levels is used for each.
Colour the 1UP level green. Both levels are on pixel row 08 (character row 01): 1UP starts at X=48 (column 09) and 2UP starts at X=A0 (column 14).
PrintPlayerLevels F5EC LD HL,$0848 Set the 1UP level pixel co-ordinates in HL (Y=08 X=48).
F5EF CALL ColourLevelsGreen Call ColourLevelsGreen to colour the three level characters green.
Colour the 2UP level green.
F5F2 LD HL,$08A0 Set the 2UP level pixel co-ordinates in HL (Y=08 X=A0).
F5F5 CALL ColourLevelsGreen Call ColourLevelsGreen to colour the three level characters green.
Is the active player 1UP or 2UP?
F5F8 LD A,($5E65) If Flag_ActivePlayer is not zero, jump to Handler_PrintPlayerLevels.
F5FB AND A
F5FC JR NZ,Handler_PrintPlayerLevels
Handler for printing the 1UP (active) level followed by the 2UP (inactive) level.
F5FE LD HL,$0848 Set the 1UP level pixel co-ordinates in HL (Y=08 X=48).
F601 CALL Print_ActivePlayerLevel Call Print_ActivePlayerLevel.
F604 LD HL,$08A0 Set the 2UP level pixel co-ordinates in HL (Y=08 X=A0).
F607 JR Print_InactivePlayerLevel Jump to Print_InactivePlayerLevel.
Handler for printing the 1UP (inactive) level followed by the 2UP (active) level.
Handler_PrintPlayerLevels F609 LD HL,$0848 Set the 1UP level pixel co-ordinates in HL (Y=08 X=48).
F60C CALL Print_InactivePlayerLevel Call Print_InactivePlayerLevel.
Handles the 2UP level.
F60F LD HL,$08A0 Set the 2UP level pixel co-ordinates in HL (Y=08 X=A0).
Handles displaying "level" for the active player.
Print_ActivePlayerLevel F612 LD A,$4C A=4C.
F614 CALL PrintLevelMessaging Call PrintLevelMessaging.
F617 CALL Calculate_ActivePlayer_Level Call Calculate_ActivePlayer_Level.
Prints the first digit (held in A from B).
PrintLevel F61A PUSH BC Stash BC on the stack.
F61B ADD A,$30 Add 30 to convert to an ASCII character (starting at "0").
F61D CALL PrintLevelMessaging Call PrintLevelMessaging.
F620 POP BC Restore BC from the stack.
Now move onto the second digit held in C.
F621 LD A,C A=C.
F622 ADD A,$30 Add 30 to convert to an ASCII character (starting at "0").
F624 CALL PrintLevelMessaging Call PrintLevelMessaging.
F627 RET Return.
Handles displaying "level" for the inactive player.
Print_InactivePlayerLevel F628 LD A,$4C A=4C.
F62A CALL PrintLevelMessaging Call PrintLevelMessaging.
F62D CALL Calculate_InactivePlayer_Level Call Calculate_InactivePlayer_Level.
F630 JR PrintLevel Jump to PrintLevel.
Keep HL (pixel co-ordinates) and AF (the ASCII character to print) for later.
PrintLevelMessaging F632 PUSH HL Stash HL and AF on the stack.
F633 PUSH AF
F634 CALL ScreenAddress Call ScreenAddress.
Fetch the ASCII character we want to print from the stack.
F637 POP AF Restore AF from the stack.
F638 CALL PrintScreen Call PrintScreen.
Restore the pixel co-ordinates from the stack, and move onto the next character column.
F63B POP HL Restore HL from the stack.
F63C LD A,L L=L+08.
F63D ADD A,$08
F63F LD L,A
F640 RET Return.
Prev: F5E3 Up: Map Next: F641