From a7359f839523de3bfca5b02739225996a4b7daf3 Mon Sep 17 00:00:00 2001 From: jespergravgaard Date: Mon, 3 Aug 2020 00:27:03 +0200 Subject: [PATCH] Added a bunch of Z-fragments. --- .../cache/fragment-cache-csg65ce02.asm | 34 ++-- .../cache/fragment-cache-mega45gs02.asm | 2 +- .../fragment/cache/fragment-cache-mos6502.asm | 2 +- .../cache/fragment-cache-mos6502x.asm | 2 +- .../cache/fragment-cache-wdc65c02.asm | 2 +- .../pbuz1_derefidx_vbuzz=vbuaa.asm | 1 + .../vboaa=pbuz1_derefidx_vbuzz_eq_vbuaa.asm | 5 + .../vbsaa=vbsaa_plus_pbsz1_derefidx_vbuzz.asm | 2 + .../vbuaa=pbuz1_derefidx_vbuzz.asm | 1 + ...vbuaa=pbuz1_derefidx_vbuzz_minus_vbuaa.asm | 3 + ...vbuaa=pbuz1_derefidx_vbuzz_minus_vbuc1.asm | 3 + ...vbuaa=pbuz1_derefidx_vbuzz_minus_vbum2.asm | 3 + .../vbuaa=vbuaa_band_pbuz1_derefidx_vbuzz.asm | 1 + .../vbuaa=vbuaa_bor_pbuz1_derefidx_vbuzz.asm | 1 + .../vbuaa=vbuaa_bxor_pbuz1_derefidx_vbuzz.asm | 1 + .../vbuaa=vbuaa_plus_pbuz1_derefidx_vbuzz.asm | 2 + ...vbuaa_eq_pbuz1_derefidx_vbuzz_then_la1.asm | 2 + .../vdum1=_word_pbuz2_derefidx_vbuzz.asm | 6 + .../vwsm1=_sword_pbsz2_derefidx_vbuzz.asm | 4 + .../vwsm1=vwsm1_plus_pbuz2_derefidx_vbuzz.asm | 7 + .../vwsm1=vwsm2_plus_pbuz3_derefidx_vbuzz.asm | 7 + .../vwum1=_word_pbuz2_derefidx_vbuzz.asm | 4 + .../vwum1=pbuz2_derefidx_vbuzz_rol_1.asm | 6 + .../pbuz1_derefidx_vbuyy=vbuaa.asm | 2 +- .../vwum1=_word_pbuz2_derefidx_vbuyy.asm | 1 - .../kickc/fragment/AsmFragmentSystemHash.java | 4 +- .../AsmFragmentTemplateSynthesisRule.java | 66 ++++++- .../AsmFragmentTemplateSynthesizer.java | 2 +- .../fragment/AsmFragmentTemplateUsages.java | 8 +- src/test/ref/cpu-65ce02-eightqueens.asm | 16 +- src/test/ref/cpu-65ce02-eightqueens.log | 168 +++++++++--------- src/test/ref/cpu-65ce02-eightqueens.sym | 12 +- 32 files changed, 241 insertions(+), 139 deletions(-) create mode 100644 src/main/fragment/csg65ce02-common/pbuz1_derefidx_vbuzz=vbuaa.asm create mode 100644 src/main/fragment/csg65ce02-common/vboaa=pbuz1_derefidx_vbuzz_eq_vbuaa.asm create mode 100644 src/main/fragment/csg65ce02-common/vbsaa=vbsaa_plus_pbsz1_derefidx_vbuzz.asm create mode 100644 src/main/fragment/csg65ce02-common/vbuaa=pbuz1_derefidx_vbuzz.asm create mode 100644 src/main/fragment/csg65ce02-common/vbuaa=pbuz1_derefidx_vbuzz_minus_vbuaa.asm create mode 100644 src/main/fragment/csg65ce02-common/vbuaa=pbuz1_derefidx_vbuzz_minus_vbuc1.asm create mode 100644 src/main/fragment/csg65ce02-common/vbuaa=pbuz1_derefidx_vbuzz_minus_vbum2.asm create mode 100644 src/main/fragment/csg65ce02-common/vbuaa=vbuaa_band_pbuz1_derefidx_vbuzz.asm create mode 100644 src/main/fragment/csg65ce02-common/vbuaa=vbuaa_bor_pbuz1_derefidx_vbuzz.asm create mode 100644 src/main/fragment/csg65ce02-common/vbuaa=vbuaa_bxor_pbuz1_derefidx_vbuzz.asm create mode 100644 src/main/fragment/csg65ce02-common/vbuaa=vbuaa_plus_pbuz1_derefidx_vbuzz.asm create mode 100644 src/main/fragment/csg65ce02-common/vbuaa_eq_pbuz1_derefidx_vbuzz_then_la1.asm create mode 100644 src/main/fragment/csg65ce02-common/vdum1=_word_pbuz2_derefidx_vbuzz.asm create mode 100644 src/main/fragment/csg65ce02-common/vwsm1=_sword_pbsz2_derefidx_vbuzz.asm create mode 100644 src/main/fragment/csg65ce02-common/vwsm1=vwsm1_plus_pbuz2_derefidx_vbuzz.asm create mode 100644 src/main/fragment/csg65ce02-common/vwsm1=vwsm2_plus_pbuz3_derefidx_vbuzz.asm create mode 100644 src/main/fragment/csg65ce02-common/vwum1=_word_pbuz2_derefidx_vbuzz.asm create mode 100644 src/main/fragment/csg65ce02-common/vwum1=pbuz2_derefidx_vbuzz_rol_1.asm diff --git a/src/main/fragment/cache/fragment-cache-csg65ce02.asm b/src/main/fragment/cache/fragment-cache-csg65ce02.asm index ed39aaa34..6fde89ef6 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 1776b64820 1776b6602f +//KICKC FRAGMENT CACHE 17a3d463b0 17a3d47bef //FRAGMENT vbuz1=vbuc1 lda #{c1} sta {z1} @@ -337,22 +337,20 @@ sta {z1} cmp #{c1} bcc {la1} //FRAGMENT pbuz1_derefidx_vbuaa=vbuc1 -tay +taz lda #{c1} -sta ({z1}),y +sta ({z1}),z //FRAGMENT pbuz1_derefidx_vbuxx=vbuc1 txa -tay +taz lda #{c1} -sta ({z1}),y +sta ({z1}),z //FRAGMENT pbuz1_derefidx_vbuyy=vbuc1 lda #{c1} sta ({z1}),y //FRAGMENT pbuz1_derefidx_vbuzz=vbuc1 -tza -tay lda #{c1} -sta ({z1}),y +sta ({z1}),z //FRAGMENT vbuaa=_deref_pbuz1 ldy #0 lda ({z1}),y @@ -426,17 +424,9 @@ beq {la1} ldy {z2} sta ({z1}),y //FRAGMENT pbuz1_derefidx_vbuz2=vbuxx -ldy {z2} txa -sta ({z1}),y -//FRAGMENT pbuz1_derefidx_vbuz2=vbuyy -tya -ldy {z2} -sta ({z1}),y -//FRAGMENT pbuz1_derefidx_vbuz2=vbuzz -ldy {z2} -tza -sta ({z1}),y +ldz {z2} +sta ({z1}),z //FRAGMENT vbuaa=_byte_vwuz1 lda {z1} //FRAGMENT vbuxx=_byte_vwuz1 @@ -2041,9 +2031,17 @@ taz //FRAGMENT vbuyy_eq_vbuc1_then_la1 cpy #{c1} beq {la1} +//FRAGMENT pbuz1_derefidx_vbuz2=vbuyy +tya +ldy {z2} +sta ({z1}),y //FRAGMENT vbuzz_eq_vbuc1_then_la1 cpz #{c1} beq {la1} +//FRAGMENT pbuz1_derefidx_vbuz2=vbuzz +tza +ldz {z2} +sta ({z1}),z //FRAGMENT vbuz1_lt_vbuxx_then_la1 cpx {z1} beq !+ diff --git a/src/main/fragment/cache/fragment-cache-mega45gs02.asm b/src/main/fragment/cache/fragment-cache-mega45gs02.asm index 55c3dd276..35f6d9118 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 1776b64820 1776b6602f +//KICKC FRAGMENT CACHE 17a3d463b0 17a3d47bef //FRAGMENT vduz1=vduc1 lda #<{c1} sta {z1} diff --git a/src/main/fragment/cache/fragment-cache-mos6502.asm b/src/main/fragment/cache/fragment-cache-mos6502.asm index 60951274c..57187f2a7 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 1776b64820 1776b6602f +//KICKC FRAGMENT CACHE 17a3d463b0 17a3d47bef //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 46ecdeccf..274e60249 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 1776b64820 1776b6602f +//KICKC FRAGMENT CACHE 17a3d463b0 17a3d47bef //FRAGMENT vbuz1=vbuc1 lda #{c1} sta {z1} diff --git a/src/main/fragment/cache/fragment-cache-wdc65c02.asm b/src/main/fragment/cache/fragment-cache-wdc65c02.asm index d4a67eb65..67a6c4f20 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 1776b64820 1776b6602f +//KICKC FRAGMENT CACHE 17a3d463b0 17a3d47bef //FRAGMENT vbuz1=_deref_pbuc1 lda {c1} sta {z1} diff --git a/src/main/fragment/csg65ce02-common/pbuz1_derefidx_vbuzz=vbuaa.asm b/src/main/fragment/csg65ce02-common/pbuz1_derefidx_vbuzz=vbuaa.asm new file mode 100644 index 000000000..3a2c942bc --- /dev/null +++ b/src/main/fragment/csg65ce02-common/pbuz1_derefidx_vbuzz=vbuaa.asm @@ -0,0 +1 @@ +sta ({z1}),z diff --git a/src/main/fragment/csg65ce02-common/vboaa=pbuz1_derefidx_vbuzz_eq_vbuaa.asm b/src/main/fragment/csg65ce02-common/vboaa=pbuz1_derefidx_vbuzz_eq_vbuaa.asm new file mode 100644 index 000000000..d229c3d21 --- /dev/null +++ b/src/main/fragment/csg65ce02-common/vboaa=pbuz1_derefidx_vbuzz_eq_vbuaa.asm @@ -0,0 +1,5 @@ +eor ({z1}),z +beq !+ +lda #1 +!: +eor #1 diff --git a/src/main/fragment/csg65ce02-common/vbsaa=vbsaa_plus_pbsz1_derefidx_vbuzz.asm b/src/main/fragment/csg65ce02-common/vbsaa=vbsaa_plus_pbsz1_derefidx_vbuzz.asm new file mode 100644 index 000000000..3edcf833d --- /dev/null +++ b/src/main/fragment/csg65ce02-common/vbsaa=vbsaa_plus_pbsz1_derefidx_vbuzz.asm @@ -0,0 +1,2 @@ +clc +adc ({z1}),z \ No newline at end of file diff --git a/src/main/fragment/csg65ce02-common/vbuaa=pbuz1_derefidx_vbuzz.asm b/src/main/fragment/csg65ce02-common/vbuaa=pbuz1_derefidx_vbuzz.asm new file mode 100644 index 000000000..95a0c5b57 --- /dev/null +++ b/src/main/fragment/csg65ce02-common/vbuaa=pbuz1_derefidx_vbuzz.asm @@ -0,0 +1 @@ +lda ({z1}),z diff --git a/src/main/fragment/csg65ce02-common/vbuaa=pbuz1_derefidx_vbuzz_minus_vbuaa.asm b/src/main/fragment/csg65ce02-common/vbuaa=pbuz1_derefidx_vbuzz_minus_vbuaa.asm new file mode 100644 index 000000000..cf1b570fa --- /dev/null +++ b/src/main/fragment/csg65ce02-common/vbuaa=pbuz1_derefidx_vbuzz_minus_vbuaa.asm @@ -0,0 +1,3 @@ +eor #$ff +sec +adc ({z1}),z diff --git a/src/main/fragment/csg65ce02-common/vbuaa=pbuz1_derefidx_vbuzz_minus_vbuc1.asm b/src/main/fragment/csg65ce02-common/vbuaa=pbuz1_derefidx_vbuzz_minus_vbuc1.asm new file mode 100644 index 000000000..1a8a6d208 --- /dev/null +++ b/src/main/fragment/csg65ce02-common/vbuaa=pbuz1_derefidx_vbuzz_minus_vbuc1.asm @@ -0,0 +1,3 @@ +sec +lda ({z1}),z +sbc #{c1} \ No newline at end of file diff --git a/src/main/fragment/csg65ce02-common/vbuaa=pbuz1_derefidx_vbuzz_minus_vbum2.asm b/src/main/fragment/csg65ce02-common/vbuaa=pbuz1_derefidx_vbuzz_minus_vbum2.asm new file mode 100644 index 000000000..391148650 --- /dev/null +++ b/src/main/fragment/csg65ce02-common/vbuaa=pbuz1_derefidx_vbuzz_minus_vbum2.asm @@ -0,0 +1,3 @@ +sec +lda ({z1}),z +sbc {m2} \ No newline at end of file diff --git a/src/main/fragment/csg65ce02-common/vbuaa=vbuaa_band_pbuz1_derefidx_vbuzz.asm b/src/main/fragment/csg65ce02-common/vbuaa=vbuaa_band_pbuz1_derefidx_vbuzz.asm new file mode 100644 index 000000000..85f32f5cf --- /dev/null +++ b/src/main/fragment/csg65ce02-common/vbuaa=vbuaa_band_pbuz1_derefidx_vbuzz.asm @@ -0,0 +1 @@ +and ({z1}),z \ No newline at end of file diff --git a/src/main/fragment/csg65ce02-common/vbuaa=vbuaa_bor_pbuz1_derefidx_vbuzz.asm b/src/main/fragment/csg65ce02-common/vbuaa=vbuaa_bor_pbuz1_derefidx_vbuzz.asm new file mode 100644 index 000000000..348f5d067 --- /dev/null +++ b/src/main/fragment/csg65ce02-common/vbuaa=vbuaa_bor_pbuz1_derefidx_vbuzz.asm @@ -0,0 +1 @@ +ora ({z1}),z \ No newline at end of file diff --git a/src/main/fragment/csg65ce02-common/vbuaa=vbuaa_bxor_pbuz1_derefidx_vbuzz.asm b/src/main/fragment/csg65ce02-common/vbuaa=vbuaa_bxor_pbuz1_derefidx_vbuzz.asm new file mode 100644 index 000000000..991563f7b --- /dev/null +++ b/src/main/fragment/csg65ce02-common/vbuaa=vbuaa_bxor_pbuz1_derefidx_vbuzz.asm @@ -0,0 +1 @@ +eor ({z1}),z diff --git a/src/main/fragment/csg65ce02-common/vbuaa=vbuaa_plus_pbuz1_derefidx_vbuzz.asm b/src/main/fragment/csg65ce02-common/vbuaa=vbuaa_plus_pbuz1_derefidx_vbuzz.asm new file mode 100644 index 000000000..3edcf833d --- /dev/null +++ b/src/main/fragment/csg65ce02-common/vbuaa=vbuaa_plus_pbuz1_derefidx_vbuzz.asm @@ -0,0 +1,2 @@ +clc +adc ({z1}),z \ No newline at end of file diff --git a/src/main/fragment/csg65ce02-common/vbuaa_eq_pbuz1_derefidx_vbuzz_then_la1.asm b/src/main/fragment/csg65ce02-common/vbuaa_eq_pbuz1_derefidx_vbuzz_then_la1.asm new file mode 100644 index 000000000..990af0f0f --- /dev/null +++ b/src/main/fragment/csg65ce02-common/vbuaa_eq_pbuz1_derefidx_vbuzz_then_la1.asm @@ -0,0 +1,2 @@ +cmp ({z1}),z +beq {la1} \ No newline at end of file diff --git a/src/main/fragment/csg65ce02-common/vdum1=_word_pbuz2_derefidx_vbuzz.asm b/src/main/fragment/csg65ce02-common/vdum1=_word_pbuz2_derefidx_vbuzz.asm new file mode 100644 index 000000000..d30250c95 --- /dev/null +++ b/src/main/fragment/csg65ce02-common/vdum1=_word_pbuz2_derefidx_vbuzz.asm @@ -0,0 +1,6 @@ +lda ({z2}),z +sta {m1} +lda #0 +sta {m1}+1 +sta {m1}+2 +sta {m1}+3 diff --git a/src/main/fragment/csg65ce02-common/vwsm1=_sword_pbsz2_derefidx_vbuzz.asm b/src/main/fragment/csg65ce02-common/vwsm1=_sword_pbsz2_derefidx_vbuzz.asm new file mode 100644 index 000000000..2a87a38e3 --- /dev/null +++ b/src/main/fragment/csg65ce02-common/vwsm1=_sword_pbsz2_derefidx_vbuzz.asm @@ -0,0 +1,4 @@ +lda ({z2}),z +sta {m1} +lda #0 +sta {m1}+1 diff --git a/src/main/fragment/csg65ce02-common/vwsm1=vwsm1_plus_pbuz2_derefidx_vbuzz.asm b/src/main/fragment/csg65ce02-common/vwsm1=vwsm1_plus_pbuz2_derefidx_vbuzz.asm new file mode 100644 index 000000000..826341f7a --- /dev/null +++ b/src/main/fragment/csg65ce02-common/vwsm1=vwsm1_plus_pbuz2_derefidx_vbuzz.asm @@ -0,0 +1,7 @@ +clc +lda {m1} +adc ({z2}),z +sta {m1} +bcc !+ +inc {m1}+1 +!: \ No newline at end of file diff --git a/src/main/fragment/csg65ce02-common/vwsm1=vwsm2_plus_pbuz3_derefidx_vbuzz.asm b/src/main/fragment/csg65ce02-common/vwsm1=vwsm2_plus_pbuz3_derefidx_vbuzz.asm new file mode 100644 index 000000000..4cfb5fa80 --- /dev/null +++ b/src/main/fragment/csg65ce02-common/vwsm1=vwsm2_plus_pbuz3_derefidx_vbuzz.asm @@ -0,0 +1,7 @@ +clc +lda {m2} +adc ({z3}),z +sta {m1} +bcc !+ +inc {m2}+1 +!: \ No newline at end of file diff --git a/src/main/fragment/csg65ce02-common/vwum1=_word_pbuz2_derefidx_vbuzz.asm b/src/main/fragment/csg65ce02-common/vwum1=_word_pbuz2_derefidx_vbuzz.asm new file mode 100644 index 000000000..2a87a38e3 --- /dev/null +++ b/src/main/fragment/csg65ce02-common/vwum1=_word_pbuz2_derefidx_vbuzz.asm @@ -0,0 +1,4 @@ +lda ({z2}),z +sta {m1} +lda #0 +sta {m1}+1 diff --git a/src/main/fragment/csg65ce02-common/vwum1=pbuz2_derefidx_vbuzz_rol_1.asm b/src/main/fragment/csg65ce02-common/vwum1=pbuz2_derefidx_vbuzz_rol_1.asm new file mode 100644 index 000000000..0b6970a63 --- /dev/null +++ b/src/main/fragment/csg65ce02-common/vwum1=pbuz2_derefidx_vbuzz_rol_1.asm @@ -0,0 +1,6 @@ +lda ({z2}),z +asl +sta {m1} +lda #0 +rol +sta {m1}+1 diff --git a/src/main/fragment/mos6502-common/pbuz1_derefidx_vbuyy=vbuaa.asm b/src/main/fragment/mos6502-common/pbuz1_derefidx_vbuyy=vbuaa.asm index e482c7be7..f28a9ddf0 100644 --- a/src/main/fragment/mos6502-common/pbuz1_derefidx_vbuyy=vbuaa.asm +++ b/src/main/fragment/mos6502-common/pbuz1_derefidx_vbuyy=vbuaa.asm @@ -1 +1 @@ -sta ({z1}),y +sta ({z1}),y \ No newline at end of file diff --git a/src/main/fragment/mos6502-common/vwum1=_word_pbuz2_derefidx_vbuyy.asm b/src/main/fragment/mos6502-common/vwum1=_word_pbuz2_derefidx_vbuyy.asm index 142b4bea8..32701d255 100644 --- a/src/main/fragment/mos6502-common/vwum1=_word_pbuz2_derefidx_vbuyy.asm +++ b/src/main/fragment/mos6502-common/vwum1=_word_pbuz2_derefidx_vbuyy.asm @@ -1,5 +1,4 @@ lda ({z2}),y sta {m1} -iny lda #0 sta {m1}+1 diff --git a/src/main/java/dk/camelot64/kickc/fragment/AsmFragmentSystemHash.java b/src/main/java/dk/camelot64/kickc/fragment/AsmFragmentSystemHash.java index c0468841d..b29c87cd7 100644 --- a/src/main/java/dk/camelot64/kickc/fragment/AsmFragmentSystemHash.java +++ b/src/main/java/dk/camelot64/kickc/fragment/AsmFragmentSystemHash.java @@ -84,8 +84,8 @@ public class AsmFragmentSystemHash { } } } - // Also hash in all synthesis rules - for(AsmFragmentTemplateSynthesisRule synthesisRule : AsmFragmentTemplateSynthesisRule.getSynthesisRules()) { + // Also hash in all synthesis rules for all CPU's + for(AsmFragmentTemplateSynthesisRule synthesisRule : AsmFragmentTemplateSynthesisRule.getAllSynthesisRules()) { hashCRLF += synthesisRule.hashCode(); hashLF += synthesisRule.hashCode(); } diff --git a/src/main/java/dk/camelot64/kickc/fragment/AsmFragmentTemplateSynthesisRule.java b/src/main/java/dk/camelot64/kickc/fragment/AsmFragmentTemplateSynthesisRule.java index cbd31b866..a5e10d7bc 100644 --- a/src/main/java/dk/camelot64/kickc/fragment/AsmFragmentTemplateSynthesisRule.java +++ b/src/main/java/dk/camelot64/kickc/fragment/AsmFragmentTemplateSynthesisRule.java @@ -1,5 +1,7 @@ package dk.camelot64.kickc.fragment; +import dk.camelot64.kickc.model.TargetCpu; + import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -182,17 +184,26 @@ class AsmFragmentTemplateSynthesisRule { return Objects.hash(sigMatch, sigAvoid, asmPrefix, sigReplace, asmPostfix, bindMappings, mapSignature, subDontClobber); } - /** All the synthesize rules available. */ - private static List fragmentSyntheses; + /** All the synthesize rules available for each CPU. */ + private static Map> fragmentSyntheses = new LinkedHashMap<>(); - static List getSynthesisRules() { - if(fragmentSyntheses == null) { - fragmentSyntheses = initFragmentSyntheses(); + static List getSynthesisRules(TargetCpu targetCpu) { + if(fragmentSyntheses.get(targetCpu) == null) { + fragmentSyntheses.put(targetCpu, initFragmentSyntheses(targetCpu)); } - return fragmentSyntheses; + return fragmentSyntheses.get(targetCpu); } - private static List initFragmentSyntheses() { + static Collection getAllSynthesisRules() { + final LinkedHashSet allRules = new LinkedHashSet<>(); + for(TargetCpu targetCpu : TargetCpu.values()) { + allRules.addAll(getSynthesisRules(targetCpu)); + } + return allRules; + } + + + private static List initFragmentSyntheses(TargetCpu targetCpu) { // Z1 is replaced by something non-ZP - all above are moved down Map mapZM1 = new LinkedHashMap<>(); mapZM1.put("z2", "z1"); @@ -731,6 +742,9 @@ class AsmFragmentTemplateSynthesisRule { synths.add(new AsmFragmentTemplateSynthesisRule("(.*)_deref_pb(.)c3(.*)", rvalYy+"|"+lvalDerefC3, "ldy {c3}", "$1vb$2yy$3", null, null)); // Rewrite (Z1),y to AA synths.add(new AsmFragmentTemplateSynthesisRule("(.*)pb(.)z1_derefidx_vbuyy(.*)_then_(.*)", twoZM1+"|"+rvalAa, "lda ({z1}),y\n" , "$1vb$2aa$3_then_$4", null, mapZM1)); + if(targetCpu.getCpu65xx().hasRegisterZ()) + // Rewrite (Z1),z to AA + synths.add(new AsmFragmentTemplateSynthesisRule("(.*)pb(.)z1_derefidx_vbuzz(.*)_then_(.*)", twoZM1+"|"+rvalAa, "lda ({z1}),z\n" , "$1vb$2aa$3_then_$4", null, mapZM1)); // Rewrite left-size C1,y to use AA and a STA C1,y synths.add(new AsmFragmentTemplateSynthesisRule("pb(.)c1_derefidx_vbuyy=(.*)", null, null, "vb$1aa=$2", "sta {c1},y", null, "yy")); @@ -738,6 +752,9 @@ class AsmFragmentTemplateSynthesisRule { synths.add(new AsmFragmentTemplateSynthesisRule("pb(.)c1_derefidx_vbuyy=(.*)", null, "sty $ff\n" , "vb$1aa=$2", "ldy $ff\nsta {c1},y", null)); // Rewrite (Z1),y to save and reload YY from $FF synths.add(new AsmFragmentTemplateSynthesisRule("pb(.)z1_derefidx_vbuyy=(.*)", twoZM1, "sty $ff\n" , "vb$1aa=$2", "ldy $ff\nsta ({z1}),y", mapZM1)); + if(targetCpu.getCpu65xx().hasRegisterZ()) + // Rewrite (Z1),z to save and reload ZZ from $FF + synths.add(new AsmFragmentTemplateSynthesisRule("pb(.)z1_derefidx_vbuzz=(.*)", twoZM1, "stz $ff\n" , "vb$1aa=$2", "ldz $ff\nsta ({z1}),z", mapZM1)); // Rewrite left-size C1,x to use AA and a STA C1,x synths.add(new AsmFragmentTemplateSynthesisRule("pb(.)c1_derefidx_vbuxx=(.*)", null, null, "vb$1aa=$2", "sta {c1},x", null, "xx")); @@ -745,11 +762,27 @@ class AsmFragmentTemplateSynthesisRule { synths.add(new AsmFragmentTemplateSynthesisRule("pb(.)c1_derefidx_vbuxx=(.*)", null, "stx $ff\n" , "vb$1aa=$2", "ldx $ff\nsta {c1},x", null)); // Rewrite (Z1),x to save Y to $FF and reload it into YY synths.add(new AsmFragmentTemplateSynthesisRule("pb(.)z1_derefidx_vbuxx=(.*)", twoZM1, "stx $ff" , "vb$1aa=$2", "ldy $ff\nsta ({z1}),y", mapZM1)); + if(targetCpu.getCpu65xx().hasRegisterZ()) + // Rewrite (Z1),x to save Y to $FF and reload it into YY + synths.add(new AsmFragmentTemplateSynthesisRule("pb(.)z1_derefidx_vbuxx=(.*)", twoZM1, "stx $ff" , "vb$1aa=$2", "ldz $ff\nsta ({z1}),z", mapZM1)); + + // TODO: Rewrite (Z1),y assignment to use A + //synths.add(new AsmFragmentTemplateSynthesisRule("pb(.)z1_derefidx_vbuyy=(.*)", twoZM1+"|"+rvalYy, null , "vb$1aa=$2", "sta ({z1}),y", null, "yy")); + //if(targetCpu.getCpu65xx().hasRegisterZ()) + // Rewrite (Z1),z assignment to use A + // synths.add(new AsmFragmentTemplateSynthesisRule("pb(.)z1_derefidx_vbuzz=(.*)", twoZM1+"|"+rvalZz, null , "vb$1aa=$2", "sta ({z1}),z", null, "zz")); // Rewrite (Z1),a to use TAY prefix synths.add(new AsmFragmentTemplateSynthesisRule("pb(.)z1_derefidx_vbuaa=(.*)", twoZM1+"|"+rvalYy, "tay" , "vb$1aa=$2", "sta ({z1}),y", mapZM1, "yy")); + if(targetCpu.getCpu65xx().hasRegisterZ()) + // Rewrite (Z1),a to use TAZ prefix + synths.add(new AsmFragmentTemplateSynthesisRule("pb(.)z1_derefidx_vbuaa=(.*)", twoZM1+"|"+rvalZz, "taz" , "vb$1aa=$2", "sta ({z1}),z", mapZM1, "zz")); + // Rewrite (Z1),a to save A to $FF and reload it into YY synths.add(new AsmFragmentTemplateSynthesisRule("pb(.)z1_derefidx_vbuaa=(.*)", twoZM1, "sta $ff" , "vb$1aa=$2", "ldy $ff\nsta ({z1}),y", mapZM1)); + if(targetCpu.getCpu65xx().hasRegisterZ()) + // Rewrite (Z1),a to save A to $FF and reload it into ZZ + synths.add(new AsmFragmentTemplateSynthesisRule("pb(.)z1_derefidx_vbuaa=(.*)", twoZM1, "sta $ff" , "vb$1aa=$2", "ldz $ff\nsta ({z1}),z", mapZM1)); // Synthesize typed pointer math using void pointers synths.add(new AsmFragmentTemplateSynthesisRule("(.*)p[^v][^o]([czm][1-9])(.*)", null, null, "$1pvo$2$3", null, null)); @@ -790,8 +823,17 @@ class AsmFragmentTemplateSynthesisRule { // Rewrite trailing right-size (Z1),y to use AA synths.add(new AsmFragmentTemplateSynthesisRule("(.*)=(.*)pb(.)z1_derefidx_vbuyy", twoZM1+"|"+rvalAa, "lda ({z1}),y", "$1=$2vb$3aa", null, mapZM1, null)); + if(targetCpu.getCpu65xx().hasRegisterZ()) + // Rewrite trailing right-size (Z1),z to use AA + synths.add(new AsmFragmentTemplateSynthesisRule("(.*)=(.*)pb(.)z1_derefidx_vbuzz", twoZM1+"|"+rvalAa, "lda ({z1}),z", "$1=$2vb$3aa", null, mapZM1, null)); + + // Rewrite trailing right-size (Z1),y to use AA - when 2 Z1 synths.add(new AsmFragmentTemplateSynthesisRule("(.*)z1(.*)pb(.)z1_derefidx_vbuyy", rvalAa, "lda ({z1}),y", "$1z1$2vb$3aa", null, null, null)); + if(targetCpu.getCpu65xx().hasRegisterZ()) + // Rewrite trailing right-size (Z1),z to use AA - when 2 Z1 + synths.add(new AsmFragmentTemplateSynthesisRule("(.*)z1(.*)pb(.)z1_derefidx_vbuzz", rvalAa, "lda ({z1}),z", "$1z1$2vb$3aa", null, null, null)); + // TODO: New fragment synth rule creates non-optimal ASM https://gitlab.com/camelot/kickc/-/issues/494 // Rewrite trailing right-size (Z2),y to use AA // synths.add(new AsmFragmentTemplateSynthesisRule("(.*)=(.*)pb(.)z2_derefidx_vbuyy", twoZM2+"|"+rvalAa, "lda ({z2}),y", "$1=$2vb$3aa", null, mapZM2, null)); @@ -807,11 +849,15 @@ class AsmFragmentTemplateSynthesisRule { // Rewrite multiple _derefidx_vbuc1 to use YY synths.add(new AsmFragmentTemplateSynthesisRule("(.*)_derefidx_vbuc1(.*)_derefidx_vbuc1(.*)", rvalYy+"|"+ threeC1, "ldy #{c1}", "$1_derefidx_vbuyy$2_derefidx_vbuyy$3", null, mapC1)); - + if(targetCpu.getCpu65xx().hasRegisterZ()) + // Rewrite multiple _derefidx_vbuc1 to use ZZ + synths.add(new AsmFragmentTemplateSynthesisRule("(.*)_derefidx_vbuc1(.*)_derefidx_vbuc1(.*)", rvalZz+"|"+ threeC1, "ldz #{c1}", "$1_derefidx_vbuzz$2_derefidx_vbuzz$3", null, mapC1)); synths.add(new AsmFragmentTemplateSynthesisRule("pb(.)c1_derefidx_vbum1=(.*)", twoZM1+"|"+twoC1, null, "vb$1aa=$2", "ldx {m1}\n" + "sta {c1},x", mapZM1C1)); - synths.add(new AsmFragmentTemplateSynthesisRule("pb(.)z1_derefidx_vbum2=(.*)", twoZM1+"|"+twoZM2, null, "vb$1aa=$2", "ldy {m2}\n" + "sta ({z1}),y", mapZM12)); synths.add(new AsmFragmentTemplateSynthesisRule("pb(.)c1_derefidx_vbum1=(.*c1.*)", twoZM1, null, "vb$1aa=$2", "ldx {m1}\n" + "sta {c1},x", mapZM1)); synths.add(new AsmFragmentTemplateSynthesisRule("pb(.)c1_derefidx_vbum1=(.*[mz]1.*)", twoC1, null, "vb$1aa=$2", "ldx {m1}\n" + "sta {c1},x", mapC1)); + synths.add(new AsmFragmentTemplateSynthesisRule("pb(.)z1_derefidx_vbum2=(.*)", twoZM1+"|"+twoZM2, null, "vb$1aa=$2", "ldy {m2}\n" + "sta ({z1}),y", mapZM12)); + if(targetCpu.getCpu65xx().hasRegisterZ()) + synths.add(new AsmFragmentTemplateSynthesisRule("pb(.)z1_derefidx_vbum2=(.*)", twoZM1+"|"+twoZM2, null, "vb$1aa=$2", "ldz {m2}\n" + "sta ({z1}),z", mapZM12)); // Convert X/Y-based array indexing of a constant pointer into A-register by prefixing lda cn,x / lda cn,y ( ...pb.c1_derefidx_vbuxx... / ...pb.c1_derefidx_vbuyy... -> ...vb.aa... ) @@ -839,6 +885,8 @@ class AsmFragmentTemplateSynthesisRule { synths.add(new AsmFragmentTemplateSynthesisRule("(.*)\\(([vp][bwd][us][mzcaxy][123456axyz])\\)(.*)", null, null, "$1$2$3", null, null)); synths.add(new AsmFragmentTemplateSynthesisRule("(.*)_derefidx_vbuz1_(.*)", rvalYy+"|"+twoZM1, "ldy {z1}", "$1_derefidx_vbuyy_$2", null, mapZM1)); + if(targetCpu.getCpu65xx().hasRegisterZ()) + synths.add(new AsmFragmentTemplateSynthesisRule("(.*)_derefidx_vbuz1_(.*)", rvalZz+"|"+twoZM1, "ldz {z1}", "$1_derefidx_vbuzz_$2", null, mapZM1)); synths.add(new AsmFragmentTemplateSynthesisRule("(.*)_derefidx_vbuz1_(lt|gt|le|ge|eq|neq)_(.*)", rvalXx+"|"+twoZM1, "ldx {z1}", "$1_derefidx_vbuxx_$2_$3", null, mapZM1)); synths.add(new AsmFragmentTemplateSynthesisRule("pb(.)c1_derefidx_vbuyy_(lt|gt|le|ge|eq|neq)_(.*)", rvalAa+"|"+twoC1, "lda {c1},y", "vb$1aa_$2_$3", null, mapC1)); synths.add(new AsmFragmentTemplateSynthesisRule("pb(.)c1_derefidx_vbuyy_(lt|gt|le|ge|eq|neq)_(.*c1.*)", rvalAa, "lda {c1},y", "vb$1aa_$2_$3", null, null)); diff --git a/src/main/java/dk/camelot64/kickc/fragment/AsmFragmentTemplateSynthesizer.java b/src/main/java/dk/camelot64/kickc/fragment/AsmFragmentTemplateSynthesizer.java index a631fbe09..9913accac 100644 --- a/src/main/java/dk/camelot64/kickc/fragment/AsmFragmentTemplateSynthesizer.java +++ b/src/main/java/dk/camelot64/kickc/fragment/AsmFragmentTemplateSynthesizer.java @@ -406,7 +406,7 @@ public class AsmFragmentTemplateSynthesizer { } } // Populate with synthesis options - for(AsmFragmentTemplateSynthesisRule rule : AsmFragmentTemplateSynthesisRule.getSynthesisRules()) { + for(AsmFragmentTemplateSynthesisRule rule : AsmFragmentTemplateSynthesisRule.getSynthesisRules(targetCpu)) { if(rule.matches(signature)) { AsmFragmentSynthesisOption synthesisOption = new AsmFragmentSynthesisOption(signature, rule); synthesis.addSynthesisOption(synthesisOption); diff --git a/src/main/java/dk/camelot64/kickc/fragment/AsmFragmentTemplateUsages.java b/src/main/java/dk/camelot64/kickc/fragment/AsmFragmentTemplateUsages.java index 70c516672..0188ea06f 100644 --- a/src/main/java/dk/camelot64/kickc/fragment/AsmFragmentTemplateUsages.java +++ b/src/main/java/dk/camelot64/kickc/fragment/AsmFragmentTemplateUsages.java @@ -1,6 +1,7 @@ package dk.camelot64.kickc.fragment; import dk.camelot64.kickc.CompileLog; +import dk.camelot64.kickc.model.TargetCpu; import java.io.File; import java.util.*; @@ -114,19 +115,18 @@ public class AsmFragmentTemplateUsages { if(logUnusedRules) { log.append("\nUNUSED ASM FRAGMENT SYNTHESIS RULE ANALYSIS (if found consider removing them)"); - Set rules = - new LinkedHashSet<>(AsmFragmentTemplateSynthesisRule.getSynthesisRules()); + final Collection allRules = AsmFragmentTemplateSynthesisRule.getAllSynthesisRules(); for(String signature : signatures) { Collection templates = synthesizer.getBestTemplates(signature, log); for(AsmFragmentTemplate template : templates) { while(template.getSynthesis()!=null) { - rules.remove(template.getSynthesis()); + allRules.remove(template.getSynthesis()); template = template.getSubFragment(); } } } - for(AsmFragmentTemplateSynthesisRule rule : rules) { + for(AsmFragmentTemplateSynthesisRule rule : allRules) { log.append("Synthesis Rule Unused: - match:" + rule.sigMatch+ " avoid:"+rule.sigAvoid+" replace:"+rule.sigReplace); } } diff --git a/src/test/ref/cpu-65ce02-eightqueens.asm b/src/test/ref/cpu-65ce02-eightqueens.asm index e1efbdf60..9c74d3336 100644 --- a/src/test/ref/cpu-65ce02-eightqueens.asm +++ b/src/test/ref/cpu-65ce02-eightqueens.asm @@ -98,10 +98,10 @@ clrscr: { sta.z line_text lda #>DEFAULT_SCREEN sta.z line_text+1 - ldz #0 + ldx #0 __b1: // for( char l=0;lDEFAULT_SCREEN sta.z line_text+1 - // [26] phi (byte) clrscr::l#2 = (byte) 0 [phi:clrscr->clrscr::@1#2] -- vbuzz=vbuc1 - ldz #0 + // [26] phi (byte) clrscr::l#2 = (byte) 0 [phi:clrscr->clrscr::@1#2] -- vbuxx=vbuc1 + ldx #0 jmp __b1 // clrscr::@1 __b1: - // [27] if((byte) clrscr::l#2<(byte) $19) goto clrscr::@3 -- vbuzz_lt_vbuc1_then_la1 - cpz #$19 + // [27] if((byte) clrscr::l#2<(byte) $19) goto clrscr::@3 -- vbuxx_lt_vbuc1_then_la1 + cpx #$19 bcc __b3_from___b1 jmp __b2 // clrscr::@2 @@ -9965,13 +9963,13 @@ clrscr: { rts // [33] phi from clrscr::@1 to clrscr::@3 [phi:clrscr::@1->clrscr::@3] __b3_from___b1: - // [33] phi (byte) clrscr::c#2 = (byte) 0 [phi:clrscr::@1->clrscr::@3#0] -- vbuyy=vbuc1 - ldy #0 + // [33] phi (byte) clrscr::c#2 = (byte) 0 [phi:clrscr::@1->clrscr::@3#0] -- vbuzz=vbuc1 + ldz #0 jmp __b3 // clrscr::@3 __b3: - // [34] if((byte) clrscr::c#2<(byte) $28) goto clrscr::@4 -- vbuyy_lt_vbuc1_then_la1 - cpy #$28 + // [34] if((byte) clrscr::c#2<(byte) $28) goto clrscr::@4 -- vbuzz_lt_vbuc1_then_la1 + cpz #$28 bcc __b4 jmp __b5 // clrscr::@5 @@ -9992,8 +9990,8 @@ clrscr: { bcc !+ inc.z line_cols+1 !: - // [37] (byte) clrscr::l#1 ← ++ (byte) clrscr::l#2 -- vbuzz=_inc_vbuzz - inz + // [37] (byte) clrscr::l#1 ← ++ (byte) clrscr::l#2 -- vbuxx=_inc_vbuxx + inx // [26] phi from clrscr::@5 to clrscr::@1 [phi:clrscr::@5->clrscr::@1] __b1_from___b5: // [26] phi (byte*) clrscr::line_cols#5 = (byte*) clrscr::line_cols#1 [phi:clrscr::@5->clrscr::@1#0] -- register_copy @@ -10002,14 +10000,14 @@ clrscr: { jmp __b1 // clrscr::@4 __b4: - // [38] *((byte*) clrscr::line_text#5 + (byte) clrscr::c#2) ← (byte) ' ' -- pbuz1_derefidx_vbuyy=vbuc1 + // [38] *((byte*) clrscr::line_text#5 + (byte) clrscr::c#2) ← (byte) ' ' -- pbuz1_derefidx_vbuzz=vbuc1 lda #' ' - sta (line_text),y - // [39] *((byte*) clrscr::line_cols#5 + (byte) clrscr::c#2) ← (const nomodify byte) LIGHT_BLUE -- pbuz1_derefidx_vbuyy=vbuc1 + sta.z (line_text),z + // [39] *((byte*) clrscr::line_cols#5 + (byte) clrscr::c#2) ← (const nomodify byte) LIGHT_BLUE -- pbuz1_derefidx_vbuzz=vbuc1 lda #LIGHT_BLUE - sta (line_cols),y - // [40] (byte) clrscr::c#1 ← ++ (byte) clrscr::c#2 -- vbuyy=_inc_vbuyy - iny + sta.z (line_cols),z + // [40] (byte) clrscr::c#1 ← ++ (byte) clrscr::c#2 -- vbuzz=_inc_vbuzz + inz // [33] phi from clrscr::@4 to clrscr::@3 [phi:clrscr::@4->clrscr::@3] __b3_from___b4: // [33] phi (byte) clrscr::c#2 = (byte) clrscr::c#1 [phi:clrscr::@4->clrscr::@3#0] -- register_copy @@ -12432,11 +12430,11 @@ FINAL SYMBOL TABLE (label) clrscr::@5 (label) clrscr::@return (byte) clrscr::c -(byte) clrscr::c#1 reg byte y 20002.0 -(byte) clrscr::c#2 reg byte y 12501.25 +(byte) clrscr::c#1 reg byte z 20002.0 +(byte) clrscr::c#2 reg byte z 12501.25 (byte) clrscr::l -(byte) clrscr::l#1 reg byte z 2002.0 -(byte) clrscr::l#2 reg byte z 333.6666666666667 +(byte) clrscr::l#1 reg byte x 2002.0 +(byte) clrscr::l#2 reg byte x 333.6666666666667 (byte*) clrscr::line_cols (byte*) clrscr::line_cols#1 line_cols zp[2]:20 1001.0 (byte*) clrscr::line_cols#5 line_cols zp[2]:20 1500.375 @@ -12934,8 +12932,8 @@ solutions: " (word) utoa_append::value#1 value zp[2]:20 2.0000002E7 (word) utoa_append::value#2 value zp[2]:20 5018334.166666666 -reg byte z [ clrscr::l#2 clrscr::l#1 ] -reg byte y [ clrscr::c#2 clrscr::c#1 ] +reg byte x [ clrscr::l#2 clrscr::l#1 ] +reg byte z [ clrscr::c#2 clrscr::c#1 ] zp[1]:2 [ queens::row#10 queens::row#1 queens::row#2 legal::row#0 ] zp[4]:3 [ count#10 count#2 printf_ulong::uvalue#2 printf_ulong::uvalue#0 printf_ulong::uvalue#1 ] reg byte a [ cputc::c#3 cputc::c#0 cputc::c#2 cputc::c#1 ] @@ -12994,7 +12992,7 @@ mem[12] [ printf_buffer ] FINAL ASSEMBLER -Score: 1297408 +Score: 1297118 // File Comments // N Queens Problem in C Using Backtracking @@ -13153,13 +13151,13 @@ clrscr: { sta.z line_text lda #>DEFAULT_SCREEN sta.z line_text+1 - // [26] phi (byte) clrscr::l#2 = (byte) 0 [phi:clrscr->clrscr::@1#2] -- vbuzz=vbuc1 - ldz #0 + // [26] phi (byte) clrscr::l#2 = (byte) 0 [phi:clrscr->clrscr::@1#2] -- vbuxx=vbuc1 + ldx #0 // clrscr::@1 __b1: // for( char l=0;lclrscr::@3] __b2: - // [33] phi (byte) clrscr::c#2 = (byte) 0 [phi:clrscr::@1->clrscr::@3#0] -- vbuyy=vbuc1 - ldy #0 + // [33] phi (byte) clrscr::c#2 = (byte) 0 [phi:clrscr::@1->clrscr::@3#0] -- vbuzz=vbuc1 + ldz #0 // clrscr::@3 __b3: // for( char c=0;cclrscr::@1] // [26] phi (byte*) clrscr::line_cols#5 = (byte*) clrscr::line_cols#1 [phi:clrscr::@5->clrscr::@1#0] -- register_copy // [26] phi (byte*) clrscr::line_text#5 = (byte*) clrscr::line_text#1 [phi:clrscr::@5->clrscr::@1#1] -- register_copy @@ -13225,16 +13223,16 @@ clrscr: { // clrscr::@4 __b4: // line_text[c] = ' ' - // [38] *((byte*) clrscr::line_text#5 + (byte) clrscr::c#2) ← (byte) ' ' -- pbuz1_derefidx_vbuyy=vbuc1 + // [38] *((byte*) clrscr::line_text#5 + (byte) clrscr::c#2) ← (byte) ' ' -- pbuz1_derefidx_vbuzz=vbuc1 lda #' ' - sta (line_text),y + sta.z (line_text),z // line_cols[c] = conio_textcolor - // [39] *((byte*) clrscr::line_cols#5 + (byte) clrscr::c#2) ← (const nomodify byte) LIGHT_BLUE -- pbuz1_derefidx_vbuyy=vbuc1 + // [39] *((byte*) clrscr::line_cols#5 + (byte) clrscr::c#2) ← (const nomodify byte) LIGHT_BLUE -- pbuz1_derefidx_vbuzz=vbuc1 lda #LIGHT_BLUE - sta (line_cols),y + sta.z (line_cols),z // for( char c=0;cclrscr::@3] // [33] phi (byte) clrscr::c#2 = (byte) clrscr::c#1 [phi:clrscr::@4->clrscr::@3#0] -- register_copy jmp __b3 diff --git a/src/test/ref/cpu-65ce02-eightqueens.sym b/src/test/ref/cpu-65ce02-eightqueens.sym index 4e98a079c..a83f7ad5b 100644 --- a/src/test/ref/cpu-65ce02-eightqueens.sym +++ b/src/test/ref/cpu-65ce02-eightqueens.sym @@ -108,11 +108,11 @@ (label) clrscr::@5 (label) clrscr::@return (byte) clrscr::c -(byte) clrscr::c#1 reg byte y 20002.0 -(byte) clrscr::c#2 reg byte y 12501.25 +(byte) clrscr::c#1 reg byte z 20002.0 +(byte) clrscr::c#2 reg byte z 12501.25 (byte) clrscr::l -(byte) clrscr::l#1 reg byte z 2002.0 -(byte) clrscr::l#2 reg byte z 333.6666666666667 +(byte) clrscr::l#1 reg byte x 2002.0 +(byte) clrscr::l#2 reg byte x 333.6666666666667 (byte*) clrscr::line_cols (byte*) clrscr::line_cols#1 line_cols zp[2]:20 1001.0 (byte*) clrscr::line_cols#5 line_cols zp[2]:20 1500.375 @@ -610,8 +610,8 @@ solutions: " (word) utoa_append::value#1 value zp[2]:20 2.0000002E7 (word) utoa_append::value#2 value zp[2]:20 5018334.166666666 -reg byte z [ clrscr::l#2 clrscr::l#1 ] -reg byte y [ clrscr::c#2 clrscr::c#1 ] +reg byte x [ clrscr::l#2 clrscr::l#1 ] +reg byte z [ clrscr::c#2 clrscr::c#1 ] zp[1]:2 [ queens::row#10 queens::row#1 queens::row#2 legal::row#0 ] zp[4]:3 [ count#10 count#2 printf_ulong::uvalue#2 printf_ulong::uvalue#0 printf_ulong::uvalue#1 ] reg byte a [ cputc::c#3 cputc::c#0 cputc::c#2 cputc::c#1 ]