mirror of
https://github.com/irmen/prog8.git
synced 2024-06-10 20:29:33 +00:00
libraries: add ==0 or !=0 to expressions that depend on implicit conversion from byte to bool
This commit is contained in:
parent
92527b4c1d
commit
1ca3f64bf0
|
@ -9,8 +9,6 @@ import kotlin.math.truncate
|
|||
sealed class PtExpression(val type: DataType, position: Position) : PtNode(position) {
|
||||
|
||||
init {
|
||||
if(type==DataType.BOOL)
|
||||
throw IllegalArgumentException("bool should have become ubyte @$position")
|
||||
if(type==DataType.UNDEFINED) {
|
||||
@Suppress("LeakingThis")
|
||||
when(this) {
|
||||
|
|
|
@ -73,7 +73,7 @@ graphics {
|
|||
}
|
||||
|
||||
word @zp d = 0
|
||||
ubyte positive_ix = true
|
||||
bool positive_ix = true
|
||||
if dx < 0 {
|
||||
dx = -dx
|
||||
positive_ix = false
|
||||
|
@ -173,7 +173,7 @@ graphics {
|
|||
ubyte separate_pixels = lsb(xx) & 7
|
||||
uword pixaddr = get_y_lookup(yy) + (xx&$fff8)
|
||||
|
||||
if separate_pixels {
|
||||
if separate_pixels!=0 {
|
||||
%asm {{
|
||||
lda p8v_pixaddr
|
||||
sta P8ZP_SCRATCH_W1
|
||||
|
@ -191,7 +191,7 @@ graphics {
|
|||
length -= 8
|
||||
}
|
||||
|
||||
if length {
|
||||
if length!=0 {
|
||||
%asm {{
|
||||
lda p8v_length
|
||||
and #7
|
||||
|
|
|
@ -126,7 +126,7 @@ bmx {
|
|||
; If you're saving the whole screen width, you can leave screenwidth at 0.
|
||||
; Returns: success status. If false, error_message points to the error message string.
|
||||
error_message = 0
|
||||
if compression {
|
||||
if compression!=0 {
|
||||
error_message = "compression not supported"
|
||||
return false
|
||||
}
|
||||
|
@ -184,7 +184,7 @@ save_end:
|
|||
for cx16.r0L in 0 to sizeof(header)-1 {
|
||||
header[cx16.r0L] = cbm.CHRIN()
|
||||
}
|
||||
return not cbm.READST()
|
||||
return cbm.READST()==0
|
||||
}
|
||||
|
||||
sub read_palette() -> bool {
|
||||
|
@ -197,7 +197,7 @@ save_end:
|
|||
do {
|
||||
cx16.r4L = cbm.CHRIN()
|
||||
cx16.r4H = cbm.CHRIN()
|
||||
if cx16.r3 {
|
||||
if cx16.r3!=0 {
|
||||
pokew(cx16.r3, cx16.r4) ; into memory
|
||||
cx16.r3+=2
|
||||
} else {
|
||||
|
@ -206,7 +206,7 @@ save_end:
|
|||
}
|
||||
cx16.r2L--
|
||||
} until cx16.r2L==0
|
||||
return cbm.READST()==0 or cbm.READST()&$40 ; no error or eof?
|
||||
return cbm.READST()==0 or cbm.READST()&$40!=0 ; no error or eof?
|
||||
}
|
||||
|
||||
sub read_bitmap_padded(ubyte vbank, uword vaddr, uword screenwidth) -> bool {
|
||||
|
@ -220,7 +220,7 @@ save_end:
|
|||
if_cs
|
||||
vbank++
|
||||
}
|
||||
return cbm.READST()==0 or cbm.READST()&$40 ; no error or eof?
|
||||
return cbm.READST()==0 or cbm.READST()&$40!=0 ; no error or eof?
|
||||
}
|
||||
|
||||
sub read_bitmap(ubyte vbank, uword vaddr) -> bool {
|
||||
|
@ -229,11 +229,11 @@ save_end:
|
|||
cx16.vaddr(vbank, vaddr, 0, 1)
|
||||
repeat height
|
||||
read_scanline(cx16.r3)
|
||||
return cbm.READST()==0 or cbm.READST()&$40 ; no error or eof?
|
||||
return cbm.READST()==0 or cbm.READST()&$40!=0 ; no error or eof?
|
||||
}
|
||||
|
||||
sub read_scanline(uword size) {
|
||||
while size {
|
||||
while size!=0 {
|
||||
cx16.r0 = cx16.MACPTR(min(255, size) as ubyte, &cx16.VERA_DATA0, true)
|
||||
if_cs {
|
||||
; no MACPTR support
|
||||
|
@ -251,7 +251,7 @@ save_end:
|
|||
for cx16.r0L in 0 to sizeof(header)-1 {
|
||||
cbm.CHROUT(header[cx16.r0L])
|
||||
}
|
||||
return not cbm.READST()
|
||||
return cbm.READST()==0
|
||||
}
|
||||
|
||||
sub write_palette() -> bool {
|
||||
|
@ -262,7 +262,7 @@ save_end:
|
|||
cx16.r2L = lsb(palette_entries)
|
||||
cx16.vaddr(1, $fa00+palette_start*2, 0, 1)
|
||||
do {
|
||||
if cx16.r3 {
|
||||
if cx16.r3!=0 {
|
||||
cbm.CHROUT(@(cx16.r3)) ; from memory
|
||||
cx16.r3++
|
||||
cbm.CHROUT(@(cx16.r3))
|
||||
|
@ -273,7 +273,7 @@ save_end:
|
|||
}
|
||||
cx16.r2L--
|
||||
} until cx16.r2L==0
|
||||
return not cbm.READST()
|
||||
return cbm.READST()==0
|
||||
}
|
||||
|
||||
sub write_bitmap(ubyte vbank, uword vaddr, uword screenwidth) -> bool {
|
||||
|
@ -282,19 +282,19 @@ save_end:
|
|||
cx16.vaddr(vbank, vaddr, 0, 1)
|
||||
cx16.r3 = bytes_per_scanline(width) ; num bytes per image scanline
|
||||
cx16.r2 = 0
|
||||
if screenwidth
|
||||
if screenwidth!=0
|
||||
cx16.r2 = bytes_per_scanline(screenwidth-width) ; num bytes padding per screen scanline
|
||||
repeat height {
|
||||
write_scanline(cx16.r3)
|
||||
repeat cx16.r2
|
||||
cx16.r0L = cx16.VERA_DATA0
|
||||
}
|
||||
return not cbm.READST()
|
||||
return cbm.READST()==0
|
||||
|
||||
sub write_scanline(uword size) {
|
||||
while size {
|
||||
while size!=0 {
|
||||
cx16.r0L = lsb(size)
|
||||
if msb(size)
|
||||
if msb(size)!=0
|
||||
cx16.r0L = 0 ; 256 bytes
|
||||
cx16.r0 = cx16.MCIOUT(cx16.r0L, &cx16.VERA_DATA0, true)
|
||||
if_cs {
|
||||
|
|
|
@ -70,7 +70,7 @@ diskio {
|
|||
void cbm.CHRIN() ; skip 2 bytes
|
||||
void cbm.CHRIN()
|
||||
status = cbm.READST()
|
||||
if cbm.STOP2()
|
||||
if cbm.STOP2()!=0
|
||||
break
|
||||
}
|
||||
status = cbm.READST()
|
||||
|
@ -79,7 +79,7 @@ io_error:
|
|||
cbm.CLRCHN() ; restore default i/o devices
|
||||
cbm.CLOSE(READ_IO_CHANNEL)
|
||||
|
||||
if status and status & $40 == 0 { ; bit 6=end of file
|
||||
if status!=0 and status & $40 == 0 { ; bit 6=end of file
|
||||
txt.print("\ni/o error, status: ")
|
||||
txt.print_ub(status)
|
||||
txt.nl()
|
||||
|
@ -121,7 +121,7 @@ io_error:
|
|||
io_error:
|
||||
cbm.CLRCHN()
|
||||
cbm.CLOSE(READ_IO_CHANNEL)
|
||||
if status and status & $40 == 0
|
||||
if status!=0 and status & $40 == 0
|
||||
return 0
|
||||
return list_filename
|
||||
}
|
||||
|
@ -210,14 +210,14 @@ io_error:
|
|||
ubyte blocks_lsb = cbm.CHRIN()
|
||||
ubyte blocks_msb = cbm.CHRIN()
|
||||
|
||||
if cbm.READST()
|
||||
if cbm.READST()!=0
|
||||
goto close_end
|
||||
|
||||
list_blocks = mkword(blocks_msb, blocks_lsb)
|
||||
|
||||
; read until the filename starts after the first "
|
||||
while cbm.CHRIN()!='\"' {
|
||||
if cbm.READST()
|
||||
if cbm.READST()!=0
|
||||
goto close_end
|
||||
}
|
||||
|
||||
|
@ -240,7 +240,7 @@ io_error:
|
|||
list_filetype[0] = cx16.r15L
|
||||
list_filetype[1] = cbm.CHRIN()
|
||||
list_filetype[2] = cbm.CHRIN()
|
||||
while cbm.CHRIN() {
|
||||
while cbm.CHRIN()!=0 {
|
||||
; read the rest of the entry until the end
|
||||
}
|
||||
|
||||
|
@ -248,7 +248,7 @@ io_error:
|
|||
void cbm.CHRIN()
|
||||
|
||||
if not list_skip_disk_name {
|
||||
if not list_pattern
|
||||
if list_pattern==0
|
||||
return true
|
||||
if string.pattern_match(list_filename, list_pattern)
|
||||
return true
|
||||
|
@ -308,14 +308,14 @@ close_end:
|
|||
; -- read from the currently open file, up to the given number of bytes.
|
||||
; returns the actual number of bytes read. (checks for End-of-file and error conditions)
|
||||
; NOTE: cannot be used to load into VRAM. Use vload() or call cx16.MACPTR() yourself with the vera data register as address.
|
||||
if not iteration_in_progress or not num_bytes
|
||||
if not iteration_in_progress or num_bytes==0
|
||||
return 0
|
||||
|
||||
reset_read_channel()
|
||||
list_blocks = 0 ; we reuse this variable for the total number of bytes read
|
||||
|
||||
uword readsize
|
||||
while num_bytes {
|
||||
while num_bytes!=0 {
|
||||
readsize = 255
|
||||
if num_bytes<readsize
|
||||
readsize = num_bytes
|
||||
|
@ -327,7 +327,7 @@ close_end:
|
|||
if msb(bufferpointer) == $c0
|
||||
bufferpointer = mkword($a0, lsb(bufferpointer)) ; wrap over bank boundary
|
||||
num_bytes -= readsize
|
||||
if cbm.READST() & $40 {
|
||||
if cbm.READST() & $40 !=0 {
|
||||
f_close() ; end of file, close it
|
||||
break
|
||||
}
|
||||
|
@ -341,10 +341,10 @@ byte_read_loop: ; fallback if MACPTR isn't supported on the device
|
|||
lda bufferpointer+1
|
||||
sta m_in_buffer+2
|
||||
}}
|
||||
while num_bytes {
|
||||
if cbm.READST() {
|
||||
while num_bytes!=0 {
|
||||
if cbm.READST()!=0 {
|
||||
f_close()
|
||||
if cbm.READST() & $40 ; eof?
|
||||
if cbm.READST() & $40 !=0 ; eof?
|
||||
return list_blocks ; number of bytes read
|
||||
return 0 ; error.
|
||||
}
|
||||
|
@ -371,7 +371,7 @@ m_in_buffer sta $ffff
|
|||
|
||||
reset_read_channel()
|
||||
uword total_read = 0
|
||||
while not cbm.READST() {
|
||||
while cbm.READST()==0 {
|
||||
cx16.r0 = f_read(bufferpointer, 256)
|
||||
total_read += cx16.r0
|
||||
bufferpointer += cx16.r0
|
||||
|
@ -444,7 +444,7 @@ _end rts
|
|||
cbm.SETLFS(WRITE_IO_CHANNEL, drivenumber, WRITE_IO_CHANNEL)
|
||||
void cbm.OPEN() ; open 13,8,13,"filename"
|
||||
if_cc {
|
||||
return not cbm.READST()
|
||||
return cbm.READST()==0
|
||||
}
|
||||
cbm.CLOSE(WRITE_IO_CHANNEL)
|
||||
f_close_w()
|
||||
|
@ -466,7 +466,7 @@ _end rts
|
|||
if cbm.READST()!=0
|
||||
return false
|
||||
} until num_bytes==0
|
||||
return not cbm.READST()
|
||||
return cbm.READST()==0
|
||||
|
||||
no_mciout:
|
||||
; the device doesn't support MCIOUT, use a normal per-byte write loop
|
||||
|
@ -474,7 +474,7 @@ no_mciout:
|
|||
cbm.CHROUT(@(bufferpointer))
|
||||
bufferpointer++
|
||||
}
|
||||
return not cbm.READST()
|
||||
return cbm.READST()==0
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
@ -506,7 +506,7 @@ no_mciout:
|
|||
goto io_error
|
||||
void cbm.CHKIN(15) ; use #15 as input channel
|
||||
|
||||
while not cbm.READST() {
|
||||
while cbm.READST()==0 {
|
||||
cx16.r5L = cbm.CHRIN()
|
||||
if cx16.r5L=='\r' or cx16.r5L=='\n'
|
||||
break
|
||||
|
@ -562,9 +562,9 @@ io_error:
|
|||
}}
|
||||
|
||||
if_cc
|
||||
cx16.r0L = cbm.READST()==0
|
||||
cx16.r0L = cbm.READST()==0 as ubyte
|
||||
|
||||
return cx16.r0L
|
||||
return cx16.r0L as bool
|
||||
}
|
||||
|
||||
; Use kernal LOAD routine to load the given program file in memory.
|
||||
|
@ -596,7 +596,7 @@ io_error:
|
|||
cbm.SETNAM(string.length(filenameptr), filenameptr)
|
||||
ubyte secondary = 1
|
||||
cx16.r1 = 0
|
||||
if address_override
|
||||
if address_override!=0
|
||||
secondary = 0
|
||||
if headerless
|
||||
secondary |= %00000010 ; activate cx16 kernal headerless load support
|
||||
|
@ -755,7 +755,7 @@ internal_vload:
|
|||
repeat 6 {
|
||||
void cbm.CHRIN()
|
||||
}
|
||||
while cbm.CHRIN() {
|
||||
while cbm.CHRIN()!=0 {
|
||||
; skip first line (drive label)
|
||||
}
|
||||
while cbm.CHRIN()!='"' {
|
||||
|
@ -786,7 +786,7 @@ internal_vload:
|
|||
io_error:
|
||||
cbm.CLRCHN()
|
||||
cbm.CLOSE(READ_IO_CHANNEL)
|
||||
if status and status & $40 == 0
|
||||
if status!=0 and status & $40 == 0
|
||||
return 0
|
||||
if @(cx16.r12)==0 {
|
||||
cx16.r12--
|
||||
|
|
|
@ -62,7 +62,7 @@ gfx2 {
|
|||
}
|
||||
|
||||
init_mode(mode)
|
||||
if active_mode
|
||||
if active_mode!=0
|
||||
clear_screen(0)
|
||||
}
|
||||
|
||||
|
@ -305,17 +305,17 @@ gfx2 {
|
|||
}
|
||||
|
||||
word @zp d = 0
|
||||
cx16.r1L = true ; 'positive_ix'
|
||||
cx16.r1L = 1 ;; true ; 'positive_ix'
|
||||
if dx < 0 {
|
||||
dx = -dx
|
||||
cx16.r1L = false
|
||||
cx16.r1L = 0 ;; false
|
||||
}
|
||||
word @zp dx2 = dx*2
|
||||
word @zp dy2 = dy*2
|
||||
cx16.r14 = x1 ; internal plot X
|
||||
|
||||
if dx >= dy {
|
||||
if cx16.r1L {
|
||||
if cx16.r1L!=0 {
|
||||
repeat {
|
||||
plot(cx16.r14, y1, color)
|
||||
if cx16.r14==x2
|
||||
|
@ -342,7 +342,7 @@ gfx2 {
|
|||
}
|
||||
}
|
||||
else {
|
||||
if cx16.r1L {
|
||||
if cx16.r1L!=0 {
|
||||
repeat {
|
||||
plot(cx16.r14, y1, color)
|
||||
if y1 == y2
|
||||
|
@ -705,7 +705,7 @@ gfx2 {
|
|||
push_stack(xx, xx, yy, 1)
|
||||
push_stack(xx, xx, yy + 1, -1)
|
||||
word left = 0
|
||||
while cx16.r12L {
|
||||
while cx16.r12L!=0 {
|
||||
pop_stack()
|
||||
xx = x1
|
||||
; possible speed optimization: if mode==1 (256c) use vera autodecrement instead of pget(), but code bloat not worth it?
|
||||
|
@ -725,15 +725,15 @@ gfx2 {
|
|||
xx = x1 + 1
|
||||
|
||||
do {
|
||||
cx16.r9 = xx
|
||||
cx16.r9s = xx
|
||||
; possible speed optimization: if mode==1 (256c) use vera autoincrement instead of pget(), but code bloat not worth it?
|
||||
while xx <= width-1 {
|
||||
if pget(xx as uword, yy as uword) != cx16.r11L
|
||||
break
|
||||
xx++
|
||||
}
|
||||
if cx16.r9!=xx
|
||||
horizontal_line(cx16.r9, yy as uword, (xx as uword)-cx16.r9, cx16.r10L)
|
||||
if cx16.r9s!=xx
|
||||
horizontal_line(cx16.r9, yy as uword, xx-cx16.r9s as uword, cx16.r10L)
|
||||
|
||||
push_stack(left, xx - 1, yy, dy)
|
||||
if xx > x2 + 1
|
||||
|
@ -845,7 +845,7 @@ skip:
|
|||
when active_mode {
|
||||
1 -> {
|
||||
; lores 256c
|
||||
while @(sctextptr) {
|
||||
while @(sctextptr)!=0 {
|
||||
chardataptr = charset_addr + (@(sctextptr) as uword)*8
|
||||
cx16.vaddr(charset_bank, chardataptr, 1, 1)
|
||||
repeat 8 {
|
||||
|
@ -874,9 +874,9 @@ skip:
|
|||
; hires 4c
|
||||
; we're going to use a few cx16 registers to make sure every variable is in zeropage in the inner loop.
|
||||
cx16.r11L = color
|
||||
while @(sctextptr) {
|
||||
while @(sctextptr)!=0 {
|
||||
chardataptr = charset_addr + (@(sctextptr) as uword)*8
|
||||
cx16.vaddr(charset_bank, chardataptr, 1, true) ; for reading the chardata from Vera data channel 1
|
||||
cx16.vaddr(charset_bank, chardataptr, 1, 1) ; for reading the chardata from Vera data channel 1
|
||||
position(xx, yy) ; only calculated once, we update vera address in the loop instead
|
||||
cx16.VERA_ADDR_H &= $0f ; no auto increment
|
||||
repeat 8 {
|
||||
|
|
|
@ -57,20 +57,20 @@ graphics {
|
|||
}
|
||||
|
||||
sub fillrect(uword xx, uword yy, uword width, uword height) {
|
||||
cx16.GRAPH_draw_rect(xx, yy, width, height, 0, 1)
|
||||
cx16.GRAPH_draw_rect(xx, yy, width, height, 0, true)
|
||||
}
|
||||
|
||||
sub rect(uword xx, uword yy, uword width, uword height) {
|
||||
cx16.GRAPH_draw_rect(xx, yy, width, height, 0, 0)
|
||||
cx16.GRAPH_draw_rect(xx, yy, width, height, 0, false)
|
||||
}
|
||||
|
||||
sub horizontal_line(uword xx, uword yy, uword length) {
|
||||
if length
|
||||
if length!=0
|
||||
cx16.GRAPH_draw_line(xx, yy, xx+length-1, yy)
|
||||
}
|
||||
|
||||
sub vertical_line(uword xx, uword yy, uword height) {
|
||||
if height
|
||||
if height!=0
|
||||
cx16.GRAPH_draw_line(xx, yy, xx, yy+height-1)
|
||||
}
|
||||
|
||||
|
|
|
@ -162,7 +162,7 @@ _clear
|
|||
}
|
||||
|
||||
ubyte separate_pixels = (8-lsb(xx)) & 7
|
||||
if separate_pixels {
|
||||
if separate_pixels!=0 {
|
||||
if dont_stipple_flag {
|
||||
position(xx,yy)
|
||||
cx16.VERA_ADDR_H &= %00000111 ; vera auto-increment off
|
||||
|
@ -179,7 +179,7 @@ _clear
|
|||
}
|
||||
length -= separate_pixels
|
||||
}
|
||||
if length {
|
||||
if length!=0 {
|
||||
position(xx, yy)
|
||||
separate_pixels = lsb(length) & 7
|
||||
xx += length & $fff8
|
||||
|
@ -340,17 +340,17 @@ _done
|
|||
}
|
||||
|
||||
word @zp d = 0
|
||||
cx16.r1L = true ; 'positive_ix'
|
||||
cx16.r1L = 1 ;; true ; 'positive_ix'
|
||||
if dx < 0 {
|
||||
dx = -dx
|
||||
cx16.r1L = false
|
||||
cx16.r1L = 0 ;; false
|
||||
}
|
||||
word @zp dx2 = dx*2
|
||||
word @zp dy2 = dy*2
|
||||
cx16.r14 = x1 ; internal plot X
|
||||
|
||||
if dx >= dy {
|
||||
if cx16.r1L {
|
||||
if cx16.r1L!=0 {
|
||||
repeat {
|
||||
plot(cx16.r14, y1, draw)
|
||||
if cx16.r14==x2
|
||||
|
@ -377,7 +377,7 @@ _done
|
|||
}
|
||||
}
|
||||
else {
|
||||
if cx16.r1L {
|
||||
if cx16.r1L!=0 {
|
||||
repeat {
|
||||
plot(cx16.r14, y1, draw)
|
||||
if y1 == y2
|
||||
|
@ -716,7 +716,7 @@ _done
|
|||
push_stack(xx, xx, yy, 1)
|
||||
push_stack(xx, xx, yy + 1, -1)
|
||||
word left = 0
|
||||
while cx16.r12L {
|
||||
while cx16.r12L!=0 {
|
||||
pop_stack()
|
||||
xx = x1
|
||||
while xx >= 0 {
|
||||
|
@ -725,7 +725,7 @@ _done
|
|||
xx--
|
||||
}
|
||||
if x1!=xx
|
||||
horizontal_line(xx as uword+1, yy as uword, x1-xx as uword, cx16.r10L)
|
||||
horizontal_line(xx as uword+1, yy as uword, x1-xx as uword, cx16.r10L as bool)
|
||||
else
|
||||
goto skip
|
||||
|
||||
|
@ -735,14 +735,14 @@ _done
|
|||
xx = x1 + 1
|
||||
|
||||
do {
|
||||
cx16.r9 = xx
|
||||
cx16.r9s = xx
|
||||
while xx <= width-1 {
|
||||
if pget(xx as uword, yy as uword) != cx16.r11L
|
||||
break
|
||||
xx++
|
||||
}
|
||||
if cx16.r9!=xx
|
||||
horizontal_line(cx16.r9, yy as uword, (xx as uword)-cx16.r9, cx16.r10L)
|
||||
if cx16.r9s!=xx
|
||||
horizontal_line(cx16.r9, yy as uword, xx-cx16.r9s as uword, cx16.r10L as bool)
|
||||
|
||||
push_stack(left, xx - 1, yy, dy)
|
||||
if xx > x2 + 1
|
||||
|
@ -791,7 +791,7 @@ skip:
|
|||
ubyte[8] @shared char_bitmap_bytes_right
|
||||
|
||||
cx16.r3 = sctextptr
|
||||
while @(cx16.r3) {
|
||||
while @(cx16.r3)!=0 {
|
||||
chardataptr = charset_addr + @(cx16.r3) * $0008
|
||||
; copy the character bitmap into RAM
|
||||
cx16.vaddr_autoincr(charset_bank, chardataptr, 0, 1)
|
||||
|
@ -843,7 +843,7 @@ skip:
|
|||
}}
|
||||
}
|
||||
; right part of shifted char
|
||||
if lsb(xx) & 7 {
|
||||
if lsb(xx) & 7 !=0 {
|
||||
position2(xx+8, yy, true)
|
||||
set_autoincrs()
|
||||
if draw {
|
||||
|
|
|
@ -134,7 +134,7 @@ psg {
|
|||
}
|
||||
1 -> {
|
||||
; sustain
|
||||
if envelope_sustains[cx16.r1L] {
|
||||
if envelope_sustains[cx16.r1L]!=0 {
|
||||
envelope_sustains[cx16.r1L]--
|
||||
} else {
|
||||
envelope_states[cx16.r1L] = 2 ; start release
|
||||
|
@ -143,7 +143,7 @@ psg {
|
|||
2 -> {
|
||||
; release
|
||||
cx16.r0 = envelope_volumes[cx16.r1L] - envelope_releases[cx16.r1L] * $0040
|
||||
if msb(cx16.r0) & %11000000 {
|
||||
if msb(cx16.r0) & %11000000 !=0 {
|
||||
cx16.r0 = 0
|
||||
envelope_releases[cx16.r1L] = 0
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ sprites {
|
|||
sprite_reg = VERA_SPRITEREGS + spritenum*$0008
|
||||
cx16.r0L = cx16.vpeek(1, sprite_reg)
|
||||
cx16.r0H = cx16.vpeek(1, sprite_reg+1)
|
||||
cx16.r1L = cx16.r0H & %00001000 !=0 ; bank
|
||||
cx16.r1L = cx16.r0H & %00001000 !=0 as ubyte ; bank
|
||||
cx16.r0 <<= 5 ; address
|
||||
}
|
||||
|
||||
|
@ -96,8 +96,8 @@ sprites {
|
|||
sub move(ubyte spritenum, word dx, word dy) {
|
||||
; move a sprite based on its current position
|
||||
sprite_reg = VERA_SPRITEREGS + 2 + spritenum*$0008
|
||||
cx16.r1 = mkword(cx16.vpeek(1, sprite_reg+1), cx16.vpeek(1, sprite_reg)) as word + dx
|
||||
cx16.r2 = mkword(cx16.vpeek(1, sprite_reg+3), cx16.vpeek(1, sprite_reg+2)) as word + dy
|
||||
cx16.r1s = mkword(cx16.vpeek(1, sprite_reg+1), cx16.vpeek(1, sprite_reg)) as word + dx
|
||||
cx16.r2s = mkword(cx16.vpeek(1, sprite_reg+3), cx16.vpeek(1, sprite_reg+2)) as word + dy
|
||||
cx16.vpoke(1, sprite_reg, cx16.r1L)
|
||||
cx16.vpoke(1, sprite_reg+1, cx16.r1H)
|
||||
cx16.vpoke(1, sprite_reg+2, cx16.r2L)
|
||||
|
@ -107,7 +107,7 @@ sprites {
|
|||
sub movex(ubyte spritenum, word dx) {
|
||||
; move a sprite horizontally based on its current position
|
||||
sprite_reg = VERA_SPRITEREGS + 2 + spritenum*$0008
|
||||
cx16.r1 = mkword(cx16.vpeek(1, sprite_reg+1), cx16.vpeek(1, sprite_reg)) as word + dx
|
||||
cx16.r1s = mkword(cx16.vpeek(1, sprite_reg+1), cx16.vpeek(1, sprite_reg)) as word + dx
|
||||
cx16.vpoke(1, sprite_reg, cx16.r1L)
|
||||
cx16.vpoke(1, sprite_reg+1, cx16.r1H)
|
||||
}
|
||||
|
@ -115,7 +115,7 @@ sprites {
|
|||
sub movey(ubyte spritenum, word dy) {
|
||||
; move a sprite vertically based on its current position
|
||||
sprite_reg = VERA_SPRITEREGS + 4 + spritenum*$0008
|
||||
cx16.r1 = mkword(cx16.vpeek(1, sprite_reg+1), cx16.vpeek(1, sprite_reg)) as word + dy
|
||||
cx16.r1s = mkword(cx16.vpeek(1, sprite_reg+1), cx16.vpeek(1, sprite_reg)) as word + dy
|
||||
cx16.vpoke(1, sprite_reg, cx16.r1L)
|
||||
cx16.vpoke(1, sprite_reg+1, cx16.r1H)
|
||||
}
|
||||
|
@ -135,11 +135,11 @@ sprites {
|
|||
}
|
||||
|
||||
sub flipx(ubyte spritenum, bool flipped) {
|
||||
cx16.vpoke_mask(1, VERA_SPRITEREGS + 6 + spritenum*$0008, %11111110, flipped)
|
||||
cx16.vpoke_mask(1, VERA_SPRITEREGS + 6 + spritenum*$0008, %11111110, flipped as ubyte)
|
||||
}
|
||||
|
||||
sub flipy(ubyte spritenum, bool flipped) {
|
||||
cx16.vpoke_mask(1, VERA_SPRITEREGS + 6 + spritenum*$0008, %11111101, flipped<<1)
|
||||
cx16.vpoke_mask(1, VERA_SPRITEREGS + 6 + spritenum*$0008, %11111101, (flipped as ubyte)<<1)
|
||||
}
|
||||
|
||||
sub set_palette_offset(ubyte spritenum, ubyte offset) {
|
||||
|
|
|
@ -15,10 +15,10 @@ verafx {
|
|||
; Vera version number is valid.
|
||||
; Vera fx is available on Vera version 0.3.1 and later,
|
||||
; so no need to even check VERA_DC_VER1, which contains 0 (or higher)
|
||||
cx16.r1L = mkword(cx16.VERA_DC_VER2, cx16.VERA_DC_VER3) >= $0301
|
||||
cx16.r1L = mkword(cx16.VERA_DC_VER2, cx16.VERA_DC_VER3) >= $0301 as ubyte
|
||||
}
|
||||
cx16.VERA_CTRL = cx16.r0L
|
||||
return cx16.r1L
|
||||
return cx16.r1L as bool
|
||||
}
|
||||
|
||||
sub clear(ubyte vbank, uword vaddr, ubyte data, uword num_longwords) {
|
||||
|
|
|
@ -59,7 +59,7 @@ diskio {
|
|||
void cbm.CHRIN() ; skip 2 bytes
|
||||
void cbm.CHRIN()
|
||||
status = cbm.READST()
|
||||
if cbm.STOP2()
|
||||
if cbm.STOP2()!=0
|
||||
break
|
||||
}
|
||||
status = cbm.READST()
|
||||
|
@ -68,7 +68,7 @@ io_error:
|
|||
cbm.CLRCHN() ; restore default i/o devices
|
||||
cbm.CLOSE(READ_IO_CHANNEL)
|
||||
|
||||
if status and status & $40 == 0 { ; bit 6=end of file
|
||||
if status!=0 and status & $40 == 0 { ; bit 6=end of file
|
||||
txt.print("\ni/o error, status: ")
|
||||
txt.print_ub(status)
|
||||
txt.nl()
|
||||
|
@ -83,7 +83,7 @@ io_error:
|
|||
|
||||
cbm.SETNAM(1, "$")
|
||||
cbm.SETLFS(READ_IO_CHANNEL, drivenumber, 0)
|
||||
ubyte okay = false
|
||||
bool okay = false
|
||||
void cbm.OPEN() ; open 12,8,0,"$"
|
||||
if_cs
|
||||
goto io_error
|
||||
|
@ -201,14 +201,14 @@ io_error:
|
|||
ubyte blocks_lsb = cbm.CHRIN()
|
||||
ubyte blocks_msb = cbm.CHRIN()
|
||||
|
||||
if cbm.READST()
|
||||
if cbm.READST()!=0
|
||||
goto close_end
|
||||
|
||||
list_blocks = mkword(blocks_msb, blocks_lsb)
|
||||
|
||||
; read until the filename starts after the first "
|
||||
while cbm.CHRIN()!='\"' {
|
||||
if cbm.READST()
|
||||
if cbm.READST()!=0
|
||||
goto close_end
|
||||
}
|
||||
|
||||
|
@ -231,7 +231,7 @@ io_error:
|
|||
list_filetype[0] = cx16.r15L
|
||||
list_filetype[1] = cbm.CHRIN()
|
||||
list_filetype[2] = cbm.CHRIN()
|
||||
while cbm.CHRIN() {
|
||||
while cbm.CHRIN()!=0 {
|
||||
; read the rest of the entry until the end
|
||||
}
|
||||
|
||||
|
@ -239,7 +239,7 @@ io_error:
|
|||
void cbm.CHRIN()
|
||||
|
||||
if not list_skip_disk_name {
|
||||
if not list_pattern
|
||||
if list_pattern==0
|
||||
return true
|
||||
if string.pattern_match(list_filename, list_pattern)
|
||||
return true
|
||||
|
@ -297,7 +297,7 @@ close_end:
|
|||
sub f_read(uword bufferpointer, uword num_bytes) -> uword {
|
||||
; -- read from the currently open file, up to the given number of bytes.
|
||||
; returns the actual number of bytes read. (checks for End-of-file and error conditions)
|
||||
if not iteration_in_progress or not num_bytes
|
||||
if not iteration_in_progress or num_bytes==0
|
||||
return 0
|
||||
|
||||
reset_read_channel()
|
||||
|
@ -309,10 +309,10 @@ close_end:
|
|||
lda bufferpointer+1
|
||||
sta m_in_buffer+2
|
||||
}}
|
||||
while num_bytes {
|
||||
if cbm.READST() {
|
||||
while num_bytes!=0 {
|
||||
if cbm.READST()!=0 {
|
||||
f_close()
|
||||
if cbm.READST() & $40 ; eof?
|
||||
if cbm.READST() & $40 !=0 ; eof?
|
||||
return list_blocks ; number of bytes read
|
||||
return 0 ; error.
|
||||
}
|
||||
|
@ -337,7 +337,7 @@ m_in_buffer sta $ffff
|
|||
|
||||
reset_read_channel()
|
||||
uword total_read = 0
|
||||
while not cbm.READST() {
|
||||
while cbm.READST()==0 {
|
||||
cx16.r0 = f_read(bufferpointer, 256)
|
||||
total_read += cx16.r0
|
||||
bufferpointer += cx16.r0
|
||||
|
@ -396,7 +396,7 @@ _end rts
|
|||
cbm.SETLFS(WRITE_IO_CHANNEL, drivenumber, 1)
|
||||
void cbm.OPEN() ; open 13,8,1,"filename"
|
||||
if_cc
|
||||
return not cbm.READST()
|
||||
return cbm.READST()==0
|
||||
cbm.CLOSE(WRITE_IO_CHANNEL)
|
||||
f_close_w()
|
||||
return false
|
||||
|
@ -410,7 +410,7 @@ _end rts
|
|||
cbm.CHROUT(@(bufferpointer))
|
||||
bufferpointer++
|
||||
}
|
||||
return not cbm.READST()
|
||||
return cbm.READST()==0
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
@ -441,7 +441,7 @@ _end rts
|
|||
goto io_error
|
||||
void cbm.CHKIN(15) ; use #15 as input channel
|
||||
|
||||
while not cbm.READST() {
|
||||
while cbm.READST()==0 {
|
||||
cx16.r5L = cbm.CHRIN()
|
||||
if cx16.r5L=='\r' or cx16.r5L=='\n'
|
||||
break
|
||||
|
@ -481,9 +481,9 @@ io_error:
|
|||
}}
|
||||
|
||||
if_cc
|
||||
cx16.r0L = cbm.READST()==0
|
||||
cx16.r0L = cbm.READST()==0 as ubyte
|
||||
|
||||
return cx16.r0L
|
||||
return cx16.r0L as bool
|
||||
}
|
||||
|
||||
; Use kernal LOAD routine to load the given program file in memory.
|
||||
|
@ -496,7 +496,7 @@ io_error:
|
|||
cbm.SETNAM(string.length(filenameptr), filenameptr)
|
||||
ubyte secondary = 1
|
||||
cx16.r1 = 0
|
||||
if address_override
|
||||
if address_override!=0
|
||||
secondary = 0
|
||||
cbm.SETLFS(1, drivenumber, secondary)
|
||||
%asm {{
|
||||
|
|
|
@ -509,7 +509,7 @@ log2_tab
|
|||
repeat length {
|
||||
cx16.r0H ^= @(cx16.r1)
|
||||
repeat 8 {
|
||||
if cx16.r0H & $80 {
|
||||
if cx16.r0H & $80 !=0 {
|
||||
cx16.r0 <<= 1
|
||||
cx16.r0 ^= $1021
|
||||
}
|
||||
|
@ -531,7 +531,7 @@ log2_tab
|
|||
repeat length {
|
||||
cx16.r1H ^= @(cx16.r2)
|
||||
repeat 8 {
|
||||
if cx16.r1H & $80 {
|
||||
if cx16.r1H & $80 !=0 {
|
||||
cx16.r0 <<= 1
|
||||
rol(cx16.r1)
|
||||
cx16.r1 ^= $04c1
|
||||
|
|
|
@ -297,7 +297,7 @@ _done rts
|
|||
return compare(st + str_len - suffix_len, suffix) == 0
|
||||
}
|
||||
|
||||
asmsub pattern_match(str string @AY, str pattern @R0) clobbers(Y) -> ubyte @A {
|
||||
asmsub pattern_match(str string @AY, str pattern @R0) clobbers(Y) -> bool @A {
|
||||
%asm {{
|
||||
; pattern matching of a string.
|
||||
; Input: cx16.r0: A NUL-terminated, <255-length pattern
|
||||
|
|
|
@ -41,9 +41,9 @@ sub internal_str_ub(ubyte value, uword out_ptr) {
|
|||
value -= hundreds*100
|
||||
ubyte tens = value / 10
|
||||
value -= tens*10
|
||||
if hundreds
|
||||
if hundreds!=0
|
||||
goto output_hundreds
|
||||
if tens
|
||||
if tens!=0
|
||||
goto output_tens
|
||||
goto output_ones
|
||||
output_hundreds:
|
||||
|
@ -153,13 +153,13 @@ sub internal_str_uw(uword value, uword out_ptr) {
|
|||
ubyte thousands = value4-value5*10 as ubyte
|
||||
uword value6 = value5/10
|
||||
ubyte tenthousands = value5-value6*10 as ubyte
|
||||
if tenthousands
|
||||
if tenthousands!=0
|
||||
goto output_tenthousands
|
||||
if thousands
|
||||
if thousands!=0
|
||||
goto output_thousands
|
||||
if hundreds
|
||||
if hundreds!=0
|
||||
goto output_hundreds
|
||||
if tens
|
||||
if tens!=0
|
||||
goto output_tens
|
||||
goto output_ones
|
||||
output_tenthousands:
|
||||
|
|
|
@ -208,7 +208,7 @@ math {
|
|||
ubyte result = 7
|
||||
ubyte compare = $80
|
||||
repeat {
|
||||
if value&compare
|
||||
if value&compare!=0
|
||||
return result
|
||||
result--
|
||||
if_z
|
||||
|
@ -221,7 +221,7 @@ math {
|
|||
ubyte result = 15
|
||||
uword compare = $8000
|
||||
repeat {
|
||||
if value&compare
|
||||
if value&compare!=0
|
||||
return result
|
||||
result--
|
||||
if_z
|
||||
|
@ -317,7 +317,7 @@ math {
|
|||
repeat length {
|
||||
cx16.r0H ^= @(data)
|
||||
repeat 8 {
|
||||
if cx16.r0H & $80
|
||||
if cx16.r0H & $80 !=0
|
||||
cx16.r0 = (cx16.r0<<1)^$1021
|
||||
else
|
||||
cx16.r0<<=1
|
||||
|
@ -336,7 +336,7 @@ math {
|
|||
repeat length {
|
||||
cx16.r1H ^= @(data)
|
||||
repeat 8 {
|
||||
if cx16.r1H & $80 {
|
||||
if cx16.r1H & $80 !=0 {
|
||||
cx16.r0 <<= 1
|
||||
rol(cx16.r1)
|
||||
cx16.r1 ^= $04c1
|
||||
|
|
|
@ -36,7 +36,7 @@ monogfx {
|
|||
|
||||
sub clear_screen(ubyte color) {
|
||||
stipple(false)
|
||||
if color
|
||||
if color!=0
|
||||
color=255
|
||||
sys.gfx_clear(color)
|
||||
}
|
||||
|
@ -126,17 +126,17 @@ monogfx {
|
|||
}
|
||||
|
||||
word @zp d = 0
|
||||
cx16.r1L = true ; 'positive_ix'
|
||||
cx16.r1L = 1 ; true ; 'positive_ix'
|
||||
if dx < 0 {
|
||||
dx = -dx
|
||||
cx16.r1L = false
|
||||
cx16.r1L = 0 ; false
|
||||
}
|
||||
word @zp dx2 = dx*2
|
||||
word @zp dy2 = dy*2
|
||||
cx16.r14 = x1 ; internal plot X
|
||||
|
||||
if dx >= dy {
|
||||
if cx16.r1L {
|
||||
if cx16.r1L!=0 {
|
||||
repeat {
|
||||
plot(cx16.r14, y1, draw)
|
||||
if cx16.r14==x2
|
||||
|
@ -163,7 +163,7 @@ monogfx {
|
|||
}
|
||||
}
|
||||
else {
|
||||
if cx16.r1L {
|
||||
if cx16.r1L!=0 {
|
||||
repeat {
|
||||
plot(cx16.r14, y1, draw)
|
||||
if y1 == y2
|
||||
|
@ -340,7 +340,7 @@ monogfx {
|
|||
if dont_stipple_flag
|
||||
sys.gfx_plot(xx, yy, 255)
|
||||
else {
|
||||
if (xx ^ yy)&1
|
||||
if (xx ^ yy)&1 !=0
|
||||
sys.gfx_plot(xx, yy, 255)
|
||||
else
|
||||
sys.gfx_plot(xx, yy, 0)
|
||||
|
@ -407,7 +407,7 @@ monogfx {
|
|||
push_stack(xx, xx, yy, 1)
|
||||
push_stack(xx, xx, yy + 1, -1)
|
||||
word left = 0
|
||||
while cx16.r12L {
|
||||
while cx16.r12L!=0 {
|
||||
pop_stack()
|
||||
xx = x1
|
||||
while xx >= 0 {
|
||||
|
@ -416,7 +416,7 @@ monogfx {
|
|||
xx--
|
||||
}
|
||||
if x1!=xx
|
||||
horizontal_line(xx as uword+1, yy as uword, x1-xx as uword, cx16.r10L)
|
||||
horizontal_line(xx as uword+1, yy as uword, x1-xx as uword, cx16.r10L as bool)
|
||||
else
|
||||
goto skip
|
||||
|
||||
|
@ -426,14 +426,14 @@ monogfx {
|
|||
xx = x1 + 1
|
||||
|
||||
do {
|
||||
cx16.r9 = xx
|
||||
cx16.r9 = xx as uword
|
||||
while xx <= width-1 {
|
||||
if pget(xx as uword, yy as uword) != cx16.r11L
|
||||
break
|
||||
xx++
|
||||
}
|
||||
if cx16.r9!=xx
|
||||
horizontal_line(cx16.r9, yy as uword, (xx as uword)-cx16.r9, cx16.r10L)
|
||||
horizontal_line(cx16.r9, yy as uword, (xx as uword)-cx16.r9, cx16.r10L as bool)
|
||||
|
||||
push_stack(left, xx - 1, yy, dy)
|
||||
if xx > x2 + 1
|
||||
|
|
|
@ -10,7 +10,7 @@ string {
|
|||
; This value is determined during runtime and counts upto the first terminating 0 byte in the string,
|
||||
; regardless of the size of the string during compilation time. Don’t confuse this with len and sizeof!
|
||||
ubyte count = 0
|
||||
while st[count]
|
||||
while st[count]!=0
|
||||
count++
|
||||
return count
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ string {
|
|||
ubyte ix
|
||||
repeat {
|
||||
ubyte char=st[ix]
|
||||
if not char
|
||||
if char==0
|
||||
return ix
|
||||
if char >= 'A' and char <= 'Z'
|
||||
st[ix] = char | %00100000
|
||||
|
@ -127,7 +127,7 @@ string {
|
|||
ubyte ix
|
||||
repeat {
|
||||
ubyte char=st[ix]
|
||||
if not char
|
||||
if char==0
|
||||
return ix
|
||||
if char >= 97 and char <= 122
|
||||
st[ix] = char & %11011111
|
||||
|
@ -175,7 +175,7 @@ string {
|
|||
ubyte ix
|
||||
sys.clear_carry()
|
||||
repeat {
|
||||
if st[ix] {
|
||||
if st[ix]!=0 {
|
||||
rol(hashcode)
|
||||
hashcode ^= st[ix]
|
||||
ix++
|
||||
|
|
|
@ -75,7 +75,7 @@ sub print_b (byte value) {
|
|||
|
||||
sub print_ubhex (ubyte value, ubyte prefix) {
|
||||
; ---- print the ubyte in hex form
|
||||
if prefix
|
||||
if prefix!=0
|
||||
chrout('$')
|
||||
conv.str_ubhex(value)
|
||||
print(conv.string_out)
|
||||
|
@ -83,7 +83,7 @@ sub print_ubhex (ubyte value, ubyte prefix) {
|
|||
|
||||
sub print_ubbin (ubyte value, ubyte prefix) {
|
||||
; ---- print the ubyte in binary form
|
||||
if prefix
|
||||
if prefix!=0
|
||||
chrout('%')
|
||||
conv.str_ubbin(value)
|
||||
print(conv.string_out)
|
||||
|
@ -91,7 +91,7 @@ sub print_ubbin (ubyte value, ubyte prefix) {
|
|||
|
||||
sub print_uwbin (uword value, ubyte prefix) {
|
||||
; ---- print the uword in binary form
|
||||
if prefix
|
||||
if prefix!=0
|
||||
chrout('%')
|
||||
conv.str_uwbin(value)
|
||||
print(conv.string_out)
|
||||
|
@ -99,7 +99,7 @@ sub print_uwbin (uword value, ubyte prefix) {
|
|||
|
||||
sub print_uwhex (uword value, ubyte prefix) {
|
||||
; ---- print the uword in hexadecimal form (4 digits)
|
||||
if prefix
|
||||
if prefix!=0
|
||||
chrout('$')
|
||||
conv.str_uwhex(value)
|
||||
print(conv.string_out)
|
||||
|
|
|
@ -5,4 +5,4 @@ org.gradle.daemon=true
|
|||
kotlin.code.style=official
|
||||
javaVersion=11
|
||||
kotlinVersion=1.9.22
|
||||
version=10.2-SNAPSHOT
|
||||
version=10.2-BOOLEANS
|
||||
|
|
Loading…
Reference in New Issue
Block a user