Prev: 62947 Up: Map Next: 63041
62956: 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 8 (character row 1): 1UP starts at X=72 (column 9) and 2UP starts at X=160 (column 20).
PrintPlayerLevels 62956 LD HL,2120 Set the 1UP level pixel co-ordinates in HL (Y=8 X=72).
62959 CALL ColourLevelsGreen Call ColourLevelsGreen to colour the three level characters green.
Colour the 2UP level green.
62962 LD HL,2208 Set the 2UP level pixel co-ordinates in HL (Y=8 X=160).
62965 CALL ColourLevelsGreen Call ColourLevelsGreen to colour the three level characters green.
Is the active player 1UP or 2UP?
62968 LD A,(24165) If Flag_ActivePlayer is not zero, jump to Handler_PrintPlayerLevels.
62971 AND A
62972 JR NZ,Handler_PrintPlayerLevels
Handler for printing the 1UP (active) level followed by the 2UP (inactive) level.
62974 LD HL,2120 Set the 1UP level pixel co-ordinates in HL (Y=8 X=72).
62977 CALL Print_ActivePlayerLevel Call Print_ActivePlayerLevel.
62980 LD HL,2208 Set the 2UP level pixel co-ordinates in HL (Y=8 X=160).
62983 JR Print_InactivePlayerLevel Jump to Print_InactivePlayerLevel.
Handler for printing the 1UP (inactive) level followed by the 2UP (active) level.
Handler_PrintPlayerLevels 62985 LD HL,2120 Set the 1UP level pixel co-ordinates in HL (Y=8 X=72).
62988 CALL Print_InactivePlayerLevel Call Print_InactivePlayerLevel.
Handles the 2UP level.
62991 LD HL,2208 Set the 2UP level pixel co-ordinates in HL (Y=8 X=160).
Handles displaying "level" for the active player.
Print_ActivePlayerLevel 62994 LD A,76 A=76.
62996 CALL PrintLevelMessaging Call PrintLevelMessaging.
62999 CALL Calculate_ActivePlayer_Level Call Calculate_ActivePlayer_Level.
Prints the first digit (held in A from B).
PrintLevel 63002 PUSH BC Stash BC on the stack.
63003 ADD A,48 Add 48 to convert to an ASCII character (starting at "0").
63005 CALL PrintLevelMessaging Call PrintLevelMessaging.
63008 POP BC Restore BC from the stack.
Now move onto the second digit held in C.
63009 LD A,C A=C.
63010 ADD A,48 Add 48 to convert to an ASCII character (starting at "0").
63012 CALL PrintLevelMessaging Call PrintLevelMessaging.
63015 RET Return.
Handles displaying "level" for the inactive player.
Print_InactivePlayerLevel 63016 LD A,76 A=76.
63018 CALL PrintLevelMessaging Call PrintLevelMessaging.
63021 CALL Calculate_InactivePlayer_Level Call Calculate_InactivePlayer_Level.
63024 JR PrintLevel Jump to PrintLevel.
Keep HL (pixel co-ordinates) and AF (the ASCII character to print) for later.
PrintLevelMessaging 63026 PUSH HL Stash HL and AF on the stack.
63027 PUSH AF
63028 CALL ScreenAddress Call ScreenAddress.
Fetch the ASCII character we want to print from the stack.
63031 POP AF Restore AF from the stack.
63032 CALL PrintScreen Call PrintScreen.
Restore the pixel co-ordinates from the stack, and move onto the next character column.
63035 POP HL Restore HL from the stack.
63036 LD A,L L=L+8.
63037 ADD A,8
63039 LD L,A
63040 RET Return.
Prev: 62947 Up: Map Next: 63041