![]() |
Routines |
| Prev: 63F0 | Up: Map | Next: 6428 |
|
Used by the routines at NewGame and HandleEndOfLife.
Swaps the data for the active player (ActivePlayer_Level) with the data for the other player (InactivePlayer_Level).
|
||||
|
This routine "swaps" the data between DE and HL.
|
||||
| ChangePlayer | 6416 | LD HL,$5F2D | Point HL at the data for the active player. | |
| 6419 | LD DE,$5F31 | Point DE at InactivePlayer_Level. | ||
| 641C | LD B,$04 | Set the counter to 04 (the level, lives, ingredients needed and level number). | ||
|
This looks complicated but it's just grabbing the data from DE, grabbing the data from HL, and writing the others data to each one.
|
||||
| ChangePlayer_States | 641E | LD A,(DE) | Fetch a byte of the data for the inactive player. | |
| 641F | LD C,(HL) | Fetch the matching byte of the data for the active player. | ||
| 6420 | LD (HL),A | Give the active player the byte from the inactive player. | ||
| 6421 | LD A,C | Give the inactive player the byte from the active player. | ||
| 6422 | LD (DE),A | |||
| 6423 | INC HL | Move onto the next byte of data for both players. | ||
| 6424 | INC DE | |||
| 6425 | DJNZ ChangePlayer_States | Decrease the counter by one and loop back to ChangePlayer_States until all four bytes have been swapped. | ||
| 6427 | RET | Return. | ||
|
View the equivalent code in;
|
||||
| Prev: 63F0 | Up: Map | Next: 6428 |