Routines |
Prev: 60FD | Up: Map | Next: 6163 |
Used by the routines at Message_Eaten and ResetPlayerData.
|
||||
This routine "swaps" the data between DE and HL.
|
||||
ChangePlayer | 613B | LD HL,$5E37 | HL=ActivePlayer_Level. | |
613E | LD DE,$5E39 | DE=InactivePlayer_Level. | ||
6141 | LD B,$02 | B=02 (counter). | ||
6143 | CALL ChangePlayer_Loop | Call ChangePlayer_Loop. | ||
6146 | LD HL,$5E23 | HL=5E23. | ||
6149 | LD DE,$5E2D | DE=5E2D. | ||
614C | LD B,$0A | B=0A (counter). | ||
614E | CALL ChangePlayer_Loop | Call ChangePlayer_Loop. | ||
6151 | LD HL,$5E44 | HL=5E44. | ||
6154 | LD DE,$5E8C | DE=State_Flower. | ||
6157 | LD B,$28 | B=28 (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 | 6159 | LD A,(DE) | A=DE. | |
615A | LD C,(HL) | C=HL. | ||
615B | LD (HL),A | Store A at HL. | ||
615C | LD A,C | Store C at DE. | ||
615D | LD (DE),A | |||
615E | INC HL | Increase both HL and DE by one. | ||
615F | INC DE | |||
6160 | DJNZ ChangePlayer_Loop | Decrease counter by one and loop back to ChangePlayer_Loop until counter is zero. | ||
6162 | RET | Return. | ||
View the equivalent code in;
|
Prev: 60FD | Up: Map | Next: 6163 |