Hello friends,
This is virgin Peter writing ..
How do I transfer the content of A to X ?
Hope i have phrased this right ..
Thanks
Hello friends,
This is virgin Peter writing ..
How do I transfer the content of A to X ?
Hope i have phrased this right ..
Thanks
There is no direct way. You must use the stack or a temporary variable. PSHA PULX - or - STA xx LDX xx
PSHA CLRA PSHA PULX
or similar
Will cause less angst at the next RTS.
Cheers, Alf snipped-for-privacy@remove.the.obvious.ieee.org
Thanks guys.
A is 8 bits and X is 16 bits. Assuming you want A in the least significant 8 bits of X then one way is:
PSHA CLRA PSHA PULX
which looses the content of A or
PSHA PSHA CLRA PSHA PULX PULA
which perserves A. Another way is
TAB CLRA XGDX
moves A into B (low 16 bits of D) and clears A (hi 16 bits of D) then exchanges D and X. This clobbers B.
Or use load and store instructions to a scratch location.
Many ways to skin this cat.
Dave Rooney
Or what you more often want to do:
PSHB PSHA PULX
I'd forgotten that X is 16 bits. Must have been in 6502 mode. *sigh*
ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.