Prev: 62848 Up: Map Next: 62916
62865: Swap Players
Used by the routines at StartNewGame, LoseLife and GameOver.
Does nothing if the second player has no ships. Otherwise it swaps the state of the two players, and the records for the scores and the numbers of ships that are printed at the top of the screen, so that the state of the player who is up is always at CurrentPlayerState. If the flag at 51740 is 153 it goes no further. If not it changes the number of the player, prints it and clears the playfield.
SwapPlayers 62865 LD A,(63062) The other player's ships.
62868 AND A Return if A is zero.
62869 RET Z
62870 LD DE,62951 The current player state.
62873 LD HL,63056 The other player state.
62876 LD B,105 B=105.
62878 CALL SwapBytes Call SwapBytes.
62881 LD DE,51692 The player 1 score text.
62884 LD HL,51708 The player 2 score text.
62887 LD B,16 B=16.
62889 CALL SwapBytes Call SwapBytes.
62892 LD A,(51740) The current player.
62895 CP 153 Return if A is 153.
62897 RET Z
62898 XOR %00000001 Flip the bits of A that are set in 1.
62900 LD (51740),A The other player is now up.
62903 CALL PrintPlayer Call PrintPlayer.
62906 LD B,8 B=8.
SwapPlayers_Delay 62908 CALL Delay Call Delay.
62911 DJNZ SwapPlayers_Delay Decrease B and jump to SwapPlayers_Delay until none remain.
62913 JP ClearPlayfield Jump to ClearPlayfield.
Prev: 62848 Up: Map Next: 62916