Note: Don’t forget to set $D016. In your portion of screen that should be scrolled, add LDA XPOS1 and STA $D016
TEXT1 = $4000 ;wherever you load your text into memory..
SCROLLER LDA XPOS1
SEC
SBC SPEED
STA XPOS1
BPL EXITSC1
AND #$07
STA XPOS1
LDX #$00
MOVE1 LDA SCREEN1+1,X
STA SCREEN1,X
LDA SCREEN1+41,X
STA SCREEN1+40,X
INX
CPX #$27
BNE MOVE1
JSR GETCHAR
LDA TEXT1
TP1 = *-2
BEQ RESTART1
INC TP1
BNE ST1
INC TP1+1
BNE ST1
RESTART1 LDA #<TEXT1
LDX #>TEXT1
STA TP1
STX TP1+1
LDA #$20
ST1 STA SCREEN1+39
CLC
ADC #$40
STA SCREEN1+79
EXITSC1 RTS
GETCHAR LDA SCREEN1+39
CMP #">"
BEQ SPEEDUP
CMP #"<"
BEQ SLOWDOWN
RTS
SPEEDUP INC SPEED
RTS
SLOWDOWN DEC SPEED
RTS
SPEED .BYTE $02
XPOS1 .BYTE $00