[A83] Re: Rotate 16 bits?


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

[A83] Re: Rotate 16 bits?



At 05:26 PM 5/1/2003 -0700, you 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)
>
>You are correct sir (your second guess, that is).  Here's the best I can 
>do off the top of my head.
>
>     ;rotate HL 1 bit to the left
>     SLA H
>     RL  L
>     JP  C, .skip
>     L
>.skip
>
>>Along the same lines, is the ADC instruction the same as the x86, where 
>>you add if carry, or is it different?
>
>ADC will add the operand and the carry bit to the accumulator.
>
>Stupid like a fox!
>Look ma, I'm an artist: http://aaronstj.deviantart.com

So I was thinking:

shl h
shl l
adc h,0

But indeed it is impossible, so I should rotate the low byte left, then 
rotate the high byte left with the carry (I think that's what had been 
suggested) I don't, however, get the ones with the jumping.





Follow-Ups: References: