From a22a0e483dccc18f49a4f95573285e1515c9eb63 Mon Sep 17 00:00:00 2001 From: jespergravgaard Date: Sat, 3 Oct 2020 08:12:56 +0200 Subject: [PATCH] Added missing fragment. Closes #531 --- .../cache/fragment-cache-csg65ce02.asm | 2 +- .../cache/fragment-cache-mega45gs02.asm | 2 +- .../fragment/cache/fragment-cache-mos6502.asm | 2 +- .../cache/fragment-cache-mos6502x.asm | 444 ++++++++---------- .../cache/fragment-cache-wdc65c02.asm | 2 +- ..._deref_pvoc1=_deref_pvoz1_memcpy_vbuxx.asm | 7 + .../_deref_pwsc1=_dec__deref_pwsc1.asm | 5 + .../_deref_pwsc1=_inc__deref_pwsc1.asm | 4 + .../_deref_pwsc1_eq_0_then_la1.asm | 3 + .../_deref_pwsc1_neq_0_then_la1.asm | 3 + .../_deref_pwsz1=_dec__deref_pwsz2.asm | 10 + .../_deref_pwsz1=_deref_pwsz1_plus_vwsm2.asm | 9 + .../_deref_pwsz1=_deref_pwsz1_rol_1.asm | 8 + .../_deref_pwsz1=_deref_pwsz1_rol_3.asm | 13 + .../_deref_pwsz1=_deref_pwsz2.asm | 6 + .../_deref_pwsz1=_deref_pwsz2_minus_vwsm3.asm | 9 + .../_deref_pwsz1=_deref_pwsz2_plus_vwsm3.asm | 9 + .../_deref_pwsz1=_inc__deref_pwsz2.asm | 10 + .../_deref_pwsz1_eq_0_then_la1.asm | 5 + .../_deref_pwsz1_eq_vbuc1_then_la1.asm | 8 + .../_deref_pwsz1_ge_vwsm2_then_la1.asm | 10 + .../_deref_pwsz1_gt__deref_pwsz2_then_la1.asm | 10 + .../_deref_pwsz1_neq_0_then_la1.asm | 5 + .../_deref_pwsz1_neq_vwsm2_then_la1.asm | 8 + .../_deref_pwuc1=_dec__deref_pwuc1.asm | 5 + .../_deref_pwuc1=_inc__deref_pwuc1.asm | 4 + .../_deref_pwuc1_eq_0_then_la1.asm | 3 + .../_deref_pwuc1_neq_0_then_la1.asm | 3 + .../_deref_pwuz1=_dec__deref_pwuz2.asm | 10 + .../_deref_pwuz1=_deref_pwuz2.asm | 6 + .../_deref_pwuz1=_deref_pwuz2_minus_vwum3.asm | 9 + .../_deref_pwuz1=_deref_pwuz2_plus_vwum3.asm | 9 + .../_deref_pwuz1=_inc__deref_pwuz2.asm | 10 + .../_deref_pwuz1_eq_0_then_la1.asm | 5 + .../_deref_pwuz1_eq_vbuc1_then_la1.asm | 8 + .../_deref_pwuz1_neq_0_then_la1.asm | 5 +- .../_deref_pwuz1_neq_vwum2_then_la1.asm | 8 + ..._derefidx_(pbuc1_derefidx_vbuxx)=vbuaa.asm | 2 + .../pwsz1=_deref_qwsz1_plus__deref_pwsz2.asm | 11 + .../pwuz1=_deref_qwuz1_plus__deref_pwuz2.asm | 11 + .../mos6502-common/qvom1=qvoc1_plus_vwum1.asm | 7 + .../vbsc1_eq__deref_pwsc2_then_la1.asm | 7 + .../vwsc1_eq__deref_pwsc2_then_la1.asm | 7 + .../mos6502-common/vwsm1=vwsm1_rol_4.asm | 8 + .../mos6502-common/vwsm1_eq_0_then_la1.asm | 3 + .../vwsm1_ge__deref_pwsz2_then_la1.asm | 10 + ...vwsm1_gt_pwsc1_derefidx_vbuxx_then_la1.asm | 1 - ...vwsm1_gt_pwsc1_derefidx_vbuyy_then_la1.asm | 1 - .../vwsm1_gt_vwsm2_then_la1.asm | 3 +- .../vwsz1=_deref_pwsz1_rol_1.asm | 10 + .../vwsz1=_deref_pwsz2_minus__deref_pwsz1.asm | 11 + .../vwum1=_deref_pwuc1_rol_1.asm | 6 + .../vwum1=_deref_pwuz2_plus__deref_pwuz3.asm | 9 + .../vwum1=_deref_pwuz2_rol_1.asm | 8 + .../vwuz1=_deref_pwuz1_rol_1.asm | 10 + .../vwuz1=_deref_pwuz2_minus__deref_pwuz1.asm | 11 + .../vwuz1=pwuz1_derefidx_vbuyy_rol_1.asm | 9 + .../vwuz1=pwuz2_derefidx_vbuyy_rol_1.asm | 7 + .../AsmFragmentTemplateSynthesisRule.java | 2 + src/test/ref/index-pointer-rewrite-7.log | 51 +- src/test/ref/test-comparisons-sword.asm | 2 - src/test/ref/test-comparisons-sword.log | 6 - 62 files changed, 591 insertions(+), 301 deletions(-) create mode 100644 src/main/fragment/mos6502-common/_deref_pvoc1=_deref_pvoz1_memcpy_vbuxx.asm create mode 100644 src/main/fragment/mos6502-common/_deref_pwsc1=_dec__deref_pwsc1.asm create mode 100644 src/main/fragment/mos6502-common/_deref_pwsc1=_inc__deref_pwsc1.asm create mode 100644 src/main/fragment/mos6502-common/_deref_pwsc1_eq_0_then_la1.asm create mode 100644 src/main/fragment/mos6502-common/_deref_pwsc1_neq_0_then_la1.asm create mode 100644 src/main/fragment/mos6502-common/_deref_pwsz1=_dec__deref_pwsz2.asm create mode 100644 src/main/fragment/mos6502-common/_deref_pwsz1=_deref_pwsz1_plus_vwsm2.asm create mode 100644 src/main/fragment/mos6502-common/_deref_pwsz1=_deref_pwsz1_rol_1.asm create mode 100644 src/main/fragment/mos6502-common/_deref_pwsz1=_deref_pwsz1_rol_3.asm create mode 100644 src/main/fragment/mos6502-common/_deref_pwsz1=_deref_pwsz2.asm create mode 100644 src/main/fragment/mos6502-common/_deref_pwsz1=_deref_pwsz2_minus_vwsm3.asm create mode 100644 src/main/fragment/mos6502-common/_deref_pwsz1=_deref_pwsz2_plus_vwsm3.asm create mode 100644 src/main/fragment/mos6502-common/_deref_pwsz1=_inc__deref_pwsz2.asm create mode 100644 src/main/fragment/mos6502-common/_deref_pwsz1_eq_0_then_la1.asm create mode 100644 src/main/fragment/mos6502-common/_deref_pwsz1_eq_vbuc1_then_la1.asm create mode 100644 src/main/fragment/mos6502-common/_deref_pwsz1_ge_vwsm2_then_la1.asm create mode 100644 src/main/fragment/mos6502-common/_deref_pwsz1_gt__deref_pwsz2_then_la1.asm create mode 100644 src/main/fragment/mos6502-common/_deref_pwsz1_neq_0_then_la1.asm create mode 100644 src/main/fragment/mos6502-common/_deref_pwsz1_neq_vwsm2_then_la1.asm create mode 100644 src/main/fragment/mos6502-common/_deref_pwuc1=_dec__deref_pwuc1.asm create mode 100644 src/main/fragment/mos6502-common/_deref_pwuc1=_inc__deref_pwuc1.asm create mode 100644 src/main/fragment/mos6502-common/_deref_pwuc1_eq_0_then_la1.asm create mode 100644 src/main/fragment/mos6502-common/_deref_pwuc1_neq_0_then_la1.asm create mode 100644 src/main/fragment/mos6502-common/_deref_pwuz1=_dec__deref_pwuz2.asm create mode 100644 src/main/fragment/mos6502-common/_deref_pwuz1=_deref_pwuz2.asm create mode 100644 src/main/fragment/mos6502-common/_deref_pwuz1=_deref_pwuz2_minus_vwum3.asm create mode 100644 src/main/fragment/mos6502-common/_deref_pwuz1=_deref_pwuz2_plus_vwum3.asm create mode 100644 src/main/fragment/mos6502-common/_deref_pwuz1=_inc__deref_pwuz2.asm create mode 100644 src/main/fragment/mos6502-common/_deref_pwuz1_eq_0_then_la1.asm create mode 100644 src/main/fragment/mos6502-common/_deref_pwuz1_eq_vbuc1_then_la1.asm create mode 100644 src/main/fragment/mos6502-common/_deref_pwuz1_neq_vwum2_then_la1.asm create mode 100644 src/main/fragment/mos6502-common/pbuz1_derefidx_(pbuc1_derefidx_vbuxx)=vbuaa.asm create mode 100644 src/main/fragment/mos6502-common/pwsz1=_deref_qwsz1_plus__deref_pwsz2.asm create mode 100644 src/main/fragment/mos6502-common/pwuz1=_deref_qwuz1_plus__deref_pwuz2.asm create mode 100644 src/main/fragment/mos6502-common/qvom1=qvoc1_plus_vwum1.asm create mode 100644 src/main/fragment/mos6502-common/vbsc1_eq__deref_pwsc2_then_la1.asm create mode 100644 src/main/fragment/mos6502-common/vwsc1_eq__deref_pwsc2_then_la1.asm create mode 100644 src/main/fragment/mos6502-common/vwsm1=vwsm1_rol_4.asm create mode 100644 src/main/fragment/mos6502-common/vwsm1_eq_0_then_la1.asm create mode 100644 src/main/fragment/mos6502-common/vwsm1_ge__deref_pwsz2_then_la1.asm create mode 100644 src/main/fragment/mos6502-common/vwsz1=_deref_pwsz1_rol_1.asm create mode 100644 src/main/fragment/mos6502-common/vwsz1=_deref_pwsz2_minus__deref_pwsz1.asm create mode 100644 src/main/fragment/mos6502-common/vwum1=_deref_pwuc1_rol_1.asm create mode 100644 src/main/fragment/mos6502-common/vwum1=_deref_pwuz2_plus__deref_pwuz3.asm create mode 100644 src/main/fragment/mos6502-common/vwum1=_deref_pwuz2_rol_1.asm create mode 100644 src/main/fragment/mos6502-common/vwuz1=_deref_pwuz1_rol_1.asm create mode 100644 src/main/fragment/mos6502-common/vwuz1=_deref_pwuz2_minus__deref_pwuz1.asm create mode 100644 src/main/fragment/mos6502-common/vwuz1=pwuz1_derefidx_vbuyy_rol_1.asm create mode 100644 src/main/fragment/mos6502-common/vwuz1=pwuz2_derefidx_vbuyy_rol_1.asm diff --git a/src/main/fragment/cache/fragment-cache-csg65ce02.asm b/src/main/fragment/cache/fragment-cache-csg65ce02.asm index 581e1994c..a4014d631 100644 --- a/src/main/fragment/cache/fragment-cache-csg65ce02.asm +++ b/src/main/fragment/cache/fragment-cache-csg65ce02.asm @@ -1,4 +1,4 @@ -//KICKC FRAGMENT CACHE 11cb56b840 11cb56d1f2 +//KICKC FRAGMENT CACHE 117c74c070 117c74db73 //FRAGMENT vbuz1=vbuc1 lda #{c1} sta {z1} diff --git a/src/main/fragment/cache/fragment-cache-mega45gs02.asm b/src/main/fragment/cache/fragment-cache-mega45gs02.asm index 54e351e93..e3a21c810 100644 --- a/src/main/fragment/cache/fragment-cache-mega45gs02.asm +++ b/src/main/fragment/cache/fragment-cache-mega45gs02.asm @@ -1,4 +1,4 @@ -//KICKC FRAGMENT CACHE 11cb56b840 11cb56d1f2 +//KICKC FRAGMENT CACHE 117c74c070 117c74db73 //FRAGMENT _deref_pbuc1=vbuc2 lda #{c2} sta {c1} diff --git a/src/main/fragment/cache/fragment-cache-mos6502.asm b/src/main/fragment/cache/fragment-cache-mos6502.asm index 120cc43e7..4c59e5a45 100644 --- a/src/main/fragment/cache/fragment-cache-mos6502.asm +++ b/src/main/fragment/cache/fragment-cache-mos6502.asm @@ -1,4 +1,4 @@ -//KICKC FRAGMENT CACHE 11cb56b840 11cb56d1f2 +//KICKC FRAGMENT CACHE 117c74c070 117c74db73 //FRAGMENT vbuz1=vbuc1 lda #{c1} sta {z1} diff --git a/src/main/fragment/cache/fragment-cache-mos6502x.asm b/src/main/fragment/cache/fragment-cache-mos6502x.asm index b081a4255..deef7fdc1 100644 --- a/src/main/fragment/cache/fragment-cache-mos6502x.asm +++ b/src/main/fragment/cache/fragment-cache-mos6502x.asm @@ -1,4 +1,4 @@ -//KICKC FRAGMENT CACHE 11cb56b840 11cb56d1f2 +//KICKC FRAGMENT CACHE 117c74c070 117c74db73 //FRAGMENT vbuz1=vbuc1 lda #{c1} sta {z1} @@ -14649,50 +14649,6 @@ beq {la1} //FRAGMENT _deref_pbsc1=_deref_pbsc2 lda {c2} sta {c1} -//FRAGMENT vwsz1_eq_vwsz2_then_la1 -lda {z1} -cmp {z2} -bne !+ -lda {z1}+1 -cmp {z2}+1 -beq {la1} -!: -//FRAGMENT vwsz1_neq_vwsz2_then_la1 -lda {z1}+1 -cmp {z2}+1 -bne {la1} -lda {z1} -cmp {z2} -bne {la1} -//FRAGMENT vwsz1_lt_vwsz2_then_la1 -lda {z1} -cmp {z2} -lda {z1}+1 -sbc {z2}+1 -bvc !+ -eor #$80 -!: -bmi {la1} -!e: -//FRAGMENT vwsz1_gt_vwsz2_then_la1 -lda {z2} -cmp {z1} -lda {z2}+1 -sbc {z1}+1 -bvc !+ -eor #$80 -!: -bmi {la1} -!e: -//FRAGMENT vwsz1_ge_vwsz2_then_la1 -lda {z1} -cmp {z2} -lda {z1}+1 -sbc {z2}+1 -bvc !+ -eor #$80 -!: -bpl {la1} //FRAGMENT vbuz1=_deref_pbuc1_plus_1 ldy {c1} iny @@ -16295,6 +16251,14 @@ lda ({z1}),y ldy #0 cmp ({z2}),y beq {la1} +//FRAGMENT vwsz1_eq_vwsz2_then_la1 +lda {z1} +cmp {z2} +bne !+ +lda {z1}+1 +cmp {z2}+1 +beq {la1} +!: //FRAGMENT vbsz1_le_0_then_la1 lda {z1} cmp #1 @@ -17563,6 +17527,190 @@ lda #{c2} sta {c1},y lda #0 sta {c1}+1,y +//FRAGMENT vwuz1=pwuc1_derefidx_vbuz2_plus_pwuc1_derefidx_vbuz3 +ldx {z2} +ldy {z3} +lda {c1},x +clc +adc {c1},y +sta {z1} +lda {c1}+1,x +adc {c1}+1,y +sta {z1}+1 +//FRAGMENT vwuz1=pwuc1_derefidx_vbuxx_plus_pwuc1_derefidx_vbuz2 +ldy {z2} +lda {c1},x +clc +adc {c1},y +sta {z1} +lda {c1}+1,x +adc {c1}+1,y +sta {z1}+1 +//FRAGMENT vwuz1=pwuc1_derefidx_vbuyy_plus_pwuc1_derefidx_vbuz2 +ldx {z2} +lda {c1},x +clc +adc {c1},y +sta {z1} +lda {c1}+1,x +adc {c1}+1,y +sta {z1}+1 +//FRAGMENT vwuz1=pwuc1_derefidx_vbuz2_plus_pwuc1_derefidx_vbuaa +ldx {z2} +tay +lda {c1},x +clc +adc {c1},y +sta {z1} +lda {c1}+1,x +adc {c1}+1,y +sta {z1}+1 +//FRAGMENT vwuz1=pwuc1_derefidx_vbuxx_plus_pwuc1_derefidx_vbuaa +tay +lda {c1},x +clc +adc {c1},y +sta {z1} +lda {c1}+1,x +adc {c1}+1,y +sta {z1}+1 +//FRAGMENT vwuz1=pwuc1_derefidx_vbuyy_plus_pwuc1_derefidx_vbuaa +tax +lda {c1},x +clc +adc {c1},y +sta {z1} +lda {c1}+1,x +adc {c1}+1,y +sta {z1}+1 +//FRAGMENT vwuz1=pwuc1_derefidx_vbuz2_plus_pwuc1_derefidx_vbuxx +ldy {z2} +lda {c1},x +clc +adc {c1},y +sta {z1} +lda {c1}+1,x +adc {c1}+1,y +sta {z1}+1 +//FRAGMENT vwuz1=pwuc1_derefidx_vbuxx_plus_pwuc1_derefidx_vbuxx +txa +tay +lda {c1},x +clc +adc {c1},y +sta {z1} +lda {c1}+1,x +adc {c1}+1,y +sta {z1}+1 +//FRAGMENT vwuz1=pwuc1_derefidx_vbuyy_plus_pwuc1_derefidx_vbuxx +lda {c1},x +clc +adc {c1},y +sta {z1} +lda {c1}+1,x +adc {c1}+1,y +sta {z1}+1 +//FRAGMENT vwuz1=pwuc1_derefidx_vbuz2_plus_pwuc1_derefidx_vbuyy +ldx {z2} +lda {c1},x +clc +adc {c1},y +sta {z1} +lda {c1}+1,x +adc {c1}+1,y +sta {z1}+1 +//FRAGMENT vwuz1=pwuc1_derefidx_vbuxx_plus_pwuc1_derefidx_vbuyy +lda {c1},x +clc +adc {c1},y +sta {z1} +lda {c1}+1,x +adc {c1}+1,y +sta {z1}+1 +//FRAGMENT vwuz1=pwuc1_derefidx_vbuyy_plus_pwuc1_derefidx_vbuyy +tya +tax +lda {c1},x +clc +adc {c1},y +sta {z1} +lda {c1}+1,x +adc {c1}+1,y +sta {z1}+1 +//FRAGMENT vbuz1=vbuxx_plus_2 +inx +inx +stx {z1} +//FRAGMENT vbuz1=vbuyy_plus_2 +iny +iny +sty {z1} +//FRAGMENT vbuz1=_deref_pbuz2_plus__deref_pbuz3 +ldy #0 +lda ({z2}),y +clc +ldy #0 +adc ({z3}),y +sta {z1} +//FRAGMENT vbuaa=_deref_pbuz1_plus__deref_pbuz2 +ldy #0 +lda ({z1}),y +clc +ldy #0 +adc ({z2}),y +//FRAGMENT vbuxx=_deref_pbuz1_plus__deref_pbuz2 +ldy #0 +lda ({z1}),y +clc +ldy #0 +adc ({z2}),y +tax +//FRAGMENT vbuyy=_deref_pbuz1_plus__deref_pbuz2 +ldy #0 +lda ({z1}),y +clc +ldy #0 +adc ({z2}),y +tay +//FRAGMENT pbuc1_derefidx_vbuz1=pbuc1_derefidx_vbuz1_plus_pbuc2_derefidx_vbuz1 +ldy {z1} +lda {c1},y +clc +adc {c2},y +sta {c1},y +//FRAGMENT pbuc1_derefidx_vbuz1=pbuc1_derefidx_vbuz1_plus_vbuc2 +lda #{c2} +ldy {z1} +clc +adc {c1},y +sta {c1},y +//FRAGMENT pbuc1_derefidx_vbuaa=pbuc1_derefidx_vbuaa_plus_pbuc2_derefidx_vbuaa +tax +tay +lda {c1},x +clc +adc {c2},x +sta {c1},y +//FRAGMENT pbuc1_derefidx_vbuxx=pbuc1_derefidx_vbuxx_plus_pbuc2_derefidx_vbuxx +lda {c1},x +clc +adc {c2},x +sta {c1},x +//FRAGMENT pbuc1_derefidx_vbuyy=pbuc1_derefidx_vbuyy_plus_pbuc2_derefidx_vbuyy +lda {c1},y +clc +adc {c2},y +sta {c1},y +//FRAGMENT pbuc1_derefidx_vbuxx=pbuc1_derefidx_vbuxx_plus_vbuc2 +lda #{c2} +clc +adc {c1},x +sta {c1},x +//FRAGMENT pbuc1_derefidx_vbuyy=pbuc1_derefidx_vbuyy_plus_vbuc2 +lda #{c2} +clc +adc {c1},y +sta {c1},y //FRAGMENT _deref_pbuz1=_deref_pbuz2_plus__deref_pbuz3 ldy #0 lda ({z2}),y @@ -18116,6 +18264,13 @@ lda {z1}+3 cmp {z2}+3 beq {la1} !: +//FRAGMENT vwsz1_neq_vwsz2_then_la1 +lda {z1}+1 +cmp {z2}+1 +bne {la1} +lda {z1} +cmp {z2} +bne {la1} //FRAGMENT vdsz1=vdsz1_plus_vwsz2 lda {z2}+1 ora #$7f @@ -18590,202 +18745,3 @@ sta {c1},x lda #{c2} ora {c1},y sta {c1},y -//FRAGMENT vwuz1=pwuc1_derefidx_vbuz2_plus_pwuc1_derefidx_vbuz3 -ldx {z2} -ldy {z3} -lda {c1},x -clc -adc {c1},y -sta {z1} -lda {c1}+1,x -adc {c1}+1,y -sta {z1}+1 -//FRAGMENT vwuz1=pwuc1_derefidx_vbuxx_plus_pwuc1_derefidx_vbuz2 -ldy {z2} -lda {c1},x -clc -adc {c1},y -sta {z1} -lda {c1}+1,x -adc {c1}+1,y -sta {z1}+1 -//FRAGMENT vwuz1=pwuc1_derefidx_vbuyy_plus_pwuc1_derefidx_vbuz2 -ldx {z2} -lda {c1},x -clc -adc {c1},y -sta {z1} -lda {c1}+1,x -adc {c1}+1,y -sta {z1}+1 -//FRAGMENT vwuz1=pwuc1_derefidx_vbuz2_plus_pwuc1_derefidx_vbuaa -ldx {z2} -tay -lda {c1},x -clc -adc {c1},y -sta {z1} -lda {c1}+1,x -adc {c1}+1,y -sta {z1}+1 -//FRAGMENT vwuz1=pwuc1_derefidx_vbuxx_plus_pwuc1_derefidx_vbuaa -tay -lda {c1},x -clc -adc {c1},y -sta {z1} -lda {c1}+1,x -adc {c1}+1,y -sta {z1}+1 -//FRAGMENT vwuz1=pwuc1_derefidx_vbuyy_plus_pwuc1_derefidx_vbuaa -tax -lda {c1},x -clc -adc {c1},y -sta {z1} -lda {c1}+1,x -adc {c1}+1,y -sta {z1}+1 -//FRAGMENT vwuz1=pwuc1_derefidx_vbuz2_plus_pwuc1_derefidx_vbuxx -ldy {z2} -lda {c1},x -clc -adc {c1},y -sta {z1} -lda {c1}+1,x -adc {c1}+1,y -sta {z1}+1 -//FRAGMENT vwuz1=pwuc1_derefidx_vbuxx_plus_pwuc1_derefidx_vbuxx -txa -tay -lda {c1},x -clc -adc {c1},y -sta {z1} -lda {c1}+1,x -adc {c1}+1,y -sta {z1}+1 -//FRAGMENT vwuz1=pwuc1_derefidx_vbuyy_plus_pwuc1_derefidx_vbuxx -lda {c1},x -clc -adc {c1},y -sta {z1} -lda {c1}+1,x -adc {c1}+1,y -sta {z1}+1 -//FRAGMENT vwuz1=pwuc1_derefidx_vbuz2_plus_pwuc1_derefidx_vbuyy -ldx {z2} -lda {c1},x -clc -adc {c1},y -sta {z1} -lda {c1}+1,x -adc {c1}+1,y -sta {z1}+1 -//FRAGMENT vwuz1=pwuc1_derefidx_vbuxx_plus_pwuc1_derefidx_vbuyy -lda {c1},x -clc -adc {c1},y -sta {z1} -lda {c1}+1,x -adc {c1}+1,y -sta {z1}+1 -//FRAGMENT vwuz1=pwuc1_derefidx_vbuyy_plus_pwuc1_derefidx_vbuyy -tya -tax -lda {c1},x -clc -adc {c1},y -sta {z1} -lda {c1}+1,x -adc {c1}+1,y -sta {z1}+1 -//FRAGMENT vbuz1=vbuxx_plus_2 -inx -inx -stx {z1} -//FRAGMENT vbuz1=vbuyy_plus_2 -iny -iny -sty {z1} -//FRAGMENT vbuz1=_deref_pbuz2_plus__deref_pbuz3 -ldy #0 -lda ({z2}),y -clc -ldy #0 -adc ({z3}),y -sta {z1} -//FRAGMENT vbuaa=_deref_pbuz1_plus__deref_pbuz2 -ldy #0 -lda ({z1}),y -clc -ldy #0 -adc ({z2}),y -//FRAGMENT vbuxx=_deref_pbuz1_plus__deref_pbuz2 -ldy #0 -lda ({z1}),y -clc -ldy #0 -adc ({z2}),y -tax -//FRAGMENT vbuyy=_deref_pbuz1_plus__deref_pbuz2 -ldy #0 -lda ({z1}),y -clc -ldy #0 -adc ({z2}),y -tay -//FRAGMENT vwuz1=_deref_pwuz2_plus__deref_pwuz3 -NO_SYNTHESIS -//FRAGMENT vwuz1=_deref_pwuz2_plus__deref_pwuz1 -ldy #0 -clc -lda ({z1}),y -adc ({z2}),y -pha -iny -lda ({z1}),y -adc ({z2}),y -sta ({z1}),y -dey -pla -sta ({z1}),y -//FRAGMENT pbuc1_derefidx_vbuz1=pbuc1_derefidx_vbuz1_plus_pbuc2_derefidx_vbuz1 -ldy {z1} -lda {c1},y -clc -adc {c2},y -sta {c1},y -//FRAGMENT pbuc1_derefidx_vbuz1=pbuc1_derefidx_vbuz1_plus_vbuc2 -lda #{c2} -ldy {z1} -clc -adc {c1},y -sta {c1},y -//FRAGMENT pbuc1_derefidx_vbuaa=pbuc1_derefidx_vbuaa_plus_pbuc2_derefidx_vbuaa -tax -tay -lda {c1},x -clc -adc {c2},x -sta {c1},y -//FRAGMENT pbuc1_derefidx_vbuxx=pbuc1_derefidx_vbuxx_plus_pbuc2_derefidx_vbuxx -lda {c1},x -clc -adc {c2},x -sta {c1},x -//FRAGMENT pbuc1_derefidx_vbuyy=pbuc1_derefidx_vbuyy_plus_pbuc2_derefidx_vbuyy -lda {c1},y -clc -adc {c2},y -sta {c1},y -//FRAGMENT pbuc1_derefidx_vbuxx=pbuc1_derefidx_vbuxx_plus_vbuc2 -lda #{c2} -clc -adc {c1},x -sta {c1},x -//FRAGMENT pbuc1_derefidx_vbuyy=pbuc1_derefidx_vbuyy_plus_vbuc2 -lda #{c2} -clc -adc {c1},y -sta {c1},y diff --git a/src/main/fragment/cache/fragment-cache-wdc65c02.asm b/src/main/fragment/cache/fragment-cache-wdc65c02.asm index 7e9d34015..ba4a94c3e 100644 --- a/src/main/fragment/cache/fragment-cache-wdc65c02.asm +++ b/src/main/fragment/cache/fragment-cache-wdc65c02.asm @@ -1,4 +1,4 @@ -//KICKC FRAGMENT CACHE 11cb56b840 11cb56d1f2 +//KICKC FRAGMENT CACHE 117c74c070 117c74db73 //FRAGMENT vbuz1=_deref_pbuc1 lda {c1} sta {z1} diff --git a/src/main/fragment/mos6502-common/_deref_pvoc1=_deref_pvoz1_memcpy_vbuxx.asm b/src/main/fragment/mos6502-common/_deref_pvoc1=_deref_pvoz1_memcpy_vbuxx.asm new file mode 100644 index 000000000..3da76aada --- /dev/null +++ b/src/main/fragment/mos6502-common/_deref_pvoc1=_deref_pvoz1_memcpy_vbuxx.asm @@ -0,0 +1,7 @@ +ldy #0 +!: +lda ({z1}),y +sta {c1},y +iny +dex +bne !- \ No newline at end of file diff --git a/src/main/fragment/mos6502-common/_deref_pwsc1=_dec__deref_pwsc1.asm b/src/main/fragment/mos6502-common/_deref_pwsc1=_dec__deref_pwsc1.asm new file mode 100644 index 000000000..69944c087 --- /dev/null +++ b/src/main/fragment/mos6502-common/_deref_pwsc1=_dec__deref_pwsc1.asm @@ -0,0 +1,5 @@ +lda {c1} +bne !+ +dec {c1}+1 +!: +dec {c1} \ No newline at end of file diff --git a/src/main/fragment/mos6502-common/_deref_pwsc1=_inc__deref_pwsc1.asm b/src/main/fragment/mos6502-common/_deref_pwsc1=_inc__deref_pwsc1.asm new file mode 100644 index 000000000..39191f06b --- /dev/null +++ b/src/main/fragment/mos6502-common/_deref_pwsc1=_inc__deref_pwsc1.asm @@ -0,0 +1,4 @@ +inc {c1} +bne !+ +inc {c1}+1 +!: \ No newline at end of file diff --git a/src/main/fragment/mos6502-common/_deref_pwsc1_eq_0_then_la1.asm b/src/main/fragment/mos6502-common/_deref_pwsc1_eq_0_then_la1.asm new file mode 100644 index 000000000..cfda98527 --- /dev/null +++ b/src/main/fragment/mos6502-common/_deref_pwsc1_eq_0_then_la1.asm @@ -0,0 +1,3 @@ +lda {c1} +ora {c1}+1 +beq {la1} \ No newline at end of file diff --git a/src/main/fragment/mos6502-common/_deref_pwsc1_neq_0_then_la1.asm b/src/main/fragment/mos6502-common/_deref_pwsc1_neq_0_then_la1.asm new file mode 100644 index 000000000..a2321eac8 --- /dev/null +++ b/src/main/fragment/mos6502-common/_deref_pwsc1_neq_0_then_la1.asm @@ -0,0 +1,3 @@ +lda {c1} +ora {c1}+1 +bne {la1} \ No newline at end of file diff --git a/src/main/fragment/mos6502-common/_deref_pwsz1=_dec__deref_pwsz2.asm b/src/main/fragment/mos6502-common/_deref_pwsz1=_dec__deref_pwsz2.asm new file mode 100644 index 000000000..d8ee90be8 --- /dev/null +++ b/src/main/fragment/mos6502-common/_deref_pwsz1=_dec__deref_pwsz2.asm @@ -0,0 +1,10 @@ +ldy #0 +sec +lda ({z2}),y +sbc #1 +sta ({z1}),y +iny +lda ({z2}),y +sbc #0 +sta ({z1}),y + diff --git a/src/main/fragment/mos6502-common/_deref_pwsz1=_deref_pwsz1_plus_vwsm2.asm b/src/main/fragment/mos6502-common/_deref_pwsz1=_deref_pwsz1_plus_vwsm2.asm new file mode 100644 index 000000000..ceb3a334d --- /dev/null +++ b/src/main/fragment/mos6502-common/_deref_pwsz1=_deref_pwsz1_plus_vwsm2.asm @@ -0,0 +1,9 @@ +ldy #0 +clc +lda ({z1}),y +adc {m2} +sta ({z1}),y +iny +lda ({z1}),y +adc {m2}+1 +sta ({z1}),y diff --git a/src/main/fragment/mos6502-common/_deref_pwsz1=_deref_pwsz1_rol_1.asm b/src/main/fragment/mos6502-common/_deref_pwsz1=_deref_pwsz1_rol_1.asm new file mode 100644 index 000000000..48a50d8f2 --- /dev/null +++ b/src/main/fragment/mos6502-common/_deref_pwsz1=_deref_pwsz1_rol_1.asm @@ -0,0 +1,8 @@ +ldy #0 +lda ({z1}),y +asl +sta ({z1}),y +iny +lda ({z1}),y +rol +sta ({z1}),y \ No newline at end of file diff --git a/src/main/fragment/mos6502-common/_deref_pwsz1=_deref_pwsz1_rol_3.asm b/src/main/fragment/mos6502-common/_deref_pwsz1=_deref_pwsz1_rol_3.asm new file mode 100644 index 000000000..e0f097cfb --- /dev/null +++ b/src/main/fragment/mos6502-common/_deref_pwsz1=_deref_pwsz1_rol_3.asm @@ -0,0 +1,13 @@ +ldy #0 +ldx #3 +!: +lda ({z1}),y +asl +sta ({z1}),y +iny +lda ({z1}),y +rol +sta ({z1}),y +dey +dex +bne !- \ No newline at end of file diff --git a/src/main/fragment/mos6502-common/_deref_pwsz1=_deref_pwsz2.asm b/src/main/fragment/mos6502-common/_deref_pwsz1=_deref_pwsz2.asm new file mode 100644 index 000000000..48d426491 --- /dev/null +++ b/src/main/fragment/mos6502-common/_deref_pwsz1=_deref_pwsz2.asm @@ -0,0 +1,6 @@ +ldy #0 +lda ({z2}),y +sta ({z1}),y +iny +lda ({z2}),y +sta ({z1}),y \ No newline at end of file diff --git a/src/main/fragment/mos6502-common/_deref_pwsz1=_deref_pwsz2_minus_vwsm3.asm b/src/main/fragment/mos6502-common/_deref_pwsz1=_deref_pwsz2_minus_vwsm3.asm new file mode 100644 index 000000000..3ab2aaf15 --- /dev/null +++ b/src/main/fragment/mos6502-common/_deref_pwsz1=_deref_pwsz2_minus_vwsm3.asm @@ -0,0 +1,9 @@ +ldy #0 +sec +lda ({z2}),y +sbc {m3} +sta ({z1}),y +iny +lda ({z2}),y +sbc {m3}+1 +sta ({z1}),y diff --git a/src/main/fragment/mos6502-common/_deref_pwsz1=_deref_pwsz2_plus_vwsm3.asm b/src/main/fragment/mos6502-common/_deref_pwsz1=_deref_pwsz2_plus_vwsm3.asm new file mode 100644 index 000000000..3fb50af86 --- /dev/null +++ b/src/main/fragment/mos6502-common/_deref_pwsz1=_deref_pwsz2_plus_vwsm3.asm @@ -0,0 +1,9 @@ +ldy #0 +clc +lda ({z2}),y +adc {m3} +sta ({z1}),y +iny +lda ({z2}),y +adc {m3}+1 +sta ({z1}),y diff --git a/src/main/fragment/mos6502-common/_deref_pwsz1=_inc__deref_pwsz2.asm b/src/main/fragment/mos6502-common/_deref_pwsz1=_inc__deref_pwsz2.asm new file mode 100644 index 000000000..93575ed11 --- /dev/null +++ b/src/main/fragment/mos6502-common/_deref_pwsz1=_inc__deref_pwsz2.asm @@ -0,0 +1,10 @@ +ldy #0 +clc +lda ({z2}),y +adc #1 +sta ({z1}),y +iny +lda ({z2}),y +adc #0 +sta ({z1}),y + diff --git a/src/main/fragment/mos6502-common/_deref_pwsz1_eq_0_then_la1.asm b/src/main/fragment/mos6502-common/_deref_pwsz1_eq_0_then_la1.asm new file mode 100644 index 000000000..b544e8423 --- /dev/null +++ b/src/main/fragment/mos6502-common/_deref_pwsz1_eq_0_then_la1.asm @@ -0,0 +1,5 @@ +ldy #0 +lda ({z1}),y +iny +ora ({z1}),y +beq {la1} \ No newline at end of file diff --git a/src/main/fragment/mos6502-common/_deref_pwsz1_eq_vbuc1_then_la1.asm b/src/main/fragment/mos6502-common/_deref_pwsz1_eq_vbuc1_then_la1.asm new file mode 100644 index 000000000..737da50de --- /dev/null +++ b/src/main/fragment/mos6502-common/_deref_pwsz1_eq_vbuc1_then_la1.asm @@ -0,0 +1,8 @@ +ldy #1 +lda ({z1}),y +bne !+ +dey +lda ({z1}),y +cmp #{c1} +beq {la1} +!: diff --git a/src/main/fragment/mos6502-common/_deref_pwsz1_ge_vwsm2_then_la1.asm b/src/main/fragment/mos6502-common/_deref_pwsz1_ge_vwsm2_then_la1.asm new file mode 100644 index 000000000..1696790c7 --- /dev/null +++ b/src/main/fragment/mos6502-common/_deref_pwsz1_ge_vwsm2_then_la1.asm @@ -0,0 +1,10 @@ +ldy #0 +lda ({z1}),y +cmp {m2} +iny +lda ({z1}),y +sbc {m2}+1 +bvc !+ +eor #$80 +!: +bpl {la1} diff --git a/src/main/fragment/mos6502-common/_deref_pwsz1_gt__deref_pwsz2_then_la1.asm b/src/main/fragment/mos6502-common/_deref_pwsz1_gt__deref_pwsz2_then_la1.asm new file mode 100644 index 000000000..425d75252 --- /dev/null +++ b/src/main/fragment/mos6502-common/_deref_pwsz1_gt__deref_pwsz2_then_la1.asm @@ -0,0 +1,10 @@ +ldy #0 +lda ({z2}),y +cmp ({z1}),y +iny +lda ({z2}),y +sbc ({z1}),y +bvc !+ +eor #$80 +!: +bmi {la1} \ No newline at end of file diff --git a/src/main/fragment/mos6502-common/_deref_pwsz1_neq_0_then_la1.asm b/src/main/fragment/mos6502-common/_deref_pwsz1_neq_0_then_la1.asm new file mode 100644 index 000000000..64aa0932d --- /dev/null +++ b/src/main/fragment/mos6502-common/_deref_pwsz1_neq_0_then_la1.asm @@ -0,0 +1,5 @@ +ldy #0 +lda ({z1}),y +iny +ora ({z1}),y +bne {la1} \ No newline at end of file diff --git a/src/main/fragment/mos6502-common/_deref_pwsz1_neq_vwsm2_then_la1.asm b/src/main/fragment/mos6502-common/_deref_pwsz1_neq_vwsm2_then_la1.asm new file mode 100644 index 000000000..9a48db314 --- /dev/null +++ b/src/main/fragment/mos6502-common/_deref_pwsz1_neq_vwsm2_then_la1.asm @@ -0,0 +1,8 @@ +ldy #0 +lda ({z1}),y +cmp {m2} +bne {la1} +iny +lda ({z1}),y +cmp {m2}+1 +bne {la1} diff --git a/src/main/fragment/mos6502-common/_deref_pwuc1=_dec__deref_pwuc1.asm b/src/main/fragment/mos6502-common/_deref_pwuc1=_dec__deref_pwuc1.asm new file mode 100644 index 000000000..69944c087 --- /dev/null +++ b/src/main/fragment/mos6502-common/_deref_pwuc1=_dec__deref_pwuc1.asm @@ -0,0 +1,5 @@ +lda {c1} +bne !+ +dec {c1}+1 +!: +dec {c1} \ No newline at end of file diff --git a/src/main/fragment/mos6502-common/_deref_pwuc1=_inc__deref_pwuc1.asm b/src/main/fragment/mos6502-common/_deref_pwuc1=_inc__deref_pwuc1.asm new file mode 100644 index 000000000..39191f06b --- /dev/null +++ b/src/main/fragment/mos6502-common/_deref_pwuc1=_inc__deref_pwuc1.asm @@ -0,0 +1,4 @@ +inc {c1} +bne !+ +inc {c1}+1 +!: \ No newline at end of file diff --git a/src/main/fragment/mos6502-common/_deref_pwuc1_eq_0_then_la1.asm b/src/main/fragment/mos6502-common/_deref_pwuc1_eq_0_then_la1.asm new file mode 100644 index 000000000..cfda98527 --- /dev/null +++ b/src/main/fragment/mos6502-common/_deref_pwuc1_eq_0_then_la1.asm @@ -0,0 +1,3 @@ +lda {c1} +ora {c1}+1 +beq {la1} \ No newline at end of file diff --git a/src/main/fragment/mos6502-common/_deref_pwuc1_neq_0_then_la1.asm b/src/main/fragment/mos6502-common/_deref_pwuc1_neq_0_then_la1.asm new file mode 100644 index 000000000..a2321eac8 --- /dev/null +++ b/src/main/fragment/mos6502-common/_deref_pwuc1_neq_0_then_la1.asm @@ -0,0 +1,3 @@ +lda {c1} +ora {c1}+1 +bne {la1} \ No newline at end of file diff --git a/src/main/fragment/mos6502-common/_deref_pwuz1=_dec__deref_pwuz2.asm b/src/main/fragment/mos6502-common/_deref_pwuz1=_dec__deref_pwuz2.asm new file mode 100644 index 000000000..d8ee90be8 --- /dev/null +++ b/src/main/fragment/mos6502-common/_deref_pwuz1=_dec__deref_pwuz2.asm @@ -0,0 +1,10 @@ +ldy #0 +sec +lda ({z2}),y +sbc #1 +sta ({z1}),y +iny +lda ({z2}),y +sbc #0 +sta ({z1}),y + diff --git a/src/main/fragment/mos6502-common/_deref_pwuz1=_deref_pwuz2.asm b/src/main/fragment/mos6502-common/_deref_pwuz1=_deref_pwuz2.asm new file mode 100644 index 000000000..48d426491 --- /dev/null +++ b/src/main/fragment/mos6502-common/_deref_pwuz1=_deref_pwuz2.asm @@ -0,0 +1,6 @@ +ldy #0 +lda ({z2}),y +sta ({z1}),y +iny +lda ({z2}),y +sta ({z1}),y \ No newline at end of file diff --git a/src/main/fragment/mos6502-common/_deref_pwuz1=_deref_pwuz2_minus_vwum3.asm b/src/main/fragment/mos6502-common/_deref_pwuz1=_deref_pwuz2_minus_vwum3.asm new file mode 100644 index 000000000..3ab2aaf15 --- /dev/null +++ b/src/main/fragment/mos6502-common/_deref_pwuz1=_deref_pwuz2_minus_vwum3.asm @@ -0,0 +1,9 @@ +ldy #0 +sec +lda ({z2}),y +sbc {m3} +sta ({z1}),y +iny +lda ({z2}),y +sbc {m3}+1 +sta ({z1}),y diff --git a/src/main/fragment/mos6502-common/_deref_pwuz1=_deref_pwuz2_plus_vwum3.asm b/src/main/fragment/mos6502-common/_deref_pwuz1=_deref_pwuz2_plus_vwum3.asm new file mode 100644 index 000000000..3fb50af86 --- /dev/null +++ b/src/main/fragment/mos6502-common/_deref_pwuz1=_deref_pwuz2_plus_vwum3.asm @@ -0,0 +1,9 @@ +ldy #0 +clc +lda ({z2}),y +adc {m3} +sta ({z1}),y +iny +lda ({z2}),y +adc {m3}+1 +sta ({z1}),y diff --git a/src/main/fragment/mos6502-common/_deref_pwuz1=_inc__deref_pwuz2.asm b/src/main/fragment/mos6502-common/_deref_pwuz1=_inc__deref_pwuz2.asm new file mode 100644 index 000000000..93575ed11 --- /dev/null +++ b/src/main/fragment/mos6502-common/_deref_pwuz1=_inc__deref_pwuz2.asm @@ -0,0 +1,10 @@ +ldy #0 +clc +lda ({z2}),y +adc #1 +sta ({z1}),y +iny +lda ({z2}),y +adc #0 +sta ({z1}),y + diff --git a/src/main/fragment/mos6502-common/_deref_pwuz1_eq_0_then_la1.asm b/src/main/fragment/mos6502-common/_deref_pwuz1_eq_0_then_la1.asm new file mode 100644 index 000000000..b544e8423 --- /dev/null +++ b/src/main/fragment/mos6502-common/_deref_pwuz1_eq_0_then_la1.asm @@ -0,0 +1,5 @@ +ldy #0 +lda ({z1}),y +iny +ora ({z1}),y +beq {la1} \ No newline at end of file diff --git a/src/main/fragment/mos6502-common/_deref_pwuz1_eq_vbuc1_then_la1.asm b/src/main/fragment/mos6502-common/_deref_pwuz1_eq_vbuc1_then_la1.asm new file mode 100644 index 000000000..737da50de --- /dev/null +++ b/src/main/fragment/mos6502-common/_deref_pwuz1_eq_vbuc1_then_la1.asm @@ -0,0 +1,8 @@ +ldy #1 +lda ({z1}),y +bne !+ +dey +lda ({z1}),y +cmp #{c1} +beq {la1} +!: diff --git a/src/main/fragment/mos6502-common/_deref_pwuz1_neq_0_then_la1.asm b/src/main/fragment/mos6502-common/_deref_pwuz1_neq_0_then_la1.asm index 6d9df3d8f..64aa0932d 100644 --- a/src/main/fragment/mos6502-common/_deref_pwuz1_neq_0_then_la1.asm +++ b/src/main/fragment/mos6502-common/_deref_pwuz1_neq_0_then_la1.asm @@ -1,6 +1,5 @@ ldy #0 lda ({z1}),y -bne {la1} iny -lda ({z1}),y -bne {la1} +ora ({z1}),y +bne {la1} \ No newline at end of file diff --git a/src/main/fragment/mos6502-common/_deref_pwuz1_neq_vwum2_then_la1.asm b/src/main/fragment/mos6502-common/_deref_pwuz1_neq_vwum2_then_la1.asm new file mode 100644 index 000000000..9a48db314 --- /dev/null +++ b/src/main/fragment/mos6502-common/_deref_pwuz1_neq_vwum2_then_la1.asm @@ -0,0 +1,8 @@ +ldy #0 +lda ({z1}),y +cmp {m2} +bne {la1} +iny +lda ({z1}),y +cmp {m2}+1 +bne {la1} diff --git a/src/main/fragment/mos6502-common/pbuz1_derefidx_(pbuc1_derefidx_vbuxx)=vbuaa.asm b/src/main/fragment/mos6502-common/pbuz1_derefidx_(pbuc1_derefidx_vbuxx)=vbuaa.asm new file mode 100644 index 000000000..2bc89c135 --- /dev/null +++ b/src/main/fragment/mos6502-common/pbuz1_derefidx_(pbuc1_derefidx_vbuxx)=vbuaa.asm @@ -0,0 +1,2 @@ +ldy {c1},x +sta ({z1}),y diff --git a/src/main/fragment/mos6502-common/pwsz1=_deref_qwsz1_plus__deref_pwsz2.asm b/src/main/fragment/mos6502-common/pwsz1=_deref_qwsz1_plus__deref_pwsz2.asm new file mode 100644 index 000000000..6777e8dec --- /dev/null +++ b/src/main/fragment/mos6502-common/pwsz1=_deref_qwsz1_plus__deref_pwsz2.asm @@ -0,0 +1,11 @@ +ldy #0 +clc +lda ({z1}),y +adc ({z2}),y +pha +iny +lda ({z1}),y +adc ({z2}),y +sta {z1}+1 +pla +sta {z1} \ No newline at end of file diff --git a/src/main/fragment/mos6502-common/pwuz1=_deref_qwuz1_plus__deref_pwuz2.asm b/src/main/fragment/mos6502-common/pwuz1=_deref_qwuz1_plus__deref_pwuz2.asm new file mode 100644 index 000000000..6777e8dec --- /dev/null +++ b/src/main/fragment/mos6502-common/pwuz1=_deref_qwuz1_plus__deref_pwuz2.asm @@ -0,0 +1,11 @@ +ldy #0 +clc +lda ({z1}),y +adc ({z2}),y +pha +iny +lda ({z1}),y +adc ({z2}),y +sta {z1}+1 +pla +sta {z1} \ No newline at end of file diff --git a/src/main/fragment/mos6502-common/qvom1=qvoc1_plus_vwum1.asm b/src/main/fragment/mos6502-common/qvom1=qvoc1_plus_vwum1.asm new file mode 100644 index 000000000..a234c26f1 --- /dev/null +++ b/src/main/fragment/mos6502-common/qvom1=qvoc1_plus_vwum1.asm @@ -0,0 +1,7 @@ +lda #<{c1} +clc +adc {m1} +sta {m1} +lda #>{c1} +adc {m1}+1 +sta {m1}+1 diff --git a/src/main/fragment/mos6502-common/vbsc1_eq__deref_pwsc2_then_la1.asm b/src/main/fragment/mos6502-common/vbsc1_eq__deref_pwsc2_then_la1.asm new file mode 100644 index 000000000..70fbc2407 --- /dev/null +++ b/src/main/fragment/mos6502-common/vbsc1_eq__deref_pwsc2_then_la1.asm @@ -0,0 +1,7 @@ +lda #<{c1} +cmp {c2} +bne !+ +lda #>{c1} +cmp {c2}+1 +beq {la1} +!: \ No newline at end of file diff --git a/src/main/fragment/mos6502-common/vwsc1_eq__deref_pwsc2_then_la1.asm b/src/main/fragment/mos6502-common/vwsc1_eq__deref_pwsc2_then_la1.asm new file mode 100644 index 000000000..70fbc2407 --- /dev/null +++ b/src/main/fragment/mos6502-common/vwsc1_eq__deref_pwsc2_then_la1.asm @@ -0,0 +1,7 @@ +lda #<{c1} +cmp {c2} +bne !+ +lda #>{c1} +cmp {c2}+1 +beq {la1} +!: \ No newline at end of file diff --git a/src/main/fragment/mos6502-common/vwsm1=vwsm1_rol_4.asm b/src/main/fragment/mos6502-common/vwsm1=vwsm1_rol_4.asm new file mode 100644 index 000000000..bcdf4d6db --- /dev/null +++ b/src/main/fragment/mos6502-common/vwsm1=vwsm1_rol_4.asm @@ -0,0 +1,8 @@ +asl {m1} +rol {m1}+1 +asl {m1} +rol {m1}+1 +asl {m1} +rol {m1}+1 +asl {m1} +rol {m1}+1 \ No newline at end of file diff --git a/src/main/fragment/mos6502-common/vwsm1_eq_0_then_la1.asm b/src/main/fragment/mos6502-common/vwsm1_eq_0_then_la1.asm new file mode 100644 index 000000000..9c2f0b382 --- /dev/null +++ b/src/main/fragment/mos6502-common/vwsm1_eq_0_then_la1.asm @@ -0,0 +1,3 @@ +lda {m1} +ora {m1}+1 +beq {la1} \ No newline at end of file diff --git a/src/main/fragment/mos6502-common/vwsm1_ge__deref_pwsz2_then_la1.asm b/src/main/fragment/mos6502-common/vwsm1_ge__deref_pwsz2_then_la1.asm new file mode 100644 index 000000000..4e201d262 --- /dev/null +++ b/src/main/fragment/mos6502-common/vwsm1_ge__deref_pwsz2_then_la1.asm @@ -0,0 +1,10 @@ +ldy #0 +lda {m1} +cmp ({z2}),y +iny +lda {m1}+1 +sbc ({z2}),y +bvc !+ +eor #$80 +!: +bpl {la1} diff --git a/src/main/fragment/mos6502-common/vwsm1_gt_pwsc1_derefidx_vbuxx_then_la1.asm b/src/main/fragment/mos6502-common/vwsm1_gt_pwsc1_derefidx_vbuxx_then_la1.asm index adee8a5f4..8fcf519cb 100644 --- a/src/main/fragment/mos6502-common/vwsm1_gt_pwsc1_derefidx_vbuxx_then_la1.asm +++ b/src/main/fragment/mos6502-common/vwsm1_gt_pwsc1_derefidx_vbuxx_then_la1.asm @@ -6,4 +6,3 @@ bvc !+ eor #$80 !: bmi {la1} -!e: diff --git a/src/main/fragment/mos6502-common/vwsm1_gt_pwsc1_derefidx_vbuyy_then_la1.asm b/src/main/fragment/mos6502-common/vwsm1_gt_pwsc1_derefidx_vbuyy_then_la1.asm index 76ce2fb60..a69b9d401 100644 --- a/src/main/fragment/mos6502-common/vwsm1_gt_pwsc1_derefidx_vbuyy_then_la1.asm +++ b/src/main/fragment/mos6502-common/vwsm1_gt_pwsc1_derefidx_vbuyy_then_la1.asm @@ -6,4 +6,3 @@ bvc !+ eor #$80 !: bmi {la1} -!e: diff --git a/src/main/fragment/mos6502-common/vwsm1_gt_vwsm2_then_la1.asm b/src/main/fragment/mos6502-common/vwsm1_gt_vwsm2_then_la1.asm index 6f46ffb75..b5471f921 100644 --- a/src/main/fragment/mos6502-common/vwsm1_gt_vwsm2_then_la1.asm +++ b/src/main/fragment/mos6502-common/vwsm1_gt_vwsm2_then_la1.asm @@ -5,5 +5,4 @@ sbc {m1}+1 bvc !+ eor #$80 !: -bmi {la1} -!e: +bmi {la1} \ No newline at end of file diff --git a/src/main/fragment/mos6502-common/vwsz1=_deref_pwsz1_rol_1.asm b/src/main/fragment/mos6502-common/vwsz1=_deref_pwsz1_rol_1.asm new file mode 100644 index 000000000..5bbf9b7ed --- /dev/null +++ b/src/main/fragment/mos6502-common/vwsz1=_deref_pwsz1_rol_1.asm @@ -0,0 +1,10 @@ +ldy #0 +lda ({z1}),y +asl +pha +iny +lda ({z1}),y +rol +sta {z1}+1 +pla +sta {z1} diff --git a/src/main/fragment/mos6502-common/vwsz1=_deref_pwsz2_minus__deref_pwsz1.asm b/src/main/fragment/mos6502-common/vwsz1=_deref_pwsz2_minus__deref_pwsz1.asm new file mode 100644 index 000000000..5c28f7d0a --- /dev/null +++ b/src/main/fragment/mos6502-common/vwsz1=_deref_pwsz2_minus__deref_pwsz1.asm @@ -0,0 +1,11 @@ +ldy #0 +sec +lda ({z2}),y +sbc ({z1}),y +pha +iny +lda ({z2}),y +sbc ({z1}),y +sta {z1}+1 +pla +sta {z1} diff --git a/src/main/fragment/mos6502-common/vwum1=_deref_pwuc1_rol_1.asm b/src/main/fragment/mos6502-common/vwum1=_deref_pwuc1_rol_1.asm new file mode 100644 index 000000000..25faa5d43 --- /dev/null +++ b/src/main/fragment/mos6502-common/vwum1=_deref_pwuc1_rol_1.asm @@ -0,0 +1,6 @@ +lda {c1} +asl +sta {m1} +lda {c1}+1 +rol +sta {m1}+1 \ No newline at end of file diff --git a/src/main/fragment/mos6502-common/vwum1=_deref_pwuz2_plus__deref_pwuz3.asm b/src/main/fragment/mos6502-common/vwum1=_deref_pwuz2_plus__deref_pwuz3.asm new file mode 100644 index 000000000..7f759a7ce --- /dev/null +++ b/src/main/fragment/mos6502-common/vwum1=_deref_pwuz2_plus__deref_pwuz3.asm @@ -0,0 +1,9 @@ +ldy #0 +clc +lda ({z2}),y +adc ({z3}),y +sta {m1} +iny +lda ({z2}),y +adc ({z3}),y +sta {m1}+1 \ No newline at end of file diff --git a/src/main/fragment/mos6502-common/vwum1=_deref_pwuz2_rol_1.asm b/src/main/fragment/mos6502-common/vwum1=_deref_pwuz2_rol_1.asm new file mode 100644 index 000000000..e096d140c --- /dev/null +++ b/src/main/fragment/mos6502-common/vwum1=_deref_pwuz2_rol_1.asm @@ -0,0 +1,8 @@ +ldy #0 +lda ({z2}),y +asl +sta {m1} +iny +lda ({z2}),y +rol +sta {m1}+1 diff --git a/src/main/fragment/mos6502-common/vwuz1=_deref_pwuz1_rol_1.asm b/src/main/fragment/mos6502-common/vwuz1=_deref_pwuz1_rol_1.asm new file mode 100644 index 000000000..5bbf9b7ed --- /dev/null +++ b/src/main/fragment/mos6502-common/vwuz1=_deref_pwuz1_rol_1.asm @@ -0,0 +1,10 @@ +ldy #0 +lda ({z1}),y +asl +pha +iny +lda ({z1}),y +rol +sta {z1}+1 +pla +sta {z1} diff --git a/src/main/fragment/mos6502-common/vwuz1=_deref_pwuz2_minus__deref_pwuz1.asm b/src/main/fragment/mos6502-common/vwuz1=_deref_pwuz2_minus__deref_pwuz1.asm new file mode 100644 index 000000000..5c28f7d0a --- /dev/null +++ b/src/main/fragment/mos6502-common/vwuz1=_deref_pwuz2_minus__deref_pwuz1.asm @@ -0,0 +1,11 @@ +ldy #0 +sec +lda ({z2}),y +sbc ({z1}),y +pha +iny +lda ({z2}),y +sbc ({z1}),y +sta {z1}+1 +pla +sta {z1} diff --git a/src/main/fragment/mos6502-common/vwuz1=pwuz1_derefidx_vbuyy_rol_1.asm b/src/main/fragment/mos6502-common/vwuz1=pwuz1_derefidx_vbuyy_rol_1.asm new file mode 100644 index 000000000..79d6cd346 --- /dev/null +++ b/src/main/fragment/mos6502-common/vwuz1=pwuz1_derefidx_vbuyy_rol_1.asm @@ -0,0 +1,9 @@ +lda ({z1}),y +asl +pha +iny +lda ({z1}),y +rol +sta {z1}+1 +pla +sta {z1} \ No newline at end of file diff --git a/src/main/fragment/mos6502-common/vwuz1=pwuz2_derefidx_vbuyy_rol_1.asm b/src/main/fragment/mos6502-common/vwuz1=pwuz2_derefidx_vbuyy_rol_1.asm new file mode 100644 index 000000000..983441ea9 --- /dev/null +++ b/src/main/fragment/mos6502-common/vwuz1=pwuz2_derefidx_vbuyy_rol_1.asm @@ -0,0 +1,7 @@ +lda ({z2}),y +asl +sta {z1} +iny +lda ({z2}),y +rol +sta {z1}+1 diff --git a/src/main/java/dk/camelot64/kickc/fragment/AsmFragmentTemplateSynthesisRule.java b/src/main/java/dk/camelot64/kickc/fragment/AsmFragmentTemplateSynthesisRule.java index 7bedb2650..f02ad95e1 100644 --- a/src/main/java/dk/camelot64/kickc/fragment/AsmFragmentTemplateSynthesisRule.java +++ b/src/main/java/dk/camelot64/kickc/fragment/AsmFragmentTemplateSynthesisRule.java @@ -660,6 +660,8 @@ class AsmFragmentTemplateSynthesisRule { // Replace second (of 2) M4 with XX synths.add(new AsmFragmentTemplateSynthesisRule("(.*)m4(.*vb.)m4(.*)", lvalZM4+"|"+rvalXx, "ldx {m4}", "$1m4$2xx$3", null, null)); + // Correct wrong ordered Z2/Z1 + synths.add(new AsmFragmentTemplateSynthesisRule("(.*)z2(.*)z1(.*)", twoZM1+"|"+twoZM2, null, "$1z1$2z2$3", null, mapZM2Swap, false)); // Correct wrong ordered Z2/Z1 synths.add(new AsmFragmentTemplateSynthesisRule("(.*)m2(.*)m1(.*)", twoZM1+"|"+twoZM2, null, "$1m1$2m2$3", null, mapZM2Swap, false)); // Correct wrong ordered Z3/Z2 diff --git a/src/test/ref/index-pointer-rewrite-7.log b/src/test/ref/index-pointer-rewrite-7.log index a723c2582..0fad906af 100644 --- a/src/test/ref/index-pointer-rewrite-7.log +++ b/src/test/ref/index-pointer-rewrite-7.log @@ -219,11 +219,6 @@ Allocated zp[2]:14 [ main::$10 ] Allocated zp[2]:16 [ main::$3 ] Allocated zp[2]:18 [ main::$8 ] Allocated zp[2]:20 [ main::$11 ] -Warning! Unknown fragment for statement [11] (word~) main::$3 ← *((word*~) main::$9) + *((word*~) main::$10) -Missing ASM fragment Fragment not found vwuz1=_deref_pwuz2_plus__deref_pwuz3. Attempted variations vwuz1=_deref_pwuz2_plus__deref_pwuz3 -File C:\c64\kickc\src\test\kc\index-pointer-rewrite-7.c -Line 13 -fibs[i]+fibs[i+1] INITIAL ASM Target platform is c64basic / MOS6502X @@ -329,8 +324,16 @@ main: { lda.z __7+1 adc #>fibs sta.z __10+1 - // [11] (word~) main::$3 ← *((word*~) main::$9) + *((word*~) main::$10) - .assert "Missing ASM fragment Fragment not found vwuz1=_deref_pwuz2_plus__deref_pwuz3. Attempted variations vwuz1=_deref_pwuz2_plus__deref_pwuz3 ", 0, 1 + // [11] (word~) main::$3 ← *((word*~) main::$9) + *((word*~) main::$10) -- vwuz1=_deref_pwuz2_plus__deref_pwuz3 + ldy #0 + clc + lda (__9),y + adc (__10),y + sta.z __3 + iny + lda (__9),y + adc (__10),y + sta.z __3+1 // [12] (word~) main::$8 ← (word~) main::$1 << (byte) 1 -- vwuz1=vwuz2_rol_1 lda.z __1 asl @@ -376,10 +379,7 @@ Statement [7] (word~) main::$6 ← (word) main::i#2 << (byte) 1 [ main::i#2 main Statement [8] (word~) main::$7 ← (word~) main::$2 << (byte) 1 [ main::i#2 main::$1 main::$6 main::$7 ] ( [ main::i#2 main::$1 main::$6 main::$7 ] { } ) always clobbers reg byte a Statement [9] (word*~) main::$9 ← (const word*) fibs + (word~) main::$6 [ main::i#2 main::$1 main::$7 main::$9 ] ( [ main::i#2 main::$1 main::$7 main::$9 ] { } ) always clobbers reg byte a Statement [10] (word*~) main::$10 ← (const word*) fibs + (word~) main::$7 [ main::i#2 main::$1 main::$9 main::$10 ] ( [ main::i#2 main::$1 main::$9 main::$10 ] { } ) always clobbers reg byte a -Potential register analysis [11] main::$3 ← *(main::$9) + *(main::$10) missing fragment Fragment not found vwuz1=_deref_pwuz2_plus__deref_pwuz3. Attempted variations vwuz1=_deref_pwuz2_plus__deref_pwuz3 allocation: zp[2]:16 [ main::$3 ] zp[2]:12 [ main::$9 ] zp[2]:14 [ main::$10 ] -MISSING FRAGMENTS - Fragment not found vwuz1=_deref_pwuz2_plus__deref_pwuz3. Attempted variations vwuz1=_deref_pwuz2_plus__deref_pwuz3 -Statement [11] (word~) main::$3 ← *((word*~) main::$9) + *((word*~) main::$10) [ main::i#2 main::$1 main::$3 ] ( [ main::i#2 main::$1 main::$3 ] { } ) always clobbers reg byte a reg byte x reg byte y +Statement [11] (word~) main::$3 ← *((word*~) main::$9) + *((word*~) main::$10) [ main::i#2 main::$1 main::$3 ] ( [ main::i#2 main::$1 main::$3 ] { } ) always clobbers reg byte a reg byte y Statement [12] (word~) main::$8 ← (word~) main::$1 << (byte) 1 [ main::i#2 main::$3 main::$8 ] ( [ main::i#2 main::$3 main::$8 ] { } ) always clobbers reg byte a Statement [13] (word*~) main::$11 ← (const word*) fibs + (word~) main::$8 [ main::i#2 main::$3 main::$11 ] ( [ main::i#2 main::$3 main::$11 ] { } ) always clobbers reg byte a Statement [14] *((word*~) main::$11) ← (word~) main::$3 [ main::i#2 ] ( [ main::i#2 ] { } ) always clobbers reg byte a reg byte y @@ -398,35 +398,10 @@ REGISTER UPLIFT SCOPES Uplift Scope [main] 27.5: zp[2]:2 [ main::i#2 main::i#1 ] 22: zp[2]:14 [ main::$10 ] 22: zp[2]:18 [ main::$8 ] 22: zp[2]:20 [ main::$11 ] 11: zp[2]:6 [ main::$2 ] 11: zp[2]:8 [ main::$6 ] 11: zp[2]:10 [ main::$7 ] 11: zp[2]:12 [ main::$9 ] 7.33: zp[2]:16 [ main::$3 ] 3.14: zp[2]:4 [ main::$1 ] Uplift Scope [] -Warning! Unknown fragment for statement [11] (word~) main::$3 ← *((word*~) main::$9) + *((word*~) main::$10) -Missing ASM fragment Fragment not found vwuz1=_deref_pwuz2_plus__deref_pwuz3. Attempted variations vwuz1=_deref_pwuz2_plus__deref_pwuz3 -File C:\c64\kickc\src\test\kc\index-pointer-rewrite-7.c -Line 13 -fibs[i]+fibs[i+1] -Uplifting [main] best 2075 combination zp[2]:2 [ main::i#2 main::i#1 ] zp[2]:14 [ main::$10 ] zp[2]:18 [ main::$8 ] zp[2]:20 [ main::$11 ] zp[2]:6 [ main::$2 ] zp[2]:8 [ main::$6 ] zp[2]:10 [ main::$7 ] zp[2]:12 [ main::$9 ] zp[2]:16 [ main::$3 ] zp[2]:4 [ main::$1 ] -Warning! Unknown fragment for statement [11] (word~) main::$3 ← *((word*~) main::$9) + *((word*~) main::$10) -Missing ASM fragment Fragment not found vwuz1=_deref_pwuz2_plus__deref_pwuz3. Attempted variations vwuz1=_deref_pwuz2_plus__deref_pwuz3 -File C:\c64\kickc\src\test\kc\index-pointer-rewrite-7.c -Line 13 -fibs[i]+fibs[i+1] -Uplifting [] best 2075 combination -Warning! Unknown fragment for statement [11] (word~) main::$3 ← *((word*~) main::$9) + *((word*~) main::$10) -Missing ASM fragment Fragment not found vwuz1=_deref_pwuz2_plus__deref_pwuz3. Attempted variations vwuz1=_deref_pwuz2_plus__deref_pwuz3 -File C:\c64\kickc\src\test\kc\index-pointer-rewrite-7.c -Line 13 -fibs[i]+fibs[i+1] +Uplifting [main] best 2415 combination zp[2]:2 [ main::i#2 main::i#1 ] zp[2]:14 [ main::$10 ] zp[2]:18 [ main::$8 ] zp[2]:20 [ main::$11 ] zp[2]:6 [ main::$2 ] zp[2]:8 [ main::$6 ] zp[2]:10 [ main::$7 ] zp[2]:12 [ main::$9 ] zp[2]:16 [ main::$3 ] zp[2]:4 [ main::$1 ] +Uplifting [] best 2415 combination Coalescing zero page register [ zp[2]:4 [ main::$1 ] ] with [ zp[2]:18 [ main::$8 ] ] - score: 1 -Warning! Unknown fragment for statement [11] (word~) main::$3 ← *((word*~) main::$9) + *((word*~) main::$10) -Missing ASM fragment Fragment not found vwuz1=_deref_pwuz2_plus__deref_pwuz3. Attempted variations vwuz1=_deref_pwuz2_plus__deref_pwuz3 -File C:\c64\kickc\src\test\kc\index-pointer-rewrite-7.c -Line 13 -fibs[i]+fibs[i+1] Coalescing zero page register [ zp[2]:6 [ main::$2 ] ] with [ zp[2]:10 [ main::$7 ] ] - score: 1 -Warning! Unknown fragment for statement [11] (word~) main::$3 ← *((word*~) main::$9) + *((word*~) main::$10) -Missing ASM fragment Fragment not found vwuz1=_deref_pwuz2_plus__deref_pwuz3. Attempted variations vwuz1=_deref_pwuz2_plus__deref_pwuz3 -File C:\c64\kickc\src\test\kc\index-pointer-rewrite-7.c -Line 13 -fibs[i]+fibs[i+1] Coalescing zero page register [ zp[2]:8 [ main::$6 ] ] with [ zp[2]:12 [ main::$9 ] ] - score: 1 Coalescing zero page register [ zp[2]:14 [ main::$10 ] ] with [ zp[2]:16 [ main::$3 ] ] - score: 1 Coalescing zero page register [ zp[2]:4 [ main::$1 main::$8 ] ] with [ zp[2]:20 [ main::$11 ] ] - score: 1 diff --git a/src/test/ref/test-comparisons-sword.asm b/src/test/ref/test-comparisons-sword.asm index 6abe0b2d9..a041f0c8e 100644 --- a/src/test/ref/test-comparisons-sword.asm +++ b/src/test/ref/test-comparisons-sword.asm @@ -208,7 +208,6 @@ compare: { eor #$80 !: bmi __b10 - !e: lda #TT sta.z r jmp __b21 @@ -253,7 +252,6 @@ compare: { eor #$80 !: bmi __b12 - !e: lda #TT sta.z r jmp __b23 diff --git a/src/test/ref/test-comparisons-sword.log b/src/test/ref/test-comparisons-sword.log index ac748c449..677f8947f 100644 --- a/src/test/ref/test-comparisons-sword.log +++ b/src/test/ref/test-comparisons-sword.log @@ -2661,7 +2661,6 @@ compare: { eor #$80 !: bmi __b21_from___b4 - !e: // [52] phi from compare::@4 to compare::@15 [phi:compare::@4->compare::@15] __b15_from___b4: jmp __b15 @@ -2740,7 +2739,6 @@ compare: { eor #$80 !: bmi __b23_from___b2 - !e: // [58] phi from compare::@2 to compare::@17 [phi:compare::@2->compare::@17] __b17_from___b2: jmp __b17 @@ -3660,7 +3658,6 @@ compare: { eor #$80 !: bmi __b21_from___b4 - !e: // [52] phi from compare::@4 to compare::@15 [phi:compare::@4->compare::@15] __b15_from___b4: jmp __b15 @@ -3739,7 +3736,6 @@ compare: { eor #$80 !: bmi __b23_from___b2 - !e: // [58] phi from compare::@2 to compare::@17 [phi:compare::@2->compare::@17] __b17_from___b2: jmp __b17 @@ -4908,7 +4904,6 @@ compare: { eor #$80 !: bmi __b10 - !e: // [52] phi from compare::@4 to compare::@15 [phi:compare::@4->compare::@15] // compare::@15 // [53] phi from compare::@15 to compare::@21 [phi:compare::@15->compare::@21] @@ -4977,7 +4972,6 @@ compare: { eor #$80 !: bmi __b12 - !e: // [58] phi from compare::@2 to compare::@17 [phi:compare::@2->compare::@17] // compare::@17 // [59] phi from compare::@17 to compare::@23 [phi:compare::@17->compare::@23]