Motorola 68HC11 - How do you swap nibbles?

Status
Not open for further replies.

Simple1

New Member
Hi, I'm supposed to do the following:

Load hex 96 into C100, swap the nibbles, and store that into location C200.

So far I figured out how to load the hex 96 into C100 but have no idea how to "Swap the nibbles."

Any help would be great!


So far i have:

LDAA #$96
STAA $C100
 
It will be something like the Rotate Right instructions. At a guess, RORA repeated four times.

Edit, Just checked and RORA is a 9 bit rotation. So you need to use a second register.

Mike.
 
Last edited:
Try this:

LDAA #$96
LDAB #$96
ASLA
ASLA
ASLA
ASLA
ASRB
ASRB
ASRB
ASRB

Now you have a 6 In the left most nibble of ACCUM A and a 9 in the rightmost bits of ACCUM B

STAA $C100
ORAB $C100

Now you should have 69 in $C100

There is probably a more efficient way, this is all I could think of quick

Stu
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…