Prev: 41696 Up: Map Next: 41712
41702: Swap Bytes
Used by the routine at SwitchPlayer.
Swaps the contents of two runs of bytes.
Input
B The number of bytes
DE The address of the first run
HL The address of the second run
SwapBytes 41702 LD C,(HL) Fetch a byte of the second run.
41703 LD A,(DE) Fetch a byte of the first run.
41704 LD (HL),A Store it in the second run.
41705 LD A,C Fetch the byte of the second run.
41706 LD (DE),A Store it in the first run.
41707 INC HL Move onto the next byte of the second run.
41708 INC DE Move onto the next byte of the first run.
41709 DJNZ SwapBytes Jump back until all of the bytes have been swapped.
41711 RET Return.
View the equivalent code in;
Prev: 41696 Up: Map Next: 41712