![]() |
Routines |
| Prev: D07E | Up: Map | Next: D0A7 |
|
Swaps the active and inactive player's 44-byte state blocks between the player 1 slot at Player_1_State and the player 2 slot at Player_2_State, using Player_State_Swap_Buffer as a scratch buffer. Called each time the game switches between the two players. The swap is a three-step rotate through the scratch buffer: save active, overwrite active with inactive, restore saved.
|
||||
| Swap_Player_State | D08B | LD HL,$C403 | Save the active player's 44-byte state block to the scratch buffer at Player_State_Swap_Buffer. | |
| D08E | LD DE,$C48B | |||
| D091 | LD BC,$0044 | |||
| D094 | LDIR | |||
| D096 | LD DE,$C403 | Copy the other player's state block from Player_2_State into the active player's slot at Player_1_State. | ||
| D099 | LD BC,$0044 | |||
| D09C | LDIR | |||
| D09E | LD HL,$C48B | Copy the saved state block from Player_State_Swap_Buffer into the other player's slot at Player_2_State. | ||
| D0A1 | LD BC,$0044 | |||
| D0A4 | LDIR | |||
| D0A6 | RET | Return. | ||
| Prev: D07E | Up: Map | Next: D0A7 |