[A83] Re: Rotate 16 bits?
[Prev][Next][Index][Thread]
[A83] Re: Rotate 16 bits?
> I would like to propose the following code for 16-bit
> rotates. These are "in-place" rotates, with the carry
> bit set to the value of bit 15 for a rotate left, and
> the value of bit 0 for a rotate right, i.e. analogous
> to the behavior of the RLC and RRC instructions.
>
> ; rotate left, i.e. "RLC HL"
>
> RLC H ; rotate H left, CF = MSB of H
> RRC H ; restore H by rotating right, CF = MSB of H
> ADC HL, HL ; LSB of L = old MSB of H, CF = old MSB of HL
>
good thinking.. here's one that is 8 clocks faster but overwrites a:
[23 clocks]
ld a,h
rla
adc hl,hl
References: