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
jsr c64.SCREEN
dex
stx _nextrow+1 ; number of columns to scroll
stx _lx+1
dey
sty P8ZP_SCRATCH_B1 ; number of rows to scroll
stz cx16.VERA_CTRL
stz cx16.VERA_ADDR_H
_nextrow
ldx #0 ; modified
_nextline
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
sty cx16.VERA_ADDR_M
- lda cx16.VERA_DATA0 ; char
inc cx16.VERA_ADDR_L
ldy cx16.VERA_DATA0 ; color
dec cx16.VERA_ADDR_L
dec cx16.VERA_ADDR_L
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
_lx ldx #0 ; modified
- lda cx16.VERA_DATA0
sta cx16.VERA_DATA1 ; copy char
lda cx16.VERA_DATA0
sta cx16.VERA_DATA1 ; copy color
dex
bpl -
bne -
dec P8ZP_SCRATCH_B1
ldy P8ZP_SCRATCH_B1
bpl _nextrow
bpl _nextline
lda #0
sta cx16.VERA_CTRL
plx
rts
}}

View File

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