diff --git a/compiler/res/prog8lib/atari/textio.p8 b/compiler/res/prog8lib/atari/textio.p8 index bae6c50bf..121ca9553 100644 --- a/compiler/res/prog8lib/atari/textio.p8 +++ b/compiler/res/prog8lib/atari/textio.p8 @@ -32,7 +32,7 @@ asmsub column(ubyte col @A) clobbers(A, X, Y) { }} } -asmsub fill_screen (ubyte char @ A, ubyte color @ Y) clobbers(A) { +asmsub fill_screen (ubyte character @ A, ubyte color @ Y) clobbers(A) { ; ---- fill the character screen with the given fill character and character color. ; (assumes screen and color matrix are at their default addresses) ; TODO @@ -42,7 +42,7 @@ asmsub fill_screen (ubyte char @ A, ubyte color @ Y) clobbers(A) { }} } -asmsub clear_screenchars (ubyte char @ A) clobbers(Y) { +asmsub clear_screenchars (ubyte character @ A) clobbers(Y) { ; ---- clear the character screen with the given fill character (leaves colors) ; (assumes screen matrix is at the default address) ; TODO @@ -114,10 +114,10 @@ asmsub scroll_down (bool alsocolors @ Pc) clobbers(A) { } -romsub $F2B0 = outchar(ubyte char @ A) +romsub $F2B0 = outchar(ubyte character @ A) romsub $F2Fd = waitkey() -asmsub chrout(ubyte char @ A) { +asmsub chrout(ubyte character @ A) { %asm {{ sta _tmp_outchar+1 txa @@ -364,7 +364,7 @@ asmsub getclr (ubyte col @A, ubyte row @Y) clobbers(Y) -> ubyte @ A { }} } -sub setcc (ubyte column, ubyte row, ubyte char, ubyte charcolor) { +sub setcc (ubyte col, ubyte row, ubyte char, ubyte charcolor) { ; ---- set char+color at the given position on the screen ; TODO %asm {{ diff --git a/compiler/res/prog8lib/c128/syslib.p8 b/compiler/res/prog8lib/c128/syslib.p8 index 79c19e83d..1c4f1633b 100644 --- a/compiler/res/prog8lib/c128/syslib.p8 +++ b/compiler/res/prog8lib/c128/syslib.p8 @@ -87,7 +87,7 @@ romsub $FFC6 = CHKIN(ubyte logical @ X) clobbers(A,X) -> bool @Pc ; (via 798 romsub $FFC9 = CHKOUT(ubyte logical @ X) clobbers(A,X) ; (via 800 ($320)) define an output channel romsub $FFCC = CLRCHN() clobbers(A,X) ; (via 802 ($322)) restore default devices romsub $FFCF = CHRIN() clobbers(X, Y) -> ubyte @ A ; (via 804 ($324)) input a character (for keyboard, read a whole line from the screen) A=byte read. -romsub $FFD2 = CHROUT(ubyte char @ A) ; (via 806 ($326)) output a character +romsub $FFD2 = CHROUT(ubyte character @ A) ; (via 806 ($326)) output a character romsub $FFD5 = LOAD(ubyte verify @ A, uword address @ XY) -> bool @Pc, ubyte @ A, uword @ XY ; (via 816 ($330)) load from device romsub $FFD8 = SAVE(ubyte zp_startaddr @ A, uword endaddr @ XY) -> bool @ Pc, ubyte @ A ; (via 818 ($332)) save to a device romsub $FFDB = SETTIM(ubyte low @ A, ubyte middle @ X, ubyte high @ Y) ; set the software clock diff --git a/compiler/res/prog8lib/c128/textio.p8 b/compiler/res/prog8lib/c128/textio.p8 index 8f843356c..b42d15f29 100644 --- a/compiler/res/prog8lib/c128/textio.p8 +++ b/compiler/res/prog8lib/c128/textio.p8 @@ -533,7 +533,7 @@ _mod lda $ffff ; modified }} } -sub setcc (ubyte column, ubyte row, ubyte char, ubyte charcolor) { +sub setcc (ubyte col, ubyte row, ubyte character, ubyte charcolor) { ; ---- set char+color at the given position on the screen %asm {{ lda row @@ -545,13 +545,13 @@ sub setcc (ubyte column, ubyte row, ubyte char, ubyte charcolor) { sta _colormod+2 lda setchr._screenrows,y clc - adc column + adc col sta _charmod+1 sta _colormod+1 bcc + inc _charmod+2 inc _colormod+2 -+ lda char ++ lda character _charmod sta $ffff ; modified lda charcolor _colormod sta $ffff ; modified diff --git a/compiler/res/prog8lib/c64/graphics.p8 b/compiler/res/prog8lib/c64/graphics.p8 index e9684c491..62a535f32 100644 --- a/compiler/res/prog8lib/c64/graphics.p8 +++ b/compiler/res/prog8lib/c64/graphics.p8 @@ -127,46 +127,46 @@ graphics { } } - sub rect(uword x, ubyte y, uword width, ubyte height) { + sub rect(uword xx, ubyte yy, uword width, ubyte height) { if width==0 or height==0 return - horizontal_line(x, y, width) + horizontal_line(xx, yy, width) if height==1 return - horizontal_line(x, y+height-1, width) - vertical_line(x, y+1, height-2) + horizontal_line(xx, yy+height-1, width) + vertical_line(xx, yy+1, height-2) if width==1 return - vertical_line(x+width-1, y+1, height-2) + vertical_line(xx+width-1, yy+1, height-2) } - sub fillrect(uword x, ubyte y, uword width, ubyte height) { + sub fillrect(uword xx, ubyte yy, uword width, ubyte height) { if width==0 return repeat height { - horizontal_line(x, y, width) - y++ + horizontal_line(xx, yy, width) + yy++ } } - sub horizontal_line(uword x, ubyte y, uword length) { + sub horizontal_line(uword xx, ubyte yy, uword length) { if length<8 { - internal_plotx=x + internal_plotx=xx repeat lsb(length) { - internal_plot(y) + internal_plot(yy) internal_plotx++ } return } - ubyte separate_pixels = lsb(x) & 7 - uword addr = get_y_lookup(y) + (x&$fff8) + ubyte separate_pixels = lsb(xx) & 7 + uword pixaddr = get_y_lookup(yy) + (xx&$fff8) if separate_pixels { %asm {{ - lda addr + lda pixaddr sta P8ZP_SCRATCH_W1 - lda addr+1 + lda pixaddr+1 sta P8ZP_SCRATCH_W1+1 ldy separate_pixels lda hline_filled_right,y @@ -175,7 +175,7 @@ graphics { ora (P8ZP_SCRATCH_W1),y sta (P8ZP_SCRATCH_W1),y }} - addr += 8 + pixaddr += 8 length += separate_pixels length -= 8 } @@ -191,9 +191,9 @@ graphics { ror length lsr length+1 ror length - lda addr + lda pixaddr sta _modified+1 - lda addr+1 + lda pixaddr+1 sta _modified+2 lda length ora length+1 @@ -227,11 +227,11 @@ hline_zero2 } } - sub vertical_line(uword x, ubyte y, ubyte height) { - internal_plotx = x + sub vertical_line(uword xx, ubyte yy, ubyte height) { + internal_plotx = xx repeat height { - internal_plot(y) - y++ + internal_plot(yy) + yy++ } } @@ -300,8 +300,8 @@ hline_zero2 ; here is the non-asm code for the plot routine below: ; sub plot_nonasm(uword px, ubyte py) { ; ubyte[] ormask = [128, 64, 32, 16, 8, 4, 2, 1] -; uword addr = BITMAP_ADDRESS + 320*(py>>3) + (py & 7) + (px & %0000000111111000) -; @(addr) |= ormask[lsb(px) & 7] +; uword pixaddr = BITMAP_ADDRESS + 320*(py>>3) + (py & 7) + (px & %0000000111111000) +; @(pixaddr) |= ormask[lsb(px) & 7] ; } inline asmsub plot(uword plotx @XY, ubyte ploty @A) clobbers (A, X, Y) { @@ -360,7 +360,7 @@ _y_lookup_hi .byte >_plot_y_values }} } - asmsub get_y_lookup(ubyte y @Y) -> uword @AY { + asmsub get_y_lookup(ubyte yy @Y) -> uword @AY { %asm {{ lda internal_plot._y_lookup_lo,y pha diff --git a/compiler/res/prog8lib/c64/syslib.p8 b/compiler/res/prog8lib/c64/syslib.p8 index 8c28408da..2cd73f8d8 100644 --- a/compiler/res/prog8lib/c64/syslib.p8 +++ b/compiler/res/prog8lib/c64/syslib.p8 @@ -91,7 +91,7 @@ romsub $FFC6 = CHKIN(ubyte logical @ X) clobbers(A,X) -> bool @Pc ; (via 798 romsub $FFC9 = CHKOUT(ubyte logical @ X) clobbers(A,X) ; (via 800 ($320)) define an output channel romsub $FFCC = CLRCHN() clobbers(A,X) ; (via 802 ($322)) restore default devices romsub $FFCF = CHRIN() clobbers(X, Y) -> ubyte @ A ; (via 804 ($324)) input a character (for keyboard, read a whole line from the screen) A=byte read. -romsub $FFD2 = CHROUT(ubyte char @ A) ; (via 806 ($326)) output a character +romsub $FFD2 = CHROUT(ubyte character @ A) ; (via 806 ($326)) output a character romsub $FFD5 = LOAD(ubyte verify @ A, uword address @ XY) -> bool @Pc, ubyte @ A, uword @ XY ; (via 816 ($330)) load from device romsub $FFD8 = SAVE(ubyte zp_startaddr @ A, uword endaddr @ XY) -> bool @ Pc, ubyte @ A ; (via 818 ($332)) save to a device romsub $FFDB = SETTIM(ubyte low @ A, ubyte middle @ X, ubyte high @ Y) ; set the software clock diff --git a/compiler/res/prog8lib/c64/textio.p8 b/compiler/res/prog8lib/c64/textio.p8 index 32f1c29b6..464a82885 100644 --- a/compiler/res/prog8lib/c64/textio.p8 +++ b/compiler/res/prog8lib/c64/textio.p8 @@ -39,7 +39,7 @@ asmsub column(ubyte col @A) clobbers(A, X, Y) { }} } -asmsub fill_screen (ubyte char @ A, ubyte color @ Y) clobbers(A) { +asmsub fill_screen (ubyte character @ A, ubyte color @ Y) clobbers(A) { ; ---- fill the character screen with the given fill character and character color. ; (assumes screen and color matrix are at their default addresses) @@ -54,7 +54,7 @@ asmsub fill_screen (ubyte char @ A, ubyte color @ Y) clobbers(A) { } -asmsub clear_screenchars (ubyte char @ A) clobbers(Y) { +asmsub clear_screenchars (ubyte character @ A) clobbers(Y) { ; ---- clear the character screen with the given fill character (leaves colors) ; (assumes screen matrix is at the default address) %asm {{ @@ -237,7 +237,7 @@ _scroll_screen ; scroll only the screen memory }} } -romsub $FFD2 = chrout(ubyte char @ A) ; for consistency. You can also use cbm.CHROUT directly ofcourse. +romsub $FFD2 = chrout(ubyte character @ A) ; for consistency. You can also use cbm.CHROUT directly ofcourse. asmsub print (str text @ AY) clobbers(A,Y) { ; ---- print null terminated string from A/Y @@ -532,7 +532,7 @@ _mod lda $ffff ; modified }} } -sub setcc (ubyte column, ubyte row, ubyte char, ubyte charcolor) { +sub setcc (ubyte col, ubyte row, ubyte character, ubyte charcolor) { ; ---- set char+color at the given position on the screen %asm {{ lda row @@ -544,13 +544,13 @@ sub setcc (ubyte column, ubyte row, ubyte char, ubyte charcolor) { sta _colormod+2 lda setchr._screenrows,y clc - adc column + adc col sta _charmod+1 sta _colormod+1 bcc + inc _charmod+2 inc _colormod+2 -+ lda char ++ lda character _charmod sta $ffff ; modified lda charcolor _colormod sta $ffff ; modified diff --git a/compiler/res/prog8lib/cx16/diskio.p8 b/compiler/res/prog8lib/cx16/diskio.p8 index 7a3c3175a..ef3cdd51e 100644 --- a/compiler/res/prog8lib/cx16/diskio.p8 +++ b/compiler/res/prog8lib/cx16/diskio.p8 @@ -43,12 +43,12 @@ diskio { ubyte high = cbm.CHRIN() txt.print_uw(mkword(high, low)) txt.spc() - ubyte @zp char + ubyte @zp character repeat { - char = cbm.CHRIN() - if char==0 + character = cbm.CHRIN() + if character==0 break - txt.chrout(char) + txt.chrout(character) } txt.nl() void cbm.CHRIN() ; skip 2 bytes @@ -209,12 +209,12 @@ io_error: ; read the filename repeat { - ubyte char = cbm.CHRIN() - if char==0 + ubyte character = cbm.CHRIN() + if character==0 break - if char=='\"' + if character=='\"' break - @(nameptr) = char + @(nameptr) = character nameptr++ } @@ -297,19 +297,19 @@ close_end: list_blocks = 0 ; we reuse this variable for the total number of bytes read ; commander X16 supports fast block-read via macptr() kernal call - uword size + uword readsize while num_bytes { - size = 255 - if num_bytes bool { - return internal_save_routine(filenameptr, address, size, false) + sub save(uword filenameptr, uword startaddress, uword savesize) -> bool { + return internal_save_routine(filenameptr, startaddress, savesize, false) } ; like save() but omits the 2 byte prg header. - sub save_raw(uword filenameptr, uword address, uword size) -> bool { - return internal_save_routine(filenameptr, address, size, true) + sub save_raw(uword filenameptr, uword startaddress, uword savesize) -> bool { + return internal_save_routine(filenameptr, startaddress, savesize, true) } - sub internal_save_routine(uword filenameptr, uword address, uword size, bool headerless) -> bool { + sub internal_save_routine(uword filenameptr, uword startaddress, uword savesize, bool headerless) -> bool { cbm.SETNAM(string.length(filenameptr), filenameptr) cbm.SETLFS(1, drivenumber, 0) - uword @shared end_address = address + size + uword @shared end_address = startaddress + savesize cx16.r0L = 0 %asm {{ - lda address + lda startaddress sta P8ZP_SCRATCH_W1 - lda address+1 + lda startaddress+1 sta P8ZP_SCRATCH_W1+1 ldx end_address ldy end_address+1 @@ -532,8 +532,8 @@ io_error: ; Identical to load(), but DOES INCLUDE the first 2 bytes in the file. ; No program header is assumed in the file. Everything is loaded. ; See comments on load() for more details. - sub load_raw(uword filenameptr, uword address) -> uword { - return internal_load_routine(filenameptr, address, true) + sub load_raw(uword filenameptr, uword startaddress) -> uword { + return internal_load_routine(filenameptr, startaddress, true) } @@ -606,7 +606,7 @@ io_error: return $2000 * (cx16.getrambank() - startbank) + endaddress - startaddress } - asmsub vload(str name @R0, ubyte bank @A, uword address @R1) clobbers(X, Y) -> ubyte @A { + asmsub vload(str name @R0, ubyte bank @A, uword startaddress @R1) clobbers(X, Y) -> ubyte @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) @@ -645,7 +645,7 @@ internal_vload: }} } - asmsub vload_raw(str name @R0, ubyte bank @A, uword address @R1) clobbers(X, Y) -> ubyte @A { + asmsub vload_raw(str name @R0, ubyte bank @A, uword startaddress @R1) clobbers(X, Y) -> ubyte @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. diff --git a/compiler/res/prog8lib/cx16/gfx2.p8 b/compiler/res/prog8lib/cx16/gfx2.p8 index 1ae0ae17b..616ad42f0 100644 --- a/compiler/res/prog8lib/cx16/gfx2.p8 +++ b/compiler/res/prog8lib/cx16/gfx2.p8 @@ -133,29 +133,29 @@ gfx2 { monochrome_dont_stipple_flag = not enable } - sub rect(uword x, uword y, uword rwidth, uword rheight, ubyte color) { + sub rect(uword xx, uword yy, uword rwidth, uword rheight, ubyte color) { if rwidth==0 or rheight==0 return - horizontal_line(x, y, rwidth, color) + horizontal_line(xx, yy, rwidth, color) if rheight==1 return - horizontal_line(x, y+rheight-1, rwidth, color) - vertical_line(x, y+1, rheight-2, color) + horizontal_line(xx, yy+rheight-1, rwidth, color) + vertical_line(xx, yy+1, rheight-2, color) if rwidth==1 return - vertical_line(x+rwidth-1, y+1, rheight-2, color) + vertical_line(xx+rwidth-1, yy+1, rheight-2, color) } - sub fillrect(uword x, uword y, uword rwidth, uword rheight, ubyte color) { + sub fillrect(uword xx, uword yy, uword rwidth, uword rheight, ubyte color) { if rwidth==0 return repeat rheight { - horizontal_line(x, y, rwidth, color) - y++ + horizontal_line(xx, yy, rwidth, color) + yy++ } } - sub horizontal_line(uword x, uword y, uword length, ubyte color) { + sub horizontal_line(uword xx, uword yy, uword length, ubyte color) { ubyte[9] masked_starts = [ 0, %00000001, %00000011, %00000111, %00001111, %00011111, %00111111, %01111111, %11111111] ubyte[9] masked_ends = [ 0, %10000000, %11000000, %11100000, %11110000, %11111000, %11111100, %11111110, %11111111] @@ -164,30 +164,30 @@ gfx2 { when active_mode { 1, 5 -> { ; monochrome modes, either resolution - ubyte separate_pixels = (8-lsb(x)) & 7 + ubyte separate_pixels = (8-lsb(xx)) & 7 if separate_pixels as uword > length separate_pixels = lsb(length) if separate_pixels { if monochrome_dont_stipple_flag { - position(x,y) + position(xx,yy) cx16.VERA_ADDR_H &= %00000111 ; vera auto-increment off if color cx16.VERA_DATA0 |= masked_starts[separate_pixels] else cx16.VERA_DATA0 &= ~masked_starts[separate_pixels] - x += separate_pixels + xx += separate_pixels } else { repeat separate_pixels { - plot(x, y, color) - x++ + plot(xx, yy, color) + xx++ } } length -= separate_pixels } if length { - position(x, y) + position(xx, yy) separate_pixels = lsb(length) & 7 - x += length & $fff8 + xx += length & $fff8 %asm {{ lsr length+1 ror length @@ -203,7 +203,7 @@ gfx2 { beq _stipple ldy #255 ; don't stipple bra _loop -_stipple lda y +_stipple lda yy and #1 ; determine stipple pattern to use bne + ldy #%01010101 @@ -229,8 +229,8 @@ _done cx16.VERA_DATA0 &= ~masked_ends[separate_pixels] } else { repeat separate_pixels { - plot(x, y, color) - x++ + plot(xx, yy, color) + xx++ } } } @@ -238,7 +238,7 @@ _done } 4 -> { ; lores 256c - position(x, y) + position(xx, yy) %asm {{ lda color ldx length+1 @@ -266,7 +266,7 @@ _done colorbits[ii] = color color <<= 2 } - void addr_mul_24_for_highres_4c(y, x) ; 24 bits result is in r0 and r1L (highest byte) + void addr_mul_24_for_highres_4c(yy, xx) ; 24 bits result is in r0 and r1L (highest byte) %asm {{ lda cx16.VERA_ADDR_H and #%00000111 ; no auto advance @@ -279,7 +279,7 @@ _done sta cx16.VERA_ADDR_L lda cx16.r0+1 sta cx16.VERA_ADDR_M - ldx x + ldx xx }} repeat length { @@ -305,15 +305,15 @@ _done } } - sub vertical_line(uword x, uword y, uword lheight, ubyte color) { + sub vertical_line(uword xx, uword yy, uword lheight, ubyte color) { when active_mode { 1, 5 -> { ; monochrome, lo-res - cx16.r15L = gfx2.plot.bits[x as ubyte & 7] ; bitmask + cx16.r15L = gfx2.plot.maskbits[xx as ubyte & 7] ; bitmask if color { if monochrome_dont_stipple_flag { ; draw continuous line. - position2(x,y,true) + position2(xx,yy,true) if active_mode==1 set_both_strides(11) ; 40 increment = 1 line in 320 px monochrome else @@ -327,11 +327,11 @@ _done } } else { ; draw stippled line. - if x&1 { - y++ + if xx&1 { + yy++ lheight-- } - position2(x,y,true) + position2(xx,yy,true) if active_mode==1 set_both_strides(12) ; 80 increment = 2 line in 320 px monochrome else @@ -345,7 +345,7 @@ _done } } } else { - position2(x,y,true) + position2(xx,yy,true) cx16.r15 = ~cx16.r15 ; erase pixels if active_mode==1 set_both_strides(11) ; 40 increment = 1 line in 320 px monochrome @@ -363,7 +363,7 @@ _done 4 -> { ; lores 256c ; set vera auto-increment to 320 pixel increment (=next line) - position(x,y) + position(xx,yy) cx16.VERA_ADDR_H = cx16.VERA_ADDR_H & %00000111 | (14<<4) %asm {{ ldy lheight @@ -380,17 +380,17 @@ _done ; use TWO vera adress pointers simultaneously one for reading, one for writing, so auto-increment is possible if lheight==0 return - position2(x,y,true) + position2(xx,yy,true) set_both_strides(13) ; 160 increment = 1 line in 640 px 4c mode ;; color &= 3 - ;; color <<= gfx2.plot.shift4c[lsb(x) & 3] - cx16.r2L = lsb(x) & 3 + ;; color <<= gfx2.plot.shift4c[lsb(xx) & 3] + cx16.r2L = lsb(xx) & 3 when color & 3 { 1 -> color = gfx2.plot.shiftedleft_4c_1[cx16.r2L] 2 -> color = gfx2.plot.shiftedleft_4c_2[cx16.r2L] 3 -> color = gfx2.plot.shiftedleft_4c_3[cx16.r2L] } - ubyte @shared mask = gfx2.plot.mask4c[lsb(x) & 3] + ubyte @shared mask = gfx2.plot.mask4c[lsb(xx) & 3] repeat lheight { %asm {{ lda cx16.VERA_DATA0 @@ -569,8 +569,8 @@ _done } } - sub plot(uword @zp x, uword @zp y, ubyte @zp color) { - ubyte[8] @shared bits = [128, 64, 32, 16, 8, 4, 2, 1] + sub plot(uword @zp xx, uword @zp yy, ubyte @zp color) { + ubyte[8] @shared maskbits = [128, 64, 32, 16, 8, 4, 2, 1] ubyte[4] @shared mask4c = [%00111111, %11001111, %11110011, %11111100] ubyte[4] @shared shift4c = [6,4,2,0] ubyte[4] shiftedleft_4c_1 = [1<<6, 1<<4, 1<<2, 1<<0] @@ -583,8 +583,8 @@ _done if color { ; solid color or perhaps stipple %asm {{ - lda x - eor y + lda xx + eor yy ora monochrome_dont_stipple_flag and #1 }} @@ -605,7 +605,7 @@ _done ; TODO modes 2, 3 4 -> { ; lores 256c - void addr_mul_24_for_lores_256c(y, x) ; 24 bits result is in r0 and r1L (highest byte) + void addr_mul_24_for_lores_256c(yy, xx) ; 24 bits result is in r0 and r1L (highest byte) %asm {{ stz cx16.VERA_CTRL lda cx16.r1 @@ -624,8 +624,8 @@ _done if color { ; solid color or perhaps stipple %asm {{ - lda x - eor y + lda xx + eor yy ora monochrome_dont_stipple_flag and #1 }} @@ -645,8 +645,8 @@ _done } 6 -> { ; highres 4c ....also mostly usable for mode 2, lores 4c? - void addr_mul_24_for_highres_4c(y, x) ; 24 bits result is in r0 and r1L (highest byte) - cx16.r2L = lsb(x) & 3 ; xbits + void addr_mul_24_for_highres_4c(yy, xx) ; 24 bits result is in r0 and r1L (highest byte) + cx16.r2L = lsb(xx) & 3 ; xbits ; color &= 3 ; color <<= shift4c[cx16.r2L] when color & 3 { @@ -673,65 +673,65 @@ _done sub mode_1_prepare() { %asm {{ - lda x + lda xx and #7 pha ; xbits }} - x /= 8 - x += y*(320/8) + xx /= 8 + xx += yy*(320/8) %asm {{ stz cx16.VERA_CTRL stz cx16.VERA_ADDR_H - lda x+1 + lda xx+1 sta cx16.VERA_ADDR_M - lda x + lda xx sta cx16.VERA_ADDR_L ply ; xbits - lda bits,y + lda maskbits,y }} } sub mode_5_prepare() { %asm {{ - lda x + lda xx and #7 pha ; xbits }} - x /= 8 - x += y*(640/8) + xx /= 8 + xx += yy*(640/8) %asm {{ stz cx16.VERA_CTRL stz cx16.VERA_ADDR_H - lda x+1 + lda xx+1 sta cx16.VERA_ADDR_M - lda x + lda xx sta cx16.VERA_ADDR_L ply ; xbits - lda bits,y + lda maskbits,y }} } } - sub pget(uword @zp x, uword y) -> ubyte { + sub pget(uword @zp xx, uword yy) -> ubyte { when active_mode { 1 -> { ; lores monochrome %asm {{ - lda x + lda xx and #7 pha ; xbits }} - x /= 8 - x += y*(320/8) + xx /= 8 + xx += yy*(320/8) %asm {{ stz cx16.VERA_CTRL stz cx16.VERA_ADDR_H - lda x+1 + lda xx+1 sta cx16.VERA_ADDR_M - lda x + lda xx sta cx16.VERA_ADDR_L ply ; xbits - lda plot.bits,y + lda plot.maskbits,y and cx16.VERA_DATA0 beq + lda #1 @@ -741,7 +741,7 @@ _done ; TODO modes 2, 3 4 -> { ; lores 256c - void addr_mul_24_for_lores_256c(y, x) ; 24 bits result is in r0 and r1L (highest byte) + void addr_mul_24_for_lores_256c(yy, xx) ; 24 bits result is in r0 and r1L (highest byte) %asm {{ stz cx16.VERA_CTRL lda cx16.r1 @@ -756,21 +756,21 @@ _done 5 -> { ; hires monochrome %asm {{ - lda x + lda xx and #7 pha ; xbits }} - x /= 8 - x += y*(640/8) + xx /= 8 + xx += yy*(640/8) %asm {{ stz cx16.VERA_CTRL stz cx16.VERA_ADDR_H - lda x+1 + lda xx+1 sta cx16.VERA_ADDR_M - lda x + lda xx sta cx16.VERA_ADDR_L ply ; xbits - lda plot.bits,y + lda plot.maskbits,y and cx16.VERA_DATA0 beq + lda #1 @@ -779,7 +779,7 @@ _done } 6 -> { ; hires 4c - void addr_mul_24_for_highres_4c(y, x) ; 24 bits result is in r0 and r1L (highest byte) + void addr_mul_24_for_highres_4c(yy, xx) ; 24 bits result is in r0 and r1L (highest byte) %asm {{ stz cx16.VERA_CTRL lda cx16.r1L @@ -791,7 +791,7 @@ _done lda cx16.VERA_DATA0 sta cx16.r0L }} - cx16.r1L = lsb(x) & 3 + cx16.r1L = lsb(xx) & 3 cx16.r0L >>= gfx2.plot.shift4c[cx16.r1L] return cx16.r0L & 3 } @@ -799,7 +799,7 @@ _done } } - sub fill(word @zp x, word @zp y, ubyte new_color) { + sub fill(word @zp xx, word @zp yy, ubyte new_color) { ; Non-recursive scanline flood fill. ; based loosely on code found here https://www.codeproject.com/Articles/6017/QuickFill-An-efficient-flood-fill-algorithm ; with the fixes applied to the seedfill_4 routine as mentioned in the comments. @@ -862,85 +862,85 @@ _done lda stack_xr_msb,y sta x2+1 lda stack_y_lsb,y - sta y + sta yy lda stack_y_msb,y - sta y+1 + sta yy+1 ldy cx16.r12L lda stack_dy,y sta dy }} - y+=dy + yy+=dy } - cx16.r11L = pget(x as uword, y as uword) ; old_color + cx16.r11L = pget(xx as uword, yy as uword) ; old_color if cx16.r11L == cx16.r10L return - if x<0 or x > width-1 or y<0 or y > height-1 + if xx<0 or xx>width-1 or yy<0 or yy>height-1 return - push_stack(x, x, y, 1) - push_stack(x, x, y + 1, -1) + push_stack(xx, xx, yy, 1) + push_stack(xx, xx, yy + 1, -1) word left = 0 while cx16.r12L { pop_stack() - x = x1 - while x >= 0 and pget(x as uword, y as uword) == cx16.r11L { - plot(x as uword, y as uword, cx16.r10L) - x-- + xx = x1 + while xx >= 0 and pget(xx as uword, yy as uword) == cx16.r11L { + plot(xx as uword, yy as uword, cx16.r10L) + xx-- } - if x>= x1 + if xx >= x1 goto skip - left = x + 1 + left = xx + 1 if left < x1 - push_stack(left, x1 - 1, y, -dy) - x = x1 + 1 + push_stack(left, x1 - 1, yy, -dy) + xx = x1 + 1 do { - while x <= width-1 and pget(x as uword, y as uword) == cx16.r11L { - plot(x as uword, y as uword, cx16.r10L) - x++ + while xx <= width-1 and pget(xx as uword, yy as uword) == cx16.r11L { + plot(xx as uword, yy as uword, cx16.r10L) + xx++ } - push_stack(left, x - 1, y, dy) - if x > x2 + 1 - push_stack(x2 + 1, x - 1, y, -dy) + push_stack(left, xx - 1, yy, dy) + if xx > x2 + 1 + push_stack(x2 + 1, xx - 1, yy, -dy) skip: - x++ - while x <= x2 and pget(x as uword, y as uword) != cx16.r11L - x++ - left = x - } until x>x2 + xx++ + while xx <= x2 and pget(xx as uword, yy as uword) != cx16.r11L + xx++ + left = xx + } until xx>x2 } } - sub position(uword @zp x, uword y) { + sub position(uword @zp xx, uword yy) { when active_mode { 1 -> { ; lores monochrome - cx16.r0 = y*(320/8) + x/8 + cx16.r0 = yy*(320/8) + xx/8 cx16.vaddr(0, cx16.r0, 0, 1) } ; TODO modes 2, 3 4 -> { ; lores 256c - void addr_mul_24_for_lores_256c(y, x) ; 24 bits result is in r0 and r1L (highest byte) + void addr_mul_24_for_lores_256c(yy, xx) ; 24 bits result is in r0 and r1L (highest byte) cx16.r2L = cx16.r1L cx16.vaddr(cx16.r2L, cx16.r0, 0, 1) } 5 -> { ; highres monochrome - cx16.r0 = y*(640/8) + x/8 + cx16.r0 = yy*(640/8) + xx/8 cx16.vaddr(0, cx16.r0, 0, 1) } 6 -> { ; highres 4c - void addr_mul_24_for_highres_4c(y, x) ; 24 bits result is in r0 and r1L (highest byte) + void addr_mul_24_for_highres_4c(yy, xx) ; 24 bits result is in r0 and r1L (highest byte) cx16.r2L = cx16.r1L cx16.vaddr(cx16.r2L, cx16.r0, 0, 1) } } } - sub position2(uword @zp x, uword y, bool also_port_1) { - position(x, y) + sub position2(uword @zp xx, uword yy, bool also_port_1) { + position(xx, yy) if also_port_1 cx16.vaddr_clone(0) } @@ -1011,7 +1011,7 @@ skip: cx16.screen_set_charset(charset, 0) } - sub text(uword @zp x, uword y, ubyte color, uword sctextptr) { + sub text(uword @zp xx, uword yy, ubyte color, uword sctextptr) { ; -- Write some text at the given pixel position. The text string must be in screencode encoding (not petscii!). ; You must also have called text_charset() first to select and prepare the character set to use. uword chardataptr @@ -1028,7 +1028,7 @@ skip: cx16.vaddr_autoincr(charset_bank, chardataptr, 0, 1) %asm {{ ; pre-shift the bits - lda text.x + lda text.xx and #7 sta P8ZP_SCRATCH_B1 ldy #0 @@ -1049,7 +1049,7 @@ skip: bne -- }} ; left part of shifted char - position2(x, y, true) + position2(xx, yy, true) set_autoincrs_mode1_or_5() if color { %asm {{ @@ -1074,8 +1074,8 @@ skip: }} } ; right part of shifted char - if lsb(x) & 7 { - position2(x+8, y, true) + if lsb(xx) & 7 { + position2(xx+8, yy, true) set_autoincrs_mode1_or_5() if color { %asm {{ @@ -1101,7 +1101,7 @@ skip: } } cx16.r3++ - x += 8 + xx += 8 } } 4 -> { @@ -1110,8 +1110,8 @@ skip: chardataptr = charset_addr + (@(sctextptr) as uword)*8 cx16.vaddr(charset_bank, chardataptr, 1, 1) repeat 8 { - position(x,y) - y++ + position(xx,yy) + yy++ %asm {{ ldx color lda cx16.VERA_DATA1 @@ -1126,8 +1126,8 @@ skip: bne - }} } - x+=8 - y-=8 + xx+=8 + yy-=8 sctextptr++ } } @@ -1138,11 +1138,11 @@ skip: while @(sctextptr) { chardataptr = charset_addr + (@(sctextptr) as uword)*8 cx16.vaddr(charset_bank, chardataptr, 1, true) ; for reading the chardata from Vera data channel 1 - position(x, y) ; only calculated once, we update vera address in the loop instead + position(xx, yy) ; only calculated once, we update vera address in the loop instead cx16.VERA_ADDR_H &= $0f ; no auto increment repeat 8 { cx16.r10L = cx16.VERA_DATA1 ; get the next 8 horizontal character bits - cx16.r7 = x + cx16.r7 = xx repeat 8 { cx16.r10L <<= 1 if_cs { @@ -1189,7 +1189,7 @@ skip: sta cx16.VERA_ADDR_H }} } - x+=8 + xx+=8 sctextptr++ } } diff --git a/compiler/res/prog8lib/cx16/graphics.p8 b/compiler/res/prog8lib/cx16/graphics.p8 index 8f79ddb71..499e10030 100644 --- a/compiler/res/prog8lib/cx16/graphics.p8 +++ b/compiler/res/prog8lib/cx16/graphics.p8 @@ -50,22 +50,22 @@ graphics { cx16.GRAPH_draw_line(x1, y1, x2, y2) } - sub fillrect(uword x, uword y, uword width, uword height) { - cx16.GRAPH_draw_rect(x, y, width, height, 0, 1) + sub fillrect(uword xx, uword yy, uword width, uword height) { + cx16.GRAPH_draw_rect(xx, yy, width, height, 0, 1) } - sub rect(uword x, uword y, uword width, uword height) { - cx16.GRAPH_draw_rect(x, y, width, height, 0, 0) + sub rect(uword xx, uword yy, uword width, uword height) { + cx16.GRAPH_draw_rect(xx, yy, width, height, 0, 0) } - sub horizontal_line(uword x, uword y, uword length) { + sub horizontal_line(uword xx, uword yy, uword length) { if length - cx16.GRAPH_draw_line(x, y, x+length-1, y) + cx16.GRAPH_draw_line(xx, yy, xx+length-1, yy) } - sub vertical_line(uword x, uword y, uword height) { + sub vertical_line(uword xx, uword yy, uword height) { if height - cx16.GRAPH_draw_line(x, y, x, y+height-1) + cx16.GRAPH_draw_line(xx, yy, xx, yy+height-1) } sub circle(uword xcenter, ubyte ycenter, ubyte radius) { diff --git a/compiler/res/prog8lib/cx16/psg.p8 b/compiler/res/prog8lib/cx16/psg.p8 index e017eb0c9..55fb4cd9f 100644 --- a/compiler/res/prog8lib/cx16/psg.p8 +++ b/compiler/res/prog8lib/cx16/psg.p8 @@ -16,11 +16,11 @@ psg { const ubyte LEFT = %01000000 const ubyte RIGHT = %10000000 - sub voice(ubyte voice_num, ubyte channel, ubyte volume, ubyte waveform, ubyte pulsewidth) { + sub voice(ubyte voice_num, ubyte channel, ubyte vol, ubyte waveform, ubyte pulsewidth) { ; -- Enables a 'voice' on the PSG. ; voice_num = 0-15, the voice number. ; channel = either LEFT or RIGHT or (LEFT|RIGHT). Specifies the stereo channel(s) to use. - ; volume = 0-63, the starting volume for the voice + ; vol = 0-63, the starting volume for the voice ; waveform = one of PULSE,SAWTOOTH,TRIANGLE,NOISE. ; pulsewidth = 0-63. Specifies the pulse width for waveform=PULSE. envelope_states[voice_num] = 255 @@ -30,11 +30,11 @@ psg { cx16.VERA_ADDR_L = lsb(cx16.r0) cx16.VERA_ADDR_M = msb(cx16.r0) cx16.VERA_ADDR_H = 1 - cx16.VERA_DATA0 = channel | volume + cx16.VERA_DATA0 = channel | vol cx16.VERA_ADDR_L++ cx16.VERA_DATA0 = waveform | pulsewidth - envelope_volumes[voice_num] = mkword(volume, 0) - envelope_maxvolumes[voice_num] = volume + envelope_volumes[voice_num] = mkword(vol, 0) + envelope_maxvolumes[voice_num] = vol sys.irqsafe_clear_irqd() } diff --git a/compiler/res/prog8lib/cx16/syslib.p8 b/compiler/res/prog8lib/cx16/syslib.p8 index bd2821a62..fe61526af 100644 --- a/compiler/res/prog8lib/cx16/syslib.p8 +++ b/compiler/res/prog8lib/cx16/syslib.p8 @@ -38,7 +38,7 @@ romsub $FFC6 = CHKIN(ubyte logical @ X) clobbers(A,X) -> bool @Pc ; (via 798 romsub $FFC9 = CHKOUT(ubyte logical @ X) clobbers(A,X) ; (via 800 ($320)) define an output channel romsub $FFCC = CLRCHN() clobbers(A,X) ; (via 802 ($322)) restore default devices romsub $FFCF = CHRIN() clobbers(X, Y) -> ubyte @ A ; (via 804 ($324)) input a character (for keyboard, read a whole line from the screen) A=byte read. -romsub $FFD2 = CHROUT(ubyte char @ A) ; (via 806 ($326)) output a character +romsub $FFD2 = CHROUT(ubyte character @ A) ; (via 806 ($326)) output a character romsub $FFD5 = LOAD(ubyte verify @ A, uword address @ XY) -> bool @Pc, ubyte @ A, uword @ XY ; (via 816 ($330)) load from device romsub $FFD8 = SAVE(ubyte zp_startaddr @ A, uword endaddr @ XY) clobbers (X, Y) -> bool @ Pc, ubyte @ A ; (via 818 ($332)) save to a device romsub $FFDB = SETTIM(ubyte low @ A, ubyte middle @ X, ubyte high @ Y) ; set the software clock @@ -346,8 +346,8 @@ romsub $ff35 = GRAPH_draw_oval(uword x @R0, uword y @R1, uword width @R2, uword romsub $ff38 = GRAPH_draw_image(uword x @R0, uword y @R1, uword ptr @R2, uword width @R3, uword height @R4) clobbers(A,X,Y) romsub $ff3b = GRAPH_set_font(uword fontptr @R0) clobbers(A,X,Y) romsub $ff3e = GRAPH_get_char_size(ubyte baseline @A, ubyte width @X, ubyte height_or_style @Y, bool is_control @Pc) clobbers(A,X,Y) -romsub $ff41 = GRAPH_put_char(uword x @R0, uword y @R1, ubyte char @A) clobbers(A,X,Y) -romsub $ff41 = GRAPH_put_next_char(ubyte char @A) clobbers(A,X,Y) ; alias for the routine above that doesn't reset the position of the initial character +romsub $ff41 = GRAPH_put_char(uword x @R0, uword y @R1, ubyte character @A) clobbers(A,X,Y) +romsub $ff41 = GRAPH_put_next_char(ubyte character @A) clobbers(A,X,Y) ; alias for the routine above that doesn't reset the position of the initial character ; framebuffer romsub $fef6 = FB_init() clobbers(A,X,Y) @@ -377,7 +377,7 @@ romsub $fee7 = memory_copy(uword source @R0, uword target @R1, uword num_bytes @ romsub $feea = memory_crc(uword address @R0, uword num_bytes @R1) clobbers(A,X,Y) -> uword @R2 romsub $feed = memory_decompress(uword input @R0, uword output @R1) clobbers(A,X,Y) -> uword @R1 ; last address +1 is result in R1 romsub $fedb = console_init(uword x @R0, uword y @R1, uword width @R2, uword height @R3) clobbers(A,X,Y) -romsub $fede = console_put_char(ubyte char @A, bool wrapping @Pc) clobbers(A,X,Y) +romsub $fede = console_put_char(ubyte character @A, bool wrapping @Pc) clobbers(A,X,Y) romsub $fee1 = console_get_char() clobbers(X,Y) -> ubyte @A romsub $fed8 = console_put_image(uword pointer @R0, uword width @R1, uword height @R2) clobbers(A,X,Y) romsub $fed5 = console_set_paging_message(uword msgptr @R0) clobbers(A,X,Y) diff --git a/compiler/res/prog8lib/cx16/textio.p8 b/compiler/res/prog8lib/cx16/textio.p8 index 6eb1bb88e..32ca616ff 100644 --- a/compiler/res/prog8lib/cx16/textio.p8 +++ b/compiler/res/prog8lib/cx16/textio.p8 @@ -42,7 +42,7 @@ asmsub column(ubyte col @A) clobbers(A, X, Y) { }} } -asmsub fill_screen (ubyte char @ A, ubyte color @ Y) clobbers(A, X) { +asmsub fill_screen (ubyte character @ A, ubyte color @ Y) clobbers(A, X) { ; ---- fill the character screen with the given fill character and character color. %asm {{ sty _ly+1 @@ -88,7 +88,7 @@ set_vera_textmatrix_addresses: }} } -asmsub clear_screenchars (ubyte char @ A) clobbers(X, Y) { +asmsub clear_screenchars (ubyte character @ A) clobbers(X, Y) { ; ---- clear the character screen with the given fill character (leaves colors) ; (assumes screen matrix is at the default address) %asm {{ @@ -384,7 +384,7 @@ _nextline }} } -romsub $FFD2 = chrout(ubyte char @ A) ; for consistency. You can also use cbm.CHROUT directly ofcourse. +romsub $FFD2 = chrout(ubyte character @ A) ; for consistency. You can also use cbm.CHROUT directly ofcourse. asmsub print (str text @ AY) clobbers(A,Y) { ; ---- print null terminated string from A/Y @@ -674,12 +674,12 @@ asmsub getclr (ubyte col @A, ubyte row @Y) -> ubyte @ A { }} } -sub setcc (ubyte column, ubyte row, ubyte char, ubyte charcolor) { +sub setcc (ubyte col, ubyte row, ubyte character, ubyte charcolor) { ; ---- 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 and leaves the background color as is. ; Use setcc2 if you want Cx-16 specific feature of setting both Bg+Fg colors (is faster as well). %asm {{ - lda column + lda col asl a tax ldy row @@ -691,7 +691,7 @@ sub setcc (ubyte column, ubyte row, ubyte char, ubyte charcolor) { ;clc adc #>VERA_TEXTMATRIX_ADDR sta cx16.VERA_ADDR_M - lda char + lda character sta cx16.VERA_DATA0 inc cx16.VERA_ADDR_L lda charcolor @@ -705,12 +705,12 @@ sub setcc (ubyte column, ubyte row, ubyte char, ubyte charcolor) { }} } -sub setcc2 (ubyte column, ubyte row, ubyte char, ubyte colors) { +sub setcc2 (ubyte col, ubyte row, ubyte character, 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! Is a bit faster than setcc() too. %asm {{ - lda column + lda col asl a tax ldy row @@ -722,7 +722,7 @@ sub setcc2 (ubyte column, ubyte row, ubyte char, ubyte colors) { ; clc adc #>VERA_TEXTMATRIX_ADDR sta cx16.VERA_ADDR_M - lda char + lda character sta cx16.VERA_DATA0 inc cx16.VERA_ADDR_L lda colors diff --git a/compiler/res/prog8lib/diskio.p8 b/compiler/res/prog8lib/diskio.p8 index 44378f6da..c459313ba 100644 --- a/compiler/res/prog8lib/diskio.p8 +++ b/compiler/res/prog8lib/diskio.p8 @@ -42,12 +42,12 @@ diskio { ubyte high = cbm.CHRIN() txt.print_uw(mkword(high, low)) txt.spc() - ubyte @zp char + ubyte @zp character repeat { - char = cbm.CHRIN() - if char==0 + character = cbm.CHRIN() + if character==0 break - txt.chrout(char) + txt.chrout(character) } txt.nl() void cbm.CHRIN() ; skip 2 bytes @@ -211,12 +211,12 @@ io_error: ; read the filename repeat { - ubyte char = cbm.CHRIN() - if char==0 + ubyte character = cbm.CHRIN() + if character==0 break - if char=='\"' + if character=='\"' break - @(nameptr) = char + @(nameptr) = character nameptr++ } @@ -444,16 +444,16 @@ io_error: goto done } - sub save(uword filenameptr, uword address, uword size) -> bool { + sub save(uword filenameptr, uword start_address, uword savesize) -> bool { cbm.SETNAM(string.length(filenameptr), filenameptr) cbm.SETLFS(1, drivenumber, 0) - uword @shared end_address = address + size + uword @shared end_address = start_address + savesize cx16.r0L = 0 %asm {{ - lda address + lda start_address sta P8ZP_SCRATCH_W1 - lda address+1 + lda start_address+1 sta P8ZP_SCRATCH_W1+1 lda # uword { + sub load_raw(uword filenameptr, uword start_address) -> uword { ; read the 2 header bytes separately to skip them if not f_open(filenameptr) return 0 - cx16.r1 = f_read(address, 2) + cx16.r1 = f_read(start_address, 2) f_close() if cx16.r1!=2 return 0 - address += 2 - return load(filenameptr, address) + start_address += 2 + return load(filenameptr, start_address) } sub delete(uword filenameptr) { diff --git a/compiler/res/prog8lib/pet32/syslib.p8 b/compiler/res/prog8lib/pet32/syslib.p8 index ad5f33330..d5117456e 100644 --- a/compiler/res/prog8lib/pet32/syslib.p8 +++ b/compiler/res/prog8lib/pet32/syslib.p8 @@ -27,7 +27,7 @@ romsub $FFC6 = CHKIN(ubyte logical @ X) clobbers(A,X) -> bool @Pc ; define an romsub $FFC9 = CHKOUT(ubyte logical @ X) clobbers(A,X) ; define an output channel romsub $FFCC = CLRCHN() clobbers(A,X) ; restore default devices romsub $FFCF = CHRIN() clobbers(X, Y) -> ubyte @ A ; input a character (for keyboard, read a whole line from the screen) A=byte read. -romsub $FFD2 = CHROUT(ubyte char @ A) ; output a character +romsub $FFD2 = CHROUT(ubyte character @ A) ; output a character romsub $FFE1 = STOP() clobbers(X) -> bool @ Pz, ubyte @ A ; check the STOP key (and some others in A) romsub $FFE4 = GETIN() clobbers(X,Y) -> bool @Pc, ubyte @ A ; get a character romsub $FFE7 = CLALL() clobbers(A,X) ; close all files diff --git a/compiler/res/prog8lib/pet32/textio.p8 b/compiler/res/prog8lib/pet32/textio.p8 index a403c9c1f..99683000a 100644 --- a/compiler/res/prog8lib/pet32/textio.p8 +++ b/compiler/res/prog8lib/pet32/textio.p8 @@ -28,7 +28,7 @@ sub spc() { } -asmsub fill_screen (ubyte char @ A, ubyte color @ Y) clobbers(A) { +asmsub fill_screen (ubyte character @ A, ubyte color @ Y) clobbers(A) { ; ---- fill the character screen with the given fill character. color is ignored on PET %asm {{ jmp clear_screenchars @@ -36,7 +36,7 @@ asmsub fill_screen (ubyte char @ A, ubyte color @ Y) clobbers(A) { } -asmsub clear_screenchars (ubyte char @ A) clobbers(Y) { +asmsub clear_screenchars (ubyte character @ A) clobbers(Y) { ; ---- clear the character screen with the given fill character ; (assumes screen matrix is at the default address) %asm {{ @@ -139,7 +139,7 @@ asmsub scroll_down () clobbers(A,X) { }} } -romsub $FFD2 = chrout(ubyte char @ A) ; for consistency. You can also use cbm.CHROUT directly ofcourse. +romsub $FFD2 = chrout(ubyte character @ A) ; for consistency. You can also use cbm.CHROUT directly ofcourse. asmsub print (str text @ AY) clobbers(A,Y) { ; ---- print null terminated string from A/Y @@ -396,7 +396,7 @@ sub setclr (ubyte col, ubyte row, ubyte color) { } -sub setcc (ubyte column, ubyte row, ubyte char, ubyte charcolor) { +sub setcc (ubyte col, ubyte row, ubyte character, ubyte charcolor) { ; ---- set char at the given position on the screen. charcolor is ignored on PET %asm {{ lda row @@ -406,11 +406,11 @@ sub setcc (ubyte column, ubyte row, ubyte char, ubyte charcolor) { sta _charmod+2 lda setchr._screenrows,y clc - adc column + adc col sta _charmod+1 bcc + inc _charmod+2 -+ lda char ++ lda character _charmod sta $ffff ; modified rts }} diff --git a/compiler/res/prog8lib/string.p8 b/compiler/res/prog8lib/string.p8 index 84e79c19a..419239b1f 100644 --- a/compiler/res/prog8lib/string.p8 +++ b/compiler/res/prog8lib/string.p8 @@ -225,7 +225,7 @@ _done rts }} } - asmsub lowerchar(ubyte char @A) -> ubyte @A { + asmsub lowerchar(ubyte character @A) -> ubyte @A { %asm {{ and #$7f cmp #97 @@ -237,7 +237,7 @@ _done rts }} } - asmsub upperchar(ubyte char @A) -> ubyte @A { + asmsub upperchar(ubyte character @A) -> ubyte @A { %asm {{ cmp #65 bcc + @@ -280,10 +280,10 @@ _done rts ; ; see http://6502.org/source/strings/patmatch.htm -str = P8ZP_SCRATCH_W1 +strptr = P8ZP_SCRATCH_W1 - sta str - sty str+1 + sta strptr + sty strptr+1 lda cx16.r0 sta modify_pattern1+1 sta modify_pattern2+1 @@ -306,9 +306,9 @@ next lda $ffff,x ; look at next pattern character MODIFIED iny ; no, let's look at the string cmp #'?' ; is the pattern caracter a ques? bne reg ; no, it's a regular character - lda (str),y ; yes, so it will match anything + lda (strptr),y ; yes, so it will match anything beq fail ; except the end of string -reg cmp (str),y ; are both characters the same? +reg cmp (strptr),y ; are both characters the same? bne fail ; no, so no match inx ; yes, keep checking cmp #0 ; are we at end of string? @@ -330,7 +330,7 @@ stloop txa ; we first try to match with * = "" tax bcs found ; we found a match, return with c=1 iny ; no match yet, try to grow * string - lda (str),y ; are we at the end of string? + lda (strptr),y ; are we at the end of string? bne stloop ; not yet, add a character fail clc ; yes, no match found, return with c=0 rts diff --git a/docs/source/todo.rst b/docs/source/todo.rst index f0f8cc29f..67f5db607 100644 --- a/docs/source/todo.rst +++ b/docs/source/todo.rst @@ -1,8 +1,8 @@ TODO ==== +- maze example is broken on c64/c128 (not on cx16...) -- [on branch: shadowing-fixes] add shadowing warning to asm and fix shadowing errors -- prefix prog8 subroutines with p8s_ instead of p8_ to not let them clash with variables in the asm +- prefix prog8 subroutines with p8s_ instead of p8_ to not let them clash with variables in the asm? - allow 'chained' array indexing for expressions: value = ptrarray[0][0] - allow 'chained' array indexing for assign targets: ptrarray[0][0] = 42 this is just evaluating the lhs as a uword pointer expression