txt.setcc() is romable

This commit is contained in:
Irmen de Jong
2025-04-16 23:44:50 +02:00
parent 5bc6c50f42
commit 4fbd67ff99
4 changed files with 29 additions and 26 deletions

View File

@@ -388,27 +388,29 @@ asmsub getclr (ubyte col @A, ubyte row @Y) clobbers(Y) -> ubyte @ A {
sub setcc (ubyte col, ubyte row, ubyte character, ubyte charcolor) {
; ---- set char+color at the given position on the screen
; TODO: Romable
%asm {{
_charptr = P8ZP_SCRATCH_W1
_colorptr = P8ZP_SCRATCH_W2
lda row
asl a
tay
lda setchr._screenrows+1,y
sta _charmod+2
sta _charptr+1
adc #$d4
sta _colormod+2
sta _colorptr+1
lda setchr._screenrows,y
clc
adc col
sta _charmod+1
sta _colormod+1
sta _charptr
sta _colorptr
bcc +
inc _charmod+2
inc _colormod+2
inc _charptr+1
inc _colorptr+1
+ lda character
_charmod sta $ffff ; modified
ldy #0
sta (_charptr),y
lda charcolor
_colormod sta $ffff ; modified
sta (_colorptr),y
rts
}}
}

View File

@@ -391,27 +391,29 @@ asmsub getclr (ubyte col @A, ubyte row @Y) clobbers(Y) -> ubyte @ A {
sub setcc (ubyte col, ubyte row, ubyte character, ubyte charcolor) {
; ---- set char+color at the given position on the screen
; TODO: Romable
%asm {{
_charptr = P8ZP_SCRATCH_W1
_colorptr = P8ZP_SCRATCH_W2
lda row
asl a
tay
lda setchr._screenrows+1,y
sta _charmod+2
sta _charptr+1
adc #$d4
sta _colormod+2
sta _colorptr+1
lda setchr._screenrows,y
clc
adc col
sta _charmod+1
sta _colormod+1
sta _charptr
sta _colorptr
bcc +
inc _charmod+2
inc _colormod+2
inc _charptr+1
inc _colorptr+1
+ lda character
_charmod sta $ffff ; modified
ldy #0
sta (_charptr),y
lda charcolor
_colormod sta $ffff ; modified
sta (_colorptr),y
rts
}}
}

View File

@@ -202,23 +202,23 @@ sub setclr (ubyte col, ubyte row, ubyte color) {
}
sub setcc (ubyte col, ubyte row, ubyte character, ubyte charcolor) {
sub setcc (ubyte col, ubyte row, ubyte character, ubyte charcolor_ignored) {
; ---- set char at the given position on the screen. charcolor is ignored on PET
; TODO: Romable
%asm {{
lda row
asl a
tay
lda setchr._screenrows+1,y
sta _charmod+2
sta P8ZP_SCRATCH_W1+1
lda setchr._screenrows,y
clc
adc col
sta _charmod+1
sta P8ZP_SCRATCH_W1
bcc +
inc _charmod+2
inc P8ZP_SCRATCH_W1+1
+ lda character
_charmod sta $ffff ; modified
ldy #0
sta (P8ZP_SCRATCH_W1),y
rts
}}
}

View File

@@ -7,8 +7,7 @@ main {
txt.home()
for cx16.r11L in 0 to 20 {
for cx16.r10L in 0 to 30 {
txt.setchr(cx16.r10L, cx16.r11L, sc:'*')
txt.setclr(cx16.r10L, cx16.r11L, txt.getclr(cx16.r10L, cx16.r11L)+1)
txt.setcc(cx16.r10L, cx16.r11L, sc:'*', 7)
}
}
}