Prev: A6C9 Up: Map Next: A6FC
A6EA: Swap Player States
Used by the routines at CheckTopScore, SetUpPlayers and CheckSheriffLost.
Exchanges the nineteen bytes of state for the current player, which start at Bounty, with the nineteen bytes for the other player, which start at OtherPlayerState.
SwapPlayerStates A6EA LD HL,$A257 Point HL at the state of the current player.
A6ED LD DE,$A26A Point DE at OtherPlayerState.
A6F0 LD B,$13 Set the number of bytes to nineteen.
This entry point is used by the routine at CheckTopScore.
This entry point exchanges B bytes at HL with the bytes at DE.
SwapBytes A6F2 LD C,(HL) Fetch a byte from the first block.
A6F3 LD A,(DE) Fetch the matching byte of the second block.
A6F4 LD (HL),A Put it into the first block.
A6F5 LD A,C Take the byte from the first block.
A6F6 LD (DE),A Put it into the second block.
A6F7 INC DE Move on to the next byte of each block.
A6F8 INC HL
A6F9 DJNZ SwapBytes Loop back until every byte has been swapped.
A6FB RET Return.
Prev: A6C9 Up: Map Next: A6FC