mirror of
https://github.com/irmen/prog8.git
synced 2024-09-08 10:55:08 +00:00
added textio.setcc2() on commanderX16 to enable setting fg+bg colors.
This commit is contained in:
parent
194fbcdd91
commit
81930312ff
@ -626,6 +626,8 @@ asmsub getchr (ubyte col @A, ubyte row @Y) -> ubyte @ A {
|
|||||||
|
|
||||||
asmsub setclr (ubyte col @X, ubyte row @Y, ubyte color @A) clobbers(A) {
|
asmsub setclr (ubyte col @X, ubyte row @Y, ubyte color @A) clobbers(A) {
|
||||||
; ---- set the color in A on the screen matrix at the given position
|
; ---- set the color in A on the screen matrix at the given position
|
||||||
|
; note: on the CommanderX16 this allows you to set both Fg and Bg colors;
|
||||||
|
; use the high nybble in A to set the Bg color!
|
||||||
%asm {{
|
%asm {{
|
||||||
pha
|
pha
|
||||||
txa
|
txa
|
||||||
@ -657,6 +659,8 @@ asmsub getclr (ubyte col @A, ubyte row @Y) -> ubyte @ A {
|
|||||||
|
|
||||||
sub setcc (ubyte column, ubyte row, ubyte char, ubyte charcolor) {
|
sub setcc (ubyte column, ubyte row, ubyte char, ubyte charcolor) {
|
||||||
; ---- set char+color at the given position on the screen
|
; ---- set char+color at the given position on the screen
|
||||||
|
; note: color handling is the same as on the C64: it only sets the foreground color.
|
||||||
|
; use setcc2 if you want Cx-16 specific feature of setting both Bg+Fg colors.
|
||||||
%asm {{
|
%asm {{
|
||||||
phx
|
phx
|
||||||
lda column
|
lda column
|
||||||
@ -685,6 +689,33 @@ sub setcc (ubyte column, ubyte row, ubyte char, ubyte charcolor) {
|
|||||||
}}
|
}}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub setcc2 (ubyte column, ubyte row, ubyte char, ubyte colors) {
|
||||||
|
; ---- set char+color at the given position on the screen
|
||||||
|
; note: on the CommanderX16 this allows you to set both Fg and Bg colors;
|
||||||
|
; use the high nybble in A to set the Bg color!
|
||||||
|
%asm {{
|
||||||
|
phx
|
||||||
|
lda column
|
||||||
|
asl a
|
||||||
|
tax
|
||||||
|
ldy row
|
||||||
|
stz cx16.VERA_CTRL
|
||||||
|
stz cx16.VERA_ADDR_H
|
||||||
|
stx cx16.VERA_ADDR_L
|
||||||
|
sty cx16.VERA_ADDR_M
|
||||||
|
lda char
|
||||||
|
sta cx16.VERA_DATA0
|
||||||
|
inx
|
||||||
|
stz cx16.VERA_ADDR_H
|
||||||
|
stx cx16.VERA_ADDR_L
|
||||||
|
sty cx16.VERA_ADDR_M
|
||||||
|
lda colors
|
||||||
|
sta cx16.VERA_DATA0
|
||||||
|
plx
|
||||||
|
rts
|
||||||
|
}}
|
||||||
|
}
|
||||||
|
|
||||||
asmsub plot (ubyte col @ Y, ubyte row @ A) clobbers(A) {
|
asmsub plot (ubyte col @ Y, ubyte row @ A) clobbers(A) {
|
||||||
; ---- safe wrapper around PLOT kernel routine, to save the X register.
|
; ---- safe wrapper around PLOT kernel routine, to save the X register.
|
||||||
%asm {{
|
%asm {{
|
||||||
|
@ -1,33 +1,32 @@
|
|||||||
%import textio
|
%import textio
|
||||||
%zeropage basicsafe
|
%zeropage basicsafe
|
||||||
|
%option no_sysinit
|
||||||
|
|
||||||
main {
|
main {
|
||||||
|
|
||||||
sub start() {
|
sub start() {
|
||||||
|
|
||||||
str text = "44"
|
|
||||||
uword textptr = &text
|
|
||||||
|
|
||||||
ubyte nlen = conv.any2uword(textptr)
|
|
||||||
ubyte lastchr = text[nlen]
|
|
||||||
ubyte valid_operand
|
|
||||||
|
|
||||||
valid_operand = nlen>0 and lastchr==0
|
|
||||||
txt.print("\nvalidoper? ")
|
|
||||||
txt.print_ub(valid_operand)
|
|
||||||
txt.nl()
|
txt.nl()
|
||||||
|
txt.nl()
|
||||||
valid_operand = nlen>0
|
|
||||||
valid_operand = valid_operand and lastchr==0
|
|
||||||
|
|
||||||
txt.print("\nvalidoper? ")
|
|
||||||
txt.print_ub(valid_operand)
|
|
||||||
txt.nl()
|
txt.nl()
|
||||||
|
|
||||||
|
|
||||||
valid_operand = nlen and lastchr==0
|
txt.setcc2(0,0, 'a', $0f)
|
||||||
txt.print("\nvalidoper? ")
|
txt.setcc2(1,0, 'a', $1f)
|
||||||
txt.print_ub(valid_operand)
|
txt.setcc2(2,0, 'a', $2f)
|
||||||
txt.nl()
|
txt.setcc2(3,0, 'a', $3f)
|
||||||
|
txt.setcc2(4,0, 'a', $4f)
|
||||||
|
txt.setcc2(5,0, 'a', $5f)
|
||||||
|
txt.setcc2(6,0, 'a', $6f)
|
||||||
|
txt.setcc2(7,0, 'a', $7f)
|
||||||
|
txt.setcc2(8,0, 'a', $8f)
|
||||||
|
txt.setcc2(9,0, 'a', $9f)
|
||||||
|
txt.setcc2(10,0, 'a', $af)
|
||||||
|
txt.setcc2(11,0, 'a', $bf)
|
||||||
|
txt.setcc2(12,0, 'a', $cf)
|
||||||
|
txt.setcc2(13,0, 'a', $df)
|
||||||
|
txt.setcc2(14,0, 'a', $ef)
|
||||||
|
txt.setcc2(15,0, 'a', $ff)
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user