![]() |
Routines |
| Prev: 63E0 | Up: Map | Next: 6416 |
|
Used by the routine at StartGame.
Sets up the data for both players at the start of a game. Both players start with level 00 and four lives. The data for the player who is not active is then changed; the level is set to FF so that when it is the turn of that player NextLevel (which adds one to the level) starts them on level 00 and the lives are made 05 for a two player game or 00 for a one player game.
|
||||
|
Set the level and the lives for both players.
|
||||
| NewGame | 63F0 | LD B,$02 | Set the player counter to 02 (one for each player). | |
| NewGame_Loop | 63F2 | PUSH BC | Stash the player counter on the stack. | |
| 63F3 | XOR A | Write 00 to ActivePlayer_Level. | ||
| 63F4 | LD ($5F2D),A | |||
|
Set both players starting lives.
|
||||
| 63F7 | LD A,$04 | Write 04 to ActivePlayer_Lives. | ||
| 63F9 | LD ($5F2E),A | |||
| 63FC | CALL ChangePlayer | Call ChangePlayer to swap the player data between 1UP and 2UP players. | ||
| 63FF | POP BC | Restore the player counter from the stack. | ||
| 6400 | DJNZ NewGame_Loop | Decrease the player counter by one and loop back to NewGame_Loop until both players have been set up. | ||
|
Note this is +01 to 63F7 as you "spend a life", and 1UP goes first.
|
||||
| 6402 | LD A,$05 | Write 05 to InactivePlayer_Lives. | ||
| 6404 | LD ($5F32),A | |||
|
The level for the other player starts at FF.
|
||||
| 6407 | LD A,$FF | Write FF to InactivePlayer_Level. | ||
| 6409 | LD ($5F31),A | |||
|
Handle a one player game; the other player has no lives.
|
||||
| 640C | LD A,($5F0C) | Fetch the game options. | ||
| 640F | AND %00000001 | Keep only bit 0 (set for a two player game). | ||
| 6411 | RET NZ | Return if this is a two player game. | ||
| 6412 | LD ($5F32),A | Write 00 to the lives of the inactive player (InactivePlayer_Lives). | ||
| 6415 | RET | Return. | ||
|
View the equivalent code in;
|
||||
| Prev: 63E0 | Up: Map | Next: 6416 |