mirror of
https://github.com/irmen/prog8.git
synced 2025-10-25 22:17:23 +00:00
added txt.size() to return text screen width and height in 1 call. Also fixed txt.width/height on the C128 (where SCREEN reports 1 less for them...)
This commit is contained in:
@@ -406,6 +406,7 @@ asmsub width() clobbers(X,Y) -> ubyte @A {
|
||||
; -- returns the text screen width (number of columns)
|
||||
%asm {{
|
||||
jsr cbm.SCREEN
|
||||
inx
|
||||
txa
|
||||
rts
|
||||
}}
|
||||
@@ -415,11 +416,22 @@ asmsub height() clobbers(X, Y) -> ubyte @A {
|
||||
; -- returns the text screen height (number of rows)
|
||||
%asm {{
|
||||
jsr cbm.SCREEN
|
||||
iny
|
||||
tya
|
||||
rts
|
||||
}}
|
||||
}
|
||||
|
||||
asmsub size() clobbers(A) -> ubyte @X, ubyte @Y {
|
||||
; -- returns the text screen width in X and height in Y (number of columns and rows)
|
||||
%asm {{
|
||||
jsr cbm.SCREEN
|
||||
inx
|
||||
iny
|
||||
rts
|
||||
}}
|
||||
}
|
||||
|
||||
asmsub waitkey() -> ubyte @A {
|
||||
%asm {{
|
||||
- jsr cbm.GETIN
|
||||
|
||||
@@ -424,6 +424,14 @@ asmsub height() clobbers(X, Y) -> ubyte @A {
|
||||
}}
|
||||
}
|
||||
|
||||
asmsub size() clobbers(A) -> ubyte @X, ubyte @Y {
|
||||
; -- returns the text screen width in X and height in Y (number of columns and rows)
|
||||
%asm {{
|
||||
jmp cbm.SCREEN
|
||||
}}
|
||||
}
|
||||
|
||||
|
||||
asmsub waitkey() -> ubyte @A {
|
||||
%asm {{
|
||||
- jsr cbm.GETIN
|
||||
|
||||
@@ -615,6 +615,13 @@ asmsub height() clobbers(X, Y) -> ubyte @A {
|
||||
}}
|
||||
}
|
||||
|
||||
asmsub size() clobbers(A) -> ubyte @X, ubyte @Y {
|
||||
; -- returns the text screen width in X and height in Y (number of columns and rows)
|
||||
%asm {{
|
||||
jmp cbm.SCREEN
|
||||
}}
|
||||
}
|
||||
|
||||
asmsub waitkey() -> ubyte @A {
|
||||
%asm {{
|
||||
- jsr cbm.GETIN
|
||||
|
||||
@@ -236,6 +236,17 @@ asmsub height() clobbers(X, Y) -> ubyte @A {
|
||||
}}
|
||||
}
|
||||
|
||||
asmsub size() clobbers(A) -> ubyte @X, ubyte @Y {
|
||||
; -- returns the text screen width in X and height in Y (number of columns and rows)
|
||||
%asm {{
|
||||
jsr width
|
||||
tax
|
||||
jsr height
|
||||
tay
|
||||
rts
|
||||
}}
|
||||
}
|
||||
|
||||
asmsub waitkey() -> ubyte @A {
|
||||
%asm {{
|
||||
- jsr cbm.GETIN
|
||||
|
||||
@@ -21,6 +21,11 @@ sub height() -> ubyte {
|
||||
}}
|
||||
}
|
||||
|
||||
sub size() -> ubyte, ubyte {
|
||||
; -- returns the text screen width and height (number of columns and rows)
|
||||
return width(), height()
|
||||
}
|
||||
|
||||
sub clear_screen() {
|
||||
str @shared sequence = "\x1b[2J\x1B[H"
|
||||
%ir {{
|
||||
|
||||
@@ -825,6 +825,7 @@ txt {
|
||||
setcc (ubyte col, ubyte row, ubyte character, ubyte charcolor)
|
||||
setchr (ubyte col @X, ubyte row @Y, ubyte character @A) clobbers (A,Y)
|
||||
setclr (ubyte col @X, ubyte row @Y, ubyte color @A) clobbers (A,Y)
|
||||
size () clobbers (A) -> ubyte @X, ubyte @Y
|
||||
spc ()
|
||||
uppercase ()
|
||||
waitkey () -> ubyte @A
|
||||
|
||||
@@ -938,6 +938,7 @@ txt {
|
||||
setcc (ubyte col, ubyte row, ubyte character, ubyte charcolor)
|
||||
setchr (ubyte col @X, ubyte row @Y, ubyte character @A) clobbers (A,Y)
|
||||
setclr (ubyte col @X, ubyte row @Y, ubyte color @A) clobbers (A,Y)
|
||||
size () clobbers (A) -> ubyte @X, ubyte @Y
|
||||
spc ()
|
||||
uppercase ()
|
||||
waitkey () -> ubyte @A
|
||||
|
||||
@@ -1422,6 +1422,7 @@ txt {
|
||||
setcc2 (ubyte col, ubyte row, ubyte character, ubyte colors)
|
||||
setchr (ubyte col @X, ubyte row @Y, ubyte character @A) clobbers (A)
|
||||
setclr (ubyte col @X, ubyte row @Y, ubyte color @A) clobbers (A)
|
||||
size () clobbers (A) -> ubyte @X, ubyte @Y
|
||||
spc ()
|
||||
t256c (bool enable)
|
||||
uppercase ()
|
||||
|
||||
@@ -540,6 +540,7 @@ txt {
|
||||
setcc (ubyte col, ubyte row, ubyte character, ubyte charcolor_ignored)
|
||||
setchr (ubyte col @X, ubyte row @Y, ubyte character @A) clobbers (A,Y)
|
||||
setclr (ubyte col, ubyte row, ubyte color)
|
||||
size () clobbers (A) -> ubyte @X, ubyte @Y
|
||||
spc ()
|
||||
uppercase ()
|
||||
waitkey () -> ubyte @A
|
||||
|
||||
@@ -559,6 +559,7 @@ txt {
|
||||
rvs_off ()
|
||||
rvs_on ()
|
||||
setchr (ubyte col, ubyte row, ubyte char)
|
||||
size () -> ubyte, ubyte
|
||||
spc ()
|
||||
uppercase ()
|
||||
width () -> ubyte
|
||||
|
||||
@@ -412,20 +412,28 @@ asmsub waitkey() -> ubyte @A {
|
||||
|
||||
asmsub width() clobbers(X,Y) -> ubyte @A {
|
||||
; -- returns the text screen width (number of columns)
|
||||
; TODO
|
||||
%asm {{
|
||||
lda #0
|
||||
lda #DEFAULT_WIDTH
|
||||
rts
|
||||
}}
|
||||
}
|
||||
|
||||
asmsub height() clobbers(X, Y) -> ubyte @A {
|
||||
; -- returns the text screen height (number of rows)
|
||||
; TODO
|
||||
%asm {{
|
||||
lda #0
|
||||
lda #DEFAULT_HEIGHT
|
||||
rts
|
||||
}}
|
||||
}
|
||||
|
||||
asmsub size() clobbers(A) -> ubyte @X, ubyte @Y {
|
||||
; -- returns the text screen width in X and height in Y (number of columns and rows)
|
||||
%asm {{
|
||||
ldx #DEFAULT_WIDTH
|
||||
ldy #DEFAULT_HEIGHT
|
||||
rts
|
||||
}}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -417,7 +417,7 @@ asmsub plot (ubyte col @ Y, ubyte row @ X) {
|
||||
asmsub width() clobbers(X,Y) -> ubyte @A {
|
||||
; -- returns the text screen width (number of columns)
|
||||
%asm {{
|
||||
lda DEFAULT_WIDTH
|
||||
lda #DEFAULT_WIDTH
|
||||
rts
|
||||
}}
|
||||
}
|
||||
@@ -425,11 +425,21 @@ asmsub width() clobbers(X,Y) -> ubyte @A {
|
||||
asmsub height() clobbers(X, Y) -> ubyte @A {
|
||||
; -- returns the text screen height (number of rows)
|
||||
%asm {{
|
||||
lda DEFAULT_HEIGHT
|
||||
lda #DEFAULT_HEIGHT
|
||||
rts
|
||||
}}
|
||||
}
|
||||
|
||||
asmsub size() clobbers(A) -> ubyte @X, ubyte @Y {
|
||||
; -- returns the text screen width in X and height in Y (number of columns and rows)
|
||||
%asm {{
|
||||
ldx #DEFAULT_HEIGHT
|
||||
ldy #DEFAULT_HEIGHT
|
||||
rts
|
||||
}}
|
||||
}
|
||||
|
||||
|
||||
; TODO: jmp to cbm.CHRIN?
|
||||
asmsub waitkey() -> ubyte @A {
|
||||
%asm {{
|
||||
|
||||
@@ -1,18 +1,32 @@
|
||||
%import textio
|
||||
%import math
|
||||
%zeropage basicsafe
|
||||
%option no_sysinit
|
||||
|
||||
main {
|
||||
sub start() {
|
||||
long @shared lv, lv2
|
||||
ubyte w,h
|
||||
|
||||
lv = $11111111
|
||||
lv2 = $55555555
|
||||
w,h = txt.size()
|
||||
txt.print("Screen size: ")
|
||||
txt.print_ub(w)
|
||||
txt.spc()
|
||||
txt.print_ub(h)
|
||||
txt.nl()
|
||||
txt.print("width/height=")
|
||||
txt.print_ub(txt.width())
|
||||
txt.spc()
|
||||
txt.print_ub(txt.height())
|
||||
txt.nl()
|
||||
|
||||
lv = lv | lv2 ^ 999999
|
||||
|
||||
txt.print_ulhex(lv, true) ; $555b177b
|
||||
; long @shared lv, lv2
|
||||
;
|
||||
; lv = $11111111
|
||||
; lv2 = $55555555
|
||||
;
|
||||
; lv = lv | lv2 ^ 999999
|
||||
;
|
||||
; txt.print_ulhex(lv, true) ; $555b177b
|
||||
|
||||
|
||||
; long @shared lv1 = $12345678
|
||||
|
||||
Reference in New Issue
Block a user