mirror of
https://github.com/irmen/prog8.git
synced 2024-10-17 10:24:55 +00:00
added cx16 txt.scroll_up
This commit is contained in:
parent
ba3dce0b4c
commit
2dbf849c82
@ -4,7 +4,6 @@
|
|||||||
;
|
;
|
||||||
; indent format: TABS, size=8
|
; indent format: TABS, size=8
|
||||||
|
|
||||||
|
|
||||||
%target c64
|
%target c64
|
||||||
%import syslib
|
%import syslib
|
||||||
%import conv
|
%import conv
|
||||||
@ -20,7 +19,7 @@ sub clear_screen() {
|
|||||||
clear_screenchars(' ')
|
clear_screenchars(' ')
|
||||||
}
|
}
|
||||||
|
|
||||||
asmsub fill_screen (ubyte char @ A, ubyte charcolor @ Y) clobbers(A) {
|
asmsub fill_screen (ubyte char @ A, ubyte color @ Y) clobbers(A) {
|
||||||
; ---- fill the character screen with the given fill character and character color.
|
; ---- fill the character screen with the given fill character and character color.
|
||||||
; (assumes screen and color matrix are at their default addresses)
|
; (assumes screen and color matrix are at their default addresses)
|
||||||
|
|
||||||
@ -50,7 +49,7 @@ _loop sta c64.Screen,y
|
|||||||
}}
|
}}
|
||||||
}
|
}
|
||||||
|
|
||||||
asmsub clear_screencolors (ubyte scrcolor @ A) clobbers(Y) {
|
asmsub clear_screencolors (ubyte color @ A) clobbers(Y) {
|
||||||
; ---- clear the character screen colors with the given color (leaves characters).
|
; ---- clear the character screen colors with the given color (leaves characters).
|
||||||
; (assumes color matrix is at the default address)
|
; (assumes color matrix is at the default address)
|
||||||
%asm {{
|
%asm {{
|
||||||
@ -77,7 +76,7 @@ sub uppercase() {
|
|||||||
c64.VMCSB &= ~2
|
c64.VMCSB &= ~2
|
||||||
}
|
}
|
||||||
|
|
||||||
asmsub scroll_left_full (ubyte alsocolors @ Pc) clobbers(A, Y) {
|
asmsub scroll_left (ubyte alsocolors @ Pc) clobbers(A, 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
|
||||||
; Carry flag determines if screen color data must be scrolled too
|
; Carry flag determines if screen color data must be scrolled too
|
||||||
@ -116,7 +115,7 @@ _scroll_screen ; scroll the screen memory
|
|||||||
}}
|
}}
|
||||||
}
|
}
|
||||||
|
|
||||||
asmsub scroll_right_full (ubyte alsocolors @ Pc) clobbers(A) {
|
asmsub scroll_right (ubyte alsocolors @ Pc) clobbers(A) {
|
||||||
; ---- 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
|
||||||
; Carry flag determines if screen color data must be scrolled too
|
; Carry flag determines if screen color data must be scrolled too
|
||||||
@ -150,7 +149,7 @@ _scroll_screen ; scroll the screen memory
|
|||||||
}}
|
}}
|
||||||
}
|
}
|
||||||
|
|
||||||
asmsub scroll_up_full (ubyte alsocolors @ Pc) clobbers(A) {
|
asmsub scroll_up (ubyte alsocolors @ Pc) clobbers(A) {
|
||||||
; ---- 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
|
||||||
; Carry flag determines if screen color data must be scrolled too
|
; Carry flag determines if screen color data must be scrolled too
|
||||||
@ -184,7 +183,7 @@ _scroll_screen ; scroll the screen memory
|
|||||||
}}
|
}}
|
||||||
}
|
}
|
||||||
|
|
||||||
asmsub scroll_down_full (ubyte alsocolors @ Pc) clobbers(A) {
|
asmsub scroll_down (ubyte alsocolors @ Pc) clobbers(A) {
|
||||||
; ---- 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
|
||||||
; Carry flag determines if screen color data must be scrolled too
|
; Carry flag determines if screen color data must be scrolled too
|
||||||
|
@ -19,7 +19,7 @@ sub clear_screen() {
|
|||||||
clear_screenchars(' ')
|
clear_screenchars(' ')
|
||||||
}
|
}
|
||||||
|
|
||||||
asmsub fill_screen (ubyte char @ A, ubyte txtcolor @ Y) clobbers(A) {
|
asmsub fill_screen (ubyte char @ A, ubyte color @ Y) clobbers(A) {
|
||||||
; ---- fill the character screen with the given fill character and character color.
|
; ---- fill the character screen with the given fill character and character color.
|
||||||
%asm {{
|
%asm {{
|
||||||
sty _ly+1
|
sty _ly+1
|
||||||
@ -92,7 +92,7 @@ _lx ldx #0 ; modified
|
|||||||
}}
|
}}
|
||||||
}
|
}
|
||||||
|
|
||||||
asmsub clear_screencolors (ubyte scrcolor @ A) clobbers(Y) {
|
asmsub clear_screencolors (ubyte color @ A) clobbers(Y) {
|
||||||
; ---- clear the character screen colors with the given color (leaves characters).
|
; ---- clear the character screen colors with the given color (leaves characters).
|
||||||
; (assumes color matrix is at the default address)
|
; (assumes color matrix is at the default address)
|
||||||
%asm {{
|
%asm {{
|
||||||
@ -148,7 +148,116 @@ sub uppercase() {
|
|||||||
cx16.screen_set_charset(2, 0) ; uppercase charset
|
cx16.screen_set_charset(2, 0) ; uppercase charset
|
||||||
}
|
}
|
||||||
|
|
||||||
; TODO implement the "missing" txtio scroll subroutines: scroll_left_full, (also right, up, down)
|
; TODO implement the "missing" txtio scroll subroutines: scroll_left, scroll_right, scroll_down
|
||||||
|
|
||||||
|
asmsub scroll_left (ubyte dummy @ Pc) clobbers(A, Y) {
|
||||||
|
; ---- scroll the whole screen 1 character to the left
|
||||||
|
; contents of the rightmost column are unchanged, you should clear/refill this yourself
|
||||||
|
; Carry flag is a dummy on the cx16
|
||||||
|
}
|
||||||
|
|
||||||
|
asmsub scroll_right (ubyte dummy @ Pc) clobbers(A) {
|
||||||
|
; ---- scroll the whole screen 1 character to the right
|
||||||
|
; contents of the leftmost column are unchanged, you should clear/refill this yourself
|
||||||
|
; Carry flag is a dummy on the cx16
|
||||||
|
}
|
||||||
|
|
||||||
|
asmsub scroll_up (ubyte dummy @ Pc) clobbers(A) {
|
||||||
|
; ---- scroll the whole screen 1 character up
|
||||||
|
; contents of the bottom row are unchanged, you should refill/clear this yourself
|
||||||
|
; Carry flag is a dummy on the cx16
|
||||||
|
%asm {{
|
||||||
|
phx
|
||||||
|
jsr c64.SCREEN
|
||||||
|
txa
|
||||||
|
lsr a
|
||||||
|
lsr a
|
||||||
|
sta P8ZP_SCRATCH_REG ; number of columns / 4 due to loop unroll
|
||||||
|
dey
|
||||||
|
sty P8ZP_SCRATCH_B1 ; number of lines to scroll up
|
||||||
|
lda #%00010000
|
||||||
|
sta cx16.VERA_ADDR_H ; enable auto increment by 1, bank 0.
|
||||||
|
lda #1
|
||||||
|
sta cx16.VERA_ADDR_M ; start at (0, 1)
|
||||||
|
|
||||||
|
_scrolline ldy #0
|
||||||
|
stz cx16.VERA_ADDR_L
|
||||||
|
ldx P8ZP_SCRATCH_REG
|
||||||
|
- lda cx16.VERA_DATA0
|
||||||
|
sta _scrollbuffer,y
|
||||||
|
iny
|
||||||
|
lda cx16.VERA_DATA0
|
||||||
|
sta _scrollbuffer,y
|
||||||
|
iny
|
||||||
|
lda cx16.VERA_DATA0
|
||||||
|
sta _scrollbuffer,y
|
||||||
|
iny
|
||||||
|
lda cx16.VERA_DATA0
|
||||||
|
sta _scrollbuffer,y
|
||||||
|
iny
|
||||||
|
lda cx16.VERA_DATA0
|
||||||
|
sta _scrollbuffer,y
|
||||||
|
iny
|
||||||
|
lda cx16.VERA_DATA0
|
||||||
|
sta _scrollbuffer,y
|
||||||
|
iny
|
||||||
|
lda cx16.VERA_DATA0
|
||||||
|
sta _scrollbuffer,y
|
||||||
|
iny
|
||||||
|
lda cx16.VERA_DATA0
|
||||||
|
sta _scrollbuffer,y
|
||||||
|
iny
|
||||||
|
dex
|
||||||
|
bpl -
|
||||||
|
; now copy the linebuffer back to the line above this one
|
||||||
|
stz cx16.VERA_ADDR_L
|
||||||
|
dec cx16.VERA_ADDR_M
|
||||||
|
ldy #0
|
||||||
|
ldx P8ZP_SCRATCH_REG
|
||||||
|
- lda _scrollbuffer,y
|
||||||
|
sta cx16.VERA_DATA0
|
||||||
|
iny
|
||||||
|
lda _scrollbuffer,y
|
||||||
|
sta cx16.VERA_DATA0
|
||||||
|
iny
|
||||||
|
lda _scrollbuffer,y
|
||||||
|
sta cx16.VERA_DATA0
|
||||||
|
iny
|
||||||
|
lda _scrollbuffer,y
|
||||||
|
sta cx16.VERA_DATA0
|
||||||
|
iny
|
||||||
|
lda _scrollbuffer,y
|
||||||
|
sta cx16.VERA_DATA0
|
||||||
|
iny
|
||||||
|
lda _scrollbuffer,y
|
||||||
|
sta cx16.VERA_DATA0
|
||||||
|
iny
|
||||||
|
lda _scrollbuffer,y
|
||||||
|
sta cx16.VERA_DATA0
|
||||||
|
iny
|
||||||
|
lda _scrollbuffer,y
|
||||||
|
sta cx16.VERA_DATA0
|
||||||
|
iny
|
||||||
|
dex
|
||||||
|
bpl -
|
||||||
|
inc cx16.VERA_ADDR_M
|
||||||
|
inc cx16.VERA_ADDR_M ; next line to copy
|
||||||
|
|
||||||
|
dec P8ZP_SCRATCH_B1
|
||||||
|
bne _scrolline
|
||||||
|
|
||||||
|
plx
|
||||||
|
rts
|
||||||
|
|
||||||
|
_scrollbuffer .fill 160, 0
|
||||||
|
}}
|
||||||
|
}
|
||||||
|
|
||||||
|
asmsub scroll_down (ubyte dummy @ Pc) clobbers(A) {
|
||||||
|
; ---- scroll the whole screen 1 character down
|
||||||
|
; contents of the top row are unchanged, you should refill/clear this yourself
|
||||||
|
; Carry flag is a dummy on the cx16
|
||||||
|
}
|
||||||
|
|
||||||
romsub $FFD2 = chrout(ubyte char @ A) ; for consistency. You can also use c64.CHROUT directly ofcourse.
|
romsub $FFD2 = chrout(ubyte char @ A) ; for consistency. You can also use c64.CHROUT directly ofcourse.
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ main {
|
|||||||
}
|
}
|
||||||
|
|
||||||
perform_scroll = false
|
perform_scroll = false
|
||||||
txt.scroll_left_full(true)
|
txt.scroll_left(true)
|
||||||
if c64.RASTER & 1
|
if c64.RASTER & 1
|
||||||
c64.SPXY[1] ++
|
c64.SPXY[1] ++
|
||||||
else
|
else
|
||||||
|
@ -8,21 +8,20 @@ main {
|
|||||||
|
|
||||||
sub start() {
|
sub start() {
|
||||||
|
|
||||||
; 40 x 25
|
ubyte x
|
||||||
; 80 x 60
|
ubyte y
|
||||||
txt.fill_screen('*', 8)
|
for y in 0 to txt.DEFAULT_HEIGHT-1 {
|
||||||
|
for x in 0 to txt.DEFAULT_WIDTH-1 {
|
||||||
|
txt.setchr(x,y,x+y)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
txt.clear_screen()
|
repeat 60 {
|
||||||
|
txt.scroll_up(true)
|
||||||
|
|
||||||
txt.print_ub(txt.width())
|
repeat 5000 {
|
||||||
txt.chrout('\n')
|
x++
|
||||||
txt.print_ub(txt.height())
|
}
|
||||||
txt.chrout('\n')
|
|
||||||
|
|
||||||
ubyte i
|
|
||||||
repeat {
|
|
||||||
txt.clear_screencolors(i)
|
|
||||||
i++
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user