Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
04/20/04 05:21
Read: times


 
#68857 - RE: Rotating 32 bytes on 89c51 through C
Responding to: ???'s previous message

You haven't told use which way you want to rotate! Or do you just want to shift?

Your example doesn't work as you can't use an indirect operation on a bit. You can do the following on bits:

set setb
reset clr
complement cpl
move to/from carry mov C,bit or mov bit,C
jump on condition jbc,jb

( I think i've covered them all!)
so the mov @r0 isn't going to work on bits (unless you want 8 at a time)

so you have two choices:

inline code using bits:

mov C,bit3
push acc ;save bit to rotate around
mov C,bit2
mov bit3,C
mov C,bit1
mov bit2,C
mov bit0,C
mov bit1,C
pop acc ;recover the last bit
mov bit0,C

this is a bit labourious but in some instances may be a good solution.

or:

bit0_7 equ 20h
mov a,bit0_7
rr a
mov bit0_7,a

I suggest you read the 'bible' on shifting and rotating for more background. Also read as many app notes that have code examples to get a feel for how things are normally done. There's also heaps on examples kicking around the web for you to learn from.











List of 9 messages in thread
TopicAuthorDate
Rotating 32 bytes on 89c51 through C            01/01/70 00:00      
   RE: Rotating 32 bytes on 89c51 through C            01/01/70 00:00      
      RE: Rotating 32 bytes on 89c51 through C            01/01/70 00:00      
      RE: Rotating 32 bytes on 89c51 through C            01/01/70 00:00      
   RE: Rotating 32 bytes on 89c51 through C            01/01/70 00:00      
      RE: Rotating 32 bytes on 89c51 through C            01/01/70 00:00      
         RE: Rotating 32 bytes on 89c51 through C            01/01/70 00:00      
            RE: Rotating 32 bytes on 89c51 through C            01/01/70 00:00      
   RE: Rotating 32 bytes on 89c51 through C            01/01/70 00:00      

Back to Subject List