Continue to Site

# 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

#### Pommie

##### Well-Known Member
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:

#### stugray

##### New Member
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 #### Simple1 ##### New Member Try this: LDAA #$96
LDAB #\$96
ASLA
ASLA
ASLA
ASLA
ASRB
ASRB
ASRB
ASRB

Stu

This actually worked out, Thx a bunch!

Status
Not open for further replies.

Replies
4
Views
1K
Replies
3
Views
811
Replies
21
Views
2K
Replies
6
Views
984
Replies
10
Views
1K