From 159f80d629a4f91a9a809999c0747a2fa5f8e9b4 Mon Sep 17 00:00:00 2001 From: Irmen de Jong Date: Tue, 14 Nov 2023 18:23:37 +0100 Subject: [PATCH] next version --- docs/source/todo.rst | 5 ++ examples/cx16/chunkedfile/readme.md | 2 +- examples/test.p8 | 133 +++------------------------- gradle.properties | 2 +- 4 files changed, 18 insertions(+), 124 deletions(-) diff --git a/docs/source/todo.rst b/docs/source/todo.rst index a4f0f7419..39475ae6d 100644 --- a/docs/source/todo.rst +++ b/docs/source/todo.rst @@ -2,6 +2,11 @@ TODO ==== +- palette: mnore accurate conversion to 4 bit colorspage in set_rgb8, by doing (x * 15 + 135) >> 8, see https://threadlocalmutex.com/?p=48 +- fix the compiler crash on s1[n+1] = s1[2] where s1 is a subroutine param (regular variable works) +- improve the working of %option merge: should be able to merge your own stuff into say textio. , and improve the docs about it too. +- give error when using %option merge in module scope. + - [on branch: shortcircuit] investigate McCarthy evaluation again? this may also reduce code size perhaps for things like if a>4 or a<2 .... - [on branch: ir-less-branch-opcodes] IR: reduce the number of branch instructions such as BEQ, BEQR, etc (gradually), replace with CMP(I) + status branch instruction - IR: reduce amount of CMP/CMPI after instructions that set the status bits correctly (LOADs? INC? Bitwise operations, etc), but only after setting the status bits is verified! diff --git a/examples/cx16/chunkedfile/readme.md b/examples/cx16/chunkedfile/readme.md index d6c19107b..01018cac8 100644 --- a/examples/cx16/chunkedfile/readme.md +++ b/examples/cx16/chunkedfile/readme.md @@ -7,7 +7,7 @@ - simple file format with few special cases. - no random access, only sequential reading/streaming. - simple user code that doesn't have to bother with the I/O at all. -- a few chunk typs that can be handled automatically to load data into system ram, banked ram, or video ram. +- a few chunk types that can be handled automatically to load data into system ram, banked ram, or video ram. - custom chunk types for flexibility or extensibility. Theoretical optimal chunk size is 512 bytes but actual size may be different. (In practice there seems to be no significant speed impact) diff --git a/examples/test.p8 b/examples/test.p8 index be1a4bd9a..b9e44b712 100644 --- a/examples/test.p8 +++ b/examples/test.p8 @@ -1,129 +1,18 @@ -%option no_sysinit -%import textio -%import diskio +%import string %zeropage basicsafe main { - sub start() { - str filename = "doesnotexist.xyz" - ubyte status - - - txt.print("read open...\n") - if diskio.f_open(filename) { - status = cbm.READST() - txt.print("open ok - wrong! status=") - } else { - status = cbm.READST() - txt.print("open failed - good! status=") - } - txt.print_ub(status) - txt.nl() - txt.print(diskio.status()) - txt.nl() - - txt.print("\nwriting the file\n") - if diskio.f_open_w(filename) { - cx16.r0 = diskio.status() - if @(cx16.r0)=='0' { - diskio.f_write("test", 4) - diskio.f_close_w() - status = cbm.READST() - txt.print("write ok! good! status=\n") - } else { - txt.print("write open error, status=") - txt.print(cx16.r0) - txt.nl() - } - } else { - status = cbm.READST() - txt.print("write open failed! wrong! status=\n") - } - txt.print_ub(status) - txt.nl() - txt.print(diskio.status()) - txt.nl() - - txt.print("\nread open...\n") - if diskio.f_open(filename) { - status = cbm.READST() - txt.print("open ok - good! status=") - } else { - status = cbm.READST() - txt.print("open failed - wrong! status=") - } - txt.print_ub(status) - txt.nl() - txt.print(diskio.status()) - txt.nl() - } -} - -main33 { - sub print_buffer() { - uword ptr = $4000 - uword firstAA = ptr - repeat 320*6 { - txt.print_ubhex(@(ptr), false) - if @(ptr)==$aa { - firstAA = ptr - break - } - ptr++ - } - txt.nl() - txt.print("first $aa is at ") - txt.print_uwhex(firstAA, true) - txt.print(" = offset ") - txt.print_uw(firstAA-$4000) - txt.nl() - } sub start() { - uword buffer = $4000 - sys.memset(buffer, 2000, $aa) - - print_buffer() - - void cx16.screen_mode($80, false) ; 320*240 * 256C - cx16.FB_cursor_position(0, 0) - cx16.FB_get_pixels($4000, 256) - void cx16.screen_mode(0, false) ; 320*240 * 256C - - print_buffer() - repeat { } - - - void cx16.screen_mode($80, false) ; 320*240 * 256C - ;; cx16.mouse_config2(1) - cx16.FB_cursor_position(0, 0) - - cx16.FB_set_pixels(0, 320*4) - ; expected result: exactly 12 rows of 320 pixels written - ; actual result: almost 13 rows of pixels written. - - repeat {} - -; sys.wait(9999) -; -; ; this works: -; ubyte y -; for y in 0 to 239 step 24 { -; cx16.FB_cursor_position(0, y) -; cx16.FB_set_pixels(0, 320*24) -; } -; sys.wait(120) -; -; ; this works too: -; cx16.FB_cursor_position(0,0) -; repeat 240 cx16.FB_set_pixels(0, 320) -; sys.wait(120) -; -; ; this kills the mouse pointer because it writes past the bitmap screen data -; ; expected is to write 10 times 24 rows = 240 rows of pixels, exactly 1 screen... -; cx16.FB_cursor_position(0,0) -; unroll 10 cx16.FB_set_pixels(0, 320*24) -; -; repeat {} + cat("aaaaa") } + +sub cat(str s1) { + str s2 = "three" + ubyte n=2 + + ; s1[n+1] = s1[2] ; TODO compiler crash + s2[n+1] = s2[2] ; works fine +} + } diff --git a/gradle.properties b/gradle.properties index 7f4722d3f..0fa39bf93 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,4 +5,4 @@ org.gradle.daemon=true kotlin.code.style=official javaVersion=11 kotlinVersion=1.9.20 -version=9.6 +version=9.7-SNAPSHOT