Prev: 42697 Up: Map Next: 42748
42730: 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 42730 LD HL,41559 Point HL at the state of the current player.
42733 LD DE,41578 Point DE at OtherPlayerState.
42736 LD B,19 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 42738 LD C,(HL) Fetch a byte from the first block.
42739 LD A,(DE) Fetch the matching byte of the second block.
42740 LD (HL),A Put it into the first block.
42741 LD A,C Take the byte from the first block.
42742 LD (DE),A Put it into the second block.
42743 INC DE Move on to the next byte of each block.
42744 INC HL
42745 DJNZ SwapBytes Loop back until every byte has been swapped.
42747 RET Return.
Prev: 42697 Up: Map Next: 42748