![]() |
Routines |
Prev: 45598 | Up: Map | Next: 45675 |
This routine "swaps" the data between DE and HL.
|
||||
ChangePlayer | 45621 | LD A,(38558) | A=Flag_ActivePlayer. | |
45624 | CPL | Flip the bits. | ||
45625 | LD (38558),A | Write this back to Flag_ActivePlayer. | ||
These are all the player states.
|
||||
45628 | LD HL,38588 | HL=38588 | ||
45631 | LD DE,38623 | DE=38623. | ||
45634 | LD BC,35 | BC=35 (counter). | ||
45637 | CALL ChangePlayer_Loop | Call ChangePlayer_Loop. | ||
This is the current "map".
|
||||
45640 | LD HL,56812 | HL=56812. | ||
45643 | LD DE,57324 | DE=57324. | ||
45646 | LD BC,512 | BC=512 (counter). | ||
45649 | CALL ChangePlayer_Loop | Call ChangePlayer_Loop. | ||
And this is the active sprites.
|
||||
45652 | LD HL,38658 | HL=ImmortalData. | ||
45655 | LD DE,38958 | DE=38958. | ||
45658 | LD BC,300 | BC=300 (counter). | ||
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_Loop | 45661 | LD A,(DE) | Fetch a byte from DE and store it in A. | |
45662 | EX AF,AF' | Switch to the shadow AF register. | ||
45663 | LD A,(HL) | Copy a byte from HL and write it to DE. | ||
45664 | LD (DE),A | |||
45665 | EX AF,AF' | Switch back to the normal AF register. | ||
45666 | LD (HL),A | Write the byte held in A (orginally from DE) into HL. | ||
45667 | INC DE | Increment DE by one. | ||
45668 | INC HL | Increment HL by one. | ||
45669 | DEC BC | Decrease C by one. | ||
45670 | LD A,B | Loop back to ChangePlayer_Loop until the counter in BC is zero. | ||
45671 | OR C | |||
45672 | JR NZ,ChangePlayer_Loop | |||
45674 | RET | Return. | ||
View the equivalent code in;
|
Prev: 45598 | Up: Map | Next: 45675 |