Re: [stella] Horizontal scrolling demo

Subject: Re: [stella] Horizontal scrolling demo
From: "Erik Mooney" <erik@xxxxxxxxxx>
Date: Fri, 14 May 2004 13:51:05 -0500
Christian Bogey <khryssun@xxxxxxxx> wrote:

> > I'd suggest trying a routine using rol/ror, instead
> > of whatever you're doing now ;-)
> I'am already using als, ror and rol ;-)

If you want to do playfield scrolling with an asymmetric playfield
in repeated mode, take a look at the INV source that I posted.  Look
for the labels MoveEachRow0 and MoveEachRow1.  That uses a series
of shifts and rotates to move the playfield bits across the screen
through both copies of all the PF registers.  The only tricky
part is moving bit 7 of PF2 into bit 4 of the second copy of PF0,
and here's how my code does that:

    lda Invaders+2,X    ;
    rol                 ;
    sta Invaders+2,X    ;We've gotta get the carry into bit 3 of A
    lda #0              ;
    rol                 ;
    rol                 ;
    rol                 ;
    rol                 ;
    ora Invaders+3,X    ;
    rol                 ;
    sta Invaders+3,X    ;

The four ROLs move the carry (shifted out of PF2) into bit 3 of
the new PF0, then the last ROL moves it into bit 4.  Of course,
nowadays I know that could be optimized....

    sta Invaders+2,X
    lda Invaders+3,X
    bcc Label0
    ora #%00001000
    sta Invaders+3,X
Archives (includes files) at
Unsub & more at

Current Thread