Prev: 60DD Up: Map Next: 6187
616A: 1UP/ 2UP Swapper.
Used by the routines at PlayerReset and 630F.
This routine "swaps" the data between DE and HL.
ChangePlayer 616A LD HL,$5DF0 HL=ActivePlayer_Level.
616D LD DE,$5DF8 DE=InactivePlayer_Level.
6170 LD B,$02 B=02 (counter).
6172 CALL ChangePlayer_Loop Call ChangePlayer_Loop.
6175 LD HL,$5D30 HL=ActivePlayerRocket_State.
6178 LD DE,$5D98 DE=InactivePlayerRocket_State.
617B LD B,$18 B=18 (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 617D LD A,(DE) A=DE.
617E LD C,(HL) C=HL.
617F LD (HL),A Store A at HL.
6180 LD A,C Store C at DE.
6181 LD (DE),A
6182 INC HL Increment both HL and DE by one.
6183 INC DE
6184 DJNZ ChangePlayer_Loop Decrease counter by one and loop back to ChangePlayer_Loop until counter is zero.
6186 RET Return.
View the equivalent code in;
Prev: 60DD Up: Map Next: 6187