![]() |
Routines |
| Prev: 25584 | Up: Map | Next: 25640 |
|
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 | 25622 | LD HL,24365 | Point HL at the data for the active player. | |
| 25625 | LD DE,24369 | Point DE at InactivePlayer_Level. | ||
| 25628 | LD B,4 | Set the counter to 4 (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 | 25630 | LD A,(DE) | Fetch a byte of the data for the inactive player. | |
| 25631 | LD C,(HL) | Fetch the matching byte of the data for the active player. | ||
| 25632 | LD (HL),A | Give the active player the byte from the inactive player. | ||
| 25633 | LD A,C | Give the inactive player the byte from the active player. | ||
| 25634 | LD (DE),A | |||
| 25635 | INC HL | Move onto the next byte of data for both players. | ||
| 25636 | INC DE | |||
| 25637 | DJNZ ChangePlayer_States | Decrease the counter by one and loop back to ChangePlayer_States until all four bytes have been swapped. | ||
| 25639 | RET | Return. | ||
|
View the equivalent code in;
|
||||
| Prev: 25584 | Up: Map | Next: 25640 |