fix several remaining bool return values in library routines

This commit is contained in:
Irmen de Jong 2024-02-28 00:34:35 +01:00
parent dba0846866
commit c532e28841
10 changed files with 21 additions and 22 deletions

View File

@ -105,7 +105,7 @@ romsub $FFF3 = IOBASE() -> uword @ XY ; read base addr
; ---- utilities -----
asmsub STOP2() clobbers(X) -> ubyte @A {
asmsub STOP2() clobbers(X) -> bool @A {
; -- check if STOP key was pressed, returns true if so. More convenient to use than STOP() because that only sets the carry status flag.
%asm {{
jsr cbm.STOP

View File

@ -102,7 +102,7 @@ romsub $FFED = SCREEN() -> ubyte @ X, ubyte @ Y ; read number of
romsub $FFF0 = PLOT(ubyte col @ Y, ubyte row @ X, bool dir @ Pc) -> ubyte @ X, ubyte @ Y ; read/set position of cursor on screen. Use txt.plot for a 'safe' wrapper that preserves X.
romsub $FFF3 = IOBASE() -> uword @ XY ; read base address of I/O devices
asmsub STOP2() clobbers(X) -> ubyte @A {
asmsub STOP2() clobbers(X) -> bool @A {
; -- check if STOP key was pressed, returns true if so. More convenient to use than STOP() because that only sets the carry status flag.
%asm {{
jsr cbm.STOP

View File

@ -70,7 +70,7 @@ diskio {
void cbm.CHRIN() ; skip 2 bytes
void cbm.CHRIN()
status = cbm.READST()
if cbm.STOP2()!=0
if cbm.STOP2()
break
}
status = cbm.READST()
@ -659,7 +659,7 @@ io_error:
return $2000 * (cx16.getrambank() - startbank) + endaddress - startaddress
}
asmsub vload(str name @R0, ubyte bank @A, uword startaddress @R1) clobbers(X, Y) -> ubyte @A {
asmsub vload(str name @R0, ubyte bank @A, uword startaddress @R1) clobbers(X, Y) -> bool @A {
; -- like the basic command VLOAD "filename",drivenumber,bank,address
; loads a file into Vera's video memory in the given bank:address, returns success in A
; the file has to have the usual 2 byte header (which will be skipped)
@ -698,7 +698,7 @@ internal_vload:
}}
}
asmsub vload_raw(str name @R0, ubyte bank @A, uword startaddress @R1) clobbers(X, Y) -> ubyte @A {
asmsub vload_raw(str name @R0, ubyte bank @A, uword startaddress @R1) clobbers(X, Y) -> bool @A {
; -- like the basic command BVLOAD "filename",drivenumber,bank,address
; loads a file into Vera's video memory in the given bank:address, returns success in A
; the file is read fully including the first two bytes.

View File

@ -606,7 +606,7 @@ _done
plot(xx, yy, draw)
}
sub pget(uword @zp xx, uword yy) -> ubyte {
sub pget(uword @zp xx, uword yy) -> bool {
%asm {{
lda p8v_xx
and #7
@ -708,7 +708,7 @@ _done
}}
yy+=dy
}
cx16.r11L = pget(xx as uword, yy as uword) ; old_color
cx16.r11L = pget(xx as uword, yy as uword) as ubyte ; old_color
if cx16.r11L == cx16.r10L
return
if xx<0 or xx>width-1 or yy<0 or yy>height-1
@ -720,7 +720,7 @@ _done
pop_stack()
xx = x1
while xx >= 0 {
if pget(xx as uword, yy as uword) != cx16.r11L
if pget(xx as uword, yy as uword) as ubyte != cx16.r11L
break
xx--
}
@ -737,7 +737,7 @@ _done
do {
cx16.r9s = xx
while xx <= width-1 {
if pget(xx as uword, yy as uword) != cx16.r11L
if pget(xx as uword, yy as uword) as ubyte != cx16.r11L
break
xx++
}
@ -750,7 +750,7 @@ _done
skip:
xx++
while xx <= x2 {
if pget(xx as uword, yy as uword) == cx16.r11L
if pget(xx as uword, yy as uword) as ubyte == cx16.r11L
break
xx++
}

View File

@ -53,8 +53,8 @@ romsub $FFF3 = IOBASE() -> uword @ XY ; read base addr
; ---- utility
asmsub STOP2() clobbers(X) -> ubyte @A {
; -- check if STOP key was pressed, returns true if so. More convenient to use than STOP() because that only sets the carry status flag.
asmsub STOP2() clobbers(X) -> bool @A {
; -- check if STOP key was pressed, returns true if so. More convenient to use than STOP() because that only sets the zero status flag.
%asm {{
jsr cbm.STOP
beq +

View File

@ -59,7 +59,7 @@ diskio {
void cbm.CHRIN() ; skip 2 bytes
void cbm.CHRIN()
status = cbm.READST()
if cbm.STOP2()!=0
if cbm.STOP2()
break
}
status = cbm.READST()

View File

@ -34,7 +34,7 @@ romsub $FFE4 = GETIN() clobbers(X,Y) -> bool @Pc, ubyte @ A ; get a characte
romsub $FFE7 = CLALL() clobbers(A,X) ; close all files
romsub $FFEA = UDTIM() clobbers(A,X) ; update the software clock
asmsub STOP2() clobbers(X) -> ubyte @A {
asmsub STOP2() clobbers(X) -> bool @A {
; -- check if STOP key was pressed, returns true if so. More convenient to use than STOP() because that only sets the carry status flag.
%asm {{
jsr cbm.STOP

View File

@ -359,8 +359,8 @@ monogfx {
plot(xx, yy, draw)
}
sub pget(uword @zp xx, uword yy) -> ubyte {
return sys.gfx_getpixel(xx, yy)
sub pget(uword @zp xx, uword yy) -> bool {
return sys.gfx_getpixel(xx, yy) as bool
}
sub fill(uword x, uword y, bool draw) {
@ -411,7 +411,7 @@ monogfx {
pop_stack()
xx = x1
while xx >= 0 {
if pget(xx as uword, yy as uword) != cx16.r11L
if pget(xx as uword, yy as uword) as ubyte != cx16.r11L
break
xx--
}
@ -428,7 +428,7 @@ monogfx {
do {
cx16.r9 = xx as uword
while xx <= width-1 {
if pget(xx as uword, yy as uword) != cx16.r11L
if pget(xx as uword, yy as uword) as ubyte != cx16.r11L
break
xx++
}
@ -441,7 +441,7 @@ monogfx {
skip:
xx++
while xx <= x2 {
if pget(xx as uword, yy as uword) == cx16.r11L
if pget(xx as uword, yy as uword) as ubyte == cx16.r11L
break
xx++
}

View File

@ -1,10 +1,9 @@
TODO
====
floatparse is a lot larger
floatparse is a lot larger (if string.isdigit() -> uses rols instead of just bcc)
snow is a lot larger
neofetch is larger
chess is larger

View File

@ -50,7 +50,7 @@ main {
txt.print("\nreading 64kb using vload() into vram")
cbm.SETTIM(0,0,0)
if diskio.vload("benchmark.dat", 0, $0000)==0
if not diskio.vload("benchmark.dat", 0, $0000)
sys.exit(1)
print_speed(cbm.RDTIM16())