txt.getchr() is romable

This commit is contained in:
Irmen de Jong 2025-04-16 23:32:18 +02:00
parent ae65266a4a
commit 063de3801d
4 changed files with 19 additions and 25 deletions

View File

@ -321,21 +321,21 @@ _screenrows .word cbm.Screen + range(0, 1000, 40)
asmsub getchr (ubyte col @A, ubyte row @Y) clobbers(Y) -> ubyte @ A {
; ---- get the character in the screen matrix at the given location
; TODO: Romable
%asm {{
pha
tya
asl a
tay
lda setchr._screenrows+1,y
sta _mod+2
sta P8ZP_SCRATCH_W1+1
pla
clc
adc setchr._screenrows,y
sta _mod+1
bcc _mod
inc _mod+2
_mod lda $ffff ; modified
sta P8ZP_SCRATCH_W1
bcc +
inc P8ZP_SCRATCH_W1+1
+ ldy #0
lda (P8ZP_SCRATCH_W1),y
rts
}}
}

View File

@ -324,21 +324,21 @@ _screenrows .word cbm.Screen + range(0, 1000, 40)
asmsub getchr (ubyte col @A, ubyte row @Y) clobbers(Y) -> ubyte @ A {
; ---- get the character in the screen matrix at the given location
; TODO: Romable
%asm {{
pha
tya
asl a
tay
lda setchr._screenrows+1,y
sta _mod+2
sta P8ZP_SCRATCH_W1+1
pla
clc
adc setchr._screenrows,y
sta _mod+1
bcc _mod
inc _mod+2
_mod lda $ffff ; modified
sta P8ZP_SCRATCH_W1
bcc +
inc P8ZP_SCRATCH_W1+1
+ ldy #0
lda (P8ZP_SCRATCH_W1),y
rts
}}
}

View File

@ -178,21 +178,21 @@ _screenrows .word cbm.Screen + range(0, 1000, 40)
asmsub getchr (ubyte col @A, ubyte row @Y) clobbers(Y) -> ubyte @ A {
; ---- get the character in the screen matrix at the given location
; TODO: Romable
%asm {{
pha
tya
asl a
tay
lda setchr._screenrows+1,y
sta _mod+2
sta P8ZP_SCRATCH_W1+1
pla
clc
adc setchr._screenrows,y
sta _mod+1
bcc _mod
inc _mod+2
_mod lda $ffff ; modified
sta P8ZP_SCRATCH_W1
bcc +
inc P8ZP_SCRATCH_W1+1
+ ldy #0
lda (P8ZP_SCRATCH_W1),y
rts
}}
}

View File

@ -7,14 +7,8 @@ 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.setchr(cx16.r10L, cx16.r11L, txt.getchr(cx16.r10L, cx16.r11L)+1)
}
}
cx16.r10L = txt.getchr(10,5)
txt.setchr(10,5,sc:'*')
cx16.r11L = txt.getchr(10,5)
txt.print_ub(cx16.r10L)
txt.spc()
txt.print_ub(cx16.r11L)
}
}