Prev: F3B7 Up: Map Next: F419
F3BD: Start New Game
Used by the routine at RunGame.
Sets up a new game: the objects on the map are all put back, the state of both players is reset and each player is given five ships. If the players were swapped by the last game they are swapped back, the second player is given no ships in a game with one player, the control devices that were chosen by the menu are copied for the players, the scores are set to zero and the sites of the items are chosen for both players.
StartNewGame F3BD LD E,$3F E=3F.
F3BF CALL MaskMapTable Call MaskMapTable.
F3C2 LD HL,$F5E7 The current player state.
F3C5 CALL ResetPlayerState Call ResetPlayerState.
F3C8 LD HL,$F650 The other player state.
F3CB CALL ResetPlayerState Call ResetPlayerState.
F3CE LD A,$05 A=05.
F3D0 LD ($F5ED),A Update the ships remaining.
F3D3 LD ($F656),A The other player is given five ships.
F3D6 LD A,$99 A=99.
F3D8 LD ($CA1C),A The players are being set up.
F3DB LD A,($C9F6) The player 1: ships left.
F3DE CP $A0 Call SwapPlayers if A is A0.
F3E0 CALL Z,SwapPlayers
F3E3 XOR A Clear A.
F3E4 LD ($CA1C),A Player one is up.
F3E7 LD A,($F2E2) The two player flag.
F3EA AND A Jump to StartNewGame_Controls if A is not zero.
F3EB JR NZ,StartNewGame_Controls
F3ED LD ($F656),A The other player has no ships.
StartNewGame_Controls F3F0 LD A,($870A) The control method chosen for player one.
F3F3 LD ($F603),A Update the control device.
F3F6 LD A,($870D) The control method chosen for player two.
F3F9 LD ($F66C),A The other player's control device.
F3FC LD B,$06 B=06.
F3FE LD DE,$C9F0 The player 1 score digits.
F401 LD HL,$CA00 The player 2 score digits.
F404 LD A,$1A A=1A.
StartNewGame_Loop F406 LD (DE),A Write A where DE points.
F407 LD (HL),A Write A where HL points.
F408 INC HL Advance HL.
F409 INC DE Advance DE.
F40A DJNZ StartNewGame_Loop Decrease B and jump to StartNewGame_Loop until none remain.
F40C LD DE,$F604 The item sites.
F40F CALL ChooseItemSites Call ChooseItemSites.
F412 LD DE,$F66D The other player's item sites.
F415 CALL ChooseItemSites Call ChooseItemSites.
F418 RET Return.
Prev: F3B7 Up: Map Next: F419