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

Re: ROL Instruction



Paul R. Santa-Maria wrote:

>"Michael J. Mahon" wrote:
>> For example, if the A register is being
>> shifted, then preceding the ROL with a CMP #$80 will cause
>> the ROL to shift the high bit to the low bit position.
>
>It does not have to be #$80, right?  Any value will work?

No, not if you want to "copy" the high bit to the carry bit.

A Compare starts by setting the carry bit and then does
a subtract and discards the difference after setting the
flags.  If the A register is $80 or more, the carry stays
set.  If it's less than $80, a borrow occurs and carry is
cleared, thus causing the carry bit to be equal to the
high bit of the A register.

-michael

Check out amazing quality sound for 8-bit Apples on my
Home page:  http://members.aol.com/MJMahon/