mirror of
https://github.com/irmen/prog8.git
synced 2025-11-23 14:17:51 +00:00
cx16: txt.scroll_left(), right, up and down are now romable
This commit is contained in:
@@ -273,11 +273,10 @@ sub kata() {
|
|||||||
asmsub scroll_left() clobbers(A, X, Y) {
|
asmsub scroll_left() clobbers(A, X, Y) {
|
||||||
; ---- scroll the whole screen 1 character to the left
|
; ---- scroll the whole screen 1 character to the left
|
||||||
; contents of the rightmost column are unchanged, you should clear/refill this yourself
|
; contents of the rightmost column are unchanged, you should clear/refill this yourself
|
||||||
; TODO: Romable
|
|
||||||
%asm {{
|
%asm {{
|
||||||
jsr cbm.SCREEN
|
jsr cbm.SCREEN
|
||||||
dex
|
dex
|
||||||
stx _lx+1
|
stx P8ZP_SCRATCH_REG ; columns
|
||||||
dey
|
dey
|
||||||
sty P8ZP_SCRATCH_B1 ; number of rows to scroll
|
sty P8ZP_SCRATCH_B1 ; number of rows to scroll
|
||||||
|
|
||||||
@@ -299,7 +298,7 @@ _nextline
|
|||||||
stz cx16.VERA_ADDR_L
|
stz cx16.VERA_ADDR_L
|
||||||
sty cx16.VERA_ADDR_M
|
sty cx16.VERA_ADDR_M
|
||||||
|
|
||||||
_lx ldx #0 ; modified
|
ldx P8ZP_SCRATCH_REG ; columns
|
||||||
- lda cx16.VERA_DATA0
|
- lda cx16.VERA_DATA0
|
||||||
sta cx16.VERA_DATA1 ; copy char
|
sta cx16.VERA_DATA1 ; copy char
|
||||||
lda cx16.VERA_DATA0
|
lda cx16.VERA_DATA0
|
||||||
@@ -318,18 +317,20 @@ _lx ldx #0 ; modified
|
|||||||
asmsub scroll_right() clobbers(A,X,Y) {
|
asmsub scroll_right() clobbers(A,X,Y) {
|
||||||
; ---- scroll the whole screen 1 character to the right
|
; ---- scroll the whole screen 1 character to the right
|
||||||
; contents of the leftmost column are unchanged, you should clear/refill this yourself
|
; contents of the leftmost column are unchanged, you should clear/refill this yourself
|
||||||
; TODO: Romable
|
|
||||||
%asm {{
|
%asm {{
|
||||||
|
_columns = P8ZP_SCRATCH_REG
|
||||||
|
_rcolv1 = P8ZP_SCRATCH_W1
|
||||||
|
_rcolv2 = P8ZP_SCRATCH_W1+1
|
||||||
jsr cbm.SCREEN
|
jsr cbm.SCREEN
|
||||||
dex
|
dex
|
||||||
stx _lx+1
|
stx _columns
|
||||||
txa
|
txa
|
||||||
asl a
|
asl a
|
||||||
dea
|
dea
|
||||||
sta _rcol+1
|
sta _rcolv1
|
||||||
ina
|
ina
|
||||||
ina
|
ina
|
||||||
sta _rcol2+1
|
sta _rcolv2
|
||||||
dey
|
dey
|
||||||
sty P8ZP_SCRATCH_B1 ; number of rows to scroll
|
sty P8ZP_SCRATCH_B1 ; number of rows to scroll
|
||||||
|
|
||||||
@@ -337,7 +338,7 @@ _nextline
|
|||||||
stz cx16.VERA_CTRL ; data port 0: source column
|
stz cx16.VERA_CTRL ; data port 0: source column
|
||||||
lda #%00011000 | VERA_TEXTMATRIX>>16 ; auto decrement 1
|
lda #%00011000 | VERA_TEXTMATRIX>>16 ; auto decrement 1
|
||||||
sta cx16.VERA_ADDR_H
|
sta cx16.VERA_ADDR_H
|
||||||
_rcol lda #79*2-1 ; modified
|
lda _rcolv1
|
||||||
sta cx16.VERA_ADDR_L ; begin in rightmost column minus one
|
sta cx16.VERA_ADDR_L ; begin in rightmost column minus one
|
||||||
lda P8ZP_SCRATCH_B1
|
lda P8ZP_SCRATCH_B1
|
||||||
clc
|
clc
|
||||||
@@ -348,11 +349,11 @@ _rcol lda #79*2-1 ; modified
|
|||||||
sta cx16.VERA_CTRL ; data port 1: destination column
|
sta cx16.VERA_CTRL ; data port 1: destination column
|
||||||
lda #%00011000 | VERA_TEXTMATRIX>>16 ; auto decrement 1
|
lda #%00011000 | VERA_TEXTMATRIX>>16 ; auto decrement 1
|
||||||
sta cx16.VERA_ADDR_H
|
sta cx16.VERA_ADDR_H
|
||||||
_rcol2 lda #79*2+1 ; modified
|
lda _rcolv2
|
||||||
sta cx16.VERA_ADDR_L
|
sta cx16.VERA_ADDR_L
|
||||||
sty cx16.VERA_ADDR_M
|
sty cx16.VERA_ADDR_M
|
||||||
|
|
||||||
_lx ldx #0 ; modified
|
ldx _columns
|
||||||
- lda cx16.VERA_DATA0
|
- lda cx16.VERA_DATA0
|
||||||
sta cx16.VERA_DATA1 ; copy char
|
sta cx16.VERA_DATA1 ; copy char
|
||||||
lda cx16.VERA_DATA0
|
lda cx16.VERA_DATA0
|
||||||
@@ -371,10 +372,9 @@ _lx ldx #0 ; modified
|
|||||||
asmsub scroll_up() clobbers(A, X, Y) {
|
asmsub scroll_up() clobbers(A, X, Y) {
|
||||||
; ---- scroll the whole screen 1 character up
|
; ---- scroll the whole screen 1 character up
|
||||||
; contents of the bottom row are unchanged, you should refill/clear this yourself
|
; contents of the bottom row are unchanged, you should refill/clear this yourself
|
||||||
; TODO: Romable
|
|
||||||
%asm {{
|
%asm {{
|
||||||
jsr cbm.SCREEN
|
jsr cbm.SCREEN
|
||||||
stx _nextline+1
|
stx P8ZP_SCRATCH_REG ; columns
|
||||||
dey
|
dey
|
||||||
sty P8ZP_SCRATCH_B1
|
sty P8ZP_SCRATCH_B1
|
||||||
stz cx16.VERA_CTRL ; data port 0 is source
|
stz cx16.VERA_CTRL ; data port 0 is source
|
||||||
@@ -393,7 +393,7 @@ asmsub scroll_up() clobbers(A, X, Y) {
|
|||||||
sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0.
|
sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0.
|
||||||
|
|
||||||
_nextline
|
_nextline
|
||||||
ldx #80 ; modified
|
ldx P8ZP_SCRATCH_REG ; columns
|
||||||
- lda cx16.VERA_DATA0
|
- lda cx16.VERA_DATA0
|
||||||
sta cx16.VERA_DATA1 ; copy char
|
sta cx16.VERA_DATA1 ; copy char
|
||||||
lda cx16.VERA_DATA0
|
lda cx16.VERA_DATA0
|
||||||
@@ -420,10 +420,9 @@ _nextline
|
|||||||
asmsub scroll_down() clobbers(A, X, Y) {
|
asmsub scroll_down() clobbers(A, X, Y) {
|
||||||
; ---- scroll the whole screen 1 character down
|
; ---- scroll the whole screen 1 character down
|
||||||
; contents of the top row are unchanged, you should refill/clear this yourself
|
; contents of the top row are unchanged, you should refill/clear this yourself
|
||||||
; TODO: Romable
|
|
||||||
%asm {{
|
%asm {{
|
||||||
jsr cbm.SCREEN
|
jsr cbm.SCREEN
|
||||||
stx _nextline+1
|
stx P8ZP_SCRATCH_REG ; columns
|
||||||
dey
|
dey
|
||||||
sty P8ZP_SCRATCH_B1
|
sty P8ZP_SCRATCH_B1
|
||||||
stz cx16.VERA_CTRL ; data port 0 is source
|
stz cx16.VERA_CTRL ; data port 0 is source
|
||||||
@@ -448,7 +447,7 @@ asmsub scroll_down() clobbers(A, X, Y) {
|
|||||||
sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0.
|
sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0.
|
||||||
|
|
||||||
_nextline
|
_nextline
|
||||||
ldx #80 ; modified
|
ldx P8ZP_SCRATCH_REG ; columns
|
||||||
- lda cx16.VERA_DATA0
|
- lda cx16.VERA_DATA0
|
||||||
sta cx16.VERA_DATA1 ; copy char
|
sta cx16.VERA_DATA1 ; copy char
|
||||||
lda cx16.VERA_DATA0
|
lda cx16.VERA_DATA0
|
||||||
|
|||||||
@@ -4,6 +4,25 @@
|
|||||||
|
|
||||||
main {
|
main {
|
||||||
sub start() {
|
sub start() {
|
||||||
txt.clear_screencolors($f7)
|
repeat 16 {
|
||||||
|
sys.waitvsync()
|
||||||
|
sys.waitvsync()
|
||||||
|
txt.scroll_right()
|
||||||
|
}
|
||||||
|
repeat 16 {
|
||||||
|
sys.waitvsync()
|
||||||
|
sys.waitvsync()
|
||||||
|
txt.scroll_left()
|
||||||
|
}
|
||||||
|
repeat 16 {
|
||||||
|
sys.waitvsync()
|
||||||
|
sys.waitvsync()
|
||||||
|
txt.scroll_down()
|
||||||
|
}
|
||||||
|
repeat 16 {
|
||||||
|
sys.waitvsync()
|
||||||
|
sys.waitvsync()
|
||||||
|
txt.scroll_up()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user