Prev: 62391 Up: Map Next: 62489
62397: 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 62397 LD E,63 E=63.
62399 CALL MaskMapTable Call MaskMapTable.
62402 LD HL,62951 The current player state.
62405 CALL ResetPlayerState Call ResetPlayerState.
62408 LD HL,63056 The other player state.
62411 CALL ResetPlayerState Call ResetPlayerState.
62414 LD A,5 A=5.
62416 LD (62957),A Update the ships remaining.
62419 LD (63062),A The other player is given five ships.
62422 LD A,153 A=153.
62424 LD (51740),A The players are being set up.
62427 LD A,(51702) The player 1: ships left.
62430 CP 160 Call SwapPlayers if A is 160.
62432 CALL Z,SwapPlayers
62435 XOR A Clear A.
62436 LD (51740),A Player one is up.
62439 LD A,(62178) The two player flag.
62442 AND A Jump to StartNewGame_Controls if A is not zero.
62443 JR NZ,StartNewGame_Controls
62445 LD (63062),A The other player has no ships.
StartNewGame_Controls 62448 LD A,(34570) The control method chosen for player one.
62451 LD (62979),A Update the control device.
62454 LD A,(34573) The control method chosen for player two.
62457 LD (63084),A The other player's control device.
62460 LD B,6 B=6.
62462 LD DE,51696 The player 1 score digits.
62465 LD HL,51712 The player 2 score digits.
62468 LD A,26 A=26.
StartNewGame_Loop 62470 LD (DE),A Write A where DE points.
62471 LD (HL),A Write A where HL points.
62472 INC HL Advance HL.
62473 INC DE Advance DE.
62474 DJNZ StartNewGame_Loop Decrease B and jump to StartNewGame_Loop until none remain.
62476 LD DE,62980 The item sites.
62479 CALL ChooseItemSites Call ChooseItemSites.
62482 LD DE,63085 The other player's item sites.
62485 CALL ChooseItemSites Call ChooseItemSites.
62488 RET Return.
Prev: 62391 Up: Map Next: 62489