diff --git a/src/main/fragment/cache/fragment-cache-mos6502.asm b/src/main/fragment/cache/fragment-cache-mos6502.asm index 06affc4ac..4c9f4b840 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 160b015f22 +//KICKC FRAGMENT CACHE 15c5116a3c //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 9c251b42d..7ea3ae9be 100644 --- a/src/main/fragment/cache/fragment-cache-mos6502x.asm +++ b/src/main/fragment/cache/fragment-cache-mos6502x.asm @@ -1,34 +1,7 @@ -//KICKC FRAGMENT CACHE 160b015f22 +//KICKC FRAGMENT CACHE 15c5116a3c //FRAGMENT vbuz1=vbuc1 lda #{c1} sta {z1} -//FRAGMENT pbuc1_derefidx_vbuz1=_inc_pbuc1_derefidx_vbuz1 -ldx {z1} -inc {c1},x -//FRAGMENT vbuz1=_inc_vbuz1 -inc {z1} -//FRAGMENT pbuc1_derefidx_vbuaa=_inc_pbuc1_derefidx_vbuaa -tax -inc {c1},x -//FRAGMENT pbuc1_derefidx_vbuxx=_inc_pbuc1_derefidx_vbuxx -inc {c1},x -//FRAGMENT vbuaa=vbuc1 -lda #{c1} -//FRAGMENT vbuaa=_inc_vbuaa -clc -adc #1 -//FRAGMENT vbuxx=vbuc1 -ldx #{c1} -//FRAGMENT vbuxx=_inc_vbuxx -inx -//FRAGMENT vbuyy=vbuc1 -ldy #{c1} -//FRAGMENT pbuc1_derefidx_vbuyy=_inc_pbuc1_derefidx_vbuyy -tya -tax -inc {c1},x -//FRAGMENT vbuyy=_inc_vbuyy -iny //FRAGMENT pbuz1=pbuc1 lda #<{c1} sta {z1} @@ -70,6 +43,8 @@ lda {z2} sta {z1} lda {z2}+1 sta {z1}+1 +//FRAGMENT vbuz1=_inc_vbuz1 +inc {z1} //FRAGMENT vbuz1_neq_vbuc1_then_la1 lda #{c1} cmp {z1} @@ -278,6 +253,12 @@ tay txa and #{c1} tay +//FRAGMENT vbuaa=vbuc1 +lda #{c1} +//FRAGMENT vbuxx=vbuc1 +ldx #{c1} +//FRAGMENT vbuyy=vbuc1 +ldy #{c1} //FRAGMENT vbuaa=pbuc1_derefidx_vbuxx lda {c1},x //FRAGMENT vbuaa=pbuc1_derefidx_vbuyy @@ -1297,6 +1278,10 @@ ldy {z1}+1 //FRAGMENT vbuyy=vbuaa_band_vbuc1 and #{c1} tay +//FRAGMENT vbuxx=_inc_vbuxx +inx +//FRAGMENT vbuyy=_inc_vbuyy +iny //FRAGMENT vbuyy_neq_vbuc1_then_la1 cpy #{c1} bne {la1} @@ -1614,6 +1599,9 @@ sta {c1},x //FRAGMENT vbuaa_neq_vbuc1_then_la1 cmp #{c1} bne {la1} +//FRAGMENT vbuaa=_inc_vbuaa +clc +adc #1 //FRAGMENT _deref_pbuc1=_deref_pbuc1_bor_vbuc2 lda #{c2} ora {c1} @@ -8018,6 +8006,9 @@ ldy {z1} lda {c1},y cmp #{c2} beq {la1} +//FRAGMENT pbuc1_derefidx_vbuz1=_inc_pbuc1_derefidx_vbuz1 +ldx {z1} +inc {c1},x //FRAGMENT pbuc1_derefidx_vbuaa_eq_vbuc2_then_la1 tay lda {c1},y @@ -8031,6 +8022,12 @@ beq {la1} lda {c1},y cmp #{c2} beq {la1} +//FRAGMENT pbuc1_derefidx_vbuxx=_inc_pbuc1_derefidx_vbuxx +inc {c1},x +//FRAGMENT pbuc1_derefidx_vbuyy=_inc_pbuc1_derefidx_vbuyy +tya +tax +inc {c1},x //FRAGMENT vduz1=vduc1_plus_vbuz2 lda {z2} clc @@ -13794,6 +13791,9 @@ lda {z1} sta {c1} lda {z1}+1 sta {c1}+1 +//FRAGMENT pbuc1_derefidx_vbuaa=_inc_pbuc1_derefidx_vbuaa +tax +inc {c1},x //FRAGMENT vbuaa=vbuaa_bor_vbuc1 ora #{c1} //FRAGMENT vbuz1=_deref_pbuz2_rol_1 @@ -15339,65 +15339,6 @@ sta {m1} bcc !+ inc {m1}+1 !: -//FRAGMENT vwsz1=vwsz1_plus_vbsz2 -lda {z2} -sta $fe -ora #$7f -bmi !+ -lda #0 -!: -sta $ff -clc -lda {z1} -adc $fe -sta {z1} -lda {z1}+1 -adc $ff -sta {z1}+1 -//FRAGMENT vwsz1=vwsz1_plus_vbsaa -sta $fe -ora #$7f -bmi !+ -lda #0 -!: -sta $ff -clc -lda {z1} -adc $fe -sta {z1} -lda {z1}+1 -adc $ff -sta {z1}+1 -//FRAGMENT vwsz1=vwsz1_plus_vbsxx -txa -sta $fe -ora #$7f -bmi !+ -lda #0 -!: -sta $ff -clc -lda {z1} -adc $fe -sta {z1} -lda {z1}+1 -adc $ff -sta {z1}+1 -//FRAGMENT vwsz1=vwsz1_plus_vbsyy -tya -sta $fe -ora #$7f -bmi !+ -lda #0 -!: -sta $ff -clc -lda {z1} -adc $fe -sta {z1} -lda {z1}+1 -adc $ff -sta {z1}+1 //FRAGMENT pbuz1=pbuc1_sethi_vbuz2 lda {z2} sta {z1}+1 @@ -15591,92 +15532,6 @@ lda ({z1}),y sta {z1}+1 pla sta {z1} -//FRAGMENT _deref_pbuz1_eq__deref_pbuz2_then_la1 -ldy #0 -lda ({z1}),y -ldy #0 -cmp ({z2}),y -beq {la1} -//FRAGMENT vbsz1_le_0_then_la1 -lda {z1} -cmp #1 -bmi {la1} -//FRAGMENT vwsz1=vwsz1_minus_vbsz2 -lda {z2} -sta $fe -ora #$7f -bmi !+ -lda #0 -!: -sta $ff -sec -lda {z1} -sbc $fe -sta {z1} -lda {z1}+1 -sbc $ff -sta {z1}+1 -//FRAGMENT vbsaa_le_0_then_la1 -cmp #1 -bmi {la1} -//FRAGMENT vbsaa_neq_vbsz1_then_la1 -cmp {z1} -bne {la1} -//FRAGMENT vwsz1=vwsz1_minus_vbsxx -txa -sta $fe -ora #$7f -bmi !+ -lda #0 -!: -sta $ff -sec -lda {z1} -sbc $fe -sta {z1} -lda {z1}+1 -sbc $ff -sta {z1}+1 -//FRAGMENT vwsz1=vwsz1_minus_vbsyy -tya -sta $fe -ora #$7f -bmi !+ -lda #0 -!: -sta $ff -sec -lda {z1} -sbc $fe -sta {z1} -lda {z1}+1 -sbc $ff -sta {z1}+1 -//FRAGMENT vbsyy_neq_vbsc1_then_la1 -cpy #{c1} -bne {la1} -//FRAGMENT vbsxx_le_0_then_la1 -cpx #1 -bmi {la1} -//FRAGMENT vbsyy_neq_vbsz1_then_la1 -cpy {z1} -bne {la1} -//FRAGMENT vbsyy=_dec_vbsyy -dey -//FRAGMENT vbsyy_neq_vbsxx_then_la1 -stx $ff -cpy $ff -bne {la1} -//FRAGMENT vbsyy_le_0_then_la1 -cpy #1 -bmi {la1} -//FRAGMENT vbsz1_neq_vbsyy_then_la1 -cpy {z1} -bne {la1} -//FRAGMENT vbsxx_neq_vbsyy_then_la1 -stx $ff -cpy $ff -bne {la1} //FRAGMENT vbuc1_neq_vwuz1_then_la1 NO_SYNTHESIS //FRAGMENT vbsc1_neq_vwuz1_then_la1 @@ -16605,24 +16460,6 @@ sty $ff ldy #0 lda ($fe),y sta {c1} -//FRAGMENT vbuz1=_hi_pvoz2 -lda {z2}+1 -sta {z1} -//FRAGMENT vbuz1=_lo_pvoz2 -lda {z2} -sta {z1} -//FRAGMENT vbuaa=_hi_pvoz1 -lda {z1}+1 -//FRAGMENT vbuxx=_hi_pvoz1 -ldx {z1}+1 -//FRAGMENT vbuaa=_lo_pvoz1 -lda {z1} -//FRAGMENT vbuxx=_lo_pvoz1 -ldx {z1} -//FRAGMENT vbuyy=_hi_pvoz1 -ldy {z1}+1 -//FRAGMENT vbuyy=_lo_pvoz1 -ldy {z1} //FRAGMENT _deref_pwsz1=vwsc1 ldy #0 lda #<{c1} @@ -17098,6 +16935,9 @@ bvc !+ eor #$80 !: bmi {la1} +//FRAGMENT vbsyy_neq_vbsc1_then_la1 +cpy #{c1} +bne {la1} //FRAGMENT vwsz1=vbsz2_plus_vwsc1 lda {z2} tax @@ -17630,32 +17470,6 @@ adc ({z1}),y sta {z1}+1 pla sta {z1} -//FRAGMENT vwuz1=vwuz2_rol_5 -lda {z2} -asl -sta {z1} -lda {z2}+1 -rol -sta {z1}+1 -asl {z1} -rol {z1}+1 -asl {z1} -rol {z1}+1 -asl {z1} -rol {z1}+1 -asl {z1} -rol {z1}+1 -//FRAGMENT vwuz1=vwuz1_rol_5 -asl {z1} -rol {z1}+1 -asl {z1} -rol {z1}+1 -asl {z1} -rol {z1}+1 -asl {z1} -rol {z1}+1 -asl {z1} -rol {z1}+1 //FRAGMENT vbuz1=_byte_pwuc1_derefidx_vbuz2 ldy {z2} lda {c1},y diff --git a/src/main/fragment/mos6502-common/vwsm1=vwsm2_plus_vbsaa.asm b/src/main/fragment/mos6502-common/vwsm1=vwsm2_plus_vbsaa.asm index aa4d1b3d4..368e78207 100644 --- a/src/main/fragment/mos6502-common/vwsm1=vwsm2_plus_vbsaa.asm +++ b/src/main/fragment/mos6502-common/vwsm1=vwsm2_plus_vbsaa.asm @@ -1,13 +1,11 @@ -sta $fe +pha +clc +adc {m2} +sta {m1} +pla ora #$7f bmi !+ lda #0 !: -sta $ff -clc -lda {m2} -adc $fe -sta {m1} -lda {m2}+1 -adc $ff -sta {m1}+1 \ No newline at end of file +adc {m2}+1 +sta {m1}+1 diff --git a/src/main/fragment/mos6502-common/vwum1=vwum1_plus_vbsaa.asm b/src/main/fragment/mos6502-common/vwum1=vwum1_plus_vbsaa.asm index c4e5140d5..97b31b973 100644 --- a/src/main/fragment/mos6502-common/vwum1=vwum1_plus_vbsaa.asm +++ b/src/main/fragment/mos6502-common/vwum1=vwum1_plus_vbsaa.asm @@ -1,13 +1,11 @@ -sta $fe +pha +clc +adc {m1} +sta {m1} +pla ora #$7f bmi !+ lda #0 !: -sta $ff -clc -lda {m1} -adc $fe -sta {m1} -lda {m1}+1 -adc $ff +adc {m1}+1 sta {m1}+1 \ No newline at end of file diff --git a/src/main/fragment/mos6502-common/vwum1=vwum2_plus_vbsaa.asm b/src/main/fragment/mos6502-common/vwum1=vwum2_plus_vbsaa.asm new file mode 100644 index 000000000..0cd2b57e0 --- /dev/null +++ b/src/main/fragment/mos6502-common/vwum1=vwum2_plus_vbsaa.asm @@ -0,0 +1,11 @@ +pha +clc +adc {m2} +sta {m1} +pla +ora #$7f +bmi !+ +lda #0 +!: +adc {m2}+1 +sta {m1}+1 \ No newline at end of file diff --git a/src/test/ref/examples/nes-conio/nes-conio.asm b/src/test/ref/examples/nes-conio/nes-conio.asm index f028118c3..69c2e54df 100644 --- a/src/test/ref/examples/nes-conio/nes-conio.asm +++ b/src/test/ref/examples/nes-conio/nes-conio.asm @@ -409,8 +409,8 @@ readJoy1: { jmp __b1 } // Transfer a number of bytes from the CPU memory to the PPU memory -// - cpuData : Pointer to the CPU memory (RAM of ROM) // - ppuData : Pointer in the PPU memory +// - cpuData : Pointer to the CPU memory (RAM of ROM) // - size : The number of bytes to transfer // ppuDataTransfer(void* zp($b) ppuData, void* zp($d) cpuData, word zp($1b) size) ppuDataTransfer: { @@ -892,8 +892,8 @@ cscroll: { jmp __b1 } // Transfer a number of bytes from the PPU memory to the CPU memory -// - ppuData : Pointer in the PPU memory // - cpuData : Pointer to the CPU memory (RAM of ROM) +// - ppuData : Pointer in the PPU memory // - size : The number of bytes to transfer // ppuDataFetch(void* zp($1b) ppuData) ppuDataFetch: { diff --git a/src/test/ref/examples/nes-conio/nes-conio.log b/src/test/ref/examples/nes-conio/nes-conio.log index e807168d2..641e9f110 100644 --- a/src/test/ref/examples/nes-conio/nes-conio.log +++ b/src/test/ref/examples/nes-conio/nes-conio.log @@ -4779,8 +4779,8 @@ readJoy1: { } // ppuDataTransfer // Transfer a number of bytes from the CPU memory to the PPU memory -// - cpuData : Pointer to the CPU memory (RAM of ROM) // - ppuData : Pointer in the PPU memory +// - cpuData : Pointer to the CPU memory (RAM of ROM) // - size : The number of bytes to transfer // ppuDataTransfer(void* zp(8) ppuData, void* zp($a) cpuData, word zp($c) size) ppuDataTransfer: { @@ -5647,8 +5647,8 @@ cscroll: { } // ppuDataFetch // Transfer a number of bytes from the PPU memory to the CPU memory -// - ppuData : Pointer in the PPU memory // - cpuData : Pointer to the CPU memory (RAM of ROM) +// - ppuData : Pointer in the PPU memory // - size : The number of bytes to transfer // ppuDataFetch(void* zp($5b) ppuData) ppuDataFetch: { @@ -6806,8 +6806,8 @@ readJoy1: { } // ppuDataTransfer // Transfer a number of bytes from the CPU memory to the PPU memory -// - cpuData : Pointer to the CPU memory (RAM of ROM) // - ppuData : Pointer in the PPU memory +// - cpuData : Pointer to the CPU memory (RAM of ROM) // - size : The number of bytes to transfer // ppuDataTransfer(void* zp($b) ppuData, void* zp($d) cpuData, word zp($1b) size) ppuDataTransfer: { @@ -7582,8 +7582,8 @@ cscroll: { } // ppuDataFetch // Transfer a number of bytes from the PPU memory to the CPU memory -// - ppuData : Pointer in the PPU memory // - cpuData : Pointer to the CPU memory (RAM of ROM) +// - ppuData : Pointer in the PPU memory // - size : The number of bytes to transfer // ppuDataFetch(void* zp($1b) ppuData) ppuDataFetch: { @@ -9063,8 +9063,8 @@ readJoy1: { } // ppuDataTransfer // Transfer a number of bytes from the CPU memory to the PPU memory -// - cpuData : Pointer to the CPU memory (RAM of ROM) // - ppuData : Pointer in the PPU memory +// - cpuData : Pointer to the CPU memory (RAM of ROM) // - size : The number of bytes to transfer // ppuDataTransfer(void* zp($b) ppuData, void* zp($d) cpuData, word zp($1b) size) ppuDataTransfer: { @@ -9803,8 +9803,8 @@ cscroll: { } // ppuDataFetch // Transfer a number of bytes from the PPU memory to the CPU memory -// - ppuData : Pointer in the PPU memory // - cpuData : Pointer to the CPU memory (RAM of ROM) +// - ppuData : Pointer in the PPU memory // - size : The number of bytes to transfer // ppuDataFetch(void* zp($1b) ppuData) ppuDataFetch: { diff --git a/src/test/ref/examples/nes-demo/nes-demo.asm b/src/test/ref/examples/nes-demo/nes-demo.asm index 3b5019ccd..74fb8b500 100644 --- a/src/test/ref/examples/nes-demo/nes-demo.asm +++ b/src/test/ref/examples/nes-demo/nes-demo.asm @@ -351,8 +351,8 @@ readJoy1: { jmp __b1 } // Transfer a number of bytes from the CPU memory to the PPU memory -// - cpuData : Pointer to the CPU memory (RAM of ROM) // - ppuData : Pointer in the PPU memory +// - cpuData : Pointer to the CPU memory (RAM of ROM) // - size : The number of bytes to transfer ppuDataTransfer: { .const size = $20*SIZEOF_BYTE diff --git a/src/test/ref/examples/nes-demo/nes-demo.log b/src/test/ref/examples/nes-demo/nes-demo.log index e54b07b33..78c25ef25 100644 --- a/src/test/ref/examples/nes-demo/nes-demo.log +++ b/src/test/ref/examples/nes-demo/nes-demo.log @@ -2993,8 +2993,8 @@ readJoy1: { } // ppuDataTransfer // Transfer a number of bytes from the CPU memory to the PPU memory -// - cpuData : Pointer to the CPU memory (RAM of ROM) // - ppuData : Pointer in the PPU memory +// - cpuData : Pointer to the CPU memory (RAM of ROM) // - size : The number of bytes to transfer ppuDataTransfer: { .const size = $20*SIZEOF_BYTE @@ -4046,8 +4046,8 @@ readJoy1: { } // ppuDataTransfer // Transfer a number of bytes from the CPU memory to the PPU memory -// - cpuData : Pointer to the CPU memory (RAM of ROM) // - ppuData : Pointer in the PPU memory +// - cpuData : Pointer to the CPU memory (RAM of ROM) // - size : The number of bytes to transfer ppuDataTransfer: { .const size = $20*SIZEOF_BYTE @@ -5275,8 +5275,8 @@ readJoy1: { } // ppuDataTransfer // Transfer a number of bytes from the CPU memory to the PPU memory -// - cpuData : Pointer to the CPU memory (RAM of ROM) // - ppuData : Pointer in the PPU memory +// - cpuData : Pointer to the CPU memory (RAM of ROM) // - size : The number of bytes to transfer ppuDataTransfer: { .const size = $20*SIZEOF_BYTE diff --git a/src/test/ref/examples/nes-dxycp/nes-dxycp.asm b/src/test/ref/examples/nes-dxycp/nes-dxycp.asm index c5d01f585..5228e049c 100644 --- a/src/test/ref/examples/nes-dxycp/nes-dxycp.asm +++ b/src/test/ref/examples/nes-dxycp/nes-dxycp.asm @@ -392,8 +392,8 @@ readJoy1: { jmp __b1 } // Transfer a number of bytes from the CPU memory to the PPU memory -// - cpuData : Pointer to the CPU memory (RAM of ROM) // - ppuData : Pointer in the PPU memory +// - cpuData : Pointer to the CPU memory (RAM of ROM) // - size : The number of bytes to transfer ppuDataTransfer: { .const size = $20*SIZEOF_BYTE diff --git a/src/test/ref/examples/nes-dxycp/nes-dxycp.log b/src/test/ref/examples/nes-dxycp/nes-dxycp.log index 865f23345..819d58acc 100644 --- a/src/test/ref/examples/nes-dxycp/nes-dxycp.log +++ b/src/test/ref/examples/nes-dxycp/nes-dxycp.log @@ -2658,8 +2658,8 @@ readJoy1: { } // ppuDataTransfer // Transfer a number of bytes from the CPU memory to the PPU memory -// - cpuData : Pointer to the CPU memory (RAM of ROM) // - ppuData : Pointer in the PPU memory +// - cpuData : Pointer to the CPU memory (RAM of ROM) // - size : The number of bytes to transfer ppuDataTransfer: { .const size = $20*SIZEOF_BYTE @@ -3665,8 +3665,8 @@ readJoy1: { } // ppuDataTransfer // Transfer a number of bytes from the CPU memory to the PPU memory -// - cpuData : Pointer to the CPU memory (RAM of ROM) // - ppuData : Pointer in the PPU memory +// - cpuData : Pointer to the CPU memory (RAM of ROM) // - size : The number of bytes to transfer ppuDataTransfer: { .const size = $20*SIZEOF_BYTE @@ -4797,8 +4797,8 @@ readJoy1: { } // ppuDataTransfer // Transfer a number of bytes from the CPU memory to the PPU memory -// - cpuData : Pointer to the CPU memory (RAM of ROM) // - ppuData : Pointer in the PPU memory +// - cpuData : Pointer to the CPU memory (RAM of ROM) // - size : The number of bytes to transfer ppuDataTransfer: { .const size = $20*SIZEOF_BYTE diff --git a/src/test/ref/noop-cast-elimination.asm b/src/test/ref/noop-cast-elimination.asm index c5d9958e5..1a54de9a3 100644 --- a/src/test/ref/noop-cast-elimination.asm +++ b/src/test/ref/noop-cast-elimination.asm @@ -13,18 +13,16 @@ main: { __b1: // sw += (signed byte)i txa - sta.z $fe + pha + clc + adc.z sw + sta.z sw + pla ora #$7f bmi !+ lda #0 !: - sta.z $ff - clc - lda.z sw - adc.z $fe - sta.z sw - lda.z sw+1 - adc.z $ff + adc.z sw+1 sta.z sw+1 // screen[i] = sw txa diff --git a/src/test/ref/noop-cast-elimination.log b/src/test/ref/noop-cast-elimination.log index 311017050..b731b7f13 100644 --- a/src/test/ref/noop-cast-elimination.log +++ b/src/test/ref/noop-cast-elimination.log @@ -171,18 +171,16 @@ main: { __b1: // [2] (signed word) main::sw#1 ← (signed word) main::sw#2 + (signed byte)(byte) main::i#2 -- vwsz1=vwsz1_plus_vbsz2 lda.z i - sta.z $fe + pha + clc + adc.z sw + sta.z sw + pla ora #$7f bmi !+ lda #0 !: - sta.z $ff - clc - lda.z sw - adc.z $fe - sta.z sw - lda.z sw+1 - adc.z $ff + adc.z sw+1 sta.z sw+1 // [3] (byte~) main::$1 ← (byte) main::i#2 << (byte) 1 -- vbuz1=vbuz2_rol_1 lda.z i @@ -224,8 +222,8 @@ REGISTER UPLIFT SCOPES Uplift Scope [main] 28.6: zp[2]:3 [ main::sw#2 main::sw#1 ] 24.75: zp[1]:2 [ main::i#2 main::i#1 ] 22: zp[1]:5 [ main::$1 ] Uplift Scope [] -Uplifting [main] best 846 combination zp[2]:3 [ main::sw#2 main::sw#1 ] reg byte x [ main::i#2 main::i#1 ] reg byte a [ main::$1 ] -Uplifting [] best 846 combination +Uplifting [main] best 796 combination zp[2]:3 [ main::sw#2 main::sw#1 ] reg byte x [ main::i#2 main::i#1 ] reg byte a [ main::$1 ] +Uplifting [] best 796 combination Allocated (was zp[2]:3) zp[2]:2 [ main::sw#2 main::sw#1 ] ASSEMBLER BEFORE OPTIMIZATION @@ -259,18 +257,16 @@ main: { __b1: // [2] (signed word) main::sw#1 ← (signed word) main::sw#2 + (signed byte)(byte) main::i#2 -- vwsz1=vwsz1_plus_vbsxx txa - sta.z $fe + pha + clc + adc.z sw + sta.z sw + pla ora #$7f bmi !+ lda #0 !: - sta.z $ff - clc - lda.z sw - adc.z $fe - sta.z sw - lda.z sw+1 - adc.z $ff + adc.z sw+1 sta.z sw+1 // [3] (byte~) main::$1 ← (byte) main::i#2 << (byte) 1 -- vbuaa=vbuxx_rol_1 txa @@ -326,7 +322,7 @@ reg byte a [ main::$1 ] FINAL ASSEMBLER -Score: 756 +Score: 706 // File Comments // Test elimination of noop-casts (signed byte to byte) @@ -355,18 +351,16 @@ main: { // sw += (signed byte)i // [2] (signed word) main::sw#1 ← (signed word) main::sw#2 + (signed byte)(byte) main::i#2 -- vwsz1=vwsz1_plus_vbsxx txa - sta.z $fe + pha + clc + adc.z sw + sta.z sw + pla ora #$7f bmi !+ lda #0 !: - sta.z $ff - clc - lda.z sw - adc.z $fe - sta.z sw - lda.z sw+1 - adc.z $ff + adc.z sw+1 sta.z sw+1 // screen[i] = sw // [3] (byte~) main::$1 ← (byte) main::i#2 << (byte) 1 -- vbuaa=vbuxx_rol_1 diff --git a/src/test/ref/test-multiply-8bit.asm b/src/test/ref/test-multiply-8bit.asm index a7b215f88..7958aaad4 100644 --- a/src/test/ref/test-multiply-8bit.asm +++ b/src/test/ref/test-multiply-8bit.asm @@ -792,18 +792,16 @@ muls8s: { __b4: // m = m + b txa - sta.z $fe + pha + clc + adc.z m + sta.z m + pla ora #$7f bmi !+ lda #0 !: - sta.z $ff - clc - lda.z m - adc.z $fe - sta.z m - lda.z m+1 - adc.z $ff + adc.z m+1 sta.z m+1 // for(signed byte j = 0; j!=a; j++) iny diff --git a/src/test/ref/test-multiply-8bit.log b/src/test/ref/test-multiply-8bit.log index 66f1cb605..18515263c 100644 --- a/src/test/ref/test-multiply-8bit.log +++ b/src/test/ref/test-multiply-8bit.log @@ -6827,18 +6827,16 @@ muls8s: { __b4: // [231] (signed word) muls8s::m#1 ← (signed word) muls8s::m#3 + (signed byte) muls8s::b#0 -- vwsz1=vwsz1_plus_vbsz2 lda.z b - sta.z $fe + pha + clc + adc.z m + sta.z m + pla ora #$7f bmi !+ lda #0 !: - sta.z $ff - clc - lda.z m - adc.z $fe - sta.z m - lda.z m+1 - adc.z $ff + adc.z m+1 sta.z m+1 // [232] (signed byte) muls8s::j#1 ← ++ (signed byte) muls8s::j#2 -- vbsz1=_inc_vbsz1 inc.z j @@ -7919,65 +7917,65 @@ Uplift Scope [print_cls] Uplift Scope [main] Uplift Scope [mulf_init_asm] -Uplifting [mul8u] best 322945 combination zp[2]:39 [ mul8u::res#2 mul8u::res#6 mul8u::res#1 ] zp[2]:41 [ mul8u::mb#2 mul8u::mb#0 mul8u::mb#1 ] reg byte a [ mul8u::$1 ] reg byte x [ mul8u::a#3 mul8u::a#6 mul8u::a#1 mul8u::a#2 mul8u::a#0 ] reg byte a [ mul8u::b#2 mul8u::b#0 mul8u::b#1 ] zp[2]:119 [ mul8u::return#2 ] zp[2]:75 [ mul8u::return#3 ] -Uplifting [muls8s] best 302645 combination zp[2]:44 [ muls8s::return#0 muls8s::m#3 muls8s::m#1 muls8s::m#5 muls8s::m#2 ] reg byte y [ muls8s::j#2 muls8s::j#1 ] reg byte y [ muls8s::i#2 muls8s::i#1 ] reg byte x [ muls8s::b#0 ] zp[1]:87 [ muls8s::a#0 ] zp[2]:89 [ muls8s::return#2 ] -Uplifting [muls8u] best 292345 combination reg byte y [ muls8u::i#2 muls8u::i#1 ] zp[2]:35 [ muls8u::return#0 muls8u::m#3 muls8u::m#1 ] reg byte x [ muls8u::b#0 ] zp[1]:63 [ muls8u::a#0 ] zp[2]:65 [ muls8u::return#2 ] -Uplifting [mulf8u_prepared] best 292336 combination reg byte a [ mulf8u_prepared::b#2 mulf8u_prepared::b#1 mulf8u_prepared::b#0 ] zp[2]:127 [ mulf8u_prepared::return#0 ] zp[2]:129 [ mulf8u_prepared::return#3 ] zp[2]:111 [ mulf8u_prepared::return#2 ] -Uplifting [print_char] best 292285 combination reg byte a [ print_char::ch#7 print_char::ch#0 print_char::ch#5 print_char::ch#6 ] -Uplifting [mulf8s_prepared] best 292261 combination zp[2]:55 [ mulf8s_prepared::m#4 mulf8s_prepared::m#5 mulf8s_prepared::m#1 mulf8s_prepared::m#0 mulf8s_prepared::m#2 ] reg byte a [ mulf8s_prepared::$6 ] reg byte a [ mulf8s_prepared::$11 ] reg byte a [ mulf8s_prepared::$9 ] reg byte a [ mulf8s_prepared::$12 ] zp[1]:116 [ mulf8s_prepared::b#0 ] +Uplifting [mul8u] best 317945 combination zp[2]:39 [ mul8u::res#2 mul8u::res#6 mul8u::res#1 ] zp[2]:41 [ mul8u::mb#2 mul8u::mb#0 mul8u::mb#1 ] reg byte a [ mul8u::$1 ] reg byte x [ mul8u::a#3 mul8u::a#6 mul8u::a#1 mul8u::a#2 mul8u::a#0 ] reg byte a [ mul8u::b#2 mul8u::b#0 mul8u::b#1 ] zp[2]:119 [ mul8u::return#2 ] zp[2]:75 [ mul8u::return#3 ] +Uplifting [muls8s] best 297645 combination zp[2]:44 [ muls8s::return#0 muls8s::m#3 muls8s::m#1 muls8s::m#5 muls8s::m#2 ] reg byte y [ muls8s::j#2 muls8s::j#1 ] reg byte y [ muls8s::i#2 muls8s::i#1 ] reg byte x [ muls8s::b#0 ] zp[1]:87 [ muls8s::a#0 ] zp[2]:89 [ muls8s::return#2 ] +Uplifting [muls8u] best 287345 combination reg byte y [ muls8u::i#2 muls8u::i#1 ] zp[2]:35 [ muls8u::return#0 muls8u::m#3 muls8u::m#1 ] reg byte x [ muls8u::b#0 ] zp[1]:63 [ muls8u::a#0 ] zp[2]:65 [ muls8u::return#2 ] +Uplifting [mulf8u_prepared] best 287336 combination reg byte a [ mulf8u_prepared::b#2 mulf8u_prepared::b#1 mulf8u_prepared::b#0 ] zp[2]:127 [ mulf8u_prepared::return#0 ] zp[2]:129 [ mulf8u_prepared::return#3 ] zp[2]:111 [ mulf8u_prepared::return#2 ] +Uplifting [print_char] best 287285 combination reg byte a [ print_char::ch#7 print_char::ch#0 print_char::ch#5 print_char::ch#6 ] +Uplifting [mulf8s_prepared] best 287261 combination zp[2]:55 [ mulf8s_prepared::m#4 mulf8s_prepared::m#5 mulf8s_prepared::m#1 mulf8s_prepared::m#0 mulf8s_prepared::m#2 ] reg byte a [ mulf8s_prepared::$6 ] reg byte a [ mulf8s_prepared::$11 ] reg byte a [ mulf8s_prepared::$9 ] reg byte a [ mulf8s_prepared::$12 ] zp[1]:116 [ mulf8s_prepared::b#0 ] Limited combination testing to 100 combinations of 512 possible. -Uplifting [] best 292261 combination zp[2]:50 [ print_char_cursor#87 print_char_cursor#145 print_char_cursor#138 print_char_cursor#1 print_char_cursor#158 print_char_cursor#192 print_char_cursor#193 print_char_cursor#101 print_char_cursor#18 print_char_cursor#231 print_char_cursor#146 ] zp[2]:30 [ print_line_cursor#24 print_line_cursor#47 print_line_cursor#10 print_line_cursor#0 ] -Uplifting [print_uchar] best 292234 combination reg byte a [ print_uchar::$0 ] reg byte x [ print_uchar::$2 ] reg byte x [ print_uchar::b#5 print_uchar::b#3 print_uchar::b#4 print_uchar::b#0 print_uchar::b#1 print_uchar::b#2 ] -Uplifting [mulf8u_prepare] best 292225 combination reg byte a [ mulf8u_prepare::a#2 mulf8u_prepare::a#1 mulf8u_prepare::a#0 ] -Uplifting [mul8s] best 292201 combination zp[2]:47 [ mul8s::m#4 mul8s::m#5 mul8s::m#1 mul8s::m#0 mul8s::m#2 ] reg byte a [ mul8s::$6 ] reg byte a [ mul8s::$11 ] reg byte a [ mul8s::$9 ] reg byte a [ mul8s::$12 ] zp[1]:100 [ mul8s::b#0 ] zp[1]:99 [ mul8s::a#0 ] +Uplifting [] best 287261 combination zp[2]:50 [ print_char_cursor#87 print_char_cursor#145 print_char_cursor#138 print_char_cursor#1 print_char_cursor#158 print_char_cursor#192 print_char_cursor#193 print_char_cursor#101 print_char_cursor#18 print_char_cursor#231 print_char_cursor#146 ] zp[2]:30 [ print_line_cursor#24 print_line_cursor#47 print_line_cursor#10 print_line_cursor#0 ] +Uplifting [print_uchar] best 287234 combination reg byte a [ print_uchar::$0 ] reg byte x [ print_uchar::$2 ] reg byte x [ print_uchar::b#5 print_uchar::b#3 print_uchar::b#4 print_uchar::b#0 print_uchar::b#1 print_uchar::b#2 ] +Uplifting [mulf8u_prepare] best 287225 combination reg byte a [ mulf8u_prepare::a#2 mulf8u_prepare::a#1 mulf8u_prepare::a#0 ] +Uplifting [mul8s] best 287201 combination zp[2]:47 [ mul8s::m#4 mul8s::m#5 mul8s::m#1 mul8s::m#0 mul8s::m#2 ] reg byte a [ mul8s::$6 ] reg byte a [ mul8s::$11 ] reg byte a [ mul8s::$9 ] reg byte a [ mul8s::$12 ] zp[1]:100 [ mul8s::b#0 ] zp[1]:99 [ mul8s::a#0 ] Limited combination testing to 100 combinations of 2304 possible. -Uplifting [print_str] best 292201 combination zp[2]:28 [ print_str::str#16 print_str::str#19 print_str::str#0 ] -Uplifting [mulf8u] best 291597 combination reg byte a [ mulf8u::a#0 ] reg byte x [ mulf8u::b#0 ] zp[2]:113 [ mulf8u::return#0 ] zp[2]:71 [ mulf8u::return#2 ] -Uplifting [print_uint] best 291597 combination zp[2]:32 [ print_uint::w#6 print_uint::w#3 print_uint::w#4 print_uint::w#5 print_uint::w#2 print_uint::w#1 print_uint::w#0 ] -Uplifting [mulf8s] best 290991 combination zp[2]:117 [ mulf8s::return#0 ] reg byte x [ mulf8s::b#0 ] zp[2]:95 [ mulf8s::return#2 ] reg byte a [ mulf8s::a#0 ] -Uplifting [mul8s_compare] best 289791 combination reg byte x [ mul8s_compare::ok#3 mul8s_compare::ok#4 ] zp[1]:24 [ mul8s_compare::b#10 mul8s_compare::b#1 ] zp[1]:23 [ mul8s_compare::a#10 mul8s_compare::a#1 ] zp[2]:101 [ mul8s_compare::mn#0 ] zp[2]:91 [ mul8s_compare::ms#0 ] zp[2]:97 [ mul8s_compare::mf#0 ] -Uplifting [print_sint] best 289791 combination zp[2]:58 [ print_sint::w#6 print_sint::w#0 print_sint::w#4 print_sint::w#1 print_sint::w#2 print_sint::w#3 ] -Uplifting [print_schar] best 289779 combination reg byte x [ print_schar::b#5 print_schar::b#0 print_schar::b#3 print_schar::b#1 print_schar::b#2 ] -Uplifting [mul8u_compare] best 288579 combination reg byte x [ mul8u_compare::ok#3 mul8u_compare::ok#4 ] zp[1]:21 [ mul8u_compare::b#10 mul8u_compare::b#1 ] zp[1]:20 [ mul8u_compare::a#7 mul8u_compare::a#1 ] zp[2]:77 [ mul8u_compare::mn#0 ] zp[2]:67 [ mul8u_compare::ms#0 ] zp[2]:73 [ mul8u_compare::mf#0 ] -Uplifting [memset] best 288579 combination zp[2]:26 [ memset::dst#2 memset::dst#1 ] -Uplifting [mulf_init] best 288329 combination zp[2]:14 [ mulf_init::sqr#3 mulf_init::sqr#4 mulf_init::sqr#1 mulf_init::sqr#2 ] zp[2]:8 [ mulf_init::sqr2_lo#2 mulf_init::sqr2_lo#1 ] zp[2]:2 [ mulf_init::sqr1_lo#2 mulf_init::sqr1_lo#1 ] reg byte x [ mulf_init::x_2#3 mulf_init::x_2#2 mulf_init::x_2#1 ] reg byte a [ mulf_init::$1 ] reg byte a [ mulf_init::$4 ] reg byte a [ mulf_init::$5 ] zp[1]:10 [ mulf_init::x_255#2 mulf_init::x_255#1 ] zp[1]:13 [ mulf_init::dir#2 mulf_init::dir#4 ] zp[1]:4 [ mulf_init::c#2 mulf_init::c#1 ] zp[2]:11 [ mulf_init::sqr2_hi#2 mulf_init::sqr2_hi#1 ] zp[2]:5 [ mulf_init::sqr1_hi#2 mulf_init::sqr1_hi#1 ] +Uplifting [print_str] best 287201 combination zp[2]:28 [ print_str::str#16 print_str::str#19 print_str::str#0 ] +Uplifting [mulf8u] best 286597 combination reg byte a [ mulf8u::a#0 ] reg byte x [ mulf8u::b#0 ] zp[2]:113 [ mulf8u::return#0 ] zp[2]:71 [ mulf8u::return#2 ] +Uplifting [print_uint] best 286597 combination zp[2]:32 [ print_uint::w#6 print_uint::w#3 print_uint::w#4 print_uint::w#5 print_uint::w#2 print_uint::w#1 print_uint::w#0 ] +Uplifting [mulf8s] best 285991 combination zp[2]:117 [ mulf8s::return#0 ] reg byte x [ mulf8s::b#0 ] zp[2]:95 [ mulf8s::return#2 ] reg byte a [ mulf8s::a#0 ] +Uplifting [mul8s_compare] best 284791 combination reg byte x [ mul8s_compare::ok#3 mul8s_compare::ok#4 ] zp[1]:24 [ mul8s_compare::b#10 mul8s_compare::b#1 ] zp[1]:23 [ mul8s_compare::a#10 mul8s_compare::a#1 ] zp[2]:101 [ mul8s_compare::mn#0 ] zp[2]:91 [ mul8s_compare::ms#0 ] zp[2]:97 [ mul8s_compare::mf#0 ] +Uplifting [print_sint] best 284791 combination zp[2]:58 [ print_sint::w#6 print_sint::w#0 print_sint::w#4 print_sint::w#1 print_sint::w#2 print_sint::w#3 ] +Uplifting [print_schar] best 284779 combination reg byte x [ print_schar::b#5 print_schar::b#0 print_schar::b#3 print_schar::b#1 print_schar::b#2 ] +Uplifting [mul8u_compare] best 283579 combination reg byte x [ mul8u_compare::ok#3 mul8u_compare::ok#4 ] zp[1]:21 [ mul8u_compare::b#10 mul8u_compare::b#1 ] zp[1]:20 [ mul8u_compare::a#7 mul8u_compare::a#1 ] zp[2]:77 [ mul8u_compare::mn#0 ] zp[2]:67 [ mul8u_compare::ms#0 ] zp[2]:73 [ mul8u_compare::mf#0 ] +Uplifting [memset] best 283579 combination zp[2]:26 [ memset::dst#2 memset::dst#1 ] +Uplifting [mulf_init] best 283329 combination zp[2]:14 [ mulf_init::sqr#3 mulf_init::sqr#4 mulf_init::sqr#1 mulf_init::sqr#2 ] zp[2]:8 [ mulf_init::sqr2_lo#2 mulf_init::sqr2_lo#1 ] zp[2]:2 [ mulf_init::sqr1_lo#2 mulf_init::sqr1_lo#1 ] reg byte x [ mulf_init::x_2#3 mulf_init::x_2#2 mulf_init::x_2#1 ] reg byte a [ mulf_init::$1 ] reg byte a [ mulf_init::$4 ] reg byte a [ mulf_init::$5 ] zp[1]:10 [ mulf_init::x_255#2 mulf_init::x_255#1 ] zp[1]:13 [ mulf_init::dir#2 mulf_init::dir#4 ] zp[1]:4 [ mulf_init::c#2 mulf_init::c#1 ] zp[2]:11 [ mulf_init::sqr2_hi#2 mulf_init::sqr2_hi#1 ] zp[2]:5 [ mulf_init::sqr1_hi#2 mulf_init::sqr1_hi#1 ] Limited combination testing to 100 combinations of 1024 possible. -Uplifting [mulf_tables_cmp] best 288329 combination zp[2]:16 [ mulf_tables_cmp::kc_sqr#2 mulf_tables_cmp::kc_sqr#1 ] zp[2]:18 [ mulf_tables_cmp::asm_sqr#2 mulf_tables_cmp::asm_sqr#1 ] -Uplifting [mul8u_error] best 288323 combination reg byte x [ mul8u_error::a#0 ] zp[1]:80 [ mul8u_error::b#0 ] zp[2]:81 [ mul8u_error::ms#0 ] zp[2]:83 [ mul8u_error::mn#0 ] zp[2]:85 [ mul8u_error::mf#0 ] -Uplifting [mul8s_error] best 288317 combination reg byte x [ mul8s_error::a#0 ] zp[1]:104 [ mul8s_error::b#0 ] zp[2]:105 [ mul8s_error::ms#0 ] zp[2]:107 [ mul8s_error::mn#0 ] zp[2]:109 [ mul8s_error::mf#0 ] -Uplifting [RADIX] best 288317 combination -Uplifting [print_ln] best 288317 combination -Uplifting [print_cls] best 288317 combination -Uplifting [main] best 288317 combination -Uplifting [mulf_init_asm] best 288317 combination +Uplifting [mulf_tables_cmp] best 283329 combination zp[2]:16 [ mulf_tables_cmp::kc_sqr#2 mulf_tables_cmp::kc_sqr#1 ] zp[2]:18 [ mulf_tables_cmp::asm_sqr#2 mulf_tables_cmp::asm_sqr#1 ] +Uplifting [mul8u_error] best 283323 combination reg byte x [ mul8u_error::a#0 ] zp[1]:80 [ mul8u_error::b#0 ] zp[2]:81 [ mul8u_error::ms#0 ] zp[2]:83 [ mul8u_error::mn#0 ] zp[2]:85 [ mul8u_error::mf#0 ] +Uplifting [mul8s_error] best 283317 combination reg byte x [ mul8s_error::a#0 ] zp[1]:104 [ mul8s_error::b#0 ] zp[2]:105 [ mul8s_error::ms#0 ] zp[2]:107 [ mul8s_error::mn#0 ] zp[2]:109 [ mul8s_error::mf#0 ] +Uplifting [RADIX] best 283317 combination +Uplifting [print_ln] best 283317 combination +Uplifting [print_cls] best 283317 combination +Uplifting [main] best 283317 combination +Uplifting [mulf_init_asm] best 283317 combination Attempting to uplift remaining variables inzp[1]:87 [ muls8s::a#0 ] -Uplifting [muls8s] best 288317 combination zp[1]:87 [ muls8s::a#0 ] +Uplifting [muls8s] best 283317 combination zp[1]:87 [ muls8s::a#0 ] Attempting to uplift remaining variables inzp[1]:63 [ muls8u::a#0 ] -Uplifting [muls8u] best 288317 combination zp[1]:63 [ muls8u::a#0 ] +Uplifting [muls8u] best 283317 combination zp[1]:63 [ muls8u::a#0 ] Attempting to uplift remaining variables inzp[1]:116 [ mulf8s_prepared::b#0 ] -Uplifting [mulf8s_prepared] best 288317 combination zp[1]:116 [ mulf8s_prepared::b#0 ] +Uplifting [mulf8s_prepared] best 283317 combination zp[1]:116 [ mulf8s_prepared::b#0 ] Attempting to uplift remaining variables inzp[1]:24 [ mul8s_compare::b#10 mul8s_compare::b#1 ] -Uplifting [mul8s_compare] best 288317 combination zp[1]:24 [ mul8s_compare::b#10 mul8s_compare::b#1 ] +Uplifting [mul8s_compare] best 283317 combination zp[1]:24 [ mul8s_compare::b#10 mul8s_compare::b#1 ] Attempting to uplift remaining variables inzp[1]:21 [ mul8u_compare::b#10 mul8u_compare::b#1 ] -Uplifting [mul8u_compare] best 288317 combination zp[1]:21 [ mul8u_compare::b#10 mul8u_compare::b#1 ] +Uplifting [mul8u_compare] best 283317 combination zp[1]:21 [ mul8u_compare::b#10 mul8u_compare::b#1 ] Attempting to uplift remaining variables inzp[1]:100 [ mul8s::b#0 ] -Uplifting [mul8s] best 288016 combination reg byte y [ mul8s::b#0 ] +Uplifting [mul8s] best 283016 combination reg byte y [ mul8s::b#0 ] Attempting to uplift remaining variables inzp[1]:99 [ mul8s::a#0 ] -Uplifting [mul8s] best 288016 combination zp[1]:99 [ mul8s::a#0 ] +Uplifting [mul8s] best 283016 combination zp[1]:99 [ mul8s::a#0 ] Attempting to uplift remaining variables inzp[1]:23 [ mul8s_compare::a#10 mul8s_compare::a#1 ] -Uplifting [mul8s_compare] best 288016 combination zp[1]:23 [ mul8s_compare::a#10 mul8s_compare::a#1 ] +Uplifting [mul8s_compare] best 283016 combination zp[1]:23 [ mul8s_compare::a#10 mul8s_compare::a#1 ] Attempting to uplift remaining variables inzp[1]:20 [ mul8u_compare::a#7 mul8u_compare::a#1 ] -Uplifting [mul8u_compare] best 288016 combination zp[1]:20 [ mul8u_compare::a#7 mul8u_compare::a#1 ] +Uplifting [mul8u_compare] best 283016 combination zp[1]:20 [ mul8u_compare::a#7 mul8u_compare::a#1 ] Attempting to uplift remaining variables inzp[1]:10 [ mulf_init::x_255#2 mulf_init::x_255#1 ] -Uplifting [mulf_init] best 287876 combination reg byte x [ mulf_init::x_255#2 mulf_init::x_255#1 ] +Uplifting [mulf_init] best 282876 combination reg byte x [ mulf_init::x_255#2 mulf_init::x_255#1 ] Attempting to uplift remaining variables inzp[1]:13 [ mulf_init::dir#2 mulf_init::dir#4 ] -Uplifting [mulf_init] best 287876 combination zp[1]:13 [ mulf_init::dir#2 mulf_init::dir#4 ] +Uplifting [mulf_init] best 282876 combination zp[1]:13 [ mulf_init::dir#2 mulf_init::dir#4 ] Attempting to uplift remaining variables inzp[1]:4 [ mulf_init::c#2 mulf_init::c#1 ] -Uplifting [mulf_init] best 287876 combination zp[1]:4 [ mulf_init::c#2 mulf_init::c#1 ] +Uplifting [mulf_init] best 282876 combination zp[1]:4 [ mulf_init::c#2 mulf_init::c#1 ] Attempting to uplift remaining variables inzp[1]:80 [ mul8u_error::b#0 ] -Uplifting [mul8u_error] best 287876 combination zp[1]:80 [ mul8u_error::b#0 ] +Uplifting [mul8u_error] best 282876 combination zp[1]:80 [ mul8u_error::b#0 ] Attempting to uplift remaining variables inzp[1]:104 [ mul8s_error::b#0 ] -Uplifting [mul8s_error] best 287876 combination zp[1]:104 [ mul8s_error::b#0 ] +Uplifting [mul8s_error] best 282876 combination zp[1]:104 [ mul8s_error::b#0 ] Coalescing zero page register [ zp[2]:18 [ mulf_tables_cmp::asm_sqr#2 mulf_tables_cmp::asm_sqr#1 ] ] with [ zp[2]:32 [ print_uint::w#6 print_uint::w#3 print_uint::w#4 print_uint::w#5 print_uint::w#2 print_uint::w#1 print_uint::w#0 ] ] - score: 1 Coalescing zero page register [ zp[1]:20 [ mul8u_compare::a#7 mul8u_compare::a#1 ] ] with [ zp[1]:63 [ muls8u::a#0 ] ] - score: 1 Coalescing zero page register [ zp[1]:21 [ mul8u_compare::b#10 mul8u_compare::b#1 ] ] with [ zp[1]:80 [ mul8u_error::b#0 ] ] - score: 1 @@ -9473,18 +9471,16 @@ muls8s: { __b4: // [231] (signed word) muls8s::m#1 ← (signed word) muls8s::m#3 + (signed byte) muls8s::b#0 -- vwsz1=vwsz1_plus_vbsxx txa - sta.z $fe + pha + clc + adc.z m + sta.z m + pla ora #$7f bmi !+ lda #0 !: - sta.z $ff - clc - lda.z m - adc.z $fe - sta.z m - lda.z m+1 - adc.z $ff + adc.z m+1 sta.z m+1 // [232] (signed byte) muls8s::j#1 ← ++ (signed byte) muls8s::j#2 -- vbsyy=_inc_vbsyy iny @@ -11092,7 +11088,7 @@ reg byte a [ mulf8s_prepared::$12 ] FINAL ASSEMBLER -Score: 236672 +Score: 231672 // File Comments // Test the fast multiplication library @@ -12400,18 +12396,16 @@ muls8s: { // m = m + b // [231] (signed word) muls8s::m#1 ← (signed word) muls8s::m#3 + (signed byte) muls8s::b#0 -- vwsz1=vwsz1_plus_vbsxx txa - sta.z $fe + pha + clc + adc.z m + sta.z m + pla ora #$7f bmi !+ lda #0 !: - sta.z $ff - clc - lda.z m - adc.z $fe - sta.z m - lda.z m+1 - adc.z $ff + adc.z m+1 sta.z m+1 // for(signed byte j = 0; j!=a; j++) // [232] (signed byte) muls8s::j#1 ← ++ (signed byte) muls8s::j#2 -- vbsyy=_inc_vbsyy