Prev: 24797 Up: Map Next: 24967
24938: 1UP/ 2UP Swapper
Used by the routines at PlayerReset and ResetPlayers.
This routine "swaps" the data between DE and HL.
ChangePlayer 24938 LD HL,24048 HL=ActivePlayer_Level.
24941 LD DE,24056 DE=InactivePlayer_Level.
24944 LD B,2 B=2 (counter).
24946 CALL ChangePlayer_Loop Call ChangePlayer_Loop.
24949 LD HL,23856 HL=ActivePlayerRocket_State.
24952 LD DE,23960 DE=InactivePlayerRocket_State.
24955 LD B,24 B=24 (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 24957 LD A,(DE) A=DE.
24958 LD C,(HL) C=HL.
24959 LD (HL),A Store A at HL.
24960 LD A,C Store C at DE.
24961 LD (DE),A
24962 INC HL Increment both HL and DE by one.
24963 INC DE
24964 DJNZ ChangePlayer_Loop Decrease counter by one and loop back to ChangePlayer_Loop until counter is zero.
24966 RET Return.
View the equivalent code in;
Prev: 24797 Up: Map Next: 24967