Bryan Parkoff wrote: > Why Motorola and Intel's ROL Instruction are not the same? > > For example, Motorola rolates from $80 to $00. The carry is turned on. >It has to rolate from $00 to $01 second time. Intel can rolates from $80 to >$01 once. I wonder why Motorla has to rolate twice. Is it the way how >Motorola is designed? It is not unusual for instruction sets to have subtle differences in semantics. I'm not an Intel (8080, 8088, x86) assembly language programmer, but I think that Intel generally offers _both_ kinds of rotates. The 6502 designers' philosophy was simplicity, and they only provided the "carry inclusive" rotates. Taking the approach of including the carry bit in the circular shift allows very easy extension to shifts of quantities larger than one byte. I find this much more useful than a rotate instruction that does not include carry. If you want to simulate a ROL that does not include carry, it is only necessary to preset the carry bit to the high bit of the shifted byte. 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. -michael Check out amazing quality sound for 8-bit Apples on my Home page: http://members.aol.com/MJMahon/ 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/