added cx16 txt.scroll_left

This commit is contained in:
Irmen de Jong 2020-09-21 23:39:25 +02:00
parent d3f433c8cf
commit 306770331a
2 changed files with 34 additions and 26 deletions

View File

@ -161,34 +161,37 @@ asmsub scroll_left (ubyte dummy @ Pc) clobbers(A, Y) {
phx phx
jsr c64.SCREEN jsr c64.SCREEN
dex dex
stx _nextrow+1 ; number of columns to scroll stx _lx+1
dey dey
sty P8ZP_SCRATCH_B1 ; number of rows to scroll sty P8ZP_SCRATCH_B1 ; number of rows to scroll
stz cx16.VERA_CTRL
stz cx16.VERA_ADDR_H
_nextrow _nextline
ldx #0 ; modified stz cx16.VERA_CTRL ; data port 0: source column
lda #%00010000 ; auto increment 1
sta cx16.VERA_ADDR_H
lda #2
sta cx16.VERA_ADDR_L ; begin in column 1
ldy P8ZP_SCRATCH_B1
sty cx16.VERA_ADDR_M
lda #1
sta cx16.VERA_CTRL ; data port 1: destination column
lda #%00010000 ; auto increment 1
sta cx16.VERA_ADDR_H
stz cx16.VERA_ADDR_L stz cx16.VERA_ADDR_L
sty cx16.VERA_ADDR_M sty cx16.VERA_ADDR_M
- lda cx16.VERA_DATA0 ; char _lx ldx #0 ; modified
inc cx16.VERA_ADDR_L - lda cx16.VERA_DATA0
ldy cx16.VERA_DATA0 ; color sta cx16.VERA_DATA1 ; copy char
dec cx16.VERA_ADDR_L lda cx16.VERA_DATA0
dec cx16.VERA_ADDR_L sta cx16.VERA_DATA1 ; copy color
dec cx16.VERA_ADDR_L
sta cx16.VERA_DATA0
inc cx16.VERA_ADDR_L
sty cx16.VERA_DATA0
inc cx16.VERA_ADDR_L
inc cx16.VERA_ADDR_L
inc cx16.VERA_ADDR_L
dex dex
bpl - bne -
dec P8ZP_SCRATCH_B1 dec P8ZP_SCRATCH_B1
ldy P8ZP_SCRATCH_B1 bpl _nextline
bpl _nextrow
lda #0
sta cx16.VERA_CTRL
plx plx
rts rts
}} }}

View File

@ -1,26 +1,31 @@
%import syslib %import syslib
; %import graphics ; %import graphics
%import textio %import textio
; %zeropage basicsafe %zeropage basicsafe
main { main {
sub start() { sub start() {
; cx16.screen_set_mode(128)
ubyte width = txt.width()
ubyte height = txt.height()
ubyte x ubyte x
ubyte y ubyte y
for y in 0 to txt.DEFAULT_HEIGHT-1 { for y in 0 to height-1 {
for x in 0 to txt.DEFAULT_WIDTH-1 { for x in 0 to width-1 {
txt.setchr(x,y,x+y) txt.setchr(x,y,x+y)
} }
} }
repeat txt.DEFAULT_WIDTH { repeat width {
txt.setcc(txt.DEFAULT_WIDTH-1, rnd() % txt.DEFAULT_HEIGHT, 81, 2) txt.setcc(width-1, rnd() % height, 81, 2)
txt.scroll_left(true) txt.scroll_left(true)
repeat 2000 { repeat 1000 {
x++ x++
} }
} }