Re: A86: 16-bit Rotations
[Prev][Next][Index][Thread]
Re: A86: 16-bit Rotations
In a message dated 9/21/00 9:21:35 PM Eastern Daylight Time,
krevinek@yahoo.com writes:
> Wow, you guys could probably teach me a couple things about having
> optimized code. However I am curious as to the naming convention. I
> do know it is Rotation Left/Right <Something> HL, but why the 'C'? Is
> it because it is accessed using call instead of jmp or jsr?
rlc and rrc are rotate left carry and rotate right carry. This is different
from rl (rotate left) and rr (rotate right) in that rl and rr shift the
previous carry into the vacant bit whereas rlc and rrc shift the 0th or 7th
bit not only into the carry but also into the vacant bit. I realize this
isn't a very good explanation, but that's what they do...
;carry=0
ld a,%10111110
rl a
;a=%01111100
;carry=1
ld a,%10111110
rl a
;a=%01111101 ;<-- bit 0 is the carry
;carry is irrelevant
ld a,%10111110
rlc a
;a=%01111101 <-- bit 0 is previous bit 7
----
Jonah Cohen
<ComAsYuAre@aol.com>
http://jonah.ticalc.org
Follow-Ups: