From 459c220af37d2ca30b22257e4af309c866caaf45 Mon Sep 17 00:00:00 2001 From: jespergravgaard Date: Sun, 13 Jun 2021 08:38:46 +0200 Subject: [PATCH] Working on deprecating lo/hi operators. Closes #667 --- src/test/ref/bitmap-plotter.asm | 32 +- src/test/ref/bitmap-plotter.log | 761 ++++---------------------------- src/test/ref/bitmap-plotter.sym | 42 +- 3 files changed, 120 insertions(+), 715 deletions(-) diff --git a/src/test/ref/bitmap-plotter.asm b/src/test/ref/bitmap-plotter.asm index 68e79cfee..dfb27a9cd 100644 --- a/src/test/ref/bitmap-plotter.asm +++ b/src/test/ref/bitmap-plotter.asm @@ -48,8 +48,8 @@ main: { jmp __b1 } init_screen: { - .label b = 7 - .label c = 5 + .label b = 6 + .label c = 4 lda #BITMAP @@ -101,7 +101,7 @@ init_screen: { } init_plot_tables: { .label __9 = 2 - .label yoffs = 7 + .label yoffs = 6 ldy #$80 ldx #0 __b1: @@ -168,35 +168,31 @@ init_plot_tables: { rts } plots: { - .label i = 2 - lda #0 - sta.z i + ldx #0 __b1: // for(byte i=0; iBITMAP [ init_plot_tables::x#2 Statement [26] plot_bit[init_plot_tables::x#2] = init_plot_tables::bits#3 [ init_plot_tables::x#2 init_plot_tables::bits#3 ] ( init_plot_tables:6 [ init_plot_tables::x#2 init_plot_tables::bits#3 ] { } ) always clobbers reg byte a Statement [34] init_plot_tables::$9 = init_plot_tables::y#2 & 7 [ init_plot_tables::y#2 init_plot_tables::yoffs#2 init_plot_tables::$9 ] ( init_plot_tables:6 [ init_plot_tables::y#2 init_plot_tables::yoffs#2 init_plot_tables::$9 ] { } ) always clobbers reg byte a Statement [41] init_plot_tables::yoffs#1 = init_plot_tables::yoffs#2 + (word)$28*8 [ init_plot_tables::y#2 init_plot_tables::yoffs#1 ] ( init_plot_tables:6 [ init_plot_tables::y#2 init_plot_tables::yoffs#1 ] { } ) always clobbers reg byte a -Statement [48] if(plots::i#2init_screen::@1] __b1_from_init_screen: // [12] phi init_screen::b#2 = BITMAP [phi:init_screen->init_screen::@1#0] -- pbuz1=pbuc1 @@ -1678,7 +1097,7 @@ init_screen: { // init_plot_tables init_plot_tables: { .label __9 = 2 - .label yoffs = 7 + .label yoffs = 6 // [22] phi from init_plot_tables to init_plot_tables::@1 [phi:init_plot_tables->init_plot_tables::@1] __b1_from_init_plot_tables: // [22] phi init_plot_tables::bits#3 = $80 [phi:init_plot_tables->init_plot_tables::@1#0] -- vbuyy=vbuc1 @@ -1797,18 +1216,15 @@ init_plot_tables: { } // plots plots: { - .label i = 2 // [47] phi from plots to plots::@1 [phi:plots->plots::@1] __b1_from_plots: - // [47] phi plots::i#2 = 0 [phi:plots->plots::@1#0] -- vbuz1=vbuc1 - lda #0 - sta.z i + // [47] phi plots::i#2 = 0 [phi:plots->plots::@1#0] -- vbuxx=vbuc1 + ldx #0 jmp __b1 // plots::@1 __b1: - // [48] if(plots::i#2plots::@1] __b1_from___b3: // [47] phi plots::i#2 = plots::i#1 [phi:plots::@3->plots::@1#0] -- register_copy jmp __b1 } // plot -// plot(byte zp(3) x, byte zp(4) y) +// plot(byte zp(2) x, byte zp(3) y) plot: { - .label x = 3 - .label y = 4 - .label plotter_x = 5 - .label plotter_y = 7 - .label plotter = 5 + .label x = 2 + .label y = 3 + .label plotter_x = 4 + .label plotter_y = 6 + .label plotter = 4 // [54] plot::$6 = plot_xhi[plot::x#0] -- vbuaa=pbuc1_derefidx_vbuz1 ldy.z x lda plot_xhi,y @@ -1925,7 +1339,6 @@ Removing instruction lda #0 Replacing instruction ldy #0 with TAY Removing instruction lda #>0 Replacing instruction ldx #0 with TAX -Removing instruction ldy.z i Removing instruction ldy.z x Removing instruction ldy.z y Succesful ASM optimization Pass5UnnecesaryLoadElimination @@ -1997,16 +1410,16 @@ byte init_plot_tables::y byte init_plot_tables::y#1 reg byte x 151.5 byte init_plot_tables::y#2 reg byte x 50.5 byte* init_plot_tables::yoffs -byte* init_plot_tables::yoffs#1 yoffs zp[2]:7 202.0 -byte* init_plot_tables::yoffs#2 yoffs zp[2]:7 63.125 -byte* init_plot_tables::yoffs#4 yoffs zp[2]:7 101.0 +byte* init_plot_tables::yoffs#1 yoffs zp[2]:6 202.0 +byte* init_plot_tables::yoffs#2 yoffs zp[2]:6 63.125 +byte* init_plot_tables::yoffs#4 yoffs zp[2]:6 101.0 void init_screen() byte* init_screen::b -byte* init_screen::b#1 b zp[2]:7 202.0 -byte* init_screen::b#2 b zp[2]:7 134.66666666666666 +byte* init_screen::b#1 b zp[2]:6 202.0 +byte* init_screen::b#2 b zp[2]:6 134.66666666666666 byte* init_screen::c -byte* init_screen::c#1 c zp[2]:5 202.0 -byte* init_screen::c#2 c zp[2]:5 134.66666666666666 +byte* init_screen::c#1 c zp[2]:4 202.0 +byte* init_screen::c#2 c zp[2]:4 134.66666666666666 void main() void plot(byte plot::x , byte plot::y) byte~ plot::$5 reg byte a 200002.0 @@ -2015,17 +1428,17 @@ byte~ plot::$7 reg byte a 200002.0 byte~ plot::$8 reg byte a 200002.0 byte~ plot::$9 reg byte a 200002.0 byte* plot::plotter -byte* plot::plotter#0 plotter zp[2]:5 150001.5 +byte* plot::plotter#0 plotter zp[2]:4 150001.5 byte* plot::plotter_x -byte* plot::plotter_x#1 plotter_x zp[2]:5 100001.0 -byte* plot::plotter_x#2 plotter_x zp[2]:5 40000.4 +byte* plot::plotter_x#1 plotter_x zp[2]:4 100001.0 +byte* plot::plotter_x#2 plotter_x zp[2]:4 40000.4 word plot::plotter_y -word plot::plotter_y#1 plotter_y zp[2]:7 100001.0 -word plot::plotter_y#2 plotter_y zp[2]:7 200002.0 +word plot::plotter_y#1 plotter_y zp[2]:6 100001.0 +word plot::plotter_y#2 plotter_y zp[2]:6 200002.0 byte plot::x -byte plot::x#0 x zp[1]:3 28182.181818181816 +byte plot::x#0 x zp[1]:2 28182.181818181816 byte plot::y -byte plot::y#0 y zp[1]:4 30000.428571428572 +byte plot::y#0 y zp[1]:3 30000.428571428572 constant const byte* plot_bit[$100] = { fill( $100, 0) } constant const byte* plot_xhi[$100] = { fill( $100, 0) } constant const byte* plot_xlo[$100] = { fill( $100, 0) } @@ -2033,8 +1446,8 @@ constant const byte* plot_yhi[$100] = { fill( $100, 0) } constant const byte* plot_ylo[$100] = { fill( $100, 0) } void plots() byte plots::i -byte plots::i#1 i zp[1]:2 20002.0 -byte plots::i#2 i zp[1]:2 10001.0 +byte plots::i#1 reg byte x 20002.0 +byte plots::i#2 reg byte x 10001.0 constant byte plots_cnt = 8 constant byte* plots_x[] = { $3c, $50, $6e, $50, $3c, $28, $a, $28 } constant byte* plots_y[] = { $a, $28, $3c, $50, $6e, $50, $3c, $28 } @@ -2042,24 +1455,24 @@ constant byte* plots_y[] = { $a, $28, $3c, $50, $6e, $50, $3c, $28 } reg byte x [ init_plot_tables::x#2 init_plot_tables::x#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::y#2 init_plot_tables::y#1 ] +reg byte x [ plots::i#2 plots::i#1 ] reg byte a [ init_plot_tables::$0 ] -zp[1]:2 [ init_plot_tables::$9 plots::i#2 plots::i#1 ] reg byte a [ init_plot_tables::$6 ] reg byte a [ init_plot_tables::$7 ] reg byte a [ init_plot_tables::$8 ] -zp[1]:3 [ plot::x#0 ] -zp[1]:4 [ plot::y#0 ] +zp[1]:2 [ plot::x#0 init_plot_tables::$9 ] +zp[1]:3 [ plot::y#0 ] reg byte a [ plot::$6 ] -zp[2]:5 [ plot::plotter_x#1 plot::plotter_x#2 plot::plotter#0 init_screen::c#2 init_screen::c#1 ] +zp[2]:4 [ plot::plotter_x#1 plot::plotter_x#2 plot::plotter#0 init_screen::c#2 init_screen::c#1 ] reg byte a [ plot::$7 ] reg byte a [ plot::$8 ] -zp[2]:7 [ plot::plotter_y#1 plot::plotter_y#2 init_plot_tables::yoffs#2 init_plot_tables::yoffs#4 init_plot_tables::yoffs#1 init_screen::b#2 init_screen::b#1 ] +zp[2]:6 [ plot::plotter_y#1 plot::plotter_y#2 init_plot_tables::yoffs#2 init_plot_tables::yoffs#4 init_plot_tables::yoffs#1 init_screen::b#2 init_screen::b#1 ] reg byte a [ plot::$9 ] reg byte a [ plot::$5 ] FINAL ASSEMBLER -Score: 7731 +Score: 6531 // File Comments // Upstart @@ -2134,8 +1547,8 @@ main: { } // init_screen init_screen: { - .label b = 7 - .label c = 5 + .label b = 6 + .label c = 4 // [12] phi from init_screen to init_screen::@1 [phi:init_screen->init_screen::@1] // [12] phi init_screen::b#2 = BITMAP [phi:init_screen->init_screen::@1#0] -- pbuz1=pbuc1 lda #init_plot_tables::@1] // [22] phi init_plot_tables::bits#3 = $80 [phi:init_plot_tables->init_plot_tables::@1#0] -- vbuyy=vbuc1 ldy #$80 @@ -2321,17 +1734,14 @@ init_plot_tables: { } // plots plots: { - .label i = 2 // [47] phi from plots to plots::@1 [phi:plots->plots::@1] - // [47] phi plots::i#2 = 0 [phi:plots->plots::@1#0] -- vbuz1=vbuc1 - lda #0 - sta.z i + // [47] phi plots::i#2 = 0 [phi:plots->plots::@1#0] -- vbuxx=vbuc1 + ldx #0 // plots::@1 __b1: // for(byte i=0; iplots::@1] // [47] phi plots::i#2 = plots::i#1 [phi:plots::@3->plots::@1#0] -- register_copy jmp __b1 } // plot -// plot(byte zp(3) x, byte zp(4) y) +// plot(byte zp(2) x, byte zp(3) y) plot: { - .label x = 3 - .label y = 4 - .label plotter_x = 5 - .label plotter_y = 7 - .label plotter = 5 + .label x = 2 + .label y = 3 + .label plotter_x = 4 + .label plotter_y = 6 + .label plotter = 4 // BYTE1(plotter_x) = plot_xhi[x] // [54] plot::$6 = plot_xhi[plot::x#0] -- vbuaa=pbuc1_derefidx_vbuz1 ldy.z x diff --git a/src/test/ref/bitmap-plotter.sym b/src/test/ref/bitmap-plotter.sym index fc9488f01..def0c8244 100644 --- a/src/test/ref/bitmap-plotter.sym +++ b/src/test/ref/bitmap-plotter.sym @@ -25,16 +25,16 @@ byte init_plot_tables::y byte init_plot_tables::y#1 reg byte x 151.5 byte init_plot_tables::y#2 reg byte x 50.5 byte* init_plot_tables::yoffs -byte* init_plot_tables::yoffs#1 yoffs zp[2]:7 202.0 -byte* init_plot_tables::yoffs#2 yoffs zp[2]:7 63.125 -byte* init_plot_tables::yoffs#4 yoffs zp[2]:7 101.0 +byte* init_plot_tables::yoffs#1 yoffs zp[2]:6 202.0 +byte* init_plot_tables::yoffs#2 yoffs zp[2]:6 63.125 +byte* init_plot_tables::yoffs#4 yoffs zp[2]:6 101.0 void init_screen() byte* init_screen::b -byte* init_screen::b#1 b zp[2]:7 202.0 -byte* init_screen::b#2 b zp[2]:7 134.66666666666666 +byte* init_screen::b#1 b zp[2]:6 202.0 +byte* init_screen::b#2 b zp[2]:6 134.66666666666666 byte* init_screen::c -byte* init_screen::c#1 c zp[2]:5 202.0 -byte* init_screen::c#2 c zp[2]:5 134.66666666666666 +byte* init_screen::c#1 c zp[2]:4 202.0 +byte* init_screen::c#2 c zp[2]:4 134.66666666666666 void main() void plot(byte plot::x , byte plot::y) byte~ plot::$5 reg byte a 200002.0 @@ -43,17 +43,17 @@ byte~ plot::$7 reg byte a 200002.0 byte~ plot::$8 reg byte a 200002.0 byte~ plot::$9 reg byte a 200002.0 byte* plot::plotter -byte* plot::plotter#0 plotter zp[2]:5 150001.5 +byte* plot::plotter#0 plotter zp[2]:4 150001.5 byte* plot::plotter_x -byte* plot::plotter_x#1 plotter_x zp[2]:5 100001.0 -byte* plot::plotter_x#2 plotter_x zp[2]:5 40000.4 +byte* plot::plotter_x#1 plotter_x zp[2]:4 100001.0 +byte* plot::plotter_x#2 plotter_x zp[2]:4 40000.4 word plot::plotter_y -word plot::plotter_y#1 plotter_y zp[2]:7 100001.0 -word plot::plotter_y#2 plotter_y zp[2]:7 200002.0 +word plot::plotter_y#1 plotter_y zp[2]:6 100001.0 +word plot::plotter_y#2 plotter_y zp[2]:6 200002.0 byte plot::x -byte plot::x#0 x zp[1]:3 28182.181818181816 +byte plot::x#0 x zp[1]:2 28182.181818181816 byte plot::y -byte plot::y#0 y zp[1]:4 30000.428571428572 +byte plot::y#0 y zp[1]:3 30000.428571428572 constant const byte* plot_bit[$100] = { fill( $100, 0) } constant const byte* plot_xhi[$100] = { fill( $100, 0) } constant const byte* plot_xlo[$100] = { fill( $100, 0) } @@ -61,8 +61,8 @@ constant const byte* plot_yhi[$100] = { fill( $100, 0) } constant const byte* plot_ylo[$100] = { fill( $100, 0) } void plots() byte plots::i -byte plots::i#1 i zp[1]:2 20002.0 -byte plots::i#2 i zp[1]:2 10001.0 +byte plots::i#1 reg byte x 20002.0 +byte plots::i#2 reg byte x 10001.0 constant byte plots_cnt = 8 constant byte* plots_x[] = { $3c, $50, $6e, $50, $3c, $28, $a, $28 } constant byte* plots_y[] = { $a, $28, $3c, $50, $6e, $50, $3c, $28 } @@ -70,17 +70,17 @@ constant byte* plots_y[] = { $a, $28, $3c, $50, $6e, $50, $3c, $28 } reg byte x [ init_plot_tables::x#2 init_plot_tables::x#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::y#2 init_plot_tables::y#1 ] +reg byte x [ plots::i#2 plots::i#1 ] reg byte a [ init_plot_tables::$0 ] -zp[1]:2 [ init_plot_tables::$9 plots::i#2 plots::i#1 ] reg byte a [ init_plot_tables::$6 ] reg byte a [ init_plot_tables::$7 ] reg byte a [ init_plot_tables::$8 ] -zp[1]:3 [ plot::x#0 ] -zp[1]:4 [ plot::y#0 ] +zp[1]:2 [ plot::x#0 init_plot_tables::$9 ] +zp[1]:3 [ plot::y#0 ] reg byte a [ plot::$6 ] -zp[2]:5 [ plot::plotter_x#1 plot::plotter_x#2 plot::plotter#0 init_screen::c#2 init_screen::c#1 ] +zp[2]:4 [ plot::plotter_x#1 plot::plotter_x#2 plot::plotter#0 init_screen::c#2 init_screen::c#1 ] reg byte a [ plot::$7 ] reg byte a [ plot::$8 ] -zp[2]:7 [ plot::plotter_y#1 plot::plotter_y#2 init_plot_tables::yoffs#2 init_plot_tables::yoffs#4 init_plot_tables::yoffs#1 init_screen::b#2 init_screen::b#1 ] +zp[2]:6 [ plot::plotter_y#1 plot::plotter_y#2 init_plot_tables::yoffs#2 init_plot_tables::yoffs#4 init_plot_tables::yoffs#1 init_screen::b#2 init_screen::b#1 ] reg byte a [ plot::$9 ] reg byte a [ plot::$5 ]