Big question ..HC11

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View


Hello friends,

This is virgin Peter writing ..

How do I transfer the content of A to X ?

Hope i have phrased this right ..

Thanks



Re: Big question ..HC11
Quoted text here. Click to load it

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


Re: Big question ..HC11

Quoted text here. Click to load it

PSHA
CLRA
PSHA
PULX

or similar

Will cause less angst at the next RTS.

Cheers,
Alf
snipped-for-privacy@remove.the.obvious.ieee.org
www.micromagic.net.au



Re: Big question ..HC11
Thanks guys.

Quoted text here. Click to load it



Re: Big question ..HC11

Quoted text here. Click to load it

Or what you more often want to do:

PSHB
PSHA
PULX

Re: Big question ..HC11
I'd forgotten that X is 16 bits. Must have been in 6502 mode. *sigh*


Re: Big question ..HC11


Quoted text here. Click to load it
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


Site Timeline