mirror of
https://github.com/irmen/prog8.git
synced 2024-11-27 03:50:27 +00:00
added cx16 txt.clear_screencolors
This commit is contained in:
parent
ae2619602d
commit
ca9588380a
@ -63,31 +63,63 @@ asmsub clear_screenchars (ubyte char @ A) clobbers(Y) {
|
|||||||
; (assumes screen matrix is at the default address)
|
; (assumes screen matrix is at the default address)
|
||||||
; TODO this can be done more efficiently with the VERA auto increment mode?
|
; TODO this can be done more efficiently with the VERA auto increment mode?
|
||||||
%asm {{
|
%asm {{
|
||||||
pha
|
|
||||||
phx
|
phx
|
||||||
|
pha
|
||||||
jsr c64.SCREEN ; get dimensions in X/Y
|
jsr c64.SCREEN ; get dimensions in X/Y
|
||||||
dex
|
dex
|
||||||
dey
|
dey
|
||||||
txa
|
txa
|
||||||
asl a
|
asl a
|
||||||
sta P8ZP_SCRATCH_B1
|
sta _mod+1
|
||||||
pla
|
pla
|
||||||
- ldx P8ZP_SCRATCH_B1
|
_mod ldx #0 ; modified
|
||||||
- stz cx16.VERA_ADDR_H
|
- stz cx16.VERA_ADDR_H
|
||||||
stx cx16.VERA_ADDR_L
|
stx cx16.VERA_ADDR_L
|
||||||
sty cx16.VERA_ADDR_M
|
sty cx16.VERA_ADDR_M
|
||||||
sta cx16.VERA_DATA0
|
sta cx16.VERA_DATA0
|
||||||
dex
|
dex
|
||||||
dex
|
dex
|
||||||
cpx #254
|
cpx #-2
|
||||||
bne -
|
bne -
|
||||||
dey
|
dey
|
||||||
bpl --
|
bpl _mod
|
||||||
plx
|
plx
|
||||||
rts
|
rts
|
||||||
}}
|
}}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
asmsub clear_screencolors (ubyte scrcolor @ A) clobbers(Y) {
|
||||||
|
; ---- clear the character screen colors with the given color (leaves characters).
|
||||||
|
; (assumes color matrix is at the default address)
|
||||||
|
; TODO this can be done more efficiently with the VERA auto increment mode?
|
||||||
|
%asm {{
|
||||||
|
phx
|
||||||
|
pha
|
||||||
|
jsr c64.SCREEN ; get dimensions in X/Y
|
||||||
|
dex
|
||||||
|
dey
|
||||||
|
txa
|
||||||
|
asl a
|
||||||
|
ina
|
||||||
|
sta _mod+1
|
||||||
|
pla
|
||||||
|
_mod ldx #0 ; modified
|
||||||
|
- stz cx16.VERA_ADDR_H
|
||||||
|
stx cx16.VERA_ADDR_L
|
||||||
|
sty cx16.VERA_ADDR_M
|
||||||
|
sta cx16.VERA_DATA0
|
||||||
|
dex
|
||||||
|
dex
|
||||||
|
cpx #-1
|
||||||
|
bne -
|
||||||
|
dey
|
||||||
|
bpl _mod
|
||||||
|
plx
|
||||||
|
rts
|
||||||
|
}}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
ubyte[16] color_to_charcode = [$90,$05,$1c,$9f,$9c,$1e,$1f,$9e,$81,$95,$96,$97,$98,$99,$9a,$9b]
|
ubyte[16] color_to_charcode = [$90,$05,$1c,$9f,$9c,$1e,$1f,$9e,$81,$95,$96,$97,$98,$99,$9a,$9b]
|
||||||
|
|
||||||
sub color (ubyte txtcol) {
|
sub color (ubyte txtcol) {
|
||||||
@ -108,7 +140,6 @@ sub uppercase() {
|
|||||||
cx16.screen_set_charset(2, 0) ; uppercase charset
|
cx16.screen_set_charset(2, 0) ; uppercase charset
|
||||||
}
|
}
|
||||||
|
|
||||||
; TODO implement clear_screencolors
|
|
||||||
; TODO implement the "missing" txtio scroll subroutines: scroll_left_full, (also right, up, down)
|
; TODO implement the "missing" txtio scroll subroutines: scroll_left_full, (also right, up, down)
|
||||||
|
|
||||||
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.
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
%target c64
|
|
||||||
%import syslib
|
%import syslib
|
||||||
%import graphics
|
; %import graphics
|
||||||
%import textio
|
%import textio
|
||||||
%import floats
|
%import floats
|
||||||
%zeropage basicsafe
|
%zeropage basicsafe
|
||||||
@ -10,25 +9,11 @@ main {
|
|||||||
|
|
||||||
sub start() {
|
sub start() {
|
||||||
|
|
||||||
const ubyte cbvalue = 40
|
txt.clear_screenchars('*')
|
||||||
const uword cwvalue = cbvalue
|
ubyte i
|
||||||
uword wvalue = 40
|
repeat {
|
||||||
|
txt.clear_screencolors(i)
|
||||||
ubyte x
|
i++
|
||||||
ubyte bb = 99
|
}
|
||||||
x = msb(sin8u(bb) * cwvalue)
|
|
||||||
txt.print_ub(x)
|
|
||||||
txt.chrout('\n')
|
|
||||||
x = msb(sin8u(bb) * wvalue)
|
|
||||||
txt.print_ub(x)
|
|
||||||
txt.chrout('\n')
|
|
||||||
txt.chrout('\n')
|
|
||||||
|
|
||||||
x = msb(cwvalue*sin8u(bb))
|
|
||||||
txt.print_ub(x)
|
|
||||||
txt.chrout('\n')
|
|
||||||
x = msb(wvalue*sin8u(bb))
|
|
||||||
txt.print_ub(x)
|
|
||||||
txt.chrout('\n')
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user