💾 Archived View for mirrors.apple2.org.za › archive › ground.icaen.uiowa.edu › MiscInfo › Programmin… captured on 2024-07-09 at 04:35:57.
⬅️ Previous capture (2023-01-29)
-=-=-=-=-=-=-
"Michael J. Mahon" wrote: > 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. You can also use ASL followed by ADC #0. Swapping nibbles in a byte can be done by: LDA #value abcd efgh ASL bcde fgh0 ADC #0 bcde fgha ASL cdef gha0 ADC #0 cdef ghab ASL defg hab0 ADC #0 defg habc ASL efgh abc0 ADC #0 efgh abcd I got this from Apple Assembly Line. -- Paul Monroe, Michigan USA Paul R. Santa-Maria wrote: >"Michael J. Mahon" wrote: >> 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. > >You can also use ASL followed by ADC #0. Swapping nibbles >in a byte can be done by: > >LDA #value abcd efgh >ASL bcde fgh0 >ADC #0 bcde fgha >ASL cdef gha0 >ADC #0 cdef ghab >ASL defg hab0 >ADC #0 defg habc >ASL efgh abc0 >ADC #0 efgh abcd > >I got this from Apple Assembly Line. It's interesting how the way the problem is framed influences the solution. ;-) I thought of it as cancelling the effect of including the carry in the ROL, so I copied the high bit to the carry after the shift. Bob S-C thought of it as getting the carried-out bit back into the accumulator, so he copied the carry to bit 0 after the shift. Cool. ;-) -michael Check out amazing quality sound for 8-bit Apples on my Home page: http://members.aol.com/MJMahon/ I wrote... >It's interesting how the way the problem is framed influences >the solution. ;-) > >I thought of it as cancelling the effect of including the carry >in the ROL, so I copied the high bit to the carry after the shift. Of course, I meant to say, _before_ the shift. ;-( -michael Check out amazing quality sound for 8-bit Apples on my Home page: http://members.aol.com/MJMahon/