Re: [stella] I'm a mountain man and I'm okay...

Subject: Re: [stella] I'm a mountain man and I'm okay...
From: jimn8@xxxxxxxxxx (Jim Nitchals)
Date: Wed, 17 Sep 1997 17:07:31 -0700 (PDT)
Crackers notes that writing the same value to all 3 playfield registers
looks cool, but he wants to scroll it.  He asks:

> One could really easily create a symetrical horizontally scrolling playfield
> by using ROL and ROR the only problem is the Carry Bit. How can I easily
> remove the problem of the Carry Bit and just have Bit 7 rotate into
> bit 0 and vice versa?

Assume the data's in A.

To rotate left is the easy one:
    asl a
    adc #0     ; move old bit 7 into bit 0

To rotate right takes a little more effort:
    lsr a
    bcc .no_carry
    ora #$80

Or time-invariant (may be important in display routines) but slower:
    sta temp  ; not needed if temp (or wherever) already has a copy of
              ; the same value that's in A
    lsr a     ; move bit 0 to carry
    lda temp  ; get original data back
    ror a     ; move old bit 0 into bit 7

Or even slower and takes fewer bytes and is still time invariant if
your display loop has time to kill:
    lsr a
    ror a

HTH   - Jim

>                                 CRACKERS
>                        (Tickled pink from hell!!!!)

Is the virtual pet going to be "Tickle Me Crackers?"  Hee hee!  Stop!

Archives updated once/day at
Unsubscribing and other info at

Current Thread