From f07065bf845601194f6ab0a75c930ac0cc6e2a48 Mon Sep 17 00:00:00 2001 From: Irmen de Jong Date: Mon, 28 Mar 2022 22:28:39 +0200 Subject: [PATCH] some x16 example changes to use the improved mode $80 screen resolution --- docs/source/todo.rst | 11 +++++++++-- examples/cx16/cobramk3-gfx.p8 | 9 +++++---- examples/cx16/kefrenbars.p8 | 5 +++-- examples/cx16/mandelbrot-gfx-colors.p8 | 12 ++++++------ examples/cx16/multipalette.p8 | 4 ++-- 5 files changed, 25 insertions(+), 16 deletions(-) diff --git a/docs/source/todo.rst b/docs/source/todo.rst index 81817bdac..8cd0b7580 100644 --- a/docs/source/todo.rst +++ b/docs/source/todo.rst @@ -5,17 +5,24 @@ For next release ^^^^^^^^^^^^^^^^ - vm codegen: fix ifelse comparisons such as if x< 0 - vm codegen: fix primes endless loop stuck on '2' +- x16: check additional FP lib changes https://github.com/commanderx16/x16-rom/commit/ae608673f0210953172d6837acfbb231d62ddbd1 + and https://github.com/commanderx16/x16-docs/commit/21238aedc641da91df88e04c4ce9bf3324a3c12d - x16: check joystick support (petaxian, own stuff) because of api change in r39 kernal https://github.com/commanderx16/x16-docs/blob/master/Commander%20X16%20Programmer's%20Reference%20Guide.md#function-name-joystick_get - x16: screen_set_mode -> screen_mode + other args https://github.com/commanderx16/x16-docs/blob/master/Commander%20X16%20Programmer's%20Reference%20Guide.md#function-name-screen_mode -- optimize diskio load_raw on X16 because headerless files are now supported https://github.com/commanderx16/x16-rom/pull/216 +- x16: new vera memory layout https://github.com/commanderx16/x16-rom/issues/185 this may break certain things in gfx2 and elsewhere. Such as font rendering + broken examples: amiga, colorbars, cube3d, highresbitmap, rasterbars, tehtriz, testgfx2, testvtui + can we make the code read the new layout from vera registers instead of hardcoding it? +- x16: check new ZP free addresses https://github.com/commanderx16/x16-docs/commit/541f2ce9e61d1d0d0e157d7f52fe16bc0895e6f0 +- x16: optimize diskio load_raw because headerless files are now supported https://github.com/commanderx16/x16-rom/pull/216 note: must still work on c64/c128 that don't have this! -- major version bump once X16 r39 rom is officially finalized +- major compiler version bump once X16 r39 rom is officially finalized - vm codegen: ForLoop - vm codegen: When - vm codegen: Pipe expression - vm codegen: validate that PtFunctionCall translation works okay with resultregister - vm codegen: postincrdecr arrayvalue - vm: support no globals re-init option +- vm: how to remove all unused subroutines? (for asm, 64tass used to do this) - vm codegen/assembler: variable memory locations should also be referenced by the variable name instead of just the address - when the vm is stable and *if* its language can get promoted to prog8 IL, the variable allocation should be changed. It's now done before the vm code generation, but the IL should probably not depend on the allocations already performed. diff --git a/examples/cx16/cobramk3-gfx.p8 b/examples/cx16/cobramk3-gfx.p8 index c72abbcf1..a0f5d2213 100644 --- a/examples/cx16/cobramk3-gfx.p8 +++ b/examples/cx16/cobramk3-gfx.p8 @@ -26,7 +26,8 @@ main { rotate_vertices(msb(anglex), msb(angley), msb(anglez)) cx16.GRAPH_set_colors(0, 0, 0) - cx16.GRAPH_draw_rect(32, 10, 256, 185, 0, true) + ; cx16.GRAPH_clear() + cx16.GRAPH_draw_rect(32, 10, 256, 220, 0, false) cx16.GRAPH_set_colors(1, 0, 0) draw_lines_hiddenremoval() @@ -119,7 +120,7 @@ _ones pla } const uword screen_width = 320 - const ubyte screen_height = 200 + const ubyte screen_height = 240 sub draw_lines() { ; simple routine that draw all edges, exactly once, but no hidden line removal. @@ -207,8 +208,8 @@ _ones pla edgestodraw[edgeidx] = false ubyte vFrom = shipdata.edgesFrom[edgeidx] ubyte vTo = shipdata.edgesTo[edgeidx] - word persp1 = 200 + rotatedz[vFrom]/256 - word persp2 = 200 + rotatedz[vTo]/256 + word persp1 = 170 + rotatedz[vFrom]/256 + word persp2 = 170 + rotatedz[vTo]/256 cx16.GRAPH_draw_line(rotatedx[vFrom] / persp1 + screen_width/2 as uword, rotatedy[vFrom] / persp1 + screen_height/2 as uword, rotatedx[vTo] / persp2 + screen_width/2 as uword, diff --git a/examples/cx16/kefrenbars.p8 b/examples/cx16/kefrenbars.p8 index 7b7cafd41..91e7a2d08 100644 --- a/examples/cx16/kefrenbars.p8 +++ b/examples/cx16/kefrenbars.p8 @@ -43,11 +43,12 @@ irq { ubyte[32] pixels = 0 to 31 + const ubyte y_offset = 6 sub irqhandler() { - next_irq_line += 6 + next_irq_line += y_offset anim1 += 4 anim2 += 6 - if next_irq_line > 400 { + if next_irq_line > 480-y_offset { av1++ av2 += 2 anim1 = av1 diff --git a/examples/cx16/mandelbrot-gfx-colors.p8 b/examples/cx16/mandelbrot-gfx-colors.p8 index b386ee7de..6a363138e 100644 --- a/examples/cx16/mandelbrot-gfx-colors.p8 +++ b/examples/cx16/mandelbrot-gfx-colors.p8 @@ -4,7 +4,7 @@ main { const uword width = 256 - const uword height = 200 + const uword height = 240 const ubyte max_iter = 16 ; 32 actually looks pretty nice but takes longer sub start() { @@ -16,10 +16,10 @@ main { } sub mandel() { - const float XL=-2.000 - const float XU=0.500 - const float YL=-1.100 - const float YU=1.100 + const float XL=-2.200 + const float XU=0.800 + const float YL=-1.300 + const float YU=1.300 float dx = (XU-XL)/width float dy = (YU-YL)/height ubyte pixelx @@ -57,7 +57,7 @@ main { void cx16.screen_set_mode($80) txt.plot(32, 5) - txt.print("256*200") + txt.print("256*240") txt.plot(32, 6) txt.print("mandel-") txt.plot(33, 7) diff --git a/examples/cx16/multipalette.p8 b/examples/cx16/multipalette.p8 index 28fe57af8..08106b41b 100644 --- a/examples/cx16/multipalette.p8 +++ b/examples/cx16/multipalette.p8 @@ -18,7 +18,7 @@ main { ubyte pix=0 ubyte ypos cx16.FB_cursor_position(0, 0) - for ypos in 0 to 199 { + for ypos in 0 to 239 { repeat 320/2 { cx16.FB_set_pixel((pix&15)<<4 | (pix&15)) pix++ @@ -397,7 +397,7 @@ irq { phase++ next_rasterline += increment - if next_rasterline > 400 { + if next_rasterline >= 480 { next_rasterline = 0 phase = 0 }