Prev: 9A22 Up: Map Next: 9AA5
9A4B: Win Round
Used by the routine at MainLoop.
Shows the message that is used when every sector has been activated and plays the victory tune. The robot then starts a new round on a fresh map with two more lives, up to a maximum of nine.
WinRound 9A4B LD A,$47 Use bright white on black as the attribute.
9A4D CALL ClearPlayWindowWithAttributes Clear the play window using ClearPlayWindowWithAttributes.
9A50 LD DE,$9B70 Point DE' at the attributes of the five lines of text (see VictoryMessage_Attributes).
9A53 EXX Switch to the shadow registers, as PrintTextList expects the attributes there.
9A54 LD HL,$9B75 Point HL at VictoryMessage_Coordinates.
9A57 LD DE,$9B7F Point DE at VictoryMessage_Text.
9A5A LD B,$05 There are five lines to print.
9A5C CALL PrintTextList Print them using PrintTextList.
This entry point is used by the routine at EndRound.
The game comes here when the player has activated eight sectors and destroyed the last one.
WinRound_Tune 9A5F LD DE,$C2A7 Point DE at the tune that is played when the round is won.
9A62 CALL PlayMusic Play it using PlayMusic.
9A65 CALL DrawGameScreen Reset the map and the screen for a new round using DrawGameScreen.
9A68 LD HL,$968B Point HL at Lives.
9A6B LD A,(HL) Fetch the number of lives.
9A6C ADD A,$02 Add two lives.
9A6E CP $09 Jump if the total is below 09.
9A70 JR C,WinRound_StoreLives
9A72 LD A,$09 Otherwise limit it to nine lives.
WinRound_StoreLives 9A74 LD (HL),A Store the number of lives.
9A75 LD HL,$9621 Point HL at the variables that describe the state of the previous round.
9A78 LD BC,$0069 There are 69 bytes to clear.
9A7B CALL FillMemory Zero them using FillMemory.
9A7E LD HL,$9690 Point HL at Entities.
9A81 LD BC,$0130 The first 13 entities are cleared. The rest are templates for the map.
9A84 CALL FillMemory Zero them using FillMemory.
9A87 LD A,$47 Use bright white on black as the attribute.
9A89 CALL ClearPlayWindowWithAttributes Clear the play window using ClearPlayWindowWithAttributes.
9A8C CALL SetRobotFacing Set the number of the sprite shown when the robot is starting using SetRobotFacing.
9A8F CALL StartRobot Put the robot back at the start using StartRobot.
9A92 XOR A Set the displayed battery level to zero, so that the bar fills up from the left.
9A93 LD ($963C),A
9A96 CALL DrawSectorMap Colour the cells of the sector map using DrawSectorMap.
9A99 CALL DrawPanel Draw the panel using DrawPanel.
9A9C CALL PrintScore Print the score using PrintScore.
9A9F CALL PrintHiScore Print the hi-score using PrintHiScore.
9AA2 JP StartRound Start the round using StartRound.
Prev: 9A22 Up: Map Next: 9AA5