Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

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.

Latest threads

New Articles From Microcontroller Tips

Back
Top