[A83] Re: Rotate 16 bits?


[Prev][Next][Index][Thread]

[A83] Re: Rotate 16 bits?



On Thu, 01 May 2003 20:00:07 -0400
Gavin Olson <gtolson@comcast.net> wrote:

> Is there an instruction to rotate a sixteen-bit register, or do I have to 
> do something like rotate the low byte and high byte seperately, and then 
> increment the high byte if the low byte produced a carry? (rotating left)
> 
> Along the same lines, is the ADC instruction the same as the x86, where you 
> add if carry, or is it different?
> 
> 
> 

I don't think there is, but you can do this (to shift):

SLA L
RL H

if you want to rotate, you need to set bit 0 to the carry-flag:

SLA L
RL H
JR NC, $+2
SET 0,L

(NOT tested code...)

-- 
Max Sikstrom
pengi@molik.org

MoLiK programming and demo group
http://www.molik.org/



References: