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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
03/13/02 00:50
Read: times


 
#20758 - RE: 16 bit shift left
Juan,

Here is a "METALINK" file you can assemble and run in a simulator. Note the use of R2 is set's the number of rotations. I've set it to 16 this means after it run's you get the same number you started with. If you really only want a 16 bit rotating shift then kill the register and it's DJNZ instruction.

regards,
p



$mod51

msb data 20H
msb0 bit 20H.0

lsb data 21H
lsb0 bit 21H.0

hold_bit bit 22H.0

org 0
jmp start

org 40H
start:
mov lsb,#1
mov msb,#0

call shift
jmp start

shift:
push psw
push ar2
shift_loop:
mov a,msb
rlc a
mov hold_bit,c
mov msb,a

mov a,lsb
rlc a
mov msb0,c
mov lsb,a
mov c,hold_bit
mov lsb0,c
djnz r2,shift_loop
pop ar2
pop psw
ret
end


List of 16 messages in thread
TopicAuthorDate
16 bit shift left            01/01/70 00:00      
RE: 16 bit shift left            01/01/70 00:00      
RE: 16 bit shift left            01/01/70 00:00      
RE: 16 bit shift left            01/01/70 00:00      
RE: 16 bit shift left            01/01/70 00:00      
RE: 16 bit shift left            01/01/70 00:00      
RE: 16 bit shift left            01/01/70 00:00      
RE: 16 bit shift left            01/01/70 00:00      
RE: 16 bit shift left            01/01/70 00:00      
RE: 16 bit shift left            01/01/70 00:00      
RE: 16 bit shift left            01/01/70 00:00      
But why not the carry bit?            01/01/70 00:00      
RE:16 bit shift left            01/01/70 00:00      
RE: RE:16 bit shift left            01/01/70 00:00      
RE: RE:16 bit shift left            01/01/70 00:00      
RE: RE:16 bit shift left            01/01/70 00:00      

Back to Subject List