Prev: A2E0 Up: Map Next: A2F0
A2E6: 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 A2E6 LD C,(HL) Fetch a byte of the second run.
A2E7 LD A,(DE) Fetch a byte of the first run.
A2E8 LD (HL),A Store it in the second run.
A2E9 LD A,C Fetch the byte of the second run.
A2EA LD (DE),A Store it in the first run.
A2EB INC HL Move onto the next byte of the second run.
A2EC INC DE Move onto the next byte of the first run.
A2ED DJNZ SwapBytes Jump back until all of the bytes have been swapped.
A2EF RET Return.
View the equivalent code in;
Prev: A2E0 Up: Map Next: A2F0