swap
Syntax:
SWAP variable1, variable2
Function:
Swap the values between two variables.
Information:
The swap command simply exchanges values between two variables.
Example:
b1 = 5
b2 = 10
main:
swap b1,b2
debug
pause 1000
goto main
Poke <RAM>, bx
bx = by
Peek <RAM>, by
Thanks,b0 = x
b1 = y
' now swap
b0 = b0 + b1 ' variables hold (x+y) and y
b1 = b0 - b1 ' variables hold (x+y) and x
b0 = b0 - b1 ' variables hold y and x
Try it and see the magic at work
...provided b0+b1 is no larger than 255