Big question ..HC11

Hello friends,

This is virgin Peter writing ..

How do I transfer the content of A to X ?

Hope i have phrased this right ..

Thanks

Reply to
Peter Pohlmann
Loading thread data ...

There is no direct way. You must use the stack or a temporary variable. PSHA PULX - or - STA xx LDX xx

Reply to
Gary Kato

PSHA CLRA PSHA PULX

or similar

Will cause less angst at the next RTS.

Cheers, Alf snipped-for-privacy@remove.the.obvious.ieee.org

formatting link

Reply to
Unbeliever

Thanks guys.

Reply to
Peter Pohlmann

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

Reply to
Dave Rooney

Or what you more often want to do:

PSHB PSHA PULX

Reply to
Everett M. Greene

I'd forgotten that X is 16 bits. Must have been in 6502 mode. *sigh*

Reply to
Gary Kato

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.