From b4bfaf016abcc18d7a68b39927385520425635d7 Mon Sep 17 00:00:00 2001 From: jespergravgaard Date: Wed, 28 Mar 2018 15:21:22 +0200 Subject: [PATCH] Lowered number of uplift permutations to 1000 --- .../java/dk/camelot64/kickc/Compiler.java | 4 +- .../kickc/test/ref/bitmap-bresenham.log | 64 ++--- .../kickc/test/ref/bitmap-plotter.log | 26 +- .../kickc/test/ref/c64dtv-gfxmodes.asm | 9 +- .../kickc/test/ref/c64dtv-gfxmodes.log | 146 +++++----- .../kickc/test/ref/c64dtv-gfxmodes.sym | 6 +- .../kickc/test/ref/chargen-analysis.asm | 12 +- .../kickc/test/ref/chargen-analysis.log | 121 +++++---- .../kickc/test/ref/chargen-analysis.sym | 14 +- .../kickc/test/ref/keyboard-glitch.asm | 8 +- .../kickc/test/ref/keyboard-glitch.log | 66 +++-- .../kickc/test/ref/keyboard-glitch.sym | 8 +- .../kickc/test/ref/sinus-sprites.asm | 42 +-- .../kickc/test/ref/sinus-sprites.log | 255 +++++++++--------- .../kickc/test/ref/sinus-sprites.sym | 27 +- .../dk/camelot64/kickc/test/ref/sinusgen8.log | 36 +-- .../camelot64/kickc/test/ref/sinusgen8b.log | 42 +-- .../kickc/test/ref/sinusgenscale8.log | 44 +-- .../dk/camelot64/kickc/test/ref/summin.log | 12 +- .../kickc/test/ref/test-division.asm | 8 +- .../kickc/test/ref/test-division.log | 120 +++++---- .../kickc/test/ref/test-division.sym | 4 +- .../kickc/test/ref/test-keyboard.asm | 24 +- .../kickc/test/ref/test-keyboard.log | 139 +++++----- .../kickc/test/ref/test-keyboard.sym | 22 +- .../kickc/test/ref/test-multiply-16bit.log | 1 + .../kickc/test/ref/test-multiply-8bit.log | 3 + .../dk/camelot64/kickc/test/ref/voronoi.asm | 40 +-- .../dk/camelot64/kickc/test/ref/voronoi.log | 236 ++++++++-------- .../dk/camelot64/kickc/test/ref/voronoi.sym | 48 ++-- .../camelot64/kickc/test/ref/zpparammin.log | 2 + 31 files changed, 845 insertions(+), 744 deletions(-) diff --git a/src/main/java/dk/camelot64/kickc/Compiler.java b/src/main/java/dk/camelot64/kickc/Compiler.java index 55bbba190..6ec8258c2 100644 --- a/src/main/java/dk/camelot64/kickc/Compiler.java +++ b/src/main/java/dk/camelot64/kickc/Compiler.java @@ -311,14 +311,14 @@ public class Compiler { // Attempt uplifting registers through a lot of combinations //getLog().setVerboseUplift(true); - new Pass4RegisterUpliftCombinations(program).performUplift(10_000); + new Pass4RegisterUpliftCombinations(program).performUplift(1_000); //getLog().setVerboseUplift(true); //new Pass4RegisterUpliftStatic(program).performUplift(); //getLog().setVerboseUplift(false); // Attempt uplifting registers one at a time to catch remaining potential not realized by combination search - new Pass4RegisterUpliftRemains(program).performUplift(10_000); + new Pass4RegisterUpliftRemains(program).performUplift(1_000); // Final register coalesce and finalization new Pass4ZeroPageCoalesceAssignment(program).coalesce(); diff --git a/src/test/java/dk/camelot64/kickc/test/ref/bitmap-bresenham.log b/src/test/java/dk/camelot64/kickc/test/ref/bitmap-bresenham.log index d4bad7e21..a1530dba6 100644 --- a/src/test/java/dk/camelot64/kickc/test/ref/bitmap-bresenham.log +++ b/src/test/java/dk/camelot64/kickc/test/ref/bitmap-bresenham.log @@ -5486,61 +5486,61 @@ Uplifting [line_xdyd] best 293804 combination zp ZP_BYTE:28 [ line_xdyd::e#3 lin Uplifting [line_ydxi] best 281798 combination zp ZP_BYTE:8 [ line_ydxi::e#3 line_ydxi::e#0 line_ydxi::e#6 line_ydxi::e#2 line_ydxi::e#1 ] reg byte x [ line_ydxi::x#3 line_ydxi::x#5 line_ydxi::x#1 line_ydxi::x#0 line_ydxi::x#6 line_ydxi::x#2 ] reg byte y [ line_ydxi::$6 ] zp ZP_BYTE:7 [ line_ydxi::y#3 line_ydxi::y#6 line_ydxi::y#1 line_ydxi::y#0 line_ydxi::y#2 ] zp ZP_BYTE:4 [ line_ydxi::yd#5 line_ydxi::yd#1 line_ydxi::yd#0 ] zp ZP_BYTE:3 [ line_ydxi::xd#2 line_ydxi::xd#1 line_ydxi::xd#0 ] zp ZP_BYTE:5 [ line_ydxi::y1#6 line_ydxi::y1#1 line_ydxi::y1#0 ] Uplifting [line_ydxd] best 269792 combination zp ZP_BYTE:22 [ line_ydxd::e#3 line_ydxd::e#0 line_ydxd::e#6 line_ydxd::e#2 line_ydxd::e#1 ] reg byte x [ line_ydxd::x#3 line_ydxd::x#5 line_ydxd::x#1 line_ydxd::x#0 line_ydxd::x#6 line_ydxd::x#2 ] reg byte y [ line_ydxd::$6 ] zp ZP_BYTE:21 [ line_ydxd::y#2 line_ydxd::y#7 line_ydxd::y#1 line_ydxd::y#0 line_ydxd::y#3 ] zp ZP_BYTE:18 [ line_ydxd::yd#5 line_ydxd::yd#1 line_ydxd::yd#0 ] zp ZP_BYTE:17 [ line_ydxd::xd#2 line_ydxd::xd#1 line_ydxd::xd#0 ] zp ZP_BYTE:19 [ line_ydxd::y1#6 line_ydxd::y1#1 line_ydxd::y1#0 ] Uplifting [lines] best 269792 combination zp ZP_BYTE:2 [ lines::l#2 lines::l#1 ] -Uplift attempts [init_plot_tables] 10000/138240 (limiting to 10000) -Uplifting [init_plot_tables] best 269162 combination zp ZP_WORD:32 [ init_plot_tables::yoffs#2 init_plot_tables::yoffs#4 init_plot_tables::yoffs#1 ] reg byte y [ init_plot_tables::bits#3 init_plot_tables::bits#4 init_plot_tables::bits#1 ] reg byte x [ init_plot_tables::x#2 init_plot_tables::x#1 ] reg byte x [ init_plot_tables::y#2 init_plot_tables::y#1 ] reg byte a [ init_plot_tables::$0 ] reg byte a [ init_plot_tables::$7 ] reg byte a [ init_plot_tables::$8 ] reg byte a [ init_plot_tables::$9 ] zp ZP_BYTE:64 [ init_plot_tables::$10 ] zp ZP_BYTE:60 [ init_plot_tables::$6 ] -Limited combination testing to 10000 combinations of 138240 possible. -Uplifting [init_screen] best 269162 combination zp ZP_WORD:34 [ init_screen::b#2 init_screen::b#1 ] zp ZP_WORD:36 [ init_screen::c#2 init_screen::c#1 ] -Uplift attempts [line] 10000/186624 (limiting to 10000) -Uplifting [line] best 268850 combination reg byte y [ line::y1#0 ] zp ZP_BYTE:40 [ line::y0#0 ] zp ZP_BYTE:39 [ line::x1#0 ] zp ZP_BYTE:38 [ line::x0#0 ] zp ZP_BYTE:43 [ line::yd#1 ] zp ZP_BYTE:44 [ line::yd#0 ] zp ZP_BYTE:46 [ line::yd#3 ] zp ZP_BYTE:47 [ line::yd#10 ] zp ZP_BYTE:42 [ line::xd#1 ] zp ZP_BYTE:45 [ line::xd#0 ] -Limited combination testing to 10000 combinations of 186624 possible. -Uplifting [main] best 268850 combination -Uplifting [] best 268850 combination +Uplifting [init_plot_tables] best 269222 combination zp ZP_WORD:32 [ init_plot_tables::yoffs#2 init_plot_tables::yoffs#4 init_plot_tables::yoffs#1 ] reg byte y [ init_plot_tables::bits#3 init_plot_tables::bits#4 init_plot_tables::bits#1 ] reg byte x [ init_plot_tables::x#2 init_plot_tables::x#1 ] reg byte x [ init_plot_tables::y#2 init_plot_tables::y#1 ] reg byte a [ init_plot_tables::$0 ] reg byte a [ init_plot_tables::$7 ] reg byte a [ init_plot_tables::$8 ] zp ZP_BYTE:63 [ init_plot_tables::$9 ] zp ZP_BYTE:64 [ init_plot_tables::$10 ] zp ZP_BYTE:60 [ init_plot_tables::$6 ] +Limited combination testing to 1000 combinations of 138240 possible. +Uplifting [init_screen] best 269222 combination zp ZP_WORD:34 [ init_screen::b#2 init_screen::b#1 ] zp ZP_WORD:36 [ init_screen::c#2 init_screen::c#1 ] +Uplifting [line] best 268910 combination reg byte y [ line::y1#0 ] zp ZP_BYTE:40 [ line::y0#0 ] zp ZP_BYTE:39 [ line::x1#0 ] zp ZP_BYTE:38 [ line::x0#0 ] zp ZP_BYTE:43 [ line::yd#1 ] zp ZP_BYTE:44 [ line::yd#0 ] zp ZP_BYTE:46 [ line::yd#3 ] zp ZP_BYTE:47 [ line::yd#10 ] zp ZP_BYTE:42 [ line::xd#1 ] zp ZP_BYTE:45 [ line::xd#0 ] +Limited combination testing to 1000 combinations of 186624 possible. +Uplifting [main] best 268910 combination +Uplifting [] best 268910 combination Attempting to uplift remaining variables inzp ZP_BYTE:8 [ line_ydxi::e#3 line_ydxi::e#0 line_ydxi::e#6 line_ydxi::e#2 line_ydxi::e#1 ] -Uplifting [line_ydxi] best 268850 combination zp ZP_BYTE:8 [ line_ydxi::e#3 line_ydxi::e#0 line_ydxi::e#6 line_ydxi::e#2 line_ydxi::e#1 ] +Uplifting [line_ydxi] best 268910 combination zp ZP_BYTE:8 [ line_ydxi::e#3 line_ydxi::e#0 line_ydxi::e#6 line_ydxi::e#2 line_ydxi::e#1 ] Attempting to uplift remaining variables inzp ZP_BYTE:16 [ line_xdyi::e#3 line_xdyi::e#0 line_xdyi::e#6 line_xdyi::e#2 line_xdyi::e#1 ] -Uplifting [line_xdyi] best 268850 combination zp ZP_BYTE:16 [ line_xdyi::e#3 line_xdyi::e#0 line_xdyi::e#6 line_xdyi::e#2 line_xdyi::e#1 ] +Uplifting [line_xdyi] best 268910 combination zp ZP_BYTE:16 [ line_xdyi::e#3 line_xdyi::e#0 line_xdyi::e#6 line_xdyi::e#2 line_xdyi::e#1 ] Attempting to uplift remaining variables inzp ZP_BYTE:22 [ line_ydxd::e#3 line_ydxd::e#0 line_ydxd::e#6 line_ydxd::e#2 line_ydxd::e#1 ] -Uplifting [line_ydxd] best 268850 combination zp ZP_BYTE:22 [ line_ydxd::e#3 line_ydxd::e#0 line_ydxd::e#6 line_ydxd::e#2 line_ydxd::e#1 ] +Uplifting [line_ydxd] best 268910 combination zp ZP_BYTE:22 [ line_ydxd::e#3 line_ydxd::e#0 line_ydxd::e#6 line_ydxd::e#2 line_ydxd::e#1 ] Attempting to uplift remaining variables inzp ZP_BYTE:28 [ line_xdyd::e#3 line_xdyd::e#0 line_xdyd::e#6 line_xdyd::e#2 line_xdyd::e#1 ] -Uplifting [line_xdyd] best 268850 combination zp ZP_BYTE:28 [ line_xdyd::e#3 line_xdyd::e#0 line_xdyd::e#6 line_xdyd::e#2 line_xdyd::e#1 ] +Uplifting [line_xdyd] best 268910 combination zp ZP_BYTE:28 [ line_xdyd::e#3 line_xdyd::e#0 line_xdyd::e#6 line_xdyd::e#2 line_xdyd::e#1 ] Attempting to uplift remaining variables inzp ZP_BYTE:15 [ line_xdyi::y#3 line_xdyi::y#5 line_xdyi::y#0 line_xdyi::y#1 line_xdyi::y#6 line_xdyi::y#2 ] -Uplifting [line_xdyi] best 268850 combination zp ZP_BYTE:15 [ line_xdyi::y#3 line_xdyi::y#5 line_xdyi::y#0 line_xdyi::y#1 line_xdyi::y#6 line_xdyi::y#2 ] +Uplifting [line_xdyi] best 268910 combination zp ZP_BYTE:15 [ line_xdyi::y#3 line_xdyi::y#5 line_xdyi::y#0 line_xdyi::y#1 line_xdyi::y#6 line_xdyi::y#2 ] Attempting to uplift remaining variables inzp ZP_BYTE:27 [ line_xdyd::y#3 line_xdyd::y#5 line_xdyd::y#0 line_xdyd::y#1 line_xdyd::y#6 line_xdyd::y#2 ] -Uplifting [line_xdyd] best 268850 combination zp ZP_BYTE:27 [ line_xdyd::y#3 line_xdyd::y#5 line_xdyd::y#0 line_xdyd::y#1 line_xdyd::y#6 line_xdyd::y#2 ] +Uplifting [line_xdyd] best 268910 combination zp ZP_BYTE:27 [ line_xdyd::y#3 line_xdyd::y#5 line_xdyd::y#0 line_xdyd::y#1 line_xdyd::y#6 line_xdyd::y#2 ] Attempting to uplift remaining variables inzp ZP_BYTE:56 [ line_xdyi::$6 ] -Uplifting [line_xdyi] best 268850 combination zp ZP_BYTE:56 [ line_xdyi::$6 ] +Uplifting [line_xdyi] best 268910 combination zp ZP_BYTE:56 [ line_xdyi::$6 ] Attempting to uplift remaining variables inzp ZP_BYTE:58 [ line_xdyd::$6 ] -Uplifting [line_xdyd] best 268850 combination zp ZP_BYTE:58 [ line_xdyd::$6 ] +Uplifting [line_xdyd] best 268910 combination zp ZP_BYTE:58 [ line_xdyd::$6 ] Attempting to uplift remaining variables inzp ZP_BYTE:7 [ line_ydxi::y#3 line_ydxi::y#6 line_ydxi::y#1 line_ydxi::y#0 line_ydxi::y#2 ] -Uplifting [line_ydxi] best 268850 combination zp ZP_BYTE:7 [ line_ydxi::y#3 line_ydxi::y#6 line_ydxi::y#1 line_ydxi::y#0 line_ydxi::y#2 ] +Uplifting [line_ydxi] best 268910 combination zp ZP_BYTE:7 [ line_ydxi::y#3 line_ydxi::y#6 line_ydxi::y#1 line_ydxi::y#0 line_ydxi::y#2 ] Attempting to uplift remaining variables inzp ZP_BYTE:21 [ line_ydxd::y#2 line_ydxd::y#7 line_ydxd::y#1 line_ydxd::y#0 line_ydxd::y#3 ] -Uplifting [line_ydxd] best 268850 combination zp ZP_BYTE:21 [ line_ydxd::y#2 line_ydxd::y#7 line_ydxd::y#1 line_ydxd::y#0 line_ydxd::y#3 ] +Uplifting [line_ydxd] best 268910 combination zp ZP_BYTE:21 [ line_ydxd::y#2 line_ydxd::y#7 line_ydxd::y#1 line_ydxd::y#0 line_ydxd::y#3 ] Attempting to uplift remaining variables inzp ZP_BYTE:2 [ lines::l#2 lines::l#1 ] -Uplifting [lines] best 268850 combination zp ZP_BYTE:2 [ lines::l#2 lines::l#1 ] +Uplifting [lines] best 268910 combination zp ZP_BYTE:2 [ lines::l#2 lines::l#1 ] Attempting to uplift remaining variables inzp ZP_BYTE:4 [ line_ydxi::yd#5 line_ydxi::yd#1 line_ydxi::yd#0 ] -Uplifting [line_ydxi] best 268850 combination zp ZP_BYTE:4 [ line_ydxi::yd#5 line_ydxi::yd#1 line_ydxi::yd#0 ] +Uplifting [line_ydxi] best 268910 combination zp ZP_BYTE:4 [ line_ydxi::yd#5 line_ydxi::yd#1 line_ydxi::yd#0 ] Attempting to uplift remaining variables inzp ZP_BYTE:12 [ line_xdyi::xd#5 line_xdyi::xd#0 line_xdyi::xd#1 ] -Uplifting [line_xdyi] best 268850 combination zp ZP_BYTE:12 [ line_xdyi::xd#5 line_xdyi::xd#0 line_xdyi::xd#1 ] +Uplifting [line_xdyi] best 268910 combination zp ZP_BYTE:12 [ line_xdyi::xd#5 line_xdyi::xd#0 line_xdyi::xd#1 ] Attempting to uplift remaining variables inzp ZP_BYTE:18 [ line_ydxd::yd#5 line_ydxd::yd#1 line_ydxd::yd#0 ] -Uplifting [line_ydxd] best 268850 combination zp ZP_BYTE:18 [ line_ydxd::yd#5 line_ydxd::yd#1 line_ydxd::yd#0 ] +Uplifting [line_ydxd] best 268910 combination zp ZP_BYTE:18 [ line_ydxd::yd#5 line_ydxd::yd#1 line_ydxd::yd#0 ] Attempting to uplift remaining variables inzp ZP_BYTE:24 [ line_xdyd::xd#5 line_xdyd::xd#0 line_xdyd::xd#1 ] -Uplifting [line_xdyd] best 268850 combination zp ZP_BYTE:24 [ line_xdyd::xd#5 line_xdyd::xd#0 line_xdyd::xd#1 ] +Uplifting [line_xdyd] best 268910 combination zp ZP_BYTE:24 [ line_xdyd::xd#5 line_xdyd::xd#0 line_xdyd::xd#1 ] Attempting to uplift remaining variables inzp ZP_BYTE:3 [ line_ydxi::xd#2 line_ydxi::xd#1 line_ydxi::xd#0 ] -Uplifting [line_ydxi] best 268850 combination zp ZP_BYTE:3 [ line_ydxi::xd#2 line_ydxi::xd#1 line_ydxi::xd#0 ] +Uplifting [line_ydxi] best 268910 combination zp ZP_BYTE:3 [ line_ydxi::xd#2 line_ydxi::xd#1 line_ydxi::xd#0 ] Attempting to uplift remaining variables inzp ZP_BYTE:11 [ line_xdyi::yd#2 line_xdyi::yd#0 line_xdyi::yd#1 ] -Uplifting [line_xdyi] best 268850 combination zp ZP_BYTE:11 [ line_xdyi::yd#2 line_xdyi::yd#0 line_xdyi::yd#1 ] +Uplifting [line_xdyi] best 268910 combination zp ZP_BYTE:11 [ line_xdyi::yd#2 line_xdyi::yd#0 line_xdyi::yd#1 ] Attempting to uplift remaining variables inzp ZP_BYTE:17 [ line_ydxd::xd#2 line_ydxd::xd#1 line_ydxd::xd#0 ] -Uplifting [line_ydxd] best 268850 combination zp ZP_BYTE:17 [ line_ydxd::xd#2 line_ydxd::xd#1 line_ydxd::xd#0 ] +Uplifting [line_ydxd] best 268910 combination zp ZP_BYTE:17 [ line_ydxd::xd#2 line_ydxd::xd#1 line_ydxd::xd#0 ] Attempting to uplift remaining variables inzp ZP_BYTE:23 [ line_xdyd::yd#2 line_xdyd::yd#0 line_xdyd::yd#1 ] -Uplifting [line_xdyd] best 268850 combination zp ZP_BYTE:23 [ line_xdyd::yd#2 line_xdyd::yd#0 line_xdyd::yd#1 ] +Uplifting [line_xdyd] best 268910 combination zp ZP_BYTE:23 [ line_xdyd::yd#2 line_xdyd::yd#0 line_xdyd::yd#1 ] Attempting to uplift remaining variables inzp ZP_BYTE:5 [ line_ydxi::y1#6 line_ydxi::y1#1 line_ydxi::y1#0 ] -Uplifting [line_ydxi] best 268850 combination zp ZP_BYTE:5 [ line_ydxi::y1#6 line_ydxi::y1#1 line_ydxi::y1#0 ] +Uplifting [line_ydxi] best 268910 combination zp ZP_BYTE:5 [ line_ydxi::y1#6 line_ydxi::y1#1 line_ydxi::y1#0 ] Attempting to uplift remaining variables inzp ZP_BYTE:13 [ line_xdyi::x1#6 line_xdyi::x1#0 line_xdyi::x1#1 ] -Uplifting [line_xdyi] best 268850 combination zp ZP_BYTE:13 [ line_xdyi::x1#6 line_xdyi::x1#0 line_xdyi::x1#1 ] +Uplifting [line_xdyi] best 268910 combination zp ZP_BYTE:13 [ line_xdyi::x1#6 line_xdyi::x1#0 line_xdyi::x1#1 ] Attempting to uplift remaining variables inzp ZP_BYTE:19 [ line_ydxd::y1#6 line_ydxd::y1#1 line_ydxd::y1#0 ] -Uplifting [line_ydxd] best 268850 combination zp ZP_BYTE:19 [ line_ydxd::y1#6 line_ydxd::y1#1 line_ydxd::y1#0 ] +Uplifting [line_ydxd] best 268910 combination zp ZP_BYTE:19 [ line_ydxd::y1#6 line_ydxd::y1#1 line_ydxd::y1#0 ] Attempting to uplift remaining variables inzp ZP_BYTE:25 [ line_xdyd::x1#6 line_xdyd::x1#0 line_xdyd::x1#1 ] -Uplifting [line_xdyd] best 268850 combination zp ZP_BYTE:25 [ line_xdyd::x1#6 line_xdyd::x1#0 line_xdyd::x1#1 ] +Uplifting [line_xdyd] best 268910 combination zp ZP_BYTE:25 [ line_xdyd::x1#6 line_xdyd::x1#0 line_xdyd::x1#1 ] +Attempting to uplift remaining variables inzp ZP_BYTE:63 [ init_plot_tables::$9 ] +Uplifting [init_plot_tables] best 268850 combination reg byte a [ init_plot_tables::$9 ] Attempting to uplift remaining variables inzp ZP_BYTE:64 [ init_plot_tables::$10 ] Uplifting [init_plot_tables] best 268790 combination reg byte a [ init_plot_tables::$10 ] Attempting to uplift remaining variables inzp ZP_BYTE:60 [ init_plot_tables::$6 ] diff --git a/src/test/java/dk/camelot64/kickc/test/ref/bitmap-plotter.log b/src/test/java/dk/camelot64/kickc/test/ref/bitmap-plotter.log index dc9eea742..675013581 100644 --- a/src/test/java/dk/camelot64/kickc/test/ref/bitmap-plotter.log +++ b/src/test/java/dk/camelot64/kickc/test/ref/bitmap-plotter.log @@ -2251,21 +2251,25 @@ Uplift Scope [main] Uplift Scope [] Uplifting [plots] best 8971 combination reg byte x [ plots::i#2 plots::i#1 ] -Uplift attempts [init_plot_tables] 10000/138240 (limiting to 10000) -Uplifting [init_plot_tables] best 8341 combination zp ZP_WORD:6 [ init_plot_tables::yoffs#2 init_plot_tables::yoffs#4 init_plot_tables::yoffs#1 ] reg byte y [ init_plot_tables::bits#3 init_plot_tables::bits#4 init_plot_tables::bits#1 ] reg byte x [ init_plot_tables::x#2 init_plot_tables::x#1 ] reg byte x [ init_plot_tables::y#2 init_plot_tables::y#1 ] reg byte a [ init_plot_tables::$0 ] reg byte a [ init_plot_tables::$7 ] reg byte a [ init_plot_tables::$8 ] reg byte a [ init_plot_tables::$9 ] zp ZP_BYTE:34 [ init_plot_tables::$10 ] zp ZP_BYTE:30 [ init_plot_tables::$6 ] -Limited combination testing to 10000 combinations of 138240 possible. -Uplifting [init_screen] best 8341 combination zp ZP_WORD:8 [ init_screen::b#2 init_screen::b#1 ] zp ZP_WORD:10 [ init_screen::c#2 init_screen::c#1 ] -Uplifting [plot] best 8311 combination zp ZP_BYTE:13 [ plot::y#0 ] zp ZP_BYTE:12 [ plot::x#0 ] reg byte a [ plot::$6 ] reg byte a [ plot::$7 ] reg byte a [ plot::$8 ] reg byte a [ plot::$9 ] zp ZP_WORD:24 [ plot::plotter_y#2 ] reg byte a [ plot::$5 ] zp ZP_WORD:26 [ plot::plotter#0 ] zp ZP_WORD:15 [ plot::plotter_x#1 ] zp ZP_WORD:21 [ plot::plotter_y#1 ] zp ZP_WORD:18 [ plot::plotter_x#2 ] -Uplifting [main] best 8311 combination -Uplifting [] best 8311 combination +Uplifting [init_plot_tables] best 8401 combination zp ZP_WORD:6 [ init_plot_tables::yoffs#2 init_plot_tables::yoffs#4 init_plot_tables::yoffs#1 ] reg byte y [ init_plot_tables::bits#3 init_plot_tables::bits#4 init_plot_tables::bits#1 ] reg byte x [ init_plot_tables::x#2 init_plot_tables::x#1 ] reg byte x [ init_plot_tables::y#2 init_plot_tables::y#1 ] reg byte a [ init_plot_tables::$0 ] reg byte a [ init_plot_tables::$7 ] reg byte a [ init_plot_tables::$8 ] zp ZP_BYTE:33 [ init_plot_tables::$9 ] zp ZP_BYTE:34 [ init_plot_tables::$10 ] zp ZP_BYTE:30 [ init_plot_tables::$6 ] +Limited combination testing to 1000 combinations of 138240 possible. +Uplifting [init_screen] best 8401 combination zp ZP_WORD:8 [ init_screen::b#2 init_screen::b#1 ] zp ZP_WORD:10 [ init_screen::c#2 init_screen::c#1 ] +Uplifting [plot] best 8377 combination zp ZP_BYTE:13 [ plot::y#0 ] zp ZP_BYTE:12 [ plot::x#0 ] reg byte a [ plot::$6 ] reg byte a [ plot::$7 ] reg byte a [ plot::$8 ] reg byte a [ plot::$9 ] zp ZP_WORD:24 [ plot::plotter_y#2 ] zp ZP_BYTE:28 [ plot::$5 ] zp ZP_WORD:26 [ plot::plotter#0 ] zp ZP_WORD:15 [ plot::plotter_x#1 ] zp ZP_WORD:21 [ plot::plotter_y#1 ] zp ZP_WORD:18 [ plot::plotter_x#2 ] +Limited combination testing to 1000 combinations of 9216 possible. +Uplifting [main] best 8377 combination +Uplifting [] best 8377 combination +Attempting to uplift remaining variables inzp ZP_BYTE:33 [ init_plot_tables::$9 ] +Uplifting [init_plot_tables] best 8317 combination reg byte a [ init_plot_tables::$9 ] Attempting to uplift remaining variables inzp ZP_BYTE:34 [ init_plot_tables::$10 ] -Uplifting [init_plot_tables] best 8251 combination reg byte a [ init_plot_tables::$10 ] +Uplifting [init_plot_tables] best 8257 combination reg byte a [ init_plot_tables::$10 ] Attempting to uplift remaining variables inzp ZP_BYTE:13 [ plot::y#0 ] -Uplifting [plot] best 8251 combination zp ZP_BYTE:13 [ plot::y#0 ] +Uplifting [plot] best 8257 combination zp ZP_BYTE:13 [ plot::y#0 ] Attempting to uplift remaining variables inzp ZP_BYTE:30 [ init_plot_tables::$6 ] -Uplifting [init_plot_tables] best 8251 combination zp ZP_BYTE:30 [ init_plot_tables::$6 ] +Uplifting [init_plot_tables] best 8257 combination zp ZP_BYTE:30 [ init_plot_tables::$6 ] Attempting to uplift remaining variables inzp ZP_BYTE:12 [ plot::x#0 ] -Uplifting [plot] best 8251 combination zp ZP_BYTE:12 [ plot::x#0 ] +Uplifting [plot] best 8257 combination zp ZP_BYTE:12 [ plot::x#0 ] +Attempting to uplift remaining variables inzp ZP_BYTE:28 [ plot::$5 ] +Uplifting [plot] best 8251 combination reg byte a [ plot::$5 ] Coalescing zero page register with common assignment [ zp ZP_WORD:15 [ plot::plotter_x#1 ] ] with [ zp ZP_WORD:18 [ plot::plotter_x#2 ] ] - score: 1 Coalescing zero page register with common assignment [ zp ZP_WORD:21 [ plot::plotter_y#1 ] ] with [ zp ZP_WORD:24 [ plot::plotter_y#2 ] ] - score: 1 Coalescing zero page register with common assignment [ zp ZP_WORD:15 [ plot::plotter_x#1 plot::plotter_x#2 ] ] with [ zp ZP_WORD:26 [ plot::plotter#0 ] ] - score: 1 diff --git a/src/test/java/dk/camelot64/kickc/test/ref/c64dtv-gfxmodes.asm b/src/test/java/dk/camelot64/kickc/test/ref/c64dtv-gfxmodes.asm index f86b44274..483188f31 100644 --- a/src/test/java/dk/camelot64/kickc/test/ref/c64dtv-gfxmodes.asm +++ b/src/test/java/dk/camelot64/kickc/test/ref/c64dtv-gfxmodes.asm @@ -596,13 +596,12 @@ mode_twoplanebitmap: { sta DTV_COLOR_BANK_LO lda #>TWOPLANE_COLORS/$400 sta DTV_COLOR_BANK_HI - lda #0 + ldx #0 b1: - tax + txa sta DTV_PALETTE,x - clc - adc #1 - cmp #$10 + inx + cpx #$10 bne b1 lda #0 sta BORDERCOL diff --git a/src/test/java/dk/camelot64/kickc/test/ref/c64dtv-gfxmodes.log b/src/test/java/dk/camelot64/kickc/test/ref/c64dtv-gfxmodes.log index b3a0126cb..9a46c1fb9 100644 --- a/src/test/java/dk/camelot64/kickc/test/ref/c64dtv-gfxmodes.log +++ b/src/test/java/dk/camelot64/kickc/test/ref/c64dtv-gfxmodes.log @@ -11036,78 +11036,88 @@ Uplift Scope [print_ln] Uplift Scope [print_set_screen] Uplift Scope [main] -Uplift attempts [mode_8bpppixelcell] 10000/6291456 (limiting to 10000) -Uplifting [mode_8bpppixelcell] best 1598234 combination reg byte a [ mode_8bpppixelcell::c#2 mode_8bpppixelcell::c#3 ] reg byte a [ mode_8bpppixelcell::$17 ] reg byte x [ mode_8bpppixelcell::cp#2 mode_8bpppixelcell::cp#1 ] zp ZP_BYTE:23 [ mode_8bpppixelcell::bits#2 mode_8bpppixelcell::bits#0 mode_8bpppixelcell::bits#1 ] zp ZP_WORD:24 [ mode_8bpppixelcell::gfxb#2 mode_8bpppixelcell::gfxb#5 mode_8bpppixelcell::gfxb#7 mode_8bpppixelcell::gfxb#1 ] zp ZP_BYTE:26 [ mode_8bpppixelcell::col#2 mode_8bpppixelcell::col#5 mode_8bpppixelcell::col#7 mode_8bpppixelcell::col#1 ] reg byte a [ mode_8bpppixelcell::$11 ] reg byte a [ mode_8bpppixelcell::$13 ] zp ZP_BYTE:86 [ mode_8bpppixelcell::$14 ] reg byte x [ mode_8bpppixelcell::ax#2 mode_8bpppixelcell::ax#1 ] zp ZP_WORD:20 [ mode_8bpppixelcell::chargen#2 mode_8bpppixelcell::chargen#4 mode_8bpppixelcell::chargen#1 ] zp ZP_BYTE:22 [ mode_8bpppixelcell::cr#6 mode_8bpppixelcell::cr#1 ] zp ZP_WORD:17 [ mode_8bpppixelcell::gfxa#2 mode_8bpppixelcell::gfxa#3 mode_8bpppixelcell::gfxa#1 ] zp ZP_BYTE:84 [ mode_8bpppixelcell::$12 ] zp ZP_BYTE:14 [ mode_8bpppixelcell::i#2 mode_8bpppixelcell::i#1 ] zp ZP_BYTE:15 [ mode_8bpppixelcell::ay#4 mode_8bpppixelcell::ay#1 ] zp ZP_BYTE:89 [ mode_8bpppixelcell::$24 ] zp ZP_BYTE:19 [ mode_8bpppixelcell::ch#8 mode_8bpppixelcell::ch#1 ] -Limited combination testing to 10000 combinations of 6291456 possible. -Uplift attempts [mode_twoplanebitmap] 10000/786432 (limiting to 10000) -Uplifting [mode_twoplanebitmap] best 1547234 combination zp ZP_WORD:48 [ mode_twoplanebitmap::gfxa#3 mode_twoplanebitmap::gfxa#6 mode_twoplanebitmap::gfxa#7 mode_twoplanebitmap::gfxa#2 mode_twoplanebitmap::gfxa#1 ] zp ZP_WORD:52 [ mode_twoplanebitmap::gfxb#2 mode_twoplanebitmap::gfxb#3 mode_twoplanebitmap::gfxb#1 ] reg byte x [ mode_twoplanebitmap::bx#2 mode_twoplanebitmap::bx#1 ] reg byte a [ mode_twoplanebitmap::$14 ] reg byte a [ mode_twoplanebitmap::$16 ] reg byte a [ mode_twoplanebitmap::$17 ] reg byte a [ mode_twoplanebitmap::$20 ] reg byte x [ mode_twoplanebitmap::cx#2 mode_twoplanebitmap::cx#1 ] reg byte x [ mode_twoplanebitmap::ax#2 mode_twoplanebitmap::ax#1 ] zp ZP_WORD:45 [ mode_twoplanebitmap::col#2 mode_twoplanebitmap::col#3 mode_twoplanebitmap::col#1 ] zp ZP_BYTE:97 [ mode_twoplanebitmap::$15 ] reg byte a [ mode_twoplanebitmap::i#2 mode_twoplanebitmap::i#1 ] zp ZP_BYTE:43 [ mode_twoplanebitmap::cy#4 mode_twoplanebitmap::cy#1 ] zp ZP_BYTE:47 [ mode_twoplanebitmap::ay#4 mode_twoplanebitmap::ay#1 ] zp ZP_BYTE:102 [ mode_twoplanebitmap::$27 ] zp ZP_BYTE:51 [ mode_twoplanebitmap::by#4 mode_twoplanebitmap::by#1 ] -Limited combination testing to 10000 combinations of 786432 possible. -Uplift attempts [mode_sixsfred] 10000/262144 (limiting to 10000) -Uplifting [mode_sixsfred] best 1496034 combination zp ZP_WORD:39 [ mode_sixsfred::gfxb#2 mode_sixsfred::gfxb#3 mode_sixsfred::gfxb#1 ] reg byte x [ mode_sixsfred::bx#2 mode_sixsfred::bx#1 ] reg byte x [ mode_sixsfred::cx#2 mode_sixsfred::cx#1 ] reg byte a [ mode_sixsfred::$15 ] reg byte a [ mode_sixsfred::$16 ] reg byte a [ mode_sixsfred::$19 ] reg byte a [ mode_sixsfred::row#0 ] reg byte x [ mode_sixsfred::ax#2 mode_sixsfred::ax#1 ] zp ZP_WORD:32 [ mode_sixsfred::col#2 mode_sixsfred::col#3 mode_sixsfred::col#1 ] zp ZP_WORD:35 [ mode_sixsfred::gfxa#2 mode_sixsfred::gfxa#3 mode_sixsfred::gfxa#1 ] reg byte x [ mode_sixsfred::i#2 mode_sixsfred::i#1 ] zp ZP_BYTE:30 [ mode_sixsfred::cy#4 mode_sixsfred::cy#1 ] zp ZP_BYTE:34 [ mode_sixsfred::ay#4 mode_sixsfred::ay#1 ] zp ZP_BYTE:95 [ mode_sixsfred::$25 ] zp ZP_BYTE:38 [ mode_sixsfred::by#4 mode_sixsfred::by#1 ] -Limited combination testing to 10000 combinations of 262144 possible. -Uplifting [mode_8bppchunkybmm] best 1482134 combination reg byte x [ mode_8bppchunkybmm::gfxbCpuBank#4 mode_8bppchunkybmm::gfxbCpuBank#7 mode_8bppchunkybmm::gfxbCpuBank#8 mode_8bppchunkybmm::gfxbCpuBank#2 ] zp ZP_WORD:10 [ mode_8bppchunkybmm::gfxb#4 mode_8bppchunkybmm::gfxb#3 mode_8bppchunkybmm::gfxb#5 mode_8bppchunkybmm::gfxb#1 ] zp ZP_WORD:71 [ mode_8bppchunkybmm::$20 ] reg byte a [ mode_8bppchunkybmm::c#0 ] zp ZP_WORD:7 [ mode_8bppchunkybmm::x#2 mode_8bppchunkybmm::x#1 ] reg byte x [ mode_8bppchunkybmm::i#2 mode_8bppchunkybmm::i#1 ] zp ZP_BYTE:6 [ mode_8bppchunkybmm::y#6 mode_8bppchunkybmm::y#1 ] reg byte a [ mode_8bppchunkybmm::$27 ] -Uplifting [] best 1482134 combination zp ZP_WORD:57 [ print_char_cursor#17 print_char_cursor#19 print_char_cursor#71 print_char_cursor#32 print_char_cursor#1 ] zp ZP_WORD:59 [ print_line_cursor#18 print_line_cursor#17 print_line_cursor#19 ] -Uplifting [dtvSetCpuBankSegment1] best 1481125 combination reg byte a [ dtvSetCpuBankSegment1::cpuBankIdx#3 dtvSetCpuBankSegment1::cpuBankIdx#1 ] -Uplifting [print_str_lines] best 1469125 combination zp ZP_WORD:55 [ print_str_lines::str#3 print_str_lines::str#2 print_str_lines::str#0 ] reg byte a [ print_str_lines::ch#0 ] -Uplift attempts [keyboard_key_pressed] 10000/37748736 (limiting to 10000) -Uplifting [keyboard_key_pressed] best 1464925 combination reg byte a [ keyboard_key_pressed::return#11 ] reg byte a [ keyboard_key_pressed::return#12 ] reg byte a [ keyboard_key_pressed::return#13 ] reg byte a [ keyboard_key_pressed::return#14 ] reg byte a [ keyboard_key_pressed::return#18 ] reg byte a [ keyboard_key_pressed::return#17 ] reg byte a [ keyboard_key_pressed::return#16 ] zp ZP_BYTE:101 [ keyboard_key_pressed::return#15 ] zp ZP_BYTE:81 [ keyboard_key_pressed::return#0 ] zp ZP_BYTE:77 [ keyboard_key_pressed::rowidx#0 ] zp ZP_BYTE:80 [ keyboard_key_pressed::$2 ] zp ZP_BYTE:12 [ keyboard_key_pressed::key#8 ] zp ZP_BYTE:76 [ keyboard_key_pressed::colidx#0 ] -Limited combination testing to 10000 combinations of 37748736 possible. -Uplifting [menu] best 1462125 combination reg byte x [ menu::i#2 menu::i#1 ] zp ZP_WORD:3 [ menu::c#2 menu::c#1 ] reg byte a [ menu::$29 ] reg byte a [ menu::$33 ] reg byte a [ menu::$37 ] reg byte a [ menu::$41 ] -Uplifting [print_cls] best 1462125 combination zp ZP_WORD:61 [ print_cls::sc#2 print_cls::sc#1 ] -Uplifting [keyboard_matrix_read] best 1462107 combination reg byte x [ keyboard_matrix_read::rowid#0 ] reg byte a [ keyboard_matrix_read::return#2 ] reg byte a [ keyboard_matrix_read::return#0 ] -Uplifting [print_ln] best 1462107 combination -Uplifting [print_set_screen] best 1462107 combination -Uplifting [main] best 1462107 combination +Uplifting [mode_8bpppixelcell] best 1608234 combination reg byte a [ mode_8bpppixelcell::c#2 mode_8bpppixelcell::c#3 ] reg byte a [ mode_8bpppixelcell::$17 ] reg byte x [ mode_8bpppixelcell::cp#2 mode_8bpppixelcell::cp#1 ] zp ZP_BYTE:23 [ mode_8bpppixelcell::bits#2 mode_8bpppixelcell::bits#0 mode_8bpppixelcell::bits#1 ] zp ZP_WORD:24 [ mode_8bpppixelcell::gfxb#2 mode_8bpppixelcell::gfxb#5 mode_8bpppixelcell::gfxb#7 mode_8bpppixelcell::gfxb#1 ] zp ZP_BYTE:26 [ mode_8bpppixelcell::col#2 mode_8bpppixelcell::col#5 mode_8bpppixelcell::col#7 mode_8bpppixelcell::col#1 ] reg byte a [ mode_8bpppixelcell::$11 ] reg byte a [ mode_8bpppixelcell::$13 ] zp ZP_BYTE:86 [ mode_8bpppixelcell::$14 ] zp ZP_BYTE:16 [ mode_8bpppixelcell::ax#2 mode_8bpppixelcell::ax#1 ] zp ZP_WORD:20 [ mode_8bpppixelcell::chargen#2 mode_8bpppixelcell::chargen#4 mode_8bpppixelcell::chargen#1 ] zp ZP_BYTE:22 [ mode_8bpppixelcell::cr#6 mode_8bpppixelcell::cr#1 ] zp ZP_WORD:17 [ mode_8bpppixelcell::gfxa#2 mode_8bpppixelcell::gfxa#3 mode_8bpppixelcell::gfxa#1 ] zp ZP_BYTE:84 [ mode_8bpppixelcell::$12 ] zp ZP_BYTE:14 [ mode_8bpppixelcell::i#2 mode_8bpppixelcell::i#1 ] zp ZP_BYTE:15 [ mode_8bpppixelcell::ay#4 mode_8bpppixelcell::ay#1 ] zp ZP_BYTE:89 [ mode_8bpppixelcell::$24 ] zp ZP_BYTE:19 [ mode_8bpppixelcell::ch#8 mode_8bpppixelcell::ch#1 ] +Limited combination testing to 1000 combinations of 6291456 possible. +Uplifting [mode_twoplanebitmap] best 1567234 combination zp ZP_WORD:48 [ mode_twoplanebitmap::gfxa#3 mode_twoplanebitmap::gfxa#6 mode_twoplanebitmap::gfxa#7 mode_twoplanebitmap::gfxa#2 mode_twoplanebitmap::gfxa#1 ] zp ZP_WORD:52 [ mode_twoplanebitmap::gfxb#2 mode_twoplanebitmap::gfxb#3 mode_twoplanebitmap::gfxb#1 ] reg byte x [ mode_twoplanebitmap::bx#2 mode_twoplanebitmap::bx#1 ] reg byte a [ mode_twoplanebitmap::$14 ] reg byte a [ mode_twoplanebitmap::$16 ] reg byte a [ mode_twoplanebitmap::$17 ] reg byte a [ mode_twoplanebitmap::$20 ] reg byte x [ mode_twoplanebitmap::cx#2 mode_twoplanebitmap::cx#1 ] zp ZP_BYTE:50 [ mode_twoplanebitmap::ax#2 mode_twoplanebitmap::ax#1 ] zp ZP_WORD:45 [ mode_twoplanebitmap::col#2 mode_twoplanebitmap::col#3 mode_twoplanebitmap::col#1 ] zp ZP_BYTE:97 [ mode_twoplanebitmap::$15 ] zp ZP_BYTE:42 [ mode_twoplanebitmap::i#2 mode_twoplanebitmap::i#1 ] zp ZP_BYTE:43 [ mode_twoplanebitmap::cy#4 mode_twoplanebitmap::cy#1 ] zp ZP_BYTE:47 [ mode_twoplanebitmap::ay#4 mode_twoplanebitmap::ay#1 ] zp ZP_BYTE:102 [ mode_twoplanebitmap::$27 ] zp ZP_BYTE:51 [ mode_twoplanebitmap::by#4 mode_twoplanebitmap::by#1 ] +Limited combination testing to 1000 combinations of 786432 possible. +Uplifting [mode_sixsfred] best 1526234 combination zp ZP_WORD:39 [ mode_sixsfred::gfxb#2 mode_sixsfred::gfxb#3 mode_sixsfred::gfxb#1 ] reg byte x [ mode_sixsfred::bx#2 mode_sixsfred::bx#1 ] reg byte x [ mode_sixsfred::cx#2 mode_sixsfred::cx#1 ] reg byte a [ mode_sixsfred::$15 ] reg byte a [ mode_sixsfred::$16 ] reg byte a [ mode_sixsfred::$19 ] reg byte a [ mode_sixsfred::row#0 ] zp ZP_BYTE:37 [ mode_sixsfred::ax#2 mode_sixsfred::ax#1 ] zp ZP_WORD:32 [ mode_sixsfred::col#2 mode_sixsfred::col#3 mode_sixsfred::col#1 ] zp ZP_WORD:35 [ mode_sixsfred::gfxa#2 mode_sixsfred::gfxa#3 mode_sixsfred::gfxa#1 ] zp ZP_BYTE:29 [ mode_sixsfred::i#2 mode_sixsfred::i#1 ] zp ZP_BYTE:30 [ mode_sixsfred::cy#4 mode_sixsfred::cy#1 ] zp ZP_BYTE:34 [ mode_sixsfred::ay#4 mode_sixsfred::ay#1 ] zp ZP_BYTE:95 [ mode_sixsfred::$25 ] zp ZP_BYTE:38 [ mode_sixsfred::by#4 mode_sixsfred::by#1 ] +Limited combination testing to 1000 combinations of 262144 possible. +Uplifting [mode_8bppchunkybmm] best 1512334 combination reg byte x [ mode_8bppchunkybmm::gfxbCpuBank#4 mode_8bppchunkybmm::gfxbCpuBank#7 mode_8bppchunkybmm::gfxbCpuBank#8 mode_8bppchunkybmm::gfxbCpuBank#2 ] zp ZP_WORD:10 [ mode_8bppchunkybmm::gfxb#4 mode_8bppchunkybmm::gfxb#3 mode_8bppchunkybmm::gfxb#5 mode_8bppchunkybmm::gfxb#1 ] zp ZP_WORD:71 [ mode_8bppchunkybmm::$20 ] reg byte a [ mode_8bppchunkybmm::c#0 ] zp ZP_WORD:7 [ mode_8bppchunkybmm::x#2 mode_8bppchunkybmm::x#1 ] reg byte x [ mode_8bppchunkybmm::i#2 mode_8bppchunkybmm::i#1 ] zp ZP_BYTE:6 [ mode_8bppchunkybmm::y#6 mode_8bppchunkybmm::y#1 ] reg byte a [ mode_8bppchunkybmm::$27 ] +Uplifting [] best 1512334 combination zp ZP_WORD:57 [ print_char_cursor#17 print_char_cursor#19 print_char_cursor#71 print_char_cursor#32 print_char_cursor#1 ] zp ZP_WORD:59 [ print_line_cursor#18 print_line_cursor#17 print_line_cursor#19 ] +Uplifting [dtvSetCpuBankSegment1] best 1511325 combination reg byte a [ dtvSetCpuBankSegment1::cpuBankIdx#3 dtvSetCpuBankSegment1::cpuBankIdx#1 ] +Uplifting [print_str_lines] best 1499325 combination zp ZP_WORD:55 [ print_str_lines::str#3 print_str_lines::str#2 print_str_lines::str#0 ] reg byte a [ print_str_lines::ch#0 ] +Uplifting [keyboard_key_pressed] best 1496325 combination reg byte a [ keyboard_key_pressed::return#11 ] reg byte a [ keyboard_key_pressed::return#12 ] reg byte a [ keyboard_key_pressed::return#13 ] reg byte a [ keyboard_key_pressed::return#14 ] reg byte a [ keyboard_key_pressed::return#18 ] zp ZP_BYTE:88 [ keyboard_key_pressed::return#17 ] zp ZP_BYTE:94 [ keyboard_key_pressed::return#16 ] zp ZP_BYTE:101 [ keyboard_key_pressed::return#15 ] zp ZP_BYTE:81 [ keyboard_key_pressed::return#0 ] zp ZP_BYTE:77 [ keyboard_key_pressed::rowidx#0 ] zp ZP_BYTE:80 [ keyboard_key_pressed::$2 ] zp ZP_BYTE:12 [ keyboard_key_pressed::key#8 ] zp ZP_BYTE:76 [ keyboard_key_pressed::colidx#0 ] +Limited combination testing to 1000 combinations of 37748736 possible. +Uplifting [menu] best 1493525 combination reg byte x [ menu::i#2 menu::i#1 ] zp ZP_WORD:3 [ menu::c#2 menu::c#1 ] reg byte a [ menu::$29 ] reg byte a [ menu::$33 ] reg byte a [ menu::$37 ] reg byte a [ menu::$41 ] +Uplifting [print_cls] best 1493525 combination zp ZP_WORD:61 [ print_cls::sc#2 print_cls::sc#1 ] +Uplifting [keyboard_matrix_read] best 1493507 combination reg byte x [ keyboard_matrix_read::rowid#0 ] reg byte a [ keyboard_matrix_read::return#2 ] reg byte a [ keyboard_matrix_read::return#0 ] +Uplifting [print_ln] best 1493507 combination +Uplifting [print_set_screen] best 1493507 combination +Uplifting [main] best 1493507 combination Attempting to uplift remaining variables inzp ZP_BYTE:23 [ mode_8bpppixelcell::bits#2 mode_8bpppixelcell::bits#0 mode_8bpppixelcell::bits#1 ] -Uplifting [mode_8bpppixelcell] best 1462107 combination zp ZP_BYTE:23 [ mode_8bpppixelcell::bits#2 mode_8bpppixelcell::bits#0 mode_8bpppixelcell::bits#1 ] +Uplifting [mode_8bpppixelcell] best 1493507 combination zp ZP_BYTE:23 [ mode_8bpppixelcell::bits#2 mode_8bpppixelcell::bits#0 mode_8bpppixelcell::bits#1 ] Attempting to uplift remaining variables inzp ZP_BYTE:26 [ mode_8bpppixelcell::col#2 mode_8bpppixelcell::col#5 mode_8bpppixelcell::col#7 mode_8bpppixelcell::col#1 ] -Uplifting [mode_8bpppixelcell] best 1462107 combination zp ZP_BYTE:26 [ mode_8bpppixelcell::col#2 mode_8bpppixelcell::col#5 mode_8bpppixelcell::col#7 mode_8bpppixelcell::col#1 ] +Uplifting [mode_8bpppixelcell] best 1493507 combination zp ZP_BYTE:26 [ mode_8bpppixelcell::col#2 mode_8bpppixelcell::col#5 mode_8bpppixelcell::col#7 mode_8bpppixelcell::col#1 ] Attempting to uplift remaining variables inzp ZP_BYTE:86 [ mode_8bpppixelcell::$14 ] -Uplifting [mode_8bpppixelcell] best 1456107 combination reg byte a [ mode_8bpppixelcell::$14 ] +Uplifting [mode_8bpppixelcell] best 1487507 combination reg byte a [ mode_8bpppixelcell::$14 ] +Attempting to uplift remaining variables inzp ZP_BYTE:16 [ mode_8bpppixelcell::ax#2 mode_8bpppixelcell::ax#1 ] +Uplifting [mode_8bpppixelcell] best 1477507 combination reg byte x [ mode_8bpppixelcell::ax#2 mode_8bpppixelcell::ax#1 ] +Attempting to uplift remaining variables inzp ZP_BYTE:37 [ mode_sixsfred::ax#2 mode_sixsfred::ax#1 ] +Uplifting [mode_sixsfred] best 1468507 combination reg byte x [ mode_sixsfred::ax#2 mode_sixsfred::ax#1 ] +Attempting to uplift remaining variables inzp ZP_BYTE:50 [ mode_twoplanebitmap::ax#2 mode_twoplanebitmap::ax#1 ] +Uplifting [mode_twoplanebitmap] best 1459507 combination reg byte x [ mode_twoplanebitmap::ax#2 mode_twoplanebitmap::ax#1 ] Attempting to uplift remaining variables inzp ZP_BYTE:22 [ mode_8bpppixelcell::cr#6 mode_8bpppixelcell::cr#1 ] -Uplifting [mode_8bpppixelcell] best 1456107 combination zp ZP_BYTE:22 [ mode_8bpppixelcell::cr#6 mode_8bpppixelcell::cr#1 ] +Uplifting [mode_8bpppixelcell] best 1459507 combination zp ZP_BYTE:22 [ mode_8bpppixelcell::cr#6 mode_8bpppixelcell::cr#1 ] Attempting to uplift remaining variables inzp ZP_BYTE:84 [ mode_8bpppixelcell::$12 ] -Uplifting [mode_8bpppixelcell] best 1456107 combination zp ZP_BYTE:84 [ mode_8bpppixelcell::$12 ] +Uplifting [mode_8bpppixelcell] best 1459507 combination zp ZP_BYTE:84 [ mode_8bpppixelcell::$12 ] Attempting to uplift remaining variables inzp ZP_BYTE:97 [ mode_twoplanebitmap::$15 ] -Uplifting [mode_twoplanebitmap] best 1456107 combination zp ZP_BYTE:97 [ mode_twoplanebitmap::$15 ] +Uplifting [mode_twoplanebitmap] best 1459507 combination zp ZP_BYTE:97 [ mode_twoplanebitmap::$15 ] Attempting to uplift remaining variables inzp ZP_BYTE:14 [ mode_8bpppixelcell::i#2 mode_8bpppixelcell::i#1 ] -Uplifting [mode_8bpppixelcell] best 1454907 combination reg byte x [ mode_8bpppixelcell::i#2 mode_8bpppixelcell::i#1 ] +Uplifting [mode_8bpppixelcell] best 1458307 combination reg byte x [ mode_8bpppixelcell::i#2 mode_8bpppixelcell::i#1 ] +Attempting to uplift remaining variables inzp ZP_BYTE:29 [ mode_sixsfred::i#2 mode_sixsfred::i#1 ] +Uplifting [mode_sixsfred] best 1457107 combination reg byte x [ mode_sixsfred::i#2 mode_sixsfred::i#1 ] +Attempting to uplift remaining variables inzp ZP_BYTE:42 [ mode_twoplanebitmap::i#2 mode_twoplanebitmap::i#1 ] +Uplifting [mode_twoplanebitmap] best 1455907 combination reg byte x [ mode_twoplanebitmap::i#2 mode_twoplanebitmap::i#1 ] Attempting to uplift remaining variables inzp ZP_BYTE:30 [ mode_sixsfred::cy#4 mode_sixsfred::cy#1 ] -Uplifting [mode_sixsfred] best 1454907 combination zp ZP_BYTE:30 [ mode_sixsfred::cy#4 mode_sixsfred::cy#1 ] +Uplifting [mode_sixsfred] best 1455907 combination zp ZP_BYTE:30 [ mode_sixsfred::cy#4 mode_sixsfred::cy#1 ] Attempting to uplift remaining variables inzp ZP_BYTE:34 [ mode_sixsfred::ay#4 mode_sixsfred::ay#1 ] -Uplifting [mode_sixsfred] best 1454907 combination zp ZP_BYTE:34 [ mode_sixsfred::ay#4 mode_sixsfred::ay#1 ] +Uplifting [mode_sixsfred] best 1455907 combination zp ZP_BYTE:34 [ mode_sixsfred::ay#4 mode_sixsfred::ay#1 ] Attempting to uplift remaining variables inzp ZP_BYTE:15 [ mode_8bpppixelcell::ay#4 mode_8bpppixelcell::ay#1 ] -Uplifting [mode_8bpppixelcell] best 1454907 combination zp ZP_BYTE:15 [ mode_8bpppixelcell::ay#4 mode_8bpppixelcell::ay#1 ] +Uplifting [mode_8bpppixelcell] best 1455907 combination zp ZP_BYTE:15 [ mode_8bpppixelcell::ay#4 mode_8bpppixelcell::ay#1 ] Attempting to uplift remaining variables inzp ZP_BYTE:43 [ mode_twoplanebitmap::cy#4 mode_twoplanebitmap::cy#1 ] -Uplifting [mode_twoplanebitmap] best 1454907 combination zp ZP_BYTE:43 [ mode_twoplanebitmap::cy#4 mode_twoplanebitmap::cy#1 ] +Uplifting [mode_twoplanebitmap] best 1455907 combination zp ZP_BYTE:43 [ mode_twoplanebitmap::cy#4 mode_twoplanebitmap::cy#1 ] Attempting to uplift remaining variables inzp ZP_BYTE:47 [ mode_twoplanebitmap::ay#4 mode_twoplanebitmap::ay#1 ] -Uplifting [mode_twoplanebitmap] best 1454907 combination zp ZP_BYTE:47 [ mode_twoplanebitmap::ay#4 mode_twoplanebitmap::ay#1 ] +Uplifting [mode_twoplanebitmap] best 1455907 combination zp ZP_BYTE:47 [ mode_twoplanebitmap::ay#4 mode_twoplanebitmap::ay#1 ] Attempting to uplift remaining variables inzp ZP_BYTE:6 [ mode_8bppchunkybmm::y#6 mode_8bppchunkybmm::y#1 ] -Uplifting [mode_8bppchunkybmm] best 1454907 combination zp ZP_BYTE:6 [ mode_8bppchunkybmm::y#6 mode_8bppchunkybmm::y#1 ] +Uplifting [mode_8bppchunkybmm] best 1455907 combination zp ZP_BYTE:6 [ mode_8bppchunkybmm::y#6 mode_8bppchunkybmm::y#1 ] +Attempting to uplift remaining variables inzp ZP_BYTE:88 [ keyboard_key_pressed::return#17 ] +Uplifting [keyboard_key_pressed] best 1455307 combination reg byte a [ keyboard_key_pressed::return#17 ] Attempting to uplift remaining variables inzp ZP_BYTE:89 [ mode_8bpppixelcell::$24 ] -Uplifting [mode_8bpppixelcell] best 1454507 combination reg byte a [ mode_8bpppixelcell::$24 ] +Uplifting [mode_8bpppixelcell] best 1454907 combination reg byte a [ mode_8bpppixelcell::$24 ] +Attempting to uplift remaining variables inzp ZP_BYTE:94 [ keyboard_key_pressed::return#16 ] +Uplifting [keyboard_key_pressed] best 1454307 combination reg byte a [ keyboard_key_pressed::return#16 ] Attempting to uplift remaining variables inzp ZP_BYTE:95 [ mode_sixsfred::$25 ] -Uplifting [mode_sixsfred] best 1454107 combination reg byte a [ mode_sixsfred::$25 ] +Uplifting [mode_sixsfred] best 1453907 combination reg byte a [ mode_sixsfred::$25 ] Attempting to uplift remaining variables inzp ZP_BYTE:101 [ keyboard_key_pressed::return#15 ] -Uplifting [keyboard_key_pressed] best 1453507 combination reg byte a [ keyboard_key_pressed::return#15 ] +Uplifting [keyboard_key_pressed] best 1453307 combination reg byte a [ keyboard_key_pressed::return#15 ] Attempting to uplift remaining variables inzp ZP_BYTE:102 [ mode_twoplanebitmap::$27 ] -Uplifting [mode_twoplanebitmap] best 1453107 combination reg byte a [ mode_twoplanebitmap::$27 ] +Uplifting [mode_twoplanebitmap] best 1452907 combination reg byte a [ mode_twoplanebitmap::$27 ] Attempting to uplift remaining variables inzp ZP_BYTE:38 [ mode_sixsfred::by#4 mode_sixsfred::by#1 ] -Uplifting [mode_sixsfred] best 1453107 combination zp ZP_BYTE:38 [ mode_sixsfred::by#4 mode_sixsfred::by#1 ] +Uplifting [mode_sixsfred] best 1452907 combination zp ZP_BYTE:38 [ mode_sixsfred::by#4 mode_sixsfred::by#1 ] Attempting to uplift remaining variables inzp ZP_BYTE:51 [ mode_twoplanebitmap::by#4 mode_twoplanebitmap::by#1 ] -Uplifting [mode_twoplanebitmap] best 1453107 combination zp ZP_BYTE:51 [ mode_twoplanebitmap::by#4 mode_twoplanebitmap::by#1 ] +Uplifting [mode_twoplanebitmap] best 1452907 combination zp ZP_BYTE:51 [ mode_twoplanebitmap::by#4 mode_twoplanebitmap::by#1 ] Attempting to uplift remaining variables inzp ZP_BYTE:19 [ mode_8bpppixelcell::ch#8 mode_8bpppixelcell::ch#1 ] -Uplifting [mode_8bpppixelcell] best 1453107 combination zp ZP_BYTE:19 [ mode_8bpppixelcell::ch#8 mode_8bpppixelcell::ch#1 ] +Uplifting [mode_8bpppixelcell] best 1452907 combination zp ZP_BYTE:19 [ mode_8bpppixelcell::ch#8 mode_8bpppixelcell::ch#1 ] Attempting to uplift remaining variables inzp ZP_BYTE:81 [ keyboard_key_pressed::return#0 ] -Uplifting [keyboard_key_pressed] best 1450704 combination reg byte a [ keyboard_key_pressed::return#0 ] +Uplifting [keyboard_key_pressed] best 1450504 combination reg byte a [ keyboard_key_pressed::return#0 ] Attempting to uplift remaining variables inzp ZP_BYTE:77 [ keyboard_key_pressed::rowidx#0 ] -Uplifting [keyboard_key_pressed] best 1450700 combination reg byte a [ keyboard_key_pressed::rowidx#0 ] +Uplifting [keyboard_key_pressed] best 1450500 combination reg byte a [ keyboard_key_pressed::rowidx#0 ] Attempting to uplift remaining variables inzp ZP_BYTE:80 [ keyboard_key_pressed::$2 ] -Uplifting [keyboard_key_pressed] best 1450694 combination reg byte a [ keyboard_key_pressed::$2 ] +Uplifting [keyboard_key_pressed] best 1450494 combination reg byte a [ keyboard_key_pressed::$2 ] Attempting to uplift remaining variables inzp ZP_BYTE:12 [ keyboard_key_pressed::key#8 ] -Uplifting [keyboard_key_pressed] best 1450668 combination reg byte x [ keyboard_key_pressed::key#8 ] +Uplifting [keyboard_key_pressed] best 1450468 combination reg byte x [ keyboard_key_pressed::key#8 ] Attempting to uplift remaining variables inzp ZP_BYTE:76 [ keyboard_key_pressed::colidx#0 ] -Uplifting [keyboard_key_pressed] best 1450664 combination reg byte y [ keyboard_key_pressed::colidx#0 ] +Uplifting [keyboard_key_pressed] best 1450464 combination reg byte y [ keyboard_key_pressed::colidx#0 ] Coalescing zero page register [ zp ZP_WORD:3 [ menu::c#2 menu::c#1 ] ] with [ zp ZP_WORD:7 [ mode_8bppchunkybmm::x#2 mode_8bppchunkybmm::x#1 ] ] Coalescing zero page register [ zp ZP_WORD:3 [ menu::c#2 menu::c#1 mode_8bppchunkybmm::x#2 mode_8bppchunkybmm::x#1 ] ] with [ zp ZP_WORD:17 [ mode_8bpppixelcell::gfxa#2 mode_8bpppixelcell::gfxa#3 mode_8bpppixelcell::gfxa#1 ] ] Coalescing zero page register [ zp ZP_WORD:3 [ menu::c#2 menu::c#1 mode_8bppchunkybmm::x#2 mode_8bppchunkybmm::x#1 mode_8bpppixelcell::gfxa#2 mode_8bpppixelcell::gfxa#3 mode_8bpppixelcell::gfxa#1 ] ] with [ zp ZP_WORD:20 [ mode_8bpppixelcell::chargen#2 mode_8bpppixelcell::chargen#4 mode_8bpppixelcell::chargen#1 ] ] @@ -12441,8 +12451,8 @@ mode_twoplanebitmap: { sta DTV_COLOR_BANK_HI //SEG463 [254] phi from mode_twoplanebitmap to mode_twoplanebitmap::@1 [phi:mode_twoplanebitmap->mode_twoplanebitmap::@1] b1_from_mode_twoplanebitmap: - //SEG464 [254] phi (byte) mode_twoplanebitmap::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:mode_twoplanebitmap->mode_twoplanebitmap::@1#0] -- vbuaa=vbuc1 - lda #0 + //SEG464 [254] phi (byte) mode_twoplanebitmap::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:mode_twoplanebitmap->mode_twoplanebitmap::@1#0] -- vbuxx=vbuc1 + ldx #0 jmp b1 //SEG465 [254] phi from mode_twoplanebitmap::@1 to mode_twoplanebitmap::@1 [phi:mode_twoplanebitmap::@1->mode_twoplanebitmap::@1] b1_from_b1: @@ -12450,14 +12460,13 @@ mode_twoplanebitmap: { jmp b1 //SEG467 mode_twoplanebitmap::@1 b1: - //SEG468 [255] *((const byte*) DTV_PALETTE#0 + (byte) mode_twoplanebitmap::i#2) ← (byte) mode_twoplanebitmap::i#2 [ mode_twoplanebitmap::i#2 ] ( main:2::menu:9::mode_twoplanebitmap:42 [ mode_twoplanebitmap::i#2 ] ) -- pbuc1_derefidx_vbuaa=vbuaa - tax + //SEG468 [255] *((const byte*) DTV_PALETTE#0 + (byte) mode_twoplanebitmap::i#2) ← (byte) mode_twoplanebitmap::i#2 [ mode_twoplanebitmap::i#2 ] ( main:2::menu:9::mode_twoplanebitmap:42 [ mode_twoplanebitmap::i#2 ] ) -- pbuc1_derefidx_vbuxx=vbuxx + txa sta DTV_PALETTE,x - //SEG469 [256] (byte) mode_twoplanebitmap::i#1 ← ++ (byte) mode_twoplanebitmap::i#2 [ mode_twoplanebitmap::i#1 ] ( main:2::menu:9::mode_twoplanebitmap:42 [ mode_twoplanebitmap::i#1 ] ) -- vbuaa=_inc_vbuaa - clc - adc #1 - //SEG470 [257] if((byte) mode_twoplanebitmap::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 16) goto mode_twoplanebitmap::@1 [ mode_twoplanebitmap::i#1 ] ( main:2::menu:9::mode_twoplanebitmap:42 [ mode_twoplanebitmap::i#1 ] ) -- vbuaa_neq_vbuc1_then_la1 - cmp #$10 + //SEG469 [256] (byte) mode_twoplanebitmap::i#1 ← ++ (byte) mode_twoplanebitmap::i#2 [ mode_twoplanebitmap::i#1 ] ( main:2::menu:9::mode_twoplanebitmap:42 [ mode_twoplanebitmap::i#1 ] ) -- vbuxx=_inc_vbuxx + inx + //SEG470 [257] if((byte) mode_twoplanebitmap::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 16) goto mode_twoplanebitmap::@1 [ mode_twoplanebitmap::i#1 ] ( main:2::menu:9::mode_twoplanebitmap:42 [ mode_twoplanebitmap::i#1 ] ) -- vbuxx_neq_vbuc1_then_la1 + cpx #$10 bne b1_from_b1 jmp b14 //SEG471 mode_twoplanebitmap::@14 @@ -13674,8 +13683,8 @@ FINAL SYMBOL TABLE (byte*) mode_twoplanebitmap::gfxb#2 gfxb zp ZP_WORD:2 1552.0 (byte*) mode_twoplanebitmap::gfxb#3 gfxb zp ZP_WORD:2 202.0 (byte) mode_twoplanebitmap::i -(byte) mode_twoplanebitmap::i#1 reg byte a 151.5 -(byte) mode_twoplanebitmap::i#2 reg byte a 202.0 +(byte) mode_twoplanebitmap::i#1 reg byte x 151.5 +(byte) mode_twoplanebitmap::i#2 reg byte x 202.0 (byte*) print_char_cursor (byte*) print_char_cursor#1 print_char_cursor zp ZP_WORD:5 2002.0 (byte*) print_char_cursor#17 print_char_cursor zp ZP_WORD:5 821.0 @@ -13732,7 +13741,7 @@ reg byte x [ mode_sixsfred::i#2 mode_sixsfred::i#1 ] reg byte x [ mode_sixsfred::cx#2 mode_sixsfred::cx#1 ] reg byte x [ mode_sixsfred::ax#2 mode_sixsfred::ax#1 ] reg byte x [ mode_sixsfred::bx#2 mode_sixsfred::bx#1 ] -reg byte a [ mode_twoplanebitmap::i#2 mode_twoplanebitmap::i#1 ] +reg byte x [ mode_twoplanebitmap::i#2 mode_twoplanebitmap::i#1 ] reg byte x [ mode_twoplanebitmap::cx#2 mode_twoplanebitmap::cx#1 ] reg byte x [ mode_twoplanebitmap::ax#2 mode_twoplanebitmap::ax#1 ] reg byte x [ mode_twoplanebitmap::bx#2 mode_twoplanebitmap::bx#1 ] @@ -13777,7 +13786,7 @@ reg byte a [ print_str_lines::ch#0 ] FINAL ASSEMBLER -Score: 1168055 +Score: 1167855 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -14857,20 +14866,19 @@ mode_twoplanebitmap: { lda #>TWOPLANE_COLORS/$400 sta DTV_COLOR_BANK_HI //SEG463 [254] phi from mode_twoplanebitmap to mode_twoplanebitmap::@1 [phi:mode_twoplanebitmap->mode_twoplanebitmap::@1] - //SEG464 [254] phi (byte) mode_twoplanebitmap::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:mode_twoplanebitmap->mode_twoplanebitmap::@1#0] -- vbuaa=vbuc1 - lda #0 + //SEG464 [254] phi (byte) mode_twoplanebitmap::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:mode_twoplanebitmap->mode_twoplanebitmap::@1#0] -- vbuxx=vbuc1 + ldx #0 //SEG465 [254] phi from mode_twoplanebitmap::@1 to mode_twoplanebitmap::@1 [phi:mode_twoplanebitmap::@1->mode_twoplanebitmap::@1] //SEG466 [254] phi (byte) mode_twoplanebitmap::i#2 = (byte) mode_twoplanebitmap::i#1 [phi:mode_twoplanebitmap::@1->mode_twoplanebitmap::@1#0] -- register_copy //SEG467 mode_twoplanebitmap::@1 b1: - //SEG468 [255] *((const byte*) DTV_PALETTE#0 + (byte) mode_twoplanebitmap::i#2) ← (byte) mode_twoplanebitmap::i#2 [ mode_twoplanebitmap::i#2 ] ( main:2::menu:9::mode_twoplanebitmap:42 [ mode_twoplanebitmap::i#2 ] ) -- pbuc1_derefidx_vbuaa=vbuaa - tax + //SEG468 [255] *((const byte*) DTV_PALETTE#0 + (byte) mode_twoplanebitmap::i#2) ← (byte) mode_twoplanebitmap::i#2 [ mode_twoplanebitmap::i#2 ] ( main:2::menu:9::mode_twoplanebitmap:42 [ mode_twoplanebitmap::i#2 ] ) -- pbuc1_derefidx_vbuxx=vbuxx + txa sta DTV_PALETTE,x - //SEG469 [256] (byte) mode_twoplanebitmap::i#1 ← ++ (byte) mode_twoplanebitmap::i#2 [ mode_twoplanebitmap::i#1 ] ( main:2::menu:9::mode_twoplanebitmap:42 [ mode_twoplanebitmap::i#1 ] ) -- vbuaa=_inc_vbuaa - clc - adc #1 - //SEG470 [257] if((byte) mode_twoplanebitmap::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 16) goto mode_twoplanebitmap::@1 [ mode_twoplanebitmap::i#1 ] ( main:2::menu:9::mode_twoplanebitmap:42 [ mode_twoplanebitmap::i#1 ] ) -- vbuaa_neq_vbuc1_then_la1 - cmp #$10 + //SEG469 [256] (byte) mode_twoplanebitmap::i#1 ← ++ (byte) mode_twoplanebitmap::i#2 [ mode_twoplanebitmap::i#1 ] ( main:2::menu:9::mode_twoplanebitmap:42 [ mode_twoplanebitmap::i#1 ] ) -- vbuxx=_inc_vbuxx + inx + //SEG470 [257] if((byte) mode_twoplanebitmap::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 16) goto mode_twoplanebitmap::@1 [ mode_twoplanebitmap::i#1 ] ( main:2::menu:9::mode_twoplanebitmap:42 [ mode_twoplanebitmap::i#1 ] ) -- vbuxx_neq_vbuc1_then_la1 + cpx #$10 bne b1 //SEG471 mode_twoplanebitmap::@14 //SEG472 [258] *((const byte*) BORDERCOL#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( main:2::menu:9::mode_twoplanebitmap:42 [ ] ) -- _deref_pbuc1=vbuc2 diff --git a/src/test/java/dk/camelot64/kickc/test/ref/c64dtv-gfxmodes.sym b/src/test/java/dk/camelot64/kickc/test/ref/c64dtv-gfxmodes.sym index f61fc066e..62945b853 100644 --- a/src/test/java/dk/camelot64/kickc/test/ref/c64dtv-gfxmodes.sym +++ b/src/test/java/dk/camelot64/kickc/test/ref/c64dtv-gfxmodes.sym @@ -418,8 +418,8 @@ (byte*) mode_twoplanebitmap::gfxb#2 gfxb zp ZP_WORD:2 1552.0 (byte*) mode_twoplanebitmap::gfxb#3 gfxb zp ZP_WORD:2 202.0 (byte) mode_twoplanebitmap::i -(byte) mode_twoplanebitmap::i#1 reg byte a 151.5 -(byte) mode_twoplanebitmap::i#2 reg byte a 202.0 +(byte) mode_twoplanebitmap::i#1 reg byte x 151.5 +(byte) mode_twoplanebitmap::i#2 reg byte x 202.0 (byte*) print_char_cursor (byte*) print_char_cursor#1 print_char_cursor zp ZP_WORD:5 2002.0 (byte*) print_char_cursor#17 print_char_cursor zp ZP_WORD:5 821.0 @@ -476,7 +476,7 @@ reg byte x [ mode_sixsfred::i#2 mode_sixsfred::i#1 ] reg byte x [ mode_sixsfred::cx#2 mode_sixsfred::cx#1 ] reg byte x [ mode_sixsfred::ax#2 mode_sixsfred::ax#1 ] reg byte x [ mode_sixsfred::bx#2 mode_sixsfred::bx#1 ] -reg byte a [ mode_twoplanebitmap::i#2 mode_twoplanebitmap::i#1 ] +reg byte x [ mode_twoplanebitmap::i#2 mode_twoplanebitmap::i#1 ] reg byte x [ mode_twoplanebitmap::cx#2 mode_twoplanebitmap::cx#1 ] reg byte x [ mode_twoplanebitmap::ax#2 mode_twoplanebitmap::ax#1 ] reg byte x [ mode_twoplanebitmap::bx#2 mode_twoplanebitmap::bx#1 ] diff --git a/src/test/java/dk/camelot64/kickc/test/ref/chargen-analysis.asm b/src/test/java/dk/camelot64/kickc/test/ref/chargen-analysis.asm index b1d00ca99..46b30b9ff 100644 --- a/src/test/java/dk/camelot64/kickc/test/ref/chargen-analysis.asm +++ b/src/test/java/dk/camelot64/kickc/test/ref/chargen-analysis.asm @@ -127,8 +127,8 @@ main: { lda #0 sta i b2: - ldx i - ldy #0 + ldy i + ldx #0 lda #$20 jsr plot_chargen inc i @@ -192,9 +192,9 @@ main: { b11: cmp #0 beq b12 - ldx cur_pos + ldy cur_pos lda ch - ldy shift + ldx shift jsr plot_chargen b12: inc ch @@ -232,7 +232,7 @@ plot_chargen: { lda chargen+1 adc #>CHARGEN sta chargen+1 - cpy #0 + cpx #0 beq b1 clc lda chargen @@ -244,6 +244,8 @@ plot_chargen: { b1: lda #$32 sta PROCPORT + tya + tax jsr mul8u clc lda sc diff --git a/src/test/java/dk/camelot64/kickc/test/ref/chargen-analysis.log b/src/test/java/dk/camelot64/kickc/test/ref/chargen-analysis.log index 7fa7ccf7e..a0f830689 100644 --- a/src/test/java/dk/camelot64/kickc/test/ref/chargen-analysis.log +++ b/src/test/java/dk/camelot64/kickc/test/ref/chargen-analysis.log @@ -5590,40 +5590,49 @@ Uplift Scope [print_str_at] 35.5: zp ZP_WORD:26 [ print_str_at::str#5 print_str_ Uplift Scope [keyboard_matrix_read] 4: zp ZP_BYTE:56 [ keyboard_matrix_read::rowid#0 ] 4: zp ZP_BYTE:57 [ keyboard_matrix_read::return#2 ] 1.33: zp ZP_BYTE:60 [ keyboard_matrix_read::return#0 ] Uplift Scope [] -Uplifting [plot_chargen] best 814750 combination reg byte a [ plot_chargen::$10 ] reg byte x [ plot_chargen::x#2 plot_chargen::x#1 ] zp ZP_BYTE:15 [ plot_chargen::bits#2 plot_chargen::bits#0 plot_chargen::bits#1 ] zp ZP_WORD:16 [ plot_chargen::sc#3 plot_chargen::sc#7 plot_chargen::sc#2 plot_chargen::sc#0 plot_chargen::sc#1 ] reg byte a [ plot_chargen::c#2 ] zp ZP_BYTE:14 [ plot_chargen::y#2 plot_chargen::y#1 ] reg byte y [ plot_chargen::shift#2 plot_chargen::shift#1 ] reg byte a [ plot_chargen::ch#2 plot_chargen::ch#1 ] reg byte x [ plot_chargen::pos#2 plot_chargen::pos#0 plot_chargen::pos#1 ] zp ZP_WORD:12 [ plot_chargen::chargen#5 plot_chargen::chargen#0 plot_chargen::chargen#1 ] zp ZP_WORD:44 [ plot_chargen::$0 ] zp ZP_WORD:46 [ plot_chargen::$1 ] zp ZP_WORD:50 [ plot_chargen::$8 ] -Uplifting [mul8u] best 809747 combination zp ZP_WORD:21 [ mul8u::res#2 mul8u::res#6 mul8u::res#1 ] zp ZP_WORD:23 [ mul8u::mb#2 mul8u::mb#1 ] reg byte a [ mul8u::$1 ] reg byte x [ mul8u::a#2 mul8u::a#1 mul8u::a#0 ] zp ZP_WORD:48 [ mul8u::return#2 ] -Uplift attempts [main] 10000/262144 (limiting to 10000) -Uplifting [main] best 807987 combination reg byte a [ main::pressed#2 main::pressed#1 ] zp ZP_BYTE:7 [ main::ch#2 main::ch#1 ] reg byte a [ main::key#0 ] zp ZP_WORD:2 [ main::sc#2 main::sc#1 ] zp ZP_BYTE:4 [ main::i#2 main::i#1 ] reg byte a [ main::$15 ] reg byte a [ main::$18 ] reg byte a [ main::$21 ] reg byte a [ main::$24 ] zp ZP_BYTE:39 [ main::$27 ] zp ZP_BYTE:5 [ main::cur_pos#18 main::cur_pos#20 main::cur_pos#22 main::cur_pos#24 main::cur_pos#12 ] zp ZP_BYTE:6 [ main::shift#10 ] -Limited combination testing to 10000 combinations of 262144 possible. -Uplift attempts [keyboard_key_pressed] 10000/2359296 (limiting to 10000) -Uplifting [keyboard_key_pressed] best 806970 combination reg byte x [ keyboard_key_pressed::key#6 keyboard_key_pressed::key#5 ] reg byte a [ keyboard_key_pressed::return#14 ] reg byte a [ keyboard_key_pressed::return#2 ] reg byte a [ keyboard_key_pressed::return#10 ] reg byte a [ keyboard_key_pressed::return#11 ] reg byte a [ keyboard_key_pressed::return#12 ] reg byte a [ keyboard_key_pressed::return#13 ] zp ZP_BYTE:59 [ keyboard_key_pressed::return#0 ] zp ZP_BYTE:55 [ keyboard_key_pressed::rowidx#0 ] zp ZP_BYTE:58 [ keyboard_key_pressed::$2 ] zp ZP_BYTE:54 [ keyboard_key_pressed::colidx#0 ] -Limited combination testing to 10000 combinations of 2359296 possible. -Uplifting [keyboard_get_keycode] best 805764 combination reg byte a [ keyboard_get_keycode::return#2 ] reg byte x [ keyboard_get_keycode::ch#0 ] reg byte a [ keyboard_get_keycode::return#0 ] -Uplifting [print_str_at] best 805764 combination zp ZP_WORD:26 [ print_str_at::str#5 print_str_at::str#7 print_str_at::str#4 ] zp ZP_WORD:28 [ print_str_at::at#5 print_str_at::at#7 print_str_at::at#4 ] -Uplifting [keyboard_matrix_read] best 805746 combination reg byte x [ keyboard_matrix_read::rowid#0 ] reg byte a [ keyboard_matrix_read::return#2 ] reg byte a [ keyboard_matrix_read::return#0 ] -Uplifting [] best 805746 combination +Uplifting [plot_chargen] best 815083 combination reg byte a [ plot_chargen::$10 ] reg byte x [ plot_chargen::x#2 plot_chargen::x#1 ] zp ZP_BYTE:15 [ plot_chargen::bits#2 plot_chargen::bits#0 plot_chargen::bits#1 ] zp ZP_WORD:16 [ plot_chargen::sc#3 plot_chargen::sc#7 plot_chargen::sc#2 plot_chargen::sc#0 plot_chargen::sc#1 ] reg byte a [ plot_chargen::c#2 ] zp ZP_BYTE:14 [ plot_chargen::y#2 plot_chargen::y#1 ] reg byte x [ plot_chargen::shift#2 plot_chargen::shift#1 ] reg byte a [ plot_chargen::ch#2 plot_chargen::ch#1 ] zp ZP_BYTE:11 [ plot_chargen::pos#2 plot_chargen::pos#0 plot_chargen::pos#1 ] zp ZP_WORD:12 [ plot_chargen::chargen#5 plot_chargen::chargen#0 plot_chargen::chargen#1 ] zp ZP_WORD:44 [ plot_chargen::$0 ] zp ZP_WORD:46 [ plot_chargen::$1 ] zp ZP_WORD:50 [ plot_chargen::$8 ] +Limited combination testing to 1000 combinations of 4608 possible. +Uplifting [mul8u] best 810080 combination zp ZP_WORD:21 [ mul8u::res#2 mul8u::res#6 mul8u::res#1 ] zp ZP_WORD:23 [ mul8u::mb#2 mul8u::mb#1 ] reg byte a [ mul8u::$1 ] reg byte x [ mul8u::a#2 mul8u::a#1 mul8u::a#0 ] zp ZP_WORD:48 [ mul8u::return#2 ] +Uplifting [main] best 808400 combination reg byte a [ main::pressed#2 main::pressed#1 ] zp ZP_BYTE:7 [ main::ch#2 main::ch#1 ] reg byte a [ main::key#0 ] zp ZP_WORD:2 [ main::sc#2 main::sc#1 ] zp ZP_BYTE:4 [ main::i#2 main::i#1 ] reg byte a [ main::$15 ] reg byte a [ main::$18 ] zp ZP_BYTE:35 [ main::$21 ] zp ZP_BYTE:37 [ main::$24 ] zp ZP_BYTE:39 [ main::$27 ] zp ZP_BYTE:5 [ main::cur_pos#18 main::cur_pos#20 main::cur_pos#22 main::cur_pos#24 main::cur_pos#12 ] zp ZP_BYTE:6 [ main::shift#10 ] +Limited combination testing to 1000 combinations of 262144 possible. +Uplifting [keyboard_key_pressed] best 807503 combination reg byte x [ keyboard_key_pressed::key#6 keyboard_key_pressed::key#5 ] reg byte a [ keyboard_key_pressed::return#14 ] reg byte a [ keyboard_key_pressed::return#2 ] reg byte a [ keyboard_key_pressed::return#10 ] reg byte a [ keyboard_key_pressed::return#11 ] zp ZP_BYTE:36 [ keyboard_key_pressed::return#12 ] zp ZP_BYTE:38 [ keyboard_key_pressed::return#13 ] zp ZP_BYTE:59 [ keyboard_key_pressed::return#0 ] zp ZP_BYTE:55 [ keyboard_key_pressed::rowidx#0 ] zp ZP_BYTE:58 [ keyboard_key_pressed::$2 ] zp ZP_BYTE:54 [ keyboard_key_pressed::colidx#0 ] +Limited combination testing to 1000 combinations of 2359296 possible. +Uplifting [keyboard_get_keycode] best 806297 combination reg byte a [ keyboard_get_keycode::return#2 ] reg byte x [ keyboard_get_keycode::ch#0 ] reg byte a [ keyboard_get_keycode::return#0 ] +Uplifting [print_str_at] best 806297 combination zp ZP_WORD:26 [ print_str_at::str#5 print_str_at::str#7 print_str_at::str#4 ] zp ZP_WORD:28 [ print_str_at::at#5 print_str_at::at#7 print_str_at::at#4 ] +Uplifting [keyboard_matrix_read] best 806279 combination reg byte x [ keyboard_matrix_read::rowid#0 ] reg byte a [ keyboard_matrix_read::return#2 ] reg byte a [ keyboard_matrix_read::return#0 ] +Uplifting [] best 806279 combination Attempting to uplift remaining variables inzp ZP_BYTE:15 [ plot_chargen::bits#2 plot_chargen::bits#0 plot_chargen::bits#1 ] -Uplifting [plot_chargen] best 805746 combination zp ZP_BYTE:15 [ plot_chargen::bits#2 plot_chargen::bits#0 plot_chargen::bits#1 ] +Uplifting [plot_chargen] best 806279 combination zp ZP_BYTE:15 [ plot_chargen::bits#2 plot_chargen::bits#0 plot_chargen::bits#1 ] Attempting to uplift remaining variables inzp ZP_BYTE:14 [ plot_chargen::y#2 plot_chargen::y#1 ] -Uplifting [plot_chargen] best 805746 combination zp ZP_BYTE:14 [ plot_chargen::y#2 plot_chargen::y#1 ] +Uplifting [plot_chargen] best 806279 combination zp ZP_BYTE:14 [ plot_chargen::y#2 plot_chargen::y#1 ] Attempting to uplift remaining variables inzp ZP_BYTE:7 [ main::ch#2 main::ch#1 ] -Uplifting [main] best 805746 combination zp ZP_BYTE:7 [ main::ch#2 main::ch#1 ] +Uplifting [main] best 806279 combination zp ZP_BYTE:7 [ main::ch#2 main::ch#1 ] +Attempting to uplift remaining variables inzp ZP_BYTE:11 [ plot_chargen::pos#2 plot_chargen::pos#0 plot_chargen::pos#1 ] +Uplifting [plot_chargen] best 805950 combination reg byte y [ plot_chargen::pos#2 plot_chargen::pos#0 plot_chargen::pos#1 ] Attempting to uplift remaining variables inzp ZP_BYTE:4 [ main::i#2 main::i#1 ] -Uplifting [main] best 805746 combination zp ZP_BYTE:4 [ main::i#2 main::i#1 ] +Uplifting [main] best 805950 combination zp ZP_BYTE:4 [ main::i#2 main::i#1 ] +Attempting to uplift remaining variables inzp ZP_BYTE:35 [ main::$21 ] +Uplifting [main] best 805910 combination reg byte a [ main::$21 ] +Attempting to uplift remaining variables inzp ZP_BYTE:36 [ keyboard_key_pressed::return#12 ] +Uplifting [keyboard_key_pressed] best 805850 combination reg byte a [ keyboard_key_pressed::return#12 ] +Attempting to uplift remaining variables inzp ZP_BYTE:37 [ main::$24 ] +Uplifting [main] best 805810 combination reg byte a [ main::$24 ] +Attempting to uplift remaining variables inzp ZP_BYTE:38 [ keyboard_key_pressed::return#13 ] +Uplifting [keyboard_key_pressed] best 805750 combination reg byte a [ keyboard_key_pressed::return#13 ] Attempting to uplift remaining variables inzp ZP_BYTE:39 [ main::$27 ] -Uplifting [main] best 805706 combination reg byte a [ main::$27 ] +Uplifting [main] best 805710 combination reg byte a [ main::$27 ] Attempting to uplift remaining variables inzp ZP_BYTE:59 [ keyboard_key_pressed::return#0 ] -Uplifting [keyboard_key_pressed] best 805253 combination reg byte a [ keyboard_key_pressed::return#0 ] +Uplifting [keyboard_key_pressed] best 805257 combination reg byte a [ keyboard_key_pressed::return#0 ] Attempting to uplift remaining variables inzp ZP_BYTE:5 [ main::cur_pos#18 main::cur_pos#20 main::cur_pos#22 main::cur_pos#24 main::cur_pos#12 ] -Uplifting [main] best 805253 combination zp ZP_BYTE:5 [ main::cur_pos#18 main::cur_pos#20 main::cur_pos#22 main::cur_pos#24 main::cur_pos#12 ] +Uplifting [main] best 805257 combination zp ZP_BYTE:5 [ main::cur_pos#18 main::cur_pos#20 main::cur_pos#22 main::cur_pos#24 main::cur_pos#12 ] Attempting to uplift remaining variables inzp ZP_BYTE:6 [ main::shift#10 ] -Uplifting [main] best 805253 combination zp ZP_BYTE:6 [ main::shift#10 ] +Uplifting [main] best 805257 combination zp ZP_BYTE:6 [ main::shift#10 ] Attempting to uplift remaining variables inzp ZP_BYTE:55 [ keyboard_key_pressed::rowidx#0 ] -Uplifting [keyboard_key_pressed] best 805249 combination reg byte a [ keyboard_key_pressed::rowidx#0 ] +Uplifting [keyboard_key_pressed] best 805253 combination reg byte a [ keyboard_key_pressed::rowidx#0 ] Attempting to uplift remaining variables inzp ZP_BYTE:58 [ keyboard_key_pressed::$2 ] -Uplifting [keyboard_key_pressed] best 805243 combination reg byte a [ keyboard_key_pressed::$2 ] +Uplifting [keyboard_key_pressed] best 805247 combination reg byte a [ keyboard_key_pressed::$2 ] Attempting to uplift remaining variables inzp ZP_BYTE:54 [ keyboard_key_pressed::colidx#0 ] -Uplifting [keyboard_key_pressed] best 805239 combination reg byte y [ keyboard_key_pressed::colidx#0 ] +Uplifting [keyboard_key_pressed] best 805243 combination reg byte y [ keyboard_key_pressed::colidx#0 ] Coalescing zero page register with common assignment [ zp ZP_WORD:12 [ plot_chargen::chargen#5 plot_chargen::chargen#0 plot_chargen::chargen#1 ] ] with [ zp ZP_WORD:46 [ plot_chargen::$1 ] ] - score: 1 Coalescing zero page register with common assignment [ zp ZP_WORD:16 [ plot_chargen::sc#3 plot_chargen::sc#7 plot_chargen::sc#2 plot_chargen::sc#0 plot_chargen::sc#1 ] ] with [ zp ZP_WORD:50 [ plot_chargen::$8 ] ] - score: 1 Coalescing zero page register with common assignment [ zp ZP_WORD:21 [ mul8u::res#2 mul8u::res#6 mul8u::res#1 ] ] with [ zp ZP_WORD:48 [ mul8u::return#2 ] ] - score: 1 @@ -5849,14 +5858,14 @@ main: { jmp b2 //SEG46 main::@2 b2: - //SEG47 [18] (byte) plot_chargen::pos#0 ← (byte) main::i#2 [ main::i#2 plot_chargen::pos#0 ] ( main:2 [ main::i#2 plot_chargen::pos#0 ] ) -- vbuxx=vbuz1 - ldx i + //SEG47 [18] (byte) plot_chargen::pos#0 ← (byte) main::i#2 [ main::i#2 plot_chargen::pos#0 ] ( main:2 [ main::i#2 plot_chargen::pos#0 ] ) -- vbuyy=vbuz1 + ldy i //SEG48 [19] call plot_chargen param-assignment [ main::i#2 ] ( main:2 [ main::i#2 ] ) //SEG49 [73] phi from main::@2 to plot_chargen [phi:main::@2->plot_chargen] plot_chargen_from_b2: //SEG50 [73] phi (byte) plot_chargen::pos#2 = (byte) plot_chargen::pos#0 [phi:main::@2->plot_chargen#0] -- register_copy - //SEG51 [73] phi (byte) plot_chargen::shift#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@2->plot_chargen#1] -- vbuyy=vbuc1 - ldy #0 + //SEG51 [73] phi (byte) plot_chargen::shift#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@2->plot_chargen#1] -- vbuxx=vbuc1 + ldx #0 //SEG52 [73] phi (byte) plot_chargen::ch#2 = (byte/signed byte/word/signed word/dword/signed dword) 32 [phi:main::@2->plot_chargen#2] -- vbuaa=vbuc1 lda #$20 jsr plot_chargen @@ -6072,12 +6081,12 @@ main: { jmp b22 //SEG140 main::@22 b22: - //SEG141 [61] (byte) plot_chargen::pos#1 ← (byte) main::cur_pos#12 [ main::cur_pos#12 main::shift#10 main::ch#2 plot_chargen::pos#1 ] ( main:2 [ main::cur_pos#12 main::shift#10 main::ch#2 plot_chargen::pos#1 ] ) -- vbuxx=vbuz1 - ldx cur_pos + //SEG141 [61] (byte) plot_chargen::pos#1 ← (byte) main::cur_pos#12 [ main::cur_pos#12 main::shift#10 main::ch#2 plot_chargen::pos#1 ] ( main:2 [ main::cur_pos#12 main::shift#10 main::ch#2 plot_chargen::pos#1 ] ) -- vbuyy=vbuz1 + ldy cur_pos //SEG142 [62] (byte) plot_chargen::ch#1 ← (byte) main::ch#2 [ main::cur_pos#12 main::shift#10 main::ch#2 plot_chargen::pos#1 plot_chargen::ch#1 ] ( main:2 [ main::cur_pos#12 main::shift#10 main::ch#2 plot_chargen::pos#1 plot_chargen::ch#1 ] ) -- vbuaa=vbuz1 lda ch - //SEG143 [63] (byte) plot_chargen::shift#1 ← (byte) main::shift#10 [ main::cur_pos#12 main::shift#10 main::ch#2 plot_chargen::pos#1 plot_chargen::ch#1 plot_chargen::shift#1 ] ( main:2 [ main::cur_pos#12 main::shift#10 main::ch#2 plot_chargen::pos#1 plot_chargen::ch#1 plot_chargen::shift#1 ] ) -- vbuyy=vbuz1 - ldy shift + //SEG143 [63] (byte) plot_chargen::shift#1 ← (byte) main::shift#10 [ main::cur_pos#12 main::shift#10 main::ch#2 plot_chargen::pos#1 plot_chargen::ch#1 plot_chargen::shift#1 ] ( main:2 [ main::cur_pos#12 main::shift#10 main::ch#2 plot_chargen::pos#1 plot_chargen::ch#1 plot_chargen::shift#1 ] ) -- vbuxx=vbuz1 + ldx shift //SEG144 [64] call plot_chargen param-assignment [ main::cur_pos#12 main::shift#10 main::ch#2 ] ( main:2 [ main::cur_pos#12 main::shift#10 main::ch#2 ] ) //SEG145 [73] phi from main::@22 to plot_chargen [phi:main::@22->plot_chargen] plot_chargen_from_b22: @@ -6175,8 +6184,8 @@ plot_chargen: { lda chargen+1 adc #>CHARGEN sta chargen+1 - //SEG177 [78] if((byte) plot_chargen::shift#2==(byte/signed byte/word/signed word/dword/signed dword) 0) goto plot_chargen::@1 [ plot_chargen::pos#2 plot_chargen::chargen#0 ] ( main:2::plot_chargen:19 [ main::i#2 plot_chargen::pos#2 plot_chargen::chargen#0 ] main:2::plot_chargen:64 [ main::cur_pos#12 main::shift#10 main::ch#2 plot_chargen::pos#2 plot_chargen::chargen#0 ] ) -- vbuyy_eq_0_then_la1 - cpy #0 + //SEG177 [78] if((byte) plot_chargen::shift#2==(byte/signed byte/word/signed word/dword/signed dword) 0) goto plot_chargen::@1 [ plot_chargen::pos#2 plot_chargen::chargen#0 ] ( main:2::plot_chargen:19 [ main::i#2 plot_chargen::pos#2 plot_chargen::chargen#0 ] main:2::plot_chargen:64 [ main::cur_pos#12 main::shift#10 main::ch#2 plot_chargen::pos#2 plot_chargen::chargen#0 ] ) -- vbuxx_eq_0_then_la1 + cpx #0 beq b1_from_plot_chargen jmp b5 //SEG178 plot_chargen::@5 @@ -6199,8 +6208,9 @@ plot_chargen: { //SEG183 [81] *((const byte*) PROCPORT#0) ← (byte/signed byte/word/signed word/dword/signed dword) 50 [ plot_chargen::pos#2 plot_chargen::chargen#5 ] ( main:2::plot_chargen:19 [ main::i#2 plot_chargen::pos#2 plot_chargen::chargen#5 ] main:2::plot_chargen:64 [ main::cur_pos#12 main::shift#10 main::ch#2 plot_chargen::pos#2 plot_chargen::chargen#5 ] ) -- _deref_pbuc1=vbuc2 lda #$32 sta PROCPORT - //SEG184 [82] (byte) mul8u::a#1 ← (byte) plot_chargen::pos#2 [ plot_chargen::chargen#5 mul8u::a#1 ] ( main:2::plot_chargen:19 [ main::i#2 plot_chargen::chargen#5 mul8u::a#1 ] main:2::plot_chargen:64 [ main::cur_pos#12 main::shift#10 main::ch#2 plot_chargen::chargen#5 mul8u::a#1 ] ) - // (byte) mul8u::a#1 = (byte) plot_chargen::pos#2 // register copy reg byte x + //SEG184 [82] (byte) mul8u::a#1 ← (byte) plot_chargen::pos#2 [ plot_chargen::chargen#5 mul8u::a#1 ] ( main:2::plot_chargen:19 [ main::i#2 plot_chargen::chargen#5 mul8u::a#1 ] main:2::plot_chargen:64 [ main::cur_pos#12 main::shift#10 main::ch#2 plot_chargen::chargen#5 mul8u::a#1 ] ) -- vbuxx=vbuyy + tya + tax //SEG185 [83] call mul8u param-assignment [ plot_chargen::chargen#5 mul8u::res#2 ] ( main:2::plot_chargen:19 [ main::i#2 plot_chargen::chargen#5 mul8u::res#2 ] main:2::plot_chargen:64 [ main::cur_pos#12 main::shift#10 main::ch#2 plot_chargen::chargen#5 mul8u::res#2 ] ) //SEG186 [105] phi from plot_chargen::@1 to mul8u [phi:plot_chargen::@1->mul8u] mul8u_from_b1: @@ -6964,9 +6974,9 @@ FINAL SYMBOL TABLE (byte*) plot_chargen::chargen#1 chargen zp ZP_WORD:2 4.0 (byte*) plot_chargen::chargen#5 chargen zp ZP_WORD:2 45.68181818181818 (byte) plot_chargen::pos -(byte) plot_chargen::pos#0 reg byte x 22.0 -(byte) plot_chargen::pos#1 reg byte x 67.33333333333333 -(byte) plot_chargen::pos#2 reg byte x 12.666666666666664 +(byte) plot_chargen::pos#0 reg byte y 22.0 +(byte) plot_chargen::pos#1 reg byte y 67.33333333333333 +(byte) plot_chargen::pos#2 reg byte y 12.666666666666664 (byte*) plot_chargen::sc (byte*) plot_chargen::sc#0 sc zp ZP_WORD:9 4.0 (byte*) plot_chargen::sc#1 sc zp ZP_WORD:9 5250.75 @@ -6974,8 +6984,8 @@ FINAL SYMBOL TABLE (byte*) plot_chargen::sc#3 sc zp ZP_WORD:9 5167.333333333333 (byte*) plot_chargen::sc#7 sc zp ZP_WORD:9 1002.0 (byte) plot_chargen::shift -(byte) plot_chargen::shift#1 reg byte y 202.0 -(byte) plot_chargen::shift#2 reg byte y 20.599999999999998 +(byte) plot_chargen::shift#1 reg byte x 202.0 +(byte) plot_chargen::shift#2 reg byte x 20.599999999999998 (byte) plot_chargen::x (byte) plot_chargen::x#1 reg byte x 15001.5 (byte) plot_chargen::x#2 reg byte x 2500.25 @@ -7001,8 +7011,8 @@ zp ZP_BYTE:5 [ main::shift#10 ] zp ZP_BYTE:6 [ main::ch#2 main::ch#1 ] reg byte a [ main::pressed#2 main::pressed#1 ] reg byte a [ plot_chargen::ch#2 plot_chargen::ch#1 ] -reg byte y [ plot_chargen::shift#2 plot_chargen::shift#1 ] -reg byte x [ plot_chargen::pos#2 plot_chargen::pos#0 plot_chargen::pos#1 ] +reg byte x [ plot_chargen::shift#2 plot_chargen::shift#1 ] +reg byte y [ plot_chargen::pos#2 plot_chargen::pos#0 plot_chargen::pos#1 ] zp ZP_BYTE:7 [ plot_chargen::y#2 plot_chargen::y#1 ] zp ZP_BYTE:8 [ plot_chargen::bits#2 plot_chargen::bits#0 plot_chargen::bits#1 ] zp ZP_WORD:9 [ plot_chargen::sc#3 plot_chargen::sc#7 plot_chargen::sc#2 plot_chargen::sc#0 plot_chargen::sc#1 plot_chargen::$8 mul8u::res#2 mul8u::res#6 mul8u::res#1 mul8u::return#2 print_str_at::at#5 print_str_at::at#7 print_str_at::at#4 ] @@ -7038,7 +7048,7 @@ reg byte a [ keyboard_get_keycode::return#0 ] FINAL ASSEMBLER -Score: 628895 +Score: 628899 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -7216,13 +7226,13 @@ main: { //SEG45 [17] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@29->main::@2#0] -- register_copy //SEG46 main::@2 b2: - //SEG47 [18] (byte) plot_chargen::pos#0 ← (byte) main::i#2 [ main::i#2 plot_chargen::pos#0 ] ( main:2 [ main::i#2 plot_chargen::pos#0 ] ) -- vbuxx=vbuz1 - ldx i + //SEG47 [18] (byte) plot_chargen::pos#0 ← (byte) main::i#2 [ main::i#2 plot_chargen::pos#0 ] ( main:2 [ main::i#2 plot_chargen::pos#0 ] ) -- vbuyy=vbuz1 + ldy i //SEG48 [19] call plot_chargen param-assignment [ main::i#2 ] ( main:2 [ main::i#2 ] ) //SEG49 [73] phi from main::@2 to plot_chargen [phi:main::@2->plot_chargen] //SEG50 [73] phi (byte) plot_chargen::pos#2 = (byte) plot_chargen::pos#0 [phi:main::@2->plot_chargen#0] -- register_copy - //SEG51 [73] phi (byte) plot_chargen::shift#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@2->plot_chargen#1] -- vbuyy=vbuc1 - ldy #0 + //SEG51 [73] phi (byte) plot_chargen::shift#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@2->plot_chargen#1] -- vbuxx=vbuc1 + ldx #0 //SEG52 [73] phi (byte) plot_chargen::ch#2 = (byte/signed byte/word/signed word/dword/signed dword) 32 [phi:main::@2->plot_chargen#2] -- vbuaa=vbuc1 lda #$20 jsr plot_chargen @@ -7389,12 +7399,12 @@ main: { cmp #0 beq b12 //SEG140 main::@22 - //SEG141 [61] (byte) plot_chargen::pos#1 ← (byte) main::cur_pos#12 [ main::cur_pos#12 main::shift#10 main::ch#2 plot_chargen::pos#1 ] ( main:2 [ main::cur_pos#12 main::shift#10 main::ch#2 plot_chargen::pos#1 ] ) -- vbuxx=vbuz1 - ldx cur_pos + //SEG141 [61] (byte) plot_chargen::pos#1 ← (byte) main::cur_pos#12 [ main::cur_pos#12 main::shift#10 main::ch#2 plot_chargen::pos#1 ] ( main:2 [ main::cur_pos#12 main::shift#10 main::ch#2 plot_chargen::pos#1 ] ) -- vbuyy=vbuz1 + ldy cur_pos //SEG142 [62] (byte) plot_chargen::ch#1 ← (byte) main::ch#2 [ main::cur_pos#12 main::shift#10 main::ch#2 plot_chargen::pos#1 plot_chargen::ch#1 ] ( main:2 [ main::cur_pos#12 main::shift#10 main::ch#2 plot_chargen::pos#1 plot_chargen::ch#1 ] ) -- vbuaa=vbuz1 lda ch - //SEG143 [63] (byte) plot_chargen::shift#1 ← (byte) main::shift#10 [ main::cur_pos#12 main::shift#10 main::ch#2 plot_chargen::pos#1 plot_chargen::ch#1 plot_chargen::shift#1 ] ( main:2 [ main::cur_pos#12 main::shift#10 main::ch#2 plot_chargen::pos#1 plot_chargen::ch#1 plot_chargen::shift#1 ] ) -- vbuyy=vbuz1 - ldy shift + //SEG143 [63] (byte) plot_chargen::shift#1 ← (byte) main::shift#10 [ main::cur_pos#12 main::shift#10 main::ch#2 plot_chargen::pos#1 plot_chargen::ch#1 plot_chargen::shift#1 ] ( main:2 [ main::cur_pos#12 main::shift#10 main::ch#2 plot_chargen::pos#1 plot_chargen::ch#1 plot_chargen::shift#1 ] ) -- vbuxx=vbuz1 + ldx shift //SEG144 [64] call plot_chargen param-assignment [ main::cur_pos#12 main::shift#10 main::ch#2 ] ( main:2 [ main::cur_pos#12 main::shift#10 main::ch#2 ] ) //SEG145 [73] phi from main::@22 to plot_chargen [phi:main::@22->plot_chargen] //SEG146 [73] phi (byte) plot_chargen::pos#2 = (byte) plot_chargen::pos#1 [phi:main::@22->plot_chargen#0] -- register_copy @@ -7465,8 +7475,8 @@ plot_chargen: { lda chargen+1 adc #>CHARGEN sta chargen+1 - //SEG177 [78] if((byte) plot_chargen::shift#2==(byte/signed byte/word/signed word/dword/signed dword) 0) goto plot_chargen::@1 [ plot_chargen::pos#2 plot_chargen::chargen#0 ] ( main:2::plot_chargen:19 [ main::i#2 plot_chargen::pos#2 plot_chargen::chargen#0 ] main:2::plot_chargen:64 [ main::cur_pos#12 main::shift#10 main::ch#2 plot_chargen::pos#2 plot_chargen::chargen#0 ] ) -- vbuyy_eq_0_then_la1 - cpy #0 + //SEG177 [78] if((byte) plot_chargen::shift#2==(byte/signed byte/word/signed word/dword/signed dword) 0) goto plot_chargen::@1 [ plot_chargen::pos#2 plot_chargen::chargen#0 ] ( main:2::plot_chargen:19 [ main::i#2 plot_chargen::pos#2 plot_chargen::chargen#0 ] main:2::plot_chargen:64 [ main::cur_pos#12 main::shift#10 main::ch#2 plot_chargen::pos#2 plot_chargen::chargen#0 ] ) -- vbuxx_eq_0_then_la1 + cpx #0 beq b1 //SEG178 plot_chargen::@5 //SEG179 [79] (byte*) plot_chargen::chargen#1 ← (byte*) plot_chargen::chargen#0 + (word/signed word/dword/signed dword) 2048 [ plot_chargen::pos#2 plot_chargen::chargen#1 ] ( main:2::plot_chargen:19 [ main::i#2 plot_chargen::pos#2 plot_chargen::chargen#1 ] main:2::plot_chargen:64 [ main::cur_pos#12 main::shift#10 main::ch#2 plot_chargen::pos#2 plot_chargen::chargen#1 ] ) -- pbuz1=pbuz1_plus_vwuc1 @@ -7484,8 +7494,9 @@ plot_chargen: { //SEG183 [81] *((const byte*) PROCPORT#0) ← (byte/signed byte/word/signed word/dword/signed dword) 50 [ plot_chargen::pos#2 plot_chargen::chargen#5 ] ( main:2::plot_chargen:19 [ main::i#2 plot_chargen::pos#2 plot_chargen::chargen#5 ] main:2::plot_chargen:64 [ main::cur_pos#12 main::shift#10 main::ch#2 plot_chargen::pos#2 plot_chargen::chargen#5 ] ) -- _deref_pbuc1=vbuc2 lda #$32 sta PROCPORT - //SEG184 [82] (byte) mul8u::a#1 ← (byte) plot_chargen::pos#2 [ plot_chargen::chargen#5 mul8u::a#1 ] ( main:2::plot_chargen:19 [ main::i#2 plot_chargen::chargen#5 mul8u::a#1 ] main:2::plot_chargen:64 [ main::cur_pos#12 main::shift#10 main::ch#2 plot_chargen::chargen#5 mul8u::a#1 ] ) - // (byte) mul8u::a#1 = (byte) plot_chargen::pos#2 // register copy reg byte x + //SEG184 [82] (byte) mul8u::a#1 ← (byte) plot_chargen::pos#2 [ plot_chargen::chargen#5 mul8u::a#1 ] ( main:2::plot_chargen:19 [ main::i#2 plot_chargen::chargen#5 mul8u::a#1 ] main:2::plot_chargen:64 [ main::cur_pos#12 main::shift#10 main::ch#2 plot_chargen::chargen#5 mul8u::a#1 ] ) -- vbuxx=vbuyy + tya + tax //SEG185 [83] call mul8u param-assignment [ plot_chargen::chargen#5 mul8u::res#2 ] ( main:2::plot_chargen:19 [ main::i#2 plot_chargen::chargen#5 mul8u::res#2 ] main:2::plot_chargen:64 [ main::cur_pos#12 main::shift#10 main::ch#2 plot_chargen::chargen#5 mul8u::res#2 ] ) //SEG186 [105] phi from plot_chargen::@1 to mul8u [phi:plot_chargen::@1->mul8u] jsr mul8u diff --git a/src/test/java/dk/camelot64/kickc/test/ref/chargen-analysis.sym b/src/test/java/dk/camelot64/kickc/test/ref/chargen-analysis.sym index b64faf52d..54010e30d 100644 --- a/src/test/java/dk/camelot64/kickc/test/ref/chargen-analysis.sym +++ b/src/test/java/dk/camelot64/kickc/test/ref/chargen-analysis.sym @@ -276,9 +276,9 @@ (byte*) plot_chargen::chargen#1 chargen zp ZP_WORD:2 4.0 (byte*) plot_chargen::chargen#5 chargen zp ZP_WORD:2 45.68181818181818 (byte) plot_chargen::pos -(byte) plot_chargen::pos#0 reg byte x 22.0 -(byte) plot_chargen::pos#1 reg byte x 67.33333333333333 -(byte) plot_chargen::pos#2 reg byte x 12.666666666666664 +(byte) plot_chargen::pos#0 reg byte y 22.0 +(byte) plot_chargen::pos#1 reg byte y 67.33333333333333 +(byte) plot_chargen::pos#2 reg byte y 12.666666666666664 (byte*) plot_chargen::sc (byte*) plot_chargen::sc#0 sc zp ZP_WORD:9 4.0 (byte*) plot_chargen::sc#1 sc zp ZP_WORD:9 5250.75 @@ -286,8 +286,8 @@ (byte*) plot_chargen::sc#3 sc zp ZP_WORD:9 5167.333333333333 (byte*) plot_chargen::sc#7 sc zp ZP_WORD:9 1002.0 (byte) plot_chargen::shift -(byte) plot_chargen::shift#1 reg byte y 202.0 -(byte) plot_chargen::shift#2 reg byte y 20.599999999999998 +(byte) plot_chargen::shift#1 reg byte x 202.0 +(byte) plot_chargen::shift#2 reg byte x 20.599999999999998 (byte) plot_chargen::x (byte) plot_chargen::x#1 reg byte x 15001.5 (byte) plot_chargen::x#2 reg byte x 2500.25 @@ -313,8 +313,8 @@ zp ZP_BYTE:5 [ main::shift#10 ] zp ZP_BYTE:6 [ main::ch#2 main::ch#1 ] reg byte a [ main::pressed#2 main::pressed#1 ] reg byte a [ plot_chargen::ch#2 plot_chargen::ch#1 ] -reg byte y [ plot_chargen::shift#2 plot_chargen::shift#1 ] -reg byte x [ plot_chargen::pos#2 plot_chargen::pos#0 plot_chargen::pos#1 ] +reg byte x [ plot_chargen::shift#2 plot_chargen::shift#1 ] +reg byte y [ plot_chargen::pos#2 plot_chargen::pos#0 plot_chargen::pos#1 ] zp ZP_BYTE:7 [ plot_chargen::y#2 plot_chargen::y#1 ] zp ZP_BYTE:8 [ plot_chargen::bits#2 plot_chargen::bits#0 plot_chargen::bits#1 ] zp ZP_WORD:9 [ plot_chargen::sc#3 plot_chargen::sc#7 plot_chargen::sc#2 plot_chargen::sc#0 plot_chargen::sc#1 plot_chargen::$8 mul8u::res#2 mul8u::res#6 mul8u::res#1 mul8u::return#2 print_str_at::at#5 print_str_at::at#7 print_str_at::at#4 ] diff --git a/src/test/java/dk/camelot64/kickc/test/ref/keyboard-glitch.asm b/src/test/java/dk/camelot64/kickc/test/ref/keyboard-glitch.asm index 7aa12d285..9c0c138f7 100644 --- a/src/test/java/dk/camelot64/kickc/test/ref/keyboard-glitch.asm +++ b/src/test/java/dk/camelot64/kickc/test/ref/keyboard-glitch.asm @@ -54,22 +54,20 @@ menu: { jmp b2 } keyboard_key_pressed: { - .label colidx = 2 txa and #7 - sta colidx + tay txa lsr lsr lsr + tax jsr keyboard_matrix_read - ldy colidx and keyboard_matrix_col_bitmask,y rts } keyboard_matrix_read: { - tay - lda keyboard_matrix_row_bitmask,y + lda keyboard_matrix_row_bitmask,x sta CIA1_PORT_A lda CIA1_PORT_B eor #$ff diff --git a/src/test/java/dk/camelot64/kickc/test/ref/keyboard-glitch.log b/src/test/java/dk/camelot64/kickc/test/ref/keyboard-glitch.log index 859c25ee4..6e9d0680c 100644 --- a/src/test/java/dk/camelot64/kickc/test/ref/keyboard-glitch.log +++ b/src/test/java/dk/camelot64/kickc/test/ref/keyboard-glitch.log @@ -2233,19 +2233,21 @@ Uplift Scope [keyboard_matrix_read] 4: zp ZP_BYTE:11 [ keyboard_matrix_read::row Uplift Scope [main] Uplift Scope [] -Uplift attempts [keyboard_key_pressed] 10000/147456 (limiting to 10000) -Uplifting [keyboard_key_pressed] best 9138 combination reg byte a [ keyboard_key_pressed::return#2 ] reg byte a [ keyboard_key_pressed::return#3 ] reg byte a [ keyboard_key_pressed::return#4 ] reg byte a [ keyboard_key_pressed::return#10 ] reg byte a [ keyboard_key_pressed::return#0 ] reg byte a [ keyboard_key_pressed::rowidx#0 ] reg byte a [ keyboard_key_pressed::$2 ] zp ZP_BYTE:2 [ keyboard_key_pressed::key#4 ] zp ZP_BYTE:9 [ keyboard_key_pressed::colidx#0 ] -Limited combination testing to 10000 combinations of 147456 possible. -Uplifting [menu] best 7938 combination reg byte a [ menu::$0 ] reg byte a [ menu::$4 ] reg byte a [ menu::$7 ] -Uplifting [pressed] best 7538 combination reg byte a [ pressed::$0 ] -Uplifting [keyboard_matrix_read] best 7522 combination reg byte a [ keyboard_matrix_read::rowid#0 ] reg byte a [ keyboard_matrix_read::return#2 ] reg byte a [ keyboard_matrix_read::return#0 ] -Uplifting [main] best 7522 combination -Uplifting [] best 7522 combination +Uplifting [keyboard_key_pressed] best 9150 combination reg byte a [ keyboard_key_pressed::return#2 ] reg byte a [ keyboard_key_pressed::return#3 ] reg byte a [ keyboard_key_pressed::return#4 ] reg byte a [ keyboard_key_pressed::return#10 ] reg byte a [ keyboard_key_pressed::return#0 ] zp ZP_BYTE:10 [ keyboard_key_pressed::rowidx#0 ] zp ZP_BYTE:13 [ keyboard_key_pressed::$2 ] zp ZP_BYTE:2 [ keyboard_key_pressed::key#4 ] zp ZP_BYTE:9 [ keyboard_key_pressed::colidx#0 ] +Limited combination testing to 1000 combinations of 147456 possible. +Uplifting [menu] best 7950 combination reg byte a [ menu::$0 ] reg byte a [ menu::$4 ] reg byte a [ menu::$7 ] +Uplifting [pressed] best 7550 combination reg byte a [ pressed::$0 ] +Uplifting [keyboard_matrix_read] best 7532 combination reg byte x [ keyboard_matrix_read::rowid#0 ] reg byte a [ keyboard_matrix_read::return#2 ] reg byte a [ keyboard_matrix_read::return#0 ] +Uplifting [main] best 7532 combination +Uplifting [] best 7532 combination +Attempting to uplift remaining variables inzp ZP_BYTE:10 [ keyboard_key_pressed::rowidx#0 ] +Uplifting [keyboard_key_pressed] best 7528 combination reg byte a [ keyboard_key_pressed::rowidx#0 ] +Attempting to uplift remaining variables inzp ZP_BYTE:13 [ keyboard_key_pressed::$2 ] +Uplifting [keyboard_key_pressed] best 7522 combination reg byte a [ keyboard_key_pressed::$2 ] Attempting to uplift remaining variables inzp ZP_BYTE:2 [ keyboard_key_pressed::key#4 ] Uplifting [keyboard_key_pressed] best 7508 combination reg byte x [ keyboard_key_pressed::key#4 ] Attempting to uplift remaining variables inzp ZP_BYTE:9 [ keyboard_key_pressed::colidx#0 ] -Uplifting [keyboard_key_pressed] best 7508 combination zp ZP_BYTE:9 [ keyboard_key_pressed::colidx#0 ] -Allocated (was zp ZP_BYTE:9) zp ZP_BYTE:2 [ keyboard_key_pressed::colidx#0 ] +Uplifting [keyboard_key_pressed] best 7504 combination reg byte y [ keyboard_key_pressed::colidx#0 ] ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart @@ -2413,18 +2415,17 @@ menu: { } //SEG61 keyboard_key_pressed keyboard_key_pressed: { - .label colidx = 2 - //SEG62 [35] (byte) keyboard_key_pressed::colidx#0 ← (byte) keyboard_key_pressed::key#4 & (byte/signed byte/word/signed word/dword/signed dword) 7 [ keyboard_key_pressed::key#4 keyboard_key_pressed::colidx#0 ] ( main:2::menu:8::keyboard_key_pressed:13 [ keyboard_key_pressed::key#4 keyboard_key_pressed::colidx#0 ] main:2::menu:8::keyboard_key_pressed:20 [ keyboard_key_pressed::key#4 keyboard_key_pressed::colidx#0 ] main:2::menu:8::keyboard_key_pressed:27 [ keyboard_key_pressed::key#4 keyboard_key_pressed::colidx#0 ] main:2::menu:8::pressed:18::keyboard_key_pressed:50 [ keyboard_key_pressed::key#4 keyboard_key_pressed::colidx#0 ] ) -- vbuz1=vbuxx_band_vbuc1 + //SEG62 [35] (byte) keyboard_key_pressed::colidx#0 ← (byte) keyboard_key_pressed::key#4 & (byte/signed byte/word/signed word/dword/signed dword) 7 [ keyboard_key_pressed::key#4 keyboard_key_pressed::colidx#0 ] ( main:2::menu:8::keyboard_key_pressed:13 [ keyboard_key_pressed::key#4 keyboard_key_pressed::colidx#0 ] main:2::menu:8::keyboard_key_pressed:20 [ keyboard_key_pressed::key#4 keyboard_key_pressed::colidx#0 ] main:2::menu:8::keyboard_key_pressed:27 [ keyboard_key_pressed::key#4 keyboard_key_pressed::colidx#0 ] main:2::menu:8::pressed:18::keyboard_key_pressed:50 [ keyboard_key_pressed::key#4 keyboard_key_pressed::colidx#0 ] ) -- vbuyy=vbuxx_band_vbuc1 txa and #7 - sta colidx + tay //SEG63 [36] (byte) keyboard_key_pressed::rowidx#0 ← (byte) keyboard_key_pressed::key#4 >> (byte/signed byte/word/signed word/dword/signed dword) 3 [ keyboard_key_pressed::colidx#0 keyboard_key_pressed::rowidx#0 ] ( main:2::menu:8::keyboard_key_pressed:13 [ keyboard_key_pressed::colidx#0 keyboard_key_pressed::rowidx#0 ] main:2::menu:8::keyboard_key_pressed:20 [ keyboard_key_pressed::colidx#0 keyboard_key_pressed::rowidx#0 ] main:2::menu:8::keyboard_key_pressed:27 [ keyboard_key_pressed::colidx#0 keyboard_key_pressed::rowidx#0 ] main:2::menu:8::pressed:18::keyboard_key_pressed:50 [ keyboard_key_pressed::colidx#0 keyboard_key_pressed::rowidx#0 ] ) -- vbuaa=vbuxx_ror_3 txa lsr lsr lsr - //SEG64 [37] (byte) keyboard_matrix_read::rowid#0 ← (byte) keyboard_key_pressed::rowidx#0 [ keyboard_key_pressed::colidx#0 keyboard_matrix_read::rowid#0 ] ( main:2::menu:8::keyboard_key_pressed:13 [ keyboard_key_pressed::colidx#0 keyboard_matrix_read::rowid#0 ] main:2::menu:8::keyboard_key_pressed:20 [ keyboard_key_pressed::colidx#0 keyboard_matrix_read::rowid#0 ] main:2::menu:8::keyboard_key_pressed:27 [ keyboard_key_pressed::colidx#0 keyboard_matrix_read::rowid#0 ] main:2::menu:8::pressed:18::keyboard_key_pressed:50 [ keyboard_key_pressed::colidx#0 keyboard_matrix_read::rowid#0 ] ) - // (byte) keyboard_matrix_read::rowid#0 = (byte) keyboard_key_pressed::rowidx#0 // register copy reg byte a + //SEG64 [37] (byte) keyboard_matrix_read::rowid#0 ← (byte) keyboard_key_pressed::rowidx#0 [ keyboard_key_pressed::colidx#0 keyboard_matrix_read::rowid#0 ] ( main:2::menu:8::keyboard_key_pressed:13 [ keyboard_key_pressed::colidx#0 keyboard_matrix_read::rowid#0 ] main:2::menu:8::keyboard_key_pressed:20 [ keyboard_key_pressed::colidx#0 keyboard_matrix_read::rowid#0 ] main:2::menu:8::keyboard_key_pressed:27 [ keyboard_key_pressed::colidx#0 keyboard_matrix_read::rowid#0 ] main:2::menu:8::pressed:18::keyboard_key_pressed:50 [ keyboard_key_pressed::colidx#0 keyboard_matrix_read::rowid#0 ] ) -- vbuxx=vbuaa + tax //SEG65 [38] call keyboard_matrix_read param-assignment [ keyboard_key_pressed::colidx#0 keyboard_matrix_read::return#0 ] ( main:2::menu:8::keyboard_key_pressed:13 [ keyboard_key_pressed::colidx#0 keyboard_matrix_read::return#0 ] main:2::menu:8::keyboard_key_pressed:20 [ keyboard_key_pressed::colidx#0 keyboard_matrix_read::return#0 ] main:2::menu:8::keyboard_key_pressed:27 [ keyboard_key_pressed::colidx#0 keyboard_matrix_read::return#0 ] main:2::menu:8::pressed:18::keyboard_key_pressed:50 [ keyboard_key_pressed::colidx#0 keyboard_matrix_read::return#0 ] ) jsr keyboard_matrix_read //SEG66 [39] (byte) keyboard_matrix_read::return#2 ← (byte) keyboard_matrix_read::return#0 [ keyboard_key_pressed::colidx#0 keyboard_matrix_read::return#2 ] ( main:2::menu:8::keyboard_key_pressed:13 [ keyboard_key_pressed::colidx#0 keyboard_matrix_read::return#2 ] main:2::menu:8::keyboard_key_pressed:20 [ keyboard_key_pressed::colidx#0 keyboard_matrix_read::return#2 ] main:2::menu:8::keyboard_key_pressed:27 [ keyboard_key_pressed::colidx#0 keyboard_matrix_read::return#2 ] main:2::menu:8::pressed:18::keyboard_key_pressed:50 [ keyboard_key_pressed::colidx#0 keyboard_matrix_read::return#2 ] ) @@ -2434,8 +2435,7 @@ keyboard_key_pressed: { b2: //SEG68 [40] (byte~) keyboard_key_pressed::$2 ← (byte) keyboard_matrix_read::return#2 [ keyboard_key_pressed::colidx#0 keyboard_key_pressed::$2 ] ( main:2::menu:8::keyboard_key_pressed:13 [ keyboard_key_pressed::colidx#0 keyboard_key_pressed::$2 ] main:2::menu:8::keyboard_key_pressed:20 [ keyboard_key_pressed::colidx#0 keyboard_key_pressed::$2 ] main:2::menu:8::keyboard_key_pressed:27 [ keyboard_key_pressed::colidx#0 keyboard_key_pressed::$2 ] main:2::menu:8::pressed:18::keyboard_key_pressed:50 [ keyboard_key_pressed::colidx#0 keyboard_key_pressed::$2 ] ) // (byte~) keyboard_key_pressed::$2 = (byte) keyboard_matrix_read::return#2 // register copy reg byte a - //SEG69 [41] (byte) keyboard_key_pressed::return#0 ← (byte~) keyboard_key_pressed::$2 & *((const byte[]) keyboard_matrix_col_bitmask#0 + (byte) keyboard_key_pressed::colidx#0) [ keyboard_key_pressed::return#0 ] ( main:2::menu:8::keyboard_key_pressed:13 [ keyboard_key_pressed::return#0 ] main:2::menu:8::keyboard_key_pressed:20 [ keyboard_key_pressed::return#0 ] main:2::menu:8::keyboard_key_pressed:27 [ keyboard_key_pressed::return#0 ] main:2::menu:8::pressed:18::keyboard_key_pressed:50 [ keyboard_key_pressed::return#0 ] ) -- vbuaa=vbuaa_band_pbuc1_derefidx_vbuz1 - ldy colidx + //SEG69 [41] (byte) keyboard_key_pressed::return#0 ← (byte~) keyboard_key_pressed::$2 & *((const byte[]) keyboard_matrix_col_bitmask#0 + (byte) keyboard_key_pressed::colidx#0) [ keyboard_key_pressed::return#0 ] ( main:2::menu:8::keyboard_key_pressed:13 [ keyboard_key_pressed::return#0 ] main:2::menu:8::keyboard_key_pressed:20 [ keyboard_key_pressed::return#0 ] main:2::menu:8::keyboard_key_pressed:27 [ keyboard_key_pressed::return#0 ] main:2::menu:8::pressed:18::keyboard_key_pressed:50 [ keyboard_key_pressed::return#0 ] ) -- vbuaa=vbuaa_band_pbuc1_derefidx_vbuyy and keyboard_matrix_col_bitmask,y jmp breturn //SEG70 keyboard_key_pressed::@return @@ -2445,9 +2445,8 @@ keyboard_key_pressed: { } //SEG72 keyboard_matrix_read keyboard_matrix_read: { - //SEG73 [43] *((const byte*) CIA1_PORT_A#0) ← *((const byte[8]) keyboard_matrix_row_bitmask#0 + (byte) keyboard_matrix_read::rowid#0) [ ] ( main:2::menu:8::keyboard_key_pressed:13::keyboard_matrix_read:38 [ keyboard_key_pressed::colidx#0 ] main:2::menu:8::keyboard_key_pressed:20::keyboard_matrix_read:38 [ keyboard_key_pressed::colidx#0 ] main:2::menu:8::keyboard_key_pressed:27::keyboard_matrix_read:38 [ keyboard_key_pressed::colidx#0 ] main:2::menu:8::pressed:18::keyboard_key_pressed:50::keyboard_matrix_read:38 [ keyboard_key_pressed::colidx#0 ] ) -- _deref_pbuc1=pbuc2_derefidx_vbuaa - tay - lda keyboard_matrix_row_bitmask,y + //SEG73 [43] *((const byte*) CIA1_PORT_A#0) ← *((const byte[8]) keyboard_matrix_row_bitmask#0 + (byte) keyboard_matrix_read::rowid#0) [ ] ( main:2::menu:8::keyboard_key_pressed:13::keyboard_matrix_read:38 [ keyboard_key_pressed::colidx#0 ] main:2::menu:8::keyboard_key_pressed:20::keyboard_matrix_read:38 [ keyboard_key_pressed::colidx#0 ] main:2::menu:8::keyboard_key_pressed:27::keyboard_matrix_read:38 [ keyboard_key_pressed::colidx#0 ] main:2::menu:8::pressed:18::keyboard_key_pressed:50::keyboard_matrix_read:38 [ keyboard_key_pressed::colidx#0 ] ) -- _deref_pbuc1=pbuc2_derefidx_vbuxx + lda keyboard_matrix_row_bitmask,x sta CIA1_PORT_A //SEG74 [44] (byte) keyboard_matrix_read::return#0 ← ~ *((const byte*) CIA1_PORT_B#0) [ keyboard_matrix_read::return#0 ] ( main:2::menu:8::keyboard_key_pressed:13::keyboard_matrix_read:38 [ keyboard_key_pressed::colidx#0 keyboard_matrix_read::return#0 ] main:2::menu:8::keyboard_key_pressed:20::keyboard_matrix_read:38 [ keyboard_key_pressed::colidx#0 keyboard_matrix_read::return#0 ] main:2::menu:8::keyboard_key_pressed:27::keyboard_matrix_read:38 [ keyboard_key_pressed::colidx#0 keyboard_matrix_read::return#0 ] main:2::menu:8::pressed:18::keyboard_key_pressed:50::keyboard_matrix_read:38 [ keyboard_key_pressed::colidx#0 keyboard_matrix_read::return#0 ] ) -- vbuaa=_bnot__deref_pbuc1 lda CIA1_PORT_B @@ -2602,7 +2601,7 @@ FINAL SYMBOL TABLE (label) keyboard_key_pressed::@2 (label) keyboard_key_pressed::@return (byte) keyboard_key_pressed::colidx -(byte) keyboard_key_pressed::colidx#0 colidx zp ZP_BYTE:2 0.6666666666666666 +(byte) keyboard_key_pressed::colidx#0 reg byte y 0.6666666666666666 (byte) keyboard_key_pressed::key (byte) keyboard_key_pressed::key#4 reg byte x 2.0 (byte) keyboard_key_pressed::return @@ -2622,7 +2621,7 @@ FINAL SYMBOL TABLE (byte) keyboard_matrix_read::return#2 reg byte a 4.0 (byte) keyboard_matrix_read::row_pressed_bits (byte) keyboard_matrix_read::rowid -(byte) keyboard_matrix_read::rowid#0 reg byte a 4.0 +(byte) keyboard_matrix_read::rowid#0 reg byte x 4.0 (byte[8]) keyboard_matrix_row_bitmask (const byte[8]) keyboard_matrix_row_bitmask#0 keyboard_matrix_row_bitmask = { (byte/word/signed word/dword/signed dword) 254, (byte/word/signed word/dword/signed dword) 253, (byte/word/signed word/dword/signed dword) 251, (byte/word/signed word/dword/signed dword) 247, (byte/word/signed word/dword/signed dword) 239, (byte/word/signed word/dword/signed dword) 223, (byte/word/signed word/dword/signed dword) 191, (byte/signed byte/word/signed word/dword/signed dword) 127 } (void()) main() @@ -2659,9 +2658,9 @@ reg byte a [ keyboard_key_pressed::return#3 ] reg byte a [ menu::$4 ] reg byte a [ keyboard_key_pressed::return#4 ] reg byte a [ menu::$7 ] -zp ZP_BYTE:2 [ keyboard_key_pressed::colidx#0 ] +reg byte y [ keyboard_key_pressed::colidx#0 ] reg byte a [ keyboard_key_pressed::rowidx#0 ] -reg byte a [ keyboard_matrix_read::rowid#0 ] +reg byte x [ keyboard_matrix_read::rowid#0 ] reg byte a [ keyboard_matrix_read::return#2 ] reg byte a [ keyboard_key_pressed::$2 ] reg byte a [ keyboard_key_pressed::return#0 ] @@ -2671,7 +2670,7 @@ reg byte a [ pressed::$0 ] FINAL ASSEMBLER -Score: 3758 +Score: 3754 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -2797,18 +2796,17 @@ menu: { } //SEG61 keyboard_key_pressed keyboard_key_pressed: { - .label colidx = 2 - //SEG62 [35] (byte) keyboard_key_pressed::colidx#0 ← (byte) keyboard_key_pressed::key#4 & (byte/signed byte/word/signed word/dword/signed dword) 7 [ keyboard_key_pressed::key#4 keyboard_key_pressed::colidx#0 ] ( main:2::menu:8::keyboard_key_pressed:13 [ keyboard_key_pressed::key#4 keyboard_key_pressed::colidx#0 ] main:2::menu:8::keyboard_key_pressed:20 [ keyboard_key_pressed::key#4 keyboard_key_pressed::colidx#0 ] main:2::menu:8::keyboard_key_pressed:27 [ keyboard_key_pressed::key#4 keyboard_key_pressed::colidx#0 ] main:2::menu:8::pressed:18::keyboard_key_pressed:50 [ keyboard_key_pressed::key#4 keyboard_key_pressed::colidx#0 ] ) -- vbuz1=vbuxx_band_vbuc1 + //SEG62 [35] (byte) keyboard_key_pressed::colidx#0 ← (byte) keyboard_key_pressed::key#4 & (byte/signed byte/word/signed word/dword/signed dword) 7 [ keyboard_key_pressed::key#4 keyboard_key_pressed::colidx#0 ] ( main:2::menu:8::keyboard_key_pressed:13 [ keyboard_key_pressed::key#4 keyboard_key_pressed::colidx#0 ] main:2::menu:8::keyboard_key_pressed:20 [ keyboard_key_pressed::key#4 keyboard_key_pressed::colidx#0 ] main:2::menu:8::keyboard_key_pressed:27 [ keyboard_key_pressed::key#4 keyboard_key_pressed::colidx#0 ] main:2::menu:8::pressed:18::keyboard_key_pressed:50 [ keyboard_key_pressed::key#4 keyboard_key_pressed::colidx#0 ] ) -- vbuyy=vbuxx_band_vbuc1 txa and #7 - sta colidx + tay //SEG63 [36] (byte) keyboard_key_pressed::rowidx#0 ← (byte) keyboard_key_pressed::key#4 >> (byte/signed byte/word/signed word/dword/signed dword) 3 [ keyboard_key_pressed::colidx#0 keyboard_key_pressed::rowidx#0 ] ( main:2::menu:8::keyboard_key_pressed:13 [ keyboard_key_pressed::colidx#0 keyboard_key_pressed::rowidx#0 ] main:2::menu:8::keyboard_key_pressed:20 [ keyboard_key_pressed::colidx#0 keyboard_key_pressed::rowidx#0 ] main:2::menu:8::keyboard_key_pressed:27 [ keyboard_key_pressed::colidx#0 keyboard_key_pressed::rowidx#0 ] main:2::menu:8::pressed:18::keyboard_key_pressed:50 [ keyboard_key_pressed::colidx#0 keyboard_key_pressed::rowidx#0 ] ) -- vbuaa=vbuxx_ror_3 txa lsr lsr lsr - //SEG64 [37] (byte) keyboard_matrix_read::rowid#0 ← (byte) keyboard_key_pressed::rowidx#0 [ keyboard_key_pressed::colidx#0 keyboard_matrix_read::rowid#0 ] ( main:2::menu:8::keyboard_key_pressed:13 [ keyboard_key_pressed::colidx#0 keyboard_matrix_read::rowid#0 ] main:2::menu:8::keyboard_key_pressed:20 [ keyboard_key_pressed::colidx#0 keyboard_matrix_read::rowid#0 ] main:2::menu:8::keyboard_key_pressed:27 [ keyboard_key_pressed::colidx#0 keyboard_matrix_read::rowid#0 ] main:2::menu:8::pressed:18::keyboard_key_pressed:50 [ keyboard_key_pressed::colidx#0 keyboard_matrix_read::rowid#0 ] ) - // (byte) keyboard_matrix_read::rowid#0 = (byte) keyboard_key_pressed::rowidx#0 // register copy reg byte a + //SEG64 [37] (byte) keyboard_matrix_read::rowid#0 ← (byte) keyboard_key_pressed::rowidx#0 [ keyboard_key_pressed::colidx#0 keyboard_matrix_read::rowid#0 ] ( main:2::menu:8::keyboard_key_pressed:13 [ keyboard_key_pressed::colidx#0 keyboard_matrix_read::rowid#0 ] main:2::menu:8::keyboard_key_pressed:20 [ keyboard_key_pressed::colidx#0 keyboard_matrix_read::rowid#0 ] main:2::menu:8::keyboard_key_pressed:27 [ keyboard_key_pressed::colidx#0 keyboard_matrix_read::rowid#0 ] main:2::menu:8::pressed:18::keyboard_key_pressed:50 [ keyboard_key_pressed::colidx#0 keyboard_matrix_read::rowid#0 ] ) -- vbuxx=vbuaa + tax //SEG65 [38] call keyboard_matrix_read param-assignment [ keyboard_key_pressed::colidx#0 keyboard_matrix_read::return#0 ] ( main:2::menu:8::keyboard_key_pressed:13 [ keyboard_key_pressed::colidx#0 keyboard_matrix_read::return#0 ] main:2::menu:8::keyboard_key_pressed:20 [ keyboard_key_pressed::colidx#0 keyboard_matrix_read::return#0 ] main:2::menu:8::keyboard_key_pressed:27 [ keyboard_key_pressed::colidx#0 keyboard_matrix_read::return#0 ] main:2::menu:8::pressed:18::keyboard_key_pressed:50 [ keyboard_key_pressed::colidx#0 keyboard_matrix_read::return#0 ] ) jsr keyboard_matrix_read //SEG66 [39] (byte) keyboard_matrix_read::return#2 ← (byte) keyboard_matrix_read::return#0 [ keyboard_key_pressed::colidx#0 keyboard_matrix_read::return#2 ] ( main:2::menu:8::keyboard_key_pressed:13 [ keyboard_key_pressed::colidx#0 keyboard_matrix_read::return#2 ] main:2::menu:8::keyboard_key_pressed:20 [ keyboard_key_pressed::colidx#0 keyboard_matrix_read::return#2 ] main:2::menu:8::keyboard_key_pressed:27 [ keyboard_key_pressed::colidx#0 keyboard_matrix_read::return#2 ] main:2::menu:8::pressed:18::keyboard_key_pressed:50 [ keyboard_key_pressed::colidx#0 keyboard_matrix_read::return#2 ] ) @@ -2816,8 +2814,7 @@ keyboard_key_pressed: { //SEG67 keyboard_key_pressed::@2 //SEG68 [40] (byte~) keyboard_key_pressed::$2 ← (byte) keyboard_matrix_read::return#2 [ keyboard_key_pressed::colidx#0 keyboard_key_pressed::$2 ] ( main:2::menu:8::keyboard_key_pressed:13 [ keyboard_key_pressed::colidx#0 keyboard_key_pressed::$2 ] main:2::menu:8::keyboard_key_pressed:20 [ keyboard_key_pressed::colidx#0 keyboard_key_pressed::$2 ] main:2::menu:8::keyboard_key_pressed:27 [ keyboard_key_pressed::colidx#0 keyboard_key_pressed::$2 ] main:2::menu:8::pressed:18::keyboard_key_pressed:50 [ keyboard_key_pressed::colidx#0 keyboard_key_pressed::$2 ] ) // (byte~) keyboard_key_pressed::$2 = (byte) keyboard_matrix_read::return#2 // register copy reg byte a - //SEG69 [41] (byte) keyboard_key_pressed::return#0 ← (byte~) keyboard_key_pressed::$2 & *((const byte[]) keyboard_matrix_col_bitmask#0 + (byte) keyboard_key_pressed::colidx#0) [ keyboard_key_pressed::return#0 ] ( main:2::menu:8::keyboard_key_pressed:13 [ keyboard_key_pressed::return#0 ] main:2::menu:8::keyboard_key_pressed:20 [ keyboard_key_pressed::return#0 ] main:2::menu:8::keyboard_key_pressed:27 [ keyboard_key_pressed::return#0 ] main:2::menu:8::pressed:18::keyboard_key_pressed:50 [ keyboard_key_pressed::return#0 ] ) -- vbuaa=vbuaa_band_pbuc1_derefidx_vbuz1 - ldy colidx + //SEG69 [41] (byte) keyboard_key_pressed::return#0 ← (byte~) keyboard_key_pressed::$2 & *((const byte[]) keyboard_matrix_col_bitmask#0 + (byte) keyboard_key_pressed::colidx#0) [ keyboard_key_pressed::return#0 ] ( main:2::menu:8::keyboard_key_pressed:13 [ keyboard_key_pressed::return#0 ] main:2::menu:8::keyboard_key_pressed:20 [ keyboard_key_pressed::return#0 ] main:2::menu:8::keyboard_key_pressed:27 [ keyboard_key_pressed::return#0 ] main:2::menu:8::pressed:18::keyboard_key_pressed:50 [ keyboard_key_pressed::return#0 ] ) -- vbuaa=vbuaa_band_pbuc1_derefidx_vbuyy and keyboard_matrix_col_bitmask,y //SEG70 keyboard_key_pressed::@return //SEG71 [42] return [ keyboard_key_pressed::return#0 ] ( main:2::menu:8::keyboard_key_pressed:13 [ keyboard_key_pressed::return#0 ] main:2::menu:8::keyboard_key_pressed:20 [ keyboard_key_pressed::return#0 ] main:2::menu:8::keyboard_key_pressed:27 [ keyboard_key_pressed::return#0 ] main:2::menu:8::pressed:18::keyboard_key_pressed:50 [ keyboard_key_pressed::return#0 ] ) @@ -2825,9 +2822,8 @@ keyboard_key_pressed: { } //SEG72 keyboard_matrix_read keyboard_matrix_read: { - //SEG73 [43] *((const byte*) CIA1_PORT_A#0) ← *((const byte[8]) keyboard_matrix_row_bitmask#0 + (byte) keyboard_matrix_read::rowid#0) [ ] ( main:2::menu:8::keyboard_key_pressed:13::keyboard_matrix_read:38 [ keyboard_key_pressed::colidx#0 ] main:2::menu:8::keyboard_key_pressed:20::keyboard_matrix_read:38 [ keyboard_key_pressed::colidx#0 ] main:2::menu:8::keyboard_key_pressed:27::keyboard_matrix_read:38 [ keyboard_key_pressed::colidx#0 ] main:2::menu:8::pressed:18::keyboard_key_pressed:50::keyboard_matrix_read:38 [ keyboard_key_pressed::colidx#0 ] ) -- _deref_pbuc1=pbuc2_derefidx_vbuaa - tay - lda keyboard_matrix_row_bitmask,y + //SEG73 [43] *((const byte*) CIA1_PORT_A#0) ← *((const byte[8]) keyboard_matrix_row_bitmask#0 + (byte) keyboard_matrix_read::rowid#0) [ ] ( main:2::menu:8::keyboard_key_pressed:13::keyboard_matrix_read:38 [ keyboard_key_pressed::colidx#0 ] main:2::menu:8::keyboard_key_pressed:20::keyboard_matrix_read:38 [ keyboard_key_pressed::colidx#0 ] main:2::menu:8::keyboard_key_pressed:27::keyboard_matrix_read:38 [ keyboard_key_pressed::colidx#0 ] main:2::menu:8::pressed:18::keyboard_key_pressed:50::keyboard_matrix_read:38 [ keyboard_key_pressed::colidx#0 ] ) -- _deref_pbuc1=pbuc2_derefidx_vbuxx + lda keyboard_matrix_row_bitmask,x sta CIA1_PORT_A //SEG74 [44] (byte) keyboard_matrix_read::return#0 ← ~ *((const byte*) CIA1_PORT_B#0) [ keyboard_matrix_read::return#0 ] ( main:2::menu:8::keyboard_key_pressed:13::keyboard_matrix_read:38 [ keyboard_key_pressed::colidx#0 keyboard_matrix_read::return#0 ] main:2::menu:8::keyboard_key_pressed:20::keyboard_matrix_read:38 [ keyboard_key_pressed::colidx#0 keyboard_matrix_read::return#0 ] main:2::menu:8::keyboard_key_pressed:27::keyboard_matrix_read:38 [ keyboard_key_pressed::colidx#0 keyboard_matrix_read::return#0 ] main:2::menu:8::pressed:18::keyboard_key_pressed:50::keyboard_matrix_read:38 [ keyboard_key_pressed::colidx#0 keyboard_matrix_read::return#0 ] ) -- vbuaa=_bnot__deref_pbuc1 lda CIA1_PORT_B diff --git a/src/test/java/dk/camelot64/kickc/test/ref/keyboard-glitch.sym b/src/test/java/dk/camelot64/kickc/test/ref/keyboard-glitch.sym index 6eb65d94b..f9c9cb21c 100644 --- a/src/test/java/dk/camelot64/kickc/test/ref/keyboard-glitch.sym +++ b/src/test/java/dk/camelot64/kickc/test/ref/keyboard-glitch.sym @@ -28,7 +28,7 @@ (label) keyboard_key_pressed::@2 (label) keyboard_key_pressed::@return (byte) keyboard_key_pressed::colidx -(byte) keyboard_key_pressed::colidx#0 colidx zp ZP_BYTE:2 0.6666666666666666 +(byte) keyboard_key_pressed::colidx#0 reg byte y 0.6666666666666666 (byte) keyboard_key_pressed::key (byte) keyboard_key_pressed::key#4 reg byte x 2.0 (byte) keyboard_key_pressed::return @@ -48,7 +48,7 @@ (byte) keyboard_matrix_read::return#2 reg byte a 4.0 (byte) keyboard_matrix_read::row_pressed_bits (byte) keyboard_matrix_read::rowid -(byte) keyboard_matrix_read::rowid#0 reg byte a 4.0 +(byte) keyboard_matrix_read::rowid#0 reg byte x 4.0 (byte[8]) keyboard_matrix_row_bitmask (const byte[8]) keyboard_matrix_row_bitmask#0 keyboard_matrix_row_bitmask = { (byte/word/signed word/dword/signed dword) 254, (byte/word/signed word/dword/signed dword) 253, (byte/word/signed word/dword/signed dword) 251, (byte/word/signed word/dword/signed dword) 247, (byte/word/signed word/dword/signed dword) 239, (byte/word/signed word/dword/signed dword) 223, (byte/word/signed word/dword/signed dword) 191, (byte/signed byte/word/signed word/dword/signed dword) 127 } (void()) main() @@ -85,9 +85,9 @@ reg byte a [ keyboard_key_pressed::return#3 ] reg byte a [ menu::$4 ] reg byte a [ keyboard_key_pressed::return#4 ] reg byte a [ menu::$7 ] -zp ZP_BYTE:2 [ keyboard_key_pressed::colidx#0 ] +reg byte y [ keyboard_key_pressed::colidx#0 ] reg byte a [ keyboard_key_pressed::rowidx#0 ] -reg byte a [ keyboard_matrix_read::rowid#0 ] +reg byte x [ keyboard_matrix_read::rowid#0 ] reg byte a [ keyboard_matrix_read::return#2 ] reg byte a [ keyboard_key_pressed::$2 ] reg byte a [ keyboard_key_pressed::return#0 ] diff --git a/src/test/java/dk/camelot64/kickc/test/ref/sinus-sprites.asm b/src/test/java/dk/camelot64/kickc/test/ref/sinus-sprites.asm index 7ad73511c..7f99a7f4e 100644 --- a/src/test/java/dk/camelot64/kickc/test/ref/sinus-sprites.asm +++ b/src/test/java/dk/camelot64/kickc/test/ref/sinus-sprites.asm @@ -37,19 +37,21 @@ main: { jmp b2 } anim: { + .label _2 = 5 .label xidx = 4 - .label yidx = 6 .label x = 8 .label x_msb = 5 + .label j2 = 6 .label j = 7 inc BORDERCOL lda sin_idx_x sta xidx - lda sin_idx_y - sta yidx + ldx sin_idx_y lda #0 sta j - ldx #$c + lda #$c + sta j2 + lda #0 sta x_msb b1: ldy xidx @@ -60,15 +62,14 @@ anim: { lda #0 adc #0 sta x+1 - lda x_msb - asl - ora x+1 + asl _2 + ora x_msb sta x_msb lda x - sta SPRITES_XPOS,x - ldy yidx - lda sintab_y,y - sta SPRITES_YPOS,x + ldy j2 + sta SPRITES_XPOS,y + lda sintab_y,x + sta SPRITES_YPOS,y lda #$a clc adc xidx @@ -79,20 +80,21 @@ anim: { sbc #sinlen_x sta xidx b2: - lda #8 + txa clc - adc yidx - sta yidx - cmp #sinlen_y + adc #8 + tax + cpx #sinlen_y bcc b3 - sec - sbc #sinlen_y - sta yidx - b3: txa sec - sbc #2 + sbc #sinlen_y tax + b3: + lda j2 + sec + sbc #2 + sta j2 inc j lda j cmp #7 diff --git a/src/test/java/dk/camelot64/kickc/test/ref/sinus-sprites.log b/src/test/java/dk/camelot64/kickc/test/ref/sinus-sprites.log index 93a573f24..244587eac 100644 --- a/src/test/java/dk/camelot64/kickc/test/ref/sinus-sprites.log +++ b/src/test/java/dk/camelot64/kickc/test/ref/sinus-sprites.log @@ -8361,67 +8361,72 @@ Uplift Scope [main] Uplift Scope [progress_init] Uplift Scope [progress_inc] -Uplifting [gen_chargen_sprite] best 1065199 combination zp ZP_BYTE:40 [ gen_chargen_sprite::s_gen#3 gen_chargen_sprite::s_gen#5 gen_chargen_sprite::s_gen#6 gen_chargen_sprite::s_gen#1 ] zp ZP_WORD:43 [ gen_chargen_sprite::sprite#3 gen_chargen_sprite::sprite#10 gen_chargen_sprite::sprite#11 gen_chargen_sprite::sprite#0 gen_chargen_sprite::sprite#2 gen_chargen_sprite::sprite#4 gen_chargen_sprite::sprite#1 ] reg byte y [ gen_chargen_sprite::s_gen_cnt#3 gen_chargen_sprite::s_gen_cnt#4 gen_chargen_sprite::s_gen_cnt#5 gen_chargen_sprite::s_gen_cnt#1 ] reg byte a [ gen_chargen_sprite::$6 ] reg byte x [ gen_chargen_sprite::b#2 gen_chargen_sprite::b#1 ] reg byte a [ gen_chargen_sprite::$3 ] zp ZP_BYTE:38 [ gen_chargen_sprite::x#6 gen_chargen_sprite::x#1 ] zp ZP_BYTE:37 [ gen_chargen_sprite::bits#2 gen_chargen_sprite::bits#0 gen_chargen_sprite::bits#1 ] zp ZP_BYTE:39 [ gen_chargen_sprite::c#3 ] zp ZP_BYTE:36 [ gen_chargen_sprite::y#2 gen_chargen_sprite::y#1 ] reg byte y [ gen_chargen_sprite::ch#0 ] zp ZP_WORD:65 [ gen_chargen_sprite::$0 ] zp ZP_WORD:67 [ gen_chargen_sprite::$1 ] zp ZP_WORD:69 [ gen_chargen_sprite::chargen#0 ] -Uplift attempts [anim] 10000/19440 (limiting to 10000) -Uplifting [anim] best 1062299 combination zp ZP_BYTE:7 [ anim::yidx#3 anim::yidx#0 anim::yidx#6 anim::yidx#1 anim::yidx#2 ] zp ZP_BYTE:4 [ anim::xidx#3 anim::xidx#0 anim::xidx#5 anim::xidx#1 anim::xidx#2 ] reg byte alu [ anim::$3 ] reg byte a [ anim::$5 ] zp ZP_BYTE:8 [ anim::j#2 anim::j#1 ] zp ZP_BYTE:5 [ anim::x_msb#2 anim::x_msb#1 ] reg byte a [ anim::$2 ] reg byte x [ anim::j2#2 anim::j2#1 ] zp ZP_WORD:50 [ anim::x#0 ] -Limited combination testing to 10000 combinations of 19440 possible. -Uplifting [place_sprites] best 1061939 combination reg byte x [ place_sprites::j2#1 ] reg byte y [ place_sprites::j#2 place_sprites::j#1 ] zp ZP_BYTE:45 [ place_sprites::spr_id#2 place_sprites::spr_id#1 ] reg byte x [ place_sprites::j2#3 place_sprites::j2#2 ] zp ZP_BYTE:47 [ place_sprites::spr_x#2 place_sprites::spr_x#1 ] zp ZP_BYTE:49 [ place_sprites::col#2 place_sprites::col#1 ] -Uplifting [setFAC] best 1061939 combination zp ZP_WORD:29 [ setFAC::w#5 setFAC::w#0 setFAC::w#3 setFAC::w#4 setFAC::w#1 ] -Uplifting [gen_sintab] best 1061872 combination zp ZP_WORD:57 [ gen_sintab::$23 ] reg byte a [ gen_sintab::$24 ] zp ZP_BYTE:17 [ gen_sintab::i#10 gen_sintab::i#1 ] reg byte x [ gen_sintab::max#2 ] zp ZP_BYTE:14 [ gen_sintab::length#10 ] zp ZP_BYTE:13 [ gen_sintab::min#2 ] zp ZP_WORD:15 [ gen_sintab::sintab#12 ] -Uplifting [gen_sprites] best 1061872 combination zp ZP_BYTE:33 [ gen_sprites::i#2 gen_sprites::i#1 ] zp ZP_WORD:34 [ gen_sprites::spr#2 gen_sprites::spr#1 ] -Uplifting [clear_screen] best 1061872 combination zp ZP_WORD:10 [ clear_screen::sc#2 clear_screen::sc#1 ] -Uplifting [prepareMEM] best 1061860 combination zp ZP_WORD:23 [ prepareMEM::mem#5 prepareMEM::mem#2 prepareMEM::mem#3 prepareMEM::mem#4 prepareMEM::mem#9 prepareMEM::mem#1 ] reg byte a [ prepareMEM::$0 ] reg byte a [ prepareMEM::$1 ] -Uplifting [init] best 1061710 combination reg byte x [ init::i#2 init::i#1 ] -Uplifting [getFAC] best 1061710 combination zp ZP_WORD:55 [ getFAC::return#2 ] zp ZP_WORD:60 [ getFAC::return#0 ] -Uplifting [] best 1061710 combination zp ZP_WORD:19 [ progress_cursor#34 progress_init::line#2 progress_cursor#11 progress_cursor#10 ] zp ZP_BYTE:18 [ progress_idx#34 progress_idx#12 progress_idx#10 ] zp ZP_BYTE:3 [ sin_idx_y#13 sin_idx_y#11 sin_idx_y#3 ] zp ZP_BYTE:2 [ sin_idx_x#13 sin_idx_x#11 sin_idx_x#3 ] -Uplifting [setMEMtoFAC] best 1061710 combination zp ZP_WORD:31 [ setMEMtoFAC::mem#5 ] -Uplifting [addMEMtoFAC] best 1061710 combination zp ZP_WORD:21 [ addMEMtoFAC::mem#2 ] -Uplifting [divMEMbyFAC] best 1061710 combination zp ZP_WORD:27 [ divMEMbyFAC::mem#2 ] -Uplifting [mulFACbyMEM] best 1061710 combination zp ZP_WORD:25 [ mulFACbyMEM::mem#2 ] -Uplifting [setARGtoFAC] best 1061710 combination -Uplifting [subFACfromARG] best 1061710 combination -Uplifting [sinFAC] best 1061710 combination -Uplifting [main] best 1061710 combination -Uplifting [progress_init] best 1061710 combination -Uplifting [progress_inc] best 1061710 combination +Uplifting [gen_chargen_sprite] best 1065230 combination zp ZP_BYTE:40 [ gen_chargen_sprite::s_gen#3 gen_chargen_sprite::s_gen#5 gen_chargen_sprite::s_gen#6 gen_chargen_sprite::s_gen#1 ] zp ZP_WORD:43 [ gen_chargen_sprite::sprite#3 gen_chargen_sprite::sprite#10 gen_chargen_sprite::sprite#11 gen_chargen_sprite::sprite#0 gen_chargen_sprite::sprite#2 gen_chargen_sprite::sprite#4 gen_chargen_sprite::sprite#1 ] reg byte y [ gen_chargen_sprite::s_gen_cnt#3 gen_chargen_sprite::s_gen_cnt#4 gen_chargen_sprite::s_gen_cnt#5 gen_chargen_sprite::s_gen_cnt#1 ] reg byte a [ gen_chargen_sprite::$6 ] reg byte x [ gen_chargen_sprite::b#2 gen_chargen_sprite::b#1 ] reg byte a [ gen_chargen_sprite::$3 ] zp ZP_BYTE:38 [ gen_chargen_sprite::x#6 gen_chargen_sprite::x#1 ] zp ZP_BYTE:37 [ gen_chargen_sprite::bits#2 gen_chargen_sprite::bits#0 gen_chargen_sprite::bits#1 ] zp ZP_BYTE:39 [ gen_chargen_sprite::c#3 ] zp ZP_BYTE:36 [ gen_chargen_sprite::y#2 gen_chargen_sprite::y#1 ] zp ZP_BYTE:64 [ gen_chargen_sprite::ch#0 ] zp ZP_WORD:65 [ gen_chargen_sprite::$0 ] zp ZP_WORD:67 [ gen_chargen_sprite::$1 ] zp ZP_WORD:69 [ gen_chargen_sprite::chargen#0 ] +Limited combination testing to 1000 combinations of 9216 possible. +Uplifting [anim] best 1063027 combination reg byte x [ anim::yidx#3 anim::yidx#0 anim::yidx#6 anim::yidx#1 anim::yidx#2 ] zp ZP_BYTE:4 [ anim::xidx#3 anim::xidx#0 anim::xidx#5 anim::xidx#1 anim::xidx#2 ] reg byte a [ anim::$3 ] reg byte a [ anim::$5 ] zp ZP_BYTE:8 [ anim::j#2 anim::j#1 ] zp ZP_BYTE:5 [ anim::x_msb#2 anim::x_msb#1 ] zp ZP_BYTE:52 [ anim::$2 ] zp ZP_BYTE:6 [ anim::j2#2 anim::j2#1 ] zp ZP_WORD:50 [ anim::x#0 ] +Limited combination testing to 1000 combinations of 19440 possible. +Uplifting [place_sprites] best 1062667 combination reg byte x [ place_sprites::j2#1 ] reg byte y [ place_sprites::j#2 place_sprites::j#1 ] zp ZP_BYTE:45 [ place_sprites::spr_id#2 place_sprites::spr_id#1 ] reg byte x [ place_sprites::j2#3 place_sprites::j2#2 ] zp ZP_BYTE:47 [ place_sprites::spr_x#2 place_sprites::spr_x#1 ] zp ZP_BYTE:49 [ place_sprites::col#2 place_sprites::col#1 ] +Uplifting [setFAC] best 1062667 combination zp ZP_WORD:29 [ setFAC::w#5 setFAC::w#0 setFAC::w#3 setFAC::w#4 setFAC::w#1 ] +Uplifting [gen_sintab] best 1062600 combination zp ZP_WORD:57 [ gen_sintab::$23 ] reg byte a [ gen_sintab::$24 ] zp ZP_BYTE:17 [ gen_sintab::i#10 gen_sintab::i#1 ] reg byte x [ gen_sintab::max#2 ] zp ZP_BYTE:14 [ gen_sintab::length#10 ] zp ZP_BYTE:13 [ gen_sintab::min#2 ] zp ZP_WORD:15 [ gen_sintab::sintab#12 ] +Uplifting [gen_sprites] best 1062600 combination zp ZP_BYTE:33 [ gen_sprites::i#2 gen_sprites::i#1 ] zp ZP_WORD:34 [ gen_sprites::spr#2 gen_sprites::spr#1 ] +Uplifting [clear_screen] best 1062600 combination zp ZP_WORD:10 [ clear_screen::sc#2 clear_screen::sc#1 ] +Uplifting [prepareMEM] best 1062588 combination zp ZP_WORD:23 [ prepareMEM::mem#5 prepareMEM::mem#2 prepareMEM::mem#3 prepareMEM::mem#4 prepareMEM::mem#9 prepareMEM::mem#1 ] reg byte a [ prepareMEM::$0 ] reg byte a [ prepareMEM::$1 ] +Uplifting [init] best 1062438 combination reg byte x [ init::i#2 init::i#1 ] +Uplifting [getFAC] best 1062438 combination zp ZP_WORD:55 [ getFAC::return#2 ] zp ZP_WORD:60 [ getFAC::return#0 ] +Uplifting [] best 1062438 combination zp ZP_WORD:19 [ progress_cursor#34 progress_init::line#2 progress_cursor#11 progress_cursor#10 ] zp ZP_BYTE:18 [ progress_idx#34 progress_idx#12 progress_idx#10 ] zp ZP_BYTE:3 [ sin_idx_y#13 sin_idx_y#11 sin_idx_y#3 ] zp ZP_BYTE:2 [ sin_idx_x#13 sin_idx_x#11 sin_idx_x#3 ] +Uplifting [setMEMtoFAC] best 1062438 combination zp ZP_WORD:31 [ setMEMtoFAC::mem#5 ] +Uplifting [addMEMtoFAC] best 1062438 combination zp ZP_WORD:21 [ addMEMtoFAC::mem#2 ] +Uplifting [divMEMbyFAC] best 1062438 combination zp ZP_WORD:27 [ divMEMbyFAC::mem#2 ] +Uplifting [mulFACbyMEM] best 1062438 combination zp ZP_WORD:25 [ mulFACbyMEM::mem#2 ] +Uplifting [setARGtoFAC] best 1062438 combination +Uplifting [subFACfromARG] best 1062438 combination +Uplifting [sinFAC] best 1062438 combination +Uplifting [main] best 1062438 combination +Uplifting [progress_init] best 1062438 combination +Uplifting [progress_inc] best 1062438 combination Attempting to uplift remaining variables inzp ZP_BYTE:40 [ gen_chargen_sprite::s_gen#3 gen_chargen_sprite::s_gen#5 gen_chargen_sprite::s_gen#6 gen_chargen_sprite::s_gen#1 ] -Uplifting [gen_chargen_sprite] best 1061710 combination zp ZP_BYTE:40 [ gen_chargen_sprite::s_gen#3 gen_chargen_sprite::s_gen#5 gen_chargen_sprite::s_gen#6 gen_chargen_sprite::s_gen#1 ] +Uplifting [gen_chargen_sprite] best 1062438 combination zp ZP_BYTE:40 [ gen_chargen_sprite::s_gen#3 gen_chargen_sprite::s_gen#5 gen_chargen_sprite::s_gen#6 gen_chargen_sprite::s_gen#1 ] Attempting to uplift remaining variables inzp ZP_BYTE:38 [ gen_chargen_sprite::x#6 gen_chargen_sprite::x#1 ] -Uplifting [gen_chargen_sprite] best 1061710 combination zp ZP_BYTE:38 [ gen_chargen_sprite::x#6 gen_chargen_sprite::x#1 ] +Uplifting [gen_chargen_sprite] best 1062438 combination zp ZP_BYTE:38 [ gen_chargen_sprite::x#6 gen_chargen_sprite::x#1 ] Attempting to uplift remaining variables inzp ZP_BYTE:37 [ gen_chargen_sprite::bits#2 gen_chargen_sprite::bits#0 gen_chargen_sprite::bits#1 ] -Uplifting [gen_chargen_sprite] best 1061710 combination zp ZP_BYTE:37 [ gen_chargen_sprite::bits#2 gen_chargen_sprite::bits#0 gen_chargen_sprite::bits#1 ] +Uplifting [gen_chargen_sprite] best 1062438 combination zp ZP_BYTE:37 [ gen_chargen_sprite::bits#2 gen_chargen_sprite::bits#0 gen_chargen_sprite::bits#1 ] Attempting to uplift remaining variables inzp ZP_BYTE:39 [ gen_chargen_sprite::c#3 ] -Uplifting [gen_chargen_sprite] best 1061710 combination zp ZP_BYTE:39 [ gen_chargen_sprite::c#3 ] -Attempting to uplift remaining variables inzp ZP_BYTE:7 [ anim::yidx#3 anim::yidx#0 anim::yidx#6 anim::yidx#1 anim::yidx#2 ] -Uplifting [anim] best 1061710 combination zp ZP_BYTE:7 [ anim::yidx#3 anim::yidx#0 anim::yidx#6 anim::yidx#1 anim::yidx#2 ] +Uplifting [gen_chargen_sprite] best 1062438 combination zp ZP_BYTE:39 [ gen_chargen_sprite::c#3 ] Attempting to uplift remaining variables inzp ZP_BYTE:4 [ anim::xidx#3 anim::xidx#0 anim::xidx#5 anim::xidx#1 anim::xidx#2 ] -Uplifting [anim] best 1061710 combination zp ZP_BYTE:4 [ anim::xidx#3 anim::xidx#0 anim::xidx#5 anim::xidx#1 anim::xidx#2 ] +Uplifting [anim] best 1062438 combination zp ZP_BYTE:4 [ anim::xidx#3 anim::xidx#0 anim::xidx#5 anim::xidx#1 anim::xidx#2 ] Attempting to uplift remaining variables inzp ZP_BYTE:36 [ gen_chargen_sprite::y#2 gen_chargen_sprite::y#1 ] -Uplifting [gen_chargen_sprite] best 1061710 combination zp ZP_BYTE:36 [ gen_chargen_sprite::y#2 gen_chargen_sprite::y#1 ] +Uplifting [gen_chargen_sprite] best 1062438 combination zp ZP_BYTE:36 [ gen_chargen_sprite::y#2 gen_chargen_sprite::y#1 ] Attempting to uplift remaining variables inzp ZP_BYTE:8 [ anim::j#2 anim::j#1 ] -Uplifting [anim] best 1061710 combination zp ZP_BYTE:8 [ anim::j#2 anim::j#1 ] +Uplifting [anim] best 1062438 combination zp ZP_BYTE:8 [ anim::j#2 anim::j#1 ] Attempting to uplift remaining variables inzp ZP_BYTE:5 [ anim::x_msb#2 anim::x_msb#1 ] -Uplifting [anim] best 1061710 combination zp ZP_BYTE:5 [ anim::x_msb#2 anim::x_msb#1 ] +Uplifting [anim] best 1062438 combination zp ZP_BYTE:5 [ anim::x_msb#2 anim::x_msb#1 ] +Attempting to uplift remaining variables inzp ZP_BYTE:52 [ anim::$2 ] +Uplifting [anim] best 1062438 combination zp ZP_BYTE:52 [ anim::$2 ] +Attempting to uplift remaining variables inzp ZP_BYTE:6 [ anim::j2#2 anim::j2#1 ] +Uplifting [anim] best 1062438 combination zp ZP_BYTE:6 [ anim::j2#2 anim::j2#1 ] Attempting to uplift remaining variables inzp ZP_BYTE:33 [ gen_sprites::i#2 gen_sprites::i#1 ] -Uplifting [gen_sprites] best 1061710 combination zp ZP_BYTE:33 [ gen_sprites::i#2 gen_sprites::i#1 ] +Uplifting [gen_sprites] best 1062438 combination zp ZP_BYTE:33 [ gen_sprites::i#2 gen_sprites::i#1 ] Attempting to uplift remaining variables inzp ZP_BYTE:45 [ place_sprites::spr_id#2 place_sprites::spr_id#1 ] -Uplifting [place_sprites] best 1061710 combination zp ZP_BYTE:45 [ place_sprites::spr_id#2 place_sprites::spr_id#1 ] +Uplifting [place_sprites] best 1062438 combination zp ZP_BYTE:45 [ place_sprites::spr_id#2 place_sprites::spr_id#1 ] Attempting to uplift remaining variables inzp ZP_BYTE:17 [ gen_sintab::i#10 gen_sintab::i#1 ] -Uplifting [gen_sintab] best 1061710 combination zp ZP_BYTE:17 [ gen_sintab::i#10 gen_sintab::i#1 ] +Uplifting [gen_sintab] best 1062438 combination zp ZP_BYTE:17 [ gen_sintab::i#10 gen_sintab::i#1 ] Attempting to uplift remaining variables inzp ZP_BYTE:47 [ place_sprites::spr_x#2 place_sprites::spr_x#1 ] -Uplifting [place_sprites] best 1061710 combination zp ZP_BYTE:47 [ place_sprites::spr_x#2 place_sprites::spr_x#1 ] +Uplifting [place_sprites] best 1062438 combination zp ZP_BYTE:47 [ place_sprites::spr_x#2 place_sprites::spr_x#1 ] Attempting to uplift remaining variables inzp ZP_BYTE:49 [ place_sprites::col#2 place_sprites::col#1 ] -Uplifting [place_sprites] best 1061710 combination zp ZP_BYTE:49 [ place_sprites::col#2 place_sprites::col#1 ] +Uplifting [place_sprites] best 1062438 combination zp ZP_BYTE:49 [ place_sprites::col#2 place_sprites::col#1 ] +Attempting to uplift remaining variables inzp ZP_BYTE:64 [ gen_chargen_sprite::ch#0 ] +Uplifting [gen_chargen_sprite] best 1062407 combination reg byte y [ gen_chargen_sprite::ch#0 ] Attempting to uplift remaining variables inzp ZP_BYTE:18 [ progress_idx#34 progress_idx#12 progress_idx#10 ] -Uplifting [] best 1061710 combination zp ZP_BYTE:18 [ progress_idx#34 progress_idx#12 progress_idx#10 ] +Uplifting [] best 1062407 combination zp ZP_BYTE:18 [ progress_idx#34 progress_idx#12 progress_idx#10 ] Attempting to uplift remaining variables inzp ZP_BYTE:3 [ sin_idx_y#13 sin_idx_y#11 sin_idx_y#3 ] -Uplifting [] best 1061710 combination zp ZP_BYTE:3 [ sin_idx_y#13 sin_idx_y#11 sin_idx_y#3 ] +Uplifting [] best 1062407 combination zp ZP_BYTE:3 [ sin_idx_y#13 sin_idx_y#11 sin_idx_y#3 ] Attempting to uplift remaining variables inzp ZP_BYTE:2 [ sin_idx_x#13 sin_idx_x#11 sin_idx_x#3 ] -Uplifting [] best 1061710 combination zp ZP_BYTE:2 [ sin_idx_x#13 sin_idx_x#11 sin_idx_x#3 ] +Uplifting [] best 1062407 combination zp ZP_BYTE:2 [ sin_idx_x#13 sin_idx_x#11 sin_idx_x#3 ] Attempting to uplift remaining variables inzp ZP_BYTE:14 [ gen_sintab::length#10 ] -Uplifting [gen_sintab] best 1061710 combination zp ZP_BYTE:14 [ gen_sintab::length#10 ] +Uplifting [gen_sintab] best 1062407 combination zp ZP_BYTE:14 [ gen_sintab::length#10 ] Attempting to uplift remaining variables inzp ZP_BYTE:13 [ gen_sintab::min#2 ] -Uplifting [gen_sintab] best 1061710 combination zp ZP_BYTE:13 [ gen_sintab::min#2 ] +Uplifting [gen_sintab] best 1062407 combination zp ZP_BYTE:13 [ gen_sintab::min#2 ] +Coalescing zero page register with common assignment [ zp ZP_BYTE:5 [ anim::x_msb#2 anim::x_msb#1 ] ] with [ zp ZP_BYTE:52 [ anim::$2 ] ] - score: 2 Coalescing zero page register with common assignment [ zp ZP_WORD:21 [ addMEMtoFAC::mem#2 ] ] with [ zp ZP_WORD:23 [ prepareMEM::mem#5 prepareMEM::mem#2 prepareMEM::mem#3 prepareMEM::mem#4 prepareMEM::mem#9 prepareMEM::mem#1 ] ] - score: 1 Coalescing zero page register with common assignment [ zp ZP_WORD:55 [ getFAC::return#2 ] ] with [ zp ZP_WORD:57 [ gen_sintab::$23 ] ] - score: 1 Coalescing zero page register with common assignment [ zp ZP_WORD:55 [ getFAC::return#2 gen_sintab::$23 ] ] with [ zp ZP_WORD:60 [ getFAC::return#0 ] ] - score: 1 @@ -8441,8 +8446,8 @@ Coalescing zero page register [ zp ZP_BYTE:3 [ sin_idx_y#13 sin_idx_y#11 sin_idx Coalescing zero page register [ zp ZP_BYTE:4 [ anim::xidx#3 anim::xidx#0 anim::xidx#5 anim::xidx#1 anim::xidx#2 ] ] with [ zp ZP_BYTE:18 [ progress_idx#34 progress_idx#12 progress_idx#10 ] ] Coalescing zero page register [ zp ZP_BYTE:4 [ anim::xidx#3 anim::xidx#0 anim::xidx#5 anim::xidx#1 anim::xidx#2 progress_idx#34 progress_idx#12 progress_idx#10 ] ] with [ zp ZP_BYTE:37 [ gen_chargen_sprite::bits#2 gen_chargen_sprite::bits#0 gen_chargen_sprite::bits#1 ] ] Coalescing zero page register [ zp ZP_BYTE:4 [ anim::xidx#3 anim::xidx#0 anim::xidx#5 anim::xidx#1 anim::xidx#2 progress_idx#34 progress_idx#12 progress_idx#10 gen_chargen_sprite::bits#2 gen_chargen_sprite::bits#0 gen_chargen_sprite::bits#1 ] ] with [ zp ZP_BYTE:49 [ place_sprites::col#2 place_sprites::col#1 ] ] -Coalescing zero page register [ zp ZP_BYTE:5 [ anim::x_msb#2 anim::x_msb#1 ] ] with [ zp ZP_BYTE:38 [ gen_chargen_sprite::x#6 gen_chargen_sprite::x#1 ] ] -Coalescing zero page register [ zp ZP_BYTE:7 [ anim::yidx#3 anim::yidx#0 anim::yidx#6 anim::yidx#1 anim::yidx#2 ] ] with [ zp ZP_BYTE:39 [ gen_chargen_sprite::c#3 ] ] +Coalescing zero page register [ zp ZP_BYTE:5 [ anim::x_msb#2 anim::x_msb#1 anim::$2 ] ] with [ zp ZP_BYTE:38 [ gen_chargen_sprite::x#6 gen_chargen_sprite::x#1 ] ] +Coalescing zero page register [ zp ZP_BYTE:6 [ anim::j2#2 anim::j2#1 ] ] with [ zp ZP_BYTE:39 [ gen_chargen_sprite::c#3 ] ] Coalescing zero page register [ zp ZP_BYTE:8 [ anim::j#2 anim::j#1 ] ] with [ zp ZP_BYTE:40 [ gen_chargen_sprite::s_gen#3 gen_chargen_sprite::s_gen#5 gen_chargen_sprite::s_gen#6 gen_chargen_sprite::s_gen#1 ] ] Coalescing zero page register [ zp ZP_WORD:10 [ clear_screen::sc#2 clear_screen::sc#1 ] ] with [ zp ZP_WORD:15 [ gen_sintab::sintab#12 ] ] Coalescing zero page register [ zp ZP_WORD:10 [ clear_screen::sc#2 clear_screen::sc#1 gen_sintab::sintab#12 ] ] with [ zp ZP_WORD:34 [ gen_sprites::spr#2 gen_sprites::spr#1 ] ] @@ -8450,7 +8455,6 @@ Coalescing zero page register [ zp ZP_WORD:10 [ clear_screen::sc#2 clear_screen: Coalescing zero page register [ zp ZP_WORD:19 [ progress_cursor#34 progress_init::line#2 progress_cursor#11 progress_cursor#10 ] ] with [ zp ZP_WORD:43 [ gen_chargen_sprite::sprite#3 gen_chargen_sprite::sprite#10 gen_chargen_sprite::sprite#11 gen_chargen_sprite::sprite#0 gen_chargen_sprite::sprite#2 gen_chargen_sprite::sprite#4 gen_chargen_sprite::sprite#1 ] ] Coalescing zero page register [ zp ZP_WORD:21 [ addMEMtoFAC::mem#2 prepareMEM::mem#5 prepareMEM::mem#2 prepareMEM::mem#3 prepareMEM::mem#4 prepareMEM::mem#9 prepareMEM::mem#1 mulFACbyMEM::mem#2 divMEMbyFAC::mem#2 setFAC::w#5 setFAC::w#0 setFAC::w#3 setFAC::w#4 setFAC::w#1 setMEMtoFAC::mem#5 ] ] with [ zp ZP_WORD:55 [ getFAC::return#2 gen_sintab::$23 getFAC::return#0 ] ] Coalescing zero page register [ zp ZP_WORD:21 [ addMEMtoFAC::mem#2 prepareMEM::mem#5 prepareMEM::mem#2 prepareMEM::mem#3 prepareMEM::mem#4 prepareMEM::mem#9 prepareMEM::mem#1 mulFACbyMEM::mem#2 divMEMbyFAC::mem#2 setFAC::w#5 setFAC::w#0 setFAC::w#3 setFAC::w#4 setFAC::w#1 setMEMtoFAC::mem#5 getFAC::return#2 gen_sintab::$23 getFAC::return#0 ] ] with [ zp ZP_WORD:65 [ gen_chargen_sprite::$0 gen_chargen_sprite::$1 gen_chargen_sprite::chargen#0 ] ] -Allocated (was zp ZP_BYTE:7) zp ZP_BYTE:6 [ anim::yidx#3 anim::yidx#0 anim::yidx#6 anim::yidx#1 anim::yidx#2 gen_chargen_sprite::c#3 ] Allocated (was zp ZP_BYTE:8) zp ZP_BYTE:7 [ anim::j#2 anim::j#1 gen_chargen_sprite::s_gen#3 gen_chargen_sprite::s_gen#5 gen_chargen_sprite::s_gen#6 gen_chargen_sprite::s_gen#1 ] Allocated (was zp ZP_WORD:10) zp ZP_WORD:8 [ clear_screen::sc#2 clear_screen::sc#1 gen_sintab::sintab#12 gen_sprites::spr#2 gen_sprites::spr#1 anim::x#0 ] Allocated (was zp ZP_WORD:19) zp ZP_WORD:10 [ progress_cursor#34 progress_init::line#2 progress_cursor#11 progress_cursor#10 gen_chargen_sprite::sprite#3 gen_chargen_sprite::sprite#10 gen_chargen_sprite::sprite#11 gen_chargen_sprite::sprite#0 gen_chargen_sprite::sprite#2 gen_chargen_sprite::sprite#4 gen_chargen_sprite::sprite#1 ] @@ -8549,27 +8553,28 @@ main: { } //SEG28 anim anim: { + .label _2 = 5 .label xidx = 4 - .label yidx = 6 .label x = 8 .label x_msb = 5 + .label j2 = 6 .label j = 7 //SEG29 [12] *((const byte*) BORDERCOL#0) ← ++ *((const byte*) BORDERCOL#0) [ sin_idx_x#13 sin_idx_y#13 ] ( main:2::anim:9 [ sin_idx_x#13 sin_idx_y#13 ] ) -- _deref_pbuc1=_inc__deref_pbuc1 inc BORDERCOL //SEG30 [13] (byte) anim::xidx#0 ← (byte) sin_idx_x#13 [ sin_idx_x#13 sin_idx_y#13 anim::xidx#0 ] ( main:2::anim:9 [ sin_idx_x#13 sin_idx_y#13 anim::xidx#0 ] ) -- vbuz1=vbuz2 lda sin_idx_x sta xidx - //SEG31 [14] (byte) anim::yidx#0 ← (byte) sin_idx_y#13 [ sin_idx_x#13 sin_idx_y#13 anim::xidx#0 anim::yidx#0 ] ( main:2::anim:9 [ sin_idx_x#13 sin_idx_y#13 anim::xidx#0 anim::yidx#0 ] ) -- vbuz1=vbuz2 - lda sin_idx_y - sta yidx + //SEG31 [14] (byte) anim::yidx#0 ← (byte) sin_idx_y#13 [ sin_idx_x#13 sin_idx_y#13 anim::xidx#0 anim::yidx#0 ] ( main:2::anim:9 [ sin_idx_x#13 sin_idx_y#13 anim::xidx#0 anim::yidx#0 ] ) -- vbuxx=vbuz1 + ldx sin_idx_y //SEG32 [15] phi from anim to anim::@1 [phi:anim->anim::@1] b1_from_anim: //SEG33 [15] phi (byte) anim::j#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:anim->anim::@1#0] -- vbuz1=vbuc1 lda #0 sta j //SEG34 [15] phi (byte) anim::yidx#3 = (byte) anim::yidx#0 [phi:anim->anim::@1#1] -- register_copy - //SEG35 [15] phi (byte) anim::j2#2 = (byte/signed byte/word/signed word/dword/signed dword) 12 [phi:anim->anim::@1#2] -- vbuxx=vbuc1 - ldx #$c + //SEG35 [15] phi (byte) anim::j2#2 = (byte/signed byte/word/signed word/dword/signed dword) 12 [phi:anim->anim::@1#2] -- vbuz1=vbuc1 + lda #$c + sta j2 //SEG36 [15] phi (byte) anim::x_msb#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:anim->anim::@1#3] -- vbuz1=vbuc1 lda #0 sta x_msb @@ -8594,22 +8599,22 @@ anim: { lda #0 adc #0 sta x+1 - //SEG46 [17] (byte~) anim::$2 ← (byte) anim::x_msb#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 [ sin_idx_x#13 sin_idx_y#13 anim::xidx#3 anim::j2#2 anim::yidx#3 anim::j#2 anim::x#0 anim::$2 ] ( main:2::anim:9 [ sin_idx_x#13 sin_idx_y#13 anim::xidx#3 anim::j2#2 anim::yidx#3 anim::j#2 anim::x#0 anim::$2 ] ) -- vbuaa=vbuz1_rol_1 - lda x_msb - asl - //SEG47 [18] (byte~) anim::$3 ← > (word) anim::x#0 [ sin_idx_x#13 sin_idx_y#13 anim::xidx#3 anim::j2#2 anim::yidx#3 anim::j#2 anim::x#0 anim::$2 anim::$3 ] ( main:2::anim:9 [ sin_idx_x#13 sin_idx_y#13 anim::xidx#3 anim::j2#2 anim::yidx#3 anim::j#2 anim::x#0 anim::$2 anim::$3 ] ) - // [18] anim::$3 ← > anim::x#0 // ALU - //SEG48 [19] (byte) anim::x_msb#1 ← (byte~) anim::$2 | (byte~) anim::$3 [ sin_idx_x#13 sin_idx_y#13 anim::xidx#3 anim::j2#2 anim::yidx#3 anim::j#2 anim::x_msb#1 anim::x#0 ] ( main:2::anim:9 [ sin_idx_x#13 sin_idx_y#13 anim::xidx#3 anim::j2#2 anim::yidx#3 anim::j#2 anim::x_msb#1 anim::x#0 ] ) -- vbuz1=vbuaa_bor__hi_vwuz2 - ora x+1 + //SEG46 [17] (byte~) anim::$2 ← (byte) anim::x_msb#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 [ sin_idx_x#13 sin_idx_y#13 anim::xidx#3 anim::j2#2 anim::yidx#3 anim::j#2 anim::x#0 anim::$2 ] ( main:2::anim:9 [ sin_idx_x#13 sin_idx_y#13 anim::xidx#3 anim::j2#2 anim::yidx#3 anim::j#2 anim::x#0 anim::$2 ] ) -- vbuz1=vbuz1_rol_1 + asl _2 + //SEG47 [18] (byte~) anim::$3 ← > (word) anim::x#0 [ sin_idx_x#13 sin_idx_y#13 anim::xidx#3 anim::j2#2 anim::yidx#3 anim::j#2 anim::x#0 anim::$2 anim::$3 ] ( main:2::anim:9 [ sin_idx_x#13 sin_idx_y#13 anim::xidx#3 anim::j2#2 anim::yidx#3 anim::j#2 anim::x#0 anim::$2 anim::$3 ] ) -- vbuaa=_hi_vwuz1 + lda x+1 + //SEG48 [19] (byte) anim::x_msb#1 ← (byte~) anim::$2 | (byte~) anim::$3 [ sin_idx_x#13 sin_idx_y#13 anim::xidx#3 anim::j2#2 anim::yidx#3 anim::j#2 anim::x_msb#1 anim::x#0 ] ( main:2::anim:9 [ sin_idx_x#13 sin_idx_y#13 anim::xidx#3 anim::j2#2 anim::yidx#3 anim::j#2 anim::x_msb#1 anim::x#0 ] ) -- vbuz1=vbuz1_bor_vbuaa + ora x_msb sta x_msb //SEG49 [20] (byte~) anim::$5 ← < (word) anim::x#0 [ sin_idx_x#13 sin_idx_y#13 anim::xidx#3 anim::j2#2 anim::yidx#3 anim::j#2 anim::x_msb#1 anim::$5 ] ( main:2::anim:9 [ sin_idx_x#13 sin_idx_y#13 anim::xidx#3 anim::j2#2 anim::yidx#3 anim::j#2 anim::x_msb#1 anim::$5 ] ) -- vbuaa=_lo_vwuz1 lda x - //SEG50 [21] *((const byte*) SPRITES_XPOS#0 + (byte) anim::j2#2) ← (byte~) anim::$5 [ sin_idx_x#13 sin_idx_y#13 anim::xidx#3 anim::j2#2 anim::yidx#3 anim::j#2 anim::x_msb#1 ] ( main:2::anim:9 [ sin_idx_x#13 sin_idx_y#13 anim::xidx#3 anim::j2#2 anim::yidx#3 anim::j#2 anim::x_msb#1 ] ) -- pbuc1_derefidx_vbuxx=vbuaa - sta SPRITES_XPOS,x - //SEG51 [22] *((const byte*) SPRITES_YPOS#0 + (byte) anim::j2#2) ← *((const byte[197]) sintab_y#0 + (byte) anim::yidx#3) [ sin_idx_x#13 sin_idx_y#13 anim::xidx#3 anim::j2#2 anim::yidx#3 anim::j#2 anim::x_msb#1 ] ( main:2::anim:9 [ sin_idx_x#13 sin_idx_y#13 anim::xidx#3 anim::j2#2 anim::yidx#3 anim::j#2 anim::x_msb#1 ] ) -- pbuc1_derefidx_vbuxx=pbuc2_derefidx_vbuz1 - ldy yidx - lda sintab_y,y - sta SPRITES_YPOS,x + //SEG50 [21] *((const byte*) SPRITES_XPOS#0 + (byte) anim::j2#2) ← (byte~) anim::$5 [ sin_idx_x#13 sin_idx_y#13 anim::xidx#3 anim::j2#2 anim::yidx#3 anim::j#2 anim::x_msb#1 ] ( main:2::anim:9 [ sin_idx_x#13 sin_idx_y#13 anim::xidx#3 anim::j2#2 anim::yidx#3 anim::j#2 anim::x_msb#1 ] ) -- pbuc1_derefidx_vbuz1=vbuaa + ldy j2 + sta SPRITES_XPOS,y + //SEG51 [22] *((const byte*) SPRITES_YPOS#0 + (byte) anim::j2#2) ← *((const byte[197]) sintab_y#0 + (byte) anim::yidx#3) [ sin_idx_x#13 sin_idx_y#13 anim::xidx#3 anim::j2#2 anim::yidx#3 anim::j#2 anim::x_msb#1 ] ( main:2::anim:9 [ sin_idx_x#13 sin_idx_y#13 anim::xidx#3 anim::j2#2 anim::yidx#3 anim::j#2 anim::x_msb#1 ] ) -- pbuc1_derefidx_vbuz1=pbuc2_derefidx_vbuxx + lda sintab_y,x + ldy j2 + sta SPRITES_YPOS,y //SEG52 [23] (byte) anim::xidx#1 ← (byte) anim::xidx#3 + (byte/signed byte/word/signed word/dword/signed dword) 10 [ sin_idx_x#13 sin_idx_y#13 anim::j2#2 anim::yidx#3 anim::j#2 anim::x_msb#1 anim::xidx#1 ] ( main:2::anim:9 [ sin_idx_x#13 sin_idx_y#13 anim::j2#2 anim::yidx#3 anim::j#2 anim::x_msb#1 anim::xidx#1 ] ) -- vbuz1=vbuz1_plus_vbuc1 lda #$a clc @@ -8634,23 +8639,22 @@ anim: { jmp b2 //SEG58 anim::@2 b2: - //SEG59 [27] (byte) anim::yidx#1 ← (byte) anim::yidx#3 + (byte/signed byte/word/signed word/dword/signed dword) 8 [ sin_idx_x#13 sin_idx_y#13 anim::j2#2 anim::j#2 anim::xidx#5 anim::x_msb#1 anim::yidx#1 ] ( main:2::anim:9 [ sin_idx_x#13 sin_idx_y#13 anim::j2#2 anim::j#2 anim::xidx#5 anim::x_msb#1 anim::yidx#1 ] ) -- vbuz1=vbuz1_plus_vbuc1 - lda #8 + //SEG59 [27] (byte) anim::yidx#1 ← (byte) anim::yidx#3 + (byte/signed byte/word/signed word/dword/signed dword) 8 [ sin_idx_x#13 sin_idx_y#13 anim::j2#2 anim::j#2 anim::xidx#5 anim::x_msb#1 anim::yidx#1 ] ( main:2::anim:9 [ sin_idx_x#13 sin_idx_y#13 anim::j2#2 anim::j#2 anim::xidx#5 anim::x_msb#1 anim::yidx#1 ] ) -- vbuxx=vbuxx_plus_vbuc1 + txa clc - adc yidx - sta yidx - //SEG60 [28] if((byte) anim::yidx#1<(const byte) sinlen_y#0) goto anim::@3 [ sin_idx_x#13 sin_idx_y#13 anim::j2#2 anim::j#2 anim::xidx#5 anim::x_msb#1 anim::yidx#1 ] ( main:2::anim:9 [ sin_idx_x#13 sin_idx_y#13 anim::j2#2 anim::j#2 anim::xidx#5 anim::x_msb#1 anim::yidx#1 ] ) -- vbuz1_lt_vbuc1_then_la1 - lda yidx - cmp #sinlen_y + adc #8 + tax + //SEG60 [28] if((byte) anim::yidx#1<(const byte) sinlen_y#0) goto anim::@3 [ sin_idx_x#13 sin_idx_y#13 anim::j2#2 anim::j#2 anim::xidx#5 anim::x_msb#1 anim::yidx#1 ] ( main:2::anim:9 [ sin_idx_x#13 sin_idx_y#13 anim::j2#2 anim::j#2 anim::xidx#5 anim::x_msb#1 anim::yidx#1 ] ) -- vbuxx_lt_vbuc1_then_la1 + cpx #sinlen_y bcc b3_from_b2 jmp b7 //SEG61 anim::@7 b7: - //SEG62 [29] (byte) anim::yidx#2 ← (byte) anim::yidx#1 - (const byte) sinlen_y#0 [ sin_idx_x#13 sin_idx_y#13 anim::j2#2 anim::j#2 anim::xidx#5 anim::x_msb#1 anim::yidx#2 ] ( main:2::anim:9 [ sin_idx_x#13 sin_idx_y#13 anim::j2#2 anim::j#2 anim::xidx#5 anim::x_msb#1 anim::yidx#2 ] ) -- vbuz1=vbuz1_minus_vbuc1 - lda yidx + //SEG62 [29] (byte) anim::yidx#2 ← (byte) anim::yidx#1 - (const byte) sinlen_y#0 [ sin_idx_x#13 sin_idx_y#13 anim::j2#2 anim::j#2 anim::xidx#5 anim::x_msb#1 anim::yidx#2 ] ( main:2::anim:9 [ sin_idx_x#13 sin_idx_y#13 anim::j2#2 anim::j#2 anim::xidx#5 anim::x_msb#1 anim::yidx#2 ] ) -- vbuxx=vbuxx_minus_vbuc1 + txa sec sbc #sinlen_y - sta yidx + tax //SEG63 [30] phi from anim::@2 anim::@7 to anim::@3 [phi:anim::@2/anim::@7->anim::@3] b3_from_b2: b3_from_b7: @@ -8658,11 +8662,11 @@ anim: { jmp b3 //SEG65 anim::@3 b3: - //SEG66 [31] (byte) anim::j2#1 ← (byte) anim::j2#2 - (byte/signed byte/word/signed word/dword/signed dword) 2 [ sin_idx_x#13 sin_idx_y#13 anim::j#2 anim::xidx#5 anim::x_msb#1 anim::j2#1 anim::yidx#6 ] ( main:2::anim:9 [ sin_idx_x#13 sin_idx_y#13 anim::j#2 anim::xidx#5 anim::x_msb#1 anim::j2#1 anim::yidx#6 ] ) -- vbuxx=vbuxx_minus_vbuc1 - txa + //SEG66 [31] (byte) anim::j2#1 ← (byte) anim::j2#2 - (byte/signed byte/word/signed word/dword/signed dword) 2 [ sin_idx_x#13 sin_idx_y#13 anim::j#2 anim::xidx#5 anim::x_msb#1 anim::j2#1 anim::yidx#6 ] ( main:2::anim:9 [ sin_idx_x#13 sin_idx_y#13 anim::j#2 anim::xidx#5 anim::x_msb#1 anim::j2#1 anim::yidx#6 ] ) -- vbuz1=vbuz1_minus_vbuc1 + lda j2 sec sbc #2 - tax + sta j2 //SEG67 [32] (byte) anim::j#1 ← ++ (byte) anim::j#2 [ sin_idx_x#13 sin_idx_y#13 anim::xidx#5 anim::x_msb#1 anim::j2#1 anim::yidx#6 anim::j#1 ] ( main:2::anim:9 [ sin_idx_x#13 sin_idx_y#13 anim::xidx#5 anim::x_msb#1 anim::j2#1 anim::yidx#6 anim::j#1 ] ) -- vbuz1=_inc_vbuz1 inc j //SEG68 [33] if((byte) anim::j#1!=(byte/signed byte/word/signed word/dword/signed dword) 7) goto anim::@1 [ sin_idx_x#13 sin_idx_y#13 anim::xidx#5 anim::x_msb#1 anim::j2#1 anim::yidx#6 anim::j#1 ] ( main:2::anim:9 [ sin_idx_x#13 sin_idx_y#13 anim::xidx#5 anim::x_msb#1 anim::j2#1 anim::yidx#6 anim::j#1 ] ) -- vbuz1_neq_vbuc1_then_la1 @@ -9880,9 +9884,9 @@ Removing instruction jmp b1 Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination Removing instruction lda #0 -Removing instruction lda #0 +Removing instruction lda x+1 +Removing instruction ldy j2 Removing instruction lda xidx -Removing instruction lda yidx Replacing instruction ldx #0 with TAX Replacing instruction ldy #0 with TAY Replacing instruction lda #0 with TXA @@ -10096,7 +10100,6 @@ Removing instruction jmp b5 Removing instruction jmp b1 Succesful ASM optimization Pass5NextJumpElimination Removing instruction lda xidx -Removing instruction lda yidx Removing instruction lda s_gen Succesful ASM optimization Pass5UnnecesaryLoadElimination Removing instruction b1: @@ -10146,8 +10149,8 @@ FINAL SYMBOL TABLE (byte*) addMEMtoFAC::mem (byte*) addMEMtoFAC::mem#2 mem zp ZP_WORD:12 2.0 (void()) anim() -(byte~) anim::$2 reg byte a 101.0 -(byte~) anim::$3 reg byte alu 202.0 +(byte~) anim::$2 $2 zp ZP_BYTE:5 101.0 +(byte~) anim::$3 reg byte a 202.0 (byte~) anim::$5 reg byte a 202.0 (label) anim::@1 (label) anim::@14 @@ -10164,8 +10167,8 @@ FINAL SYMBOL TABLE (byte) anim::j#1 j zp ZP_BYTE:7 151.5 (byte) anim::j#2 j zp ZP_BYTE:7 11.882352941176471 (byte) anim::j2 -(byte) anim::j2#1 reg byte x 67.33333333333333 -(byte) anim::j2#2 reg byte x 25.25 +(byte) anim::j2#1 j2 zp ZP_BYTE:6 67.33333333333333 +(byte) anim::j2#2 j2 zp ZP_BYTE:6 25.25 (word) anim::x (word) anim::x#0 x zp ZP_WORD:8 75.75 (byte) anim::x_msb @@ -10178,11 +10181,11 @@ FINAL SYMBOL TABLE (byte) anim::xidx#3 xidx zp ZP_BYTE:4 38.125 (byte) anim::xidx#5 xidx zp ZP_BYTE:4 37.875 (byte) anim::yidx -(byte) anim::yidx#0 yidx zp ZP_BYTE:6 4.0 -(byte) anim::yidx#1 yidx zp ZP_BYTE:6 202.0 -(byte) anim::yidx#2 yidx zp ZP_BYTE:6 202.0 -(byte) anim::yidx#3 yidx zp ZP_BYTE:6 25.416666666666664 -(byte) anim::yidx#6 yidx zp ZP_BYTE:6 75.75 +(byte) anim::yidx#0 reg byte x 4.0 +(byte) anim::yidx#1 reg byte x 202.0 +(byte) anim::yidx#2 reg byte x 202.0 +(byte) anim::yidx#3 reg byte x 25.416666666666664 +(byte) anim::yidx#6 reg byte x 75.75 (void()) clear_screen() (label) clear_screen::@1 (label) clear_screen::@return @@ -10428,9 +10431,9 @@ FINAL SYMBOL TABLE zp ZP_BYTE:2 [ sin_idx_x#13 sin_idx_x#11 sin_idx_x#3 gen_sintab::min#2 gen_sintab::i#10 gen_sintab::i#1 gen_sprites::i#2 gen_sprites::i#1 place_sprites::spr_id#2 place_sprites::spr_id#1 ] zp ZP_BYTE:3 [ sin_idx_y#13 sin_idx_y#11 sin_idx_y#3 gen_sintab::length#10 gen_chargen_sprite::y#2 gen_chargen_sprite::y#1 place_sprites::spr_x#2 place_sprites::spr_x#1 ] zp ZP_BYTE:4 [ anim::xidx#3 anim::xidx#0 anim::xidx#5 anim::xidx#1 anim::xidx#2 progress_idx#34 progress_idx#12 progress_idx#10 gen_chargen_sprite::bits#2 gen_chargen_sprite::bits#0 gen_chargen_sprite::bits#1 place_sprites::col#2 place_sprites::col#1 ] -zp ZP_BYTE:5 [ anim::x_msb#2 anim::x_msb#1 gen_chargen_sprite::x#6 gen_chargen_sprite::x#1 ] -reg byte x [ anim::j2#2 anim::j2#1 ] -zp ZP_BYTE:6 [ anim::yidx#3 anim::yidx#0 anim::yidx#6 anim::yidx#1 anim::yidx#2 gen_chargen_sprite::c#3 ] +zp ZP_BYTE:5 [ anim::x_msb#2 anim::x_msb#1 anim::$2 gen_chargen_sprite::x#6 gen_chargen_sprite::x#1 ] +zp ZP_BYTE:6 [ anim::j2#2 anim::j2#1 gen_chargen_sprite::c#3 ] +reg byte x [ anim::yidx#3 anim::yidx#0 anim::yidx#6 anim::yidx#1 anim::yidx#2 ] zp ZP_BYTE:7 [ anim::j#2 anim::j#1 gen_chargen_sprite::s_gen#3 gen_chargen_sprite::s_gen#5 gen_chargen_sprite::s_gen#6 gen_chargen_sprite::s_gen#1 ] reg byte x [ init::i#2 init::i#1 ] zp ZP_WORD:8 [ clear_screen::sc#2 clear_screen::sc#1 gen_sintab::sintab#12 gen_sprites::spr#2 gen_sprites::spr#1 anim::x#0 ] @@ -10441,8 +10444,7 @@ reg byte y [ gen_chargen_sprite::s_gen_cnt#3 gen_chargen_sprite::s_gen_cnt#4 gen reg byte x [ gen_chargen_sprite::b#2 gen_chargen_sprite::b#1 ] reg byte y [ place_sprites::j#2 place_sprites::j#1 ] reg byte x [ place_sprites::j2#3 place_sprites::j2#2 ] -reg byte a [ anim::$2 ] -reg byte alu [ anim::$3 ] +reg byte a [ anim::$3 ] reg byte a [ anim::$5 ] reg byte a [ gen_sintab::$24 ] reg byte a [ prepareMEM::$0 ] @@ -10454,7 +10456,7 @@ reg byte x [ place_sprites::j2#1 ] FINAL ASSEMBLER -Score: 767890 +Score: 768487 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -10524,27 +10526,29 @@ main: { } //SEG28 anim anim: { + .label _2 = 5 .label xidx = 4 - .label yidx = 6 .label x = 8 .label x_msb = 5 + .label j2 = 6 .label j = 7 //SEG29 [12] *((const byte*) BORDERCOL#0) ← ++ *((const byte*) BORDERCOL#0) [ sin_idx_x#13 sin_idx_y#13 ] ( main:2::anim:9 [ sin_idx_x#13 sin_idx_y#13 ] ) -- _deref_pbuc1=_inc__deref_pbuc1 inc BORDERCOL //SEG30 [13] (byte) anim::xidx#0 ← (byte) sin_idx_x#13 [ sin_idx_x#13 sin_idx_y#13 anim::xidx#0 ] ( main:2::anim:9 [ sin_idx_x#13 sin_idx_y#13 anim::xidx#0 ] ) -- vbuz1=vbuz2 lda sin_idx_x sta xidx - //SEG31 [14] (byte) anim::yidx#0 ← (byte) sin_idx_y#13 [ sin_idx_x#13 sin_idx_y#13 anim::xidx#0 anim::yidx#0 ] ( main:2::anim:9 [ sin_idx_x#13 sin_idx_y#13 anim::xidx#0 anim::yidx#0 ] ) -- vbuz1=vbuz2 - lda sin_idx_y - sta yidx + //SEG31 [14] (byte) anim::yidx#0 ← (byte) sin_idx_y#13 [ sin_idx_x#13 sin_idx_y#13 anim::xidx#0 anim::yidx#0 ] ( main:2::anim:9 [ sin_idx_x#13 sin_idx_y#13 anim::xidx#0 anim::yidx#0 ] ) -- vbuxx=vbuz1 + ldx sin_idx_y //SEG32 [15] phi from anim to anim::@1 [phi:anim->anim::@1] //SEG33 [15] phi (byte) anim::j#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:anim->anim::@1#0] -- vbuz1=vbuc1 lda #0 sta j //SEG34 [15] phi (byte) anim::yidx#3 = (byte) anim::yidx#0 [phi:anim->anim::@1#1] -- register_copy - //SEG35 [15] phi (byte) anim::j2#2 = (byte/signed byte/word/signed word/dword/signed dword) 12 [phi:anim->anim::@1#2] -- vbuxx=vbuc1 - ldx #$c + //SEG35 [15] phi (byte) anim::j2#2 = (byte/signed byte/word/signed word/dword/signed dword) 12 [phi:anim->anim::@1#2] -- vbuz1=vbuc1 + lda #$c + sta j2 //SEG36 [15] phi (byte) anim::x_msb#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:anim->anim::@1#3] -- vbuz1=vbuc1 + lda #0 sta x_msb //SEG37 [15] phi (byte) anim::xidx#3 = (byte) anim::xidx#0 [phi:anim->anim::@1#4] -- register_copy //SEG38 [15] phi from anim::@3 to anim::@1 [phi:anim::@3->anim::@1] @@ -10564,22 +10568,20 @@ anim: { lda #0 adc #0 sta x+1 - //SEG46 [17] (byte~) anim::$2 ← (byte) anim::x_msb#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 [ sin_idx_x#13 sin_idx_y#13 anim::xidx#3 anim::j2#2 anim::yidx#3 anim::j#2 anim::x#0 anim::$2 ] ( main:2::anim:9 [ sin_idx_x#13 sin_idx_y#13 anim::xidx#3 anim::j2#2 anim::yidx#3 anim::j#2 anim::x#0 anim::$2 ] ) -- vbuaa=vbuz1_rol_1 - lda x_msb - asl - //SEG47 [18] (byte~) anim::$3 ← > (word) anim::x#0 [ sin_idx_x#13 sin_idx_y#13 anim::xidx#3 anim::j2#2 anim::yidx#3 anim::j#2 anim::x#0 anim::$2 anim::$3 ] ( main:2::anim:9 [ sin_idx_x#13 sin_idx_y#13 anim::xidx#3 anim::j2#2 anim::yidx#3 anim::j#2 anim::x#0 anim::$2 anim::$3 ] ) - // [18] anim::$3 ← > anim::x#0 // ALU - //SEG48 [19] (byte) anim::x_msb#1 ← (byte~) anim::$2 | (byte~) anim::$3 [ sin_idx_x#13 sin_idx_y#13 anim::xidx#3 anim::j2#2 anim::yidx#3 anim::j#2 anim::x_msb#1 anim::x#0 ] ( main:2::anim:9 [ sin_idx_x#13 sin_idx_y#13 anim::xidx#3 anim::j2#2 anim::yidx#3 anim::j#2 anim::x_msb#1 anim::x#0 ] ) -- vbuz1=vbuaa_bor__hi_vwuz2 - ora x+1 + //SEG46 [17] (byte~) anim::$2 ← (byte) anim::x_msb#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 [ sin_idx_x#13 sin_idx_y#13 anim::xidx#3 anim::j2#2 anim::yidx#3 anim::j#2 anim::x#0 anim::$2 ] ( main:2::anim:9 [ sin_idx_x#13 sin_idx_y#13 anim::xidx#3 anim::j2#2 anim::yidx#3 anim::j#2 anim::x#0 anim::$2 ] ) -- vbuz1=vbuz1_rol_1 + asl _2 + //SEG47 [18] (byte~) anim::$3 ← > (word) anim::x#0 [ sin_idx_x#13 sin_idx_y#13 anim::xidx#3 anim::j2#2 anim::yidx#3 anim::j#2 anim::x#0 anim::$2 anim::$3 ] ( main:2::anim:9 [ sin_idx_x#13 sin_idx_y#13 anim::xidx#3 anim::j2#2 anim::yidx#3 anim::j#2 anim::x#0 anim::$2 anim::$3 ] ) -- vbuaa=_hi_vwuz1 + //SEG48 [19] (byte) anim::x_msb#1 ← (byte~) anim::$2 | (byte~) anim::$3 [ sin_idx_x#13 sin_idx_y#13 anim::xidx#3 anim::j2#2 anim::yidx#3 anim::j#2 anim::x_msb#1 anim::x#0 ] ( main:2::anim:9 [ sin_idx_x#13 sin_idx_y#13 anim::xidx#3 anim::j2#2 anim::yidx#3 anim::j#2 anim::x_msb#1 anim::x#0 ] ) -- vbuz1=vbuz1_bor_vbuaa + ora x_msb sta x_msb //SEG49 [20] (byte~) anim::$5 ← < (word) anim::x#0 [ sin_idx_x#13 sin_idx_y#13 anim::xidx#3 anim::j2#2 anim::yidx#3 anim::j#2 anim::x_msb#1 anim::$5 ] ( main:2::anim:9 [ sin_idx_x#13 sin_idx_y#13 anim::xidx#3 anim::j2#2 anim::yidx#3 anim::j#2 anim::x_msb#1 anim::$5 ] ) -- vbuaa=_lo_vwuz1 lda x - //SEG50 [21] *((const byte*) SPRITES_XPOS#0 + (byte) anim::j2#2) ← (byte~) anim::$5 [ sin_idx_x#13 sin_idx_y#13 anim::xidx#3 anim::j2#2 anim::yidx#3 anim::j#2 anim::x_msb#1 ] ( main:2::anim:9 [ sin_idx_x#13 sin_idx_y#13 anim::xidx#3 anim::j2#2 anim::yidx#3 anim::j#2 anim::x_msb#1 ] ) -- pbuc1_derefidx_vbuxx=vbuaa - sta SPRITES_XPOS,x - //SEG51 [22] *((const byte*) SPRITES_YPOS#0 + (byte) anim::j2#2) ← *((const byte[197]) sintab_y#0 + (byte) anim::yidx#3) [ sin_idx_x#13 sin_idx_y#13 anim::xidx#3 anim::j2#2 anim::yidx#3 anim::j#2 anim::x_msb#1 ] ( main:2::anim:9 [ sin_idx_x#13 sin_idx_y#13 anim::xidx#3 anim::j2#2 anim::yidx#3 anim::j#2 anim::x_msb#1 ] ) -- pbuc1_derefidx_vbuxx=pbuc2_derefidx_vbuz1 - ldy yidx - lda sintab_y,y - sta SPRITES_YPOS,x + //SEG50 [21] *((const byte*) SPRITES_XPOS#0 + (byte) anim::j2#2) ← (byte~) anim::$5 [ sin_idx_x#13 sin_idx_y#13 anim::xidx#3 anim::j2#2 anim::yidx#3 anim::j#2 anim::x_msb#1 ] ( main:2::anim:9 [ sin_idx_x#13 sin_idx_y#13 anim::xidx#3 anim::j2#2 anim::yidx#3 anim::j#2 anim::x_msb#1 ] ) -- pbuc1_derefidx_vbuz1=vbuaa + ldy j2 + sta SPRITES_XPOS,y + //SEG51 [22] *((const byte*) SPRITES_YPOS#0 + (byte) anim::j2#2) ← *((const byte[197]) sintab_y#0 + (byte) anim::yidx#3) [ sin_idx_x#13 sin_idx_y#13 anim::xidx#3 anim::j2#2 anim::yidx#3 anim::j#2 anim::x_msb#1 ] ( main:2::anim:9 [ sin_idx_x#13 sin_idx_y#13 anim::xidx#3 anim::j2#2 anim::yidx#3 anim::j#2 anim::x_msb#1 ] ) -- pbuc1_derefidx_vbuz1=pbuc2_derefidx_vbuxx + lda sintab_y,x + sta SPRITES_YPOS,y //SEG52 [23] (byte) anim::xidx#1 ← (byte) anim::xidx#3 + (byte/signed byte/word/signed word/dword/signed dword) 10 [ sin_idx_x#13 sin_idx_y#13 anim::j2#2 anim::yidx#3 anim::j#2 anim::x_msb#1 anim::xidx#1 ] ( main:2::anim:9 [ sin_idx_x#13 sin_idx_y#13 anim::j2#2 anim::yidx#3 anim::j#2 anim::x_msb#1 anim::xidx#1 ] ) -- vbuz1=vbuz1_plus_vbuc1 lda #$a clc @@ -10597,28 +10599,29 @@ anim: { //SEG57 [26] phi (byte) anim::xidx#5 = (byte) anim::xidx#1 [phi:anim::@1/anim::@6->anim::@2#0] -- register_copy //SEG58 anim::@2 b2: - //SEG59 [27] (byte) anim::yidx#1 ← (byte) anim::yidx#3 + (byte/signed byte/word/signed word/dword/signed dword) 8 [ sin_idx_x#13 sin_idx_y#13 anim::j2#2 anim::j#2 anim::xidx#5 anim::x_msb#1 anim::yidx#1 ] ( main:2::anim:9 [ sin_idx_x#13 sin_idx_y#13 anim::j2#2 anim::j#2 anim::xidx#5 anim::x_msb#1 anim::yidx#1 ] ) -- vbuz1=vbuz1_plus_vbuc1 - lda #8 + //SEG59 [27] (byte) anim::yidx#1 ← (byte) anim::yidx#3 + (byte/signed byte/word/signed word/dword/signed dword) 8 [ sin_idx_x#13 sin_idx_y#13 anim::j2#2 anim::j#2 anim::xidx#5 anim::x_msb#1 anim::yidx#1 ] ( main:2::anim:9 [ sin_idx_x#13 sin_idx_y#13 anim::j2#2 anim::j#2 anim::xidx#5 anim::x_msb#1 anim::yidx#1 ] ) -- vbuxx=vbuxx_plus_vbuc1 + txa clc - adc yidx - sta yidx - //SEG60 [28] if((byte) anim::yidx#1<(const byte) sinlen_y#0) goto anim::@3 [ sin_idx_x#13 sin_idx_y#13 anim::j2#2 anim::j#2 anim::xidx#5 anim::x_msb#1 anim::yidx#1 ] ( main:2::anim:9 [ sin_idx_x#13 sin_idx_y#13 anim::j2#2 anim::j#2 anim::xidx#5 anim::x_msb#1 anim::yidx#1 ] ) -- vbuz1_lt_vbuc1_then_la1 - cmp #sinlen_y + adc #8 + tax + //SEG60 [28] if((byte) anim::yidx#1<(const byte) sinlen_y#0) goto anim::@3 [ sin_idx_x#13 sin_idx_y#13 anim::j2#2 anim::j#2 anim::xidx#5 anim::x_msb#1 anim::yidx#1 ] ( main:2::anim:9 [ sin_idx_x#13 sin_idx_y#13 anim::j2#2 anim::j#2 anim::xidx#5 anim::x_msb#1 anim::yidx#1 ] ) -- vbuxx_lt_vbuc1_then_la1 + cpx #sinlen_y bcc b3 //SEG61 anim::@7 - //SEG62 [29] (byte) anim::yidx#2 ← (byte) anim::yidx#1 - (const byte) sinlen_y#0 [ sin_idx_x#13 sin_idx_y#13 anim::j2#2 anim::j#2 anim::xidx#5 anim::x_msb#1 anim::yidx#2 ] ( main:2::anim:9 [ sin_idx_x#13 sin_idx_y#13 anim::j2#2 anim::j#2 anim::xidx#5 anim::x_msb#1 anim::yidx#2 ] ) -- vbuz1=vbuz1_minus_vbuc1 + //SEG62 [29] (byte) anim::yidx#2 ← (byte) anim::yidx#1 - (const byte) sinlen_y#0 [ sin_idx_x#13 sin_idx_y#13 anim::j2#2 anim::j#2 anim::xidx#5 anim::x_msb#1 anim::yidx#2 ] ( main:2::anim:9 [ sin_idx_x#13 sin_idx_y#13 anim::j2#2 anim::j#2 anim::xidx#5 anim::x_msb#1 anim::yidx#2 ] ) -- vbuxx=vbuxx_minus_vbuc1 + txa sec sbc #sinlen_y - sta yidx + tax //SEG63 [30] phi from anim::@2 anim::@7 to anim::@3 [phi:anim::@2/anim::@7->anim::@3] //SEG64 [30] phi (byte) anim::yidx#6 = (byte) anim::yidx#1 [phi:anim::@2/anim::@7->anim::@3#0] -- register_copy //SEG65 anim::@3 b3: - //SEG66 [31] (byte) anim::j2#1 ← (byte) anim::j2#2 - (byte/signed byte/word/signed word/dword/signed dword) 2 [ sin_idx_x#13 sin_idx_y#13 anim::j#2 anim::xidx#5 anim::x_msb#1 anim::j2#1 anim::yidx#6 ] ( main:2::anim:9 [ sin_idx_x#13 sin_idx_y#13 anim::j#2 anim::xidx#5 anim::x_msb#1 anim::j2#1 anim::yidx#6 ] ) -- vbuxx=vbuxx_minus_vbuc1 - txa + //SEG66 [31] (byte) anim::j2#1 ← (byte) anim::j2#2 - (byte/signed byte/word/signed word/dword/signed dword) 2 [ sin_idx_x#13 sin_idx_y#13 anim::j#2 anim::xidx#5 anim::x_msb#1 anim::j2#1 anim::yidx#6 ] ( main:2::anim:9 [ sin_idx_x#13 sin_idx_y#13 anim::j#2 anim::xidx#5 anim::x_msb#1 anim::j2#1 anim::yidx#6 ] ) -- vbuz1=vbuz1_minus_vbuc1 + lda j2 sec sbc #2 - tax + sta j2 //SEG67 [32] (byte) anim::j#1 ← ++ (byte) anim::j#2 [ sin_idx_x#13 sin_idx_y#13 anim::xidx#5 anim::x_msb#1 anim::j2#1 anim::yidx#6 anim::j#1 ] ( main:2::anim:9 [ sin_idx_x#13 sin_idx_y#13 anim::xidx#5 anim::x_msb#1 anim::j2#1 anim::yidx#6 anim::j#1 ] ) -- vbuz1=_inc_vbuz1 inc j //SEG68 [33] if((byte) anim::j#1!=(byte/signed byte/word/signed word/dword/signed dword) 7) goto anim::@1 [ sin_idx_x#13 sin_idx_y#13 anim::xidx#5 anim::x_msb#1 anim::j2#1 anim::yidx#6 anim::j#1 ] ( main:2::anim:9 [ sin_idx_x#13 sin_idx_y#13 anim::xidx#5 anim::x_msb#1 anim::j2#1 anim::yidx#6 anim::j#1 ] ) -- vbuz1_neq_vbuc1_then_la1 diff --git a/src/test/java/dk/camelot64/kickc/test/ref/sinus-sprites.sym b/src/test/java/dk/camelot64/kickc/test/ref/sinus-sprites.sym index d343f947b..67fe2d195 100644 --- a/src/test/java/dk/camelot64/kickc/test/ref/sinus-sprites.sym +++ b/src/test/java/dk/camelot64/kickc/test/ref/sinus-sprites.sym @@ -33,8 +33,8 @@ (byte*) addMEMtoFAC::mem (byte*) addMEMtoFAC::mem#2 mem zp ZP_WORD:12 2.0 (void()) anim() -(byte~) anim::$2 reg byte a 101.0 -(byte~) anim::$3 reg byte alu 202.0 +(byte~) anim::$2 $2 zp ZP_BYTE:5 101.0 +(byte~) anim::$3 reg byte a 202.0 (byte~) anim::$5 reg byte a 202.0 (label) anim::@1 (label) anim::@14 @@ -51,8 +51,8 @@ (byte) anim::j#1 j zp ZP_BYTE:7 151.5 (byte) anim::j#2 j zp ZP_BYTE:7 11.882352941176471 (byte) anim::j2 -(byte) anim::j2#1 reg byte x 67.33333333333333 -(byte) anim::j2#2 reg byte x 25.25 +(byte) anim::j2#1 j2 zp ZP_BYTE:6 67.33333333333333 +(byte) anim::j2#2 j2 zp ZP_BYTE:6 25.25 (word) anim::x (word) anim::x#0 x zp ZP_WORD:8 75.75 (byte) anim::x_msb @@ -65,11 +65,11 @@ (byte) anim::xidx#3 xidx zp ZP_BYTE:4 38.125 (byte) anim::xidx#5 xidx zp ZP_BYTE:4 37.875 (byte) anim::yidx -(byte) anim::yidx#0 yidx zp ZP_BYTE:6 4.0 -(byte) anim::yidx#1 yidx zp ZP_BYTE:6 202.0 -(byte) anim::yidx#2 yidx zp ZP_BYTE:6 202.0 -(byte) anim::yidx#3 yidx zp ZP_BYTE:6 25.416666666666664 -(byte) anim::yidx#6 yidx zp ZP_BYTE:6 75.75 +(byte) anim::yidx#0 reg byte x 4.0 +(byte) anim::yidx#1 reg byte x 202.0 +(byte) anim::yidx#2 reg byte x 202.0 +(byte) anim::yidx#3 reg byte x 25.416666666666664 +(byte) anim::yidx#6 reg byte x 75.75 (void()) clear_screen() (label) clear_screen::@1 (label) clear_screen::@return @@ -315,9 +315,9 @@ zp ZP_BYTE:2 [ sin_idx_x#13 sin_idx_x#11 sin_idx_x#3 gen_sintab::min#2 gen_sintab::i#10 gen_sintab::i#1 gen_sprites::i#2 gen_sprites::i#1 place_sprites::spr_id#2 place_sprites::spr_id#1 ] zp ZP_BYTE:3 [ sin_idx_y#13 sin_idx_y#11 sin_idx_y#3 gen_sintab::length#10 gen_chargen_sprite::y#2 gen_chargen_sprite::y#1 place_sprites::spr_x#2 place_sprites::spr_x#1 ] zp ZP_BYTE:4 [ anim::xidx#3 anim::xidx#0 anim::xidx#5 anim::xidx#1 anim::xidx#2 progress_idx#34 progress_idx#12 progress_idx#10 gen_chargen_sprite::bits#2 gen_chargen_sprite::bits#0 gen_chargen_sprite::bits#1 place_sprites::col#2 place_sprites::col#1 ] -zp ZP_BYTE:5 [ anim::x_msb#2 anim::x_msb#1 gen_chargen_sprite::x#6 gen_chargen_sprite::x#1 ] -reg byte x [ anim::j2#2 anim::j2#1 ] -zp ZP_BYTE:6 [ anim::yidx#3 anim::yidx#0 anim::yidx#6 anim::yidx#1 anim::yidx#2 gen_chargen_sprite::c#3 ] +zp ZP_BYTE:5 [ anim::x_msb#2 anim::x_msb#1 anim::$2 gen_chargen_sprite::x#6 gen_chargen_sprite::x#1 ] +zp ZP_BYTE:6 [ anim::j2#2 anim::j2#1 gen_chargen_sprite::c#3 ] +reg byte x [ anim::yidx#3 anim::yidx#0 anim::yidx#6 anim::yidx#1 anim::yidx#2 ] zp ZP_BYTE:7 [ anim::j#2 anim::j#1 gen_chargen_sprite::s_gen#3 gen_chargen_sprite::s_gen#5 gen_chargen_sprite::s_gen#6 gen_chargen_sprite::s_gen#1 ] reg byte x [ init::i#2 init::i#1 ] zp ZP_WORD:8 [ clear_screen::sc#2 clear_screen::sc#1 gen_sintab::sintab#12 gen_sprites::spr#2 gen_sprites::spr#1 anim::x#0 ] @@ -328,8 +328,7 @@ reg byte y [ gen_chargen_sprite::s_gen_cnt#3 gen_chargen_sprite::s_gen_cnt#4 gen reg byte x [ gen_chargen_sprite::b#2 gen_chargen_sprite::b#1 ] reg byte y [ place_sprites::j#2 place_sprites::j#1 ] reg byte x [ place_sprites::j2#3 place_sprites::j2#2 ] -reg byte a [ anim::$2 ] -reg byte alu [ anim::$3 ] +reg byte a [ anim::$3 ] reg byte a [ anim::$5 ] reg byte a [ gen_sintab::$24 ] reg byte a [ prepareMEM::$0 ] diff --git a/src/test/java/dk/camelot64/kickc/test/ref/sinusgen8.log b/src/test/java/dk/camelot64/kickc/test/ref/sinusgen8.log index 4b21be40e..5bc8805ec 100644 --- a/src/test/java/dk/camelot64/kickc/test/ref/sinusgen8.log +++ b/src/test/java/dk/camelot64/kickc/test/ref/sinusgen8.log @@ -6709,23 +6709,29 @@ Uplifting [mul8u] best 18977 combination zp ZP_WORD:26 [ mul8u::res#2 mul8u::res Uplifting [print_str] best 18977 combination zp ZP_WORD:3 [ print_str::str#3 print_str::str#5 print_str::str#0 ] Uplifting [divr16u] best 18787 combination zp ZP_WORD:30 [ divr16u::rem#4 divr16u::rem#10 divr16u::rem#5 divr16u::rem#0 divr16u::rem#1 divr16u::rem#2 ] zp ZP_WORD:34 [ divr16u::quotient#3 divr16u::return#0 divr16u::quotient#1 divr16u::quotient#2 ] reg byte a [ divr16u::$1 ] reg byte a [ divr16u::$2 ] reg byte x [ divr16u::i#2 divr16u::i#1 ] zp ZP_WORD:32 [ divr16u::dividend#2 divr16u::dividend#0 ] zp ZP_WORD:70 [ divr16u::return#2 ] Uplifting [] best 18787 combination zp ZP_WORD:7 [ print_char_cursor#27 print_char_cursor#37 print_char_cursor#44 print_char_cursor#41 print_char_cursor#42 print_char_cursor#19 print_char_cursor#10 print_char_cursor#1 ] -Uplift attempts [sin8s] 10000/5308416 (limiting to 10000) -Uplifting [sin8s] best 18660 combination zp ZP_WORD:18 [ sin8s::x#6 sin8s::x#4 sin8s::x#0 sin8s::x#1 sin8s::x#2 ] reg byte a [ sin8s::return#0 ] reg byte a [ sin8s::return#1 sin8s::return#5 sin8s::sinx#1 ] reg byte x [ sin8s::usinx#4 sin8s::usinx#1 sin8s::usinx#2 ] zp ZP_WORD:46 [ sin8s::$6 ] reg byte a [ sin8s::x2#0 ] reg byte a [ sin8s::x3_6#0 ] reg byte a [ sin8s::x4#0 ] reg byte a [ sin8s::x5#0 ] zp ZP_BYTE:60 [ sin8s::x5_128#0 ] zp ZP_BYTE:52 [ sin8s::x3#0 ] zp ZP_BYTE:48 [ sin8s::x1#0 ] zp ZP_BYTE:55 [ sin8s::usinx#0 ] zp ZP_BYTE:17 [ sin8s::isUpper#10 ] -Limited combination testing to 10000 combinations of 5308416 possible. -Uplift attempts [mulu8_sel] 10000/196608 (limiting to 10000) -Uplifting [mulu8_sel] best 18600 combination reg byte x [ mulu8_sel::v1#5 mulu8_sel::v1#1 mulu8_sel::v1#2 mulu8_sel::v1#3 mulu8_sel::v1#4 mulu8_sel::v1#0 ] reg byte y [ mulu8_sel::v2#5 mulu8_sel::v2#1 mulu8_sel::v2#3 mulu8_sel::v2#4 mulu8_sel::v2#0 ] reg byte a [ mulu8_sel::return#0 ] reg byte a [ mulu8_sel::return#1 ] reg byte a [ mulu8_sel::return#2 ] reg byte a [ mulu8_sel::return#10 ] reg byte a [ mulu8_sel::return#11 ] zp ZP_WORD:64 [ mulu8_sel::$0 ] zp ZP_WORD:66 [ mulu8_sel::$1 ] zp ZP_BYTE:68 [ mulu8_sel::return#12 ] zp ZP_BYTE:24 [ mulu8_sel::select#5 ] -Limited combination testing to 10000 combinations of 196608 possible. -Uplifting [sin8s_gen] best 18540 combination reg byte a [ sin8s_gen::$1 ] zp ZP_WORD:15 [ sin8s_gen::i#2 sin8s_gen::i#1 ] zp ZP_WORD:11 [ sin8s_gen::x#2 sin8s_gen::x#1 ] zp ZP_WORD:13 [ sin8s_gen::sintab#2 sin8s_gen::sintab#0 ] zp ZP_WORD:42 [ sin8s_gen::step#0 ] -Uplifting [print_cls] best 18540 combination zp ZP_WORD:9 [ print_cls::sc#2 print_cls::sc#1 ] -Uplifting [main] best 18420 combination reg byte x [ main::i#2 main::i#1 ] zp ZP_BYTE:37 [ main::sb#0 ] -Uplifting [print_char] best 18408 combination reg byte a [ print_char::ch#3 print_char::ch#1 print_char::ch#2 ] -Uplifting [print_sbyte] best 18408 combination zp ZP_BYTE:5 [ print_sbyte::b#3 print_sbyte::b#1 print_sbyte::b#0 ] -Uplifting [print_byte] best 18400 combination reg byte a [ print_byte::$0 ] reg byte a [ print_byte::$2 ] -Uplifting [div16u] best 18400 combination zp ZP_WORD:40 [ div16u::return#2 ] zp ZP_WORD:72 [ div16u::return#0 ] +Uplifting [sin8s] best 18672 combination zp ZP_WORD:18 [ sin8s::x#6 sin8s::x#4 sin8s::x#0 sin8s::x#1 sin8s::x#2 ] reg byte a [ sin8s::return#0 ] reg byte a [ sin8s::return#1 sin8s::return#5 sin8s::sinx#1 ] reg byte x [ sin8s::usinx#4 sin8s::usinx#1 sin8s::usinx#2 ] zp ZP_WORD:46 [ sin8s::$6 ] reg byte a [ sin8s::x2#0 ] reg byte a [ sin8s::x3_6#0 ] zp ZP_BYTE:57 [ sin8s::x4#0 ] zp ZP_BYTE:59 [ sin8s::x5#0 ] zp ZP_BYTE:60 [ sin8s::x5_128#0 ] zp ZP_BYTE:52 [ sin8s::x3#0 ] zp ZP_BYTE:48 [ sin8s::x1#0 ] zp ZP_BYTE:55 [ sin8s::usinx#0 ] zp ZP_BYTE:17 [ sin8s::isUpper#10 ] +Limited combination testing to 1000 combinations of 5308416 possible. +Uplifting [mulu8_sel] best 18622 combination reg byte x [ mulu8_sel::v1#5 mulu8_sel::v1#1 mulu8_sel::v1#2 mulu8_sel::v1#3 mulu8_sel::v1#4 mulu8_sel::v1#0 ] reg byte y [ mulu8_sel::v2#5 mulu8_sel::v2#1 mulu8_sel::v2#3 mulu8_sel::v2#4 mulu8_sel::v2#0 ] reg byte a [ mulu8_sel::return#0 ] reg byte a [ mulu8_sel::return#1 ] reg byte a [ mulu8_sel::return#2 ] zp ZP_BYTE:56 [ mulu8_sel::return#10 ] zp ZP_BYTE:58 [ mulu8_sel::return#11 ] zp ZP_WORD:64 [ mulu8_sel::$0 ] zp ZP_WORD:66 [ mulu8_sel::$1 ] zp ZP_BYTE:68 [ mulu8_sel::return#12 ] zp ZP_BYTE:24 [ mulu8_sel::select#5 ] +Limited combination testing to 1000 combinations of 196608 possible. +Uplifting [sin8s_gen] best 18562 combination reg byte a [ sin8s_gen::$1 ] zp ZP_WORD:15 [ sin8s_gen::i#2 sin8s_gen::i#1 ] zp ZP_WORD:11 [ sin8s_gen::x#2 sin8s_gen::x#1 ] zp ZP_WORD:13 [ sin8s_gen::sintab#2 sin8s_gen::sintab#0 ] zp ZP_WORD:42 [ sin8s_gen::step#0 ] +Uplifting [print_cls] best 18562 combination zp ZP_WORD:9 [ print_cls::sc#2 print_cls::sc#1 ] +Uplifting [main] best 18442 combination reg byte x [ main::i#2 main::i#1 ] zp ZP_BYTE:37 [ main::sb#0 ] +Uplifting [print_char] best 18430 combination reg byte a [ print_char::ch#3 print_char::ch#1 print_char::ch#2 ] +Uplifting [print_sbyte] best 18430 combination zp ZP_BYTE:5 [ print_sbyte::b#3 print_sbyte::b#1 print_sbyte::b#0 ] +Uplifting [print_byte] best 18422 combination reg byte a [ print_byte::$0 ] reg byte a [ print_byte::$2 ] +Uplifting [div16u] best 18422 combination zp ZP_WORD:40 [ div16u::return#2 ] zp ZP_WORD:72 [ div16u::return#0 ] Attempting to uplift remaining variables inzp ZP_BYTE:5 [ print_sbyte::b#3 print_sbyte::b#1 print_sbyte::b#0 ] -Uplifting [print_sbyte] best 18400 combination zp ZP_BYTE:5 [ print_sbyte::b#3 print_sbyte::b#1 print_sbyte::b#0 ] +Uplifting [print_sbyte] best 18422 combination zp ZP_BYTE:5 [ print_sbyte::b#3 print_sbyte::b#1 print_sbyte::b#0 ] Attempting to uplift remaining variables inzp ZP_BYTE:37 [ main::sb#0 ] -Uplifting [main] best 18400 combination zp ZP_BYTE:37 [ main::sb#0 ] +Uplifting [main] best 18422 combination zp ZP_BYTE:37 [ main::sb#0 ] +Attempting to uplift remaining variables inzp ZP_BYTE:56 [ mulu8_sel::return#10 ] +Uplifting [mulu8_sel] best 18416 combination reg byte a [ mulu8_sel::return#10 ] +Attempting to uplift remaining variables inzp ZP_BYTE:57 [ sin8s::x4#0 ] +Uplifting [sin8s] best 18412 combination reg byte a [ sin8s::x4#0 ] +Attempting to uplift remaining variables inzp ZP_BYTE:58 [ mulu8_sel::return#11 ] +Uplifting [mulu8_sel] best 18406 combination reg byte a [ mulu8_sel::return#11 ] +Attempting to uplift remaining variables inzp ZP_BYTE:59 [ sin8s::x5#0 ] +Uplifting [sin8s] best 18400 combination reg byte a [ sin8s::x5#0 ] Attempting to uplift remaining variables inzp ZP_BYTE:60 [ sin8s::x5_128#0 ] Uplifting [sin8s] best 18394 combination reg byte a [ sin8s::x5_128#0 ] Attempting to uplift remaining variables inzp ZP_BYTE:68 [ mulu8_sel::return#12 ] diff --git a/src/test/java/dk/camelot64/kickc/test/ref/sinusgen8b.log b/src/test/java/dk/camelot64/kickc/test/ref/sinusgen8b.log index 323784a8a..ee44f9756 100644 --- a/src/test/java/dk/camelot64/kickc/test/ref/sinusgen8b.log +++ b/src/test/java/dk/camelot64/kickc/test/ref/sinusgen8b.log @@ -9363,26 +9363,32 @@ Uplifting [print_str] best 34981 combination zp ZP_WORD:3 [ print_str::str#3 pri Uplifting [divr16u] best 34791 combination zp ZP_WORD:43 [ divr16u::rem#6 divr16u::rem#11 divr16u::rem#5 divr16u::rem#10 divr16u::rem#7 divr16u::rem#0 divr16u::rem#1 divr16u::rem#2 ] zp ZP_WORD:47 [ divr16u::quotient#3 divr16u::return#0 divr16u::quotient#1 divr16u::quotient#2 ] reg byte a [ divr16u::$1 ] reg byte a [ divr16u::$2 ] reg byte x [ divr16u::i#2 divr16u::i#1 ] zp ZP_WORD:45 [ divr16u::dividend#4 divr16u::dividend#6 divr16u::dividend#0 ] zp ZP_WORD:143 [ divr16u::return#3 ] zp ZP_WORD:147 [ divr16u::return#4 ] zp ZP_WORD:189 [ divr16u::return#2 ] zp ZP_WORD:41 [ divr16u::divisor#7 ] Uplifting [] best 34791 combination zp ZP_WORD:7 [ print_char_cursor#27 print_char_cursor#37 print_char_cursor#44 print_char_cursor#41 print_char_cursor#42 print_char_cursor#19 print_char_cursor#10 print_char_cursor#1 ] zp ZP_WORD:157 [ rem16u#1 ] Uplifting [main] best 34621 combination zp ZP_WORD:70 [ main::$3 ] zp ZP_WORD:72 [ main::$4 ] zp ZP_WORD:74 [ main::$5 ] zp ZP_WORD:76 [ main::sw#0 ] reg byte x [ main::i#2 main::i#1 ] reg byte a [ main::$6 ] zp ZP_BYTE:79 [ main::sd#0 ] zp ZP_BYTE:69 [ main::sb#0 ] -Uplift attempts [sin8s] 10000/5308416 (limiting to 10000) -Uplifting [sin8s] best 34494 combination zp ZP_WORD:57 [ sin8s::x#6 sin8s::x#4 sin8s::x#0 sin8s::x#1 sin8s::x#2 ] reg byte a [ sin8s::return#0 ] reg byte a [ sin8s::return#1 sin8s::return#5 sin8s::sinx#1 ] reg byte x [ sin8s::usinx#4 sin8s::usinx#1 sin8s::usinx#2 ] zp ZP_WORD:165 [ sin8s::$6 ] reg byte a [ sin8s::x2#0 ] reg byte a [ sin8s::x3_6#0 ] reg byte a [ sin8s::x4#0 ] reg byte a [ sin8s::x5#0 ] zp ZP_BYTE:179 [ sin8s::x5_128#0 ] zp ZP_BYTE:171 [ sin8s::x3#0 ] zp ZP_BYTE:167 [ sin8s::x1#0 ] zp ZP_BYTE:174 [ sin8s::usinx#0 ] zp ZP_BYTE:56 [ sin8s::isUpper#10 ] -Limited combination testing to 10000 combinations of 5308416 possible. -Uplifting [sin16s] best 34494 combination zp ZP_DWORD:20 [ sin16s::x#6 sin16s::x#4 sin16s::x#0 sin16s::x#1 sin16s::x#2 ] zp ZP_WORD:90 [ sin16s::return#0 ] zp ZP_WORD:24 [ sin16s::return#1 sin16s::return#5 sin16s::sinx#1 ] zp ZP_DWORD:94 [ sin16s::$6 ] zp ZP_WORD:102 [ sin16s::x2#0 ] zp ZP_WORD:110 [ sin16s::x3_6#0 ] zp ZP_WORD:116 [ sin16s::x4#0 ] zp ZP_WORD:120 [ sin16s::x5#0 ] zp ZP_WORD:122 [ sin16s::x5_128#0 ] zp ZP_WORD:106 [ sin16s::x3#0 ] zp ZP_WORD:124 [ sin16s::usinx#1 ] zp ZP_WORD:98 [ sin16s::x1#0 ] zp ZP_WORD:112 [ sin16s::usinx#0 ] zp ZP_BYTE:19 [ sin16s::isUpper#2 ] -Uplifting [mulu16_sel] best 34478 combination zp ZP_WORD:26 [ mulu16_sel::v1#5 mulu16_sel::v1#3 mulu16_sel::v1#4 mulu16_sel::v1#0 mulu16_sel::v1#1 mulu16_sel::v1#2 ] zp ZP_WORD:28 [ mulu16_sel::v2#5 mulu16_sel::v2#3 mulu16_sel::v2#4 mulu16_sel::v2#0 mulu16_sel::v2#1 ] zp ZP_WORD:100 [ mulu16_sel::return#0 ] zp ZP_WORD:104 [ mulu16_sel::return#1 ] zp ZP_WORD:108 [ mulu16_sel::return#2 ] zp ZP_WORD:114 [ mulu16_sel::return#10 ] zp ZP_WORD:118 [ mulu16_sel::return#11 ] zp ZP_DWORD:132 [ mulu16_sel::$0 ] zp ZP_DWORD:136 [ mulu16_sel::$1 ] zp ZP_WORD:140 [ mulu16_sel::return#12 ] reg byte x [ mulu16_sel::select#5 ] -Uplift attempts [mulu8_sel] 10000/196608 (limiting to 10000) -Uplifting [mulu8_sel] best 34418 combination reg byte x [ mulu8_sel::v1#5 mulu8_sel::v1#1 mulu8_sel::v1#2 mulu8_sel::v1#3 mulu8_sel::v1#4 mulu8_sel::v1#0 ] reg byte y [ mulu8_sel::v2#5 mulu8_sel::v2#1 mulu8_sel::v2#3 mulu8_sel::v2#4 mulu8_sel::v2#0 ] reg byte a [ mulu8_sel::return#0 ] reg byte a [ mulu8_sel::return#1 ] reg byte a [ mulu8_sel::return#2 ] reg byte a [ mulu8_sel::return#10 ] reg byte a [ mulu8_sel::return#11 ] zp ZP_WORD:183 [ mulu8_sel::$0 ] zp ZP_WORD:185 [ mulu8_sel::$1 ] zp ZP_BYTE:187 [ mulu8_sel::return#12 ] zp ZP_BYTE:63 [ mulu8_sel::select#5 ] -Limited combination testing to 10000 combinations of 196608 possible. -Uplifting [sin16s_gen] best 34418 combination zp ZP_WORD:92 [ sin16s_gen::$1 ] zp ZP_WORD:17 [ sin16s_gen::i#2 sin16s_gen::i#1 ] zp ZP_DWORD:11 [ sin16s_gen::x#2 sin16s_gen::x#1 ] zp ZP_WORD:15 [ sin16s_gen::sintab#2 sin16s_gen::sintab#0 ] zp ZP_DWORD:86 [ sin16s_gen::step#0 ] -Uplifting [sin8s_gen] best 34358 combination reg byte a [ sin8s_gen::$1 ] zp ZP_WORD:54 [ sin8s_gen::i#2 sin8s_gen::i#1 ] zp ZP_WORD:50 [ sin8s_gen::x#2 sin8s_gen::x#1 ] zp ZP_WORD:52 [ sin8s_gen::sintab#2 sin8s_gen::sintab#0 ] zp ZP_WORD:161 [ sin8s_gen::step#0 ] -Uplifting [print_cls] best 34358 combination zp ZP_WORD:9 [ print_cls::sc#2 print_cls::sc#1 ] -Uplifting [print_char] best 34346 combination reg byte a [ print_char::ch#3 print_char::ch#1 print_char::ch#2 ] -Uplifting [div32u16u] best 34346 combination zp ZP_DWORD:82 [ div32u16u::return#2 ] zp ZP_WORD:149 [ div32u16u::quotient_lo#0 ] zp ZP_DWORD:151 [ div32u16u::return#0 ] zp ZP_WORD:145 [ div32u16u::quotient_hi#0 ] -Uplifting [print_sbyte] best 34346 combination zp ZP_BYTE:5 [ print_sbyte::b#3 print_sbyte::b#1 print_sbyte::b#0 ] -Uplifting [print_byte] best 34338 combination reg byte a [ print_byte::$0 ] reg byte a [ print_byte::$2 ] -Uplifting [div16u] best 34338 combination zp ZP_WORD:159 [ div16u::return#2 ] zp ZP_WORD:191 [ div16u::return#0 ] +Uplifting [sin8s] best 34506 combination zp ZP_WORD:57 [ sin8s::x#6 sin8s::x#4 sin8s::x#0 sin8s::x#1 sin8s::x#2 ] reg byte a [ sin8s::return#0 ] reg byte a [ sin8s::return#1 sin8s::return#5 sin8s::sinx#1 ] reg byte x [ sin8s::usinx#4 sin8s::usinx#1 sin8s::usinx#2 ] zp ZP_WORD:165 [ sin8s::$6 ] reg byte a [ sin8s::x2#0 ] reg byte a [ sin8s::x3_6#0 ] zp ZP_BYTE:176 [ sin8s::x4#0 ] zp ZP_BYTE:178 [ sin8s::x5#0 ] zp ZP_BYTE:179 [ sin8s::x5_128#0 ] zp ZP_BYTE:171 [ sin8s::x3#0 ] zp ZP_BYTE:167 [ sin8s::x1#0 ] zp ZP_BYTE:174 [ sin8s::usinx#0 ] zp ZP_BYTE:56 [ sin8s::isUpper#10 ] +Limited combination testing to 1000 combinations of 5308416 possible. +Uplifting [sin16s] best 34506 combination zp ZP_DWORD:20 [ sin16s::x#6 sin16s::x#4 sin16s::x#0 sin16s::x#1 sin16s::x#2 ] zp ZP_WORD:90 [ sin16s::return#0 ] zp ZP_WORD:24 [ sin16s::return#1 sin16s::return#5 sin16s::sinx#1 ] zp ZP_DWORD:94 [ sin16s::$6 ] zp ZP_WORD:102 [ sin16s::x2#0 ] zp ZP_WORD:110 [ sin16s::x3_6#0 ] zp ZP_WORD:116 [ sin16s::x4#0 ] zp ZP_WORD:120 [ sin16s::x5#0 ] zp ZP_WORD:122 [ sin16s::x5_128#0 ] zp ZP_WORD:106 [ sin16s::x3#0 ] zp ZP_WORD:124 [ sin16s::usinx#1 ] zp ZP_WORD:98 [ sin16s::x1#0 ] zp ZP_WORD:112 [ sin16s::usinx#0 ] zp ZP_BYTE:19 [ sin16s::isUpper#2 ] +Uplifting [mulu16_sel] best 34490 combination zp ZP_WORD:26 [ mulu16_sel::v1#5 mulu16_sel::v1#3 mulu16_sel::v1#4 mulu16_sel::v1#0 mulu16_sel::v1#1 mulu16_sel::v1#2 ] zp ZP_WORD:28 [ mulu16_sel::v2#5 mulu16_sel::v2#3 mulu16_sel::v2#4 mulu16_sel::v2#0 mulu16_sel::v2#1 ] zp ZP_WORD:100 [ mulu16_sel::return#0 ] zp ZP_WORD:104 [ mulu16_sel::return#1 ] zp ZP_WORD:108 [ mulu16_sel::return#2 ] zp ZP_WORD:114 [ mulu16_sel::return#10 ] zp ZP_WORD:118 [ mulu16_sel::return#11 ] zp ZP_DWORD:132 [ mulu16_sel::$0 ] zp ZP_DWORD:136 [ mulu16_sel::$1 ] zp ZP_WORD:140 [ mulu16_sel::return#12 ] reg byte x [ mulu16_sel::select#5 ] +Uplifting [mulu8_sel] best 34440 combination reg byte x [ mulu8_sel::v1#5 mulu8_sel::v1#1 mulu8_sel::v1#2 mulu8_sel::v1#3 mulu8_sel::v1#4 mulu8_sel::v1#0 ] reg byte y [ mulu8_sel::v2#5 mulu8_sel::v2#1 mulu8_sel::v2#3 mulu8_sel::v2#4 mulu8_sel::v2#0 ] reg byte a [ mulu8_sel::return#0 ] reg byte a [ mulu8_sel::return#1 ] reg byte a [ mulu8_sel::return#2 ] zp ZP_BYTE:175 [ mulu8_sel::return#10 ] zp ZP_BYTE:177 [ mulu8_sel::return#11 ] zp ZP_WORD:183 [ mulu8_sel::$0 ] zp ZP_WORD:185 [ mulu8_sel::$1 ] zp ZP_BYTE:187 [ mulu8_sel::return#12 ] zp ZP_BYTE:63 [ mulu8_sel::select#5 ] +Limited combination testing to 1000 combinations of 196608 possible. +Uplifting [sin16s_gen] best 34440 combination zp ZP_WORD:92 [ sin16s_gen::$1 ] zp ZP_WORD:17 [ sin16s_gen::i#2 sin16s_gen::i#1 ] zp ZP_DWORD:11 [ sin16s_gen::x#2 sin16s_gen::x#1 ] zp ZP_WORD:15 [ sin16s_gen::sintab#2 sin16s_gen::sintab#0 ] zp ZP_DWORD:86 [ sin16s_gen::step#0 ] +Uplifting [sin8s_gen] best 34380 combination reg byte a [ sin8s_gen::$1 ] zp ZP_WORD:54 [ sin8s_gen::i#2 sin8s_gen::i#1 ] zp ZP_WORD:50 [ sin8s_gen::x#2 sin8s_gen::x#1 ] zp ZP_WORD:52 [ sin8s_gen::sintab#2 sin8s_gen::sintab#0 ] zp ZP_WORD:161 [ sin8s_gen::step#0 ] +Uplifting [print_cls] best 34380 combination zp ZP_WORD:9 [ print_cls::sc#2 print_cls::sc#1 ] +Uplifting [print_char] best 34368 combination reg byte a [ print_char::ch#3 print_char::ch#1 print_char::ch#2 ] +Uplifting [div32u16u] best 34368 combination zp ZP_DWORD:82 [ div32u16u::return#2 ] zp ZP_WORD:149 [ div32u16u::quotient_lo#0 ] zp ZP_DWORD:151 [ div32u16u::return#0 ] zp ZP_WORD:145 [ div32u16u::quotient_hi#0 ] +Uplifting [print_sbyte] best 34368 combination zp ZP_BYTE:5 [ print_sbyte::b#3 print_sbyte::b#1 print_sbyte::b#0 ] +Uplifting [print_byte] best 34360 combination reg byte a [ print_byte::$0 ] reg byte a [ print_byte::$2 ] +Uplifting [div16u] best 34360 combination zp ZP_WORD:159 [ div16u::return#2 ] zp ZP_WORD:191 [ div16u::return#0 ] Attempting to uplift remaining variables inzp ZP_BYTE:5 [ print_sbyte::b#3 print_sbyte::b#1 print_sbyte::b#0 ] -Uplifting [print_sbyte] best 34338 combination zp ZP_BYTE:5 [ print_sbyte::b#3 print_sbyte::b#1 print_sbyte::b#0 ] +Uplifting [print_sbyte] best 34360 combination zp ZP_BYTE:5 [ print_sbyte::b#3 print_sbyte::b#1 print_sbyte::b#0 ] Attempting to uplift remaining variables inzp ZP_BYTE:79 [ main::sd#0 ] -Uplifting [main] best 34338 combination zp ZP_BYTE:79 [ main::sd#0 ] +Uplifting [main] best 34360 combination zp ZP_BYTE:79 [ main::sd#0 ] +Attempting to uplift remaining variables inzp ZP_BYTE:175 [ mulu8_sel::return#10 ] +Uplifting [mulu8_sel] best 34354 combination reg byte a [ mulu8_sel::return#10 ] +Attempting to uplift remaining variables inzp ZP_BYTE:176 [ sin8s::x4#0 ] +Uplifting [sin8s] best 34350 combination reg byte a [ sin8s::x4#0 ] +Attempting to uplift remaining variables inzp ZP_BYTE:177 [ mulu8_sel::return#11 ] +Uplifting [mulu8_sel] best 34344 combination reg byte a [ mulu8_sel::return#11 ] +Attempting to uplift remaining variables inzp ZP_BYTE:178 [ sin8s::x5#0 ] +Uplifting [sin8s] best 34338 combination reg byte a [ sin8s::x5#0 ] Attempting to uplift remaining variables inzp ZP_BYTE:179 [ sin8s::x5_128#0 ] Uplifting [sin8s] best 34332 combination reg byte a [ sin8s::x5_128#0 ] Attempting to uplift remaining variables inzp ZP_BYTE:69 [ main::sb#0 ] diff --git a/src/test/java/dk/camelot64/kickc/test/ref/sinusgenscale8.log b/src/test/java/dk/camelot64/kickc/test/ref/sinusgenscale8.log index 5c71ba661..1f0a441d7 100644 --- a/src/test/java/dk/camelot64/kickc/test/ref/sinusgenscale8.log +++ b/src/test/java/dk/camelot64/kickc/test/ref/sinusgenscale8.log @@ -8852,27 +8852,33 @@ Uplifting [mul8u] best 24241 combination zp ZP_WORD:25 [ mul8u::res#2 mul8u::res Uplifting [] best 24241 combination zp ZP_WORD:8 [ print_line_cursor#12 print_line_cursor#23 print_line_cursor#1 ] zp ZP_WORD:16 [ print_char_cursor#92 print_char_cursor#102 print_char_cursor#62 print_char_cursor#97 print_char_cursor#94 print_char_cursor#96 print_char_cursor#17 print_char_cursor#2 print_char_cursor#121 print_char_cursor#1 ] Uplifting [print_str] best 24241 combination zp ZP_WORD:12 [ print_str::str#10 print_str::str#12 print_str::str#0 ] Uplifting [divr16u] best 24051 combination zp ZP_WORD:37 [ divr16u::rem#4 divr16u::rem#10 divr16u::rem#5 divr16u::rem#0 divr16u::rem#1 divr16u::rem#2 ] zp ZP_WORD:41 [ divr16u::quotient#3 divr16u::return#0 divr16u::quotient#1 divr16u::quotient#2 ] reg byte a [ divr16u::$1 ] reg byte a [ divr16u::$2 ] reg byte x [ divr16u::i#2 divr16u::i#1 ] zp ZP_WORD:39 [ divr16u::dividend#2 divr16u::dividend#0 ] zp ZP_WORD:88 [ divr16u::return#2 ] -Uplift attempts [sin8s] 10000/5308416 (limiting to 10000) -Uplifting [sin8s] best 23924 combination zp ZP_WORD:30 [ sin8s::x#6 sin8s::x#4 sin8s::x#2 sin8s::x#0 sin8s::x#1 ] reg byte a [ sin8s::return#2 ] reg byte a [ sin8s::return#0 sin8s::return#5 sin8s::sinx#1 ] reg byte x [ sin8s::usinx#4 sin8s::usinx#1 sin8s::usinx#2 ] zp ZP_WORD:66 [ sin8s::$6 ] reg byte a [ sin8s::x2#0 ] reg byte a [ sin8s::x3_6#0 ] reg byte a [ sin8s::x4#0 ] reg byte a [ sin8s::x5#0 ] zp ZP_BYTE:80 [ sin8s::x5_128#0 ] zp ZP_BYTE:72 [ sin8s::x3#0 ] zp ZP_BYTE:68 [ sin8s::x1#0 ] zp ZP_BYTE:75 [ sin8s::usinx#0 ] zp ZP_BYTE:29 [ sin8s::isUpper#10 ] -Limited combination testing to 10000 combinations of 5308416 possible. -Uplift attempts [mulu8_sel] 10000/196608 (limiting to 10000) -Uplifting [mulu8_sel] best 23864 combination reg byte x [ mulu8_sel::v1#5 mulu8_sel::v1#1 mulu8_sel::v1#2 mulu8_sel::v1#3 mulu8_sel::v1#4 mulu8_sel::v1#0 ] reg byte y [ mulu8_sel::v2#5 mulu8_sel::v2#1 mulu8_sel::v2#3 mulu8_sel::v2#4 mulu8_sel::v2#0 ] reg byte a [ mulu8_sel::return#0 ] reg byte a [ mulu8_sel::return#1 ] reg byte a [ mulu8_sel::return#2 ] reg byte a [ mulu8_sel::return#10 ] reg byte a [ mulu8_sel::return#11 ] zp ZP_WORD:83 [ mulu8_sel::$0 ] zp ZP_WORD:85 [ mulu8_sel::$1 ] zp ZP_BYTE:87 [ mulu8_sel::return#12 ] zp ZP_BYTE:36 [ mulu8_sel::select#5 ] -Limited combination testing to 10000 combinations of 196608 possible. -Uplifting [sin8u_table] best 23754 combination reg byte a [ sin8u_table::$21 ] zp ZP_WORD:6 [ sin8u_table::i#10 sin8u_table::i#1 ] zp ZP_WORD:2 [ sin8u_table::x#10 sin8u_table::x#1 ] zp ZP_WORD:4 [ sin8u_table::sintab#2 sin8u_table::sintab#1 ] zp ZP_BYTE:51 [ sin8u_table::sinx#0 ] zp ZP_WORD:55 [ sin8u_table::sinx_sc#0 ] reg byte x [ sin8u_table::sinx_tr#0 ] zp ZP_WORD:48 [ sin8u_table::step#0 ] -Uplifting [print_byte] best 23746 combination zp ZP_BYTE:10 [ print_byte::b#8 print_byte::b#10 print_byte::b#1 print_byte::b#2 print_byte::b#7 ] reg byte a [ print_byte::$0 ] reg byte a [ print_byte::$2 ] -Uplifting [mul8su] best 23702 combination zp ZP_WORD:53 [ mul8su::return#2 ] zp ZP_WORD:21 [ mul8su::m#2 mul8su::m#1 mul8su::m#0 ] reg byte a [ mul8su::$6 ] reg byte a [ mul8su::$10 ] reg byte y [ mul8su::a#0 ] -Uplifting [print_word] best 23702 combination zp ZP_WORD:18 [ print_word::w#3 print_word::w#5 print_word::w#2 print_word::w#1 ] -Uplifting [print_cls] best 23702 combination zp ZP_WORD:44 [ print_cls::sc#2 print_cls::sc#1 ] -Uplifting [print_char] best 23687 combination reg byte a [ print_char::ch#4 print_char::ch#2 print_char::ch#3 ] -Uplifting [print_sword] best 23687 combination zp ZP_WORD:14 [ print_sword::w#3 print_sword::w#1 print_sword::w#0 ] -Uplifting [print_sbyte] best 23687 combination zp ZP_BYTE:20 [ print_sbyte::b#3 print_sbyte::b#1 print_sbyte::b#0 ] -Uplifting [div16u] best 23687 combination zp ZP_WORD:46 [ div16u::return#2 ] zp ZP_WORD:90 [ div16u::return#0 ] -Uplifting [print_ln] best 23687 combination -Uplifting [main] best 23687 combination +Uplifting [sin8s] best 23936 combination zp ZP_WORD:30 [ sin8s::x#6 sin8s::x#4 sin8s::x#2 sin8s::x#0 sin8s::x#1 ] reg byte a [ sin8s::return#2 ] reg byte a [ sin8s::return#0 sin8s::return#5 sin8s::sinx#1 ] reg byte x [ sin8s::usinx#4 sin8s::usinx#1 sin8s::usinx#2 ] zp ZP_WORD:66 [ sin8s::$6 ] reg byte a [ sin8s::x2#0 ] reg byte a [ sin8s::x3_6#0 ] zp ZP_BYTE:77 [ sin8s::x4#0 ] zp ZP_BYTE:79 [ sin8s::x5#0 ] zp ZP_BYTE:80 [ sin8s::x5_128#0 ] zp ZP_BYTE:72 [ sin8s::x3#0 ] zp ZP_BYTE:68 [ sin8s::x1#0 ] zp ZP_BYTE:75 [ sin8s::usinx#0 ] zp ZP_BYTE:29 [ sin8s::isUpper#10 ] +Limited combination testing to 1000 combinations of 5308416 possible. +Uplifting [mulu8_sel] best 23886 combination reg byte x [ mulu8_sel::v1#5 mulu8_sel::v1#1 mulu8_sel::v1#2 mulu8_sel::v1#3 mulu8_sel::v1#4 mulu8_sel::v1#0 ] reg byte y [ mulu8_sel::v2#5 mulu8_sel::v2#1 mulu8_sel::v2#3 mulu8_sel::v2#4 mulu8_sel::v2#0 ] reg byte a [ mulu8_sel::return#0 ] reg byte a [ mulu8_sel::return#1 ] reg byte a [ mulu8_sel::return#2 ] zp ZP_BYTE:76 [ mulu8_sel::return#10 ] zp ZP_BYTE:78 [ mulu8_sel::return#11 ] zp ZP_WORD:83 [ mulu8_sel::$0 ] zp ZP_WORD:85 [ mulu8_sel::$1 ] zp ZP_BYTE:87 [ mulu8_sel::return#12 ] zp ZP_BYTE:36 [ mulu8_sel::select#5 ] +Limited combination testing to 1000 combinations of 196608 possible. +Uplifting [sin8u_table] best 23776 combination reg byte a [ sin8u_table::$21 ] zp ZP_WORD:6 [ sin8u_table::i#10 sin8u_table::i#1 ] zp ZP_WORD:2 [ sin8u_table::x#10 sin8u_table::x#1 ] zp ZP_WORD:4 [ sin8u_table::sintab#2 sin8u_table::sintab#1 ] zp ZP_BYTE:51 [ sin8u_table::sinx#0 ] zp ZP_WORD:55 [ sin8u_table::sinx_sc#0 ] reg byte x [ sin8u_table::sinx_tr#0 ] zp ZP_WORD:48 [ sin8u_table::step#0 ] +Uplifting [print_byte] best 23768 combination zp ZP_BYTE:10 [ print_byte::b#8 print_byte::b#10 print_byte::b#1 print_byte::b#2 print_byte::b#7 ] reg byte a [ print_byte::$0 ] reg byte a [ print_byte::$2 ] +Uplifting [mul8su] best 23724 combination zp ZP_WORD:53 [ mul8su::return#2 ] zp ZP_WORD:21 [ mul8su::m#2 mul8su::m#1 mul8su::m#0 ] reg byte a [ mul8su::$6 ] reg byte a [ mul8su::$10 ] reg byte y [ mul8su::a#0 ] +Uplifting [print_word] best 23724 combination zp ZP_WORD:18 [ print_word::w#3 print_word::w#5 print_word::w#2 print_word::w#1 ] +Uplifting [print_cls] best 23724 combination zp ZP_WORD:44 [ print_cls::sc#2 print_cls::sc#1 ] +Uplifting [print_char] best 23709 combination reg byte a [ print_char::ch#4 print_char::ch#2 print_char::ch#3 ] +Uplifting [print_sword] best 23709 combination zp ZP_WORD:14 [ print_sword::w#3 print_sword::w#1 print_sword::w#0 ] +Uplifting [print_sbyte] best 23709 combination zp ZP_BYTE:20 [ print_sbyte::b#3 print_sbyte::b#1 print_sbyte::b#0 ] +Uplifting [div16u] best 23709 combination zp ZP_WORD:46 [ div16u::return#2 ] zp ZP_WORD:90 [ div16u::return#0 ] +Uplifting [print_ln] best 23709 combination +Uplifting [main] best 23709 combination Attempting to uplift remaining variables inzp ZP_BYTE:10 [ print_byte::b#8 print_byte::b#10 print_byte::b#1 print_byte::b#2 print_byte::b#7 ] -Uplifting [print_byte] best 23687 combination zp ZP_BYTE:10 [ print_byte::b#8 print_byte::b#10 print_byte::b#1 print_byte::b#2 print_byte::b#7 ] +Uplifting [print_byte] best 23709 combination zp ZP_BYTE:10 [ print_byte::b#8 print_byte::b#10 print_byte::b#1 print_byte::b#2 print_byte::b#7 ] Attempting to uplift remaining variables inzp ZP_BYTE:20 [ print_sbyte::b#3 print_sbyte::b#1 print_sbyte::b#0 ] -Uplifting [print_sbyte] best 23687 combination zp ZP_BYTE:20 [ print_sbyte::b#3 print_sbyte::b#1 print_sbyte::b#0 ] +Uplifting [print_sbyte] best 23709 combination zp ZP_BYTE:20 [ print_sbyte::b#3 print_sbyte::b#1 print_sbyte::b#0 ] +Attempting to uplift remaining variables inzp ZP_BYTE:76 [ mulu8_sel::return#10 ] +Uplifting [mulu8_sel] best 23703 combination reg byte a [ mulu8_sel::return#10 ] +Attempting to uplift remaining variables inzp ZP_BYTE:77 [ sin8s::x4#0 ] +Uplifting [sin8s] best 23699 combination reg byte a [ sin8s::x4#0 ] +Attempting to uplift remaining variables inzp ZP_BYTE:78 [ mulu8_sel::return#11 ] +Uplifting [mulu8_sel] best 23693 combination reg byte a [ mulu8_sel::return#11 ] +Attempting to uplift remaining variables inzp ZP_BYTE:79 [ sin8s::x5#0 ] +Uplifting [sin8s] best 23687 combination reg byte a [ sin8s::x5#0 ] Attempting to uplift remaining variables inzp ZP_BYTE:80 [ sin8s::x5_128#0 ] Uplifting [sin8s] best 23681 combination reg byte a [ sin8s::x5_128#0 ] Attempting to uplift remaining variables inzp ZP_BYTE:51 [ sin8u_table::sinx#0 ] diff --git a/src/test/java/dk/camelot64/kickc/test/ref/summin.log b/src/test/java/dk/camelot64/kickc/test/ref/summin.log index 8cb125975..693fee6a1 100644 --- a/src/test/java/dk/camelot64/kickc/test/ref/summin.log +++ b/src/test/java/dk/camelot64/kickc/test/ref/summin.log @@ -604,11 +604,15 @@ Uplift Scope [sum] 4: zp ZP_BYTE:4 [ sum::return#0 ] 4: zp ZP_BYTE:6 [ sum::retu Uplift Scope [main] 4: zp ZP_BYTE:10 [ main::$3 ] 4: zp ZP_BYTE:11 [ main::s4#0 ] 2: zp ZP_BYTE:9 [ main::s3#0 ] 1: zp ZP_BYTE:7 [ main::s2#0 ] 0.57: zp ZP_BYTE:5 [ main::s1#0 ] Uplift Scope [] -Uplifting [sum] best 115 combination reg byte a [ sum::return#0 ] reg byte a [ sum::return#1 ] reg byte a [ sum::return#2 ] reg byte x [ sum::a#3 ] reg byte a [ sum::b#3 ] reg byte a [ sum::return#3 ] -Uplifting [main] best 101 combination reg byte a [ main::$3 ] reg byte a [ main::s4#0 ] zp ZP_BYTE:9 [ main::s3#0 ] reg byte y [ main::s2#0 ] zp ZP_BYTE:5 [ main::s1#0 ] -Uplifting [] best 101 combination +Uplifting [sum] best 127 combination reg byte a [ sum::return#0 ] reg byte a [ sum::return#1 ] reg byte a [ sum::return#2 ] reg byte x [ sum::a#3 ] reg byte a [ sum::b#3 ] zp ZP_BYTE:12 [ sum::return#3 ] +Limited combination testing to 1000 combinations of 4096 possible. +Uplifting [main] best 113 combination reg byte a [ main::$3 ] reg byte a [ main::s4#0 ] zp ZP_BYTE:9 [ main::s3#0 ] reg byte y [ main::s2#0 ] zp ZP_BYTE:5 [ main::s1#0 ] +Limited combination testing to 1000 combinations of 1024 possible. +Uplifting [] best 113 combination Attempting to uplift remaining variables inzp ZP_BYTE:9 [ main::s3#0 ] -Uplifting [main] best 101 combination zp ZP_BYTE:9 [ main::s3#0 ] +Uplifting [main] best 113 combination zp ZP_BYTE:9 [ main::s3#0 ] +Attempting to uplift remaining variables inzp ZP_BYTE:12 [ sum::return#3 ] +Uplifting [sum] best 101 combination reg byte a [ sum::return#3 ] Attempting to uplift remaining variables inzp ZP_BYTE:5 [ main::s1#0 ] Uplifting [main] best 101 combination zp ZP_BYTE:5 [ main::s1#0 ] Allocated (was zp ZP_BYTE:5) zp ZP_BYTE:2 [ main::s1#0 ] diff --git a/src/test/java/dk/camelot64/kickc/test/ref/test-division.asm b/src/test/java/dk/camelot64/kickc/test/ref/test-division.asm index 5170b92b1..ceec41a17 100644 --- a/src/test/java/dk/camelot64/kickc/test/ref/test-division.asm +++ b/src/test/java/dk/camelot64/kickc/test/ref/test-division.asm @@ -326,8 +326,8 @@ test_8s: { sta dividend lda divisors,y sta divisor - lda dividend - ldx divisor + ldy dividend + tax jsr div8s sta res lda print_line_cursor @@ -388,8 +388,9 @@ print_sbyte: { } div8s: { .label neg = $10 - cmp #0 + cpy #0 bpl b16 + tya eor #$ff clc adc #1 @@ -428,7 +429,6 @@ div8s: { adc #1 jmp breturn b16: - tay lda #0 sta neg jmp b2 diff --git a/src/test/java/dk/camelot64/kickc/test/ref/test-division.log b/src/test/java/dk/camelot64/kickc/test/ref/test-division.log index 6bb4cf4c3..bbd9d2f8d 100644 --- a/src/test/java/dk/camelot64/kickc/test/ref/test-division.log +++ b/src/test/java/dk/camelot64/kickc/test/ref/test-division.log @@ -9354,59 +9354,66 @@ Uplift Scope [print_ln] Uplift Scope [main] Uplifting [divr16u] best 44804 combination zp ZP_WORD:28 [ divr16u::rem#4 divr16u::rem#10 divr16u::rem#5 divr16u::rem#0 divr16u::rem#1 divr16u::rem#2 ] zp ZP_WORD:32 [ divr16u::quotient#3 divr16u::return#0 divr16u::quotient#1 divr16u::quotient#2 ] reg byte a [ divr16u::$1 ] reg byte a [ divr16u::$2 ] reg byte x [ divr16u::i#2 divr16u::i#1 ] zp ZP_WORD:30 [ divr16u::dividend#2 divr16u::dividend#1 divr16u::dividend#0 ] zp ZP_WORD:74 [ divr16u::divisor#0 ] zp ZP_WORD:76 [ divr16u::return#2 ] -Uplifting [divr8u] best 42995 combination reg byte y [ divr8u::rem#4 divr8u::rem#10 divr8u::rem#5 divr8u::rem#1 divr8u::rem#2 divr8u::rem#3 ] zp ZP_BYTE:46 [ divr8u::quotient#3 divr8u::return#1 divr8u::quotient#1 divr8u::quotient#2 ] reg byte a [ divr8u::$1 ] reg byte x [ divr8u::i#2 divr8u::i#1 ] zp ZP_BYTE:45 [ divr8u::dividend#2 divr8u::dividend#0 divr8u::dividend#1 ] zp ZP_BYTE:94 [ divr8u::divisor#0 ] reg byte a [ divr8u::return#0 ] -Uplifting [] best 42928 combination zp ZP_WORD:11 [ print_char_cursor#80 print_char_cursor#133 print_char_cursor#130 print_char_cursor#132 print_char_cursor#128 print_char_cursor#129 print_char_cursor#155 print_char_cursor#126 print_char_cursor#17 print_char_cursor#162 print_char_cursor#135 print_char_cursor#131 print_char_cursor#1 print_char_cursor#179 print_char_cursor#185 ] zp ZP_WORD:3 [ print_line_cursor#20 print_line_cursor#39 print_line_cursor#1 print_line_cursor#41 ] zp ZP_WORD:22 [ rem16s#3 rem16s#31 rem16s#1 ] reg byte x [ rem8s#3 rem8s#32 rem8s#1 ] reg byte x [ rem8u#17 ] zp ZP_WORD:82 [ rem16u#1 ] -Uplifting [print_str] best 42928 combination zp ZP_WORD:13 [ print_str::str#13 print_str::str#15 print_str::str#0 ] -Uplifting [print_byte] best 42920 combination zp ZP_BYTE:9 [ print_byte::b#7 print_byte::b#9 print_byte::b#1 print_byte::b#2 print_byte::b#3 print_byte::b#4 print_byte::b#5 print_byte::b#6 ] reg byte a [ print_byte::$0 ] reg byte a [ print_byte::$2 ] -Uplifting [print_word] best 42920 combination zp ZP_WORD:7 [ print_word::w#5 print_word::w#7 print_word::w#1 print_word::w#2 print_word::w#3 print_word::w#4 ] -Uplifting [print_sword] best 42920 combination zp ZP_WORD:5 [ print_sword::w#6 print_sword::w#5 print_sword::w#1 print_sword::w#2 print_sword::w#3 print_sword::w#4 print_sword::w#0 ] -Uplifting [print_sbyte] best 42920 combination zp ZP_BYTE:36 [ print_sbyte::b#6 print_sbyte::b#5 print_sbyte::b#1 print_sbyte::b#2 print_sbyte::b#3 print_sbyte::b#4 print_sbyte::b#0 ] -Uplifting [div8u] best 42746 combination reg byte x [ div8u::divisor#2 div8u::divisor#0 div8u::divisor#1 ] reg byte a [ div8u::dividend#2 div8u::dividend#0 div8u::dividend#1 ] reg byte a [ div8u::return#3 ] reg byte a [ div8u::return#2 ] reg byte a [ div8u::return#0 ] -Uplifting [div16u] best 42746 combination zp ZP_WORD:26 [ div16u::divisor#2 div16u::divisor#0 div16u::divisor#1 ] zp ZP_WORD:24 [ div16u::dividend#2 div16u::dividend#0 div16u::dividend#1 ] zp ZP_WORD:103 [ div16u::return#3 ] zp ZP_WORD:70 [ div16u::return#2 ] zp ZP_WORD:78 [ div16u::return#0 ] -Uplift attempts [div8s] 10000/248832 (limiting to 10000) -Uplifting [div8s] best 42556 combination reg byte a [ div8s::return#3 ] reg byte x [ div8s::divisoru#3 div8s::divisoru#4 div8s::divisoru#5 ] reg byte a [ div8s::return#2 div8s::return#6 div8s::return#0 ] reg byte y [ div8s::dividendu#3 div8s::dividendu#7 div8s::dividendu#8 ] reg byte a [ div8s::dividend#0 ] zp ZP_BYTE:39 [ div8s::neg#4 div8s::neg#3 div8s::neg#2 ] reg byte x [ div8s::divisor#0 ] reg byte a [ div8s::$2 ] zp ZP_BYTE:91 [ div8s::$7 ] zp ZP_BYTE:93 [ div8s::resultu#0 ] -Limited combination testing to 10000 combinations of 248832 possible. -Uplifting [div16s] best 42547 combination zp ZP_WORD:60 [ div16s::return#3 ] zp ZP_WORD:17 [ div16s::divisoru#3 div16s::divisoru#4 div16s::divisoru#5 ] zp ZP_WORD:20 [ div16s::return#2 div16s::return#6 div16s::return#0 ] zp ZP_WORD:15 [ div16s::dividendu#3 div16s::dividendu#7 div16s::dividendu#8 ] zp ZP_WORD:56 [ div16s::dividend#0 ] reg byte y [ div16s::neg#4 div16s::neg#3 div16s::neg#2 ] zp ZP_WORD:58 [ div16s::divisor#0 ] zp ZP_WORD:66 [ div16s::$2 ] zp ZP_WORD:68 [ div16s::$7 ] zp ZP_WORD:72 [ div16s::resultu#0 ] -Uplifting [print_cls] best 42547 combination zp ZP_WORD:50 [ print_cls::sc#2 print_cls::sc#1 ] -Uplifting [test_16u] best 42547 combination zp ZP_BYTE:48 [ test_16u::i#10 test_16u::i#1 ] zp ZP_WORD:99 [ test_16u::dividend#0 ] zp ZP_WORD:101 [ test_16u::divisor#0 ] zp ZP_WORD:105 [ test_16u::res#0 ] -Uplifting [test_8s] best 42547 combination zp ZP_BYTE:35 [ test_8s::i#10 test_8s::i#1 ] zp ZP_BYTE:84 [ test_8s::dividend#0 ] zp ZP_BYTE:85 [ test_8s::divisor#0 ] zp ZP_BYTE:89 [ test_8s::res#0 ] -Uplifting [test_16s] best 42547 combination zp ZP_BYTE:2 [ test_16s::i#10 test_16s::i#1 ] zp ZP_WORD:52 [ test_16s::dividend#0 ] zp ZP_WORD:54 [ test_16s::divisor#0 ] zp ZP_WORD:62 [ test_16s::res#0 ] -Uplifting [test_8u] best 42547 combination zp ZP_BYTE:49 [ test_8u::i#10 test_8u::i#1 ] zp ZP_BYTE:107 [ test_8u::dividend#0 ] zp ZP_BYTE:108 [ test_8u::divisor#0 ] zp ZP_BYTE:110 [ test_8u::res#0 ] -Uplifting [print_char] best 42532 combination reg byte a [ print_char::ch#4 print_char::ch#2 print_char::ch#3 ] -Uplifting [print_ln] best 42532 combination -Uplifting [main] best 42532 combination +Uplifting [divr8u] best 43001 combination reg byte y [ divr8u::rem#4 divr8u::rem#10 divr8u::rem#5 divr8u::rem#1 divr8u::rem#2 divr8u::rem#3 ] zp ZP_BYTE:46 [ divr8u::quotient#3 divr8u::return#1 divr8u::quotient#1 divr8u::quotient#2 ] reg byte a [ divr8u::$1 ] reg byte x [ divr8u::i#2 divr8u::i#1 ] zp ZP_BYTE:45 [ divr8u::dividend#2 divr8u::dividend#0 divr8u::dividend#1 ] zp ZP_BYTE:94 [ divr8u::divisor#0 ] zp ZP_BYTE:95 [ divr8u::return#0 ] +Limited combination testing to 1000 combinations of 3888 possible. +Uplifting [] best 42934 combination zp ZP_WORD:11 [ print_char_cursor#80 print_char_cursor#133 print_char_cursor#130 print_char_cursor#132 print_char_cursor#128 print_char_cursor#129 print_char_cursor#155 print_char_cursor#126 print_char_cursor#17 print_char_cursor#162 print_char_cursor#135 print_char_cursor#131 print_char_cursor#1 print_char_cursor#179 print_char_cursor#185 ] zp ZP_WORD:3 [ print_line_cursor#20 print_line_cursor#39 print_line_cursor#1 print_line_cursor#41 ] zp ZP_WORD:22 [ rem16s#3 rem16s#31 rem16s#1 ] reg byte x [ rem8s#3 rem8s#32 rem8s#1 ] reg byte x [ rem8u#17 ] zp ZP_WORD:82 [ rem16u#1 ] +Uplifting [print_str] best 42934 combination zp ZP_WORD:13 [ print_str::str#13 print_str::str#15 print_str::str#0 ] +Uplifting [print_byte] best 42926 combination zp ZP_BYTE:9 [ print_byte::b#7 print_byte::b#9 print_byte::b#1 print_byte::b#2 print_byte::b#3 print_byte::b#4 print_byte::b#5 print_byte::b#6 ] reg byte a [ print_byte::$0 ] reg byte a [ print_byte::$2 ] +Uplifting [print_word] best 42926 combination zp ZP_WORD:7 [ print_word::w#5 print_word::w#7 print_word::w#1 print_word::w#2 print_word::w#3 print_word::w#4 ] +Uplifting [print_sword] best 42926 combination zp ZP_WORD:5 [ print_sword::w#6 print_sword::w#5 print_sword::w#1 print_sword::w#2 print_sword::w#3 print_sword::w#4 print_sword::w#0 ] +Uplifting [print_sbyte] best 42926 combination zp ZP_BYTE:36 [ print_sbyte::b#6 print_sbyte::b#5 print_sbyte::b#1 print_sbyte::b#2 print_sbyte::b#3 print_sbyte::b#4 print_sbyte::b#0 ] +Uplifting [div8u] best 42752 combination reg byte x [ div8u::divisor#2 div8u::divisor#0 div8u::divisor#1 ] reg byte a [ div8u::dividend#2 div8u::dividend#0 div8u::dividend#1 ] reg byte a [ div8u::return#3 ] reg byte a [ div8u::return#2 ] reg byte a [ div8u::return#0 ] +Limited combination testing to 1000 combinations of 1024 possible. +Uplifting [div16u] best 42752 combination zp ZP_WORD:26 [ div16u::divisor#2 div16u::divisor#0 div16u::divisor#1 ] zp ZP_WORD:24 [ div16u::dividend#2 div16u::dividend#0 div16u::dividend#1 ] zp ZP_WORD:103 [ div16u::return#3 ] zp ZP_WORD:70 [ div16u::return#2 ] zp ZP_WORD:78 [ div16u::return#0 ] +Uplifting [div8s] best 42603 combination reg byte a [ div8s::return#3 ] reg byte x [ div8s::divisoru#3 div8s::divisoru#4 div8s::divisoru#5 ] reg byte a [ div8s::return#2 div8s::return#6 div8s::return#0 ] reg byte y [ div8s::dividendu#3 div8s::dividendu#7 div8s::dividendu#8 ] reg byte y [ div8s::dividend#0 ] zp ZP_BYTE:39 [ div8s::neg#4 div8s::neg#3 div8s::neg#2 ] zp ZP_BYTE:87 [ div8s::divisor#0 ] zp ZP_BYTE:90 [ div8s::$2 ] zp ZP_BYTE:91 [ div8s::$7 ] zp ZP_BYTE:93 [ div8s::resultu#0 ] +Limited combination testing to 1000 combinations of 248832 possible. +Uplifting [div16s] best 42594 combination zp ZP_WORD:60 [ div16s::return#3 ] zp ZP_WORD:17 [ div16s::divisoru#3 div16s::divisoru#4 div16s::divisoru#5 ] zp ZP_WORD:20 [ div16s::return#2 div16s::return#6 div16s::return#0 ] zp ZP_WORD:15 [ div16s::dividendu#3 div16s::dividendu#7 div16s::dividendu#8 ] zp ZP_WORD:56 [ div16s::dividend#0 ] reg byte y [ div16s::neg#4 div16s::neg#3 div16s::neg#2 ] zp ZP_WORD:58 [ div16s::divisor#0 ] zp ZP_WORD:66 [ div16s::$2 ] zp ZP_WORD:68 [ div16s::$7 ] zp ZP_WORD:72 [ div16s::resultu#0 ] +Uplifting [print_cls] best 42594 combination zp ZP_WORD:50 [ print_cls::sc#2 print_cls::sc#1 ] +Uplifting [test_16u] best 42594 combination zp ZP_BYTE:48 [ test_16u::i#10 test_16u::i#1 ] zp ZP_WORD:99 [ test_16u::dividend#0 ] zp ZP_WORD:101 [ test_16u::divisor#0 ] zp ZP_WORD:105 [ test_16u::res#0 ] +Uplifting [test_8s] best 42594 combination zp ZP_BYTE:35 [ test_8s::i#10 test_8s::i#1 ] zp ZP_BYTE:84 [ test_8s::dividend#0 ] zp ZP_BYTE:85 [ test_8s::divisor#0 ] zp ZP_BYTE:89 [ test_8s::res#0 ] +Uplifting [test_16s] best 42594 combination zp ZP_BYTE:2 [ test_16s::i#10 test_16s::i#1 ] zp ZP_WORD:52 [ test_16s::dividend#0 ] zp ZP_WORD:54 [ test_16s::divisor#0 ] zp ZP_WORD:62 [ test_16s::res#0 ] +Uplifting [test_8u] best 42594 combination zp ZP_BYTE:49 [ test_8u::i#10 test_8u::i#1 ] zp ZP_BYTE:107 [ test_8u::dividend#0 ] zp ZP_BYTE:108 [ test_8u::divisor#0 ] zp ZP_BYTE:110 [ test_8u::res#0 ] +Uplifting [print_char] best 42579 combination reg byte a [ print_char::ch#4 print_char::ch#2 print_char::ch#3 ] +Uplifting [print_ln] best 42579 combination +Uplifting [main] best 42579 combination Attempting to uplift remaining variables inzp ZP_BYTE:46 [ divr8u::quotient#3 divr8u::return#1 divr8u::quotient#1 divr8u::quotient#2 ] -Uplifting [divr8u] best 42532 combination zp ZP_BYTE:46 [ divr8u::quotient#3 divr8u::return#1 divr8u::quotient#1 divr8u::quotient#2 ] +Uplifting [divr8u] best 42579 combination zp ZP_BYTE:46 [ divr8u::quotient#3 divr8u::return#1 divr8u::quotient#1 divr8u::quotient#2 ] Attempting to uplift remaining variables inzp ZP_BYTE:9 [ print_byte::b#7 print_byte::b#9 print_byte::b#1 print_byte::b#2 print_byte::b#3 print_byte::b#4 print_byte::b#5 print_byte::b#6 ] -Uplifting [print_byte] best 42532 combination zp ZP_BYTE:9 [ print_byte::b#7 print_byte::b#9 print_byte::b#1 print_byte::b#2 print_byte::b#3 print_byte::b#4 print_byte::b#5 print_byte::b#6 ] +Uplifting [print_byte] best 42579 combination zp ZP_BYTE:9 [ print_byte::b#7 print_byte::b#9 print_byte::b#1 print_byte::b#2 print_byte::b#3 print_byte::b#4 print_byte::b#5 print_byte::b#6 ] Attempting to uplift remaining variables inzp ZP_BYTE:36 [ print_sbyte::b#6 print_sbyte::b#5 print_sbyte::b#1 print_sbyte::b#2 print_sbyte::b#3 print_sbyte::b#4 print_sbyte::b#0 ] -Uplifting [print_sbyte] best 42532 combination zp ZP_BYTE:36 [ print_sbyte::b#6 print_sbyte::b#5 print_sbyte::b#1 print_sbyte::b#2 print_sbyte::b#3 print_sbyte::b#4 print_sbyte::b#0 ] +Uplifting [print_sbyte] best 42579 combination zp ZP_BYTE:36 [ print_sbyte::b#6 print_sbyte::b#5 print_sbyte::b#1 print_sbyte::b#2 print_sbyte::b#3 print_sbyte::b#4 print_sbyte::b#0 ] Attempting to uplift remaining variables inzp ZP_BYTE:45 [ divr8u::dividend#2 divr8u::dividend#0 divr8u::dividend#1 ] -Uplifting [divr8u] best 42532 combination zp ZP_BYTE:45 [ divr8u::dividend#2 divr8u::dividend#0 divr8u::dividend#1 ] +Uplifting [divr8u] best 42579 combination zp ZP_BYTE:45 [ divr8u::dividend#2 divr8u::dividend#0 divr8u::dividend#1 ] Attempting to uplift remaining variables inzp ZP_BYTE:2 [ test_16s::i#10 test_16s::i#1 ] -Uplifting [test_16s] best 42532 combination zp ZP_BYTE:2 [ test_16s::i#10 test_16s::i#1 ] +Uplifting [test_16s] best 42579 combination zp ZP_BYTE:2 [ test_16s::i#10 test_16s::i#1 ] Attempting to uplift remaining variables inzp ZP_BYTE:35 [ test_8s::i#10 test_8s::i#1 ] -Uplifting [test_8s] best 42532 combination zp ZP_BYTE:35 [ test_8s::i#10 test_8s::i#1 ] +Uplifting [test_8s] best 42579 combination zp ZP_BYTE:35 [ test_8s::i#10 test_8s::i#1 ] Attempting to uplift remaining variables inzp ZP_BYTE:48 [ test_16u::i#10 test_16u::i#1 ] -Uplifting [test_16u] best 42532 combination zp ZP_BYTE:48 [ test_16u::i#10 test_16u::i#1 ] +Uplifting [test_16u] best 42579 combination zp ZP_BYTE:48 [ test_16u::i#10 test_16u::i#1 ] Attempting to uplift remaining variables inzp ZP_BYTE:49 [ test_8u::i#10 test_8u::i#1 ] -Uplifting [test_8u] best 42532 combination zp ZP_BYTE:49 [ test_8u::i#10 test_8u::i#1 ] +Uplifting [test_8u] best 42579 combination zp ZP_BYTE:49 [ test_8u::i#10 test_8u::i#1 ] Attempting to uplift remaining variables inzp ZP_BYTE:94 [ divr8u::divisor#0 ] -Uplifting [divr8u] best 42532 combination zp ZP_BYTE:94 [ divr8u::divisor#0 ] +Uplifting [divr8u] best 42579 combination zp ZP_BYTE:94 [ divr8u::divisor#0 ] Attempting to uplift remaining variables inzp ZP_BYTE:84 [ test_8s::dividend#0 ] -Uplifting [test_8s] best 42532 combination zp ZP_BYTE:84 [ test_8s::dividend#0 ] +Uplifting [test_8s] best 42579 combination zp ZP_BYTE:84 [ test_8s::dividend#0 ] Attempting to uplift remaining variables inzp ZP_BYTE:107 [ test_8u::dividend#0 ] -Uplifting [test_8u] best 42532 combination zp ZP_BYTE:107 [ test_8u::dividend#0 ] +Uplifting [test_8u] best 42579 combination zp ZP_BYTE:107 [ test_8u::dividend#0 ] Attempting to uplift remaining variables inzp ZP_BYTE:39 [ div8s::neg#4 div8s::neg#3 div8s::neg#2 ] -Uplifting [div8s] best 42532 combination zp ZP_BYTE:39 [ div8s::neg#4 div8s::neg#3 div8s::neg#2 ] +Uplifting [div8s] best 42579 combination zp ZP_BYTE:39 [ div8s::neg#4 div8s::neg#3 div8s::neg#2 ] +Attempting to uplift remaining variables inzp ZP_BYTE:95 [ divr8u::return#0 ] +Uplifting [divr8u] best 42573 combination reg byte a [ divr8u::return#0 ] Attempting to uplift remaining variables inzp ZP_BYTE:108 [ test_8u::divisor#0 ] -Uplifting [test_8u] best 42532 combination zp ZP_BYTE:108 [ test_8u::divisor#0 ] +Uplifting [test_8u] best 42573 combination zp ZP_BYTE:108 [ test_8u::divisor#0 ] Attempting to uplift remaining variables inzp ZP_BYTE:85 [ test_8s::divisor#0 ] -Uplifting [test_8s] best 42532 combination zp ZP_BYTE:85 [ test_8s::divisor#0 ] +Uplifting [test_8s] best 42573 combination zp ZP_BYTE:85 [ test_8s::divisor#0 ] Attempting to uplift remaining variables inzp ZP_BYTE:110 [ test_8u::res#0 ] -Uplifting [test_8u] best 42532 combination zp ZP_BYTE:110 [ test_8u::res#0 ] +Uplifting [test_8u] best 42573 combination zp ZP_BYTE:110 [ test_8u::res#0 ] Attempting to uplift remaining variables inzp ZP_BYTE:89 [ test_8s::res#0 ] -Uplifting [test_8s] best 42532 combination zp ZP_BYTE:89 [ test_8s::res#0 ] +Uplifting [test_8s] best 42573 combination zp ZP_BYTE:89 [ test_8s::res#0 ] +Attempting to uplift remaining variables inzp ZP_BYTE:87 [ div8s::divisor#0 ] +Uplifting [div8s] best 42536 combination reg byte x [ div8s::divisor#0 ] +Attempting to uplift remaining variables inzp ZP_BYTE:90 [ div8s::$2 ] +Uplifting [div8s] best 42532 combination reg byte a [ div8s::$2 ] Attempting to uplift remaining variables inzp ZP_BYTE:91 [ div8s::$7 ] Uplifting [div8s] best 42528 combination reg byte x [ div8s::$7 ] Attempting to uplift remaining variables inzp ZP_BYTE:93 [ div8s::resultu#0 ] @@ -10227,8 +10234,8 @@ test_8s: { ldy i lda divisors,y sta divisor - //SEG270 [135] (signed byte) div8s::dividend#0 ← (signed byte) test_8s::dividend#0 [ print_line_cursor#1 test_8s::i#10 test_8s::dividend#0 test_8s::divisor#0 div8s::dividend#0 ] ( main:2::test_8s:11 [ print_line_cursor#1 test_8s::i#10 test_8s::dividend#0 test_8s::divisor#0 div8s::dividend#0 ] ) -- vbsaa=vbsz1 - lda dividend + //SEG270 [135] (signed byte) div8s::dividend#0 ← (signed byte) test_8s::dividend#0 [ print_line_cursor#1 test_8s::i#10 test_8s::dividend#0 test_8s::divisor#0 div8s::dividend#0 ] ( main:2::test_8s:11 [ print_line_cursor#1 test_8s::i#10 test_8s::dividend#0 test_8s::divisor#0 div8s::dividend#0 ] ) -- vbsyy=vbsz1 + ldy dividend //SEG271 [136] (signed byte) div8s::divisor#0 ← (signed byte) test_8s::divisor#0 [ print_line_cursor#1 test_8s::i#10 test_8s::dividend#0 test_8s::divisor#0 div8s::dividend#0 div8s::divisor#0 ] ( main:2::test_8s:11 [ print_line_cursor#1 test_8s::i#10 test_8s::dividend#0 test_8s::divisor#0 div8s::dividend#0 div8s::divisor#0 ] ) -- vbsxx=vbsz1 ldx divisor //SEG272 [137] call div8s param-assignment [ print_line_cursor#1 test_8s::i#10 test_8s::dividend#0 test_8s::divisor#0 div8s::return#2 rem8s#3 ] ( main:2::test_8s:11 [ print_line_cursor#1 test_8s::i#10 test_8s::dividend#0 test_8s::divisor#0 div8s::return#2 rem8s#3 ] ) @@ -10413,13 +10420,14 @@ print_sbyte: { //SEG346 div8s div8s: { .label neg = $10 - //SEG347 [169] if((signed byte) div8s::dividend#0>=(byte/signed byte/word/signed word/dword/signed dword) 0) goto div8s::@16 [ div8s::dividend#0 div8s::divisor#0 ] ( main:2::test_8s:11::div8s:137 [ print_line_cursor#1 test_8s::i#10 test_8s::dividend#0 test_8s::divisor#0 div8s::dividend#0 div8s::divisor#0 ] ) -- vbsaa_ge_0_then_la1 - cmp #0 + //SEG347 [169] if((signed byte) div8s::dividend#0>=(byte/signed byte/word/signed word/dword/signed dword) 0) goto div8s::@16 [ div8s::dividend#0 div8s::divisor#0 ] ( main:2::test_8s:11::div8s:137 [ print_line_cursor#1 test_8s::i#10 test_8s::dividend#0 test_8s::divisor#0 div8s::dividend#0 div8s::divisor#0 ] ) -- vbsyy_ge_0_then_la1 + cpy #0 bpl b16 jmp b7 //SEG348 div8s::@7 b7: - //SEG349 [170] (signed byte~) div8s::$2 ← - (signed byte) div8s::dividend#0 [ div8s::divisor#0 div8s::$2 ] ( main:2::test_8s:11::div8s:137 [ print_line_cursor#1 test_8s::i#10 test_8s::dividend#0 test_8s::divisor#0 div8s::divisor#0 div8s::$2 ] ) -- vbsaa=_neg_vbsaa + //SEG349 [170] (signed byte~) div8s::$2 ← - (signed byte) div8s::dividend#0 [ div8s::divisor#0 div8s::$2 ] ( main:2::test_8s:11::div8s:137 [ print_line_cursor#1 test_8s::i#10 test_8s::dividend#0 test_8s::divisor#0 div8s::divisor#0 div8s::$2 ] ) -- vbsaa=_neg_vbsyy + tya eor #$ff clc adc #1 @@ -10518,8 +10526,8 @@ div8s: { jmp b4_from_b17 //SEG387 div8s::@16 b16: - //SEG388 [191] (byte~) div8s::dividendu#7 ← (byte)(signed byte) div8s::dividend#0 [ div8s::divisor#0 div8s::dividendu#7 ] ( main:2::test_8s:11::div8s:137 [ print_line_cursor#1 test_8s::i#10 test_8s::dividend#0 test_8s::divisor#0 div8s::divisor#0 div8s::dividendu#7 ] ) -- vbuyy=vbuaa - tay + //SEG388 [191] (byte~) div8s::dividendu#7 ← (byte)(signed byte) div8s::dividend#0 [ div8s::divisor#0 div8s::dividendu#7 ] ( main:2::test_8s:11::div8s:137 [ print_line_cursor#1 test_8s::i#10 test_8s::dividend#0 test_8s::divisor#0 div8s::divisor#0 div8s::dividendu#7 ] ) + // (byte~) div8s::dividendu#7 = (byte)(signed byte) div8s::dividend#0 // register copy reg byte y //SEG389 [172] phi from div8s::@16 to div8s::@2 [phi:div8s::@16->div8s::@2] b2_from_b16: //SEG390 [172] phi (byte) div8s::dividendu#3 = (byte~) div8s::dividendu#7 [phi:div8s::@16->div8s::@2#0] -- register_copy @@ -11153,6 +11161,7 @@ Removing instruction lda #>0 Removing instruction lda #<0 Removing instruction lda #>0 Removing instruction ldy i +Replacing instruction ldx divisor with TAX Replacing instruction lda #0 with TXA Replacing instruction ldy #0 with TAY Removing instruction ldy i @@ -11469,7 +11478,7 @@ FINAL SYMBOL TABLE (label) div8s::@9 (label) div8s::@return (signed byte) div8s::dividend -(signed byte) div8s::dividend#0 reg byte a 5.0 +(signed byte) div8s::dividend#0 reg byte y 5.0 (byte) div8s::dividendu (byte) div8s::dividendu#3 reg byte y 0.8571428571428571 (byte~) div8s::dividendu#7 reg byte y 4.0 @@ -11828,7 +11837,7 @@ reg byte a [ print_byte::$2 ] reg byte a [ divr16u::$1 ] reg byte a [ divr16u::$2 ] zp ZP_BYTE:21 [ test_8s::divisor#0 ] -reg byte a [ div8s::dividend#0 ] +reg byte y [ div8s::dividend#0 ] reg byte x [ div8s::divisor#0 ] reg byte a [ div8s::return#3 ] reg byte a [ div8s::$2 ] @@ -11844,7 +11853,7 @@ reg byte a [ div8u::return#3 ] FINAL ASSEMBLER -Score: 33823 +Score: 33813 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -12463,10 +12472,10 @@ test_8s: { //SEG269 [134] (signed byte) test_8s::divisor#0 ← *((const signed byte[]) test_8s::divisors#0 + (byte) test_8s::i#10) [ print_line_cursor#1 test_8s::i#10 test_8s::dividend#0 test_8s::divisor#0 ] ( main:2::test_8s:11 [ print_line_cursor#1 test_8s::i#10 test_8s::dividend#0 test_8s::divisor#0 ] ) -- vbsz1=pbsc1_derefidx_vbuz2 lda divisors,y sta divisor - //SEG270 [135] (signed byte) div8s::dividend#0 ← (signed byte) test_8s::dividend#0 [ print_line_cursor#1 test_8s::i#10 test_8s::dividend#0 test_8s::divisor#0 div8s::dividend#0 ] ( main:2::test_8s:11 [ print_line_cursor#1 test_8s::i#10 test_8s::dividend#0 test_8s::divisor#0 div8s::dividend#0 ] ) -- vbsaa=vbsz1 - lda dividend + //SEG270 [135] (signed byte) div8s::dividend#0 ← (signed byte) test_8s::dividend#0 [ print_line_cursor#1 test_8s::i#10 test_8s::dividend#0 test_8s::divisor#0 div8s::dividend#0 ] ( main:2::test_8s:11 [ print_line_cursor#1 test_8s::i#10 test_8s::dividend#0 test_8s::divisor#0 div8s::dividend#0 ] ) -- vbsyy=vbsz1 + ldy dividend //SEG271 [136] (signed byte) div8s::divisor#0 ← (signed byte) test_8s::divisor#0 [ print_line_cursor#1 test_8s::i#10 test_8s::dividend#0 test_8s::divisor#0 div8s::dividend#0 div8s::divisor#0 ] ( main:2::test_8s:11 [ print_line_cursor#1 test_8s::i#10 test_8s::dividend#0 test_8s::divisor#0 div8s::dividend#0 div8s::divisor#0 ] ) -- vbsxx=vbsz1 - ldx divisor + tax //SEG272 [137] call div8s param-assignment [ print_line_cursor#1 test_8s::i#10 test_8s::dividend#0 test_8s::divisor#0 div8s::return#2 rem8s#3 ] ( main:2::test_8s:11 [ print_line_cursor#1 test_8s::i#10 test_8s::dividend#0 test_8s::divisor#0 div8s::return#2 rem8s#3 ] ) jsr div8s //SEG273 [138] (signed byte) div8s::return#3 ← (signed byte) div8s::return#2 [ print_line_cursor#1 test_8s::i#10 test_8s::dividend#0 test_8s::divisor#0 div8s::return#3 rem8s#3 ] ( main:2::test_8s:11 [ print_line_cursor#1 test_8s::i#10 test_8s::dividend#0 test_8s::divisor#0 div8s::return#3 rem8s#3 ] ) @@ -12605,11 +12614,12 @@ print_sbyte: { //SEG346 div8s div8s: { .label neg = $10 - //SEG347 [169] if((signed byte) div8s::dividend#0>=(byte/signed byte/word/signed word/dword/signed dword) 0) goto div8s::@16 [ div8s::dividend#0 div8s::divisor#0 ] ( main:2::test_8s:11::div8s:137 [ print_line_cursor#1 test_8s::i#10 test_8s::dividend#0 test_8s::divisor#0 div8s::dividend#0 div8s::divisor#0 ] ) -- vbsaa_ge_0_then_la1 - cmp #0 + //SEG347 [169] if((signed byte) div8s::dividend#0>=(byte/signed byte/word/signed word/dword/signed dword) 0) goto div8s::@16 [ div8s::dividend#0 div8s::divisor#0 ] ( main:2::test_8s:11::div8s:137 [ print_line_cursor#1 test_8s::i#10 test_8s::dividend#0 test_8s::divisor#0 div8s::dividend#0 div8s::divisor#0 ] ) -- vbsyy_ge_0_then_la1 + cpy #0 bpl b16 //SEG348 div8s::@7 - //SEG349 [170] (signed byte~) div8s::$2 ← - (signed byte) div8s::dividend#0 [ div8s::divisor#0 div8s::$2 ] ( main:2::test_8s:11::div8s:137 [ print_line_cursor#1 test_8s::i#10 test_8s::dividend#0 test_8s::divisor#0 div8s::divisor#0 div8s::$2 ] ) -- vbsaa=_neg_vbsaa + //SEG349 [170] (signed byte~) div8s::$2 ← - (signed byte) div8s::dividend#0 [ div8s::divisor#0 div8s::$2 ] ( main:2::test_8s:11::div8s:137 [ print_line_cursor#1 test_8s::i#10 test_8s::dividend#0 test_8s::divisor#0 div8s::divisor#0 div8s::$2 ] ) -- vbsaa=_neg_vbsyy + tya eor #$ff clc adc #1 @@ -12691,8 +12701,8 @@ div8s: { // (byte~) div8s::divisoru#4 = (byte)(signed byte) div8s::divisor#0 // register copy reg byte x //SEG387 div8s::@16 b16: - //SEG388 [191] (byte~) div8s::dividendu#7 ← (byte)(signed byte) div8s::dividend#0 [ div8s::divisor#0 div8s::dividendu#7 ] ( main:2::test_8s:11::div8s:137 [ print_line_cursor#1 test_8s::i#10 test_8s::dividend#0 test_8s::divisor#0 div8s::divisor#0 div8s::dividendu#7 ] ) -- vbuyy=vbuaa - tay + //SEG388 [191] (byte~) div8s::dividendu#7 ← (byte)(signed byte) div8s::dividend#0 [ div8s::divisor#0 div8s::dividendu#7 ] ( main:2::test_8s:11::div8s:137 [ print_line_cursor#1 test_8s::i#10 test_8s::dividend#0 test_8s::divisor#0 div8s::divisor#0 div8s::dividendu#7 ] ) + // (byte~) div8s::dividendu#7 = (byte)(signed byte) div8s::dividend#0 // register copy reg byte y //SEG389 [172] phi from div8s::@16 to div8s::@2 [phi:div8s::@16->div8s::@2] //SEG390 [172] phi (byte) div8s::dividendu#3 = (byte~) div8s::dividendu#7 [phi:div8s::@16->div8s::@2#0] -- register_copy //SEG391 [172] phi (byte) div8s::neg#3 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:div8s::@16->div8s::@2#1] -- vbuz1=vbuc1 diff --git a/src/test/java/dk/camelot64/kickc/test/ref/test-division.sym b/src/test/java/dk/camelot64/kickc/test/ref/test-division.sym index 684182a45..7946fed2c 100644 --- a/src/test/java/dk/camelot64/kickc/test/ref/test-division.sym +++ b/src/test/java/dk/camelot64/kickc/test/ref/test-division.sym @@ -66,7 +66,7 @@ (label) div8s::@9 (label) div8s::@return (signed byte) div8s::dividend -(signed byte) div8s::dividend#0 reg byte a 5.0 +(signed byte) div8s::dividend#0 reg byte y 5.0 (byte) div8s::dividendu (byte) div8s::dividendu#3 reg byte y 0.8571428571428571 (byte~) div8s::dividendu#7 reg byte y 4.0 @@ -425,7 +425,7 @@ reg byte a [ print_byte::$2 ] reg byte a [ divr16u::$1 ] reg byte a [ divr16u::$2 ] zp ZP_BYTE:21 [ test_8s::divisor#0 ] -reg byte a [ div8s::dividend#0 ] +reg byte y [ div8s::dividend#0 ] reg byte x [ div8s::divisor#0 ] reg byte a [ div8s::return#3 ] reg byte a [ div8s::$2 ] diff --git a/src/test/java/dk/camelot64/kickc/test/ref/test-keyboard.asm b/src/test/java/dk/camelot64/kickc/test/ref/test-keyboard.asm index 4628ccb83..f0ad0080f 100644 --- a/src/test/java/dk/camelot64/kickc/test/ref/test-keyboard.asm +++ b/src/test/java/dk/camelot64/kickc/test/ref/test-keyboard.asm @@ -59,8 +59,8 @@ jsr main main: { .label sc = 2 - .label row_pressed_bits = 4 .label screen = 2 + .label row = 4 .label i = 4 lda #<$400 sta sc @@ -91,21 +91,24 @@ main: { sta screen lda #>$400 sta screen+1 - ldx #0 + lda #0 + sta row b6: - txa + ldy row jsr keyboard_matrix_read - sta row_pressed_bits + tax ldy #0 b7: - lda #$80 - and row_pressed_bits + txa + and #$80 cmp #0 beq b8 lda #'1' sta (screen),y b9: - asl row_pressed_bits + txa + asl + tax iny cpy #8 bne b7 @@ -116,8 +119,9 @@ main: { bcc !+ inc screen+1 !: - inx - cpx #8 + inc row + lda row + cmp #8 bne b6 lda screen clc @@ -168,13 +172,13 @@ keyboard_key_pressed: { lsr lsr lsr + tay jsr keyboard_matrix_read ldy colidx and keyboard_matrix_col_bitmask,y rts } keyboard_matrix_read: { - tay lda keyboard_matrix_row_bitmask,y sta CIA1_PORT_A lda CIA1_PORT_B diff --git a/src/test/java/dk/camelot64/kickc/test/ref/test-keyboard.log b/src/test/java/dk/camelot64/kickc/test/ref/test-keyboard.log index 051259b7e..d2c760164 100644 --- a/src/test/java/dk/camelot64/kickc/test/ref/test-keyboard.log +++ b/src/test/java/dk/camelot64/kickc/test/ref/test-keyboard.log @@ -2933,24 +2933,25 @@ Uplift Scope [keyboard_key_pressed] 202: zp ZP_BYTE:20 [ keyboard_key_pressed::r Uplift Scope [keyboard_init] Uplift Scope [] -Uplift attempts [main] 10000/15552 (limiting to 10000) -Uplifting [main] best 77624 combination reg byte y [ main::col#2 main::col#1 ] reg byte a [ main::$5 ] zp ZP_BYTE:7 [ main::row_pressed_bits#2 main::row_pressed_bits#0 main::row_pressed_bits#1 ] zp ZP_BYTE:10 [ main::i#4 main::i#10 main::i#6 main::i#1 main::i#2 ] zp ZP_WORD:5 [ main::screen#13 main::screen#1 ] reg byte a [ main::$16 ] reg byte x [ main::ch#2 main::ch#1 ] reg byte x [ main::row#2 main::row#1 ] reg byte a [ main::key#0 ] zp ZP_WORD:2 [ main::sc#2 main::sc#1 ] zp ZP_WORD:14 [ main::screen#2 ] -Limited combination testing to 10000 combinations of 15552 possible. -Uplifting [keyboard_matrix_read] best 76608 combination reg byte a [ keyboard_matrix_read::rowid#2 keyboard_matrix_read::rowid#0 keyboard_matrix_read::rowid#1 ] reg byte a [ keyboard_matrix_read::return#3 ] reg byte a [ keyboard_matrix_read::return#0 ] reg byte a [ keyboard_matrix_read::return#2 ] -Uplifting [keyboard_get_keycode] best 75402 combination reg byte a [ keyboard_get_keycode::return#2 ] reg byte x [ keyboard_get_keycode::ch#0 ] reg byte a [ keyboard_get_keycode::return#0 ] -Uplifting [keyboard_key_pressed] best 74385 combination reg byte a [ keyboard_key_pressed::return#2 ] reg byte y [ keyboard_key_pressed::key#0 ] reg byte a [ keyboard_key_pressed::return#0 ] reg byte a [ keyboard_key_pressed::rowidx#0 ] reg byte a [ keyboard_key_pressed::$2 ] zp ZP_BYTE:22 [ keyboard_key_pressed::colidx#0 ] -Uplifting [keyboard_init] best 74385 combination -Uplifting [] best 74385 combination -Attempting to uplift remaining variables inzp ZP_BYTE:7 [ main::row_pressed_bits#2 main::row_pressed_bits#0 main::row_pressed_bits#1 ] -Uplifting [main] best 74385 combination zp ZP_BYTE:7 [ main::row_pressed_bits#2 main::row_pressed_bits#0 main::row_pressed_bits#1 ] +Uplifting [main] best 79424 combination reg byte y [ main::col#2 main::col#1 ] reg byte a [ main::$5 ] reg byte x [ main::row_pressed_bits#2 main::row_pressed_bits#0 main::row_pressed_bits#1 ] zp ZP_BYTE:10 [ main::i#4 main::i#10 main::i#6 main::i#1 main::i#2 ] zp ZP_WORD:5 [ main::screen#13 main::screen#1 ] reg byte a [ main::$16 ] reg byte x [ main::ch#2 main::ch#1 ] zp ZP_BYTE:4 [ main::row#2 main::row#1 ] zp ZP_BYTE:18 [ main::key#0 ] zp ZP_WORD:2 [ main::sc#2 main::sc#1 ] zp ZP_WORD:14 [ main::screen#2 ] +Limited combination testing to 1000 combinations of 15552 possible. +Uplifting [keyboard_matrix_read] best 78406 combination reg byte y [ keyboard_matrix_read::rowid#2 keyboard_matrix_read::rowid#0 keyboard_matrix_read::rowid#1 ] reg byte a [ keyboard_matrix_read::return#3 ] reg byte a [ keyboard_matrix_read::return#0 ] reg byte a [ keyboard_matrix_read::return#2 ] +Uplifting [keyboard_get_keycode] best 77200 combination reg byte a [ keyboard_get_keycode::return#2 ] reg byte x [ keyboard_get_keycode::ch#0 ] reg byte a [ keyboard_get_keycode::return#0 ] +Uplifting [keyboard_key_pressed] best 75985 combination reg byte a [ keyboard_key_pressed::return#2 ] reg byte y [ keyboard_key_pressed::key#0 ] reg byte a [ keyboard_key_pressed::return#0 ] reg byte a [ keyboard_key_pressed::rowidx#0 ] reg byte a [ keyboard_key_pressed::$2 ] zp ZP_BYTE:22 [ keyboard_key_pressed::colidx#0 ] +Limited combination testing to 1000 combinations of 2304 possible. +Uplifting [keyboard_init] best 75985 combination +Uplifting [] best 75985 combination Attempting to uplift remaining variables inzp ZP_BYTE:10 [ main::i#4 main::i#10 main::i#6 main::i#1 main::i#2 ] -Uplifting [main] best 74385 combination zp ZP_BYTE:10 [ main::i#4 main::i#10 main::i#6 main::i#1 main::i#2 ] +Uplifting [main] best 75985 combination zp ZP_BYTE:10 [ main::i#4 main::i#10 main::i#6 main::i#1 main::i#2 ] +Attempting to uplift remaining variables inzp ZP_BYTE:4 [ main::row#2 main::row#1 ] +Uplifting [main] best 75985 combination zp ZP_BYTE:4 [ main::row#2 main::row#1 ] +Attempting to uplift remaining variables inzp ZP_BYTE:18 [ main::key#0 ] +Uplifting [main] best 75285 combination reg byte a [ main::key#0 ] Attempting to uplift remaining variables inzp ZP_BYTE:22 [ keyboard_key_pressed::colidx#0 ] -Uplifting [keyboard_key_pressed] best 74385 combination zp ZP_BYTE:22 [ keyboard_key_pressed::colidx#0 ] +Uplifting [keyboard_key_pressed] best 75285 combination zp ZP_BYTE:22 [ keyboard_key_pressed::colidx#0 ] Coalescing zero page register with common assignment [ zp ZP_WORD:5 [ main::screen#13 main::screen#1 ] ] with [ zp ZP_WORD:14 [ main::screen#2 ] ] - score: 1 Coalescing zero page register [ zp ZP_WORD:2 [ main::sc#2 main::sc#1 ] ] with [ zp ZP_WORD:5 [ main::screen#13 main::screen#1 main::screen#2 ] ] -Coalescing zero page register [ zp ZP_BYTE:7 [ main::row_pressed_bits#2 main::row_pressed_bits#0 main::row_pressed_bits#1 ] ] with [ zp ZP_BYTE:10 [ main::i#4 main::i#10 main::i#6 main::i#1 main::i#2 ] ] -Allocated (was zp ZP_BYTE:7) zp ZP_BYTE:4 [ main::row_pressed_bits#2 main::row_pressed_bits#0 main::row_pressed_bits#1 main::i#4 main::i#10 main::i#6 main::i#1 main::i#2 ] +Coalescing zero page register [ zp ZP_BYTE:4 [ main::row#2 main::row#1 ] ] with [ zp ZP_BYTE:10 [ main::i#4 main::i#10 main::i#6 main::i#1 main::i#2 ] ] Allocated (was zp ZP_BYTE:22) zp ZP_BYTE:5 [ keyboard_key_pressed::colidx#0 ] ASSEMBLER BEFORE OPTIMIZATION @@ -3033,8 +3034,8 @@ bend: //SEG9 main main: { .label sc = 2 - .label row_pressed_bits = 4 .label screen = 2 + .label row = 4 .label i = 4 //SEG10 [5] phi from main to main::@1 [phi:main->main::@1] b1_from_main: @@ -3098,8 +3099,9 @@ main: { sta screen lda #>$400 sta screen+1 - //SEG29 [14] phi (byte) main::row#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@5->main::@6#1] -- vbuxx=vbuc1 - ldx #0 + //SEG29 [14] phi (byte) main::row#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@5->main::@6#1] -- vbuz1=vbuc1 + lda #0 + sta row jmp b6 //SEG30 [14] phi from main::@20 to main::@6 [phi:main::@20->main::@6] b6_from_b20: @@ -3108,8 +3110,8 @@ main: { jmp b6 //SEG33 main::@6 b6: - //SEG34 [15] (byte) keyboard_matrix_read::rowid#1 ← (byte) main::row#2 [ main::row#2 main::screen#13 keyboard_matrix_read::rowid#1 ] ( main:2 [ main::row#2 main::screen#13 keyboard_matrix_read::rowid#1 ] ) -- vbuaa=vbuxx - txa + //SEG34 [15] (byte) keyboard_matrix_read::rowid#1 ← (byte) main::row#2 [ main::row#2 main::screen#13 keyboard_matrix_read::rowid#1 ] ( main:2 [ main::row#2 main::screen#13 keyboard_matrix_read::rowid#1 ] ) -- vbuyy=vbuz1 + ldy row //SEG35 [16] call keyboard_matrix_read param-assignment [ main::row#2 main::screen#13 keyboard_matrix_read::return#0 ] ( main:2 [ main::row#2 main::screen#13 keyboard_matrix_read::return#0 ] ) //SEG36 [59] phi from main::@6 to keyboard_matrix_read [phi:main::@6->keyboard_matrix_read] keyboard_matrix_read_from_b6: @@ -3120,8 +3122,8 @@ main: { jmp b28 //SEG39 main::@28 b28: - //SEG40 [18] (byte) main::row_pressed_bits#0 ← (byte) keyboard_matrix_read::return#3 [ main::row#2 main::screen#13 main::row_pressed_bits#0 ] ( main:2 [ main::row#2 main::screen#13 main::row_pressed_bits#0 ] ) -- vbuz1=vbuaa - sta row_pressed_bits + //SEG40 [18] (byte) main::row_pressed_bits#0 ← (byte) keyboard_matrix_read::return#3 [ main::row#2 main::screen#13 main::row_pressed_bits#0 ] ( main:2 [ main::row#2 main::screen#13 main::row_pressed_bits#0 ] ) -- vbuxx=vbuaa + tax //SEG41 [19] phi from main::@28 to main::@7 [phi:main::@28->main::@7] b7_from_b28: //SEG42 [19] phi (byte) main::col#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@28->main::@7#0] -- vbuyy=vbuc1 @@ -3135,9 +3137,9 @@ main: { jmp b7 //SEG47 main::@7 b7: - //SEG48 [20] (byte~) main::$5 ← (byte) main::row_pressed_bits#2 & (byte/word/signed word/dword/signed dword) 128 [ main::row#2 main::screen#13 main::row_pressed_bits#2 main::col#2 main::$5 ] ( main:2 [ main::row#2 main::screen#13 main::row_pressed_bits#2 main::col#2 main::$5 ] ) -- vbuaa=vbuz1_band_vbuc1 - lda #$80 - and row_pressed_bits + //SEG48 [20] (byte~) main::$5 ← (byte) main::row_pressed_bits#2 & (byte/word/signed word/dword/signed dword) 128 [ main::row#2 main::screen#13 main::row_pressed_bits#2 main::col#2 main::$5 ] ( main:2 [ main::row#2 main::screen#13 main::row_pressed_bits#2 main::col#2 main::$5 ] ) -- vbuaa=vbuxx_band_vbuc1 + txa + and #$80 //SEG49 [21] if((byte~) main::$5==(byte/signed byte/word/signed word/dword/signed dword) 0) goto main::@8 [ main::row#2 main::screen#13 main::row_pressed_bits#2 main::col#2 ] ( main:2 [ main::row#2 main::screen#13 main::row_pressed_bits#2 main::col#2 ] ) -- vbuaa_eq_0_then_la1 cmp #0 beq b8 @@ -3150,8 +3152,10 @@ main: { jmp b9 //SEG52 main::@9 b9: - //SEG53 [23] (byte) main::row_pressed_bits#1 ← (byte) main::row_pressed_bits#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 [ main::row#2 main::screen#13 main::col#2 main::row_pressed_bits#1 ] ( main:2 [ main::row#2 main::screen#13 main::col#2 main::row_pressed_bits#1 ] ) -- vbuz1=vbuz1_rol_1 - asl row_pressed_bits + //SEG53 [23] (byte) main::row_pressed_bits#1 ← (byte) main::row_pressed_bits#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 [ main::row#2 main::screen#13 main::col#2 main::row_pressed_bits#1 ] ( main:2 [ main::row#2 main::screen#13 main::col#2 main::row_pressed_bits#1 ] ) -- vbuxx=vbuxx_rol_1 + txa + asl + tax //SEG54 [24] (byte) main::col#1 ← ++ (byte) main::col#2 [ main::row#2 main::screen#13 main::row_pressed_bits#1 main::col#1 ] ( main:2 [ main::row#2 main::screen#13 main::row_pressed_bits#1 main::col#1 ] ) -- vbuyy=_inc_vbuyy iny //SEG55 [25] if((byte) main::col#1!=(byte/signed byte/word/signed word/dword/signed dword) 8) goto main::@7 [ main::row#2 main::screen#13 main::row_pressed_bits#1 main::col#1 ] ( main:2 [ main::row#2 main::screen#13 main::row_pressed_bits#1 main::col#1 ] ) -- vbuyy_neq_vbuc1_then_la1 @@ -3168,10 +3172,11 @@ main: { bcc !+ inc screen+1 !: - //SEG58 [27] (byte) main::row#1 ← ++ (byte) main::row#2 [ main::row#1 main::screen#1 ] ( main:2 [ main::row#1 main::screen#1 ] ) -- vbuxx=_inc_vbuxx - inx - //SEG59 [28] if((byte) main::row#1!=(byte/signed byte/word/signed word/dword/signed dword) 8) goto main::@6 [ main::row#1 main::screen#1 ] ( main:2 [ main::row#1 main::screen#1 ] ) -- vbuxx_neq_vbuc1_then_la1 - cpx #8 + //SEG58 [27] (byte) main::row#1 ← ++ (byte) main::row#2 [ main::row#1 main::screen#1 ] ( main:2 [ main::row#1 main::screen#1 ] ) -- vbuz1=_inc_vbuz1 + inc row + //SEG59 [28] if((byte) main::row#1!=(byte/signed byte/word/signed word/dword/signed dword) 8) goto main::@6 [ main::row#1 main::screen#1 ] ( main:2 [ main::row#1 main::screen#1 ] ) -- vbuz1_neq_vbuc1_then_la1 + lda row + cmp #8 bne b6_from_b20 jmp b21 //SEG60 main::@21 @@ -3289,8 +3294,8 @@ keyboard_key_pressed: { lsr lsr lsr - //SEG101 [53] (byte) keyboard_matrix_read::rowid#0 ← (byte) keyboard_key_pressed::rowidx#0 [ keyboard_key_pressed::colidx#0 keyboard_matrix_read::rowid#0 ] ( main:2::keyboard_key_pressed:37 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::colidx#0 keyboard_matrix_read::rowid#0 ] ) - // (byte) keyboard_matrix_read::rowid#0 = (byte) keyboard_key_pressed::rowidx#0 // register copy reg byte a + //SEG101 [53] (byte) keyboard_matrix_read::rowid#0 ← (byte) keyboard_key_pressed::rowidx#0 [ keyboard_key_pressed::colidx#0 keyboard_matrix_read::rowid#0 ] ( main:2::keyboard_key_pressed:37 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::colidx#0 keyboard_matrix_read::rowid#0 ] ) -- vbuyy=vbuaa + tay //SEG102 [54] call keyboard_matrix_read param-assignment [ keyboard_matrix_read::return#0 keyboard_key_pressed::colidx#0 ] ( main:2::keyboard_key_pressed:37 [ main::screen#2 main::ch#2 main::i#10 keyboard_matrix_read::return#0 keyboard_key_pressed::colidx#0 ] ) //SEG103 [59] phi from keyboard_key_pressed to keyboard_matrix_read [phi:keyboard_key_pressed->keyboard_matrix_read] keyboard_matrix_read_from_keyboard_key_pressed: @@ -3314,8 +3319,7 @@ keyboard_key_pressed: { } //SEG111 keyboard_matrix_read keyboard_matrix_read: { - //SEG112 [60] *((const byte*) CIA1_PORT_A#0) ← *((const byte[8]) keyboard_matrix_row_bitmask#0 + (byte) keyboard_matrix_read::rowid#2) [ ] ( main:2::keyboard_matrix_read:16 [ main::row#2 main::screen#13 ] main:2::keyboard_key_pressed:37::keyboard_matrix_read:54 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::colidx#0 ] ) -- _deref_pbuc1=pbuc2_derefidx_vbuaa - tay + //SEG112 [60] *((const byte*) CIA1_PORT_A#0) ← *((const byte[8]) keyboard_matrix_row_bitmask#0 + (byte) keyboard_matrix_read::rowid#2) [ ] ( main:2::keyboard_matrix_read:16 [ main::row#2 main::screen#13 ] main:2::keyboard_key_pressed:37::keyboard_matrix_read:54 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::colidx#0 ] ) -- _deref_pbuc1=pbuc2_derefidx_vbuyy lda keyboard_matrix_row_bitmask,y sta CIA1_PORT_A //SEG113 [61] (byte) keyboard_matrix_read::return#0 ← ~ *((const byte*) CIA1_PORT_B#0) [ keyboard_matrix_read::return#0 ] ( main:2::keyboard_matrix_read:16 [ main::row#2 main::screen#13 keyboard_matrix_read::return#0 ] main:2::keyboard_key_pressed:37::keyboard_matrix_read:54 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::colidx#0 keyboard_matrix_read::return#0 ] ) -- vbuaa=_bnot__deref_pbuc1 @@ -3591,9 +3595,9 @@ FINAL SYMBOL TABLE (byte) keyboard_matrix_read::return#3 reg byte a 202.0 (byte) keyboard_matrix_read::row_pressed_bits (byte) keyboard_matrix_read::rowid -(byte) keyboard_matrix_read::rowid#0 reg byte a 4.0 -(byte) keyboard_matrix_read::rowid#1 reg byte a 202.0 -(byte) keyboard_matrix_read::rowid#2 reg byte a 105.0 +(byte) keyboard_matrix_read::rowid#0 reg byte y 4.0 +(byte) keyboard_matrix_read::rowid#1 reg byte y 202.0 +(byte) keyboard_matrix_read::rowid#2 reg byte y 105.0 (byte[8]) keyboard_matrix_row_bitmask (const byte[8]) keyboard_matrix_row_bitmask#0 keyboard_matrix_row_bitmask = { (byte/word/signed word/dword/signed dword) 254, (byte/word/signed word/dword/signed dword) 253, (byte/word/signed word/dword/signed dword) 251, (byte/word/signed word/dword/signed dword) 247, (byte/word/signed word/dword/signed dword) 239, (byte/word/signed word/dword/signed dword) 223, (byte/word/signed word/dword/signed dword) 191, (byte/signed byte/word/signed word/dword/signed dword) 127 } (void()) main() @@ -3634,12 +3638,12 @@ FINAL SYMBOL TABLE (byte) main::key (byte) main::key#0 reg byte a 151.5 (byte) main::row -(byte) main::row#1 reg byte x 151.5 -(byte) main::row#2 reg byte x 21.642857142857142 +(byte) main::row#1 row zp ZP_BYTE:4 151.5 +(byte) main::row#2 row zp ZP_BYTE:4 21.642857142857142 (byte) main::row_pressed_bits -(byte) main::row_pressed_bits#0 row_pressed_bits zp ZP_BYTE:4 202.0 -(byte) main::row_pressed_bits#1 row_pressed_bits zp ZP_BYTE:4 667.3333333333334 -(byte) main::row_pressed_bits#2 row_pressed_bits zp ZP_BYTE:4 620.8 +(byte) main::row_pressed_bits#0 reg byte x 202.0 +(byte) main::row_pressed_bits#1 reg byte x 667.3333333333334 +(byte) main::row_pressed_bits#2 reg byte x 620.8 (byte*) main::sc (byte*) main::sc#1 sc zp ZP_WORD:2 16.5 (byte*) main::sc#2 sc zp ZP_WORD:2 16.5 @@ -3649,11 +3653,11 @@ FINAL SYMBOL TABLE (byte*) main::screen#2 screen zp ZP_WORD:2 10.142857142857142 zp ZP_WORD:2 [ main::sc#2 main::sc#1 main::screen#13 main::screen#1 main::screen#2 ] -reg byte x [ main::row#2 main::row#1 ] -zp ZP_BYTE:4 [ main::row_pressed_bits#2 main::row_pressed_bits#0 main::row_pressed_bits#1 main::i#4 main::i#10 main::i#6 main::i#1 main::i#2 ] +zp ZP_BYTE:4 [ main::row#2 main::row#1 main::i#4 main::i#10 main::i#6 main::i#1 main::i#2 ] +reg byte x [ main::row_pressed_bits#2 main::row_pressed_bits#0 main::row_pressed_bits#1 ] reg byte y [ main::col#2 main::col#1 ] reg byte x [ main::ch#2 main::ch#1 ] -reg byte a [ keyboard_matrix_read::rowid#2 keyboard_matrix_read::rowid#0 keyboard_matrix_read::rowid#1 ] +reg byte y [ keyboard_matrix_read::rowid#2 keyboard_matrix_read::rowid#0 keyboard_matrix_read::rowid#1 ] reg byte a [ keyboard_matrix_read::return#3 ] reg byte a [ main::$5 ] reg byte x [ keyboard_get_keycode::ch#0 ] @@ -3672,7 +3676,7 @@ reg byte a [ keyboard_get_keycode::return#0 ] FINAL ASSEMBLER -Score: 55627 +Score: 56527 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -3745,8 +3749,8 @@ Score: 55627 //SEG9 main main: { .label sc = 2 - .label row_pressed_bits = 4 .label screen = 2 + .label row = 4 .label i = 4 //SEG10 [5] phi from main to main::@1 [phi:main->main::@1] //SEG11 [5] phi (byte*) main::sc#2 = ((byte*))(word/signed word/dword/signed dword) 1024 [phi:main->main::@1#0] -- pbuz1=pbuc1 @@ -3796,15 +3800,16 @@ main: { sta screen lda #>$400 sta screen+1 - //SEG29 [14] phi (byte) main::row#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@5->main::@6#1] -- vbuxx=vbuc1 - ldx #0 + //SEG29 [14] phi (byte) main::row#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@5->main::@6#1] -- vbuz1=vbuc1 + lda #0 + sta row //SEG30 [14] phi from main::@20 to main::@6 [phi:main::@20->main::@6] //SEG31 [14] phi (byte*) main::screen#13 = (byte*) main::screen#1 [phi:main::@20->main::@6#0] -- register_copy //SEG32 [14] phi (byte) main::row#2 = (byte) main::row#1 [phi:main::@20->main::@6#1] -- register_copy //SEG33 main::@6 b6: - //SEG34 [15] (byte) keyboard_matrix_read::rowid#1 ← (byte) main::row#2 [ main::row#2 main::screen#13 keyboard_matrix_read::rowid#1 ] ( main:2 [ main::row#2 main::screen#13 keyboard_matrix_read::rowid#1 ] ) -- vbuaa=vbuxx - txa + //SEG34 [15] (byte) keyboard_matrix_read::rowid#1 ← (byte) main::row#2 [ main::row#2 main::screen#13 keyboard_matrix_read::rowid#1 ] ( main:2 [ main::row#2 main::screen#13 keyboard_matrix_read::rowid#1 ] ) -- vbuyy=vbuz1 + ldy row //SEG35 [16] call keyboard_matrix_read param-assignment [ main::row#2 main::screen#13 keyboard_matrix_read::return#0 ] ( main:2 [ main::row#2 main::screen#13 keyboard_matrix_read::return#0 ] ) //SEG36 [59] phi from main::@6 to keyboard_matrix_read [phi:main::@6->keyboard_matrix_read] //SEG37 [59] phi (byte) keyboard_matrix_read::rowid#2 = (byte) keyboard_matrix_read::rowid#1 [phi:main::@6->keyboard_matrix_read#0] -- register_copy @@ -3812,8 +3817,8 @@ main: { //SEG38 [17] (byte) keyboard_matrix_read::return#3 ← (byte) keyboard_matrix_read::return#0 [ main::row#2 main::screen#13 keyboard_matrix_read::return#3 ] ( main:2 [ main::row#2 main::screen#13 keyboard_matrix_read::return#3 ] ) // (byte) keyboard_matrix_read::return#3 = (byte) keyboard_matrix_read::return#0 // register copy reg byte a //SEG39 main::@28 - //SEG40 [18] (byte) main::row_pressed_bits#0 ← (byte) keyboard_matrix_read::return#3 [ main::row#2 main::screen#13 main::row_pressed_bits#0 ] ( main:2 [ main::row#2 main::screen#13 main::row_pressed_bits#0 ] ) -- vbuz1=vbuaa - sta row_pressed_bits + //SEG40 [18] (byte) main::row_pressed_bits#0 ← (byte) keyboard_matrix_read::return#3 [ main::row#2 main::screen#13 main::row_pressed_bits#0 ] ( main:2 [ main::row#2 main::screen#13 main::row_pressed_bits#0 ] ) -- vbuxx=vbuaa + tax //SEG41 [19] phi from main::@28 to main::@7 [phi:main::@28->main::@7] //SEG42 [19] phi (byte) main::col#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@28->main::@7#0] -- vbuyy=vbuc1 ldy #0 @@ -3823,9 +3828,9 @@ main: { //SEG46 [19] phi (byte) main::row_pressed_bits#2 = (byte) main::row_pressed_bits#1 [phi:main::@9->main::@7#1] -- register_copy //SEG47 main::@7 b7: - //SEG48 [20] (byte~) main::$5 ← (byte) main::row_pressed_bits#2 & (byte/word/signed word/dword/signed dword) 128 [ main::row#2 main::screen#13 main::row_pressed_bits#2 main::col#2 main::$5 ] ( main:2 [ main::row#2 main::screen#13 main::row_pressed_bits#2 main::col#2 main::$5 ] ) -- vbuaa=vbuz1_band_vbuc1 - lda #$80 - and row_pressed_bits + //SEG48 [20] (byte~) main::$5 ← (byte) main::row_pressed_bits#2 & (byte/word/signed word/dword/signed dword) 128 [ main::row#2 main::screen#13 main::row_pressed_bits#2 main::col#2 main::$5 ] ( main:2 [ main::row#2 main::screen#13 main::row_pressed_bits#2 main::col#2 main::$5 ] ) -- vbuaa=vbuxx_band_vbuc1 + txa + and #$80 //SEG49 [21] if((byte~) main::$5==(byte/signed byte/word/signed word/dword/signed dword) 0) goto main::@8 [ main::row#2 main::screen#13 main::row_pressed_bits#2 main::col#2 ] ( main:2 [ main::row#2 main::screen#13 main::row_pressed_bits#2 main::col#2 ] ) -- vbuaa_eq_0_then_la1 cmp #0 beq b8 @@ -3835,8 +3840,10 @@ main: { sta (screen),y //SEG52 main::@9 b9: - //SEG53 [23] (byte) main::row_pressed_bits#1 ← (byte) main::row_pressed_bits#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 [ main::row#2 main::screen#13 main::col#2 main::row_pressed_bits#1 ] ( main:2 [ main::row#2 main::screen#13 main::col#2 main::row_pressed_bits#1 ] ) -- vbuz1=vbuz1_rol_1 - asl row_pressed_bits + //SEG53 [23] (byte) main::row_pressed_bits#1 ← (byte) main::row_pressed_bits#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 [ main::row#2 main::screen#13 main::col#2 main::row_pressed_bits#1 ] ( main:2 [ main::row#2 main::screen#13 main::col#2 main::row_pressed_bits#1 ] ) -- vbuxx=vbuxx_rol_1 + txa + asl + tax //SEG54 [24] (byte) main::col#1 ← ++ (byte) main::col#2 [ main::row#2 main::screen#13 main::row_pressed_bits#1 main::col#1 ] ( main:2 [ main::row#2 main::screen#13 main::row_pressed_bits#1 main::col#1 ] ) -- vbuyy=_inc_vbuyy iny //SEG55 [25] if((byte) main::col#1!=(byte/signed byte/word/signed word/dword/signed dword) 8) goto main::@7 [ main::row#2 main::screen#13 main::row_pressed_bits#1 main::col#1 ] ( main:2 [ main::row#2 main::screen#13 main::row_pressed_bits#1 main::col#1 ] ) -- vbuyy_neq_vbuc1_then_la1 @@ -3851,10 +3858,11 @@ main: { bcc !+ inc screen+1 !: - //SEG58 [27] (byte) main::row#1 ← ++ (byte) main::row#2 [ main::row#1 main::screen#1 ] ( main:2 [ main::row#1 main::screen#1 ] ) -- vbuxx=_inc_vbuxx - inx - //SEG59 [28] if((byte) main::row#1!=(byte/signed byte/word/signed word/dword/signed dword) 8) goto main::@6 [ main::row#1 main::screen#1 ] ( main:2 [ main::row#1 main::screen#1 ] ) -- vbuxx_neq_vbuc1_then_la1 - cpx #8 + //SEG58 [27] (byte) main::row#1 ← ++ (byte) main::row#2 [ main::row#1 main::screen#1 ] ( main:2 [ main::row#1 main::screen#1 ] ) -- vbuz1=_inc_vbuz1 + inc row + //SEG59 [28] if((byte) main::row#1!=(byte/signed byte/word/signed word/dword/signed dword) 8) goto main::@6 [ main::row#1 main::screen#1 ] ( main:2 [ main::row#1 main::screen#1 ] ) -- vbuz1_neq_vbuc1_then_la1 + lda row + cmp #8 bne b6 //SEG60 main::@21 //SEG61 [29] (byte*) main::screen#2 ← (byte*) main::screen#1 + (byte/signed byte/word/signed word/dword/signed dword) 40 [ main::screen#2 ] ( main:2 [ main::screen#2 ] ) -- pbuz1=pbuz1_plus_vbuc1 @@ -3951,8 +3959,8 @@ keyboard_key_pressed: { lsr lsr lsr - //SEG101 [53] (byte) keyboard_matrix_read::rowid#0 ← (byte) keyboard_key_pressed::rowidx#0 [ keyboard_key_pressed::colidx#0 keyboard_matrix_read::rowid#0 ] ( main:2::keyboard_key_pressed:37 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::colidx#0 keyboard_matrix_read::rowid#0 ] ) - // (byte) keyboard_matrix_read::rowid#0 = (byte) keyboard_key_pressed::rowidx#0 // register copy reg byte a + //SEG101 [53] (byte) keyboard_matrix_read::rowid#0 ← (byte) keyboard_key_pressed::rowidx#0 [ keyboard_key_pressed::colidx#0 keyboard_matrix_read::rowid#0 ] ( main:2::keyboard_key_pressed:37 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::colidx#0 keyboard_matrix_read::rowid#0 ] ) -- vbuyy=vbuaa + tay //SEG102 [54] call keyboard_matrix_read param-assignment [ keyboard_matrix_read::return#0 keyboard_key_pressed::colidx#0 ] ( main:2::keyboard_key_pressed:37 [ main::screen#2 main::ch#2 main::i#10 keyboard_matrix_read::return#0 keyboard_key_pressed::colidx#0 ] ) //SEG103 [59] phi from keyboard_key_pressed to keyboard_matrix_read [phi:keyboard_key_pressed->keyboard_matrix_read] //SEG104 [59] phi (byte) keyboard_matrix_read::rowid#2 = (byte) keyboard_matrix_read::rowid#0 [phi:keyboard_key_pressed->keyboard_matrix_read#0] -- register_copy @@ -3971,8 +3979,7 @@ keyboard_key_pressed: { } //SEG111 keyboard_matrix_read keyboard_matrix_read: { - //SEG112 [60] *((const byte*) CIA1_PORT_A#0) ← *((const byte[8]) keyboard_matrix_row_bitmask#0 + (byte) keyboard_matrix_read::rowid#2) [ ] ( main:2::keyboard_matrix_read:16 [ main::row#2 main::screen#13 ] main:2::keyboard_key_pressed:37::keyboard_matrix_read:54 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::colidx#0 ] ) -- _deref_pbuc1=pbuc2_derefidx_vbuaa - tay + //SEG112 [60] *((const byte*) CIA1_PORT_A#0) ← *((const byte[8]) keyboard_matrix_row_bitmask#0 + (byte) keyboard_matrix_read::rowid#2) [ ] ( main:2::keyboard_matrix_read:16 [ main::row#2 main::screen#13 ] main:2::keyboard_key_pressed:37::keyboard_matrix_read:54 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::colidx#0 ] ) -- _deref_pbuc1=pbuc2_derefidx_vbuyy lda keyboard_matrix_row_bitmask,y sta CIA1_PORT_A //SEG113 [61] (byte) keyboard_matrix_read::return#0 ← ~ *((const byte*) CIA1_PORT_B#0) [ keyboard_matrix_read::return#0 ] ( main:2::keyboard_matrix_read:16 [ main::row#2 main::screen#13 keyboard_matrix_read::return#0 ] main:2::keyboard_key_pressed:37::keyboard_matrix_read:54 [ main::screen#2 main::ch#2 main::i#10 keyboard_key_pressed::colidx#0 keyboard_matrix_read::return#0 ] ) -- vbuaa=_bnot__deref_pbuc1 diff --git a/src/test/java/dk/camelot64/kickc/test/ref/test-keyboard.sym b/src/test/java/dk/camelot64/kickc/test/ref/test-keyboard.sym index 3c6d45b65..a210bed45 100644 --- a/src/test/java/dk/camelot64/kickc/test/ref/test-keyboard.sym +++ b/src/test/java/dk/camelot64/kickc/test/ref/test-keyboard.sym @@ -145,9 +145,9 @@ (byte) keyboard_matrix_read::return#3 reg byte a 202.0 (byte) keyboard_matrix_read::row_pressed_bits (byte) keyboard_matrix_read::rowid -(byte) keyboard_matrix_read::rowid#0 reg byte a 4.0 -(byte) keyboard_matrix_read::rowid#1 reg byte a 202.0 -(byte) keyboard_matrix_read::rowid#2 reg byte a 105.0 +(byte) keyboard_matrix_read::rowid#0 reg byte y 4.0 +(byte) keyboard_matrix_read::rowid#1 reg byte y 202.0 +(byte) keyboard_matrix_read::rowid#2 reg byte y 105.0 (byte[8]) keyboard_matrix_row_bitmask (const byte[8]) keyboard_matrix_row_bitmask#0 keyboard_matrix_row_bitmask = { (byte/word/signed word/dword/signed dword) 254, (byte/word/signed word/dword/signed dword) 253, (byte/word/signed word/dword/signed dword) 251, (byte/word/signed word/dword/signed dword) 247, (byte/word/signed word/dword/signed dword) 239, (byte/word/signed word/dword/signed dword) 223, (byte/word/signed word/dword/signed dword) 191, (byte/signed byte/word/signed word/dword/signed dword) 127 } (void()) main() @@ -188,12 +188,12 @@ (byte) main::key (byte) main::key#0 reg byte a 151.5 (byte) main::row -(byte) main::row#1 reg byte x 151.5 -(byte) main::row#2 reg byte x 21.642857142857142 +(byte) main::row#1 row zp ZP_BYTE:4 151.5 +(byte) main::row#2 row zp ZP_BYTE:4 21.642857142857142 (byte) main::row_pressed_bits -(byte) main::row_pressed_bits#0 row_pressed_bits zp ZP_BYTE:4 202.0 -(byte) main::row_pressed_bits#1 row_pressed_bits zp ZP_BYTE:4 667.3333333333334 -(byte) main::row_pressed_bits#2 row_pressed_bits zp ZP_BYTE:4 620.8 +(byte) main::row_pressed_bits#0 reg byte x 202.0 +(byte) main::row_pressed_bits#1 reg byte x 667.3333333333334 +(byte) main::row_pressed_bits#2 reg byte x 620.8 (byte*) main::sc (byte*) main::sc#1 sc zp ZP_WORD:2 16.5 (byte*) main::sc#2 sc zp ZP_WORD:2 16.5 @@ -203,11 +203,11 @@ (byte*) main::screen#2 screen zp ZP_WORD:2 10.142857142857142 zp ZP_WORD:2 [ main::sc#2 main::sc#1 main::screen#13 main::screen#1 main::screen#2 ] -reg byte x [ main::row#2 main::row#1 ] -zp ZP_BYTE:4 [ main::row_pressed_bits#2 main::row_pressed_bits#0 main::row_pressed_bits#1 main::i#4 main::i#10 main::i#6 main::i#1 main::i#2 ] +zp ZP_BYTE:4 [ main::row#2 main::row#1 main::i#4 main::i#10 main::i#6 main::i#1 main::i#2 ] +reg byte x [ main::row_pressed_bits#2 main::row_pressed_bits#0 main::row_pressed_bits#1 ] reg byte y [ main::col#2 main::col#1 ] reg byte x [ main::ch#2 main::ch#1 ] -reg byte a [ keyboard_matrix_read::rowid#2 keyboard_matrix_read::rowid#0 keyboard_matrix_read::rowid#1 ] +reg byte y [ keyboard_matrix_read::rowid#2 keyboard_matrix_read::rowid#0 keyboard_matrix_read::rowid#1 ] reg byte a [ keyboard_matrix_read::return#3 ] reg byte a [ main::$5 ] reg byte x [ keyboard_get_keycode::ch#0 ] diff --git a/src/test/java/dk/camelot64/kickc/test/ref/test-multiply-16bit.log b/src/test/java/dk/camelot64/kickc/test/ref/test-multiply-16bit.log index b41154c97..e7fdeb0e8 100644 --- a/src/test/java/dk/camelot64/kickc/test/ref/test-multiply-16bit.log +++ b/src/test/java/dk/camelot64/kickc/test/ref/test-multiply-16bit.log @@ -9297,6 +9297,7 @@ Uplifting [mul16u_compare] best 519212 combination zp ZP_WORD:54 [ mul16u_compar Uplifting [mul16s_compare] best 517522 combination zp ZP_WORD:3 [ mul16s_compare::a#2 mul16s_compare::a#5 mul16s_compare::a#1 ] reg byte y [ mul16s_compare::j#2 mul16s_compare::j#1 ] zp ZP_WORD:5 [ mul16s_compare::b#2 mul16s_compare::b#5 mul16s_compare::b#1 ] reg byte a [ mul16s_compare::ok#2 ] zp ZP_DWORD:102 [ mul16s_compare::mn#0 ] reg byte x [ mul16s_compare::i#9 mul16s_compare::i#1 ] zp ZP_DWORD:90 [ mul16s_compare::ms#0 ] Uplifting [mul16s] best 517522 combination zp ZP_DWORD:98 [ mul16s::return#2 ] zp ZP_DWORD:132 [ mul16s::return#0 ] zp ZP_DWORD:29 [ mul16s::m#4 mul16s::m#5 mul16s::m#1 mul16s::m#0 mul16s::m#2 ] zp ZP_WORD:96 [ mul16s::b#0 ] zp ZP_WORD:94 [ mul16s::a#0 ] zp ZP_WORD:124 [ mul16s::$6 ] zp ZP_WORD:126 [ mul16s::$16 ] zp ZP_WORD:128 [ mul16s::$12 ] zp ZP_WORD:130 [ mul16s::$17 ] Uplifting [mulf_init] best 517172 combination zp ZP_WORD:72 [ mulf_init::sqr#3 mulf_init::sqr#4 mulf_init::sqr#1 mulf_init::sqr#2 ] reg byte x [ mulf_init::c#2 mulf_init::c#1 ] zp ZP_BYTE:71 [ mulf_init::x_2#3 mulf_init::x_2#2 mulf_init::x_2#1 ] reg byte a [ mulf_init::$2 ] reg byte a [ mulf_init::$5 ] reg byte a [ mulf_init::$6 ] zp ZP_WORD:75 [ mulf_init::sqr2_lo#2 mulf_init::sqr2_lo#1 ] zp ZP_WORD:67 [ mulf_init::sqr1_lo#2 mulf_init::sqr1_lo#1 ] reg byte x [ mulf_init::x_255#2 mulf_init::x_255#1 ] zp ZP_WORD:77 [ mulf_init::sqr2_hi#2 mulf_init::sqr2_hi#1 ] zp ZP_BYTE:79 [ mulf_init::dir#2 mulf_init::dir#3 ] zp ZP_WORD:69 [ mulf_init::sqr1_hi#2 mulf_init::sqr1_hi#1 ] +Limited combination testing to 1000 combinations of 1024 possible. Uplifting [] best 517172 combination zp ZP_WORD:25 [ print_char_cursor#76 print_char_cursor#120 print_char_cursor#116 print_char_cursor#117 print_char_cursor#118 print_char_cursor#130 print_char_cursor#157 print_char_cursor#158 print_char_cursor#113 print_char_cursor#112 print_char_cursor#20 print_char_cursor#1 print_char_cursor#114 ] zp ZP_WORD:9 [ print_line_cursor#20 print_line_cursor#39 print_line_cursor#1 ] Uplifting [print_str] best 517172 combination zp ZP_WORD:11 [ print_str::str#11 print_str::str#13 print_str::str#0 ] Uplifting [print_cls] best 517172 combination zp ZP_WORD:80 [ print_cls::sc#2 print_cls::sc#1 ] diff --git a/src/test/java/dk/camelot64/kickc/test/ref/test-multiply-8bit.log b/src/test/java/dk/camelot64/kickc/test/ref/test-multiply-8bit.log index 77368bcde..8d0169dcd 100644 --- a/src/test/java/dk/camelot64/kickc/test/ref/test-multiply-8bit.log +++ b/src/test/java/dk/camelot64/kickc/test/ref/test-multiply-8bit.log @@ -10943,8 +10943,11 @@ Uplifting [mulf8u] best 296758 combination reg byte x [ mulf8u::b#2 mulf8u::b#1 Uplifting [mul8u_compare] best 295758 combination reg byte x [ mul8u_compare::ok#3 mul8u_compare::ok#4 ] zp ZP_BYTE:35 [ mul8u_compare::b#10 mul8u_compare::b#1 ] zp ZP_BYTE:34 [ mul8u_compare::a#7 mul8u_compare::a#1 ] zp ZP_WORD:115 [ mul8u_compare::mn#0 ] zp ZP_WORD:107 [ mul8u_compare::ms#0 ] zp ZP_WORD:111 [ mul8u_compare::mf#0 ] Uplifting [mul8s_compare] best 294758 combination reg byte x [ mul8s_compare::ok#3 mul8s_compare::ok#4 ] zp ZP_BYTE:3 [ mul8s_compare::b#10 mul8s_compare::b#1 ] zp ZP_BYTE:2 [ mul8s_compare::a#7 mul8s_compare::a#1 ] zp ZP_WORD:76 [ mul8s_compare::mn#0 ] zp ZP_WORD:64 [ mul8s_compare::ms#0 ] zp ZP_WORD:70 [ mul8s_compare::mf#0 ] Uplifting [mulf_init] best 294408 combination zp ZP_WORD:50 [ mulf_init::sqr#3 mulf_init::sqr#4 mulf_init::sqr#1 mulf_init::sqr#2 ] reg byte x [ mulf_init::c#2 mulf_init::c#1 ] zp ZP_BYTE:49 [ mulf_init::x_2#3 mulf_init::x_2#2 mulf_init::x_2#1 ] reg byte a [ mulf_init::$2 ] reg byte a [ mulf_init::$5 ] reg byte a [ mulf_init::$6 ] zp ZP_WORD:53 [ mulf_init::sqr2_lo#2 mulf_init::sqr2_lo#1 ] zp ZP_WORD:45 [ mulf_init::sqr1_lo#2 mulf_init::sqr1_lo#1 ] reg byte x [ mulf_init::x_255#2 mulf_init::x_255#1 ] zp ZP_WORD:55 [ mulf_init::sqr2_hi#2 mulf_init::sqr2_hi#1 ] zp ZP_BYTE:57 [ mulf_init::dir#2 mulf_init::dir#3 ] zp ZP_WORD:47 [ mulf_init::sqr1_hi#2 mulf_init::sqr1_hi#1 ] +Limited combination testing to 1000 combinations of 1024 possible. Uplifting [mul8s] best 294083 combination zp ZP_WORD:74 [ mul8s::return#2 ] zp ZP_WORD:18 [ mul8s::m#4 mul8s::m#5 mul8s::m#1 mul8s::m#0 mul8s::m#2 ] reg byte y [ mul8s::b#0 ] zp ZP_BYTE:72 [ mul8s::a#0 ] reg byte a [ mul8s::$6 ] reg byte a [ mul8s::$16 ] reg byte a [ mul8s::$12 ] reg byte a [ mul8s::$17 ] +Limited combination testing to 1000 combinations of 2304 possible. Uplifting [mulf8s] best 293758 combination zp ZP_WORD:68 [ mulf8s::return#2 ] zp ZP_WORD:26 [ mulf8s::m#4 mulf8s::m#5 mulf8s::m#1 mulf8s::m#0 mulf8s::m#2 ] zp ZP_BYTE:67 [ mulf8s::b#0 ] reg byte y [ mulf8s::a#0 ] reg byte a [ mulf8s::$6 ] reg byte a [ mulf8s::$16 ] reg byte a [ mulf8s::$12 ] reg byte a [ mulf8s::$17 ] +Limited combination testing to 1000 combinations of 1024 possible. Uplifting [] best 293758 combination zp ZP_WORD:15 [ print_char_cursor#82 print_char_cursor#137 print_char_cursor#136 print_char_cursor#132 print_char_cursor#149 print_char_cursor#188 print_char_cursor#189 print_char_cursor#131 print_char_cursor#130 print_char_cursor#17 print_char_cursor#30 print_char_cursor#1 print_char_cursor#134 print_char_cursor#222 ] zp ZP_WORD:5 [ print_line_cursor#23 print_line_cursor#45 print_line_cursor#1 print_line_cursor#10 ] Uplifting [mulf_tables_cmp] best 293758 combination zp ZP_WORD:40 [ mulf_tables_cmp::kc_sqr#2 mulf_tables_cmp::kc_sqr#1 ] zp ZP_WORD:42 [ mulf_tables_cmp::asm_sqr#2 mulf_tables_cmp::asm_sqr#1 ] Uplifting [print_str] best 293758 combination zp ZP_WORD:7 [ print_str::str#16 print_str::str#18 print_str::str#0 ] diff --git a/src/test/java/dk/camelot64/kickc/test/ref/voronoi.asm b/src/test/java/dk/camelot64/kickc/test/ref/voronoi.asm index 1e71cb06c..ba356738f 100644 --- a/src/test/java/dk/camelot64/kickc/test/ref/voronoi.asm +++ b/src/test/java/dk/camelot64/kickc/test/ref/voronoi.asm @@ -85,7 +85,7 @@ render: { sta x b2: jsr findcol - tya + txa ldy x sta (colline),y inc x @@ -108,18 +108,21 @@ render: { findcol: { .label x = 5 .label y = 2 - .label xp = 7 - .label yp = 8 - .label diff = 7 - .label mindiff = 6 - ldy #0 + .label xp = 8 + .label yp = 9 + .label diff = 8 + .label i = 6 + .label mindiff = 7 + ldx #0 lda #$ff sta mindiff - ldx #0 + txa + sta i b1: - lda XPOS,x + ldy i + lda XPOS,y sta xp - lda YPOS,x + lda YPOS,y sta yp lda x cmp xp @@ -127,7 +130,7 @@ findcol: { lda y cmp yp bne b2 - ldy #0 + ldx #0 breturn: rts b2: @@ -147,20 +150,24 @@ findcol: { sbc y clc adc diff + tay b7: - cmp mindiff + cpy mindiff bcs b21 - ldy COLS,x + ldx i + lda COLS,x + tax b8: - inx - cpx #numpoints + inc i + lda i + cmp #numpoints bcc b19 jmp breturn b19: - sta mindiff + sty mindiff jmp b1 b21: - lda mindiff + ldy mindiff jmp b8 b6: lda y @@ -168,6 +175,7 @@ findcol: { sbc yp clc adc diff + tay jmp b7 b4: lda x diff --git a/src/test/java/dk/camelot64/kickc/test/ref/voronoi.log b/src/test/java/dk/camelot64/kickc/test/ref/voronoi.log index 0af4519b0..c48bd1c49 100644 --- a/src/test/java/dk/camelot64/kickc/test/ref/voronoi.log +++ b/src/test/java/dk/camelot64/kickc/test/ref/voronoi.log @@ -2572,41 +2572,44 @@ Uplift Scope [animate] 4: zp ZP_BYTE:13 [ animate::$0 ] 4: zp ZP_BYTE:14 [ anima Uplift Scope [main] Uplift Scope [] -Uplift attempts [findcol] 10000/2239488 (limiting to 10000) -Uplifting [findcol] best 1713995 combination reg byte a [ findcol::mindiff#11 findcol::diff#6 findcol::diff#3 findcol::diff#2 findcol::mindiff#15 ] zp ZP_BYTE:9 [ findcol::diff#4 findcol::diff#1 findcol::diff#0 ] reg byte y [ findcol::return#2 findcol::mincol#10 findcol::mincol#2 findcol::mincol#1 ] zp ZP_BYTE:7 [ findcol::mindiff#10 findcol::mindiff#13 ] reg byte a [ findcol::$10 ] reg byte a [ findcol::$12 ] reg byte x [ findcol::i#10 findcol::i#1 ] zp ZP_BYTE:24 [ findcol::xp#0 ] zp ZP_BYTE:25 [ findcol::yp#0 ] zp ZP_BYTE:22 [ findcol::return#0 ] zp ZP_BYTE:21 [ findcol::y#0 ] zp ZP_BYTE:20 [ findcol::x#0 ] -Limited combination testing to 10000 combinations of 2239488 possible. -Uplifting [render] best 1707995 combination zp ZP_BYTE:5 [ render::x#2 render::x#1 ] reg byte a [ render::col#0 ] zp ZP_BYTE:2 [ render::y#4 render::y#1 ] zp ZP_WORD:3 [ render::colline#5 render::colline#1 ] -Uplifting [initscreen] best 1707995 combination zp ZP_WORD:11 [ initscreen::screen#2 initscreen::screen#1 ] -Uplift attempts [animate] 10000/16384 (limiting to 10000) -Uplifting [animate] best 1707953 combination reg byte x [ animate::$0 ] reg byte x [ animate::$3 ] reg byte x [ animate::$6 ] reg byte x [ animate::$9 ] reg byte x [ animate::$12 ] reg byte a [ animate::$15 ] reg byte a [ animate::$18 ] -Limited combination testing to 10000 combinations of 16384 possible. -Uplifting [main] best 1707953 combination -Uplifting [] best 1707953 combination +Uplifting [findcol] best 1953995 combination reg byte y [ findcol::mindiff#11 findcol::diff#6 findcol::diff#3 findcol::diff#2 findcol::mindiff#15 ] zp ZP_BYTE:9 [ findcol::diff#4 findcol::diff#1 findcol::diff#0 ] reg byte x [ findcol::return#2 findcol::mincol#10 findcol::mincol#2 findcol::mincol#1 ] zp ZP_BYTE:7 [ findcol::mindiff#10 findcol::mindiff#13 ] reg byte a [ findcol::$10 ] reg byte a [ findcol::$12 ] zp ZP_BYTE:6 [ findcol::i#10 findcol::i#1 ] zp ZP_BYTE:24 [ findcol::xp#0 ] zp ZP_BYTE:25 [ findcol::yp#0 ] zp ZP_BYTE:22 [ findcol::return#0 ] zp ZP_BYTE:21 [ findcol::y#0 ] zp ZP_BYTE:20 [ findcol::x#0 ] +Limited combination testing to 1000 combinations of 2239488 possible. +Uplifting [render] best 1947995 combination zp ZP_BYTE:5 [ render::x#2 render::x#1 ] reg byte a [ render::col#0 ] zp ZP_BYTE:2 [ render::y#4 render::y#1 ] zp ZP_WORD:3 [ render::colline#5 render::colline#1 ] +Uplifting [initscreen] best 1947995 combination zp ZP_WORD:11 [ initscreen::screen#2 initscreen::screen#1 ] +Uplifting [animate] best 1947965 combination reg byte x [ animate::$0 ] reg byte x [ animate::$3 ] reg byte x [ animate::$6 ] reg byte x [ animate::$9 ] reg byte x [ animate::$12 ] zp ZP_BYTE:18 [ animate::$15 ] zp ZP_BYTE:19 [ animate::$18 ] +Limited combination testing to 1000 combinations of 16384 possible. +Uplifting [main] best 1947965 combination +Uplifting [] best 1947965 combination Attempting to uplift remaining variables inzp ZP_BYTE:9 [ findcol::diff#4 findcol::diff#1 findcol::diff#0 ] -Uplifting [findcol] best 1707953 combination zp ZP_BYTE:9 [ findcol::diff#4 findcol::diff#1 findcol::diff#0 ] +Uplifting [findcol] best 1947965 combination zp ZP_BYTE:9 [ findcol::diff#4 findcol::diff#1 findcol::diff#0 ] Attempting to uplift remaining variables inzp ZP_BYTE:7 [ findcol::mindiff#10 findcol::mindiff#13 ] -Uplifting [findcol] best 1707953 combination zp ZP_BYTE:7 [ findcol::mindiff#10 findcol::mindiff#13 ] +Uplifting [findcol] best 1947965 combination zp ZP_BYTE:7 [ findcol::mindiff#10 findcol::mindiff#13 ] +Attempting to uplift remaining variables inzp ZP_BYTE:6 [ findcol::i#10 findcol::i#1 ] +Uplifting [findcol] best 1947965 combination zp ZP_BYTE:6 [ findcol::i#10 findcol::i#1 ] Attempting to uplift remaining variables inzp ZP_BYTE:24 [ findcol::xp#0 ] -Uplifting [findcol] best 1707953 combination zp ZP_BYTE:24 [ findcol::xp#0 ] +Uplifting [findcol] best 1947965 combination zp ZP_BYTE:24 [ findcol::xp#0 ] Attempting to uplift remaining variables inzp ZP_BYTE:25 [ findcol::yp#0 ] -Uplifting [findcol] best 1707953 combination zp ZP_BYTE:25 [ findcol::yp#0 ] +Uplifting [findcol] best 1947965 combination zp ZP_BYTE:25 [ findcol::yp#0 ] Attempting to uplift remaining variables inzp ZP_BYTE:5 [ render::x#2 render::x#1 ] -Uplifting [render] best 1707953 combination zp ZP_BYTE:5 [ render::x#2 render::x#1 ] +Uplifting [render] best 1947965 combination zp ZP_BYTE:5 [ render::x#2 render::x#1 ] Attempting to uplift remaining variables inzp ZP_BYTE:22 [ findcol::return#0 ] -Uplifting [findcol] best 1703953 combination reg byte a [ findcol::return#0 ] +Uplifting [findcol] best 1943965 combination reg byte a [ findcol::return#0 ] Attempting to uplift remaining variables inzp ZP_BYTE:21 [ findcol::y#0 ] -Uplifting [findcol] best 1703953 combination zp ZP_BYTE:21 [ findcol::y#0 ] +Uplifting [findcol] best 1943965 combination zp ZP_BYTE:21 [ findcol::y#0 ] Attempting to uplift remaining variables inzp ZP_BYTE:20 [ findcol::x#0 ] -Uplifting [findcol] best 1703953 combination zp ZP_BYTE:20 [ findcol::x#0 ] +Uplifting [findcol] best 1943965 combination zp ZP_BYTE:20 [ findcol::x#0 ] Attempting to uplift remaining variables inzp ZP_BYTE:2 [ render::y#4 render::y#1 ] -Uplifting [render] best 1703953 combination zp ZP_BYTE:2 [ render::y#4 render::y#1 ] +Uplifting [render] best 1943965 combination zp ZP_BYTE:2 [ render::y#4 render::y#1 ] +Attempting to uplift remaining variables inzp ZP_BYTE:18 [ animate::$15 ] +Uplifting [animate] best 1943959 combination reg byte a [ animate::$15 ] +Attempting to uplift remaining variables inzp ZP_BYTE:19 [ animate::$18 ] +Uplifting [animate] best 1943953 combination reg byte a [ animate::$18 ] Coalescing zero page register with common assignment [ zp ZP_BYTE:9 [ findcol::diff#4 findcol::diff#1 findcol::diff#0 ] ] with [ zp ZP_BYTE:24 [ findcol::xp#0 ] ] - score: 2 Coalescing zero page register with common assignment [ zp ZP_BYTE:2 [ render::y#4 render::y#1 ] ] with [ zp ZP_BYTE:21 [ findcol::y#0 ] ] - score: 1 Coalescing zero page register with common assignment [ zp ZP_BYTE:5 [ render::x#2 render::x#1 ] ] with [ zp ZP_BYTE:20 [ findcol::x#0 ] ] - score: 1 Coalescing zero page register [ zp ZP_WORD:3 [ render::colline#5 render::colline#1 ] ] with [ zp ZP_WORD:11 [ initscreen::screen#2 initscreen::screen#1 ] ] -Allocated (was zp ZP_BYTE:7) zp ZP_BYTE:6 [ findcol::mindiff#10 findcol::mindiff#13 ] -Allocated (was zp ZP_BYTE:9) zp ZP_BYTE:7 [ findcol::diff#4 findcol::diff#1 findcol::diff#0 findcol::xp#0 ] -Allocated (was zp ZP_BYTE:25) zp ZP_BYTE:8 [ findcol::yp#0 ] +Allocated (was zp ZP_BYTE:9) zp ZP_BYTE:8 [ findcol::diff#4 findcol::diff#1 findcol::diff#0 findcol::xp#0 ] +Allocated (was zp ZP_BYTE:25) zp ZP_BYTE:9 [ findcol::yp#0 ] ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart @@ -2825,8 +2828,8 @@ render: { //SEG77 [53] phi from render::@2 to findcol [phi:render::@2->findcol] findcol_from_b2: jsr findcol - //SEG78 [44] (byte) findcol::return#0 ← (byte) findcol::return#2 [ render::y#4 render::colline#5 render::x#2 findcol::return#0 ] ( main:2::render:7 [ render::y#4 render::colline#5 render::x#2 findcol::return#0 ] ) -- vbuaa=vbuyy - tya + //SEG78 [44] (byte) findcol::return#0 ← (byte) findcol::return#2 [ render::y#4 render::colline#5 render::x#2 findcol::return#0 ] ( main:2::render:7 [ render::y#4 render::colline#5 render::x#2 findcol::return#0 ] ) -- vbuaa=vbuxx + txa jmp b5 //SEG79 render::@5 b5: @@ -2868,27 +2871,31 @@ render: { findcol: { .label x = 5 .label y = 2 - .label xp = 7 - .label yp = 8 - .label diff = 7 - .label mindiff = 6 + .label xp = 8 + .label yp = 9 + .label diff = 8 + .label i = 6 + .label mindiff = 7 //SEG91 [54] phi from findcol to findcol::@1 [phi:findcol->findcol::@1] b1_from_findcol: - //SEG92 [54] phi (byte) findcol::mincol#10 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:findcol->findcol::@1#0] -- vbuyy=vbuc1 - ldy #0 + //SEG92 [54] phi (byte) findcol::mincol#10 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:findcol->findcol::@1#0] -- vbuxx=vbuc1 + ldx #0 //SEG93 [54] phi (byte) findcol::mindiff#10 = (byte/word/signed word/dword/signed dword) 255 [phi:findcol->findcol::@1#1] -- vbuz1=vbuc1 lda #$ff sta mindiff - //SEG94 [54] phi (byte) findcol::i#10 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:findcol->findcol::@1#2] -- vbuxx=vbuc1 - ldx #0 + //SEG94 [54] phi (byte) findcol::i#10 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:findcol->findcol::@1#2] -- vbuz1=vbuc1 + lda #0 + sta i jmp b1 //SEG95 findcol::@1 b1: - //SEG96 [55] (byte) findcol::xp#0 ← *((const byte[]) XPOS#0 + (byte) findcol::i#10) [ findcol::x#0 findcol::y#0 findcol::i#10 findcol::mindiff#10 findcol::mincol#10 findcol::xp#0 ] ( main:2::render:7::findcol:43 [ render::y#4 render::colline#5 render::x#2 findcol::x#0 findcol::y#0 findcol::i#10 findcol::mindiff#10 findcol::mincol#10 findcol::xp#0 ] ) -- vbuz1=pbuc1_derefidx_vbuxx - lda XPOS,x + //SEG96 [55] (byte) findcol::xp#0 ← *((const byte[]) XPOS#0 + (byte) findcol::i#10) [ findcol::x#0 findcol::y#0 findcol::i#10 findcol::mindiff#10 findcol::mincol#10 findcol::xp#0 ] ( main:2::render:7::findcol:43 [ render::y#4 render::colline#5 render::x#2 findcol::x#0 findcol::y#0 findcol::i#10 findcol::mindiff#10 findcol::mincol#10 findcol::xp#0 ] ) -- vbuz1=pbuc1_derefidx_vbuz2 + ldy i + lda XPOS,y sta xp - //SEG97 [56] (byte) findcol::yp#0 ← *((const byte[]) YPOS#0 + (byte) findcol::i#10) [ findcol::x#0 findcol::y#0 findcol::i#10 findcol::mindiff#10 findcol::mincol#10 findcol::xp#0 findcol::yp#0 ] ( main:2::render:7::findcol:43 [ render::y#4 render::colline#5 render::x#2 findcol::x#0 findcol::y#0 findcol::i#10 findcol::mindiff#10 findcol::mincol#10 findcol::xp#0 findcol::yp#0 ] ) -- vbuz1=pbuc1_derefidx_vbuxx - lda YPOS,x + //SEG97 [56] (byte) findcol::yp#0 ← *((const byte[]) YPOS#0 + (byte) findcol::i#10) [ findcol::x#0 findcol::y#0 findcol::i#10 findcol::mindiff#10 findcol::mincol#10 findcol::xp#0 findcol::yp#0 ] ( main:2::render:7::findcol:43 [ render::y#4 render::colline#5 render::x#2 findcol::x#0 findcol::y#0 findcol::i#10 findcol::mindiff#10 findcol::mincol#10 findcol::xp#0 findcol::yp#0 ] ) -- vbuz1=pbuc1_derefidx_vbuz2 + ldy i + lda YPOS,y sta yp //SEG98 [57] if((byte) findcol::x#0!=(byte) findcol::xp#0) goto findcol::@2 [ findcol::x#0 findcol::y#0 findcol::i#10 findcol::mindiff#10 findcol::mincol#10 findcol::xp#0 findcol::yp#0 ] ( main:2::render:7::findcol:43 [ render::y#4 render::colline#5 render::x#2 findcol::x#0 findcol::y#0 findcol::i#10 findcol::mindiff#10 findcol::mincol#10 findcol::xp#0 findcol::yp#0 ] ) -- vbuz1_neq_vbuz2_then_la1 lda x @@ -2903,8 +2910,8 @@ findcol: { bne b2 //SEG101 [59] phi from findcol::@9 to findcol::@return [phi:findcol::@9->findcol::@return] breturn_from_b9: - //SEG102 [59] phi (byte) findcol::return#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:findcol::@9->findcol::@return#0] -- vbuyy=vbuc1 - ldy #0 + //SEG102 [59] phi (byte) findcol::return#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:findcol::@9->findcol::@return#0] -- vbuxx=vbuc1 + ldx #0 jmp breturn //SEG103 findcol::@return breturn: @@ -2942,9 +2949,10 @@ findcol: { lda yp sec sbc y - //SEG115 [66] (byte) findcol::diff#3 ← (byte) findcol::diff#4 + (byte~) findcol::$10 [ findcol::x#0 findcol::y#0 findcol::i#10 findcol::mindiff#10 findcol::mincol#10 findcol::diff#3 ] ( main:2::render:7::findcol:43 [ render::y#4 render::colline#5 render::x#2 findcol::x#0 findcol::y#0 findcol::i#10 findcol::mindiff#10 findcol::mincol#10 findcol::diff#3 ] ) -- vbuaa=vbuz1_plus_vbuaa + //SEG115 [66] (byte) findcol::diff#3 ← (byte) findcol::diff#4 + (byte~) findcol::$10 [ findcol::x#0 findcol::y#0 findcol::i#10 findcol::mindiff#10 findcol::mincol#10 findcol::diff#3 ] ( main:2::render:7::findcol:43 [ render::y#4 render::colline#5 render::x#2 findcol::x#0 findcol::y#0 findcol::i#10 findcol::mindiff#10 findcol::mincol#10 findcol::diff#3 ] ) -- vbuyy=vbuz1_plus_vbuaa clc adc diff + tay //SEG116 [67] phi from findcol::@14 findcol::@6 to findcol::@7 [phi:findcol::@14/findcol::@6->findcol::@7] b7_from_b14: b7_from_b6: @@ -2952,14 +2960,16 @@ findcol: { jmp b7 //SEG118 findcol::@7 b7: - //SEG119 [68] if((byte) findcol::diff#6>=(byte) findcol::mindiff#10) goto findcol::@21 [ findcol::x#0 findcol::y#0 findcol::i#10 findcol::mindiff#10 findcol::mincol#10 findcol::diff#6 ] ( main:2::render:7::findcol:43 [ render::y#4 render::colline#5 render::x#2 findcol::x#0 findcol::y#0 findcol::i#10 findcol::mindiff#10 findcol::mincol#10 findcol::diff#6 ] ) -- vbuaa_ge_vbuz1_then_la1 - cmp mindiff + //SEG119 [68] if((byte) findcol::diff#6>=(byte) findcol::mindiff#10) goto findcol::@21 [ findcol::x#0 findcol::y#0 findcol::i#10 findcol::mindiff#10 findcol::mincol#10 findcol::diff#6 ] ( main:2::render:7::findcol:43 [ render::y#4 render::colline#5 render::x#2 findcol::x#0 findcol::y#0 findcol::i#10 findcol::mindiff#10 findcol::mincol#10 findcol::diff#6 ] ) -- vbuyy_ge_vbuz1_then_la1 + cpy mindiff bcs b21 jmp b16 //SEG120 findcol::@16 b16: - //SEG121 [69] (byte) findcol::mincol#1 ← *((const byte[]) COLS#0 + (byte) findcol::i#10) [ findcol::x#0 findcol::y#0 findcol::i#10 findcol::diff#6 findcol::mincol#1 ] ( main:2::render:7::findcol:43 [ render::y#4 render::colline#5 render::x#2 findcol::x#0 findcol::y#0 findcol::i#10 findcol::diff#6 findcol::mincol#1 ] ) -- vbuyy=pbuc1_derefidx_vbuxx - ldy COLS,x + //SEG121 [69] (byte) findcol::mincol#1 ← *((const byte[]) COLS#0 + (byte) findcol::i#10) [ findcol::x#0 findcol::y#0 findcol::i#10 findcol::diff#6 findcol::mincol#1 ] ( main:2::render:7::findcol:43 [ render::y#4 render::colline#5 render::x#2 findcol::x#0 findcol::y#0 findcol::i#10 findcol::diff#6 findcol::mincol#1 ] ) -- vbuxx=pbuc1_derefidx_vbuz1 + ldx i + lda COLS,x + tax //SEG122 [70] phi from findcol::@16 findcol::@21 to findcol::@8 [phi:findcol::@16/findcol::@21->findcol::@8] b8_from_b16: b8_from_b21: @@ -2968,10 +2978,11 @@ findcol: { jmp b8 //SEG125 findcol::@8 b8: - //SEG126 [71] (byte) findcol::i#1 ← ++ (byte) findcol::i#10 [ findcol::x#0 findcol::y#0 findcol::i#1 findcol::mincol#2 findcol::mindiff#11 ] ( main:2::render:7::findcol:43 [ render::y#4 render::colline#5 render::x#2 findcol::x#0 findcol::y#0 findcol::i#1 findcol::mincol#2 findcol::mindiff#11 ] ) -- vbuxx=_inc_vbuxx - inx - //SEG127 [72] if((byte) findcol::i#1<(const byte) numpoints#0) goto findcol::@19 [ findcol::x#0 findcol::y#0 findcol::i#1 findcol::mincol#2 findcol::mindiff#11 ] ( main:2::render:7::findcol:43 [ render::y#4 render::colline#5 render::x#2 findcol::x#0 findcol::y#0 findcol::i#1 findcol::mincol#2 findcol::mindiff#11 ] ) -- vbuxx_lt_vbuc1_then_la1 - cpx #numpoints + //SEG126 [71] (byte) findcol::i#1 ← ++ (byte) findcol::i#10 [ findcol::x#0 findcol::y#0 findcol::i#1 findcol::mincol#2 findcol::mindiff#11 ] ( main:2::render:7::findcol:43 [ render::y#4 render::colline#5 render::x#2 findcol::x#0 findcol::y#0 findcol::i#1 findcol::mincol#2 findcol::mindiff#11 ] ) -- vbuz1=_inc_vbuz1 + inc i + //SEG127 [72] if((byte) findcol::i#1<(const byte) numpoints#0) goto findcol::@19 [ findcol::x#0 findcol::y#0 findcol::i#1 findcol::mincol#2 findcol::mindiff#11 ] ( main:2::render:7::findcol:43 [ render::y#4 render::colline#5 render::x#2 findcol::x#0 findcol::y#0 findcol::i#1 findcol::mincol#2 findcol::mindiff#11 ] ) -- vbuz1_lt_vbuc1_then_la1 + lda i + cmp #numpoints bcc b19 //SEG128 [59] phi from findcol::@8 to findcol::@return [phi:findcol::@8->findcol::@return] breturn_from_b8: @@ -2979,8 +2990,8 @@ findcol: { jmp breturn //SEG130 findcol::@19 b19: - //SEG131 [73] (byte~) findcol::mindiff#13 ← (byte) findcol::mindiff#11 [ findcol::x#0 findcol::y#0 findcol::i#1 findcol::mindiff#13 findcol::mincol#2 ] ( main:2::render:7::findcol:43 [ render::y#4 render::colline#5 render::x#2 findcol::x#0 findcol::y#0 findcol::i#1 findcol::mindiff#13 findcol::mincol#2 ] ) -- vbuz1=vbuaa - sta mindiff + //SEG131 [73] (byte~) findcol::mindiff#13 ← (byte) findcol::mindiff#11 [ findcol::x#0 findcol::y#0 findcol::i#1 findcol::mindiff#13 findcol::mincol#2 ] ( main:2::render:7::findcol:43 [ render::y#4 render::colline#5 render::x#2 findcol::x#0 findcol::y#0 findcol::i#1 findcol::mindiff#13 findcol::mincol#2 ] ) -- vbuz1=vbuyy + sty mindiff //SEG132 [54] phi from findcol::@19 to findcol::@1 [phi:findcol::@19->findcol::@1] b1_from_b19: //SEG133 [54] phi (byte) findcol::mincol#10 = (byte) findcol::mincol#2 [phi:findcol::@19->findcol::@1#0] -- register_copy @@ -2989,8 +3000,8 @@ findcol: { jmp b1 //SEG136 findcol::@21 b21: - //SEG137 [74] (byte~) findcol::mindiff#15 ← (byte) findcol::mindiff#10 [ findcol::x#0 findcol::y#0 findcol::i#10 findcol::mincol#10 findcol::mindiff#15 ] ( main:2::render:7::findcol:43 [ render::y#4 render::colline#5 render::x#2 findcol::x#0 findcol::y#0 findcol::i#10 findcol::mincol#10 findcol::mindiff#15 ] ) -- vbuaa=vbuz1 - lda mindiff + //SEG137 [74] (byte~) findcol::mindiff#15 ← (byte) findcol::mindiff#10 [ findcol::x#0 findcol::y#0 findcol::i#10 findcol::mincol#10 findcol::mindiff#15 ] ( main:2::render:7::findcol:43 [ render::y#4 render::colline#5 render::x#2 findcol::x#0 findcol::y#0 findcol::i#10 findcol::mincol#10 findcol::mindiff#15 ] ) -- vbuyy=vbuz1 + ldy mindiff jmp b8_from_b21 //SEG138 findcol::@6 b6: @@ -2998,9 +3009,10 @@ findcol: { lda y sec sbc yp - //SEG140 [76] (byte) findcol::diff#2 ← (byte) findcol::diff#4 + (byte~) findcol::$12 [ findcol::x#0 findcol::y#0 findcol::i#10 findcol::mindiff#10 findcol::mincol#10 findcol::diff#2 ] ( main:2::render:7::findcol:43 [ render::y#4 render::colline#5 render::x#2 findcol::x#0 findcol::y#0 findcol::i#10 findcol::mindiff#10 findcol::mincol#10 findcol::diff#2 ] ) -- vbuaa=vbuz1_plus_vbuaa + //SEG140 [76] (byte) findcol::diff#2 ← (byte) findcol::diff#4 + (byte~) findcol::$12 [ findcol::x#0 findcol::y#0 findcol::i#10 findcol::mindiff#10 findcol::mincol#10 findcol::diff#2 ] ( main:2::render:7::findcol:43 [ render::y#4 render::colline#5 render::x#2 findcol::x#0 findcol::y#0 findcol::i#10 findcol::mindiff#10 findcol::mincol#10 findcol::diff#2 ] ) -- vbuyy=vbuz1_plus_vbuaa clc adc diff + tay jmp b7_from_b6 //SEG141 findcol::@4 b4: @@ -3097,6 +3109,8 @@ Replacing instruction lda XPOS+1 with TXA Replacing instruction lda YPOS+2 with TXA Replacing instruction lda YPOS+3 with TXA Removing instruction lda XPOS+3 +Replacing instruction lda #0 with TXA +Removing instruction ldy i Succesful ASM optimization Pass5UnnecesaryLoadElimination Replacing label b1_from_b5 with b1 Replacing label b2_from_b5 with b2 @@ -3215,35 +3229,35 @@ FINAL SYMBOL TABLE (label) findcol::@9 (label) findcol::@return (byte) findcol::diff -(byte) findcol::diff#0 diff zp ZP_BYTE:7 20002.0 -(byte) findcol::diff#1 diff zp ZP_BYTE:7 20002.0 -(byte) findcol::diff#2 reg byte a 20002.0 -(byte) findcol::diff#3 reg byte a 20002.0 -(byte) findcol::diff#4 diff zp ZP_BYTE:7 10001.0 -(byte) findcol::diff#6 reg byte a 13334.666666666666 +(byte) findcol::diff#0 diff zp ZP_BYTE:8 20002.0 +(byte) findcol::diff#1 diff zp ZP_BYTE:8 20002.0 +(byte) findcol::diff#2 reg byte y 20002.0 +(byte) findcol::diff#3 reg byte y 20002.0 +(byte) findcol::diff#4 diff zp ZP_BYTE:8 10001.0 +(byte) findcol::diff#6 reg byte y 13334.666666666666 (byte) findcol::i -(byte) findcol::i#1 reg byte x 10001.0 -(byte) findcol::i#10 reg byte x 2631.842105263158 +(byte) findcol::i#1 i zp ZP_BYTE:6 10001.0 +(byte) findcol::i#10 i zp ZP_BYTE:6 2631.842105263158 (byte) findcol::mincol -(byte) findcol::mincol#1 reg byte y 20002.0 -(byte) findcol::mincol#10 reg byte y 1176.5882352941176 -(byte) findcol::mincol#2 reg byte y 10001.0 +(byte) findcol::mincol#1 reg byte x 20002.0 +(byte) findcol::mincol#10 reg byte x 1176.5882352941176 +(byte) findcol::mincol#2 reg byte x 10001.0 (byte) findcol::mindiff -(byte) findcol::mindiff#10 mindiff zp ZP_BYTE:6 1875.1875 -(byte) findcol::mindiff#11 reg byte a 10001.0 -(byte~) findcol::mindiff#13 mindiff zp ZP_BYTE:6 20002.0 -(byte~) findcol::mindiff#15 reg byte a 20002.0 +(byte) findcol::mindiff#10 mindiff zp ZP_BYTE:7 1875.1875 +(byte) findcol::mindiff#11 reg byte y 10001.0 +(byte~) findcol::mindiff#13 mindiff zp ZP_BYTE:7 20002.0 +(byte~) findcol::mindiff#15 reg byte y 20002.0 (byte) findcol::return (byte) findcol::return#0 reg byte a 2002.0 -(byte) findcol::return#2 reg byte y 3667.333333333333 +(byte) findcol::return#2 reg byte x 3667.333333333333 (byte) findcol::x (byte) findcol::x#0 x zp ZP_BYTE:5 1640.2 (byte) findcol::xp -(byte) findcol::xp#0 xp zp ZP_BYTE:7 10001.0 +(byte) findcol::xp#0 xp zp ZP_BYTE:8 10001.0 (byte) findcol::y (byte) findcol::y#0 y zp ZP_BYTE:2 1708.5416666666665 (byte) findcol::yp -(byte) findcol::yp#0 yp zp ZP_BYTE:8 6250.625 +(byte) findcol::yp#0 yp zp ZP_BYTE:9 6250.625 (void()) initscreen() (label) initscreen::@1 (label) initscreen::@return @@ -3278,11 +3292,11 @@ FINAL SYMBOL TABLE zp ZP_BYTE:2 [ render::y#4 render::y#1 findcol::y#0 ] zp ZP_WORD:3 [ render::colline#5 render::colline#1 initscreen::screen#2 initscreen::screen#1 ] zp ZP_BYTE:5 [ render::x#2 render::x#1 findcol::x#0 ] -reg byte x [ findcol::i#10 findcol::i#1 ] -zp ZP_BYTE:6 [ findcol::mindiff#10 findcol::mindiff#13 ] -reg byte y [ findcol::return#2 findcol::mincol#10 findcol::mincol#2 findcol::mincol#1 ] -zp ZP_BYTE:7 [ findcol::diff#4 findcol::diff#1 findcol::diff#0 findcol::xp#0 ] -reg byte a [ findcol::mindiff#11 findcol::diff#6 findcol::diff#3 findcol::diff#2 findcol::mindiff#15 ] +zp ZP_BYTE:6 [ findcol::i#10 findcol::i#1 ] +zp ZP_BYTE:7 [ findcol::mindiff#10 findcol::mindiff#13 ] +reg byte x [ findcol::return#2 findcol::mincol#10 findcol::mincol#2 findcol::mincol#1 ] +zp ZP_BYTE:8 [ findcol::diff#4 findcol::diff#1 findcol::diff#0 findcol::xp#0 ] +reg byte y [ findcol::mindiff#11 findcol::diff#6 findcol::diff#3 findcol::diff#2 findcol::mindiff#15 ] reg byte x [ animate::$0 ] reg byte x [ animate::$3 ] reg byte x [ animate::$6 ] @@ -3292,13 +3306,13 @@ reg byte a [ animate::$15 ] reg byte a [ animate::$18 ] reg byte a [ findcol::return#0 ] reg byte a [ render::col#0 ] -zp ZP_BYTE:8 [ findcol::yp#0 ] +zp ZP_BYTE:9 [ findcol::yp#0 ] reg byte a [ findcol::$10 ] reg byte a [ findcol::$12 ] FINAL ASSEMBLER -Score: 1438777 +Score: 1648777 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -3467,8 +3481,8 @@ render: { //SEG76 [43] call findcol param-assignment [ render::y#4 render::colline#5 render::x#2 findcol::return#2 ] ( main:2::render:7 [ render::y#4 render::colline#5 render::x#2 findcol::return#2 ] ) //SEG77 [53] phi from render::@2 to findcol [phi:render::@2->findcol] jsr findcol - //SEG78 [44] (byte) findcol::return#0 ← (byte) findcol::return#2 [ render::y#4 render::colline#5 render::x#2 findcol::return#0 ] ( main:2::render:7 [ render::y#4 render::colline#5 render::x#2 findcol::return#0 ] ) -- vbuaa=vbuyy - tya + //SEG78 [44] (byte) findcol::return#0 ← (byte) findcol::return#2 [ render::y#4 render::colline#5 render::x#2 findcol::return#0 ] ( main:2::render:7 [ render::y#4 render::colline#5 render::x#2 findcol::return#0 ] ) -- vbuaa=vbuxx + txa //SEG79 render::@5 //SEG80 [45] (byte) render::col#0 ← (byte) findcol::return#0 [ render::y#4 render::colline#5 render::x#2 render::col#0 ] ( main:2::render:7 [ render::y#4 render::colline#5 render::x#2 render::col#0 ] ) // (byte) render::col#0 = (byte) findcol::return#0 // register copy reg byte a @@ -3504,25 +3518,28 @@ render: { findcol: { .label x = 5 .label y = 2 - .label xp = 7 - .label yp = 8 - .label diff = 7 - .label mindiff = 6 + .label xp = 8 + .label yp = 9 + .label diff = 8 + .label i = 6 + .label mindiff = 7 //SEG91 [54] phi from findcol to findcol::@1 [phi:findcol->findcol::@1] - //SEG92 [54] phi (byte) findcol::mincol#10 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:findcol->findcol::@1#0] -- vbuyy=vbuc1 - ldy #0 + //SEG92 [54] phi (byte) findcol::mincol#10 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:findcol->findcol::@1#0] -- vbuxx=vbuc1 + ldx #0 //SEG93 [54] phi (byte) findcol::mindiff#10 = (byte/word/signed word/dword/signed dword) 255 [phi:findcol->findcol::@1#1] -- vbuz1=vbuc1 lda #$ff sta mindiff - //SEG94 [54] phi (byte) findcol::i#10 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:findcol->findcol::@1#2] -- vbuxx=vbuc1 - ldx #0 + //SEG94 [54] phi (byte) findcol::i#10 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:findcol->findcol::@1#2] -- vbuz1=vbuc1 + txa + sta i //SEG95 findcol::@1 b1: - //SEG96 [55] (byte) findcol::xp#0 ← *((const byte[]) XPOS#0 + (byte) findcol::i#10) [ findcol::x#0 findcol::y#0 findcol::i#10 findcol::mindiff#10 findcol::mincol#10 findcol::xp#0 ] ( main:2::render:7::findcol:43 [ render::y#4 render::colline#5 render::x#2 findcol::x#0 findcol::y#0 findcol::i#10 findcol::mindiff#10 findcol::mincol#10 findcol::xp#0 ] ) -- vbuz1=pbuc1_derefidx_vbuxx - lda XPOS,x + //SEG96 [55] (byte) findcol::xp#0 ← *((const byte[]) XPOS#0 + (byte) findcol::i#10) [ findcol::x#0 findcol::y#0 findcol::i#10 findcol::mindiff#10 findcol::mincol#10 findcol::xp#0 ] ( main:2::render:7::findcol:43 [ render::y#4 render::colline#5 render::x#2 findcol::x#0 findcol::y#0 findcol::i#10 findcol::mindiff#10 findcol::mincol#10 findcol::xp#0 ] ) -- vbuz1=pbuc1_derefidx_vbuz2 + ldy i + lda XPOS,y sta xp - //SEG97 [56] (byte) findcol::yp#0 ← *((const byte[]) YPOS#0 + (byte) findcol::i#10) [ findcol::x#0 findcol::y#0 findcol::i#10 findcol::mindiff#10 findcol::mincol#10 findcol::xp#0 findcol::yp#0 ] ( main:2::render:7::findcol:43 [ render::y#4 render::colline#5 render::x#2 findcol::x#0 findcol::y#0 findcol::i#10 findcol::mindiff#10 findcol::mincol#10 findcol::xp#0 findcol::yp#0 ] ) -- vbuz1=pbuc1_derefidx_vbuxx - lda YPOS,x + //SEG97 [56] (byte) findcol::yp#0 ← *((const byte[]) YPOS#0 + (byte) findcol::i#10) [ findcol::x#0 findcol::y#0 findcol::i#10 findcol::mindiff#10 findcol::mincol#10 findcol::xp#0 findcol::yp#0 ] ( main:2::render:7::findcol:43 [ render::y#4 render::colline#5 render::x#2 findcol::x#0 findcol::y#0 findcol::i#10 findcol::mindiff#10 findcol::mincol#10 findcol::xp#0 findcol::yp#0 ] ) -- vbuz1=pbuc1_derefidx_vbuz2 + lda YPOS,y sta yp //SEG98 [57] if((byte) findcol::x#0!=(byte) findcol::xp#0) goto findcol::@2 [ findcol::x#0 findcol::y#0 findcol::i#10 findcol::mindiff#10 findcol::mincol#10 findcol::xp#0 findcol::yp#0 ] ( main:2::render:7::findcol:43 [ render::y#4 render::colline#5 render::x#2 findcol::x#0 findcol::y#0 findcol::i#10 findcol::mindiff#10 findcol::mincol#10 findcol::xp#0 findcol::yp#0 ] ) -- vbuz1_neq_vbuz2_then_la1 lda x @@ -3534,8 +3551,8 @@ findcol: { cmp yp bne b2 //SEG101 [59] phi from findcol::@9 to findcol::@return [phi:findcol::@9->findcol::@return] - //SEG102 [59] phi (byte) findcol::return#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:findcol::@9->findcol::@return#0] -- vbuyy=vbuc1 - ldy #0 + //SEG102 [59] phi (byte) findcol::return#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:findcol::@9->findcol::@return#0] -- vbuxx=vbuc1 + ldx #0 //SEG103 findcol::@return breturn: //SEG104 [60] return [ findcol::return#2 ] ( main:2::render:7::findcol:43 [ render::y#4 render::colline#5 render::x#2 findcol::return#2 ] ) @@ -3565,36 +3582,40 @@ findcol: { lda yp sec sbc y - //SEG115 [66] (byte) findcol::diff#3 ← (byte) findcol::diff#4 + (byte~) findcol::$10 [ findcol::x#0 findcol::y#0 findcol::i#10 findcol::mindiff#10 findcol::mincol#10 findcol::diff#3 ] ( main:2::render:7::findcol:43 [ render::y#4 render::colline#5 render::x#2 findcol::x#0 findcol::y#0 findcol::i#10 findcol::mindiff#10 findcol::mincol#10 findcol::diff#3 ] ) -- vbuaa=vbuz1_plus_vbuaa + //SEG115 [66] (byte) findcol::diff#3 ← (byte) findcol::diff#4 + (byte~) findcol::$10 [ findcol::x#0 findcol::y#0 findcol::i#10 findcol::mindiff#10 findcol::mincol#10 findcol::diff#3 ] ( main:2::render:7::findcol:43 [ render::y#4 render::colline#5 render::x#2 findcol::x#0 findcol::y#0 findcol::i#10 findcol::mindiff#10 findcol::mincol#10 findcol::diff#3 ] ) -- vbuyy=vbuz1_plus_vbuaa clc adc diff + tay //SEG116 [67] phi from findcol::@14 findcol::@6 to findcol::@7 [phi:findcol::@14/findcol::@6->findcol::@7] //SEG117 [67] phi (byte) findcol::diff#6 = (byte) findcol::diff#3 [phi:findcol::@14/findcol::@6->findcol::@7#0] -- register_copy //SEG118 findcol::@7 b7: - //SEG119 [68] if((byte) findcol::diff#6>=(byte) findcol::mindiff#10) goto findcol::@21 [ findcol::x#0 findcol::y#0 findcol::i#10 findcol::mindiff#10 findcol::mincol#10 findcol::diff#6 ] ( main:2::render:7::findcol:43 [ render::y#4 render::colline#5 render::x#2 findcol::x#0 findcol::y#0 findcol::i#10 findcol::mindiff#10 findcol::mincol#10 findcol::diff#6 ] ) -- vbuaa_ge_vbuz1_then_la1 - cmp mindiff + //SEG119 [68] if((byte) findcol::diff#6>=(byte) findcol::mindiff#10) goto findcol::@21 [ findcol::x#0 findcol::y#0 findcol::i#10 findcol::mindiff#10 findcol::mincol#10 findcol::diff#6 ] ( main:2::render:7::findcol:43 [ render::y#4 render::colline#5 render::x#2 findcol::x#0 findcol::y#0 findcol::i#10 findcol::mindiff#10 findcol::mincol#10 findcol::diff#6 ] ) -- vbuyy_ge_vbuz1_then_la1 + cpy mindiff bcs b21 //SEG120 findcol::@16 - //SEG121 [69] (byte) findcol::mincol#1 ← *((const byte[]) COLS#0 + (byte) findcol::i#10) [ findcol::x#0 findcol::y#0 findcol::i#10 findcol::diff#6 findcol::mincol#1 ] ( main:2::render:7::findcol:43 [ render::y#4 render::colline#5 render::x#2 findcol::x#0 findcol::y#0 findcol::i#10 findcol::diff#6 findcol::mincol#1 ] ) -- vbuyy=pbuc1_derefidx_vbuxx - ldy COLS,x + //SEG121 [69] (byte) findcol::mincol#1 ← *((const byte[]) COLS#0 + (byte) findcol::i#10) [ findcol::x#0 findcol::y#0 findcol::i#10 findcol::diff#6 findcol::mincol#1 ] ( main:2::render:7::findcol:43 [ render::y#4 render::colline#5 render::x#2 findcol::x#0 findcol::y#0 findcol::i#10 findcol::diff#6 findcol::mincol#1 ] ) -- vbuxx=pbuc1_derefidx_vbuz1 + ldx i + lda COLS,x + tax //SEG122 [70] phi from findcol::@16 findcol::@21 to findcol::@8 [phi:findcol::@16/findcol::@21->findcol::@8] //SEG123 [70] phi (byte) findcol::mindiff#11 = (byte) findcol::diff#6 [phi:findcol::@16/findcol::@21->findcol::@8#0] -- register_copy //SEG124 [70] phi (byte) findcol::mincol#2 = (byte) findcol::mincol#1 [phi:findcol::@16/findcol::@21->findcol::@8#1] -- register_copy //SEG125 findcol::@8 b8: - //SEG126 [71] (byte) findcol::i#1 ← ++ (byte) findcol::i#10 [ findcol::x#0 findcol::y#0 findcol::i#1 findcol::mincol#2 findcol::mindiff#11 ] ( main:2::render:7::findcol:43 [ render::y#4 render::colline#5 render::x#2 findcol::x#0 findcol::y#0 findcol::i#1 findcol::mincol#2 findcol::mindiff#11 ] ) -- vbuxx=_inc_vbuxx - inx - //SEG127 [72] if((byte) findcol::i#1<(const byte) numpoints#0) goto findcol::@19 [ findcol::x#0 findcol::y#0 findcol::i#1 findcol::mincol#2 findcol::mindiff#11 ] ( main:2::render:7::findcol:43 [ render::y#4 render::colline#5 render::x#2 findcol::x#0 findcol::y#0 findcol::i#1 findcol::mincol#2 findcol::mindiff#11 ] ) -- vbuxx_lt_vbuc1_then_la1 - cpx #numpoints + //SEG126 [71] (byte) findcol::i#1 ← ++ (byte) findcol::i#10 [ findcol::x#0 findcol::y#0 findcol::i#1 findcol::mincol#2 findcol::mindiff#11 ] ( main:2::render:7::findcol:43 [ render::y#4 render::colline#5 render::x#2 findcol::x#0 findcol::y#0 findcol::i#1 findcol::mincol#2 findcol::mindiff#11 ] ) -- vbuz1=_inc_vbuz1 + inc i + //SEG127 [72] if((byte) findcol::i#1<(const byte) numpoints#0) goto findcol::@19 [ findcol::x#0 findcol::y#0 findcol::i#1 findcol::mincol#2 findcol::mindiff#11 ] ( main:2::render:7::findcol:43 [ render::y#4 render::colline#5 render::x#2 findcol::x#0 findcol::y#0 findcol::i#1 findcol::mincol#2 findcol::mindiff#11 ] ) -- vbuz1_lt_vbuc1_then_la1 + lda i + cmp #numpoints bcc b19 //SEG128 [59] phi from findcol::@8 to findcol::@return [phi:findcol::@8->findcol::@return] //SEG129 [59] phi (byte) findcol::return#2 = (byte) findcol::mincol#2 [phi:findcol::@8->findcol::@return#0] -- register_copy jmp breturn //SEG130 findcol::@19 b19: - //SEG131 [73] (byte~) findcol::mindiff#13 ← (byte) findcol::mindiff#11 [ findcol::x#0 findcol::y#0 findcol::i#1 findcol::mindiff#13 findcol::mincol#2 ] ( main:2::render:7::findcol:43 [ render::y#4 render::colline#5 render::x#2 findcol::x#0 findcol::y#0 findcol::i#1 findcol::mindiff#13 findcol::mincol#2 ] ) -- vbuz1=vbuaa - sta mindiff + //SEG131 [73] (byte~) findcol::mindiff#13 ← (byte) findcol::mindiff#11 [ findcol::x#0 findcol::y#0 findcol::i#1 findcol::mindiff#13 findcol::mincol#2 ] ( main:2::render:7::findcol:43 [ render::y#4 render::colline#5 render::x#2 findcol::x#0 findcol::y#0 findcol::i#1 findcol::mindiff#13 findcol::mincol#2 ] ) -- vbuz1=vbuyy + sty mindiff //SEG132 [54] phi from findcol::@19 to findcol::@1 [phi:findcol::@19->findcol::@1] //SEG133 [54] phi (byte) findcol::mincol#10 = (byte) findcol::mincol#2 [phi:findcol::@19->findcol::@1#0] -- register_copy //SEG134 [54] phi (byte) findcol::mindiff#10 = (byte~) findcol::mindiff#13 [phi:findcol::@19->findcol::@1#1] -- register_copy @@ -3602,8 +3623,8 @@ findcol: { jmp b1 //SEG136 findcol::@21 b21: - //SEG137 [74] (byte~) findcol::mindiff#15 ← (byte) findcol::mindiff#10 [ findcol::x#0 findcol::y#0 findcol::i#10 findcol::mincol#10 findcol::mindiff#15 ] ( main:2::render:7::findcol:43 [ render::y#4 render::colline#5 render::x#2 findcol::x#0 findcol::y#0 findcol::i#10 findcol::mincol#10 findcol::mindiff#15 ] ) -- vbuaa=vbuz1 - lda mindiff + //SEG137 [74] (byte~) findcol::mindiff#15 ← (byte) findcol::mindiff#10 [ findcol::x#0 findcol::y#0 findcol::i#10 findcol::mincol#10 findcol::mindiff#15 ] ( main:2::render:7::findcol:43 [ render::y#4 render::colline#5 render::x#2 findcol::x#0 findcol::y#0 findcol::i#10 findcol::mincol#10 findcol::mindiff#15 ] ) -- vbuyy=vbuz1 + ldy mindiff jmp b8 //SEG138 findcol::@6 b6: @@ -3611,9 +3632,10 @@ findcol: { lda y sec sbc yp - //SEG140 [76] (byte) findcol::diff#2 ← (byte) findcol::diff#4 + (byte~) findcol::$12 [ findcol::x#0 findcol::y#0 findcol::i#10 findcol::mindiff#10 findcol::mincol#10 findcol::diff#2 ] ( main:2::render:7::findcol:43 [ render::y#4 render::colline#5 render::x#2 findcol::x#0 findcol::y#0 findcol::i#10 findcol::mindiff#10 findcol::mincol#10 findcol::diff#2 ] ) -- vbuaa=vbuz1_plus_vbuaa + //SEG140 [76] (byte) findcol::diff#2 ← (byte) findcol::diff#4 + (byte~) findcol::$12 [ findcol::x#0 findcol::y#0 findcol::i#10 findcol::mindiff#10 findcol::mincol#10 findcol::diff#2 ] ( main:2::render:7::findcol:43 [ render::y#4 render::colline#5 render::x#2 findcol::x#0 findcol::y#0 findcol::i#10 findcol::mindiff#10 findcol::mincol#10 findcol::diff#2 ] ) -- vbuyy=vbuz1_plus_vbuaa clc adc diff + tay jmp b7 //SEG141 findcol::@4 b4: diff --git a/src/test/java/dk/camelot64/kickc/test/ref/voronoi.sym b/src/test/java/dk/camelot64/kickc/test/ref/voronoi.sym index 037430ea1..737fd2e2c 100644 --- a/src/test/java/dk/camelot64/kickc/test/ref/voronoi.sym +++ b/src/test/java/dk/camelot64/kickc/test/ref/voronoi.sym @@ -50,35 +50,35 @@ (label) findcol::@9 (label) findcol::@return (byte) findcol::diff -(byte) findcol::diff#0 diff zp ZP_BYTE:7 20002.0 -(byte) findcol::diff#1 diff zp ZP_BYTE:7 20002.0 -(byte) findcol::diff#2 reg byte a 20002.0 -(byte) findcol::diff#3 reg byte a 20002.0 -(byte) findcol::diff#4 diff zp ZP_BYTE:7 10001.0 -(byte) findcol::diff#6 reg byte a 13334.666666666666 +(byte) findcol::diff#0 diff zp ZP_BYTE:8 20002.0 +(byte) findcol::diff#1 diff zp ZP_BYTE:8 20002.0 +(byte) findcol::diff#2 reg byte y 20002.0 +(byte) findcol::diff#3 reg byte y 20002.0 +(byte) findcol::diff#4 diff zp ZP_BYTE:8 10001.0 +(byte) findcol::diff#6 reg byte y 13334.666666666666 (byte) findcol::i -(byte) findcol::i#1 reg byte x 10001.0 -(byte) findcol::i#10 reg byte x 2631.842105263158 +(byte) findcol::i#1 i zp ZP_BYTE:6 10001.0 +(byte) findcol::i#10 i zp ZP_BYTE:6 2631.842105263158 (byte) findcol::mincol -(byte) findcol::mincol#1 reg byte y 20002.0 -(byte) findcol::mincol#10 reg byte y 1176.5882352941176 -(byte) findcol::mincol#2 reg byte y 10001.0 +(byte) findcol::mincol#1 reg byte x 20002.0 +(byte) findcol::mincol#10 reg byte x 1176.5882352941176 +(byte) findcol::mincol#2 reg byte x 10001.0 (byte) findcol::mindiff -(byte) findcol::mindiff#10 mindiff zp ZP_BYTE:6 1875.1875 -(byte) findcol::mindiff#11 reg byte a 10001.0 -(byte~) findcol::mindiff#13 mindiff zp ZP_BYTE:6 20002.0 -(byte~) findcol::mindiff#15 reg byte a 20002.0 +(byte) findcol::mindiff#10 mindiff zp ZP_BYTE:7 1875.1875 +(byte) findcol::mindiff#11 reg byte y 10001.0 +(byte~) findcol::mindiff#13 mindiff zp ZP_BYTE:7 20002.0 +(byte~) findcol::mindiff#15 reg byte y 20002.0 (byte) findcol::return (byte) findcol::return#0 reg byte a 2002.0 -(byte) findcol::return#2 reg byte y 3667.333333333333 +(byte) findcol::return#2 reg byte x 3667.333333333333 (byte) findcol::x (byte) findcol::x#0 x zp ZP_BYTE:5 1640.2 (byte) findcol::xp -(byte) findcol::xp#0 xp zp ZP_BYTE:7 10001.0 +(byte) findcol::xp#0 xp zp ZP_BYTE:8 10001.0 (byte) findcol::y (byte) findcol::y#0 y zp ZP_BYTE:2 1708.5416666666665 (byte) findcol::yp -(byte) findcol::yp#0 yp zp ZP_BYTE:8 6250.625 +(byte) findcol::yp#0 yp zp ZP_BYTE:9 6250.625 (void()) initscreen() (label) initscreen::@1 (label) initscreen::@return @@ -113,11 +113,11 @@ zp ZP_BYTE:2 [ render::y#4 render::y#1 findcol::y#0 ] zp ZP_WORD:3 [ render::colline#5 render::colline#1 initscreen::screen#2 initscreen::screen#1 ] zp ZP_BYTE:5 [ render::x#2 render::x#1 findcol::x#0 ] -reg byte x [ findcol::i#10 findcol::i#1 ] -zp ZP_BYTE:6 [ findcol::mindiff#10 findcol::mindiff#13 ] -reg byte y [ findcol::return#2 findcol::mincol#10 findcol::mincol#2 findcol::mincol#1 ] -zp ZP_BYTE:7 [ findcol::diff#4 findcol::diff#1 findcol::diff#0 findcol::xp#0 ] -reg byte a [ findcol::mindiff#11 findcol::diff#6 findcol::diff#3 findcol::diff#2 findcol::mindiff#15 ] +zp ZP_BYTE:6 [ findcol::i#10 findcol::i#1 ] +zp ZP_BYTE:7 [ findcol::mindiff#10 findcol::mindiff#13 ] +reg byte x [ findcol::return#2 findcol::mincol#10 findcol::mincol#2 findcol::mincol#1 ] +zp ZP_BYTE:8 [ findcol::diff#4 findcol::diff#1 findcol::diff#0 findcol::xp#0 ] +reg byte y [ findcol::mindiff#11 findcol::diff#6 findcol::diff#3 findcol::diff#2 findcol::mindiff#15 ] reg byte x [ animate::$0 ] reg byte x [ animate::$3 ] reg byte x [ animate::$6 ] @@ -127,6 +127,6 @@ reg byte a [ animate::$15 ] reg byte a [ animate::$18 ] reg byte a [ findcol::return#0 ] reg byte a [ render::col#0 ] -zp ZP_BYTE:8 [ findcol::yp#0 ] +zp ZP_BYTE:9 [ findcol::yp#0 ] reg byte a [ findcol::$10 ] reg byte a [ findcol::$12 ] diff --git a/src/test/java/dk/camelot64/kickc/test/ref/zpparammin.log b/src/test/java/dk/camelot64/kickc/test/ref/zpparammin.log index d2ab94d0f..9dc79c94c 100644 --- a/src/test/java/dk/camelot64/kickc/test/ref/zpparammin.log +++ b/src/test/java/dk/camelot64/kickc/test/ref/zpparammin.log @@ -810,7 +810,9 @@ Uplift Scope [] Uplifting [main] best 1345 combination zp ZP_BYTE:2 [ main::i#2 main::i#1 ] reg byte a [ main::$2 ] reg byte a [ main::$5 ] Uplifting [sum] best 1179 combination reg byte a [ sum::return#0 ] reg byte a [ sum::a#0 ] reg byte y [ sum::b#0 ] reg byte x [ sum::c#0 ] reg byte a [ sum::return#1 ] reg byte a [ sum::$0 ] +Limited combination testing to 1000 combinations of 2304 possible. Uplifting [sum2] best 1013 combination reg byte a [ sum2::return#0 ] reg byte a [ sum2::a#0 ] reg byte y [ sum2::b#0 ] reg byte x [ sum2::c#0 ] reg byte a [ sum2::return#1 ] reg byte a [ sum2::$0 ] +Limited combination testing to 1000 combinations of 2304 possible. Uplifting [] best 1013 combination Attempting to uplift remaining variables inzp ZP_BYTE:2 [ main::i#2 main::i#1 ] Uplifting [main] best 1013 combination zp ZP_BYTE:2 [ main::i#2 main::i#1 ]