mirror of
https://github.com/irmen/prog8.git
synced 2024-07-30 01:29:08 +00:00
added txt.column()
This commit is contained in:
parent
321fdd10d1
commit
1bbd77fddb
@ -31,6 +31,16 @@ sub spc() {
|
|||||||
txt.chrout(' ')
|
txt.chrout(' ')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
asmsub column(ubyte col @A) clobbers(A, X, Y) {
|
||||||
|
; ---- set the cursor on the given column (starting with 0) on the current line
|
||||||
|
%asm {{
|
||||||
|
sec
|
||||||
|
jsr c64.PLOT
|
||||||
|
tay
|
||||||
|
clc
|
||||||
|
jmp c64.PLOT
|
||||||
|
}}
|
||||||
|
}
|
||||||
|
|
||||||
asmsub fill_screen (ubyte char @ A, ubyte color @ 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.
|
||||||
|
@ -31,6 +31,16 @@ sub spc() {
|
|||||||
txt.chrout(' ')
|
txt.chrout(' ')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
asmsub column(ubyte col @A) clobbers(A, X, Y) {
|
||||||
|
; ---- set the cursor on the given column (starting with 0) on the current line
|
||||||
|
%asm {{
|
||||||
|
sec
|
||||||
|
jsr c64.PLOT
|
||||||
|
tay
|
||||||
|
clc
|
||||||
|
jmp c64.PLOT
|
||||||
|
}}
|
||||||
|
}
|
||||||
|
|
||||||
asmsub fill_screen (ubyte char @ A, ubyte color @ 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.
|
||||||
@ -588,90 +598,90 @@ asmsub input_chars (uword buffer @ AY) clobbers(A) -> ubyte @ Y {
|
|||||||
asmsub setchr (ubyte col @X, ubyte row @Y, ubyte character @A) clobbers(A) {
|
asmsub setchr (ubyte col @X, ubyte row @Y, ubyte character @A) clobbers(A) {
|
||||||
; ---- sets the character in the screen matrix at the given position
|
; ---- sets the character in the screen matrix at the given position
|
||||||
%asm {{
|
%asm {{
|
||||||
pha
|
pha
|
||||||
txa
|
txa
|
||||||
asl a
|
asl a
|
||||||
stz cx16.VERA_CTRL
|
stz cx16.VERA_CTRL
|
||||||
stz cx16.VERA_ADDR_H
|
stz cx16.VERA_ADDR_H
|
||||||
sta cx16.VERA_ADDR_L
|
sta cx16.VERA_ADDR_L
|
||||||
sty cx16.VERA_ADDR_M
|
sty cx16.VERA_ADDR_M
|
||||||
pla
|
pla
|
||||||
sta cx16.VERA_DATA0
|
sta cx16.VERA_DATA0
|
||||||
rts
|
rts
|
||||||
}}
|
}}
|
||||||
}
|
}
|
||||||
|
|
||||||
asmsub getchr (ubyte col @A, ubyte row @Y) -> ubyte @ A {
|
asmsub getchr (ubyte col @A, ubyte row @Y) -> ubyte @ A {
|
||||||
; ---- get the character in the screen matrix at the given location
|
; ---- get the character in the screen matrix at the given location
|
||||||
%asm {{
|
%asm {{
|
||||||
asl a
|
asl a
|
||||||
stz cx16.VERA_CTRL
|
stz cx16.VERA_CTRL
|
||||||
stz cx16.VERA_ADDR_H
|
stz cx16.VERA_ADDR_H
|
||||||
sta cx16.VERA_ADDR_L
|
sta cx16.VERA_ADDR_L
|
||||||
sty cx16.VERA_ADDR_M
|
sty cx16.VERA_ADDR_M
|
||||||
lda cx16.VERA_DATA0
|
lda cx16.VERA_DATA0
|
||||||
rts
|
rts
|
||||||
}}
|
}}
|
||||||
}
|
}
|
||||||
|
|
||||||
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
|
||||||
%asm {{
|
%asm {{
|
||||||
pha
|
pha
|
||||||
txa
|
txa
|
||||||
asl a
|
asl a
|
||||||
ina
|
ina
|
||||||
stz cx16.VERA_CTRL
|
stz cx16.VERA_CTRL
|
||||||
stz cx16.VERA_ADDR_H
|
stz cx16.VERA_ADDR_H
|
||||||
sta cx16.VERA_ADDR_L
|
sta cx16.VERA_ADDR_L
|
||||||
sty cx16.VERA_ADDR_M
|
sty cx16.VERA_ADDR_M
|
||||||
pla
|
pla
|
||||||
sta cx16.VERA_DATA0
|
sta cx16.VERA_DATA0
|
||||||
rts
|
rts
|
||||||
}}
|
}}
|
||||||
}
|
}
|
||||||
|
|
||||||
asmsub getclr (ubyte col @A, ubyte row @Y) -> ubyte @ A {
|
asmsub getclr (ubyte col @A, ubyte row @Y) -> ubyte @ A {
|
||||||
; ---- get the color in the screen color matrix at the given location
|
; ---- get the color in the screen color matrix at the given location
|
||||||
%asm {{
|
%asm {{
|
||||||
asl a
|
asl a
|
||||||
ina
|
ina
|
||||||
stz cx16.VERA_CTRL
|
stz cx16.VERA_CTRL
|
||||||
stz cx16.VERA_ADDR_H
|
stz cx16.VERA_ADDR_H
|
||||||
sta cx16.VERA_ADDR_L
|
sta cx16.VERA_ADDR_L
|
||||||
sty cx16.VERA_ADDR_M
|
sty cx16.VERA_ADDR_M
|
||||||
lda cx16.VERA_DATA0
|
lda cx16.VERA_DATA0
|
||||||
rts
|
rts
|
||||||
}}
|
}}
|
||||||
}
|
}
|
||||||
|
|
||||||
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
|
||||||
%asm {{
|
%asm {{
|
||||||
phx
|
phx
|
||||||
lda column
|
lda column
|
||||||
asl a
|
asl a
|
||||||
tax
|
tax
|
||||||
ldy row
|
ldy row
|
||||||
lda charcolor
|
lda charcolor
|
||||||
and #$0f
|
and #$0f
|
||||||
sta P8ZP_SCRATCH_B1
|
sta P8ZP_SCRATCH_B1
|
||||||
stz cx16.VERA_CTRL
|
stz cx16.VERA_CTRL
|
||||||
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
|
||||||
lda char
|
lda char
|
||||||
sta cx16.VERA_DATA0
|
sta cx16.VERA_DATA0
|
||||||
inx
|
inx
|
||||||
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
|
||||||
lda cx16.VERA_DATA0
|
lda cx16.VERA_DATA0
|
||||||
and #$f0
|
and #$f0
|
||||||
ora P8ZP_SCRATCH_B1
|
ora P8ZP_SCRATCH_B1
|
||||||
sta cx16.VERA_DATA0
|
sta cx16.VERA_DATA0
|
||||||
plx
|
plx
|
||||||
rts
|
rts
|
||||||
}}
|
}}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,6 +4,16 @@
|
|||||||
main {
|
main {
|
||||||
|
|
||||||
sub start() {
|
sub start() {
|
||||||
txt.print("hello")
|
txt.print("hello\n")
|
||||||
|
txt.column(3)
|
||||||
|
txt.print("hello2\n")
|
||||||
|
txt.column(8)
|
||||||
|
txt.print("hello3\n")
|
||||||
|
txt.column(34)
|
||||||
|
txt.print("hello4\n")
|
||||||
|
txt.column(1)
|
||||||
|
txt.print("hello5\n")
|
||||||
|
txt.column(0)
|
||||||
|
txt.print("hello6\n")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user