diff --git a/src/main/fragment/cache/fragment-cache-csg65ce02.asm b/src/main/fragment/cache/fragment-cache-csg65ce02.asm index be9fdb3ad..3d5ce8f72 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 12916116c7 12916134cc +//KICKC FRAGMENT CACHE 129161168d 129161348a //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 349d276f3..3bc7bda1c 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 12916116c7 12916134cc +//KICKC FRAGMENT CACHE 129161168d 129161348a //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 bca9d0d2c..4e24458db 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 12916116c7 12916134cc +//KICKC FRAGMENT CACHE 129161168d 129161348a //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 e88b6951d..1bc0aa5f1 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 12916116c7 12916134cc +//KICKC FRAGMENT CACHE 129161168d 129161348a //FRAGMENT vbuz1=vbuc1 lda #{c1} sta {z1} @@ -1441,144 +1441,46 @@ tax sty $ff cpx $ff beq {la1} -//FRAGMENT vwuz1=vwuz2_plus_1 -clc -lda {z2} -adc #1 +//FRAGMENT vbuz1=_deref_pbuc1 +lda {c1} sta {z1} -lda {z2}+1 -adc #0 -sta {z1}+1 -//FRAGMENT vwuz1=vwuz2_rol_1 +//FRAGMENT vbuz1=vbuz2_minus_1 +ldx {z2} +dex +stx {z1} +//FRAGMENT pbuz1_derefidx_vbuz2_neq_vbuz3_then_la1 +ldy {z2} +lda ({z1}),y + +cmp {z3} +bne {la1} +//FRAGMENT vbuz1_lt_vbuz2_then_la1 +lda {z1} +cmp {z2} +bcc {la1} +//FRAGMENT vbuz1_le_vbuz2_then_la1 +lda {z2} +cmp {z1} +bcs {la1} +//FRAGMENT vbuz1_eq_vbuc1_then_la1 +lda #{c1} +cmp {z1} +beq {la1} +//FRAGMENT _deref_pbuz1_neq_vbuz2_then_la1 +ldy #0 +lda ({z1}),y +cmp {z2} +bne {la1} +//FRAGMENT vwuz1=vwuz2_rol_2 lda {z2} asl sta {z1} lda {z2}+1 rol sta {z1}+1 -//FRAGMENT pwuz1=pwuc1_plus_vwuz2 -clc -lda {z2} -adc #<{c1} -sta {z1} -lda {z2}+1 -adc #>{c1} -sta {z1}+1 -//FRAGMENT vwuz1=_deref_pwuz2_plus__deref_pwuz3 -ldy #0 -clc -lda ({z2}),y -adc ({z3}),y -sta {z1} -iny -lda ({z2}),y -adc ({z3}),y -sta {z1}+1 -//FRAGMENT vwuz1=vwuz2_plus__deref_pwuz3 -ldy #0 -clc -lda {z2} -adc ({z3}),y -sta {z1} -iny -lda {z2}+1 -adc ({z3}),y -sta {z1}+1 -//FRAGMENT vwuz1_neq_vwuc1_then_la1 -lda {z1}+1 -cmp #>{c1} -bne {la1} -lda {z1} -cmp #<{c1} -bne {la1} -//FRAGMENT vwuz1=_deref_pwuz2 -ldy #0 -lda ({z2}),y -sta {z1} -iny -lda ({z2}),y -sta {z1}+1 -//FRAGMENT vduz1=vduz2 -lda {z2} -sta {z1} -lda {z2}+1 -sta {z1}+1 -lda {z2}+2 -sta {z1}+2 -lda {z2}+3 -sta {z1}+3 -//FRAGMENT vwuz1=_lo_vduz2 -lda {z2} -sta {z1} -lda {z2}+1 -sta {z1}+1 -//FRAGMENT pvoz1=_deref_qvoc1 -lda {c1} -sta {z1} -lda {c1}+1 -sta {z1}+1 -//FRAGMENT vbuc1_neq_vbuz1_then_la1 -lda #{c1} -cmp {z1} -bne {la1} -//FRAGMENT vbuz1=_deref_pbuc1 -lda {c1} -sta {z1} -//FRAGMENT vduz1=_dword_vwuz2 -lda {z2} -sta {z1} -lda {z2}+1 -sta {z1}+1 -lda #0 -sta {z1}+2 -sta {z1}+3 -//FRAGMENT vduz1=vduc1 -lda #<{c1} -sta {z1} -lda #>{c1} -sta {z1}+1 -lda #<{c1}>>$10 -sta {z1}+2 -lda #>{c1}>>$10 -sta {z1}+3 -//FRAGMENT vwuz1_neq_0_then_la1 -lda {z1} -bne {la1} -lda {z1}+1 -bne {la1} -//FRAGMENT vbuz1=vwuz2_band_vbuc1 -lda #{c1} -and {z2} -sta {z1} -//FRAGMENT vduz1=vduz1_plus_vduz2 -lda {z1} -clc -adc {z2} -sta {z1} -lda {z1}+1 -adc {z2}+1 -sta {z1}+1 -lda {z1}+2 -adc {z2}+2 -sta {z1}+2 -lda {z1}+3 -adc {z2}+3 -sta {z1}+3 -//FRAGMENT vwuz1=vwuz1_ror_1 -lsr {z1}+1 -ror {z1} -//FRAGMENT vduz1=vduz1_rol_1 asl {z1} rol {z1}+1 -rol {z1}+2 -rol {z1}+3 -//FRAGMENT vwuz1_le_0_then_la1 -lda {z1} -bne !+ -lda {z1}+1 -beq {la1} -!: -//FRAGMENT pbuz1=pbuz2_plus_vwuz3 +//FRAGMENT vwuz1=vwuz2_plus_vwuz3 lda {z2} clc adc {z3} @@ -1586,38 +1488,44 @@ sta {z1} lda {z2}+1 adc {z3}+1 sta {z1}+1 -//FRAGMENT pbuz1_neq_pbuz2_then_la1 -lda {z1}+1 -cmp {z2}+1 -bne {la1} -lda {z1} -cmp {z2} -bne {la1} -//FRAGMENT _deref_pwuc1=vbuc2 -lda #0 -sta {c1}+1 -lda #<{c2} -sta {c1} -//FRAGMENT vbuz1_eq_vbuc1_then_la1 +//FRAGMENT pbuz1=pbuc1_plus_vwuz2 +clc +lda {z2} +adc #<{c1} +sta {z1} +lda {z2}+1 +adc #>{c1} +sta {z1}+1 +//FRAGMENT pbuz1_derefidx_vbuz2=vbuc1 +lda #{c1} +ldy {z2} +sta ({z1}),y +//FRAGMENT vbuc1_neq_vbuz1_then_la1 lda #{c1} cmp {z1} -beq {la1} -//FRAGMENT vbuz1=pbuc1_derefidx_(_deref_pbuc2) -ldy {c2} -lda {c1},y +bne {la1} +//FRAGMENT vbuz1_le_vbuc1_then_la1 +lda #{c1} +cmp {z1} +bcs {la1} +//FRAGMENT _deref_qbuc1=pbuz1 +lda {z1} +sta {c1} +lda {z1}+1 +sta {c1}+1 +//FRAGMENT vbuz1=vbuz2_rol_2 +lda {z2} +asl +asl sta {z1} -//FRAGMENT _deref_pwuc1=_inc__deref_pwuc1 -inc {c1} -bne !+ -inc {c1}+1 -!: -//FRAGMENT _deref_pwuc1_eq_vbuc2_then_la1 -lda {c1}+1 -bne !+ -lda {c1} -cmp #{c2} -beq {la1} -!: +//FRAGMENT vbuz1=vbuz2_rol_1 +lda {z2} +asl +sta {z1} +//FRAGMENT pbuz1_derefidx_vbuz2=vbuz3 +lda {z3} +ldy {z2} +sta ({z1}),y //FRAGMENT vbuz1=_byte_vwuz2 lda {z2} sta {z1} @@ -1634,10 +1542,6 @@ sta {z1} lda {z2}+1 adc #0 sta {z1}+1 -//FRAGMENT vbuz1=vbuz2_rol_1 -lda {z2} -asl -sta {z1} //FRAGMENT vwuz1=pwuc1_derefidx_vbuz2 ldy {z2} lda {c1},y @@ -1657,110 +1561,6 @@ bcc {la1} lda #{c1} cmp {z1} beq {la1} -//FRAGMENT vbuz1=_byte_vduz2 -lda {z2} -sta {z1} -//FRAGMENT vbuz1=vbuz2_rol_2 -lda {z2} -asl -asl -sta {z1} -//FRAGMENT vduz1=pduc1_derefidx_vbuz2 -ldy {z2} -lda {c1},y -sta {z1} -lda {c1}+1,y -sta {z1}+1 -lda {c1}+2,y -sta {z1}+2 -lda {c1}+3,y -sta {z1}+3 -//FRAGMENT vduz1_ge_vduz2_then_la1 -lda {z1}+3 -cmp {z2}+3 -bcc !+ -bne {la1} -lda {z1}+2 -cmp {z2}+2 -bcc !+ -bne {la1} -lda {z1}+1 -cmp {z2}+1 -bcc !+ -bne {la1} -lda {z1} -cmp {z2} -bcs {la1} -!: -//FRAGMENT _deref_(_deref_qbuc1)=_deref_pbuc2 -lda {c2} -ldy {c1} -sty $fe -ldy {c1}+1 -sty $ff -ldy #0 -sta ($fe),y -//FRAGMENT _deref_pbuc1=vbuz1 -lda {z1} -sta {c1} -//FRAGMENT _deref_qbuc1=pbuz1 -lda {z1} -sta {c1} -lda {z1}+1 -sta {c1}+1 -//FRAGMENT vbuz1=vbuz2_bxor_vbuc1 -lda #{c1} -eor {z2} -sta {z1} -//FRAGMENT _deref_(_deref_qbuc1)=vbuz1 -lda {z1} -ldy {c1} -sty $fe -ldy {c1}+1 -sty $ff -ldy #0 -sta ($fe),y -//FRAGMENT _deref_pbuc1=_inc__deref_pbuc1 -inc {c1} -//FRAGMENT _deref_pbuc1_neq_vbuc2_then_la1 -lda #{c2} -cmp {c1} -bne {la1} -//FRAGMENT _deref_(_deref_qbuc1)=_deref_(_deref_qbuc1)_bxor_vbuc2 -ldy {c1} -sty $fe -ldy {c1}+1 -sty $ff -ldy #0 -lda ($fe),y -eor #{c2} -sta ($fe),y -//FRAGMENT pbuz1=_deref_qbuc1 -lda {c1} -sta {z1} -lda {c1}+1 -sta {z1}+1 -//FRAGMENT pbuz1=pbuz2_plus_vbuc1 -lda #{c1} -clc -adc {z2} -sta {z1} -lda #0 -adc {z2}+1 -sta {z1}+1 -//FRAGMENT pvoz1=pvoz2 -lda {z2} -sta {z1} -lda {z2}+1 -sta {z1}+1 -//FRAGMENT pbuz1=pbuz2_plus_vwuc1 -clc -lda {z2} -adc #<{c1} -sta {z1} -lda {z2}+1 -adc #>{c1} -sta {z1}+1 //FRAGMENT vwuz1=vwuz1_minus_vwuz2 lda {z1} sec @@ -1769,493 +1569,6 @@ sta {z1} lda {z1}+1 sbc {z2}+1 sta {z1}+1 -//FRAGMENT vduz1=vduz1_minus_vduz2 -lda {z1} -sec -sbc {z2} -sta {z1} -lda {z1}+1 -sbc {z2}+1 -sta {z1}+1 -lda {z1}+2 -sbc {z2}+2 -sta {z1}+2 -lda {z1}+3 -sbc {z2}+3 -sta {z1}+3 -//FRAGMENT vwuz1=_word__deref_pbuc1 -lda {c1} -sta {z1} -lda #0 -sta {z1}+1 -//FRAGMENT vwuz1=vwuz2_rol_2 -lda {z2} -asl -sta {z1} -lda {z2}+1 -rol -sta {z1}+1 -asl {z1} -rol {z1}+1 -//FRAGMENT vwuz1=vwuz2_plus_vwuz3 -lda {z2} -clc -adc {z3} -sta {z1} -lda {z2}+1 -adc {z3}+1 -sta {z1}+1 -//FRAGMENT pbuz1=_deref_qbuc1_plus_vwuz2 -clc -lda {z2} -adc {c1} -sta {z1} -lda {z2}+1 -adc {c1}+1 -sta {z1}+1 -//FRAGMENT pbuz1=pbuz2_plus__deref_pwuc1 -clc -lda {c1} -adc {z2} -sta {z1} -lda {c1}+1 -adc {z2}+1 -sta {z1}+1 -//FRAGMENT _deref_pbuz1=_deref_pbuz2 -ldy #0 -lda ({z2}),y -ldy #0 -sta ({z1}),y -//FRAGMENT vbuc1_neq_vbuaa_then_la1 -cmp #{c1} -bne {la1} -//FRAGMENT vbuaa=_deref_pbuc1 -lda {c1} -//FRAGMENT vbuxx=_deref_pbuc1 -ldx {c1} -//FRAGMENT vbuaa=vwuz1_band_vbuc1 -lda #{c1} -and {z1} -//FRAGMENT vbuxx=vwuz1_band_vbuc1 -lda #{c1} -and {z1} -tax -//FRAGMENT vbuyy=vwuz1_band_vbuc1 -lda #{c1} -and {z1} -tay -//FRAGMENT vbuaa=pbuc1_derefidx_(_deref_pbuc2) -ldy {c2} -lda {c1},y -//FRAGMENT vbuxx=pbuc1_derefidx_(_deref_pbuc2) -ldy {c2} -ldx {c1},y -//FRAGMENT vbuyy=pbuc1_derefidx_(_deref_pbuc2) -ldx {c2} -ldy {c1},x -//FRAGMENT vbuaa=_byte_vwuz1 -lda {z1} -//FRAGMENT vbuxx=_byte_vwuz1 -lda {z1} -tax -//FRAGMENT vbuyy=_byte_vwuz1 -lda {z1} -tay -//FRAGMENT _deref_pbuz1=pbuc1_derefidx_vbuaa -tay -lda {c1},y -ldy #0 -sta ({z1}),y -//FRAGMENT _deref_pbuz1=pbuc1_derefidx_vbuxx -lda {c1},x -ldy #0 -sta ({z1}),y -//FRAGMENT _deref_pbuz1=pbuc1_derefidx_vbuyy -lda {c1},y -ldy #0 -sta ({z1}),y -//FRAGMENT vbuaa=vbuz1_rol_1 -lda {z1} -asl -//FRAGMENT vbuxx=vbuz1_rol_1 -lda {z1} -asl -tax -//FRAGMENT vbuyy=vbuz1_rol_1 -lda {z1} -asl -tay -//FRAGMENT vbuz1=vbuaa_rol_1 -asl -sta {z1} -//FRAGMENT vbuaa=vbuaa_rol_1 -asl -//FRAGMENT vbuxx=vbuaa_rol_1 -asl -tax -//FRAGMENT vbuyy=vbuaa_rol_1 -asl -tay -//FRAGMENT vbuz1=vbuxx_rol_1 -txa -asl -sta {z1} -//FRAGMENT vbuaa=vbuxx_rol_1 -txa -asl -//FRAGMENT vbuxx=vbuxx_rol_1 -txa -asl -tax -//FRAGMENT vbuyy=vbuxx_rol_1 -txa -asl -tay -//FRAGMENT vbuz1=vbuyy_rol_1 -tya -asl -sta {z1} -//FRAGMENT vbuaa=vbuyy_rol_1 -tya -asl -//FRAGMENT vbuxx=vbuyy_rol_1 -tya -asl -tax -//FRAGMENT vbuyy=vbuyy_rol_1 -tya -asl -tay -//FRAGMENT vwuz1=pwuc1_derefidx_vbuaa -tay -lda {c1},y -sta {z1} -lda {c1}+1,y -sta {z1}+1 -//FRAGMENT vwuz1=pwuc1_derefidx_vbuxx -lda {c1},x -sta {z1} -lda {c1}+1,x -sta {z1}+1 -//FRAGMENT vwuz1=pwuc1_derefidx_vbuyy -lda {c1},y -sta {z1} -lda {c1}+1,y -sta {z1}+1 -//FRAGMENT vbuc1_neq_vbuxx_then_la1 -cpx #{c1} -bne {la1} -//FRAGMENT vbuc1_eq_vbuaa_then_la1 -cmp #{c1} -beq {la1} -//FRAGMENT vbuaa=_byte_vduz1 -lda {z1} -//FRAGMENT vbuxx=_byte_vduz1 -lda {z1} -tax -//FRAGMENT vbuyy=_byte_vduz1 -lda {z1} -tay -//FRAGMENT vbuz1=vbuaa_rol_2 -asl -asl -sta {z1} -//FRAGMENT vbuz1=vbuxx_rol_2 -txa -asl -asl -sta {z1} -//FRAGMENT vbuz1=vbuyy_rol_2 -tya -asl -asl -sta {z1} -//FRAGMENT vbuaa=vbuz1_rol_2 -lda {z1} -asl -asl -//FRAGMENT vbuaa=vbuaa_rol_2 -asl -asl -//FRAGMENT vbuaa=vbuxx_rol_2 -txa -asl -asl -//FRAGMENT vbuaa=vbuyy_rol_2 -tya -asl -asl -//FRAGMENT vbuxx=vbuz1_rol_2 -lda {z1} -asl -asl -tax -//FRAGMENT vbuxx=vbuaa_rol_2 -asl -asl -tax -//FRAGMENT vbuxx=vbuxx_rol_2 -txa -asl -asl -tax -//FRAGMENT vbuxx=vbuyy_rol_2 -tya -asl -asl -tax -//FRAGMENT vbuyy=vbuz1_rol_2 -lda {z1} -asl -asl -tay -//FRAGMENT vbuyy=vbuaa_rol_2 -asl -asl -tay -//FRAGMENT vbuyy=vbuxx_rol_2 -txa -asl -asl -tay -//FRAGMENT vbuyy=vbuyy_rol_2 -tya -asl -asl -tay -//FRAGMENT vduz1=pduc1_derefidx_vbuaa -tay -lda {c1},y -sta {z1} -lda {c1}+1,y -sta {z1}+1 -lda {c1}+2,y -sta {z1}+2 -lda {c1}+3,y -sta {z1}+3 -//FRAGMENT vduz1=pduc1_derefidx_vbuxx -lda {c1},x -sta {z1} -lda {c1}+1,x -sta {z1}+1 -lda {c1}+2,x -sta {z1}+2 -lda {c1}+3,x -sta {z1}+3 -//FRAGMENT vduz1=pduc1_derefidx_vbuyy -lda {c1},y -sta {z1} -lda {c1}+1,y -sta {z1}+1 -lda {c1}+2,y -sta {z1}+2 -lda {c1}+3,y -sta {z1}+3 -//FRAGMENT _deref_pbuc1=vbuaa -sta {c1} -//FRAGMENT vbuaa=vbuz1_bxor_vbuc1 -lda #{c1} -eor {z1} -//FRAGMENT vbuxx=vbuz1_bxor_vbuc1 -lda #{c1} -eor {z1} -tax -//FRAGMENT vbuyy=vbuz1_bxor_vbuc1 -lda #{c1} -eor {z1} -tay -//FRAGMENT vbuz1=vbuxx_bxor_vbuc1 -txa -eor #{c1} -sta {z1} -//FRAGMENT vbuaa=vbuxx_bxor_vbuc1 -txa -eor #{c1} -//FRAGMENT vbuxx=vbuxx_bxor_vbuc1 -txa -eor #{c1} -tax -//FRAGMENT vbuyy=vbuxx_bxor_vbuc1 -txa -eor #{c1} -tay -//FRAGMENT vbuz1=vbuyy_bxor_vbuc1 -tya -eor #{c1} -sta {z1} -//FRAGMENT vbuaa=vbuyy_bxor_vbuc1 -tya -eor #{c1} -//FRAGMENT vbuxx=vbuyy_bxor_vbuc1 -tya -eor #{c1} -tax -//FRAGMENT vbuyy=vbuyy_bxor_vbuc1 -tya -eor #{c1} -tay -//FRAGMENT _deref_(_deref_qbuc1)=vbuaa -ldy {c1} -sty $fe -ldy {c1}+1 -sty $ff -ldy #0 -sta ($fe),y -//FRAGMENT _deref_(_deref_qbuc1)=vbuxx -txa -ldy {c1} -sty $fe -ldy {c1}+1 -sty $ff -ldy #0 -sta ($fe),y -//FRAGMENT _deref_(_deref_qbuc1)=vbuyy -tya -ldy {c1} -sty $fe -ldy {c1}+1 -sty $ff -ldy #0 -sta ($fe),y -//FRAGMENT _deref_pbuc1=vbuxx -stx {c1} -//FRAGMENT _deref_pbuc1=vbuyy -sty {c1} -//FRAGMENT vbuc1_neq_vbuyy_then_la1 -cpy #{c1} -bne {la1} -//FRAGMENT vbuc1_eq_vbuxx_then_la1 -cpx #{c1} -beq {la1} -//FRAGMENT vbuyy=_deref_pbuc1 -ldy {c1} -//FRAGMENT vbuc1_eq_vbuyy_then_la1 -cpy #{c1} -beq {la1} -//FRAGMENT vwuz1=_deref_pwuz1 -ldy #0 -lda ({z1}),y -pha -iny -lda ({z1}),y -sta {z1}+1 -pla -sta {z1} -//FRAGMENT pbuz1=pbuz2_plus_vwuz1 -lda {z1} -clc -adc {z2} -sta {z1} -lda {z1}+1 -adc {z2}+1 -sta {z1}+1 -//FRAGMENT vwuz1=_deref_pwuz1_plus__deref_pwuz2 -ldy #0 -clc -lda ({z1}),y -adc ({z2}),y -pha -iny -lda ({z1}),y -adc ({z2}),y -sta {z1}+1 -pla -sta {z1} -//FRAGMENT vwuz1=vwuz2_plus__deref_pwuz1 -ldy #0 -clc -lda ({z1}),y -adc {z2} -pha -iny -lda ({z1}),y -adc {z2}+1 -sta {z1}+1 -pla -sta {z1} -//FRAGMENT vwuz1=vwuz2_plus_vwuz1 -lda {z1} -clc -adc {z2} -sta {z1} -lda {z1}+1 -adc {z2}+1 -sta {z1}+1 -//FRAGMENT pbuz1=_deref_qbuc1_plus_vwuz1 -clc -lda {z1} -adc {c1} -sta {z1} -lda {z1}+1 -adc {c1}+1 -sta {z1}+1 -//FRAGMENT pwuz1=pwuc1_plus_vwuz1 -clc -lda {z1} -adc #<{c1} -sta {z1} -lda {z1}+1 -adc #>{c1} -sta {z1}+1 -//FRAGMENT pbuz1=pbuz1_plus_vwuc1 -clc -lda {z1} -adc #<{c1} -sta {z1} -lda {z1}+1 -adc #>{c1} -sta {z1}+1 -//FRAGMENT pbuz1=pbuz1_plus__deref_pwuc1 -clc -lda {c1} -adc {z1} -sta {z1} -lda {c1}+1 -adc {z1}+1 -sta {z1}+1 -//FRAGMENT vbuz1=vbuz2_minus_1 -ldx {z2} -dex -stx {z1} -//FRAGMENT pbuz1_derefidx_vbuz2_neq_vbuz3_then_la1 -ldy {z2} -lda ({z1}),y - -cmp {z3} -bne {la1} -//FRAGMENT vbuz1_lt_vbuz2_then_la1 -lda {z1} -cmp {z2} -bcc {la1} -//FRAGMENT vbuz1_le_vbuz2_then_la1 -lda {z2} -cmp {z1} -bcs {la1} -//FRAGMENT _deref_pbuz1_neq_vbuz2_then_la1 -ldy #0 -lda ({z1}),y -cmp {z2} -bne {la1} -//FRAGMENT pbuz1=pbuc1_plus_vwuz2 -clc -lda {z2} -adc #<{c1} -sta {z1} -lda {z2}+1 -adc #>{c1} -sta {z1}+1 -//FRAGMENT pbuz1_derefidx_vbuz2=vbuc1 -lda #{c1} -ldy {z2} -sta ({z1}),y -//FRAGMENT vbuz1_le_vbuc1_then_la1 -lda #{c1} -cmp {z1} -bcs {la1} -//FRAGMENT pbuz1_derefidx_vbuz2=vbuz3 -lda {z3} -ldy {z2} -sta ({z1}),y //FRAGMENT pvoz1=pvoc1 lda #<{c1} sta {z1} @@ -2269,6 +1582,38 @@ sta {z1} lda {z1}+1 sbc #0 sta {z1}+1 +//FRAGMENT pbuz1=pbuz2_plus_vwuc1 +clc +lda {z2} +adc #<{c1} +sta {z1} +lda {z2}+1 +adc #>{c1} +sta {z1}+1 +//FRAGMENT pbuz1_neq_pbuz2_then_la1 +lda {z1}+1 +cmp {z2}+1 +bne {la1} +lda {z1} +cmp {z2} +bne {la1} +//FRAGMENT _deref_pbuz1=_deref_pbuz2 +ldy #0 +lda ({z2}),y +ldy #0 +sta ({z1}),y +//FRAGMENT pbuz1=pbuz2_plus_vbuc1 +lda #{c1} +clc +adc {z2} +sta {z1} +lda #0 +adc {z2}+1 +sta {z1}+1 +//FRAGMENT vbuaa=_deref_pbuc1 +lda {c1} +//FRAGMENT vbuxx=_deref_pbuc1 +ldx {c1} //FRAGMENT vbuaa=vbuz1_minus_1 lda {z1} sec @@ -2377,10 +1722,65 @@ sta ({z1}),y //FRAGMENT pbuz1_derefidx_vbuyy=vbuc1 lda #{c1} sta ({z1}),y +//FRAGMENT vbuc1_neq_vbuaa_then_la1 +cmp #{c1} +bne {la1} //FRAGMENT vbuaa_le_vbuc1_then_la1 cmp #{c1} bcc {la1} beq {la1} +//FRAGMENT vbuaa=vbuz1_rol_2 +lda {z1} +asl +asl +//FRAGMENT vbuxx=vbuz1_rol_2 +lda {z1} +asl +asl +tax +//FRAGMENT vbuyy=vbuz1_rol_2 +lda {z1} +asl +asl +tay +//FRAGMENT vbuz1=vbuxx_rol_2 +txa +asl +asl +sta {z1} +//FRAGMENT vbuaa=vbuxx_rol_2 +txa +asl +asl +//FRAGMENT vbuxx=vbuxx_rol_2 +txa +asl +asl +tax +//FRAGMENT vbuyy=vbuxx_rol_2 +txa +asl +asl +tay +//FRAGMENT vbuz1=vbuyy_rol_2 +tya +asl +asl +sta {z1} +//FRAGMENT vbuaa=vbuyy_rol_2 +tya +asl +asl +//FRAGMENT vbuxx=vbuyy_rol_2 +tya +asl +asl +tax +//FRAGMENT vbuyy=vbuyy_rol_2 +tya +asl +asl +tay //FRAGMENT vbuz1=vbuaa_plus_vbuz2 clc adc {z2} @@ -2434,6 +1834,58 @@ sty $ff clc adc $ff tay +//FRAGMENT vbuz1=vbuaa_rol_1 +asl +sta {z1} +//FRAGMENT vbuz1=vbuxx_rol_1 +txa +asl +sta {z1} +//FRAGMENT vbuz1=vbuyy_rol_1 +tya +asl +sta {z1} +//FRAGMENT vbuaa=vbuz1_rol_1 +lda {z1} +asl +//FRAGMENT vbuaa=vbuaa_rol_1 +asl +//FRAGMENT vbuaa=vbuxx_rol_1 +txa +asl +//FRAGMENT vbuaa=vbuyy_rol_1 +tya +asl +//FRAGMENT vbuxx=vbuz1_rol_1 +lda {z1} +asl +tax +//FRAGMENT vbuxx=vbuaa_rol_1 +asl +tax +//FRAGMENT vbuxx=vbuxx_rol_1 +txa +asl +tax +//FRAGMENT vbuxx=vbuyy_rol_1 +tya +asl +tax +//FRAGMENT vbuyy=vbuz1_rol_1 +lda {z1} +asl +tay +//FRAGMENT vbuyy=vbuaa_rol_1 +asl +tay +//FRAGMENT vbuyy=vbuxx_rol_1 +txa +asl +tay +//FRAGMENT vbuyy=vbuyy_rol_1 +tya +asl +tay //FRAGMENT vbuaa_eq_vbuc1_then_la1 cmp #{c1} beq {la1} @@ -2448,6 +1900,49 @@ sta ({z1}),y tya ldy {z2} sta ({z1}),y +//FRAGMENT vbuaa=_byte_vwuz1 +lda {z1} +//FRAGMENT vbuxx=_byte_vwuz1 +lda {z1} +tax +//FRAGMENT vbuyy=_byte_vwuz1 +lda {z1} +tay +//FRAGMENT _deref_pbuz1=pbuc1_derefidx_vbuaa +tay +lda {c1},y +ldy #0 +sta ({z1}),y +//FRAGMENT _deref_pbuz1=pbuc1_derefidx_vbuxx +lda {c1},x +ldy #0 +sta ({z1}),y +//FRAGMENT _deref_pbuz1=pbuc1_derefidx_vbuyy +lda {c1},y +ldy #0 +sta ({z1}),y +//FRAGMENT vwuz1=pwuc1_derefidx_vbuaa +tay +lda {c1},y +sta {z1} +lda {c1}+1,y +sta {z1}+1 +//FRAGMENT vwuz1=pwuc1_derefidx_vbuxx +lda {c1},x +sta {z1} +lda {c1}+1,x +sta {z1}+1 +//FRAGMENT vwuz1=pwuc1_derefidx_vbuyy +lda {c1},y +sta {z1} +lda {c1}+1,y +sta {z1}+1 +//FRAGMENT vbuc1_neq_vbuxx_then_la1 +cpx #{c1} +bne {la1} +//FRAGMENT vbuc1_eq_vbuaa_then_la1 +cmp #{c1} +beq {la1} //FRAGMENT vbuxx_le_vbuc1_then_la1 cpx #{c1} bcc {la1} @@ -2459,6 +1954,9 @@ beq {la1} cpy #{c1} bcc {la1} beq {la1} +//FRAGMENT vbuc1_neq_vbuyy_then_la1 +cpy #{c1} +bne {la1} //FRAGMENT vbuxx=vbuz1_minus_1 ldx {z1} dex @@ -2466,10 +1964,26 @@ dex lda {z1} tay dey +//FRAGMENT vbuc1_eq_vbuxx_then_la1 +cpx #{c1} +beq {la1} +//FRAGMENT vbuyy=_deref_pbuc1 +ldy {c1} +//FRAGMENT vbuc1_eq_vbuyy_then_la1 +cpy #{c1} +beq {la1} //FRAGMENT vbuz1=vbuz1_plus_vbuaa clc adc {z1} sta {z1} +//FRAGMENT vwuz1=vwuz2_plus_vwuz1 +lda {z1} +clc +adc {z2} +sta {z1} +lda {z1}+1 +adc {z2}+1 +sta {z1}+1 //FRAGMENT pbuz1=pbuc1_plus_vwuz1 clc lda {z1} @@ -2478,6 +1992,11 @@ sta {z1} lda {z1}+1 adc #>{c1} sta {z1}+1 +//FRAGMENT pvoz1=_deref_qvoc1 +lda {c1} +sta {z1} +lda {c1}+1 +sta {z1}+1 //FRAGMENT pbuz1_derefidx_vbuz2_neq_vbuc1_then_la1 ldy {z2} lda ({z1}),y @@ -2509,6 +2028,110 @@ sta {z1} bcc !+ inc {z1}+1 !: +//FRAGMENT vwuz1_le_0_then_la1 +lda {z1} +bne !+ +lda {z1}+1 +beq {la1} +!: +//FRAGMENT pbuz1=pbuz2_plus_vwuz3 +lda {z2} +clc +adc {z3} +sta {z1} +lda {z2}+1 +adc {z3}+1 +sta {z1}+1 +//FRAGMENT _deref_pwuc1=vbuc2 +lda #0 +sta {c1}+1 +lda #<{c2} +sta {c1} +//FRAGMENT vbuz1=pbuc1_derefidx_(_deref_pbuc2) +ldy {c2} +lda {c1},y +sta {z1} +//FRAGMENT _deref_pwuc1=_inc__deref_pwuc1 +inc {c1} +bne !+ +inc {c1}+1 +!: +//FRAGMENT _deref_pwuc1_eq_vbuc2_then_la1 +lda {c1}+1 +bne !+ +lda {c1} +cmp #{c2} +beq {la1} +!: +//FRAGMENT _deref_(_deref_qbuc1)=_deref_pbuc2 +lda {c2} +ldy {c1} +sty $fe +ldy {c1}+1 +sty $ff +ldy #0 +sta ($fe),y +//FRAGMENT _deref_pbuc1=vbuz1 +lda {z1} +sta {c1} +//FRAGMENT vbuz1=vbuz2_bxor_vbuc1 +lda #{c1} +eor {z2} +sta {z1} +//FRAGMENT _deref_(_deref_qbuc1)=vbuz1 +lda {z1} +ldy {c1} +sty $fe +ldy {c1}+1 +sty $ff +ldy #0 +sta ($fe),y +//FRAGMENT _deref_pbuc1=_inc__deref_pbuc1 +inc {c1} +//FRAGMENT _deref_pbuc1_neq_vbuc2_then_la1 +lda #{c2} +cmp {c1} +bne {la1} +//FRAGMENT _deref_(_deref_qbuc1)=_deref_(_deref_qbuc1)_bxor_vbuc2 +ldy {c1} +sty $fe +ldy {c1}+1 +sty $ff +ldy #0 +lda ($fe),y +eor #{c2} +sta ($fe),y +//FRAGMENT pbuz1=_deref_qbuc1 +lda {c1} +sta {z1} +lda {c1}+1 +sta {z1}+1 +//FRAGMENT pvoz1=pvoz2 +lda {z2} +sta {z1} +lda {z2}+1 +sta {z1}+1 +//FRAGMENT vwuz1=_word__deref_pbuc1 +lda {c1} +sta {z1} +lda #0 +sta {z1}+1 +//FRAGMENT pbuz1=_deref_qbuc1_plus_vwuz2 +clc +lda {z2} +adc {c1} +sta {z1} +lda {z2}+1 +adc {c1}+1 +sta {z1}+1 +//FRAGMENT pbuz1=pbuz2_plus__deref_pwuc1 +clc +lda {c1} +adc {z2} +sta {z1} +lda {c1}+1 +adc {z2}+1 +sta {z1}+1 //FRAGMENT pbuz1_derefidx_vbuxx_neq_vbuc1_then_la1 txa tay @@ -2570,6 +2193,117 @@ sta {z1} bcc !+ inc {z1}+1 !: +//FRAGMENT vbuaa=pbuc1_derefidx_(_deref_pbuc2) +ldy {c2} +lda {c1},y +//FRAGMENT vbuxx=pbuc1_derefidx_(_deref_pbuc2) +ldy {c2} +ldx {c1},y +//FRAGMENT vbuyy=pbuc1_derefidx_(_deref_pbuc2) +ldx {c2} +ldy {c1},x +//FRAGMENT _deref_pbuc1=vbuaa +sta {c1} +//FRAGMENT vbuaa=vbuz1_bxor_vbuc1 +lda #{c1} +eor {z1} +//FRAGMENT vbuxx=vbuz1_bxor_vbuc1 +lda #{c1} +eor {z1} +tax +//FRAGMENT vbuyy=vbuz1_bxor_vbuc1 +lda #{c1} +eor {z1} +tay +//FRAGMENT vbuz1=vbuxx_bxor_vbuc1 +txa +eor #{c1} +sta {z1} +//FRAGMENT vbuaa=vbuxx_bxor_vbuc1 +txa +eor #{c1} +//FRAGMENT vbuxx=vbuxx_bxor_vbuc1 +txa +eor #{c1} +tax +//FRAGMENT vbuyy=vbuxx_bxor_vbuc1 +txa +eor #{c1} +tay +//FRAGMENT vbuz1=vbuyy_bxor_vbuc1 +tya +eor #{c1} +sta {z1} +//FRAGMENT vbuaa=vbuyy_bxor_vbuc1 +tya +eor #{c1} +//FRAGMENT vbuxx=vbuyy_bxor_vbuc1 +tya +eor #{c1} +tax +//FRAGMENT vbuyy=vbuyy_bxor_vbuc1 +tya +eor #{c1} +tay +//FRAGMENT _deref_(_deref_qbuc1)=vbuaa +ldy {c1} +sty $fe +ldy {c1}+1 +sty $ff +ldy #0 +sta ($fe),y +//FRAGMENT _deref_(_deref_qbuc1)=vbuxx +txa +ldy {c1} +sty $fe +ldy {c1}+1 +sty $ff +ldy #0 +sta ($fe),y +//FRAGMENT _deref_(_deref_qbuc1)=vbuyy +tya +ldy {c1} +sty $fe +ldy {c1}+1 +sty $ff +ldy #0 +sta ($fe),y +//FRAGMENT _deref_pbuc1=vbuxx +stx {c1} +//FRAGMENT _deref_pbuc1=vbuyy +sty {c1} +//FRAGMENT pbuz1=pbuz2_plus_vwuz1 +lda {z1} +clc +adc {z2} +sta {z1} +lda {z1}+1 +adc {z2}+1 +sta {z1}+1 +//FRAGMENT pbuz1=_deref_qbuc1_plus_vwuz1 +clc +lda {z1} +adc {c1} +sta {z1} +lda {z1}+1 +adc {c1}+1 +sta {z1}+1 +//FRAGMENT pbuz1=pbuz1_plus_vwuc1 +clc +lda {z1} +adc #<{c1} +sta {z1} +lda {z1}+1 +adc #>{c1} +sta {z1}+1 +//FRAGMENT pbuz1=pbuz1_plus__deref_pwuc1 +clc +lda {c1} +adc {z1} +sta {z1} +lda {c1}+1 +adc {z1}+1 +sta {z1}+1 //FRAGMENT _deref_pbuz1_neq_vbuc1_then_la1 ldy #0 lda ({z1}),y @@ -3287,6 +3021,21 @@ sta {z1} lda #0 adc {z2}+1 sta {z1}+1 +//FRAGMENT vbuz1=vbuaa_rol_2 +asl +asl +sta {z1} +//FRAGMENT vbuaa=vbuaa_rol_2 +asl +asl +//FRAGMENT vbuxx=vbuaa_rol_2 +asl +asl +tax +//FRAGMENT vbuyy=vbuaa_rol_2 +asl +asl +tay //FRAGMENT pbuz1_derefidx_vbuc1=pbuc2_derefidx_vbuxx lda {c2},x ldy #{c1} @@ -4556,143 +4305,6 @@ lda #<{c1} sta {z1} lda #>{c1} sta {z1}+1 -//FRAGMENT _deref_pwsc1=vbsc2 -NO_SYNTHESIS -//FRAGMENT _deref_pwsc1=vwuc2 -NO_SYNTHESIS -//FRAGMENT _deref_pwsc1=vwsc2 -lda #<{c2} -sta {c1} -lda #>{c2} -sta {c1}+1 -//FRAGMENT vwsz1=vbsc1 -lda #<{c1} -sta {z1} -lda #>{c1} -sta {z1}+1 -//FRAGMENT pwsz1=pwsc1_plus_vwsz2 -clc -lda {z2} -adc #<{c1} -sta {z1} -lda {z2}+1 -adc #>{c1} -sta {z1}+1 -//FRAGMENT vwsz1=_deref_pwsz2 -ldy #0 -lda ({z2}),y -sta {z1} -iny -lda ({z2}),y -sta {z1}+1 -//FRAGMENT vdsz1=vdsz2 -lda {z2} -sta {z1} -lda {z2}+1 -sta {z1}+1 -lda {z2}+2 -sta {z1}+2 -lda {z2}+3 -sta {z1}+3 -//FRAGMENT vwsz1=_sword_vdsz2 -lda {z2} -sta {z1} -lda {z2}+1 -sta {z1}+1 -//FRAGMENT vwsz1_le_vwsz2_then_la1 -lda {z2} -cmp {z1} -lda {z2}+1 -sbc {z1}+1 -bvc !+ -eor #$80 -!: -bpl {la1} -//FRAGMENT vwsz1=_inc_vwsz1 -inc {z1} -bne !+ -inc {z1}+1 -!: -//FRAGMENT vwsz1_neq_0_then_la1 -lda {z1}+1 -bne {la1} -lda {z1} -bne {la1} -//FRAGMENT _deref_pwsz1=vwsz2 -ldy #0 -lda {z2} -sta ({z1}),y -iny -lda {z2}+1 -sta ({z1}),y -//FRAGMENT vwsz1_lt_vwsc1_then_la1 -lda {z1} -cmp #<{c1} -lda {z1}+1 -sbc #>{c1} -bvc !+ -eor #$80 -!: -bmi {la1} -//FRAGMENT vwsz1_ge_0_then_la1 -lda {z1}+1 -bpl {la1} -//FRAGMENT vwuz1=_hi_vduz2 -lda {z2}+2 -sta {z1} -lda {z2}+3 -sta {z1}+1 -//FRAGMENT vwuz1=vwuz2_minus_vwuz3 -lda {z2} -sec -sbc {z3} -sta {z1} -lda {z2}+1 -sbc {z3}+1 -sta {z1}+1 -//FRAGMENT vduz1=vduz1_sethi_vwuz2 -lda {z2} -sta {z1}+2 -lda {z2}+1 -sta {z1}+3 -//FRAGMENT vwsz1=_neg_vwsz2 -sec -lda #0 -sbc {z2} -sta {z1} -lda #0 -sbc {z2}+1 -sta {z1}+1 -//FRAGMENT vbuz1=vbuz1_bxor_vbuc1 -lda #{c1} -eor {z1} -sta {z1} -//FRAGMENT vwuz1_lt_vwuz2_then_la1 -lda {z1}+1 -cmp {z2}+1 -bcc {la1} -bne !+ -lda {z1} -cmp {z2} -bcc {la1} -!: -//FRAGMENT pwsz1=pwsc1_plus_vwsz1 -clc -lda {z1} -adc #<{c1} -sta {z1} -lda {z1}+1 -adc #>{c1} -sta {z1}+1 -//FRAGMENT vwsz1=_deref_pwsz1 -ldy #0 -lda ({z1}),y -pha -iny -lda ({z1}),y -sta {z1}+1 -pla -sta {z1} //FRAGMENT pprz1=pprz2 lda {z2} sta {z1} @@ -5163,6 +4775,15 @@ ldx {c1}+1 ldy {c1} //FRAGMENT vbuyy=_hi__deref_pwuc1 ldy {c1}+1 +//FRAGMENT vwsz1_lt_vwsc1_then_la1 +lda {z1} +cmp #<{c1} +lda {z1}+1 +sbc #>{c1} +bvc !+ +eor #$80 +!: +bmi {la1} //FRAGMENT pbuz1=pbuz2_plus_vwsz3 lda {z2} clc @@ -5181,6 +4802,15 @@ sta {z1} lda #>{c1} sbc {z2}+1 sta {z1}+1 +//FRAGMENT vwsz1_le_vwsz2_then_la1 +lda {z2} +cmp {z1} +lda {z2}+1 +sbc {z1}+1 +bvc !+ +eor #$80 +!: +bpl {la1} //FRAGMENT vwsz1=vwsz1_minus_1 sec lda {z1} @@ -5238,6 +4868,11 @@ sta {z1} lda #>{c1} sbc {z2}+1 sta {z1}+1 +//FRAGMENT vwsz1=_inc_vwsz1 +inc {z1} +bne !+ +inc {z1}+1 +!: //FRAGMENT vwsz1_gt_vwsc1_then_la1 lda #<{c1} cmp {z1} @@ -5845,442 +5480,6 @@ sta {z1}+1 lda #{c1} cmp {c2} bne {la1} -//FRAGMENT vwuz1=vbuz2_word_vbuc1 -lda {z2} -ldy #{c1} -sta {z1}+1 -sty {z1} -//FRAGMENT vwuz1=vwuz2_plus_vbuc1 -lda #{c1} -clc -adc {z2} -sta {z1} -lda #0 -adc {z2}+1 -sta {z1}+1 -//FRAGMENT vbuz1=vbuz2_minus__deref_pbuz3 -lda {z2} -sec -ldy #0 -sbc ({z3}),y -sta {z1} -//FRAGMENT vbsz1=_inc_vbsz1 -inc {z1} -//FRAGMENT vbsz1_neq_vbsc1_then_la1 -lda #{c1} -cmp {z1} -bne {la1} -//FRAGMENT vbuz1=pbuz2_derefidx_vbuz3_rol_4 -ldy {z3} -lda ({z2}),y -asl -asl -asl -asl -sta {z1} -//FRAGMENT vbuz1=pbuz2_derefidx_vbuz3_rol_1 -ldy {z3} -lda ({z2}),y -asl -sta {z1} -//FRAGMENT vwuz1=vwuz2_ror_1 -lda {z2}+1 -lsr -sta {z1}+1 -lda {z2} -ror -sta {z1} -//FRAGMENT vwuz1=_neg_vwuz1 -sec -lda #0 -sbc {z1} -sta {z1} -lda #0 -sbc {z1}+1 -sta {z1}+1 -//FRAGMENT vwsz1=vwsz1_ror_1 -lda {z1}+1 -cmp #$80 -ror {z1}+1 -ror {z1} -//FRAGMENT vwsz1=vwsz1_minus_vwsz2 -lda {z1} -sec -sbc {z2} -sta {z1} -lda {z1}+1 -sbc {z2}+1 -sta {z1}+1 -//FRAGMENT vwuz1=vwuz1_minus_pwuc1_derefidx_vbuz2 -ldy {z2} -sec -lda {z1} -sbc {c1},y -sta {z1} -lda {z1}+1 -sbc {c1}+1,y -sta {z1}+1 -//FRAGMENT vwuz1=vwuz1_plus_pwuc1_derefidx_vbuz2 -ldy {z2} -clc -lda {z1} -adc {c1},y -sta {z1} -lda {z1}+1 -adc {c1}+1,y -sta {z1}+1 -//FRAGMENT vwsz1=vwsz1_ror_2 -lda {z1}+1 -cmp #$80 -ror {z1}+1 -ror {z1} -lda {z1}+1 -cmp #$80 -ror {z1}+1 -ror {z1} -//FRAGMENT vbuz1=vbuz1_minus_2 -dec {z1} -dec {z1} -//FRAGMENT vwuz1=vbuaa_word_vbuc1 -ldy #{c1} -sta {z1}+1 -sty {z1} -//FRAGMENT vwuz1=vbuxx_word_vbuc1 -ldy #{c1} -txa -sta {z1}+1 -sty {z1} -//FRAGMENT vwuz1=vbuyy_word_vbuc1 -tya -ldy #{c1} -sta {z1}+1 -sty {z1} -//FRAGMENT vwuz1=vwuz1_plus_vbuaa -clc -adc {z1} -sta {z1} -bcc !+ -inc {z1}+1 -!: -//FRAGMENT vbuz1=vbuxx_minus__deref_pbuz2 -txa -sec -ldy #0 -sbc ({z2}),y -sta {z1} -//FRAGMENT vbuaa=vbuz1_minus__deref_pbuz2 -lda {z1} -sec -ldy #0 -sbc ({z2}),y -//FRAGMENT vbuaa=vbuxx_minus__deref_pbuz1 -txa -sec -ldy #0 -sbc ({z1}),y -//FRAGMENT vbuxx=vbuz1_minus__deref_pbuz2 -lda {z1} -sec -ldy #0 -sbc ({z2}),y -tax -//FRAGMENT vbuxx=vbuxx_minus__deref_pbuz1 -txa -sec -ldy #0 -sbc ({z1}),y -tax -//FRAGMENT vbuyy=vbuz1_minus__deref_pbuz2 -lda {z1} -sec -ldy #0 -sbc ({z2}),y -tay -//FRAGMENT vbuyy=vbuxx_minus__deref_pbuz1 -txa -sec -ldy #0 -sbc ({z1}),y -tay -//FRAGMENT vbsxx_neq_vbsc1_then_la1 -cpx #{c1} -bne {la1} -//FRAGMENT vbuaa=pbuz1_derefidx_vbuz2_rol_4 -ldy {z2} -lda ({z1}),y -asl -asl -asl -asl -//FRAGMENT vbuxx=pbuz1_derefidx_vbuz2_rol_4 -ldy {z2} -lda ({z1}),y -asl -asl -asl -asl -tax -//FRAGMENT vbuyy=pbuz1_derefidx_vbuz2_rol_4 -ldy {z2} -lda ({z1}),y -asl -asl -asl -asl -tay -//FRAGMENT vbuz1=pbuz2_derefidx_vbuaa_rol_4 -tay -lda ({z2}),y -asl -asl -asl -asl -sta {z1} -//FRAGMENT vbuaa=pbuz1_derefidx_vbuaa_rol_4 -tay -lda ({z1}),y -asl -asl -asl -asl -//FRAGMENT vbuxx=pbuz1_derefidx_vbuaa_rol_4 -tay -lda ({z1}),y -asl -asl -asl -asl -tax -//FRAGMENT vbuyy=pbuz1_derefidx_vbuaa_rol_4 -tay -lda ({z1}),y -asl -asl -asl -asl -tay -//FRAGMENT vbuz1=pbuz2_derefidx_vbuxx_rol_4 -txa -tay -lda ({z2}),y -asl -asl -asl -asl -sta {z1} -//FRAGMENT vbuaa=pbuz1_derefidx_vbuxx_rol_4 -txa -tay -lda ({z1}),y -asl -asl -asl -asl -//FRAGMENT vbuxx=pbuz1_derefidx_vbuxx_rol_4 -txa -tay -lda ({z1}),y -asl -asl -asl -asl -tax -//FRAGMENT vbuyy=pbuz1_derefidx_vbuxx_rol_4 -txa -tay -lda ({z1}),y -asl -asl -asl -asl -tay -//FRAGMENT vbuz1=pbuz2_derefidx_vbuyy_rol_4 -lda ({z2}),y -asl -asl -asl -asl -sta {z1} -//FRAGMENT vbuaa=pbuz1_derefidx_vbuyy_rol_4 -lda ({z1}),y -asl -asl -asl -asl -//FRAGMENT vbuxx=pbuz1_derefidx_vbuyy_rol_4 -lda ({z1}),y -asl -asl -asl -asl -tax -//FRAGMENT vbuyy=pbuz1_derefidx_vbuyy_rol_4 -lda ({z1}),y -asl -asl -asl -asl -tay -//FRAGMENT vbuaa=pbuz1_derefidx_vbuz2_rol_1 -ldy {z2} -lda ({z1}),y -asl -//FRAGMENT vbuxx=pbuz1_derefidx_vbuz2_rol_1 -ldy {z2} -lda ({z1}),y -asl -tax -//FRAGMENT vbuyy=pbuz1_derefidx_vbuz2_rol_1 -ldy {z2} -lda ({z1}),y -asl -tay -//FRAGMENT vbuz1=pbuz2_derefidx_vbuxx_rol_1 -txa -tay -lda ({z2}),y -asl -sta {z1} -//FRAGMENT vbuaa=pbuz1_derefidx_vbuxx_rol_1 -txa -tay -lda ({z1}),y -asl -//FRAGMENT vbuxx=pbuz1_derefidx_vbuxx_rol_1 -txa -tay -lda ({z1}),y -asl -tax -//FRAGMENT vbuyy=pbuz1_derefidx_vbuxx_rol_1 -txa -tay -lda ({z1}),y -asl -tay -//FRAGMENT vbuz1=pbuz2_derefidx_vbuyy_rol_1 -lda ({z2}),y -asl -sta {z1} -//FRAGMENT vbuaa=pbuz1_derefidx_vbuyy_rol_1 -lda ({z1}),y -asl -//FRAGMENT vbuxx=pbuz1_derefidx_vbuyy_rol_1 -lda ({z1}),y -asl -tax -//FRAGMENT vbuyy=pbuz1_derefidx_vbuyy_rol_1 -lda ({z1}),y -asl -tay -//FRAGMENT pbuz1_derefidx_vbuxx=vbuz2 -txa -tay -lda {z2} -sta ({z1}),y -//FRAGMENT pbuz1_derefidx_vbuyy=vbuz2 -lda {z2} -sta ({z1}),y -//FRAGMENT vwuz1=vwuz1_minus_pwuc1_derefidx_vbuaa -tay -sec -lda {z1} -sbc {c1},y -sta {z1} -lda {z1}+1 -sbc {c1}+1,y -sta {z1}+1 -//FRAGMENT vwuz1=vwuz1_minus_pwuc1_derefidx_vbuxx -sec -lda {z1} -sbc {c1},x -sta {z1} -lda {z1}+1 -sbc {c1}+1,x -sta {z1}+1 -//FRAGMENT vwuz1=vwuz1_minus_pwuc1_derefidx_vbuyy -sec -lda {z1} -sbc {c1},y -sta {z1} -lda {z1}+1 -sbc {c1}+1,y -sta {z1}+1 -//FRAGMENT vwuz1=vwuz1_plus_pwuc1_derefidx_vbuaa -tay -clc -lda {z1} -adc {c1},y -sta {z1} -lda {z1}+1 -adc {c1}+1,y -sta {z1}+1 -//FRAGMENT vwuz1=vwuz1_plus_pwuc1_derefidx_vbuxx -clc -lda {z1} -adc {c1},x -sta {z1} -lda {z1}+1 -adc {c1}+1,x -sta {z1}+1 -//FRAGMENT vwuz1=vwuz1_plus_pwuc1_derefidx_vbuyy -clc -lda {z1} -adc {c1},y -sta {z1} -lda {z1}+1 -adc {c1}+1,y -sta {z1}+1 -//FRAGMENT vbuz1_lt_vbuaa_then_la1 -cmp {z1} -beq !+ -bcs {la1} -!: -//FRAGMENT vbuxx=vbuxx_minus_2 -dex -dex -//FRAGMENT vbuyy=vbuyy_minus_2 -dey -dey -//FRAGMENT vbuz1=vbuz2_bor_vbuyy -tya -ora {z2} -sta {z1} -//FRAGMENT vbuaa=vbuz1_bor_vbuyy -tya -ora {z1} -//FRAGMENT vbuxx=vbuz1_bor_vbuyy -tya -ora {z1} -tax -//FRAGMENT vbuyy=vbuz1_bor_vbuyy -tya -ora {z1} -tay -//FRAGMENT pbuz1_derefidx_vbuxx=vbuyy -stx $ff -tya -ldy $ff -sta ({z1}),y -//FRAGMENT vbuz1_lt_vbuyy_then_la1 -cpy {z1} -beq !+ -bcs {la1} -!: -//FRAGMENT vbuxx_lt_vbuyy_then_la1 -sty $ff -cpx $ff -bcc {la1} -//FRAGMENT pbuz1_derefidx_vbuyy=vbuaa -sta ({z1}),y -//FRAGMENT vwuz1=vwuz1_plus_vbuc1 -lda #{c1} -clc -adc {z1} -sta {z1} -bcc !+ -inc {z1}+1 -!: //FRAGMENT vbuz1_eq_vbuxx_then_la1 cpx {z1} beq {la1} @@ -6574,6 +5773,21 @@ asl asl asl tay +//FRAGMENT vbuz1=vbuz2_bor_vbuyy +tya +ora {z2} +sta {z1} +//FRAGMENT vbuaa=vbuz1_bor_vbuyy +tya +ora {z1} +//FRAGMENT vbuxx=vbuz1_bor_vbuyy +tya +ora {z1} +tax +//FRAGMENT vbuyy=vbuz1_bor_vbuyy +tya +ora {z1} +tay //FRAGMENT vbuz1=vbuaa_bor_vbuz2 ora {z2} sta {z1} @@ -6615,11 +5829,21 @@ tay sty $ff ora $ff tay +//FRAGMENT pbuz1_derefidx_vbuxx=vbuz2 +txa +tay +lda {z2} +sta ({z1}),y +//FRAGMENT pbuz1_derefidx_vbuyy=vbuz2 +lda {z2} +sta ({z1}),y //FRAGMENT vbuz1=vbuxx_bor_vbuyy txa sty $ff ora $ff sta {z1} +//FRAGMENT pbuz1_derefidx_vbuyy=vbuaa +sta ({z1}),y //FRAGMENT vbuaa=vbuxx_bor_vbuyy txa sty $ff @@ -6636,6 +5860,11 @@ txa sty $ff ora $ff tax +//FRAGMENT pbuz1_derefidx_vbuxx=vbuyy +stx $ff +tya +ldy $ff +sta ({z1}),y //FRAGMENT vbuyy=vbuyy_bor_vbuxx txa sty $ff @@ -6788,6 +6017,13 @@ bne {la1} lda {z1} cmp #<{c1} bne {la1} +//FRAGMENT vwuz1_neq_vwuc1_then_la1 +lda {z1}+1 +cmp #>{c1} +bne {la1} +lda {z1} +cmp #<{c1} +bne {la1} //FRAGMENT vbuz1=vbuc1_bor_vbuaa ora #{c1} sta {z1} @@ -6840,6 +6076,14 @@ tay tya ora #{c1} tay +//FRAGMENT vwuz1=vwuz1_plus_vbuc1 +lda #{c1} +clc +adc {z1} +sta {z1} +bcc !+ +inc {z1}+1 +!: //FRAGMENT vwuz1_gt_vbuc1_then_la1 lda {z1}+1 bne {la1} @@ -6975,346 +6219,6 @@ tax ldx #{c1} //FRAGMENT vbsxx=_dec_vbsxx dex -//FRAGMENT vduz1=vduz2_minus_vduc1 -lda {z2} -sec -sbc #<{c1} -sta {z1} -lda {z2}+1 -sbc #>{c1} -sta {z1}+1 -lda {z2}+2 -sbc #<{c1}>>$10 -sta {z1}+2 -lda {z2}+3 -sbc #>{c1}>>$10 -sta {z1}+3 -//FRAGMENT _deref_pduc1=vduc2 -lda #<{c2} -sta {c1} -lda #>{c2} -sta {c1}+1 -lda #<{c2}>>$10 -sta {c1}+2 -lda #>{c2}>>$10 -sta {c1}+3 -//FRAGMENT vbuz1=vbuc1_minus_vbuz2 -lda #{c1} -sec -sbc {z2} -sta {z1} -//FRAGMENT vduz1=vduc1_minus__deref_pduc2 -lda #<{c1} -sec -sbc {c2} -sta {z1} -lda #>{c1} -sbc {c2}+1 -sta {z1}+1 -lda #<{c1}>>$10 -sbc {c2}+2 -sta {z1}+2 -lda #>{c1}>>$10 -sbc {c2}+3 -sta {z1}+3 -//FRAGMENT pwuz1=pwuc1 -lda #<{c1} -sta {z1} -lda #>{c1} -sta {z1}+1 -//FRAGMENT _deref_pwuz1=vwuz2 -ldy #0 -lda {z2} -sta ({z1}),y -iny -lda {z2}+1 -sta ({z1}),y -//FRAGMENT pwuz1=pwuz1_plus_vbuc1 -lda #{c1} -clc -adc {z1} -sta {z1} -bcc !+ -inc {z1}+1 -!: -//FRAGMENT pwuz1=pwuz2 -lda {z2} -sta {z1} -lda {z2}+1 -sta {z1}+1 -//FRAGMENT vwuz1=pwuz2_minus_pwuc1 -lda {z2} -sec -sbc #<{c1} -sta {z1} -lda {z2}+1 -sbc #>{c1} -sta {z1}+1 -//FRAGMENT _deref_pwuz1_le_vwuz2_then_la1 -ldy #1 -lda ({z1}),y -cmp {z2}+1 -bne !+ -dey -lda ({z1}),y -cmp {z2} -beq {la1} -!: -bcc {la1} -//FRAGMENT pwuz1=pwuz1_minus_vbuc1 -sec -lda {z1} -sbc #{c1} -sta {z1} -lda {z1}+1 -sbc #0 -sta {z1}+1 -//FRAGMENT vbuz1=vbuz2_ror_1 -lda {z2} -lsr -sta {z1} -//FRAGMENT pwuz1=pwuz2_plus_vbuz3 -lda {z3} -clc -adc {z2} -sta {z1} -lda #0 -adc {z2}+1 -sta {z1}+1 -//FRAGMENT vwsz1=vwsz2_minus__deref_pwsz3 -sec -lda {z2} -ldy #0 -sbc ({z3}),y -sta {z1} -lda {z2}+1 -iny -sbc ({z3}),y -sta {z1}+1 -//FRAGMENT vwsz1_le_0_then_la1 -lda {z1}+1 -bmi {la1} -bne !+ -lda {z1} -beq {la1} -!: -//FRAGMENT pwuz1=pwuz2_plus_vbuc1 -lda #{c1} -clc -adc {z2} -sta {z1} -lda #0 -adc {z2}+1 -sta {z1}+1 -//FRAGMENT pbuz1=pbuz2_plus_1 -clc -lda {z2} -adc #1 -sta {z1} -lda {z2}+1 -adc #0 -sta {z1}+1 -//FRAGMENT vbuaa=vbuc1_minus_vbuz1 -lda #{c1} -sec -sbc {z1} -//FRAGMENT vbuxx=vbuc1_minus_vbuz1 -lda #{c1} -sec -sbc {z1} -tax -//FRAGMENT vbuyy=vbuc1_minus_vbuz1 -lda #{c1} -sec -sbc {z1} -tay -//FRAGMENT vbuz1=vbuc1_minus_vbuaa -eor #$ff -sec -adc #{c1} -sta {z1} -//FRAGMENT vbuaa=vbuc1_minus_vbuaa -eor #$ff -sec -adc #{c1} -//FRAGMENT vbuxx=vbuc1_minus_vbuaa -eor #$ff -tax -axs #-{c1}-1 -//FRAGMENT vbuyy=vbuc1_minus_vbuaa -eor #$ff -sec -adc #{c1} -tay -//FRAGMENT vbuz1=vbuc1_minus_vbuxx -txa -eor #$ff -sec -adc #{c1} -sta {z1} -//FRAGMENT vbuaa=vbuc1_minus_vbuxx -txa -eor #$ff -sec -adc #{c1} -//FRAGMENT vbuxx=vbuc1_minus_vbuxx -txa -eor #$ff -tax -axs #-{c1}-1 -//FRAGMENT vbuyy=vbuc1_minus_vbuxx -txa -eor #$ff -sec -adc #{c1} -tay -//FRAGMENT vbuz1=vbuc1_minus_vbuyy -tya -eor #$ff -sec -adc #{c1} -sta {z1} -//FRAGMENT vbuaa=vbuc1_minus_vbuyy -tya -eor #$ff -sec -adc #{c1} -//FRAGMENT vbuxx=vbuc1_minus_vbuyy -tya -eor #$ff -tax -axs #-{c1}-1 -//FRAGMENT vbuyy=vbuc1_minus_vbuyy -tya -eor #$ff -sec -adc #{c1} -tay -//FRAGMENT pbuz1_derefidx_vbuxx=vbuxx -txa -tay -sta ({z1}),y -//FRAGMENT vbuaa=vbuz1_ror_1 -lda {z1} -lsr -//FRAGMENT vbuxx=vbuz1_ror_1 -lda {z1} -lsr -tax -//FRAGMENT vbuyy=vbuz1_ror_1 -lda {z1} -lsr -tay -//FRAGMENT vbuz1=vbuaa_ror_1 -lsr -sta {z1} -//FRAGMENT vbuaa=vbuaa_ror_1 -lsr -//FRAGMENT vbuxx=vbuaa_ror_1 -lsr -tax -//FRAGMENT vbuyy=vbuaa_ror_1 -lsr -tay -//FRAGMENT vbuz1=vbuxx_ror_1 -txa -lsr -sta {z1} -//FRAGMENT vbuaa=vbuxx_ror_1 -txa -lsr -//FRAGMENT vbuyy=vbuxx_ror_1 -txa -lsr -tay -//FRAGMENT vbuz1=vbuyy_ror_1 -tya -lsr -sta {z1} -//FRAGMENT vbuaa=vbuyy_ror_1 -tya -lsr -//FRAGMENT vbuxx=vbuyy_ror_1 -tya -lsr -tax -//FRAGMENT pwuz1=pwuz2_plus_vbuaa -clc -adc {z2} -sta {z1} -lda #0 -adc {z2}+1 -sta {z1}+1 -//FRAGMENT pwuz1=pwuz2_plus_vbuxx -txa -clc -adc {z2} -sta {z1} -lda #0 -adc {z2}+1 -sta {z1}+1 -//FRAGMENT pwuz1=pwuz2_plus_vbuyy -tya -clc -adc {z2} -sta {z1} -lda #0 -adc {z2}+1 -sta {z1}+1 -//FRAGMENT vbuaa=vbuaa_plus_1 -clc -adc #1 -//FRAGMENT vbuaa=vbuxx_plus_1 -inx -txa -//FRAGMENT vbuaa=vbuyy_plus_1 -iny -tya -//FRAGMENT vbuxx=vbuaa_plus_1 -tax -inx -//FRAGMENT vbuxx=vbuxx_plus_1 -inx -//FRAGMENT vbuxx=vbuyy_plus_1 -tya -tax -inx -//FRAGMENT vbuyy=vbuaa_plus_1 -tay -iny -//FRAGMENT vbuyy=vbuxx_plus_1 -txa -tay -iny -//FRAGMENT vbuyy=vbuyy_plus_1 -iny -//FRAGMENT vbuxx=pbuc1_derefidx_vbuxx -lda {c1},x -tax -//FRAGMENT vbuxx=pbuc1_derefidx_vbuyy -ldx {c1},y -//FRAGMENT vwuz1=pwuz1_minus_pwuc1 -lda {z1} -sec -sbc #<{c1} -sta {z1} -lda {z1}+1 -sbc #>{c1} -sta {z1}+1 -//FRAGMENT vduz1=vduz1_minus_vduc1 -lda {z1} -sec -sbc #<{c1} -sta {z1} -lda {z1}+1 -sbc #>{c1} -sta {z1}+1 -lda {z1}+2 -sbc #<{c1}>>$10 -sta {z1}+2 -lda {z1}+3 -sbc #>{c1}>>$10 -sta {z1}+3 //FRAGMENT pbuz1=_dec_pbuz1 lda {z1} bne !+ @@ -7325,6 +6229,10 @@ dec {z1} tsx lda STACK_BASE+{c1},x sta {z1} +//FRAGMENT vbuz1=vbuz2_ror_1 +lda {z2} +lsr +sta {z1} //FRAGMENT _stackidxbyte_vbuc1=vbuz1 lda {z1} tsx @@ -7351,6 +6259,50 @@ tax tsx lda STACK_BASE+{c1},x tay +//FRAGMENT vbuz1=vbuaa_ror_1 +lsr +sta {z1} +//FRAGMENT vbuz1=vbuxx_ror_1 +txa +lsr +sta {z1} +//FRAGMENT vbuz1=vbuyy_ror_1 +tya +lsr +sta {z1} +//FRAGMENT vbuaa=vbuz1_ror_1 +lda {z1} +lsr +//FRAGMENT vbuaa=vbuaa_ror_1 +lsr +//FRAGMENT vbuaa=vbuxx_ror_1 +txa +lsr +//FRAGMENT vbuaa=vbuyy_ror_1 +tya +lsr +//FRAGMENT vbuxx=vbuz1_ror_1 +lda {z1} +lsr +tax +//FRAGMENT vbuxx=vbuaa_ror_1 +lsr +tax +//FRAGMENT vbuxx=vbuyy_ror_1 +tya +lsr +tax +//FRAGMENT vbuyy=vbuz1_ror_1 +lda {z1} +lsr +tay +//FRAGMENT vbuyy=vbuaa_ror_1 +lsr +tay +//FRAGMENT vbuyy=vbuxx_ror_1 +txa +lsr +tay //FRAGMENT _stackidxbyte_vbuc1=vbuxx txa tsx @@ -7382,6 +6334,10 @@ tsx txa axs #-4 txs +//FRAGMENT vbuyy=vbuxx_plus_1 +txa +tay +iny //FRAGMENT pbuz1=_stackidxptr_vbuc1 tsx lda STACK_BASE+{c1},x @@ -7421,6 +6377,13 @@ sbc #1 //FRAGMENT vbuxx=vbuaa_minus_1 tax dex +//FRAGMENT vbuaa=vbuaa_plus_1 +clc +adc #1 +//FRAGMENT vbuxx=vbuxx_plus_1 +inx +//FRAGMENT vbuyy=vbuyy_plus_1 +iny //FRAGMENT vbuz1=_lo_pbuz2 lda {z2} sta {z1} @@ -7576,69 +6539,6 @@ ora {z3} sta {z1} //FRAGMENT vbuyy=_hi_pbuz1 ldy {z1}+1 -//FRAGMENT vwuz1_eq_0_then_la1 -lda {z1} -bne !+ -lda {z1}+1 -beq {la1} -!: -//FRAGMENT vwuz1_gt_vwuz2_then_la1 -lda {z2}+1 -cmp {z1}+1 -bcc {la1} -bne !+ -lda {z2} -cmp {z1} -bcc {la1} -!: -//FRAGMENT vwuz1_neq_vwuz2_then_la1 -lda {z1}+1 -cmp {z2}+1 -bne {la1} -lda {z1} -cmp {z2} -bne {la1} -//FRAGMENT vwuz1=vwuz2_band_vwuc1 -lda {z2} -and #<{c1} -sta {z1} -lda {z2}+1 -and #>{c1} -sta {z1}+1 -//FRAGMENT _deref_pbuz1=_deref_pbuz1_bor_pbuc1_derefidx_vbuz2 -ldy #0 -lda ({z1}),y -ldy {z2} -ora {c1},y -ldy #0 -sta ({z1}),y -//FRAGMENT _deref_pbuz1=_deref_pbuz1_bor_pbuc1_derefidx_vbuaa -tay -lda {c1},y -ldy #0 -ora ({z1}),y -ldy #0 -sta ({z1}),y -//FRAGMENT _deref_pbuz1=_deref_pbuz1_bor_pbuc1_derefidx_vbuxx -lda {c1},x -ldy #0 -ora ({z1}),y -ldy #0 -sta ({z1}),y -//FRAGMENT _deref_pbuz1=_deref_pbuz1_bor_pbuc1_derefidx_vbuyy -lda {c1},y -ldy #0 -ora ({z1}),y -ldy #0 -sta ({z1}),y -//FRAGMENT pbuz1=pbuz1_plus_vwuz2 -lda {z1} -clc -adc {z2} -sta {z1} -lda {z1}+1 -adc {z2}+1 -sta {z1}+1 //FRAGMENT pbuc1_derefidx_vbuz1_neq_0_then_la1 ldy {z1} lda {c1},y @@ -7657,826 +6557,28 @@ bne {la1} lda {c1},y cmp #0 bne {la1} -//FRAGMENT pbuz1=pbuz2_minus_vwuc1 -lda {z2} -sec -sbc #<{c1} -sta {z1} -lda {z2}+1 -sbc #>{c1} -sta {z1}+1 -//FRAGMENT pssz1=pssc1_plus_vbuz2 -lda {z2} -clc -adc #<{c1} -sta {z1} -lda #>{c1} -adc #0 -sta {z1}+1 -//FRAGMENT vbuz1=vbuc1_rol_pbuz2_derefidx_vbuc2 -ldy #{c2} -lda ({z2}),y -tay -lda #{c1} -cpy #0 -beq !e+ -!: -asl -dey -bne !- -!e: -sta {z1} -//FRAGMENT pbuz1_derefidx_vbuc1_eq_vbuc2_then_la1 -lda #{c2} -ldy #{c1} -cmp ({z1}),y -beq {la1} -//FRAGMENT pbuz1_derefidx_vbuc1_neq_vbuc2_then_la1 -ldy #{c1} -lda ({z1}),y - -cmp #{c2} -bne {la1} -//FRAGMENT _deref_(qbuz1_derefidx_vbuc1)=vbuc2 -ldx #{c2} -ldy #{c1} -lda ({z1}),y -sta !+ +1 -iny -lda ({z1}),y -sta !+ +2 -!: stx $ffff -//FRAGMENT pbuc1_derefidx_(pbuz1_derefidx_vbuc2)=pbuz1_derefidx_vbuc3 -ldy #{c3} -lda ({z1}),y -ldy #{c2} -pha -lda ({z1}),y -tay -pla -sta {c1},y -//FRAGMENT vwuz1=_deref_pwuz2_ror_4 -ldy #0 -lda ({z2}),y -sta {z1} -iny -lda ({z2}),y -sta {z1}+1 -lsr {z1}+1 -ror {z1} -lsr {z1}+1 -ror {z1} -lsr {z1}+1 -ror {z1} -lsr {z1}+1 -ror {z1} -//FRAGMENT vbuz1=vbuc1_bxor_vbuz2 -lda #{c1} -eor {z2} -sta {z1} -//FRAGMENT pbuc1_derefidx_vbuz1=_byte_vwuz2 -ldy {z1} -lda {z2} -sta {c1},y -//FRAGMENT vwuz1=pwuz2_derefidx_vbuc1_ror_4 -ldy #{c1} -lda ({z2}),y -sta {z1} -iny -lda ({z2}),y -sta {z1}+1 -lsr {z1}+1 -ror {z1} -lsr {z1}+1 -ror {z1} -lsr {z1}+1 -ror {z1} -lsr {z1}+1 -ror {z1} -//FRAGMENT _deref_pwuz1_lt_vwuc1_then_la1 -ldy #1 -lda ({z1}),y -cmp #>{c1} -bcc {la1} -bne !+ -dey -lda ({z1}),y -cmp #<{c1} -bcc {la1} -!: -//FRAGMENT _deref_pwuz1_gt_vwuc1_then_la1 -ldy #1 -lda #>{c1} -cmp ({z1}),y -bcc {la1} -bne !+ -dey -lda #<{c1} -cmp ({z1}),y -bcc {la1} -!: -//FRAGMENT pwuz1_derefidx_vbuc1_lt_vwuc2_then_la1 -ldy #{c1} -iny -lda ({z1}),y -cmp #>{c2} -bcc {la1} -bne !+ -dey -lda ({z1}),y -cmp #<{c2} -bcc {la1} -!: -//FRAGMENT pwuz1_derefidx_vbuc1_gt_vwuc2_then_la1 -ldy #{c1} -iny -lda #>{c2} -cmp ({z1}),y -bcc {la1} -bne !+ -dey -lda #<{c2} -cmp ({z1}),y -bcc {la1} -!: -//FRAGMENT vwuz1=vwuz2_ror_3 -lda {z2}+1 -lsr -sta {z1}+1 -lda {z2} -ror -sta {z1} -lsr {z1}+1 -ror {z1} -lsr {z1}+1 -ror {z1} -//FRAGMENT pwuz1_derefidx_vbuc1=pwuz1_derefidx_vbuc1_plus_pwuc2_derefidx_vbuz2 -ldx {z2} -ldy #{c1} -clc -lda ({z1}),y -adc {c2},x -sta ({z1}),y -iny -lda ({z1}),y -adc {c2}+1,x -sta ({z1}),y -//FRAGMENT _deref_pwuz1=_deref_pwuz1_plus_pwuz1_derefidx_vbuc1 -ldy #{c1} -sty $ff -clc -lda ({z1}),y -ldy #0 -adc ({z1}),y -sta ({z1}),y -ldy $ff -iny -lda ({z1}),y -ldy #1 -adc ({z1}),y -sta ({z1}),y -//FRAGMENT pwuz1_derefidx_vbuc1=pwuz1_derefidx_vbuc1_plus_pwuz1_derefidx_vbuc2 -ldy #{c2} -clc -lda ({z1}),y -ldy #{c1} -adc ({z1}),y -sta ({z1}),y -ldy #{c2}+1 -lda ({z1}),y -ldy #{c1}+1 -adc ({z1}),y -sta ({z1}),y -//FRAGMENT vbuz1=_neg_vbuz2 -lda {z2} -eor #$ff -clc -adc #$01 -sta {z1} -//FRAGMENT vbuz1=pbuz2_derefidx_vbuz3 -ldy {z3} -lda ({z2}),y -sta {z1} -//FRAGMENT pbuc1_derefidx_vbuz1_neq_vbuc2_then_la1 -lda #{c2} -ldy {z1} -cmp {c1},y -bne {la1} -//FRAGMENT vwuz1=vwuz2_rol_6 -lda {z2}+1 -lsr -sta $ff -lda {z2} -ror -sta {z1}+1 -lda #0 -ror -sta {z1} -lsr $ff -ror {z1}+1 -ror {z1} -//FRAGMENT vwuz1=vbuc1_plus_vwuz2 -lda #{c1} -clc -adc {z2} -sta {z1} -lda #0 -adc {z2}+1 -sta {z1}+1 -//FRAGMENT vwuz1=vwuz2_rol_4 -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 -//FRAGMENT pwuc1_derefidx_vbuz1=_word_vbuz2 -lda {z2} -ldy {z1} -sta {c1},y -lda #0 -sta {c1}+1,y -//FRAGMENT pwuc1_derefidx_vbuz1=vwuc2 -ldy {z1} -lda #<{c2} -sta {c1},y -lda #>{c2} -sta {c1}+1,y -//FRAGMENT qbuc1_derefidx_vbuz1=pbuz2 -ldy {z1} -lda {z2} -sta {c1},y -lda {z2}+1 -sta {c1}+1,y -//FRAGMENT pssz1=pssc1_plus_vbuaa -clc -adc #<{c1} -sta {z1} -lda #>{c1} -adc #0 -sta {z1}+1 -//FRAGMENT pssz1=pssc1_plus_vbuxx -txa -clc -adc #<{c1} -sta {z1} -lda #>{c1} -adc #0 -sta {z1}+1 -//FRAGMENT pssz1=pssc1_plus_vbuyy -tya -clc -adc #<{c1} -sta {z1} -lda #>{c1} -adc #0 -sta {z1}+1 -//FRAGMENT vbuaa=vbuc1_rol_pbuz1_derefidx_vbuc2 -ldy #{c2} -lda ({z1}),y -tay -lda #{c1} -cpy #0 -beq !e+ -!: -asl -dey -bne !- -!e: -//FRAGMENT vbuxx=vbuc1_rol_pbuz1_derefidx_vbuc2 -ldy #{c2} -lda ({z1}),y -tax -lda #{c1} -cpx #0 -beq !e+ -!: -asl -dex -bne !- -!e: -tax -//FRAGMENT vbuyy=vbuc1_rol_pbuz1_derefidx_vbuc2 -ldy #{c2} -lda ({z1}),y -tay -lda #{c1} -cpy #0 -beq !e+ -!: -asl -dey -bne !- -!e: -tay -//FRAGMENT vbuaa=vbuc1_bxor_vbuz1 -lda #{c1} -eor {z1} -//FRAGMENT vbuxx=vbuc1_bxor_vbuz1 -lda #{c1} -eor {z1} -tax -//FRAGMENT vbuyy=vbuc1_bxor_vbuz1 -lda #{c1} -eor {z1} -tay -//FRAGMENT pwuz1_derefidx_vbuc1=pwuz1_derefidx_vbuc1_plus_pwuc2_derefidx_vbuaa -ldy #{c1} -tax -clc -lda ({z1}),y -adc {c2},x -sta ({z1}),y -iny -lda ({z1}),y -adc {c2}+1,x -sta ({z1}),y -//FRAGMENT pwuz1_derefidx_vbuc1=pwuz1_derefidx_vbuc1_plus_pwuc2_derefidx_vbuxx -ldy #{c1} -clc -lda ({z1}),y -adc {c2},x -sta ({z1}),y -iny -lda ({z1}),y -adc {c2}+1,x -sta ({z1}),y -//FRAGMENT pwuz1_derefidx_vbuc1=pwuz1_derefidx_vbuc1_plus_pwuc2_derefidx_vbuyy -tya -ldy #{c1} -tax -clc -lda ({z1}),y -adc {c2},x -sta ({z1}),y -iny -lda ({z1}),y -adc {c2}+1,x -sta ({z1}),y -//FRAGMENT vbuz1=_neg_vbuaa -eor #$ff -clc -adc #$01 -sta {z1} -//FRAGMENT vbuz1=_neg_vbuxx -dex -txa -eor #$ff -sta {z1} -//FRAGMENT vbuaa=_neg_vbuz1 -lda {z1} -eor #$ff -clc -adc #$01 -//FRAGMENT vbuaa=_neg_vbuaa -eor #$ff -clc -adc #$01 -//FRAGMENT vbuaa=_neg_vbuxx -dex -txa -eor #$ff -//FRAGMENT vbuxx=_neg_vbuz1 -lda {z1} -eor #$ff -tax -inx -//FRAGMENT vbuxx=_neg_vbuaa -eor #$ff -tax -inx -//FRAGMENT vbuxx=_neg_vbuxx -dex -txa -eor #$ff -tax -//FRAGMENT vbuyy=_neg_vbuz1 -lda {z1} -eor #$ff -tay -iny -//FRAGMENT vbuyy=_neg_vbuaa -eor #$ff -tay -iny -//FRAGMENT vbuyy=_neg_vbuxx -txa -eor #$ff -tay -iny -//FRAGMENT vbuxx=pbuz1_derefidx_vbuz2 -ldy {z2} -lda ({z1}),y -tax -//FRAGMENT vbuyy=pbuz1_derefidx_vbuz2 -ldy {z2} -lda ({z1}),y -tay -//FRAGMENT vbuz1=pbuz2_derefidx_vbuxx +//FRAGMENT pbuz1_derefidx_vbuxx=vbuxx txa tay -lda ({z2}),y -sta {z1} -//FRAGMENT vbuxx=pbuz1_derefidx_vbuxx -txa -tay -lda ({z1}),y -tax -//FRAGMENT vbuyy=pbuz1_derefidx_vbuxx -txa -tay -lda ({z1}),y -tay -//FRAGMENT vbuz1=pbuz2_derefidx_vbuyy -lda ({z2}),y -sta {z1} -//FRAGMENT vbuxx=pbuz1_derefidx_vbuyy -lda ({z1}),y -tax -//FRAGMENT vbuyy=pbuz1_derefidx_vbuyy -lda ({z1}),y -tay -//FRAGMENT vbuaa_ge_vbuz1_then_la1 -cmp {z1} -bcs {la1} -//FRAGMENT pbuc1_derefidx_vbuaa_neq_vbuc2_then_la1 -tay -lda #{c2} -cmp {c1},y -bne {la1} -//FRAGMENT pbuc1_derefidx_vbuxx_neq_vbuc2_then_la1 -lda {c1},x -cmp #{c2} -bne {la1} -//FRAGMENT pbuc1_derefidx_vbuyy_neq_vbuc2_then_la1 -lda #{c2} -cmp {c1},y -bne {la1} -//FRAGMENT pwuc1_derefidx_vbuz1=_word_vbuxx -ldy {z1} -txa -sta {c1},y -lda #0 -sta {c1}+1,y -//FRAGMENT pwuc1_derefidx_vbuz1=_word_vbuyy -tya -ldy {z1} -sta {c1},y -lda #0 -sta {c1}+1,y -//FRAGMENT pwuc1_derefidx_vbuxx=_word_vbuz1 -lda {z1} -sta {c1},x -lda #0 -sta {c1}+1,x -//FRAGMENT pwuc1_derefidx_vbuxx=_word_vbuxx -txa -sta {c1},x -lda #0 -sta {c1}+1,x -//FRAGMENT pwuc1_derefidx_vbuxx=_word_vbuyy -tya -sta {c1},x -lda #0 -sta {c1}+1,x -//FRAGMENT pwuc1_derefidx_vbuyy=_word_vbuz1 -lda {z1} -sta {c1},y -lda #0 -sta {c1}+1,y -//FRAGMENT pwuc1_derefidx_vbuyy=_word_vbuxx -txa -sta {c1},y -lda #0 -sta {c1}+1,y -//FRAGMENT pwuc1_derefidx_vbuyy=_word_vbuyy -tya -sta {c1},y -lda #0 -sta {c1}+1,y -//FRAGMENT pwuc1_derefidx_vbuxx=vwuc2 -lda #<{c2} -sta {c1},x -lda #>{c2} -sta {c1}+1,x -//FRAGMENT pwuc1_derefidx_vbuyy=vwuc2 -lda #<{c2} -sta {c1},y -lda #>{c2} -sta {c1}+1,y -//FRAGMENT qbuc1_derefidx_vbuxx=pbuz1 -lda {z1} -sta {c1},x -lda {z1}+1 -sta {c1}+1,x -//FRAGMENT qbuc1_derefidx_vbuyy=pbuz1 -lda {z1} -sta {c1},y -lda {z1}+1 -sta {c1}+1,y -//FRAGMENT vbuyy_ge_vbuz1_then_la1 -cpy {z1} -bcs {la1} -//FRAGMENT vbuyy_ge_vbuxx_then_la1 -stx $ff -cpy $ff -bcs {la1} -//FRAGMENT vbuz1_ge_vbuyy_then_la1 -lda {z1} -sty $ff -cmp $ff -bcs {la1} -//FRAGMENT vbuxx_ge_vbuyy_then_la1 -sty $ff -cpx $ff -bcs {la1} -//FRAGMENT vwuz1=vwuz1_ror_3 -lsr {z1}+1 -ror {z1} -lsr {z1}+1 -ror {z1} -lsr {z1}+1 -ror {z1} -//FRAGMENT vwuz1=vwuz1_rol_4 -asl {z1} -rol {z1}+1 -asl {z1} -rol {z1}+1 -asl {z1} -rol {z1}+1 -asl {z1} -rol {z1}+1 -//FRAGMENT vwuz1=vwuz1_rol_6 -lda {z1}+1 -lsr -sta $ff -lda {z1} -ror -sta {z1}+1 -lda #0 -ror -sta {z1} -lsr $ff -ror {z1}+1 -ror {z1} -//FRAGMENT vwuz1=vbuc1_plus_vwuz1 -lda #{c1} -clc -adc {z1} -sta {z1} -bcc !+ -inc {z1}+1 -!: -//FRAGMENT pbuz1=pbuz2_minus_vwuz3 -lda {z2} -sec -sbc {z3} -sta {z1} -lda {z2}+1 -sbc {z3}+1 -sta {z1}+1 -//FRAGMENT pwuz1=qwuz2_derefidx_vbuz3 -ldy {z3} -lda ({z2}),y -sta {z1} -iny -lda ({z2}),y -sta {z1}+1 -//FRAGMENT vbuz1_le_0_then_la1 -lda {z1} -cmp #0 -beq {la1} -//FRAGMENT vwuz1_eq_vwuc1_then_la1 -lda {z1} -cmp #<{c1} -bne !+ -lda {z1}+1 -cmp #>{c1} -beq {la1} -!: -//FRAGMENT _deref_pbuc1=_dec__deref_pbuc1 -dec {c1} -//FRAGMENT vwuz1=pwuz2_derefidx_vbuz3 -ldy {z3} -lda ({z2}),y -sta {z1} -iny -lda ({z2}),y -sta {z1}+1 -//FRAGMENT _deref_pbuz1_gt_vbuz2_then_la1 -ldy #0 -lda ({z1}),y -cmp {z2} -beq !+ -bcs {la1} -!: -//FRAGMENT pbuz1_derefidx_(_deref_pbuz2)=_inc_pbuz1_derefidx_(_deref_pbuz2) -ldy #0 -lda ({z2}),y -tay -lda ({z1}),y -clc -adc #1 sta ({z1}),y -//FRAGMENT vwuz1=_deref_pbuz2_rol_1 -ldy #0 -lda ({z2}),y -asl -sta {z1} -lda #0 -rol -sta {z1}+1 -//FRAGMENT qwuz1=qwuz2_plus_vwuz3 -lda {z2} -clc -adc {z3} -sta {z1} -lda {z2}+1 -adc {z3}+1 -sta {z1}+1 -//FRAGMENT _deref_qwuz1=pwuz2 -ldy #0 -lda {z2} -sta ({z1}),y -iny -lda {z2}+1 -sta ({z1}),y -//FRAGMENT vwuz1_neq_vbuc1_then_la1 -NO_SYNTHESIS -//FRAGMENT vwuz1_neq_vbsc1_then_la1 -NO_SYNTHESIS -//FRAGMENT pwuz1=_deref_qwuz2 -ldy #0 -lda ({z2}),y -sta {z1} -iny -lda ({z2}),y -sta {z1}+1 -//FRAGMENT vwuz1=pbuz2_minus_pbuz3 -lda {z2} -sec -sbc {z3} -sta {z1} -lda {z2}+1 -sbc {z3}+1 -sta {z1}+1 -//FRAGMENT pwuz1_derefidx_vbuz2=vwuz3 -ldy {z2} -lda {z3} -sta ({z1}),y -iny -lda {z3}+1 -sta ({z1}),y -//FRAGMENT pbuz1_derefidx_vbuz2=_inc_pbuz1_derefidx_vbuz2 -ldy {z2} -lda ({z1}),y -clc -adc #1 -sta ({z1}),y -//FRAGMENT vwuz1=pwuz2_minus_pwuz3 -lda {z2} -sec -sbc {z3} -sta {z1} -lda {z2}+1 -sbc {z3}+1 -sta {z1}+1 -//FRAGMENT pwuz1=qwuz2_derefidx_vbuaa -tay -lda ({z2}),y -sta {z1} -iny -lda ({z2}),y -sta {z1}+1 -//FRAGMENT pwuz1=qwuz2_derefidx_vbuxx -txa -tay -lda ({z2}),y -sta {z1} -iny -lda ({z2}),y -sta {z1}+1 -//FRAGMENT pwuz1=qwuz2_derefidx_vbuyy -lda ({z2}),y -sta {z1} -iny -lda ({z2}),y -sta {z1}+1 -//FRAGMENT vbuaa_le_0_then_la1 -cmp #0 -beq {la1} -//FRAGMENT vwuz1=pwuz2_derefidx_vbuaa -tay -lda ({z2}),y -sta {z1} -iny -lda ({z2}),y -sta {z1}+1 -//FRAGMENT vwuz1=pwuz2_derefidx_vbuxx -txa -tay -lda ({z2}),y -sta {z1} -iny -lda ({z2}),y -sta {z1}+1 -//FRAGMENT vwuz1=pwuz2_derefidx_vbuyy -lda ({z2}),y -sta {z1} -iny -lda ({z2}),y -sta {z1}+1 -//FRAGMENT _deref_pbuz1_gt_vbuxx_then_la1 -ldy #0 -lda ({z1}),y -sta $ff -cpx $ff -bcc {la1} -//FRAGMENT pwuz1_derefidx_vbuaa=vwuz2 -tay -lda {z2} -sta ({z1}),y -iny -lda {z2}+1 -sta ({z1}),y -//FRAGMENT pwuz1_derefidx_vbuxx=vwuz2 -txa -tay -lda {z2} -sta ({z1}),y -iny -lda {z2}+1 -sta ({z1}),y -//FRAGMENT pwuz1_derefidx_vbuyy=vwuz2 -lda {z2} -sta ({z1}),y -iny -lda {z2}+1 -sta ({z1}),y -//FRAGMENT pbuz1_derefidx_vbuxx=_inc_pbuz1_derefidx_vbuxx -txa -tay -lda ({z1}),y -clc -adc #1 -sta ({z1}),y -//FRAGMENT vbuxx_le_0_then_la1 -cpx #0 -beq {la1} -//FRAGMENT pbuz1=pbuz2_minus_vwuz1 -lda {z2} -sec -sbc {z1} -sta {z1} -lda {z2}+1 -sbc {z1}+1 -sta {z1}+1 -//FRAGMENT vwuz1=_deref_pbuz1_rol_1 -ldy #0 -lda ({z1}),y -asl -sta {z1} -lda #0 -rol -sta {z1}+1 -//FRAGMENT qwuz1=qwuz2_plus_vwuz1 -lda {z1} -clc -adc {z2} -sta {z1} -lda {z1}+1 -adc {z2}+1 -sta {z1}+1 -//FRAGMENT pwuz1=_deref_qwuz1 -ldy #0 -lda ({z1}),y -pha -iny -lda ({z1}),y -sta {z1}+1 -pla -sta {z1} -//FRAGMENT vwuz1=pwuz1_minus_pwuz2 -lda {z1} -sec -sbc {z2} -sta {z1} -lda {z1}+1 -sbc {z2}+1 -sta {z1}+1 //FRAGMENT pbuz1_derefidx_vbuz2=pbuc1_derefidx_vbuaa tay lda {c1},y ldy {z2} sta ({z1}),y +//FRAGMENT vbuxx=pbuc1_derefidx_vbuyy +ldx {c1},y //FRAGMENT vbuyy=pbuc1_derefidx_vbuxx ldy {c1},x +//FRAGMENT vduz1=vduc1 +lda #<{c1} +sta {z1} +lda #>{c1} +sta {z1}+1 +lda #<{c1}>>$10 +sta {z1}+2 +lda #>{c1}>>$10 +sta {z1}+3 //FRAGMENT _stackpullbyte_1 pla //FRAGMENT vduz1=_inc_vduz1 @@ -8488,6 +6590,15 @@ inc {z1}+2 bne !+ inc {z1}+3 !: +//FRAGMENT vduz1=vduz2 +lda {z2} +sta {z1} +lda {z2}+1 +sta {z1}+1 +lda {z2}+2 +sta {z1}+2 +lda {z2}+3 +sta {z1}+3 //FRAGMENT pbuc1_derefidx_vbuz1_eq_vbuz2_then_la1 ldy {z1} lda {c1},y @@ -8496,6 +6607,8 @@ beq {la1} //FRAGMENT vbsz1=_sbyte_vwuz2 lda {z2} sta {z1} +//FRAGMENT vbsz1=_inc_vbsz1 +inc {z1} //FRAGMENT vbsz1=vbsz2_minus_vbsz3 lda {z2} sec @@ -8505,6 +6618,50 @@ sta {z1} lda #{c1} cmp {z1} bne {la1} +//FRAGMENT vbuz1=_byte_vduz2 +lda {z2} +sta {z1} +//FRAGMENT vduz1=pduc1_derefidx_vbuz2 +ldy {z2} +lda {c1},y +sta {z1} +lda {c1}+1,y +sta {z1}+1 +lda {c1}+2,y +sta {z1}+2 +lda {c1}+3,y +sta {z1}+3 +//FRAGMENT vduz1_ge_vduz2_then_la1 +lda {z1}+3 +cmp {z2}+3 +bcc !+ +bne {la1} +lda {z1}+2 +cmp {z2}+2 +bcc !+ +bne {la1} +lda {z1}+1 +cmp {z2}+1 +bcc !+ +bne {la1} +lda {z1} +cmp {z2} +bcs {la1} +!: +//FRAGMENT vduz1=vduz1_minus_vduz2 +lda {z1} +sec +sbc {z2} +sta {z1} +lda {z1}+1 +sbc {z2}+1 +sta {z1}+1 +lda {z1}+2 +sbc {z2}+2 +sta {z1}+2 +lda {z1}+3 +sbc {z2}+3 +sta {z1}+3 //FRAGMENT vbuaa_le_vbuz1_then_la1 ldy {z1} sta $ff @@ -8604,6 +6761,11 @@ tax sty $ff cpx $ff beq {la1} +//FRAGMENT vbuz1_lt_vbuaa_then_la1 +cmp {z1} +beq !+ +bcs {la1} +!: //FRAGMENT vbsaa=_sbyte_vwuz1 lda {z1} //FRAGMENT vbsxx=_sbyte_vwuz1 @@ -8730,6 +6892,45 @@ tax //FRAGMENT vbsc1_neq_vbsxx_then_la1 cpx #{c1} bne {la1} +//FRAGMENT vbuaa=_byte_vduz1 +lda {z1} +//FRAGMENT vbuxx=_byte_vduz1 +lda {z1} +tax +//FRAGMENT vbuyy=_byte_vduz1 +lda {z1} +tay +//FRAGMENT vduz1=pduc1_derefidx_vbuaa +tay +lda {c1},y +sta {z1} +lda {c1}+1,y +sta {z1}+1 +lda {c1}+2,y +sta {z1}+2 +lda {c1}+3,y +sta {z1}+3 +//FRAGMENT vduz1=pduc1_derefidx_vbuxx +lda {c1},x +sta {z1} +lda {c1}+1,x +sta {z1}+1 +lda {c1}+2,x +sta {z1}+2 +lda {c1}+3,x +sta {z1}+3 +//FRAGMENT vduz1=pduc1_derefidx_vbuyy +lda {c1},y +sta {z1} +lda {c1}+1,y +sta {z1}+1 +lda {c1}+2,y +sta {z1}+2 +lda {c1}+3,y +sta {z1}+3 +//FRAGMENT vbuaa_ge_vbuz1_then_la1 +cmp {z1} +bcs {la1} //FRAGMENT vbuz1=vbuxx_minus_1 dex stx {z1} @@ -8746,6 +6947,22 @@ bcs {la1} //FRAGMENT vbuz1_le_vbuaa_then_la1 cmp {z1} bcs {la1} +//FRAGMENT vbuz1_ge_vbuyy_then_la1 +lda {z1} +sty $ff +cmp $ff +bcs {la1} +//FRAGMENT vbuxx_ge_vbuyy_then_la1 +sty $ff +cpx $ff +bcs {la1} +//FRAGMENT vbuyy_ge_vbuz1_then_la1 +cpy {z1} +bcs {la1} +//FRAGMENT vbuyy_ge_vbuxx_then_la1 +stx $ff +cpy $ff +bcs {la1} //FRAGMENT vbsaa=_inc_vbsaa clc adc #1 @@ -8755,6 +6972,11 @@ inx ldy {z1} //FRAGMENT vbsyy=_inc_vbsyy iny +//FRAGMENT vbuz1_lt_vbuyy_then_la1 +cpy {z1} +beq !+ +bcs {la1} +!: //FRAGMENT vbuaa_lt_vbuxx_then_la1 stx $ff cmp $ff @@ -8764,6 +6986,10 @@ tax sty $ff cpx $ff bcc {la1} +//FRAGMENT vbuxx_lt_vbuyy_then_la1 +sty $ff +cpx $ff +bcc {la1} //FRAGMENT vbuyy_lt_vbuaa_then_la1 sta $ff cpy $ff @@ -8911,6 +7137,8 @@ sta {z1}+2 lda #>{c1}>>$10 adc #0 sta {z1}+3 +//FRAGMENT _deref_pbuc1=_dec__deref_pbuc1 +dec {c1} //FRAGMENT pbuz1_derefidx_vbuaa=vbuz2 tay lda {z2} @@ -8930,6 +7158,13 @@ sta ({z1}),y //FRAGMENT pbuz1_derefidx_vbuyy=vbuyy tya sta ({z1}),y +//FRAGMENT vwuz1_neq_vwuz2_then_la1 +lda {z1}+1 +cmp {z2}+1 +bne {la1} +lda {z1} +cmp {z2} +bne {la1} //FRAGMENT vwuz1=vwuz2_rol_7 lda {z2}+1 lsr @@ -8971,11 +7206,73 @@ lda {z1} cmp #{c1} bcc {la1} !: +//FRAGMENT vduz1=vduz2_minus_vduc1 +lda {z2} +sec +sbc #<{c1} +sta {z1} +lda {z2}+1 +sbc #>{c1} +sta {z1}+1 +lda {z2}+2 +sbc #<{c1}>>$10 +sta {z1}+2 +lda {z2}+3 +sbc #>{c1}>>$10 +sta {z1}+3 //FRAGMENT vwuz1=_word_vduz2 lda {z2} sta {z1} lda {z2}+1 sta {z1}+1 +//FRAGMENT vwuz1=vwuz2_rol_1 +lda {z2} +asl +sta {z1} +lda {z2}+1 +rol +sta {z1}+1 +//FRAGMENT pbuz1=pbuz1_plus_vwuz2 +lda {z1} +clc +adc {z2} +sta {z1} +lda {z1}+1 +adc {z2}+1 +sta {z1}+1 +//FRAGMENT _deref_pduc1=vduc2 +lda #<{c2} +sta {c1} +lda #>{c2} +sta {c1}+1 +lda #<{c2}>>$10 +sta {c1}+2 +lda #>{c2}>>$10 +sta {c1}+3 +//FRAGMENT vduz1=vduc1_minus__deref_pduc2 +lda #<{c1} +sec +sbc {c2} +sta {z1} +lda #>{c1} +sbc {c2}+1 +sta {z1}+1 +lda #<{c1}>>$10 +sbc {c2}+2 +sta {z1}+2 +lda #>{c1}>>$10 +sbc {c2}+3 +sta {z1}+3 +//FRAGMENT vwuz1=_hi_vduz2 +lda {z2}+2 +sta {z1} +lda {z2}+3 +sta {z1}+1 +//FRAGMENT vwuz1=_lo_vduz2 +lda {z2} +sta {z1} +lda {z2}+1 +sta {z1}+1 //FRAGMENT vduz1=vwuz2_dword_vwuz3 lda {z2} sta {z1}+2 @@ -8985,6 +7282,20 @@ lda {z3} sta {z1} lda {z3}+1 sta {z1}+1 +//FRAGMENT vduz1=vduz1_minus_vduc1 +lda {z1} +sec +sbc #<{c1} +sta {z1} +lda {z1}+1 +sbc #>{c1} +sta {z1}+1 +lda {z1}+2 +sbc #<{c1}>>$10 +sta {z1}+2 +lda {z1}+3 +sbc #>{c1}>>$10 +sta {z1}+3 //FRAGMENT _deref_pbuz1_eq_vbuz2_then_la1 lda {z2} ldy #0 @@ -9010,6 +7321,10 @@ lda {z2} sta {z1} lda #0 sta {z1}+1 +//FRAGMENT vbuz1=vwuz2_band_vbuc1 +lda #{c1} +and {z2} +sta {z1} //FRAGMENT vbuz1=pwuc1_derefidx_vbuz2_band_vbuc2 lda #{c2} ldy {z2} @@ -9029,6 +7344,17 @@ tya sta {z1} lda #0 sta {z1}+1 +//FRAGMENT vbuaa=vwuz1_band_vbuc1 +lda #{c1} +and {z1} +//FRAGMENT vbuxx=vwuz1_band_vbuc1 +lda #{c1} +and {z1} +tax +//FRAGMENT vbuyy=vwuz1_band_vbuc1 +lda #{c1} +and {z1} +tay //FRAGMENT vbuaa=pwuc1_derefidx_vbuz1_band_vbuc2 lda #{c2} ldy {z1} @@ -9434,12 +7760,37 @@ dey txa tay dey +//FRAGMENT vbuz1=pbuz2_derefidx_vbuz3 +ldy {z3} +lda ({z2}),y +sta {z1} //FRAGMENT vwuz1=vwuz2_bor_vbuz3 lda {z3} ora {z2} sta {z1} lda {z2}+1 sta {z1}+1 +//FRAGMENT vwuz1=vwuz2_rol_4 +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 +//FRAGMENT vbuxx=pbuz1_derefidx_vbuz2 +ldy {z2} +lda ({z1}),y +tax +//FRAGMENT vbuyy=pbuz1_derefidx_vbuz2 +ldy {z2} +lda ({z1}),y +tay //FRAGMENT vbuz1=pbuz2_derefidx_vbuaa tay lda ({z2}),y @@ -9455,6 +7806,30 @@ tax tay lda ({z1}),y tay +//FRAGMENT vbuz1=pbuz2_derefidx_vbuxx +txa +tay +lda ({z2}),y +sta {z1} +//FRAGMENT vbuxx=pbuz1_derefidx_vbuxx +txa +tay +lda ({z1}),y +tax +//FRAGMENT vbuyy=pbuz1_derefidx_vbuxx +txa +tay +lda ({z1}),y +tay +//FRAGMENT vbuz1=pbuz2_derefidx_vbuyy +lda ({z2}),y +sta {z1} +//FRAGMENT vbuxx=pbuz1_derefidx_vbuyy +lda ({z1}),y +tax +//FRAGMENT vbuyy=pbuz1_derefidx_vbuyy +lda ({z1}),y +tay //FRAGMENT vwuz1=vwuz2_bor_vbuxx txa ora {z2} @@ -9480,6 +7855,20 @@ sta ({z1}),y txa ora {z1} sta {z1} +//FRAGMENT vwuz1=vwuz1_rol_4 +asl {z1} +rol {z1}+1 +asl {z1} +rol {z1}+1 +asl {z1} +rol {z1}+1 +asl {z1} +rol {z1}+1 +//FRAGMENT vbuz1=vbuc1_minus_vbuz2 +lda #{c1} +sec +sbc {z2} +sta {z1} //FRAGMENT vbuz1_ge_pbuc1_derefidx_vbuz2_then_la1 lda {z1} ldy {z2} @@ -9525,6 +7914,82 @@ bne {la1} lda {z1} cmp {z1} bne {la1} +//FRAGMENT vbuaa=vbuc1_minus_vbuz1 +lda #{c1} +sec +sbc {z1} +//FRAGMENT vbuxx=vbuc1_minus_vbuz1 +lda #{c1} +sec +sbc {z1} +tax +//FRAGMENT vbuyy=vbuc1_minus_vbuz1 +lda #{c1} +sec +sbc {z1} +tay +//FRAGMENT vbuz1=vbuc1_minus_vbuaa +eor #$ff +sec +adc #{c1} +sta {z1} +//FRAGMENT vbuaa=vbuc1_minus_vbuaa +eor #$ff +sec +adc #{c1} +//FRAGMENT vbuxx=vbuc1_minus_vbuaa +eor #$ff +tax +axs #-{c1}-1 +//FRAGMENT vbuyy=vbuc1_minus_vbuaa +eor #$ff +sec +adc #{c1} +tay +//FRAGMENT vbuz1=vbuc1_minus_vbuxx +txa +eor #$ff +sec +adc #{c1} +sta {z1} +//FRAGMENT vbuaa=vbuc1_minus_vbuxx +txa +eor #$ff +sec +adc #{c1} +//FRAGMENT vbuxx=vbuc1_minus_vbuxx +txa +eor #$ff +tax +axs #-{c1}-1 +//FRAGMENT vbuyy=vbuc1_minus_vbuxx +txa +eor #$ff +sec +adc #{c1} +tay +//FRAGMENT vbuz1=vbuc1_minus_vbuyy +tya +eor #$ff +sec +adc #{c1} +sta {z1} +//FRAGMENT vbuaa=vbuc1_minus_vbuyy +tya +eor #$ff +sec +adc #{c1} +//FRAGMENT vbuxx=vbuc1_minus_vbuyy +tya +eor #$ff +tax +axs #-{c1}-1 +//FRAGMENT vbuyy=vbuc1_minus_vbuyy +tya +eor #$ff +sec +adc #{c1} +tay //FRAGMENT vbuz1_ge_pbuc1_derefidx_vbuxx_then_la1 txa tay @@ -9775,6 +8240,18 @@ tax stx $ff cpy $ff bne {la1} +//FRAGMENT pwuz1=pwuc1 +lda #<{c1} +sta {z1} +lda #>{c1} +sta {z1}+1 +//FRAGMENT _deref_pwuz1=vwuz2 +ldy #0 +lda {z2} +sta ({z1}),y +iny +lda {z2}+1 +sta ({z1}),y //FRAGMENT pwuz1_derefidx_vbuc1=vwuz2 ldy #{c1} lda {z2} @@ -9782,6 +8259,14 @@ sta ({z1}),y iny lda {z2}+1 sta ({z1}),y +//FRAGMENT pwuz1=pwuz1_plus_vbuc1 +lda #{c1} +clc +adc {z1} +sta {z1} +bcc !+ +inc {z1}+1 +!: //FRAGMENT vbuz1=vbuz2_plus_2 lda {z2} clc @@ -9843,6 +8328,14 @@ bvc !+ eor #$80 !: bmi {la1} +//FRAGMENT vwsz1_ge_0_then_la1 +lda {z1}+1 +bpl {la1} +//FRAGMENT vwsz1=vbsc1 +lda #<{c1} +sta {z1} +lda #>{c1} +sta {z1}+1 //FRAGMENT vwsz1=vwsz2_ror_7 lda {z2}+1 sta {z1} @@ -9889,24 +8382,90 @@ sta {z1}+1 //FRAGMENT _deref_pbsc1=vbsz1 lda {z1} sta {c1} +//FRAGMENT pwuc1_derefidx_vbuz1=_word_vbuz2 +lda {z2} +ldy {z1} +sta {c1},y +lda #0 +sta {c1}+1,y //FRAGMENT pwuc1_derefidx_vbuaa=_word_vbuz1 tay lda {z1} sta {c1},y lda #0 sta {c1}+1,y +//FRAGMENT pwuc1_derefidx_vbuxx=_word_vbuz1 +lda {z1} +sta {c1},x +lda #0 +sta {c1}+1,x +//FRAGMENT pwuc1_derefidx_vbuyy=_word_vbuz1 +lda {z1} +sta {c1},y +lda #0 +sta {c1}+1,y +//FRAGMENT pwuc1_derefidx_vbuz1=_word_vbuxx +ldy {z1} +txa +sta {c1},y +lda #0 +sta {c1}+1,y //FRAGMENT pwuc1_derefidx_vbuaa=_word_vbuxx tay txa sta {c1},y lda #0 sta {c1}+1,y +//FRAGMENT pwuc1_derefidx_vbuxx=_word_vbuxx +txa +sta {c1},x +lda #0 +sta {c1}+1,x +//FRAGMENT pwuc1_derefidx_vbuyy=_word_vbuxx +txa +sta {c1},y +lda #0 +sta {c1}+1,y +//FRAGMENT pwuc1_derefidx_vbuz1=_word_vbuyy +tya +ldy {z1} +sta {c1},y +lda #0 +sta {c1}+1,y //FRAGMENT pwuc1_derefidx_vbuaa=_word_vbuyy tax tya sta {c1},x lda #0 sta {c1}+1,x +//FRAGMENT pwuc1_derefidx_vbuxx=_word_vbuyy +tya +sta {c1},x +lda #0 +sta {c1}+1,x +//FRAGMENT pwuc1_derefidx_vbuyy=_word_vbuyy +tya +sta {c1},y +lda #0 +sta {c1}+1,y +//FRAGMENT pbuc1_derefidx_vbuz1_neq_vbuc2_then_la1 +lda #{c2} +ldy {z1} +cmp {c1},y +bne {la1} +//FRAGMENT pbuc1_derefidx_vbuaa_neq_vbuc2_then_la1 +tay +lda #{c2} +cmp {c1},y +bne {la1} +//FRAGMENT pbuc1_derefidx_vbuxx_neq_vbuc2_then_la1 +lda {c1},x +cmp #{c2} +bne {la1} +//FRAGMENT pbuc1_derefidx_vbuyy_neq_vbuc2_then_la1 +lda #{c2} +cmp {c1},y +bne {la1} //FRAGMENT vbuxx_neq_vbuaa_then_la1 tay stx $ff @@ -9963,6 +8522,14 @@ inc {z1} lax {z1} axs #{c1} stx {z1} +//FRAGMENT pbuz1=pbuz2_plus_1 +clc +lda {z2} +adc #1 +sta {z1} +lda {z2}+1 +adc #0 +sta {z1}+1 //FRAGMENT vbsz1=vbsz2_plus_vbsz3 lda {z2} clc @@ -11270,6 +9837,9 @@ tay lda {c1} //FRAGMENT vbsxx=_deref_pbsc1 ldx {c1} +//FRAGMENT vbuxx=pbuc1_derefidx_vbuxx +lda {c1},x +tax //FRAGMENT vbsyy=_deref_pbsc1 ldy {c1} //FRAGMENT _deref_pbsc1=vbsxx @@ -11333,6 +9903,13 @@ sta ({z1}),y iny lda {z2}+1 sta ({z1}),y +//FRAGMENT vwuz1=_deref_pwuz2 +ldy #0 +lda ({z2}),y +sta {z1} +iny +lda ({z2}),y +sta {z1}+1 //FRAGMENT vwuz1=pwuz2_derefidx_vbuc1 ldy #{c1} lda ({z2}),y @@ -11372,6 +9949,29 @@ bne {la1} lda {z1} cmp #<{c1} bne {la1} +//FRAGMENT vwuz1_neq_vbuc1_then_la1 +NO_SYNTHESIS +//FRAGMENT vwuz1_neq_vbsc1_then_la1 +NO_SYNTHESIS +//FRAGMENT pbuc1_derefidx_vbuz1=_byte_vwuz2 +ldy {z1} +lda {z2} +sta {c1},y +//FRAGMENT vwuz1=vwuz2_ror_1 +lda {z2}+1 +lsr +sta {z1}+1 +lda {z2} +ror +sta {z1} +//FRAGMENT vwuz1=vwuz2_plus_1 +clc +lda {z2} +adc #1 +sta {z1} +lda {z2}+1 +adc #0 +sta {z1}+1 //FRAGMENT vwuz1=vwuz2_ror_4 lda {z2}+1 lsr @@ -11495,6 +10095,13 @@ sta {z1}+2 lda {z2}+3 adc #0 sta {z1}+3 +//FRAGMENT vwuz1=vwuz2_band_vwuc1 +lda {z2} +and #<{c1} +sta {z1} +lda {z2}+1 +and #>{c1} +sta {z1}+1 //FRAGMENT vwuz1=vwuz2_ror_6 lda {z2} asl @@ -12331,6 +10938,10 @@ sta {z1} lda #>{c1} eor {z2}+1 sta {z1}+1 +//FRAGMENT vbuz1=vbuz1_bxor_vbuc1 +lda #{c1} +eor {z1} +sta {z1} //FRAGMENT pbuz1_derefidx_vbuz2=pbuz1_derefidx_vbuz2_bor_pbuc1_derefidx_vbuz3 ldx {z3} ldy {z2} @@ -12462,6 +11073,15 @@ tax txa eor ({z1}),y tax +//FRAGMENT vbuaa=_neg_vbuaa +eor #$ff +clc +adc #$01 +//FRAGMENT vbuxx=_neg_vbuxx +dex +txa +eor #$ff +tax //FRAGMENT vbuyy=_neg_vbuyy dey tya @@ -12636,6 +11256,14 @@ sta {z1} lda #0 rol sta {z1}+1 +//FRAGMENT vwuz1=vwuz2_plus_vbuc1 +lda #{c1} +clc +adc {z2} +sta {z1} +lda #0 +adc {z2}+1 +sta {z1}+1 //FRAGMENT vwuz1=vbuxx_rol_1 txa asl @@ -12799,200 +11427,6 @@ sta {z1}+1 txa cmp #0 bne {la1} -//FRAGMENT pwsz1=pwsc1 -lda #<{c1} -sta {z1} -lda #>{c1} -sta {z1}+1 -//FRAGMENT vwuz1=_hi_vdsz2 -lda {z2}+2 -sta {z1} -lda {z2}+3 -sta {z1}+1 -//FRAGMENT pwsz1=pwsz1_plus_vbuc1 -lda #{c1} -clc -adc {z1} -sta {z1} -bcc !+ -inc {z1}+1 -!: -//FRAGMENT pwsz1=pwsc1_plus_vwuz2 -clc -lda {z2} -adc #<{c1} -sta {z1} -lda {z2}+1 -adc #>{c1} -sta {z1}+1 -//FRAGMENT vduz1_lt_vduc1_then_la1 -lda {z1}+3 -cmp #>{c1}>>$10 -bcc {la1} -bne !+ -lda {z1}+2 -cmp #<{c1}>>$10 -bcc {la1} -bne !+ -lda {z1}+1 -cmp #>{c1} -bcc {la1} -bne !+ -lda {z1} -cmp #<{c1} -bcc {la1} -!: -//FRAGMENT vduz1=vduc1_minus_vduz1 -lda #<{c1} -sec -sbc {z1} -sta {z1} -lda #>{c1} -sbc {z1}+1 -sta {z1}+1 -lda #<{c1}>>$10 -sbc {z1}+2 -sta {z1}+2 -lda #>{c1}>>$10 -sbc {z1}+3 -sta {z1}+3 -//FRAGMENT vduz1=vduz2_rol_3 -lda {z2} -asl -sta {z1} -lda {z2}+1 -rol -sta {z1}+1 -lda {z2}+2 -rol -sta {z1}+2 -lda {z2}+3 -rol -sta {z1}+3 -asl {z1} -rol {z1}+1 -rol {z1}+2 -rol {z1}+3 -asl {z1} -rol {z1}+1 -rol {z1}+2 -rol {z1}+3 -//FRAGMENT vwuz1=vwuz2_minus_vwuc1 -lda {z2} -sec -sbc #<{c1} -sta {z1} -lda {z2}+1 -sbc #>{c1} -sta {z1}+1 -//FRAGMENT vbuz1=_byte_vwsz2 -lda {z2} -sta {z1} -//FRAGMENT vbsz1=_sbyte_vwsz2 -lda {z2} -sta {z1} -//FRAGMENT vduz1=vduz2_rol_vbuz3 -ldy {z3} -lda {z2} -sta {z1} -lda {z2}+1 -sta {z1}+1 -lda {z2}+2 -sta {z1}+2 -lda {z2}+3 -sta {z1}+3 -cpy #0 -beq !e+ -!: -asl {z1} -rol {z1}+1 -rol {z1}+2 -rol {z1}+3 -dey -bne !- -!e: -//FRAGMENT vbuaa=_byte_vwsz1 -lda {z1} -//FRAGMENT vbuxx=_byte_vwsz1 -lda {z1} -tax -//FRAGMENT vbuyy=_byte_vwsz1 -lda {z1} -tay -//FRAGMENT vbsaa=_sbyte_vwsz1 -lda {z1} -//FRAGMENT vbsxx=_sbyte_vwsz1 -lda {z1} -tax -//FRAGMENT vbsyy=_sbyte_vwsz1 -lda {z1} -tay -//FRAGMENT vduz1=vduz2_rol_vbuxx -lda {z2} -sta {z1} -lda {z2}+1 -sta {z1}+1 -lda {z2}+2 -sta {z1}+2 -lda {z2}+3 -sta {z1}+3 -cpx #0 -beq !e+ -!: -asl {z1} -rol {z1}+1 -rol {z1}+2 -rol {z1}+3 -dex -bne !- -!e: -//FRAGMENT vduz1=vduz2_rol_vbuyy -lda {z2} -sta {z1} -lda {z2}+1 -sta {z1}+1 -lda {z2}+2 -sta {z1}+2 -lda {z2}+3 -sta {z1}+3 -cpy #0 -beq !e+ -!: -asl {z1} -rol {z1}+1 -rol {z1}+2 -rol {z1}+3 -dey -bne !- -!e: -//FRAGMENT vduz1=vduz1_rol_3 -ldy #3 -!: -asl {z1} -rol {z1}+1 -rol {z1}+2 -rol {z1}+3 -dey -bne !- -//FRAGMENT pwsz1=pwsc1_plus_vwuz1 -clc -lda {z1} -adc #<{c1} -sta {z1} -lda {z1}+1 -adc #>{c1} -sta {z1}+1 -//FRAGMENT vduz1=vduz1_rol_vbuxx -cpx #0 -beq !e+ -!: -asl {z1} -rol {z1}+1 -rol {z1}+2 -rol {z1}+3 -dex -bne !- -!e: //FRAGMENT pssz1=pssc1 lda #<{c1} sta {z1} @@ -13108,6 +11542,14 @@ sta {z1} bcc !+ inc {z1}+1 !: +//FRAGMENT pssz1=pssc1_plus_vbuz2 +lda {z2} +clc +adc #<{c1} +sta {z1} +lda #>{c1} +adc #0 +sta {z1}+1 //FRAGMENT pwsz1_derefidx_vbuc1=vwsc2 ldy #{c1} lda #<{c2} @@ -13124,6 +11566,29 @@ ldy {z1} lda {c1},y cmp #{c2} bcc {la1} +//FRAGMENT pssz1=pssc1_plus_vbuaa +clc +adc #<{c1} +sta {z1} +lda #>{c1} +adc #0 +sta {z1}+1 +//FRAGMENT pssz1=pssc1_plus_vbuxx +txa +clc +adc #<{c1} +sta {z1} +lda #>{c1} +adc #0 +sta {z1}+1 +//FRAGMENT pssz1=pssc1_plus_vbuyy +tya +clc +adc #<{c1} +sta {z1} +lda #>{c1} +adc #0 +sta {z1}+1 //FRAGMENT pbsz1_derefidx_vbuc1=vbsxx ldy #{c1} txa @@ -13147,13 +11612,17 @@ dex tya tay dey -//FRAGMENT vwsz1_neq_vwsc1_then_la1 -lda {z1}+1 -cmp #>{c1} -bne {la1} -lda {z1} -cmp #<{c1} -bne {la1} +//FRAGMENT pbuz1_derefidx_vbuz2=_inc_pbuz1_derefidx_vbuz2 +ldy {z2} +lda ({z1}),y +clc +adc #1 +sta ({z1}),y +//FRAGMENT _deref_pwsc1=vwsc2 +lda #<{c2} +sta {c1} +lda #>{c2} +sta {c1}+1 //FRAGMENT _deref_pwsc1=vwsz1 lda {z1} sta {c1} @@ -13198,6 +11667,10 @@ sta {z1} ldy {z2} lda {c1}+1,y sta {z1} +//FRAGMENT vbuz1=vbuc1_bxor_vbuz2 +lda #{c1} +eor {z2} +sta {z1} //FRAGMENT pwuc1_derefidx_vbuz1=vbuxx ldy {z1} txa @@ -13419,6 +11892,17 @@ tay //FRAGMENT vbuyy=_hi_pwuc1_derefidx_vbuxx lda {c1}+1,x tay +//FRAGMENT vbuaa=vbuc1_bxor_vbuz1 +lda #{c1} +eor {z1} +//FRAGMENT vbuxx=vbuc1_bxor_vbuz1 +lda #{c1} +eor {z1} +tax +//FRAGMENT vbuyy=vbuc1_bxor_vbuz1 +lda #{c1} +eor {z1} +tay //FRAGMENT vbuxx_ge_pbuc1_derefidx_(pbuc2_derefidx_vbuz1)_then_la1 ldy {z1} txa @@ -13463,6 +11947,16 @@ cpx $ff bcc {la1} //FRAGMENT vbsxx=pbsc1_derefidx_vbuyy ldx {c1},y +//FRAGMENT vbuaa=vbuxx_plus_1 +inx +txa +//FRAGMENT vbuaa=vbuyy_plus_1 +iny +tya +//FRAGMENT vbuxx=vbuyy_plus_1 +tya +tax +inx //FRAGMENT pbuc1_derefidx_vbuz1=pbuz2_derefidx_vbuc2 ldx {z1} ldy #{c2} @@ -13598,12 +12092,28 @@ bcc {la1} ldy {m1} tya sta {c1},y +//FRAGMENT pwuc1_derefidx_vbuz1=vwuc2 +ldy {z1} +lda #<{c2} +sta {c1},y +lda #>{c2} +sta {c1}+1,y //FRAGMENT pwuc1_derefidx_vbuaa=vwuc2 tay lda #<{c2} sta {c1},y lda #>{c2} sta {c1}+1,y +//FRAGMENT pwuc1_derefidx_vbuxx=vwuc2 +lda #<{c2} +sta {c1},x +lda #>{c2} +sta {c1}+1,x +//FRAGMENT pwuc1_derefidx_vbuyy=vwuc2 +lda #<{c2} +sta {c1},y +lda #>{c2} +sta {c1}+1,y //FRAGMENT _deref_pbuc1_ge_vbuc2_then_la1 lda {c1} cmp #{c2} @@ -13621,20 +12131,40 @@ tax //FRAGMENT vboyy=vboxx txa tay +//FRAGMENT vwuz1=pwuz2_derefidx_vbuz3 +ldy {z3} +lda ({z2}),y +sta {z1} +iny +lda ({z2}),y +sta {z1}+1 +//FRAGMENT vwuz1=pwuz2_derefidx_vbuaa +tay +lda ({z2}),y +sta {z1} +iny +lda ({z2}),y +sta {z1}+1 +//FRAGMENT vwuz1=pwuz2_derefidx_vbuxx +txa +tay +lda ({z2}),y +sta {z1} +iny +lda ({z2}),y +sta {z1}+1 +//FRAGMENT vwuz1=pwuz2_derefidx_vbuyy +lda ({z2}),y +sta {z1} +iny +lda ({z2}),y +sta {z1}+1 //FRAGMENT vbsz1=vbsz1_minus_vbsxx txa eor #$ff sec adc {z1} sta {z1} -//FRAGMENT vwsz1=vwsz1_minus_vwsc1 -lda {z1} -sec -sbc #<{c1} -sta {z1} -lda {z1}+1 -sbc #>{c1} -sta {z1}+1 //FRAGMENT vbsz1=pbsc1_derefidx_vbuz2_minus_pbsc2_derefidx_vbuz2 ldy {z2} lda {c1},y @@ -13843,6 +12373,15 @@ lda {z1}+1 cmp {z2}+1 beq {la1} !: +//FRAGMENT vwuz1_lt_vwuz2_then_la1 +lda {z1}+1 +cmp {z2}+1 +bcc {la1} +bne !+ +lda {z1} +cmp {z2} +bcc {la1} +!: //FRAGMENT vwuz1_le_vwuz2_then_la1 lda {z1}+1 cmp {z2}+1 @@ -13852,6 +12391,23 @@ cmp {z2} beq {la1} !: bcc {la1} +//FRAGMENT vwuz1_gt_vwuz2_then_la1 +lda {z2}+1 +cmp {z1}+1 +bcc {la1} +bne !+ +lda {z2} +cmp {z1} +bcc {la1} +!: +//FRAGMENT vwuz1=vwuz2_minus_vwuz3 +lda {z2} +sec +sbc {z3} +sta {z1} +lda {z2}+1 +sbc {z3}+1 +sta {z1}+1 //FRAGMENT vduz1=vwuz2_dword_vwuc1 lda #<{c1} sta {z1} @@ -13861,6 +12417,20 @@ lda {z2} sta {z1}+2 lda {z2}+1 sta {z1}+3 +//FRAGMENT vduz1=vduz1_plus_vduz2 +lda {z1} +clc +adc {z2} +sta {z1} +lda {z1}+1 +adc {z2}+1 +sta {z1}+1 +lda {z1}+2 +adc {z2}+2 +sta {z1}+2 +lda {z1}+3 +adc {z2}+3 +sta {z1}+3 //FRAGMENT vwuz1=vwuz1_minus_vbuc1 sec lda {z1} @@ -14040,6 +12610,23 @@ tax NO_SYNTHESIS //FRAGMENT vduz1_lt_vwsc1_then_la1 NO_SYNTHESIS +//FRAGMENT vduz1_lt_vduc1_then_la1 +lda {z1}+3 +cmp #>{c1}>>$10 +bcc {la1} +bne !+ +lda {z1}+2 +cmp #<{c1}>>$10 +bcc {la1} +bne !+ +lda {z1}+1 +cmp #>{c1} +bcc {la1} +bne !+ +lda {z1} +cmp #<{c1} +bcc {la1} +!: //FRAGMENT vduz1=vduz2_rol_4 lda {z2} asl @@ -14115,6 +12702,28 @@ asl {z1} rol {z1}+1 rol {z1}+2 rol {z1}+3 +//FRAGMENT vduz1=vduz1_rol_1 +asl {z1} +rol {z1}+1 +rol {z1}+2 +rol {z1}+3 +//FRAGMENT vbsz1_neq_vbsc1_then_la1 +lda #{c1} +cmp {z1} +bne {la1} +//FRAGMENT vbuz1=pbuz2_derefidx_vbuz3_rol_4 +ldy {z3} +lda ({z2}),y +asl +asl +asl +asl +sta {z1} +//FRAGMENT vbuz1=pbuz2_derefidx_vbuz3_rol_1 +ldy {z3} +lda ({z2}),y +asl +sta {z1} //FRAGMENT vbsz1_gt_0_then_la1 lda {z1} cmp #0 @@ -14152,6 +12761,174 @@ sta {z1} //FRAGMENT vbsaa_neq_vbsc1_then_la1 cmp #{c1} bne {la1} +//FRAGMENT vbuaa=pbuz1_derefidx_vbuz2_rol_4 +ldy {z2} +lda ({z1}),y +asl +asl +asl +asl +//FRAGMENT vbuxx=pbuz1_derefidx_vbuz2_rol_4 +ldy {z2} +lda ({z1}),y +asl +asl +asl +asl +tax +//FRAGMENT vbuyy=pbuz1_derefidx_vbuz2_rol_4 +ldy {z2} +lda ({z1}),y +asl +asl +asl +asl +tay +//FRAGMENT vbuz1=pbuz2_derefidx_vbuaa_rol_4 +tay +lda ({z2}),y +asl +asl +asl +asl +sta {z1} +//FRAGMENT vbuaa=pbuz1_derefidx_vbuaa_rol_4 +tay +lda ({z1}),y +asl +asl +asl +asl +//FRAGMENT vbuxx=pbuz1_derefidx_vbuaa_rol_4 +tay +lda ({z1}),y +asl +asl +asl +asl +tax +//FRAGMENT vbuyy=pbuz1_derefidx_vbuaa_rol_4 +tay +lda ({z1}),y +asl +asl +asl +asl +tay +//FRAGMENT vbuz1=pbuz2_derefidx_vbuxx_rol_4 +txa +tay +lda ({z2}),y +asl +asl +asl +asl +sta {z1} +//FRAGMENT vbuaa=pbuz1_derefidx_vbuxx_rol_4 +txa +tay +lda ({z1}),y +asl +asl +asl +asl +//FRAGMENT vbuxx=pbuz1_derefidx_vbuxx_rol_4 +txa +tay +lda ({z1}),y +asl +asl +asl +asl +tax +//FRAGMENT vbuyy=pbuz1_derefidx_vbuxx_rol_4 +txa +tay +lda ({z1}),y +asl +asl +asl +asl +tay +//FRAGMENT vbuz1=pbuz2_derefidx_vbuyy_rol_4 +lda ({z2}),y +asl +asl +asl +asl +sta {z1} +//FRAGMENT vbuaa=pbuz1_derefidx_vbuyy_rol_4 +lda ({z1}),y +asl +asl +asl +asl +//FRAGMENT vbuxx=pbuz1_derefidx_vbuyy_rol_4 +lda ({z1}),y +asl +asl +asl +asl +tax +//FRAGMENT vbuyy=pbuz1_derefidx_vbuyy_rol_4 +lda ({z1}),y +asl +asl +asl +asl +tay +//FRAGMENT vbuaa=pbuz1_derefidx_vbuz2_rol_1 +ldy {z2} +lda ({z1}),y +asl +//FRAGMENT vbuxx=pbuz1_derefidx_vbuz2_rol_1 +ldy {z2} +lda ({z1}),y +asl +tax +//FRAGMENT vbuyy=pbuz1_derefidx_vbuz2_rol_1 +ldy {z2} +lda ({z1}),y +asl +tay +//FRAGMENT vbuz1=pbuz2_derefidx_vbuxx_rol_1 +txa +tay +lda ({z2}),y +asl +sta {z1} +//FRAGMENT vbuaa=pbuz1_derefidx_vbuxx_rol_1 +txa +tay +lda ({z1}),y +asl +//FRAGMENT vbuxx=pbuz1_derefidx_vbuxx_rol_1 +txa +tay +lda ({z1}),y +asl +tax +//FRAGMENT vbuyy=pbuz1_derefidx_vbuxx_rol_1 +txa +tay +lda ({z1}),y +asl +tay +//FRAGMENT vbuz1=pbuz2_derefidx_vbuyy_rol_1 +lda ({z2}),y +asl +sta {z1} +//FRAGMENT vbuaa=pbuz1_derefidx_vbuyy_rol_1 +lda ({z1}),y +asl +//FRAGMENT vbuxx=pbuz1_derefidx_vbuyy_rol_1 +lda ({z1}),y +asl +tax +//FRAGMENT vbuyy=pbuz1_derefidx_vbuyy_rol_1 +lda ({z1}),y +asl +tay //FRAGMENT vbsaa_gt_0_then_la1 cmp #0 beq !+ @@ -14620,6 +13397,9 @@ tay sec sbc {c1},y tay +//FRAGMENT vbsxx_neq_vbsc1_then_la1 +cpx #{c1} +bne {la1} //FRAGMENT _deref_pduc1=vduz1 lda {z1} sta {c1} @@ -14771,24 +13551,6 @@ sta {c1},x ldx {c3},y lda {c2},x sta {c1},y -//FRAGMENT pwsz1_lt_pwsc1_then_la1 -lda {z1}+1 -cmp #>{c1} -bcc {la1} -bne !+ -lda {z1} -cmp #<{c1} -bcc {la1} -!: -//FRAGMENT vbsaa=vbsz1_minus_vbsaa -eor #$ff -sec -adc {z1} -//FRAGMENT vbsaa=vbsxx_minus_vbsaa -sta $ff -txa -sec -sbc $ff //FRAGMENT vbuz1=_deref_pbuc1_bxor_vbuc2 lda #{c2} eor {c1} @@ -15144,6 +13906,22 @@ bne {la1} //FRAGMENT vbsxx_neq_vbsz1_then_la1 cpx {z1} bne {la1} +//FRAGMENT pwuz1=pwuc1_plus_vwuz2 +clc +lda {z2} +adc #<{c1} +sta {z1} +lda {z2}+1 +adc #>{c1} +sta {z1}+1 +//FRAGMENT pwuz1=pwuc1_plus_vwuz1 +clc +lda {z1} +adc #<{c1} +sta {z1} +lda {z1}+1 +adc #>{c1} +sta {z1}+1 //FRAGMENT vbuz1=pbuc1_derefidx_vbuz2_plus_vbuc2 lda #{c2} ldy {z2} @@ -15164,6 +13942,20 @@ sta ({z1}),y lda #0 iny sta ({z1}),y +//FRAGMENT _deref_pwuz1=_deref_pwuz1_plus_pwuz1_derefidx_vbuc1 +ldy #{c1} +sty $ff +clc +lda ({z1}),y +ldy #0 +adc ({z1}),y +sta ({z1}),y +ldy $ff +iny +lda ({z1}),y +ldy #1 +adc ({z1}),y +sta ({z1}),y //FRAGMENT pwuz1_derefidx_vbuc1=pwuz1_derefidx_vbuc1_plus_vbuc2 lda #{c2} ldy #{c1} @@ -15174,6 +13966,18 @@ iny lda #0 adc ({z1}),y sta ({z1}),y +//FRAGMENT pwuz1_derefidx_vbuc1=pwuz1_derefidx_vbuc1_plus_pwuz1_derefidx_vbuc2 +ldy #{c2} +clc +lda ({z1}),y +ldy #{c1} +adc ({z1}),y +sta ({z1}),y +ldy #{c2}+1 +lda ({z1}),y +ldy #{c1}+1 +adc ({z1}),y +sta ({z1}),y //FRAGMENT vwuz1=_deref_pwuz2_ror_8 ldy #1 lda ({z2}),y @@ -15414,6 +14218,9 @@ sta {z1} lda #>{c1} adc #0 sta {z1}+1 +//FRAGMENT vbuz1=vbuz1_minus_2 +dec {z1} +dec {z1} //FRAGMENT pbuz1_derefidx_vbuz2=_byte_vwuz3 lda {z3} ldy {z2} @@ -15455,18 +14262,15 @@ sta ({z1}),y lda {z2} ora {z3}+1 sta {z1} +//FRAGMENT vbuxx=vbuxx_minus_2 +dex +dex +//FRAGMENT vbuyy=vbuyy_minus_2 +dey +dey //FRAGMENT vbuz1=vbuz1_bor_vbuaa ora {z1} sta {z1} -//FRAGMENT pbuz1_ge_pbuc1_then_la1 -lda {z1}+1 -cmp #>{c1} -bcc !+ -bne {la1} -lda {z1} -cmp #<{c1} -bcs {la1} -!: //FRAGMENT vbuz1=_deref_pbuc1_ror_1 lda {c1} lsr @@ -15481,6 +14285,15 @@ cmp {z1} beq {la1} !: bcc {la1} +//FRAGMENT vwuz1=vwuz1_minus_pwuc1_derefidx_vbuz2 +ldy {z2} +sec +lda {z1} +sbc {c1},y +sta {z1} +lda {z1}+1 +sbc {c1}+1,y +sta {z1}+1 //FRAGMENT _deref_(_deref_qbuc1)=pbuc2_derefidx_vbuz1 ldy {z1} lda {c2},y @@ -15534,6 +14347,22 @@ cmp {z1} beq {la1} !: bcc {la1} +//FRAGMENT vwuz1=vwuz1_minus_pwuc1_derefidx_vbuxx +sec +lda {z1} +sbc {c1},x +sta {z1} +lda {z1}+1 +sbc {c1}+1,x +sta {z1}+1 +//FRAGMENT vwuz1=vwuz1_minus_pwuc1_derefidx_vbuyy +sec +lda {z1} +sbc {c1},y +sta {z1} +lda {z1}+1 +sbc {c1}+1,y +sta {z1}+1 //FRAGMENT _deref_(_deref_qbuc1)=pbuc2_derefidx_vbuaa tay lda {c2},y @@ -15674,6 +14503,11 @@ tax //FRAGMENT vbsyy=vbsaa_rol_1 asl tay +//FRAGMENT pwsz1=pwsc1 +lda #<{c1} +sta {z1} +lda #>{c1} +sta {z1}+1 //FRAGMENT pwsz1=pwsc1_plus_vbuz2 lda {z2} clc @@ -16037,12 +14871,6 @@ tax stx $ff cpy $ff bne {la1} -//FRAGMENT vwuz1=_deref_pbuz2_word__deref_pbuz3 -ldy #0 -lda ({z3}),y -sta {z1} -lda ({z2}),y -sta {z1}+1 //FRAGMENT vbuz1=_deref_pbuc1_plus_2 lda {c1} clc @@ -16064,6 +14892,19 @@ iny lda {z2} ldy #0 sta ({z1}),y +//FRAGMENT vwuz1=vwuz2_rol_6 +lda {z2}+1 +lsr +sta $ff +lda {z2} +ror +sta {z1}+1 +lda #0 +ror +sta {z1} +lsr $ff +ror {z1}+1 +ror {z1} //FRAGMENT vwuz1=vwuz2_minus_vbuc1 sec lda {z2} @@ -16299,6 +15140,19 @@ and {z1} sta {z1} lda #0 sta {z1}+1 +//FRAGMENT vwuz1=vwuz1_rol_6 +lda {z1}+1 +lsr +sta $ff +lda {z1} +ror +sta {z1}+1 +lda #0 +ror +sta {z1} +lsr $ff +ror {z1}+1 +ror {z1} //FRAGMENT vduz1=vduz1_plus_pduz2_derefidx_vbuz3 ldy {z3} lda {z1} @@ -16474,20 +15328,76 @@ tya cmp #$80 ror tay +//FRAGMENT vwsz1=_neg_vwsz2 +sec +lda #0 +sbc {z2} +sta {z1} +lda #0 +sbc {z2}+1 +sta {z1}+1 +//FRAGMENT vbuz1=_neg_vbuz2 +lda {z2} +eor #$ff +clc +adc #$01 +sta {z1} +//FRAGMENT vbuz1=_neg_vbuaa +eor #$ff +clc +adc #$01 +sta {z1} +//FRAGMENT vbuz1=_neg_vbuxx +dex +txa +eor #$ff +sta {z1} //FRAGMENT vbuz1=_neg_vbuyy dey tya eor #$ff sta {z1} +//FRAGMENT vbuaa=_neg_vbuz1 +lda {z1} +eor #$ff +clc +adc #$01 +//FRAGMENT vbuaa=_neg_vbuxx +dex +txa +eor #$ff //FRAGMENT vbuaa=_neg_vbuyy dey tya eor #$ff +//FRAGMENT vbuxx=_neg_vbuz1 +lda {z1} +eor #$ff +tax +inx +//FRAGMENT vbuxx=_neg_vbuaa +eor #$ff +tax +inx //FRAGMENT vbuxx=_neg_vbuyy tya eor #$ff tax inx +//FRAGMENT vbuyy=_neg_vbuz1 +lda {z1} +eor #$ff +tay +iny +//FRAGMENT vbuyy=_neg_vbuaa +eor #$ff +tay +iny +//FRAGMENT vbuyy=_neg_vbuxx +txa +eor #$ff +tay +iny //FRAGMENT vbuz1=vbuz2_band_vbuz3 lda {z2} and {z3} @@ -16547,134 +15457,6 @@ tay tya and {z1} tay -//FRAGMENT vdsz1=vdsz2_rol_4 -lda {z2} -sta {z1} -lda {z2}+1 -sta {z1}+1 -lda {z2}+2 -sta {z1}+2 -lda {z2}+3 -sta {z1}+3 -asl {z1} -rol {z1}+1 -rol {z1}+2 -rol {z1}+3 -asl {z1} -rol {z1}+1 -rol {z1}+2 -rol {z1}+3 -asl {z1} -rol {z1}+1 -rol {z1}+2 -rol {z1}+3 -asl {z1} -rol {z1}+1 -rol {z1}+2 -rol {z1}+3 -//FRAGMENT vwuz1=vbuc1_plus__hi_vdsz2 -NO_SYNTHESIS -//FRAGMENT vwuz1=vwuc1_plus__hi_vdsz2 -clc -lda #<{c1} -adc {z2}+2 -sta {z1} -lda #>{c1} -adc {z2}+3 -sta {z1}+1 -//FRAGMENT vwuz1=vbsc1_plus__hi_vdsz2 -NO_SYNTHESIS -//FRAGMENT vwuz1=vwuz2_minus_vwuz1 -lda {z2} -sec -sbc {z1} -sta {z1} -lda {z2}+1 -sbc {z1}+1 -sta {z1}+1 -//FRAGMENT vdsz1=vdsz1_rol_4 -asl {z1} -rol {z1}+1 -rol {z1}+2 -rol {z1}+3 -asl {z1} -rol {z1}+1 -rol {z1}+2 -rol {z1}+3 -asl {z1} -rol {z1}+1 -rol {z1}+2 -rol {z1}+3 -asl {z1} -rol {z1}+1 -rol {z1}+2 -rol {z1}+3 -//FRAGMENT vwsz1=vwsz2_ror_2 -lda {z2}+1 -cmp #$80 -ror -sta {z1}+1 -lda {z2} -ror -sta {z1} -lda {z1}+1 -cmp #$80 -ror {z1}+1 -ror {z1} -//FRAGMENT vwsz1=vbsc1_plus_vwsz2 -clc -lda {z2} -adc #<{c1} -sta {z1} -lda {z2}+1 -adc #>{c1} -sta {z1}+1 -//FRAGMENT vwsz1=vwsz1_plus_vbuz2 -clc -lda {z1} -adc {z2} -sta {z1} -lda {z1}+1 -adc #0 -sta {z1}+1 -//FRAGMENT vwsz1=vwsc1_plus_vwsz1 -clc -lda {z1} -adc #<{c1} -sta {z1} -lda {z1}+1 -adc #>{c1} -sta {z1}+1 -//FRAGMENT vwsz1=vbsc1_plus_vwsz1 -clc -lda {z1} -adc #<{c1} -sta {z1} -lda {z1}+1 -adc #>{c1} -sta {z1}+1 -//FRAGMENT vwuz1=_word_pbuc1_derefidx_vbuz2 -ldy {z2} -lda {c1},y -sta {z1} -lda #0 -sta {z1}+1 -//FRAGMENT vwuz1=_word_pbuc1_derefidx_vbuaa -tay -lda {c1},y -sta {z1} -lda #0 -sta {z1}+1 -//FRAGMENT vwuz1=_word_pbuc1_derefidx_vbuxx -lda {c1},x -sta {z1} -lda #0 -sta {z1}+1 -//FRAGMENT vwuz1=_word_pbuc1_derefidx_vbuyy -lda {c1},y -sta {z1} -lda #0 -sta {z1}+1 //FRAGMENT pbuz1_ge_vwuc1_then_la1 lda {z1}+1 cmp #>{c1} @@ -17019,6 +15801,13 @@ sta {z1} lda {z1}+1 sbc $ff sta {z1}+1 +//FRAGMENT vwuz1=vwuz1_plus_vbuaa +clc +adc {z1} +sta {z1} +bcc !+ +inc {z1}+1 +!: //FRAGMENT vbsaa_le_0_then_la1 cmp #1 bmi {la1} @@ -17813,193 +16602,6 @@ lda {c1},y clc adc {c2},y tay -//FRAGMENT vbuz1=pbuz2_derefidx_(pbuz3_derefidx_vbuz4)_plus_pbuz5_derefidx_(pbuz6_derefidx_vbuz4) -ldy {z4} -lda ({z6}),y -sta $ff -lda ({z3}),y -tay -lda ({z2}),y -ldy $ff -clc -adc ({z5}),y -sta {z1} -//FRAGMENT vbuz1=vbuz1_bor_pbuc1_derefidx_vbuaa -tay -lda {c1},y -ora {z1} -sta {z1} -//FRAGMENT vbuxx=vbuxx_bor_pbuc1_derefidx_vbuaa -tay -txa -ora {c1},y -tax -//FRAGMENT vbuyy=vbuyy_bor_pbuc1_derefidx_vbuaa -tax -tya -ora {c1},x -tay -//FRAGMENT vbuaa=pbuz1_derefidx_(pbuz2_derefidx_vbuz3)_plus_pbuz4_derefidx_(pbuz5_derefidx_vbuz3) -ldy {z3} -lda ({z5}),y -sta $ff -lda ({z2}),y -tay -lda ({z1}),y -ldy $ff -clc -adc ({z4}),y -//FRAGMENT vbuxx=pbuz1_derefidx_(pbuz2_derefidx_vbuz3)_plus_pbuz4_derefidx_(pbuz5_derefidx_vbuz3) -ldy {z3} -lda ({z5}),y -sta $ff -lda ({z2}),y -tay -lda ({z1}),y -ldy $ff -clc -adc ({z4}),y -tax -//FRAGMENT vbuyy=pbuz1_derefidx_(pbuz2_derefidx_vbuz3)_plus_pbuz4_derefidx_(pbuz5_derefidx_vbuz3) -ldy {z3} -lda ({z5}),y -sta $ff -lda ({z2}),y -tay -lda ({z1}),y -ldy $ff -clc -adc ({z4}),y -tay -//FRAGMENT vbuz1=pbuz2_derefidx_(pbuz3_derefidx_vbuaa)_plus_pbuz4_derefidx_(pbuz5_derefidx_vbuaa) -tay -lda ({z5}),y -sta $ff -lda ({z3}),y -tay -lda ({z2}),y -ldy $ff -clc -adc ({z4}),y -sta {z1} -//FRAGMENT vbuaa=pbuz1_derefidx_(pbuz2_derefidx_vbuaa)_plus_pbuz3_derefidx_(pbuz4_derefidx_vbuaa) -tay -lda ({z4}),y -sta $ff -lda ({z2}),y -tay -lda ({z1}),y -ldy $ff -clc -adc ({z3}),y -//FRAGMENT vbuxx=pbuz1_derefidx_(pbuz2_derefidx_vbuaa)_plus_pbuz3_derefidx_(pbuz4_derefidx_vbuaa) -tay -lda ({z4}),y -sta $ff -lda ({z2}),y -tay -lda ({z1}),y -ldy $ff -clc -adc ({z3}),y -tax -//FRAGMENT vbuyy=pbuz1_derefidx_(pbuz2_derefidx_vbuaa)_plus_pbuz3_derefidx_(pbuz4_derefidx_vbuaa) -tay -lda ({z4}),y -sta $ff -lda ({z2}),y -tay -lda ({z1}),y -ldy $ff -clc -adc ({z3}),y -tay -//FRAGMENT vbuz1=pbuz2_derefidx_(pbuz3_derefidx_vbuxx)_plus_pbuz4_derefidx_(pbuz5_derefidx_vbuxx) -txa -tay -lda ({z5}),y -sta $ff -lda ({z3}),y -tay -lda ({z2}),y -ldy $ff -clc -adc ({z4}),y -sta {z1} -//FRAGMENT vbuaa=pbuz1_derefidx_(pbuz2_derefidx_vbuxx)_plus_pbuz3_derefidx_(pbuz4_derefidx_vbuxx) -txa -tay -lda ({z4}),y -sta $ff -lda ({z2}),y -tay -lda ({z1}),y -ldy $ff -clc -adc ({z3}),y -//FRAGMENT vbuxx=pbuz1_derefidx_(pbuz2_derefidx_vbuxx)_plus_pbuz3_derefidx_(pbuz4_derefidx_vbuxx) -txa -tay -lda ({z4}),y -sta $ff -lda ({z2}),y -tay -lda ({z1}),y -ldy $ff -clc -adc ({z3}),y -tax -//FRAGMENT vbuyy=pbuz1_derefidx_(pbuz2_derefidx_vbuxx)_plus_pbuz3_derefidx_(pbuz4_derefidx_vbuxx) -txa -tay -lda ({z4}),y -sta $ff -lda ({z2}),y -tay -lda ({z1}),y -ldy $ff -clc -adc ({z3}),y -tay -//FRAGMENT vbuz1=pbuz2_derefidx_(pbuz3_derefidx_vbuyy)_plus_pbuz4_derefidx_(pbuz5_derefidx_vbuyy) -lda ({z5}),y -sta $ff -lda ({z3}),y -tay -lda ({z2}),y -ldy $ff -clc -adc ({z4}),y -sta {z1} -//FRAGMENT vbuaa=pbuz1_derefidx_(pbuz2_derefidx_vbuyy)_plus_pbuz3_derefidx_(pbuz4_derefidx_vbuyy) -lda ({z4}),y -sta $ff -lda ({z2}),y -tay -lda ({z1}),y -ldy $ff -clc -adc ({z3}),y -//FRAGMENT vbuxx=pbuz1_derefidx_(pbuz2_derefidx_vbuyy)_plus_pbuz3_derefidx_(pbuz4_derefidx_vbuyy) -lda ({z4}),y -sta $ff -lda ({z2}),y -tay -lda ({z1}),y -ldy $ff -clc -adc ({z3}),y -tax -//FRAGMENT vbuyy=pbuz1_derefidx_(pbuz2_derefidx_vbuyy)_plus_pbuz3_derefidx_(pbuz4_derefidx_vbuyy) -lda ({z4}),y -sta $ff -lda ({z2}),y -tay -lda ({z1}),y -ldy $ff -clc -adc ({z3}),y -tay //FRAGMENT _deref_pbuc1=_deref_(_deref_qbuc2) ldy {c2} sty $fe @@ -18029,9 +16631,44 @@ lda #0 !: adc {z2}+1 sta {z1}+1 +//FRAGMENT pwsz1=pwsc1_plus_vwuz2 +clc +lda {z2} +adc #<{c1} +sta {z1} +lda {z2}+1 +adc #>{c1} +sta {z1}+1 +//FRAGMENT vwsz1=_deref_pwsz2 +ldy #0 +lda ({z2}),y +sta {z1} +iny +lda ({z2}),y +sta {z1}+1 +//FRAGMENT vwuz1=vwuz2_ror_3 +lda {z2}+1 +lsr +sta {z1}+1 +lda {z2} +ror +sta {z1} +lsr {z1}+1 +ror {z1} +lsr {z1}+1 +ror {z1} //FRAGMENT vbsaa_eq_vbsc1_then_la1 cmp #{c1} beq {la1} +//FRAGMENT vbsaa=vbsz1_minus_vbsaa +eor #$ff +sec +adc {z1} +//FRAGMENT vbsaa=vbsxx_minus_vbsaa +sta $ff +txa +sec +sbc $ff //FRAGMENT vbsaa=vbsyy_minus_vbsaa sta $ff tya @@ -18100,11 +16737,35 @@ lda #0 !: adc {z1}+1 sta {z1}+1 +//FRAGMENT pwsz1=pwsc1_plus_vwuz1 +clc +lda {z1} +adc #<{c1} +sta {z1} +lda {z1}+1 +adc #>{c1} +sta {z1}+1 +//FRAGMENT vwuz1=vwuz1_ror_3 +lsr {z1}+1 +ror {z1} +lsr {z1}+1 +ror {z1} +lsr {z1}+1 +ror {z1} //FRAGMENT vwuz1=vwuz1_rol_2 asl {z1} rol {z1}+1 asl {z1} rol {z1}+1 +//FRAGMENT vwsz1=_deref_pwsz1 +ldy #0 +lda ({z1}),y +pha +iny +lda ({z1}),y +sta {z1}+1 +pla +sta {z1} //FRAGMENT _deref_pwsz1=vwsc1 ldy #0 lda #<{c1} @@ -18125,6 +16786,14 @@ sta {z1}+1 ldy #1 lda ({z2}),y sta {z1} +//FRAGMENT pwsz1=pwsz1_plus_vbuc1 +lda #{c1} +clc +adc {z1} +sta {z1} +bcc !+ +inc {z1}+1 +!: //FRAGMENT vbuaa=_hi__deref_pwsz1 ldy #1 lda ({z1}),y @@ -18405,6 +17074,16 @@ clc ldy #0 adc ({z2}),y tay +//FRAGMENT vwuz1=_deref_pwuz2_plus__deref_pwuz3 +ldy #0 +clc +lda ({z2}),y +adc ({z3}),y +sta {z1} +iny +lda ({z2}),y +adc ({z3}),y +sta {z1}+1 //FRAGMENT vwuz1=_deref_pwuz2_plus__deref_pwuz1 ldy #0 clc @@ -18539,16 +17218,29 @@ sta {c1},y lda {c1}+1,y adc #>{c2} sta {c1}+1,y -//FRAGMENT vwsz1=_deref_pwsz2_minus__deref_pwsz3 -ldy #0 -sec -lda ({z2}),y -sbc ({z3}),y +//FRAGMENT vbuz1=vbuz1_bor_pbuc1_derefidx_vbuaa +tay +lda {c1},y +ora {z1} sta {z1} -iny -lda ({z2}),y -sbc ({z3}),y +//FRAGMENT vbuxx=vbuxx_bor_pbuc1_derefidx_vbuaa +tay +txa +ora {c1},y +tax +//FRAGMENT vbuyy=vbuyy_bor_pbuc1_derefidx_vbuaa +tax +tya +ora {c1},x +tay +//FRAGMENT vduz1=_dword_vwuz2 +lda {z2} +sta {z1} +lda {z2}+1 sta {z1}+1 +lda #0 +sta {z1}+2 +sta {z1}+3 //FRAGMENT vduz1=vduz2_plus_vwuz3 lda {z2} clc @@ -18585,152 +17277,10 @@ ldy {c1}+1 sty $ff ldy #0 sta ($fe),y -//FRAGMENT vwsz1=vwsz2_minus_vwsc1 -lda {z2} -sec -sbc #<{c1} -sta {z1} -lda {z2}+1 -sbc #>{c1} -sta {z1}+1 -//FRAGMENT vwsz1=_sword_pbsc1_derefidx_vbuz2 -ldy {z2} -lda {c1},y -sta {z1} -// sign-extend the byte -ora #$7f -bmi !+ -lda #0 -!: -sta {z1}+1 -//FRAGMENT vwsz1=_sword_vbsz2 -lda {z2} -sta {z1} -// sign-extend the byte -ora #$7f -bmi !+ -lda #0 -!: -sta {z1}+1 -//FRAGMENT vwsz1=vwsz2_rol_3 -lda {z2} -asl -sta {z1} -lda {z2}+1 -rol -sta {z1}+1 -asl {z1} -rol {z1}+1 -asl {z1} -rol {z1}+1 -//FRAGMENT vwsz1=vwsz2_ror_6 -lda {z2} -sta $ff -lda {z2}+1 -sta {z1} -lda #0 -bit {z2}+1 -bpl !+ -lda #$ff -!: -sta {z1}+1 -rol $ff -rol {z1} -rol {z1}+1 -rol $ff -rol {z1} -rol {z1}+1 -//FRAGMENT vwsz1=_deref_pwsc1 -lda {c1} -sta {z1} -lda {c1}+1 -sta {z1}+1 -//FRAGMENT vwsz1=_sword_pbsc1_derefidx_vbuaa -tay -lda {c1},y -sta {z1} -// sign-extend the byte -ora #$7f -bmi !+ -lda #0 -!: -sta {z1}+1 -//FRAGMENT vwsz1=_sword_pbsc1_derefidx_vbuxx -lda {c1},x -sta {z1} -// sign-extend the byte -ora #$7f -bmi !+ -lda #0 -!: -sta {z1}+1 -//FRAGMENT vwsz1=_sword_pbsc1_derefidx_vbuyy -lda {c1},y -sta {z1} -// sign-extend the byte -ora #$7f -bmi !+ -lda #0 -!: -sta {z1}+1 -//FRAGMENT vwsz1=_sword_vbsaa -sta {z1} -// sign-extend the byte -ora #$7f -bmi !+ -lda #0 -!: -sta {z1}+1 -//FRAGMENT vwsz1=_sword_vbsxx -txa -sta {z1} -// sign-extend the byte -ora #$7f -bmi !+ -lda #0 -!: -sta {z1}+1 -//FRAGMENT vwsz1=_sword_vbsyy -tya -sta {z1} -// sign-extend the byte -ora #$7f -bmi !+ -lda #0 -!: -sta {z1}+1 -//FRAGMENT vwsz1=vwsz2_minus_vwsz1 -lda {z2} -sec -sbc {z1} -sta {z1} -lda {z2}+1 -sbc {z1}+1 -sta {z1}+1 -//FRAGMENT vwsz1=vwsz1_ror_6 -lda {z1} -sta $ff -lda {z1}+1 -sta {z1} -lda #0 -bit {z1}+1 -bpl !+ -lda #$ff -!: -sta {z1}+1 -rol $ff -rol {z1} -rol {z1}+1 -rol $ff -rol {z1} -rol {z1}+1 -//FRAGMENT vwsz1=vwsz1_rol_3 -asl {z1} -rol {z1}+1 -asl {z1} -rol {z1}+1 -asl {z1} -rol {z1}+1 +//FRAGMENT _deref_pwsc1=vbsc2 +NO_SYNTHESIS +//FRAGMENT _deref_pwsc1=vwuc2 +NO_SYNTHESIS //FRAGMENT vbsz1_le_vbsc1_then_la1 lda #{c1} sec @@ -18816,11 +17366,25 @@ lda #0 !: adc #>{c1} sta {z1}+1 +//FRAGMENT vwsz1=vwsz1_minus_vwsz2 +lda {z1} +sec +sbc {z2} +sta {z1} +lda {z1}+1 +sbc {z2}+1 +sta {z1}+1 //FRAGMENT vbuaa_gt_vbuz1_then_la1 cmp {z1} beq !+ bcs {la1} !: +//FRAGMENT qbuc1_derefidx_vbuz1=pbuz2 +ldy {z1} +lda {z2} +sta {c1},y +lda {z2}+1 +sta {c1}+1,y //FRAGMENT pduc1_derefidx_vbuz1=pduc2_derefidx_vbuz1 ldy {z1} lda {c2},y @@ -18858,6 +17422,16 @@ lda {z1} sta {c1},y lda {z1}+1 sta {c1}+1,y +//FRAGMENT qbuc1_derefidx_vbuxx=pbuz1 +lda {z1} +sta {c1},x +lda {z1}+1 +sta {c1}+1,x +//FRAGMENT qbuc1_derefidx_vbuyy=pbuz1 +lda {z1} +sta {c1},y +lda {z1}+1 +sta {c1}+1,y //FRAGMENT pduc1_derefidx_vbuaa=pduc2_derefidx_vbuaa tay lda {c2},y @@ -18949,80 +17523,13 @@ sta {z1} lda {z2}+1 sbc #0 sta {z1}+1 -//FRAGMENT vduz1_eq_vduz2_then_la1 -lda {z1} -cmp {z2} -bne !+ +//FRAGMENT vwsz1_neq_vwsc1_then_la1 lda {z1}+1 -cmp {z2}+1 -bne !+ -lda {z1}+2 -cmp {z2}+2 -bne !+ -lda {z1}+3 -cmp {z2}+3 -beq {la1} -!: -//FRAGMENT vdsz1_eq_vdsz2_then_la1 +cmp #>{c1} +bne {la1} lda {z1} -cmp {z2} -bne !+ -lda {z1}+1 -cmp {z2}+1 -bne !+ -lda {z1}+2 -cmp {z2}+2 -bne !+ -lda {z1}+3 -cmp {z2}+3 -beq {la1} -!: -//FRAGMENT vdsz1=vdsz1_plus_vwsz2 -lda {z2}+1 -ora #$7f -bmi !+ -lda #0 -!: -sta $ff -lda {z1} -clc -adc {z2} -sta {z1} -lda {z1}+1 -adc {z2}+1 -sta {z1}+1 -lda {z1}+2 -adc $ff -sta {z1}+2 -lda {z1}+3 -adc $ff -sta {z1}+3 -//FRAGMENT vdsz1=vdsz1_minus_vwsz2 -lda {z2}+1 -ora #$7f -bmi !+ -lda #0 -!: -sta $ff -sec -lda {z1} -sbc {z2} -sta {z1} -lda {z1}+1 -sbc {z2}+1 -sta {z1}+1 -lda {z1}+2 -sbc $ff -sta {z1}+2 -lda {z1}+3 -sbc $ff -sta {z1}+3 -//FRAGMENT vwsz1=_dec_vwsz1 -lda {z1} -bne !+ -dec {z1}+1 -!: -dec {z1} +cmp #<{c1} +bne {la1} //FRAGMENT _deref_pwuc1=vbuz1 lda {z1} sta {c1} @@ -19083,10 +17590,23 @@ asl {z1} rol {z1}+1 asl {z1} rol {z1}+1 +//FRAGMENT vwuz1=_word_pbuc1_derefidx_vbuz2 +ldy {z2} +lda {c1},y +sta {z1} +lda #0 +sta {z1}+1 //FRAGMENT pbsc1_derefidx_vbuz1=vbsc2 lda #{c2} ldy {z1} sta {c1},y +//FRAGMENT _deref_pbuz1=_deref_pbuz1_bor_pbuc1_derefidx_vbuz2 +ldy #0 +lda ({z1}),y +ldy {z2} +ora {c1},y +ldy #0 +sta ({z1}),y //FRAGMENT vwsz1=pwsc1_derefidx_vbuaa_minus_pwsc2_derefidx_vbuaa tay sec @@ -19148,12 +17668,41 @@ asl {z1} rol {z1}+1 asl {z1} rol {z1}+1 +//FRAGMENT vwuz1=_word_pbuc1_derefidx_vbuxx +lda {c1},x +sta {z1} +lda #0 +sta {z1}+1 +//FRAGMENT vwuz1=_word_pbuc1_derefidx_vbuyy +lda {c1},y +sta {z1} +lda #0 +sta {z1}+1 //FRAGMENT pbsc1_derefidx_vbuxx=vbsc2 lda #{c2} sta {c1},x //FRAGMENT pbsc1_derefidx_vbuyy=vbsc2 lda #{c2} sta {c1},y +//FRAGMENT _deref_pbuz1=_deref_pbuz1_bor_pbuc1_derefidx_vbuaa +tay +lda {c1},y +ldy #0 +ora ({z1}),y +ldy #0 +sta ({z1}),y +//FRAGMENT _deref_pbuz1=_deref_pbuz1_bor_pbuc1_derefidx_vbuxx +lda {c1},x +ldy #0 +ora ({z1}),y +ldy #0 +sta ({z1}),y +//FRAGMENT _deref_pbuz1=_deref_pbuz1_bor_pbuc1_derefidx_vbuyy +lda {c1},y +ldy #0 +ora ({z1}),y +ldy #0 +sta ({z1}),y //FRAGMENT _deref_pwuc1=_deref_pwuc1_plus_vwuc2 lda #<{c2} clc @@ -19479,6 +18028,27 @@ lda {z2}+2 sta {z1}+2 lda {z2}+3 sta {z1}+3 +//FRAGMENT vduz1=vduz2_rol_3 +lda {z2} +asl +sta {z1} +lda {z2}+1 +rol +sta {z1}+1 +lda {z2}+2 +rol +sta {z1}+2 +lda {z2}+3 +rol +sta {z1}+3 +asl {z1} +rol {z1}+1 +rol {z1}+2 +rol {z1}+3 +asl {z1} +rol {z1}+1 +rol {z1}+2 +rol {z1}+3 //FRAGMENT vduz1=vduz2_rol_5 lda {z2} asl @@ -19983,3 +18553,29 @@ ror {z1} dex bne !- !e: +//FRAGMENT vwsz1=_sword_vbsz2 +lda {z2} +sta {z1} +// sign-extend the byte +ora #$7f +bmi !+ +lda #0 +!: +sta {z1}+1 +//FRAGMENT vwsz1=vwsz1_minus_vwsc1 +lda {z1} +sec +sbc #<{c1} +sta {z1} +lda {z1}+1 +sbc #>{c1} +sta {z1}+1 +//FRAGMENT vwsz1=_sword_vbsyy +tya +sta {z1} +// sign-extend the byte +ora #$7f +bmi !+ +lda #0 +!: +sta {z1}+1 diff --git a/src/main/fragment/cache/fragment-cache-wdc65c02.asm b/src/main/fragment/cache/fragment-cache-wdc65c02.asm index 0560a24b1..1867d6adb 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 12916116c7 12916134cc +//KICKC FRAGMENT CACHE 129161168d 129161348a //FRAGMENT vbuz1=_deref_pbuc1 lda {c1} sta {z1} diff --git a/src/test/java/dk/camelot64/kickc/test/TestPrograms.java b/src/test/java/dk/camelot64/kickc/test/TestPrograms.java index 1ea5cf149..bbc7aa016 100644 --- a/src/test/java/dk/camelot64/kickc/test/TestPrograms.java +++ b/src/test/java/dk/camelot64/kickc/test/TestPrograms.java @@ -47,6 +47,11 @@ public class TestPrograms { compileAndCompare("adventofcode/2020-04.c"); } + @Test + public void testStructArrayProblem1() throws IOException, URISyntaxException { + compileAndCompare("struct-array-problem-1.c"); + } + @Test public void testAdventOfCode03() throws IOException, URISyntaxException { compileAndCompare("adventofcode/2020-03.c"); diff --git a/src/test/kc/struct-array-problem-1.c b/src/test/kc/struct-array-problem-1.c new file mode 100644 index 000000000..f3c4b57f4 --- /dev/null +++ b/src/test/kc/struct-array-problem-1.c @@ -0,0 +1,30 @@ +// Demonstrates problem with structs containing arrays and auto-type conversion +// https://gitlab.com/camelot/kickc/-/issues/593 + +typedef struct hostslots { + // this should be [8][32], but kickc doesn't do double arrays + unsigned char host[256]; +} HostSlots; +#define HOSTSLOT_SIZE 32 + +char * const OUT = 0x8000; + +void main() { + __mem HostSlots slots1 = {"some data that would fit a normal 8x32 double array"}; + __mem HostSlots slots2 = {"more data that would fit a normal 8x32 double array"}; + doStuff(&slots1); + doStuff(&slots2); +} + +void doStuff(HostSlots *hs) { + for(unsigned char i = 0; i < 8; i++) { + // should be: + // if (hs->host[i][0] != 0) { + char *hsp = hs->host[i * HOSTSLOT_SIZE]; + if (*hsp != 0) { + *(OUT + i) = 1; + } else { + *(OUT + i) = 2; + } + } +} diff --git a/src/test/ref/adventofcode/2020-01.asm b/src/test/ref/adventofcode/2020-01.asm index 2b41f0f91..37fa956bb 100644 --- a/src/test/ref/adventofcode/2020-01.asm +++ b/src/test/ref/adventofcode/2020-01.asm @@ -785,8 +785,7 @@ mul16u: { __b1: // while(a!=0) lda.z a - bne __b2 - lda.z a+1 + ora.z a+1 bne __b2 // } rts diff --git a/src/test/ref/adventofcode/2020-01.log b/src/test/ref/adventofcode/2020-01.log index 5e0155e7a..0e2a0751b 100644 --- a/src/test/ref/adventofcode/2020-01.log +++ b/src/test/ref/adventofcode/2020-01.log @@ -6668,41 +6668,41 @@ Uplift Scope [printf_buffer_number] Uplift Scope [printf_format_string] Uplift Scope [] 0: mem[12] [ printf_buffer ] -Uplifting [memcpy] best 34265632 combination zp[2]:187 [ memcpy::src#2 memcpy::src#4 memcpy::src#1 ] zp[2]:189 [ memcpy::dst#2 memcpy::dst#4 memcpy::dst#1 ] zp[2]:328 [ memcpy::src_end#0 ] zp[2]:310 [ memcpy::source#0 ] zp[2]:312 [ memcpy::destination#0 ] -Uplifting [memset] best 34265632 combination zp[2]:162 [ memset::dst#2 memset::dst#4 memset::dst#1 ] zp[2]:264 [ memset::end#0 ] zp[2]:158 [ memset::num#2 ] zp[2]:160 [ memset::str#3 memset::str#7 memset::str#8 ] zp[2]:314 [ memset::str#0 ] -Uplifting [utoa_append] best 33665629 combination zp[2]:179 [ utoa_append::value#2 utoa_append::value#0 utoa_append::value#1 ] reg byte x [ utoa_append::digit#2 utoa_append::digit#1 ] zp[2]:275 [ utoa_append::sub#0 ] zp[2]:277 [ utoa_append::return#0 ] zp[2]:273 [ utoa_append::buffer#0 ] -Uplifting [ultoa_append] best 33065626 combination zp[4]:182 [ ultoa_append::value#2 ultoa_append::value#0 ultoa_append::value#1 ] reg byte x [ ultoa_append::digit#2 ultoa_append::digit#1 ] zp[4]:289 [ ultoa_append::sub#0 ] zp[4]:293 [ ultoa_append::return#0 ] zp[2]:287 [ ultoa_append::buffer#0 ] -Uplifting [cursorLocation] best 33065626 combination zp[2]:318 [ cursorLocation::$4 ] zp[2]:320 [ cursorLocation::$5 ] zp[2]:322 [ cursorLocation::$0 ] zp[2]:324 [ cursorLocation::$1 ] zp[2]:316 [ cursorLocation::$3 ] zp[2]:326 [ cursorLocation::return#1 ] zp[2]:297 [ cursorLocation::return#3 ] zp[2]:303 [ cursorLocation::return#0 ] -Uplifting [setcursor] best 33065615 combination reg byte a [ setcursor::c#1 ] zp[2]:299 [ setcursor::loc#0 ] reg byte x [ setcursor::c#0 ] -Uplifting [putchar] best 33065606 combination reg byte a [ putchar::newChar#0 ] zp[2]:305 [ putchar::loc#0 ] -Uplifting [newline] best 33065606 combination zp[2]:308 [ newline::start#0 ] -Uplifting [cputc] best 33065602 combination reg byte x [ cputc::convertToScreenCode1_return#0 ] zp[1]:262 [ cputc::c ] -Uplifting [cputs] best 32975602 combination zp[2]:138 [ cputs::s#26 cputs::s#27 cputs::s#0 ] reg byte a [ cputs::c#1 ] -Uplifting [utoa] best 32845598 combination zp[2]:168 [ utoa::buffer#11 utoa::buffer#14 utoa::buffer#4 ] zp[2]:165 [ utoa::value#2 utoa::value#6 utoa::value#1 utoa::value#0 ] zp[1]:164 [ utoa::digit#2 utoa::digit#1 ] reg byte a [ utoa::$10 ] reg byte x [ utoa::started#2 utoa::started#4 ] zp[2]:271 [ utoa::digit_value#0 ] reg byte a [ utoa::$11 ] zp[2]:268 [ utoa::buffer#3 ] -Uplifting [ultoa] best 32715594 combination zp[2]:177 [ ultoa::buffer#11 ultoa::buffer#14 ultoa::buffer#4 ] zp[4]:172 [ ultoa::value#2 ultoa::value#6 ultoa::value#1 ultoa::value#0 ] zp[1]:171 [ ultoa::digit#2 ultoa::digit#1 ] reg byte a [ ultoa::$10 ] reg byte x [ ultoa::started#2 ultoa::started#4 ] zp[4]:283 [ ultoa::digit_value#0 ] reg byte a [ ultoa::$11 ] zp[2]:280 [ ultoa::buffer#3 ] -Uplifting [mul16u] best 32655594 combination zp[4]:146 [ mul16u::res#2 mul16u::res#6 mul16u::res#1 ] zp[4]:150 [ mul16u::mb#2 mul16u::mb#0 mul16u::mb#1 ] reg byte a [ mul16u::$1 ] zp[2]:144 [ mul16u::a#4 mul16u::a#7 mul16u::a#1 mul16u::a#2 mul16u::a#3 mul16u::a#0 ] zp[2]:142 [ mul16u::b#3 mul16u::b#0 mul16u::b#1 mul16u::b#2 ] zp[4]:217 [ mul16u::return#3 ] zp[4]:227 [ mul16u::return#4 ] zp[4]:253 [ mul16u::return#2 ] -Uplifting [printf_number_buffer] best 32655582 combination reg byte a [ printf_number_buffer::buffer_sign#10 printf_number_buffer::buffer_sign#1 printf_number_buffer::buffer_sign#0 ] -Uplifting [main] best 32655582 combination zp[2]:134 [ main::k#10 main::k#0 main::k#1 ] zp[2]:197 [ main::$54 ] zp[2]:203 [ main::$55 ] zp[2]:205 [ main::$22 ] zp[2]:207 [ main::$56 ] zp[2]:209 [ main::$57 ] zp[2]:211 [ main::$58 ] zp[2]:213 [ main::$59 ] zp[2]:215 [ main::$60 ] zp[4]:221 [ main::mul1#0 ] zp[2]:225 [ main::$61 ] zp[2]:195 [ main::$53 ] zp[4]:231 [ main::mul2#0 ] zp[2]:199 [ main::$21 ] zp[2]:132 [ main::j1#2 main::j1#0 main::j1#1 ] zp[2]:136 [ main::j#10 main::j#0 main::j#1 ] zp[2]:241 [ main::$48 ] zp[2]:243 [ main::$8 ] zp[2]:245 [ main::$49 ] zp[2]:247 [ main::$50 ] zp[2]:249 [ main::$51 ] zp[2]:251 [ main::$52 ] zp[2]:201 [ main::$43 ] zp[2]:239 [ main::$47 ] zp[4]:257 [ main::mul#0 ] zp[2]:191 [ main::$41 ] zp[2]:193 [ main::$42 ] zp[2]:130 [ main::i1#2 main::i1#1 ] zp[2]:128 [ main::i#2 main::i#1 ] zp[2]:235 [ main::$34 ] zp[2]:237 [ main::$35 ] -Uplifting [printf_uint] best 32655582 combination zp[2]:140 [ printf_uint::uvalue#12 printf_uint::uvalue#2 printf_uint::uvalue#3 printf_uint::uvalue#4 printf_uint::uvalue#5 printf_uint::uvalue#6 printf_uint::uvalue#7 printf_uint::uvalue#8 printf_uint::uvalue#9 printf_uint::uvalue#10 printf_uint::uvalue#11 ] -Uplifting [printf_ulong] best 32655582 combination zp[4]:154 [ printf_ulong::uvalue#2 printf_ulong::uvalue#0 printf_ulong::uvalue#1 ] -Uplifting [RADIX] best 32655582 combination -Uplifting [ATARI_ANTIC] best 32655582 combination -Uplifting [ATARI_GTIA_READ] best 32655582 combination -Uplifting [ATARI_GTIA_WRITE] best 32655582 combination -Uplifting [ATARI_POKEY_READ] best 32655582 combination -Uplifting [ATARI_POKEY_WRITE] best 32655582 combination -Uplifting [gotoxy] best 32655582 combination -Uplifting [clrscr] best 32655582 combination -Uplifting [printf_format_number] best 32655582 combination -Uplifting [printf_buffer_number] best 32655582 combination -Uplifting [printf_format_string] best 32655582 combination -Uplifting [] best 32655582 combination mem[12] [ printf_buffer ] +Uplifting [memcpy] best 34240632 combination zp[2]:187 [ memcpy::src#2 memcpy::src#4 memcpy::src#1 ] zp[2]:189 [ memcpy::dst#2 memcpy::dst#4 memcpy::dst#1 ] zp[2]:328 [ memcpy::src_end#0 ] zp[2]:310 [ memcpy::source#0 ] zp[2]:312 [ memcpy::destination#0 ] +Uplifting [memset] best 34240632 combination zp[2]:162 [ memset::dst#2 memset::dst#4 memset::dst#1 ] zp[2]:264 [ memset::end#0 ] zp[2]:158 [ memset::num#2 ] zp[2]:160 [ memset::str#3 memset::str#7 memset::str#8 ] zp[2]:314 [ memset::str#0 ] +Uplifting [utoa_append] best 33640629 combination zp[2]:179 [ utoa_append::value#2 utoa_append::value#0 utoa_append::value#1 ] reg byte x [ utoa_append::digit#2 utoa_append::digit#1 ] zp[2]:275 [ utoa_append::sub#0 ] zp[2]:277 [ utoa_append::return#0 ] zp[2]:273 [ utoa_append::buffer#0 ] +Uplifting [ultoa_append] best 33040626 combination zp[4]:182 [ ultoa_append::value#2 ultoa_append::value#0 ultoa_append::value#1 ] reg byte x [ ultoa_append::digit#2 ultoa_append::digit#1 ] zp[4]:289 [ ultoa_append::sub#0 ] zp[4]:293 [ ultoa_append::return#0 ] zp[2]:287 [ ultoa_append::buffer#0 ] +Uplifting [cursorLocation] best 33040626 combination zp[2]:318 [ cursorLocation::$4 ] zp[2]:320 [ cursorLocation::$5 ] zp[2]:322 [ cursorLocation::$0 ] zp[2]:324 [ cursorLocation::$1 ] zp[2]:316 [ cursorLocation::$3 ] zp[2]:326 [ cursorLocation::return#1 ] zp[2]:297 [ cursorLocation::return#3 ] zp[2]:303 [ cursorLocation::return#0 ] +Uplifting [setcursor] best 33040615 combination reg byte a [ setcursor::c#1 ] zp[2]:299 [ setcursor::loc#0 ] reg byte x [ setcursor::c#0 ] +Uplifting [putchar] best 33040606 combination reg byte a [ putchar::newChar#0 ] zp[2]:305 [ putchar::loc#0 ] +Uplifting [newline] best 33040606 combination zp[2]:308 [ newline::start#0 ] +Uplifting [cputc] best 33040602 combination reg byte x [ cputc::convertToScreenCode1_return#0 ] zp[1]:262 [ cputc::c ] +Uplifting [cputs] best 32950602 combination zp[2]:138 [ cputs::s#26 cputs::s#27 cputs::s#0 ] reg byte a [ cputs::c#1 ] +Uplifting [utoa] best 32820598 combination zp[2]:168 [ utoa::buffer#11 utoa::buffer#14 utoa::buffer#4 ] zp[2]:165 [ utoa::value#2 utoa::value#6 utoa::value#1 utoa::value#0 ] zp[1]:164 [ utoa::digit#2 utoa::digit#1 ] reg byte a [ utoa::$10 ] reg byte x [ utoa::started#2 utoa::started#4 ] zp[2]:271 [ utoa::digit_value#0 ] reg byte a [ utoa::$11 ] zp[2]:268 [ utoa::buffer#3 ] +Uplifting [ultoa] best 32690594 combination zp[2]:177 [ ultoa::buffer#11 ultoa::buffer#14 ultoa::buffer#4 ] zp[4]:172 [ ultoa::value#2 ultoa::value#6 ultoa::value#1 ultoa::value#0 ] zp[1]:171 [ ultoa::digit#2 ultoa::digit#1 ] reg byte a [ ultoa::$10 ] reg byte x [ ultoa::started#2 ultoa::started#4 ] zp[4]:283 [ ultoa::digit_value#0 ] reg byte a [ ultoa::$11 ] zp[2]:280 [ ultoa::buffer#3 ] +Uplifting [mul16u] best 32630594 combination zp[4]:146 [ mul16u::res#2 mul16u::res#6 mul16u::res#1 ] zp[4]:150 [ mul16u::mb#2 mul16u::mb#0 mul16u::mb#1 ] reg byte a [ mul16u::$1 ] zp[2]:144 [ mul16u::a#4 mul16u::a#7 mul16u::a#1 mul16u::a#2 mul16u::a#3 mul16u::a#0 ] zp[2]:142 [ mul16u::b#3 mul16u::b#0 mul16u::b#1 mul16u::b#2 ] zp[4]:217 [ mul16u::return#3 ] zp[4]:227 [ mul16u::return#4 ] zp[4]:253 [ mul16u::return#2 ] +Uplifting [printf_number_buffer] best 32630582 combination reg byte a [ printf_number_buffer::buffer_sign#10 printf_number_buffer::buffer_sign#1 printf_number_buffer::buffer_sign#0 ] +Uplifting [main] best 32630582 combination zp[2]:134 [ main::k#10 main::k#0 main::k#1 ] zp[2]:197 [ main::$54 ] zp[2]:203 [ main::$55 ] zp[2]:205 [ main::$22 ] zp[2]:207 [ main::$56 ] zp[2]:209 [ main::$57 ] zp[2]:211 [ main::$58 ] zp[2]:213 [ main::$59 ] zp[2]:215 [ main::$60 ] zp[4]:221 [ main::mul1#0 ] zp[2]:225 [ main::$61 ] zp[2]:195 [ main::$53 ] zp[4]:231 [ main::mul2#0 ] zp[2]:199 [ main::$21 ] zp[2]:132 [ main::j1#2 main::j1#0 main::j1#1 ] zp[2]:136 [ main::j#10 main::j#0 main::j#1 ] zp[2]:241 [ main::$48 ] zp[2]:243 [ main::$8 ] zp[2]:245 [ main::$49 ] zp[2]:247 [ main::$50 ] zp[2]:249 [ main::$51 ] zp[2]:251 [ main::$52 ] zp[2]:201 [ main::$43 ] zp[2]:239 [ main::$47 ] zp[4]:257 [ main::mul#0 ] zp[2]:191 [ main::$41 ] zp[2]:193 [ main::$42 ] zp[2]:130 [ main::i1#2 main::i1#1 ] zp[2]:128 [ main::i#2 main::i#1 ] zp[2]:235 [ main::$34 ] zp[2]:237 [ main::$35 ] +Uplifting [printf_uint] best 32630582 combination zp[2]:140 [ printf_uint::uvalue#12 printf_uint::uvalue#2 printf_uint::uvalue#3 printf_uint::uvalue#4 printf_uint::uvalue#5 printf_uint::uvalue#6 printf_uint::uvalue#7 printf_uint::uvalue#8 printf_uint::uvalue#9 printf_uint::uvalue#10 printf_uint::uvalue#11 ] +Uplifting [printf_ulong] best 32630582 combination zp[4]:154 [ printf_ulong::uvalue#2 printf_ulong::uvalue#0 printf_ulong::uvalue#1 ] +Uplifting [RADIX] best 32630582 combination +Uplifting [ATARI_ANTIC] best 32630582 combination +Uplifting [ATARI_GTIA_READ] best 32630582 combination +Uplifting [ATARI_GTIA_WRITE] best 32630582 combination +Uplifting [ATARI_POKEY_READ] best 32630582 combination +Uplifting [ATARI_POKEY_WRITE] best 32630582 combination +Uplifting [gotoxy] best 32630582 combination +Uplifting [clrscr] best 32630582 combination +Uplifting [printf_format_number] best 32630582 combination +Uplifting [printf_buffer_number] best 32630582 combination +Uplifting [printf_format_string] best 32630582 combination +Uplifting [] best 32630582 combination mem[12] [ printf_buffer ] Attempting to uplift remaining variables inzp[1]:262 [ cputc::c ] -Uplifting [cputc] best 32655582 combination zp[1]:262 [ cputc::c ] +Uplifting [cputc] best 32630582 combination zp[1]:262 [ cputc::c ] Attempting to uplift remaining variables inzp[1]:164 [ utoa::digit#2 utoa::digit#1 ] -Uplifting [utoa] best 32655582 combination zp[1]:164 [ utoa::digit#2 utoa::digit#1 ] +Uplifting [utoa] best 32630582 combination zp[1]:164 [ utoa::digit#2 utoa::digit#1 ] Attempting to uplift remaining variables inzp[1]:171 [ ultoa::digit#2 ultoa::digit#1 ] -Uplifting [ultoa] best 32655582 combination zp[1]:171 [ ultoa::digit#2 ultoa::digit#1 ] +Uplifting [ultoa] best 32630582 combination zp[1]:171 [ ultoa::digit#2 ultoa::digit#1 ] Coalescing zero page register [ zp[2]:140 [ printf_uint::uvalue#12 printf_uint::uvalue#2 printf_uint::uvalue#3 printf_uint::uvalue#4 printf_uint::uvalue#5 printf_uint::uvalue#6 printf_uint::uvalue#7 printf_uint::uvalue#8 printf_uint::uvalue#9 printf_uint::uvalue#10 printf_uint::uvalue#11 ] ] with [ zp[2]:165 [ utoa::value#2 utoa::value#6 utoa::value#1 utoa::value#0 ] ] - score: 1 Coalescing zero page register [ zp[2]:140 [ printf_uint::uvalue#12 printf_uint::uvalue#2 printf_uint::uvalue#3 printf_uint::uvalue#4 printf_uint::uvalue#5 printf_uint::uvalue#6 printf_uint::uvalue#7 printf_uint::uvalue#8 printf_uint::uvalue#9 printf_uint::uvalue#10 printf_uint::uvalue#11 utoa::value#2 utoa::value#6 utoa::value#1 utoa::value#0 ] ] with [ zp[2]:207 [ main::$56 ] ] - score: 1 Coalescing zero page register [ zp[2]:140 [ printf_uint::uvalue#12 printf_uint::uvalue#2 printf_uint::uvalue#3 printf_uint::uvalue#4 printf_uint::uvalue#5 printf_uint::uvalue#6 printf_uint::uvalue#7 printf_uint::uvalue#8 printf_uint::uvalue#9 printf_uint::uvalue#10 printf_uint::uvalue#11 utoa::value#2 utoa::value#6 utoa::value#1 utoa::value#0 main::$56 ] ] with [ zp[2]:209 [ main::$57 ] ] - score: 1 @@ -8005,8 +8005,7 @@ mul16u: { __b1: // [158] if(mul16u::a#4!=0) goto mul16u::@2 -- vwuz1_neq_0_then_la1 lda.z a - bne __b2 - lda.z a+1 + ora.z a+1 bne __b2 jmp __breturn // mul16u::@return @@ -9754,7 +9753,7 @@ mem[12] [ printf_buffer ] FINAL ASSEMBLER -Score: 27721937 +Score: 27696937 // File Comments // https://adventofcode.com/2020/day/1/input @@ -10876,8 +10875,7 @@ mul16u: { // while(a!=0) // [158] if(mul16u::a#4!=0) goto mul16u::@2 -- vwuz1_neq_0_then_la1 lda.z a - bne __b2 - lda.z a+1 + ora.z a+1 bne __b2 // mul16u::@return // } diff --git a/src/test/ref/bitmap-line-anim-2.asm b/src/test/ref/bitmap-line-anim-2.asm index 04a58fcf0..833697ccb 100644 --- a/src/test/ref/bitmap-line-anim-2.asm +++ b/src/test/ref/bitmap-line-anim-2.asm @@ -180,16 +180,13 @@ bitmap_line: { // dy = abs_u16(y2-y1) // if(dx==0 && dy==0) lda.z dx - bne __b1 - lda.z dx+1 + ora.z dx+1 bne __b1 lda.z dy - bne !+ - lda.z dy+1 + ora.z dy+1 bne !__b4+ jmp __b4 !__b4: - !: __b1: // sgn_u16(x2-x1) lda.z x2 diff --git a/src/test/ref/bitmap-line-anim-2.log b/src/test/ref/bitmap-line-anim-2.log index 85e8382e9..f0bd95a39 100644 --- a/src/test/ref/bitmap-line-anim-2.log +++ b/src/test/ref/bitmap-line-anim-2.log @@ -2211,25 +2211,25 @@ Uplift Scope [MOS6581_SID] Uplift Scope [bitmap_clear] Uplift Scope [main] -Uplifting [bitmap_plot] best 37076 combination reg byte x [ bitmap_plot::y#4 bitmap_plot::y#2 bitmap_plot::y#1 bitmap_plot::y#3 ] zp[2]:63 [ bitmap_plot::$0 ] reg byte x [ bitmap_plot::$1 ] zp[2]:65 [ bitmap_plot::plotter#1 ] zp[2]:31 [ bitmap_plot::x#4 bitmap_plot::x#2 bitmap_plot::x#1 bitmap_plot::x#3 ] zp[2]:61 [ bitmap_plot::plotter#0 ] -Uplifting [bitmap_line] best 37076 combination zp[2]:11 [ bitmap_line::x#7 bitmap_line::x#6 bitmap_line::x#15 bitmap_line::x#13 bitmap_line::x#12 bitmap_line::x#1 ] zp[2]:13 [ bitmap_line::y#15 bitmap_line::y#7 bitmap_line::y#13 bitmap_line::y#4 bitmap_line::y#1 bitmap_line::y#2 ] zp[2]:9 [ bitmap_line::e#3 bitmap_line::e#0 bitmap_line::e#6 bitmap_line::e#1 bitmap_line::e#2 ] zp[2]:15 [ bitmap_line::e1#3 bitmap_line::e1#6 bitmap_line::e1#0 bitmap_line::e1#2 bitmap_line::e1#1 ] zp[2]:45 [ bitmap_line::dy#0 ] zp[2]:41 [ bitmap_line::dx#0 ] zp[2]:53 [ bitmap_line::sy#0 ] zp[2]:49 [ bitmap_line::sx#0 ] zp[2]:33 [ bitmap_line::x2#0 ] -Uplifting [abs_u16] best 37064 combination zp[2]:24 [ abs_u16::return#4 abs_u16::return#2 abs_u16::w#2 abs_u16::w#0 ] reg byte a [ abs_u16::$0 ] reg byte a [ abs_u16::$1 ] zp[2]:39 [ abs_u16::return#0 ] zp[2]:43 [ abs_u16::return#1 ] -Uplifting [sgn_u16] best 37052 combination reg byte a [ sgn_u16::$0 ] reg byte a [ sgn_u16::$1 ] zp[2]:26 [ sgn_u16::w#2 sgn_u16::w#0 ] zp[2]:47 [ sgn_u16::return#0 ] zp[2]:51 [ sgn_u16::return#1 ] zp[2]:28 [ sgn_u16::return#4 ] -Uplifting [memset] best 37036 combination zp[2]:22 [ memset::dst#2 memset::dst#4 memset::dst#1 ] zp[2]:55 [ memset::end#0 ] reg byte x [ memset::c#4 ] zp[2]:17 [ memset::num#2 ] zp[2]:19 [ memset::str#3 ] -Uplifting [bitmap_init] best 36526 combination zp[2]:7 [ bitmap_init::yoffs#2 bitmap_init::yoffs#4 bitmap_init::yoffs#1 ] reg byte a [ bitmap_init::bits#3 bitmap_init::bits#4 bitmap_init::bits#1 ] reg byte x [ bitmap_init::x#2 bitmap_init::x#1 ] reg byte x [ bitmap_init::y#2 bitmap_init::y#1 ] reg byte a [ bitmap_init::$4 ] zp[1]:37 [ bitmap_init::$5 ] zp[1]:38 [ bitmap_init::$6 ] zp[1]:35 [ bitmap_init::$7 ] +Uplifting [bitmap_plot] best 37070 combination reg byte x [ bitmap_plot::y#4 bitmap_plot::y#2 bitmap_plot::y#1 bitmap_plot::y#3 ] zp[2]:63 [ bitmap_plot::$0 ] reg byte x [ bitmap_plot::$1 ] zp[2]:65 [ bitmap_plot::plotter#1 ] zp[2]:31 [ bitmap_plot::x#4 bitmap_plot::x#2 bitmap_plot::x#1 bitmap_plot::x#3 ] zp[2]:61 [ bitmap_plot::plotter#0 ] +Uplifting [bitmap_line] best 37070 combination zp[2]:11 [ bitmap_line::x#7 bitmap_line::x#6 bitmap_line::x#15 bitmap_line::x#13 bitmap_line::x#12 bitmap_line::x#1 ] zp[2]:13 [ bitmap_line::y#15 bitmap_line::y#7 bitmap_line::y#13 bitmap_line::y#4 bitmap_line::y#1 bitmap_line::y#2 ] zp[2]:9 [ bitmap_line::e#3 bitmap_line::e#0 bitmap_line::e#6 bitmap_line::e#1 bitmap_line::e#2 ] zp[2]:15 [ bitmap_line::e1#3 bitmap_line::e1#6 bitmap_line::e1#0 bitmap_line::e1#2 bitmap_line::e1#1 ] zp[2]:45 [ bitmap_line::dy#0 ] zp[2]:41 [ bitmap_line::dx#0 ] zp[2]:53 [ bitmap_line::sy#0 ] zp[2]:49 [ bitmap_line::sx#0 ] zp[2]:33 [ bitmap_line::x2#0 ] +Uplifting [abs_u16] best 37058 combination zp[2]:24 [ abs_u16::return#4 abs_u16::return#2 abs_u16::w#2 abs_u16::w#0 ] reg byte a [ abs_u16::$0 ] reg byte a [ abs_u16::$1 ] zp[2]:39 [ abs_u16::return#0 ] zp[2]:43 [ abs_u16::return#1 ] +Uplifting [sgn_u16] best 37046 combination reg byte a [ sgn_u16::$0 ] reg byte a [ sgn_u16::$1 ] zp[2]:26 [ sgn_u16::w#2 sgn_u16::w#0 ] zp[2]:47 [ sgn_u16::return#0 ] zp[2]:51 [ sgn_u16::return#1 ] zp[2]:28 [ sgn_u16::return#4 ] +Uplifting [memset] best 37030 combination zp[2]:22 [ memset::dst#2 memset::dst#4 memset::dst#1 ] zp[2]:55 [ memset::end#0 ] reg byte x [ memset::c#4 ] zp[2]:17 [ memset::num#2 ] zp[2]:19 [ memset::str#3 ] +Uplifting [bitmap_init] best 36520 combination zp[2]:7 [ bitmap_init::yoffs#2 bitmap_init::yoffs#4 bitmap_init::yoffs#1 ] reg byte a [ bitmap_init::bits#3 bitmap_init::bits#4 bitmap_init::bits#1 ] reg byte x [ bitmap_init::x#2 bitmap_init::x#1 ] reg byte x [ bitmap_init::y#2 bitmap_init::y#1 ] reg byte a [ bitmap_init::$4 ] zp[1]:37 [ bitmap_init::$5 ] zp[1]:38 [ bitmap_init::$6 ] zp[1]:35 [ bitmap_init::$7 ] Limited combination testing to 100 combinations of 15360 possible. -Uplifting [] best 36526 combination zp[2]:2 [ next#6 next#11 next#0 ] -Uplifting [MOS6526_CIA] best 36526 combination -Uplifting [MOS6569_VICII] best 36526 combination -Uplifting [MOS6581_SID] best 36526 combination -Uplifting [bitmap_clear] best 36526 combination -Uplifting [main] best 36526 combination +Uplifting [] best 36520 combination zp[2]:2 [ next#6 next#11 next#0 ] +Uplifting [MOS6526_CIA] best 36520 combination +Uplifting [MOS6569_VICII] best 36520 combination +Uplifting [MOS6581_SID] best 36520 combination +Uplifting [bitmap_clear] best 36520 combination +Uplifting [main] best 36520 combination Attempting to uplift remaining variables inzp[1]:37 [ bitmap_init::$5 ] -Uplifting [bitmap_init] best 36466 combination reg byte a [ bitmap_init::$5 ] +Uplifting [bitmap_init] best 36460 combination reg byte a [ bitmap_init::$5 ] Attempting to uplift remaining variables inzp[1]:38 [ bitmap_init::$6 ] -Uplifting [bitmap_init] best 36406 combination reg byte a [ bitmap_init::$6 ] +Uplifting [bitmap_init] best 36400 combination reg byte a [ bitmap_init::$6 ] Attempting to uplift remaining variables inzp[1]:35 [ bitmap_init::$7 ] -Uplifting [bitmap_init] best 36406 combination zp[1]:35 [ bitmap_init::$7 ] +Uplifting [bitmap_init] best 36400 combination zp[1]:35 [ bitmap_init::$7 ] Coalescing zero page register [ zp[2]:11 [ bitmap_line::x#7 bitmap_line::x#6 bitmap_line::x#15 bitmap_line::x#13 bitmap_line::x#12 bitmap_line::x#1 ] ] with [ zp[2]:31 [ bitmap_plot::x#4 bitmap_plot::x#2 bitmap_plot::x#1 bitmap_plot::x#3 ] ] - score: 3 Coalescing zero page register [ zp[2]:2 [ next#6 next#11 next#0 ] ] with [ zp[2]:33 [ bitmap_line::x2#0 ] ] - score: 1 Coalescing zero page register [ zp[2]:17 [ memset::num#2 ] ] with [ zp[2]:55 [ memset::end#0 ] ] - score: 1 @@ -2568,18 +2568,15 @@ bitmap_line: { // [47] bitmap_line::dy#0 = abs_u16::return#1 // [48] if(bitmap_line::dx#0!=0) goto bitmap_line::@1 -- vwuz1_neq_0_then_la1 lda.z dx - bne __b1 - lda.z dx+1 + ora.z dx+1 bne __b1 jmp __b18 // bitmap_line::@18 __b18: // [49] if(bitmap_line::dy#0==0) goto bitmap_line::@4 -- vwuz1_eq_0_then_la1 lda.z dy - bne !+ - lda.z dy+1 + ora.z dy+1 beq __b4_from___b18 - !: jmp __b1 // bitmap_line::@1 __b1: @@ -3211,7 +3208,7 @@ Removing instruction __breturn: Succesful ASM optimization Pass5UnusedLabelElimination Removing unreachable instruction jmp __b1 Succesful ASM optimization Pass5UnreachableCodeElimination -Fixing long branch [155] beq __b4 to bne +Fixing long branch [153] beq __b4 to bne FINAL SYMBOL TABLE const nomodify byte* BG_COLOR = (byte*) 53281 @@ -3384,7 +3381,7 @@ reg byte x [ bitmap_plot::$1 ] FINAL ASSEMBLER -Score: 30186 +Score: 30180 // File Comments // Shows that bitmap2.kc line() does not have the same problem as bitmap-draw.kc @@ -3672,18 +3669,15 @@ bitmap_line: { // if(dx==0 && dy==0) // [48] if(bitmap_line::dx#0!=0) goto bitmap_line::@1 -- vwuz1_neq_0_then_la1 lda.z dx - bne __b1 - lda.z dx+1 + ora.z dx+1 bne __b1 // bitmap_line::@18 // [49] if(bitmap_line::dy#0==0) goto bitmap_line::@4 -- vwuz1_eq_0_then_la1 lda.z dy - bne !+ - lda.z dy+1 + ora.z dy+1 bne !__b4+ jmp __b4 !__b4: - !: // bitmap_line::@1 __b1: // sgn_u16(x2-x1) diff --git a/src/test/ref/bitmap-plot-0.asm b/src/test/ref/bitmap-plot-0.asm index 1380eab31..54acea847 100644 --- a/src/test/ref/bitmap-plot-0.asm +++ b/src/test/ref/bitmap-plot-0.asm @@ -126,8 +126,7 @@ main: { beq __b5 !: lda.z x - bne __b3 - lda.z x+1 + ora.z x+1 bne __b3 __b5: // vx = -vx diff --git a/src/test/ref/bitmap-plot-0.log b/src/test/ref/bitmap-plot-0.log index 735820e5b..a76104bcb 100644 --- a/src/test/ref/bitmap-plot-0.log +++ b/src/test/ref/bitmap-plot-0.log @@ -1591,31 +1591,31 @@ Uplift Scope [init_irq] Uplift Scope [irq] Uplift Scope [__start] -Uplifting [memset] best 4871 combination zp[2]:18 [ memset::dst#2 memset::dst#4 memset::dst#1 ] zp[2]:35 [ memset::end#0 ] reg byte x [ memset::c#4 ] zp[2]:13 [ memset::num#2 ] zp[2]:15 [ memset::str#3 ] -Uplifting [bitmap_init] best 4361 combination zp[2]:11 [ bitmap_init::yoffs#2 bitmap_init::yoffs#4 bitmap_init::yoffs#1 ] reg byte a [ bitmap_init::bits#3 bitmap_init::bits#4 bitmap_init::bits#1 ] reg byte x [ bitmap_init::x#2 bitmap_init::x#1 ] reg byte x [ bitmap_init::y#2 bitmap_init::y#1 ] reg byte a [ bitmap_init::$4 ] zp[1]:26 [ bitmap_init::$5 ] zp[1]:27 [ bitmap_init::$6 ] zp[1]:24 [ bitmap_init::$7 ] +Uplifting [memset] best 4846 combination zp[2]:18 [ memset::dst#2 memset::dst#4 memset::dst#1 ] zp[2]:35 [ memset::end#0 ] reg byte x [ memset::c#4 ] zp[2]:13 [ memset::num#2 ] zp[2]:15 [ memset::str#3 ] +Uplifting [bitmap_init] best 4336 combination zp[2]:11 [ bitmap_init::yoffs#2 bitmap_init::yoffs#4 bitmap_init::yoffs#1 ] reg byte a [ bitmap_init::bits#3 bitmap_init::bits#4 bitmap_init::bits#1 ] reg byte x [ bitmap_init::x#2 bitmap_init::x#1 ] reg byte x [ bitmap_init::y#2 bitmap_init::y#1 ] reg byte a [ bitmap_init::$4 ] zp[1]:26 [ bitmap_init::$5 ] zp[1]:27 [ bitmap_init::$6 ] zp[1]:24 [ bitmap_init::$7 ] Limited combination testing to 100 combinations of 15360 possible. -Uplifting [bitmap_plot] best 4322 combination reg byte x [ bitmap_plot::y#0 ] zp[2]:30 [ bitmap_plot::$0 ] reg byte x [ bitmap_plot::$1 ] zp[2]:32 [ bitmap_plot::plotter#1 ] zp[2]:28 [ bitmap_plot::plotter#0 ] zp[2]:21 [ bitmap_plot::x#0 ] -Uplifting [main] best 4322 combination zp[1]:7 [ main::vy#2 main::vy#8 main::vy#1 ] zp[2]:5 [ main::vx#2 main::vx#6 main::vx#1 ] zp[2]:2 [ main::x#2 main::x#1 ] zp[1]:4 [ main::y#2 main::y#1 ] -Uplifting [] best 4322 combination zp[1]:20 [ frame_cnt ] -Uplifting [MOS6526_CIA] best 4322 combination -Uplifting [MOS6569_VICII] best 4322 combination -Uplifting [MOS6581_SID] best 4322 combination -Uplifting [bitmap_clear] best 4322 combination -Uplifting [init_irq] best 4322 combination -Uplifting [irq] best 4322 combination -Uplifting [__start] best 4322 combination +Uplifting [bitmap_plot] best 4297 combination reg byte x [ bitmap_plot::y#0 ] zp[2]:30 [ bitmap_plot::$0 ] reg byte x [ bitmap_plot::$1 ] zp[2]:32 [ bitmap_plot::plotter#1 ] zp[2]:28 [ bitmap_plot::plotter#0 ] zp[2]:21 [ bitmap_plot::x#0 ] +Uplifting [main] best 4297 combination zp[1]:7 [ main::vy#2 main::vy#8 main::vy#1 ] zp[2]:5 [ main::vx#2 main::vx#6 main::vx#1 ] zp[2]:2 [ main::x#2 main::x#1 ] zp[1]:4 [ main::y#2 main::y#1 ] +Uplifting [] best 4297 combination zp[1]:20 [ frame_cnt ] +Uplifting [MOS6526_CIA] best 4297 combination +Uplifting [MOS6569_VICII] best 4297 combination +Uplifting [MOS6581_SID] best 4297 combination +Uplifting [bitmap_clear] best 4297 combination +Uplifting [init_irq] best 4297 combination +Uplifting [irq] best 4297 combination +Uplifting [__start] best 4297 combination Attempting to uplift remaining variables inzp[1]:26 [ bitmap_init::$5 ] -Uplifting [bitmap_init] best 4262 combination reg byte a [ bitmap_init::$5 ] +Uplifting [bitmap_init] best 4237 combination reg byte a [ bitmap_init::$5 ] Attempting to uplift remaining variables inzp[1]:27 [ bitmap_init::$6 ] -Uplifting [bitmap_init] best 4202 combination reg byte a [ bitmap_init::$6 ] +Uplifting [bitmap_init] best 4177 combination reg byte a [ bitmap_init::$6 ] Attempting to uplift remaining variables inzp[1]:24 [ bitmap_init::$7 ] -Uplifting [bitmap_init] best 4202 combination zp[1]:24 [ bitmap_init::$7 ] +Uplifting [bitmap_init] best 4177 combination zp[1]:24 [ bitmap_init::$7 ] Attempting to uplift remaining variables inzp[1]:7 [ main::vy#2 main::vy#8 main::vy#1 ] -Uplifting [main] best 4202 combination zp[1]:7 [ main::vy#2 main::vy#8 main::vy#1 ] +Uplifting [main] best 4177 combination zp[1]:7 [ main::vy#2 main::vy#8 main::vy#1 ] Attempting to uplift remaining variables inzp[1]:4 [ main::y#2 main::y#1 ] -Uplifting [main] best 4202 combination zp[1]:4 [ main::y#2 main::y#1 ] +Uplifting [main] best 4177 combination zp[1]:4 [ main::y#2 main::y#1 ] Attempting to uplift remaining variables inzp[1]:20 [ frame_cnt ] -Uplifting [] best 4202 combination zp[1]:20 [ frame_cnt ] +Uplifting [] best 4177 combination zp[1]:20 [ frame_cnt ] Coalescing zero page register [ zp[2]:2 [ main::x#2 main::x#1 ] ] with [ zp[2]:21 [ bitmap_plot::x#0 ] ] - score: 1 Coalescing zero page register [ zp[2]:13 [ memset::num#2 ] ] with [ zp[2]:35 [ memset::end#0 ] ] - score: 1 Coalescing zero page register [ zp[2]:15 [ memset::str#3 ] ] with [ zp[2]:18 [ memset::dst#2 memset::dst#4 memset::dst#1 ] ] - score: 1 @@ -1838,8 +1838,7 @@ main: { __b11: // [26] if(main::x#1!=0) goto main::@3 -- vwuz1_neq_0_then_la1 lda.z x - bne __b3_from___b11 - lda.z x+1 + ora.z x+1 bne __b3_from___b11 jmp __b5 // main::@5 @@ -2246,7 +2245,6 @@ Removing instruction lda #>0 Removing instruction ldy #0 Succesful ASM optimization Pass5UnnecesaryLoadElimination Replacing label __b3_from___b11 with __b3 -Replacing label __b3_from___b11 with __b3 Replacing label __b4_from___b12 with __b4 Replacing label __b1 with __b2 Replacing label __b6_from___b1 with __b2 @@ -2432,7 +2430,7 @@ reg byte x [ bitmap_plot::$1 ] FINAL ASSEMBLER -Score: 3175 +Score: 3150 // File Comments // Tests the simple bitmap plotter - and counts plots per frame in an IRQ @@ -2615,8 +2613,7 @@ main: { // main::@11 // [26] if(main::x#1!=0) goto main::@3 -- vwuz1_neq_0_then_la1 lda.z x - bne __b3 - lda.z x+1 + ora.z x+1 bne __b3 // main::@5 __b5: diff --git a/src/test/ref/bitmap-plot-1.asm b/src/test/ref/bitmap-plot-1.asm index cfd8e628e..d8fec5b0b 100644 --- a/src/test/ref/bitmap-plot-1.asm +++ b/src/test/ref/bitmap-plot-1.asm @@ -938,8 +938,7 @@ mul16u: { __b1: // while(a!=0) lda.z a - bne __b2 - lda.z a+1 + ora.z a+1 bne __b2 // } rts diff --git a/src/test/ref/bitmap-plot-1.log b/src/test/ref/bitmap-plot-1.log index 41e6fbc7c..0e260394c 100644 --- a/src/test/ref/bitmap-plot-1.log +++ b/src/test/ref/bitmap-plot-1.log @@ -3929,34 +3929,34 @@ Uplift Scope [init_irq] Uplift Scope [irq] Uplift Scope [__start] -Uplifting [mul16u] best 27649 combination zp[4]:45 [ mul16u::res#2 mul16u::res#6 mul16u::res#1 ] zp[4]:49 [ mul16u::mb#2 mul16u::mb#0 mul16u::mb#1 ] reg byte a [ mul16u::$1 ] zp[2]:43 [ mul16u::a#3 mul16u::a#6 mul16u::a#1 mul16u::a#2 mul16u::a#0 ] zp[2]:41 [ mul16u::b#2 mul16u::b#0 mul16u::b#1 ] zp[4]:211 [ mul16u::return#3 ] zp[4]:137 [ mul16u::return#2 ] -Uplifting [divr16u] best 27439 combination zp[2]:53 [ divr16u::rem#5 divr16u::rem#10 divr16u::rem#4 divr16u::rem#11 divr16u::rem#6 divr16u::rem#0 divr16u::rem#1 divr16u::rem#2 ] zp[2]:57 [ divr16u::quotient#3 divr16u::return#0 divr16u::quotient#1 divr16u::quotient#2 ] reg byte a [ divr16u::$1 ] reg byte a [ divr16u::$2 ] reg byte x [ divr16u::i#2 divr16u::i#1 ] zp[2]:55 [ divr16u::dividend#3 divr16u::dividend#5 divr16u::dividend#0 ] zp[2]:160 [ divr16u::return#2 ] zp[2]:164 [ divr16u::return#3 ] -Uplifting [mulu16_sel] best 27421 combination zp[2]:60 [ mulu16_sel::v1#5 mulu16_sel::v1#4 mulu16_sel::v1#0 mulu16_sel::v1#1 mulu16_sel::v1#2 mulu16_sel::v1#3 ] zp[4]:215 [ mulu16_sel::$0 ] zp[4]:219 [ mulu16_sel::$1 ] zp[2]:62 [ mulu16_sel::v2#5 mulu16_sel::v2#4 mulu16_sel::v2#0 mulu16_sel::v2#1 mulu16_sel::v2#3 ] zp[2]:223 [ mulu16_sel::return#12 ] zp[2]:178 [ mulu16_sel::return#0 ] zp[2]:182 [ mulu16_sel::return#1 ] zp[2]:186 [ mulu16_sel::return#2 ] zp[2]:192 [ mulu16_sel::return#10 ] zp[2]:196 [ mulu16_sel::return#11 ] reg byte x [ mulu16_sel::select#5 ] -Uplifting [sin16s] best 27412 combination zp[4]:28 [ sin16s::x#6 sin16s::x#4 sin16s::x#0 sin16s::x#1 sin16s::x#2 ] zp[2]:32 [ sin16s::return#1 sin16s::return#5 sin16s::sinx#1 ] zp[4]:172 [ sin16s::$4 ] zp[2]:180 [ sin16s::x2#0 ] zp[2]:188 [ sin16s::x3_6#0 ] zp[2]:194 [ sin16s::x4#0 ] zp[2]:198 [ sin16s::x5#0 ] zp[2]:200 [ sin16s::x5_128#0 ] zp[2]:184 [ sin16s::x3#0 ] zp[2]:202 [ sin16s::usinx#1 ] zp[2]:176 [ sin16s::x1#0 ] zp[2]:121 [ sin16s::return#0 ] zp[2]:190 [ sin16s::usinx#0 ] reg byte y [ sin16s::isUpper#2 ] -Uplifting [mul16s] best 27412 combination zp[4]:23 [ mul16s::m#4 mul16s::m#5 mul16s::m#1 mul16s::m#0 mul16s::m#2 ] zp[2]:141 [ mul16s::$6 ] zp[2]:143 [ mul16s::$11 ] zp[2]:145 [ mul16s::$9 ] zp[2]:147 [ mul16s::$12 ] zp[2]:19 [ mul16s::a#3 mul16s::a#0 ] zp[4]:149 [ mul16s::return#0 ] zp[4]:123 [ mul16s::return#2 ] zp[2]:21 [ mul16s::b#3 mul16s::b#2 mul16s::b#1 ] zp[4]:72 [ mul16s::return#3 ] zp[4]:94 [ mul16s::return#4 ] -Uplifting [memset] best 27396 combination zp[2]:39 [ memset::dst#2 memset::dst#4 memset::dst#1 ] zp[2]:204 [ memset::end#0 ] reg byte x [ memset::c#4 ] zp[2]:34 [ memset::num#2 ] zp[2]:36 [ memset::str#3 ] -Uplifting [bitmap_init] best 26886 combination zp[2]:17 [ bitmap_init::yoffs#2 bitmap_init::yoffs#4 bitmap_init::yoffs#1 ] reg byte a [ bitmap_init::bits#3 bitmap_init::bits#4 bitmap_init::bits#1 ] reg byte x [ bitmap_init::x#2 bitmap_init::x#1 ] reg byte x [ bitmap_init::y#2 bitmap_init::y#1 ] reg byte a [ bitmap_init::$4 ] zp[1]:135 [ bitmap_init::$5 ] zp[1]:136 [ bitmap_init::$6 ] zp[1]:133 [ bitmap_init::$7 ] +Uplifting [mul16u] best 27399 combination zp[4]:45 [ mul16u::res#2 mul16u::res#6 mul16u::res#1 ] zp[4]:49 [ mul16u::mb#2 mul16u::mb#0 mul16u::mb#1 ] reg byte a [ mul16u::$1 ] zp[2]:43 [ mul16u::a#3 mul16u::a#6 mul16u::a#1 mul16u::a#2 mul16u::a#0 ] zp[2]:41 [ mul16u::b#2 mul16u::b#0 mul16u::b#1 ] zp[4]:211 [ mul16u::return#3 ] zp[4]:137 [ mul16u::return#2 ] +Uplifting [divr16u] best 27189 combination zp[2]:53 [ divr16u::rem#5 divr16u::rem#10 divr16u::rem#4 divr16u::rem#11 divr16u::rem#6 divr16u::rem#0 divr16u::rem#1 divr16u::rem#2 ] zp[2]:57 [ divr16u::quotient#3 divr16u::return#0 divr16u::quotient#1 divr16u::quotient#2 ] reg byte a [ divr16u::$1 ] reg byte a [ divr16u::$2 ] reg byte x [ divr16u::i#2 divr16u::i#1 ] zp[2]:55 [ divr16u::dividend#3 divr16u::dividend#5 divr16u::dividend#0 ] zp[2]:160 [ divr16u::return#2 ] zp[2]:164 [ divr16u::return#3 ] +Uplifting [mulu16_sel] best 27171 combination zp[2]:60 [ mulu16_sel::v1#5 mulu16_sel::v1#4 mulu16_sel::v1#0 mulu16_sel::v1#1 mulu16_sel::v1#2 mulu16_sel::v1#3 ] zp[4]:215 [ mulu16_sel::$0 ] zp[4]:219 [ mulu16_sel::$1 ] zp[2]:62 [ mulu16_sel::v2#5 mulu16_sel::v2#4 mulu16_sel::v2#0 mulu16_sel::v2#1 mulu16_sel::v2#3 ] zp[2]:223 [ mulu16_sel::return#12 ] zp[2]:178 [ mulu16_sel::return#0 ] zp[2]:182 [ mulu16_sel::return#1 ] zp[2]:186 [ mulu16_sel::return#2 ] zp[2]:192 [ mulu16_sel::return#10 ] zp[2]:196 [ mulu16_sel::return#11 ] reg byte x [ mulu16_sel::select#5 ] +Uplifting [sin16s] best 27162 combination zp[4]:28 [ sin16s::x#6 sin16s::x#4 sin16s::x#0 sin16s::x#1 sin16s::x#2 ] zp[2]:32 [ sin16s::return#1 sin16s::return#5 sin16s::sinx#1 ] zp[4]:172 [ sin16s::$4 ] zp[2]:180 [ sin16s::x2#0 ] zp[2]:188 [ sin16s::x3_6#0 ] zp[2]:194 [ sin16s::x4#0 ] zp[2]:198 [ sin16s::x5#0 ] zp[2]:200 [ sin16s::x5_128#0 ] zp[2]:184 [ sin16s::x3#0 ] zp[2]:202 [ sin16s::usinx#1 ] zp[2]:176 [ sin16s::x1#0 ] zp[2]:121 [ sin16s::return#0 ] zp[2]:190 [ sin16s::usinx#0 ] reg byte y [ sin16s::isUpper#2 ] +Uplifting [mul16s] best 27162 combination zp[4]:23 [ mul16s::m#4 mul16s::m#5 mul16s::m#1 mul16s::m#0 mul16s::m#2 ] zp[2]:141 [ mul16s::$6 ] zp[2]:143 [ mul16s::$11 ] zp[2]:145 [ mul16s::$9 ] zp[2]:147 [ mul16s::$12 ] zp[2]:19 [ mul16s::a#3 mul16s::a#0 ] zp[4]:149 [ mul16s::return#0 ] zp[4]:123 [ mul16s::return#2 ] zp[2]:21 [ mul16s::b#3 mul16s::b#2 mul16s::b#1 ] zp[4]:72 [ mul16s::return#3 ] zp[4]:94 [ mul16s::return#4 ] +Uplifting [memset] best 27146 combination zp[2]:39 [ memset::dst#2 memset::dst#4 memset::dst#1 ] zp[2]:204 [ memset::end#0 ] reg byte x [ memset::c#4 ] zp[2]:34 [ memset::num#2 ] zp[2]:36 [ memset::str#3 ] +Uplifting [bitmap_init] best 26636 combination zp[2]:17 [ bitmap_init::yoffs#2 bitmap_init::yoffs#4 bitmap_init::yoffs#1 ] reg byte a [ bitmap_init::bits#3 bitmap_init::bits#4 bitmap_init::bits#1 ] reg byte x [ bitmap_init::x#2 bitmap_init::x#1 ] reg byte x [ bitmap_init::y#2 bitmap_init::y#1 ] reg byte a [ bitmap_init::$4 ] zp[1]:135 [ bitmap_init::$5 ] zp[1]:136 [ bitmap_init::$6 ] zp[1]:133 [ bitmap_init::$7 ] Limited combination testing to 100 combinations of 15360 possible. -Uplifting [bitmap_plot] best 26849 combination reg byte a [ bitmap_plot::y#0 ] zp[2]:155 [ bitmap_plot::$0 ] reg byte x [ bitmap_plot::$1 ] zp[2]:157 [ bitmap_plot::plotter#1 ] zp[2]:153 [ bitmap_plot::plotter#0 ] zp[2]:110 [ bitmap_plot::x#0 ] -Uplifting [sin16s_gen2] best 26849 combination zp[2]:6 [ sin16s_gen2::i#2 sin16s_gen2::i#1 ] zp[4]:127 [ sin16s_gen2::$6 ] zp[4]:8 [ sin16s_gen2::x#2 sin16s_gen2::x#1 ] zp[2]:131 [ sin16s_gen2::$8 ] zp[2]:12 [ sin16s_gen2::sintab#2 sin16s_gen2::sintab#0 ] zp[4]:117 [ sin16s_gen2::step#0 ] -Uplifting [div32u16u] best 26849 combination zp[2]:166 [ div32u16u::quotient_lo#0 ] zp[2]:162 [ div32u16u::quotient_hi#0 ] zp[4]:168 [ div32u16u::return#0 ] zp[4]:113 [ div32u16u::return#2 ] -Uplifting [main] best 26609 combination zp[2]:4 [ main::idx_y#3 main::idx_y#10 main::idx_y#1 ] zp[2]:66 [ main::$19 ] zp[2]:68 [ main::$21 ] zp[2]:70 [ main::cos_x#0 ] zp[4]:76 [ main::xpos#0 ] zp[4]:80 [ main::$6 ] reg byte alu [ main::$7 ] zp[2]:88 [ main::$20 ] zp[2]:90 [ main::$22 ] zp[2]:92 [ main::sin_y#0 ] zp[4]:98 [ main::ypos#0 ] zp[4]:102 [ main::$10 ] reg byte alu [ main::$11 ] zp[2]:2 [ main::idx_x#3 main::idx_x#10 main::idx_x#1 ] zp[2]:108 [ main::y#0 ] zp[2]:86 [ main::x#0 ] -Uplifting [] best 26609 combination zp[2]:209 [ rem16u#0 ] zp[1]:65 [ frame_cnt ] -Uplifting [MOS6526_CIA] best 26609 combination -Uplifting [MOS6569_VICII] best 26609 combination -Uplifting [MOS6581_SID] best 26609 combination -Uplifting [bitmap_clear] best 26609 combination -Uplifting [init_irq] best 26609 combination -Uplifting [irq] best 26609 combination -Uplifting [__start] best 26609 combination +Uplifting [bitmap_plot] best 26599 combination reg byte a [ bitmap_plot::y#0 ] zp[2]:155 [ bitmap_plot::$0 ] reg byte x [ bitmap_plot::$1 ] zp[2]:157 [ bitmap_plot::plotter#1 ] zp[2]:153 [ bitmap_plot::plotter#0 ] zp[2]:110 [ bitmap_plot::x#0 ] +Uplifting [sin16s_gen2] best 26599 combination zp[2]:6 [ sin16s_gen2::i#2 sin16s_gen2::i#1 ] zp[4]:127 [ sin16s_gen2::$6 ] zp[4]:8 [ sin16s_gen2::x#2 sin16s_gen2::x#1 ] zp[2]:131 [ sin16s_gen2::$8 ] zp[2]:12 [ sin16s_gen2::sintab#2 sin16s_gen2::sintab#0 ] zp[4]:117 [ sin16s_gen2::step#0 ] +Uplifting [div32u16u] best 26599 combination zp[2]:166 [ div32u16u::quotient_lo#0 ] zp[2]:162 [ div32u16u::quotient_hi#0 ] zp[4]:168 [ div32u16u::return#0 ] zp[4]:113 [ div32u16u::return#2 ] +Uplifting [main] best 26359 combination zp[2]:4 [ main::idx_y#3 main::idx_y#10 main::idx_y#1 ] zp[2]:66 [ main::$19 ] zp[2]:68 [ main::$21 ] zp[2]:70 [ main::cos_x#0 ] zp[4]:76 [ main::xpos#0 ] zp[4]:80 [ main::$6 ] reg byte alu [ main::$7 ] zp[2]:88 [ main::$20 ] zp[2]:90 [ main::$22 ] zp[2]:92 [ main::sin_y#0 ] zp[4]:98 [ main::ypos#0 ] zp[4]:102 [ main::$10 ] reg byte alu [ main::$11 ] zp[2]:2 [ main::idx_x#3 main::idx_x#10 main::idx_x#1 ] zp[2]:108 [ main::y#0 ] zp[2]:86 [ main::x#0 ] +Uplifting [] best 26359 combination zp[2]:209 [ rem16u#0 ] zp[1]:65 [ frame_cnt ] +Uplifting [MOS6526_CIA] best 26359 combination +Uplifting [MOS6569_VICII] best 26359 combination +Uplifting [MOS6581_SID] best 26359 combination +Uplifting [bitmap_clear] best 26359 combination +Uplifting [init_irq] best 26359 combination +Uplifting [irq] best 26359 combination +Uplifting [__start] best 26359 combination Attempting to uplift remaining variables inzp[1]:135 [ bitmap_init::$5 ] -Uplifting [bitmap_init] best 26549 combination reg byte a [ bitmap_init::$5 ] +Uplifting [bitmap_init] best 26299 combination reg byte a [ bitmap_init::$5 ] Attempting to uplift remaining variables inzp[1]:136 [ bitmap_init::$6 ] -Uplifting [bitmap_init] best 26489 combination reg byte a [ bitmap_init::$6 ] +Uplifting [bitmap_init] best 26239 combination reg byte a [ bitmap_init::$6 ] Attempting to uplift remaining variables inzp[1]:133 [ bitmap_init::$7 ] -Uplifting [bitmap_init] best 26489 combination zp[1]:133 [ bitmap_init::$7 ] +Uplifting [bitmap_init] best 26239 combination zp[1]:133 [ bitmap_init::$7 ] Attempting to uplift remaining variables inzp[1]:65 [ frame_cnt ] -Uplifting [] best 26489 combination zp[1]:65 [ frame_cnt ] +Uplifting [] best 26239 combination zp[1]:65 [ frame_cnt ] Coalescing zero page register [ zp[2]:32 [ sin16s::return#1 sin16s::return#5 sin16s::sinx#1 ] ] with [ zp[2]:202 [ sin16s::usinx#1 ] ] - score: 2 Coalescing zero page register [ zp[2]:60 [ mulu16_sel::v1#5 mulu16_sel::v1#4 mulu16_sel::v1#0 mulu16_sel::v1#1 mulu16_sel::v1#2 mulu16_sel::v1#3 ] ] with [ zp[2]:184 [ sin16s::x3#0 ] ] - score: 2 Coalescing zero page register [ zp[2]:19 [ mul16s::a#3 mul16s::a#0 ] ] with [ zp[2]:121 [ sin16s::return#0 ] ] - score: 1 @@ -5394,8 +5394,7 @@ mul16u: { __b1: // [196] if(mul16u::a#3!=0) goto mul16u::@2 -- vwuz1_neq_0_then_la1 lda.z a - bne __b2 - lda.z a+1 + ora.z a+1 bne __b2 jmp __breturn // mul16u::@return @@ -6196,7 +6195,7 @@ zp[2]:44 [ rem16u#0 ] FINAL ASSEMBLER -Score: 20672 +Score: 20422 // File Comments // Tests the simple bitmap plotter - and counts plots per frame in an IRQ @@ -7503,8 +7502,7 @@ mul16u: { // while(a!=0) // [196] if(mul16u::a#3!=0) goto mul16u::@2 -- vwuz1_neq_0_then_la1 lda.z a - bne __b2 - lda.z a+1 + ora.z a+1 bne __b2 // mul16u::@return // } diff --git a/src/test/ref/bitmap-plot-2.asm b/src/test/ref/bitmap-plot-2.asm index 7a6c425c7..9aec243bf 100644 --- a/src/test/ref/bitmap-plot-2.asm +++ b/src/test/ref/bitmap-plot-2.asm @@ -284,8 +284,7 @@ main: { sta.z r+1 // if((idx_x==0) && (r_add!=1)) lda.z idx_x - bne __b5 - lda.z idx_x+1 + ora.z idx_x+1 bne __b5 lda #1 cmp.z r_add @@ -975,8 +974,7 @@ mul16u: { __b1: // while(a!=0) lda.z a - bne __b2 - lda.z a+1 + ora.z a+1 bne __b2 // } rts diff --git a/src/test/ref/bitmap-plot-2.log b/src/test/ref/bitmap-plot-2.log index ba455c59d..912995e13 100644 --- a/src/test/ref/bitmap-plot-2.log +++ b/src/test/ref/bitmap-plot-2.log @@ -4154,36 +4154,36 @@ Uplift Scope [init_irq] Uplift Scope [irq] Uplift Scope [__start] -Uplifting [mul16u] best 27574 combination zp[4]:48 [ mul16u::res#2 mul16u::res#6 mul16u::res#1 ] zp[4]:52 [ mul16u::mb#2 mul16u::mb#0 mul16u::mb#1 ] reg byte a [ mul16u::$1 ] zp[2]:46 [ mul16u::a#3 mul16u::a#6 mul16u::a#1 mul16u::a#2 mul16u::a#0 ] zp[2]:44 [ mul16u::b#2 mul16u::b#0 mul16u::b#1 ] zp[4]:210 [ mul16u::return#3 ] zp[4]:136 [ mul16u::return#2 ] -Uplifting [divr16u] best 27364 combination zp[2]:56 [ divr16u::rem#5 divr16u::rem#10 divr16u::rem#4 divr16u::rem#11 divr16u::rem#6 divr16u::rem#0 divr16u::rem#1 divr16u::rem#2 ] zp[2]:60 [ divr16u::quotient#3 divr16u::return#0 divr16u::quotient#1 divr16u::quotient#2 ] reg byte a [ divr16u::$1 ] reg byte a [ divr16u::$2 ] reg byte x [ divr16u::i#2 divr16u::i#1 ] zp[2]:58 [ divr16u::dividend#3 divr16u::dividend#5 divr16u::dividend#0 ] zp[2]:159 [ divr16u::return#2 ] zp[2]:163 [ divr16u::return#3 ] -Uplifting [mulu16_sel] best 27346 combination zp[2]:63 [ mulu16_sel::v1#5 mulu16_sel::v1#4 mulu16_sel::v1#0 mulu16_sel::v1#1 mulu16_sel::v1#2 mulu16_sel::v1#3 ] zp[4]:214 [ mulu16_sel::$0 ] zp[4]:218 [ mulu16_sel::$1 ] zp[2]:65 [ mulu16_sel::v2#5 mulu16_sel::v2#4 mulu16_sel::v2#0 mulu16_sel::v2#1 mulu16_sel::v2#3 ] zp[2]:222 [ mulu16_sel::return#12 ] zp[2]:177 [ mulu16_sel::return#0 ] zp[2]:181 [ mulu16_sel::return#1 ] zp[2]:185 [ mulu16_sel::return#2 ] zp[2]:191 [ mulu16_sel::return#10 ] zp[2]:195 [ mulu16_sel::return#11 ] reg byte x [ mulu16_sel::select#5 ] -Uplifting [sin16s] best 27337 combination zp[4]:31 [ sin16s::x#6 sin16s::x#4 sin16s::x#0 sin16s::x#1 sin16s::x#2 ] zp[2]:35 [ sin16s::return#1 sin16s::return#5 sin16s::sinx#1 ] zp[4]:171 [ sin16s::$4 ] zp[2]:179 [ sin16s::x2#0 ] zp[2]:187 [ sin16s::x3_6#0 ] zp[2]:193 [ sin16s::x4#0 ] zp[2]:197 [ sin16s::x5#0 ] zp[2]:199 [ sin16s::x5_128#0 ] zp[2]:183 [ sin16s::x3#0 ] zp[2]:201 [ sin16s::usinx#1 ] zp[2]:175 [ sin16s::x1#0 ] zp[2]:120 [ sin16s::return#0 ] zp[2]:189 [ sin16s::usinx#0 ] reg byte y [ sin16s::isUpper#2 ] -Uplifting [mul16s] best 27337 combination zp[4]:26 [ mul16s::m#4 mul16s::m#5 mul16s::m#1 mul16s::m#0 mul16s::m#2 ] zp[2]:140 [ mul16s::$6 ] zp[2]:142 [ mul16s::$11 ] zp[2]:144 [ mul16s::$9 ] zp[2]:146 [ mul16s::$12 ] zp[2]:22 [ mul16s::a#3 mul16s::a#2 mul16s::a#1 mul16s::a#0 ] zp[4]:148 [ mul16s::return#0 ] zp[4]:122 [ mul16s::return#2 ] zp[2]:24 [ mul16s::b#3 mul16s::b#2 mul16s::b#1 ] zp[4]:75 [ mul16s::return#3 ] zp[4]:95 [ mul16s::return#4 ] -Uplifting [memset] best 27321 combination zp[2]:42 [ memset::dst#2 memset::dst#4 memset::dst#1 ] zp[2]:203 [ memset::end#0 ] reg byte x [ memset::c#4 ] zp[2]:37 [ memset::num#2 ] zp[2]:39 [ memset::str#3 ] -Uplifting [bitmap_init] best 26811 combination zp[2]:20 [ bitmap_init::yoffs#2 bitmap_init::yoffs#4 bitmap_init::yoffs#1 ] reg byte a [ bitmap_init::bits#3 bitmap_init::bits#4 bitmap_init::bits#1 ] reg byte x [ bitmap_init::x#2 bitmap_init::x#1 ] reg byte x [ bitmap_init::y#2 bitmap_init::y#1 ] reg byte a [ bitmap_init::$4 ] zp[1]:134 [ bitmap_init::$5 ] zp[1]:135 [ bitmap_init::$6 ] zp[1]:132 [ bitmap_init::$7 ] +Uplifting [mul16u] best 27299 combination zp[4]:48 [ mul16u::res#2 mul16u::res#6 mul16u::res#1 ] zp[4]:52 [ mul16u::mb#2 mul16u::mb#0 mul16u::mb#1 ] reg byte a [ mul16u::$1 ] zp[2]:46 [ mul16u::a#3 mul16u::a#6 mul16u::a#1 mul16u::a#2 mul16u::a#0 ] zp[2]:44 [ mul16u::b#2 mul16u::b#0 mul16u::b#1 ] zp[4]:210 [ mul16u::return#3 ] zp[4]:136 [ mul16u::return#2 ] +Uplifting [divr16u] best 27089 combination zp[2]:56 [ divr16u::rem#5 divr16u::rem#10 divr16u::rem#4 divr16u::rem#11 divr16u::rem#6 divr16u::rem#0 divr16u::rem#1 divr16u::rem#2 ] zp[2]:60 [ divr16u::quotient#3 divr16u::return#0 divr16u::quotient#1 divr16u::quotient#2 ] reg byte a [ divr16u::$1 ] reg byte a [ divr16u::$2 ] reg byte x [ divr16u::i#2 divr16u::i#1 ] zp[2]:58 [ divr16u::dividend#3 divr16u::dividend#5 divr16u::dividend#0 ] zp[2]:159 [ divr16u::return#2 ] zp[2]:163 [ divr16u::return#3 ] +Uplifting [mulu16_sel] best 27071 combination zp[2]:63 [ mulu16_sel::v1#5 mulu16_sel::v1#4 mulu16_sel::v1#0 mulu16_sel::v1#1 mulu16_sel::v1#2 mulu16_sel::v1#3 ] zp[4]:214 [ mulu16_sel::$0 ] zp[4]:218 [ mulu16_sel::$1 ] zp[2]:65 [ mulu16_sel::v2#5 mulu16_sel::v2#4 mulu16_sel::v2#0 mulu16_sel::v2#1 mulu16_sel::v2#3 ] zp[2]:222 [ mulu16_sel::return#12 ] zp[2]:177 [ mulu16_sel::return#0 ] zp[2]:181 [ mulu16_sel::return#1 ] zp[2]:185 [ mulu16_sel::return#2 ] zp[2]:191 [ mulu16_sel::return#10 ] zp[2]:195 [ mulu16_sel::return#11 ] reg byte x [ mulu16_sel::select#5 ] +Uplifting [sin16s] best 27062 combination zp[4]:31 [ sin16s::x#6 sin16s::x#4 sin16s::x#0 sin16s::x#1 sin16s::x#2 ] zp[2]:35 [ sin16s::return#1 sin16s::return#5 sin16s::sinx#1 ] zp[4]:171 [ sin16s::$4 ] zp[2]:179 [ sin16s::x2#0 ] zp[2]:187 [ sin16s::x3_6#0 ] zp[2]:193 [ sin16s::x4#0 ] zp[2]:197 [ sin16s::x5#0 ] zp[2]:199 [ sin16s::x5_128#0 ] zp[2]:183 [ sin16s::x3#0 ] zp[2]:201 [ sin16s::usinx#1 ] zp[2]:175 [ sin16s::x1#0 ] zp[2]:120 [ sin16s::return#0 ] zp[2]:189 [ sin16s::usinx#0 ] reg byte y [ sin16s::isUpper#2 ] +Uplifting [mul16s] best 27062 combination zp[4]:26 [ mul16s::m#4 mul16s::m#5 mul16s::m#1 mul16s::m#0 mul16s::m#2 ] zp[2]:140 [ mul16s::$6 ] zp[2]:142 [ mul16s::$11 ] zp[2]:144 [ mul16s::$9 ] zp[2]:146 [ mul16s::$12 ] zp[2]:22 [ mul16s::a#3 mul16s::a#2 mul16s::a#1 mul16s::a#0 ] zp[4]:148 [ mul16s::return#0 ] zp[4]:122 [ mul16s::return#2 ] zp[2]:24 [ mul16s::b#3 mul16s::b#2 mul16s::b#1 ] zp[4]:75 [ mul16s::return#3 ] zp[4]:95 [ mul16s::return#4 ] +Uplifting [memset] best 27046 combination zp[2]:42 [ memset::dst#2 memset::dst#4 memset::dst#1 ] zp[2]:203 [ memset::end#0 ] reg byte x [ memset::c#4 ] zp[2]:37 [ memset::num#2 ] zp[2]:39 [ memset::str#3 ] +Uplifting [bitmap_init] best 26536 combination zp[2]:20 [ bitmap_init::yoffs#2 bitmap_init::yoffs#4 bitmap_init::yoffs#1 ] reg byte a [ bitmap_init::bits#3 bitmap_init::bits#4 bitmap_init::bits#1 ] reg byte x [ bitmap_init::x#2 bitmap_init::x#1 ] reg byte x [ bitmap_init::y#2 bitmap_init::y#1 ] reg byte a [ bitmap_init::$4 ] zp[1]:134 [ bitmap_init::$5 ] zp[1]:135 [ bitmap_init::$6 ] zp[1]:132 [ bitmap_init::$7 ] Limited combination testing to 100 combinations of 15360 possible. -Uplifting [bitmap_plot] best 26774 combination reg byte a [ bitmap_plot::y#0 ] zp[2]:154 [ bitmap_plot::$0 ] reg byte x [ bitmap_plot::$1 ] zp[2]:156 [ bitmap_plot::plotter#1 ] zp[2]:152 [ bitmap_plot::plotter#0 ] zp[2]:109 [ bitmap_plot::x#0 ] -Uplifting [sin16s_gen2] best 26774 combination zp[2]:9 [ sin16s_gen2::i#2 sin16s_gen2::i#1 ] zp[4]:126 [ sin16s_gen2::$6 ] zp[4]:11 [ sin16s_gen2::x#2 sin16s_gen2::x#1 ] zp[2]:130 [ sin16s_gen2::$8 ] zp[2]:15 [ sin16s_gen2::sintab#2 sin16s_gen2::sintab#0 ] zp[4]:116 [ sin16s_gen2::step#0 ] -Uplifting [div32u16u] best 26774 combination zp[2]:165 [ div32u16u::quotient_lo#0 ] zp[2]:161 [ div32u16u::quotient_hi#0 ] zp[4]:167 [ div32u16u::return#0 ] zp[4]:112 [ div32u16u::return#2 ] -Uplifting [main] best 26774 combination zp[1]:8 [ main::r_add#10 main::r_add#12 main::r_add#1 ] zp[2]:69 [ main::$26 ] zp[2]:71 [ main::$30 ] zp[4]:79 [ main::xpos#0 ] zp[2]:85 [ main::$7 ] zp[2]:89 [ main::$27 ] zp[2]:91 [ main::$31 ] zp[4]:99 [ main::ypos#0 ] zp[2]:105 [ main::$11 ] zp[2]:2 [ main::idx_x#11 main::idx_x#10 main::idx_x#1 ] zp[2]:6 [ main::idx_y#3 main::idx_y#10 main::idx_y#1 ] zp[2]:73 [ main::cos_x#0 ] zp[2]:83 [ main::$28 ] zp[2]:93 [ main::sin_y#0 ] zp[2]:103 [ main::$29 ] zp[2]:4 [ main::r#10 main::r#1 ] zp[2]:107 [ main::y#0 ] zp[2]:87 [ main::x#0 ] -Uplifting [] best 26774 combination zp[2]:208 [ rem16u#0 ] zp[1]:68 [ frame_cnt ] -Uplifting [MOS6526_CIA] best 26774 combination -Uplifting [MOS6569_VICII] best 26774 combination -Uplifting [MOS6581_SID] best 26774 combination -Uplifting [bitmap_clear] best 26774 combination -Uplifting [init_irq] best 26774 combination -Uplifting [irq] best 26774 combination -Uplifting [__start] best 26774 combination +Uplifting [bitmap_plot] best 26499 combination reg byte a [ bitmap_plot::y#0 ] zp[2]:154 [ bitmap_plot::$0 ] reg byte x [ bitmap_plot::$1 ] zp[2]:156 [ bitmap_plot::plotter#1 ] zp[2]:152 [ bitmap_plot::plotter#0 ] zp[2]:109 [ bitmap_plot::x#0 ] +Uplifting [sin16s_gen2] best 26499 combination zp[2]:9 [ sin16s_gen2::i#2 sin16s_gen2::i#1 ] zp[4]:126 [ sin16s_gen2::$6 ] zp[4]:11 [ sin16s_gen2::x#2 sin16s_gen2::x#1 ] zp[2]:130 [ sin16s_gen2::$8 ] zp[2]:15 [ sin16s_gen2::sintab#2 sin16s_gen2::sintab#0 ] zp[4]:116 [ sin16s_gen2::step#0 ] +Uplifting [div32u16u] best 26499 combination zp[2]:165 [ div32u16u::quotient_lo#0 ] zp[2]:161 [ div32u16u::quotient_hi#0 ] zp[4]:167 [ div32u16u::return#0 ] zp[4]:112 [ div32u16u::return#2 ] +Uplifting [main] best 26499 combination zp[1]:8 [ main::r_add#10 main::r_add#12 main::r_add#1 ] zp[2]:69 [ main::$26 ] zp[2]:71 [ main::$30 ] zp[4]:79 [ main::xpos#0 ] zp[2]:85 [ main::$7 ] zp[2]:89 [ main::$27 ] zp[2]:91 [ main::$31 ] zp[4]:99 [ main::ypos#0 ] zp[2]:105 [ main::$11 ] zp[2]:2 [ main::idx_x#11 main::idx_x#10 main::idx_x#1 ] zp[2]:6 [ main::idx_y#3 main::idx_y#10 main::idx_y#1 ] zp[2]:73 [ main::cos_x#0 ] zp[2]:83 [ main::$28 ] zp[2]:93 [ main::sin_y#0 ] zp[2]:103 [ main::$29 ] zp[2]:4 [ main::r#10 main::r#1 ] zp[2]:107 [ main::y#0 ] zp[2]:87 [ main::x#0 ] +Uplifting [] best 26499 combination zp[2]:208 [ rem16u#0 ] zp[1]:68 [ frame_cnt ] +Uplifting [MOS6526_CIA] best 26499 combination +Uplifting [MOS6569_VICII] best 26499 combination +Uplifting [MOS6581_SID] best 26499 combination +Uplifting [bitmap_clear] best 26499 combination +Uplifting [init_irq] best 26499 combination +Uplifting [irq] best 26499 combination +Uplifting [__start] best 26499 combination Attempting to uplift remaining variables inzp[1]:134 [ bitmap_init::$5 ] -Uplifting [bitmap_init] best 26714 combination reg byte a [ bitmap_init::$5 ] +Uplifting [bitmap_init] best 26439 combination reg byte a [ bitmap_init::$5 ] Attempting to uplift remaining variables inzp[1]:135 [ bitmap_init::$6 ] -Uplifting [bitmap_init] best 26654 combination reg byte a [ bitmap_init::$6 ] +Uplifting [bitmap_init] best 26379 combination reg byte a [ bitmap_init::$6 ] Attempting to uplift remaining variables inzp[1]:132 [ bitmap_init::$7 ] -Uplifting [bitmap_init] best 26654 combination zp[1]:132 [ bitmap_init::$7 ] +Uplifting [bitmap_init] best 26379 combination zp[1]:132 [ bitmap_init::$7 ] Attempting to uplift remaining variables inzp[1]:8 [ main::r_add#10 main::r_add#12 main::r_add#1 ] -Uplifting [main] best 26654 combination zp[1]:8 [ main::r_add#10 main::r_add#12 main::r_add#1 ] +Uplifting [main] best 26379 combination zp[1]:8 [ main::r_add#10 main::r_add#12 main::r_add#1 ] Attempting to uplift remaining variables inzp[1]:68 [ frame_cnt ] -Uplifting [] best 26654 combination zp[1]:68 [ frame_cnt ] +Uplifting [] best 26379 combination zp[1]:68 [ frame_cnt ] Coalescing zero page register [ zp[2]:4 [ main::r#10 main::r#1 ] ] with [ zp[2]:22 [ mul16s::a#3 mul16s::a#2 mul16s::a#1 mul16s::a#0 ] ] - score: 2 Coalescing zero page register [ zp[2]:35 [ sin16s::return#1 sin16s::return#5 sin16s::sinx#1 ] ] with [ zp[2]:201 [ sin16s::usinx#1 ] ] - score: 2 Coalescing zero page register [ zp[2]:63 [ mulu16_sel::v1#5 mulu16_sel::v1#4 mulu16_sel::v1#0 mulu16_sel::v1#1 mulu16_sel::v1#2 mulu16_sel::v1#3 ] ] with [ zp[2]:183 [ sin16s::x3#0 ] ] - score: 2 @@ -4688,8 +4688,7 @@ main: { sta.z r+1 // [57] if(main::idx_x#10!=0) goto main::@5 -- vwuz1_neq_0_then_la1 lda.z idx_x - bne __b5_from___b4 - lda.z idx_x+1 + ora.z idx_x+1 bne __b5_from___b4 jmp __b15 // main::@15 @@ -5683,8 +5682,7 @@ mul16u: { __b1: // [205] if(mul16u::a#3!=0) goto mul16u::@2 -- vwuz1_neq_0_then_la1 lda.z a - bne __b2 - lda.z a+1 + ora.z a+1 bne __b2 jmp __breturn // mul16u::@return @@ -6007,7 +6005,6 @@ Replacing label __b16_from___b14 with __b3 Replacing label __b17_from___b3 with __b4 Replacing label __b17_from___b3 with __b4 Replacing label __b5_from___b4 with __b5_from___b6 -Replacing label __b5_from___b4 with __b5_from___b6 Replacing label __b5_from___b15 with __b5 Replacing label __b1 with __b2 Replacing label __b6_from___b1 with __b2 @@ -6150,7 +6147,6 @@ Removing instruction __b1: Removing instruction __breturn: Succesful ASM optimization Pass5UnusedLabelElimination Skipping double jump to __b5 in bne __b5_from___b6 -Skipping double jump to __b5 in bne __b5_from___b6 Skipping double jump to __b3 in beq __b12 Replacing jump to rts with rts in jmp __b3 Succesful ASM optimization Pass5DoubleJumpElimination @@ -6513,7 +6509,7 @@ zp[2]:47 [ rem16u#0 ] FINAL ASSEMBLER -Score: 20857 +Score: 20582 // File Comments // Tests the simple bitmap plotter - and counts plots per frame in an IRQ @@ -6904,8 +6900,7 @@ main: { // if((idx_x==0) && (r_add!=1)) // [57] if(main::idx_x#10!=0) goto main::@5 -- vwuz1_neq_0_then_la1 lda.z idx_x - bne __b5 - lda.z idx_x+1 + ora.z idx_x+1 bne __b5 // main::@15 // [58] if(main::r_add#10==1) goto main::@5 -- vbuz1_eq_vbuc1_then_la1 @@ -7876,8 +7871,7 @@ mul16u: { // while(a!=0) // [205] if(mul16u::a#3!=0) goto mul16u::@2 -- vwuz1_neq_0_then_la1 lda.z a - bne __b2 - lda.z a+1 + ora.z a+1 bne __b2 // mul16u::@return // } diff --git a/src/test/ref/bitmap-plot-3.asm b/src/test/ref/bitmap-plot-3.asm index a81b81a85..ddf5a6807 100644 --- a/src/test/ref/bitmap-plot-3.asm +++ b/src/test/ref/bitmap-plot-3.asm @@ -222,16 +222,13 @@ bitmap_line: { // dy = abs_u16(y2-y1) // if(dx==0 && dy==0) lda.z dx - bne __b1 - lda.z dx+1 + ora.z dx+1 bne __b1 lda.z dy - bne !+ - lda.z dy+1 + ora.z dy+1 bne !__b4+ jmp __b4 !__b4: - !: __b1: // sgn_u16(x2-x1) lda.z x2 diff --git a/src/test/ref/bitmap-plot-3.log b/src/test/ref/bitmap-plot-3.log index 193d03ac2..aebc89241 100644 --- a/src/test/ref/bitmap-plot-3.log +++ b/src/test/ref/bitmap-plot-3.log @@ -2445,30 +2445,30 @@ Uplift Scope [bitmap_clear] Uplift Scope [RADIX] Uplift Scope [] -Uplifting [bitmap_plot] best 33056 combination reg byte a [ bitmap_plot::y#4 bitmap_plot::y#2 bitmap_plot::y#0 bitmap_plot::y#1 bitmap_plot::y#3 ] zp[2]:69 [ bitmap_plot::$0 ] reg byte x [ bitmap_plot::$1 ] zp[2]:71 [ bitmap_plot::plotter#1 ] zp[2]:31 [ bitmap_plot::x#4 bitmap_plot::x#2 bitmap_plot::x#0 bitmap_plot::x#1 bitmap_plot::x#3 ] zp[2]:67 [ bitmap_plot::plotter#0 ] -Uplifting [bitmap_line] best 33056 combination zp[2]:11 [ bitmap_line::x#7 bitmap_line::x#6 bitmap_line::x#15 bitmap_line::x#13 bitmap_line::x1#0 bitmap_line::x#12 bitmap_line::x#1 ] zp[2]:13 [ bitmap_line::y#15 bitmap_line::y#7 bitmap_line::y#13 bitmap_line::y#4 bitmap_line::y1#0 bitmap_line::y#1 bitmap_line::y#2 ] zp[2]:9 [ bitmap_line::e#3 bitmap_line::e#0 bitmap_line::e#6 bitmap_line::e#1 bitmap_line::e#2 ] zp[2]:15 [ bitmap_line::e1#3 bitmap_line::e1#6 bitmap_line::e1#0 bitmap_line::e1#2 bitmap_line::e1#1 ] zp[2]:51 [ bitmap_line::dy#0 ] zp[2]:59 [ bitmap_line::sy#0 ] zp[2]:47 [ bitmap_line::dx#0 ] zp[2]:55 [ bitmap_line::sx#0 ] zp[2]:39 [ bitmap_line::y2#0 ] zp[2]:37 [ bitmap_line::x2#0 ] -Uplifting [abs_u16] best 33044 combination zp[2]:24 [ abs_u16::return#4 abs_u16::return#2 abs_u16::w#2 abs_u16::w#0 abs_u16::w#1 ] reg byte a [ abs_u16::$0 ] reg byte a [ abs_u16::$1 ] zp[2]:45 [ abs_u16::return#0 ] zp[2]:49 [ abs_u16::return#1 ] -Uplifting [sgn_u16] best 33032 combination reg byte a [ sgn_u16::$0 ] reg byte a [ sgn_u16::$1 ] zp[2]:26 [ sgn_u16::w#2 sgn_u16::w#0 sgn_u16::w#1 ] zp[2]:53 [ sgn_u16::return#0 ] zp[2]:57 [ sgn_u16::return#1 ] zp[2]:28 [ sgn_u16::return#4 ] -Uplifting [memset] best 33016 combination zp[2]:22 [ memset::dst#2 memset::dst#4 memset::dst#1 ] zp[2]:61 [ memset::end#0 ] reg byte x [ memset::c#4 ] zp[2]:17 [ memset::num#2 ] zp[2]:19 [ memset::str#3 ] -Uplifting [bitmap_init] best 32506 combination zp[2]:7 [ bitmap_init::yoffs#2 bitmap_init::yoffs#4 bitmap_init::yoffs#1 ] reg byte a [ bitmap_init::bits#3 bitmap_init::bits#4 bitmap_init::bits#1 ] reg byte x [ bitmap_init::x#2 bitmap_init::x#1 ] reg byte x [ bitmap_init::y#2 bitmap_init::y#1 ] reg byte a [ bitmap_init::$4 ] zp[1]:43 [ bitmap_init::$5 ] zp[1]:44 [ bitmap_init::$6 ] zp[1]:41 [ bitmap_init::$7 ] +Uplifting [bitmap_plot] best 33050 combination reg byte a [ bitmap_plot::y#4 bitmap_plot::y#2 bitmap_plot::y#0 bitmap_plot::y#1 bitmap_plot::y#3 ] zp[2]:69 [ bitmap_plot::$0 ] reg byte x [ bitmap_plot::$1 ] zp[2]:71 [ bitmap_plot::plotter#1 ] zp[2]:31 [ bitmap_plot::x#4 bitmap_plot::x#2 bitmap_plot::x#0 bitmap_plot::x#1 bitmap_plot::x#3 ] zp[2]:67 [ bitmap_plot::plotter#0 ] +Uplifting [bitmap_line] best 33050 combination zp[2]:11 [ bitmap_line::x#7 bitmap_line::x#6 bitmap_line::x#15 bitmap_line::x#13 bitmap_line::x1#0 bitmap_line::x#12 bitmap_line::x#1 ] zp[2]:13 [ bitmap_line::y#15 bitmap_line::y#7 bitmap_line::y#13 bitmap_line::y#4 bitmap_line::y1#0 bitmap_line::y#1 bitmap_line::y#2 ] zp[2]:9 [ bitmap_line::e#3 bitmap_line::e#0 bitmap_line::e#6 bitmap_line::e#1 bitmap_line::e#2 ] zp[2]:15 [ bitmap_line::e1#3 bitmap_line::e1#6 bitmap_line::e1#0 bitmap_line::e1#2 bitmap_line::e1#1 ] zp[2]:51 [ bitmap_line::dy#0 ] zp[2]:59 [ bitmap_line::sy#0 ] zp[2]:47 [ bitmap_line::dx#0 ] zp[2]:55 [ bitmap_line::sx#0 ] zp[2]:39 [ bitmap_line::y2#0 ] zp[2]:37 [ bitmap_line::x2#0 ] +Uplifting [abs_u16] best 33038 combination zp[2]:24 [ abs_u16::return#4 abs_u16::return#2 abs_u16::w#2 abs_u16::w#0 abs_u16::w#1 ] reg byte a [ abs_u16::$0 ] reg byte a [ abs_u16::$1 ] zp[2]:45 [ abs_u16::return#0 ] zp[2]:49 [ abs_u16::return#1 ] +Uplifting [sgn_u16] best 33026 combination reg byte a [ sgn_u16::$0 ] reg byte a [ sgn_u16::$1 ] zp[2]:26 [ sgn_u16::w#2 sgn_u16::w#0 sgn_u16::w#1 ] zp[2]:53 [ sgn_u16::return#0 ] zp[2]:57 [ sgn_u16::return#1 ] zp[2]:28 [ sgn_u16::return#4 ] +Uplifting [memset] best 33010 combination zp[2]:22 [ memset::dst#2 memset::dst#4 memset::dst#1 ] zp[2]:61 [ memset::end#0 ] reg byte x [ memset::c#4 ] zp[2]:17 [ memset::num#2 ] zp[2]:19 [ memset::str#3 ] +Uplifting [bitmap_init] best 32500 combination zp[2]:7 [ bitmap_init::yoffs#2 bitmap_init::yoffs#4 bitmap_init::yoffs#1 ] reg byte a [ bitmap_init::bits#3 bitmap_init::bits#4 bitmap_init::bits#1 ] reg byte x [ bitmap_init::x#2 bitmap_init::x#1 ] reg byte x [ bitmap_init::y#2 bitmap_init::y#1 ] reg byte a [ bitmap_init::$4 ] zp[1]:43 [ bitmap_init::$5 ] zp[1]:44 [ bitmap_init::$6 ] zp[1]:41 [ bitmap_init::$7 ] Limited combination testing to 100 combinations of 15360 possible. -Uplifting [main] best 32506 combination zp[1]:2 [ main::i#2 main::i#1 ] zp[2]:33 [ main::$13 ] zp[2]:35 [ main::$14 ] zp[1]:3 [ main::a#2 main::a#1 ] -Uplifting [MOS6526_CIA] best 32506 combination -Uplifting [MOS6569_VICII] best 32506 combination -Uplifting [MOS6581_SID] best 32506 combination -Uplifting [bitmap_clear] best 32506 combination -Uplifting [RADIX] best 32506 combination -Uplifting [] best 32506 combination +Uplifting [main] best 32500 combination zp[1]:2 [ main::i#2 main::i#1 ] zp[2]:33 [ main::$13 ] zp[2]:35 [ main::$14 ] zp[1]:3 [ main::a#2 main::a#1 ] +Uplifting [MOS6526_CIA] best 32500 combination +Uplifting [MOS6569_VICII] best 32500 combination +Uplifting [MOS6581_SID] best 32500 combination +Uplifting [bitmap_clear] best 32500 combination +Uplifting [RADIX] best 32500 combination +Uplifting [] best 32500 combination Attempting to uplift remaining variables inzp[1]:43 [ bitmap_init::$5 ] -Uplifting [bitmap_init] best 32446 combination reg byte a [ bitmap_init::$5 ] +Uplifting [bitmap_init] best 32440 combination reg byte a [ bitmap_init::$5 ] Attempting to uplift remaining variables inzp[1]:44 [ bitmap_init::$6 ] -Uplifting [bitmap_init] best 32386 combination reg byte a [ bitmap_init::$6 ] +Uplifting [bitmap_init] best 32380 combination reg byte a [ bitmap_init::$6 ] Attempting to uplift remaining variables inzp[1]:41 [ bitmap_init::$7 ] -Uplifting [bitmap_init] best 32386 combination zp[1]:41 [ bitmap_init::$7 ] +Uplifting [bitmap_init] best 32380 combination zp[1]:41 [ bitmap_init::$7 ] Attempting to uplift remaining variables inzp[1]:2 [ main::i#2 main::i#1 ] -Uplifting [main] best 32386 combination zp[1]:2 [ main::i#2 main::i#1 ] +Uplifting [main] best 32380 combination zp[1]:2 [ main::i#2 main::i#1 ] Attempting to uplift remaining variables inzp[1]:3 [ main::a#2 main::a#1 ] -Uplifting [main] best 32386 combination zp[1]:3 [ main::a#2 main::a#1 ] +Uplifting [main] best 32380 combination zp[1]:3 [ main::a#2 main::a#1 ] Coalescing zero page register [ zp[2]:11 [ bitmap_line::x#7 bitmap_line::x#6 bitmap_line::x#15 bitmap_line::x#13 bitmap_line::x1#0 bitmap_line::x#12 bitmap_line::x#1 ] ] with [ zp[2]:31 [ bitmap_plot::x#4 bitmap_plot::x#2 bitmap_plot::x#0 bitmap_plot::x#1 bitmap_plot::x#3 ] ] - score: 4 Coalescing zero page register [ zp[2]:11 [ bitmap_line::x#7 bitmap_line::x#6 bitmap_line::x#15 bitmap_line::x#13 bitmap_line::x1#0 bitmap_line::x#12 bitmap_line::x#1 bitmap_plot::x#4 bitmap_plot::x#2 bitmap_plot::x#0 bitmap_plot::x#1 bitmap_plot::x#3 ] ] with [ zp[2]:33 [ main::$13 ] ] - score: 1 Coalescing zero page register [ zp[2]:17 [ memset::num#2 ] ] with [ zp[2]:61 [ memset::end#0 ] ] - score: 1 @@ -2854,18 +2854,15 @@ bitmap_line: { // [53] bitmap_line::dy#0 = abs_u16::return#1 // [54] if(bitmap_line::dx#0!=0) goto bitmap_line::@1 -- vwuz1_neq_0_then_la1 lda.z dx - bne __b1 - lda.z dx+1 + ora.z dx+1 bne __b1 jmp __b18 // bitmap_line::@18 __b18: // [55] if(bitmap_line::dy#0==0) goto bitmap_line::@4 -- vwuz1_eq_0_then_la1 lda.z dy - bne !+ - lda.z dy+1 + ora.z dy+1 beq __b4 - !: jmp __b1 // bitmap_line::@1 __b1: @@ -3462,7 +3459,7 @@ Removing instruction __b2: Removing instruction __breturn: Removing instruction __breturn: Succesful ASM optimization Pass5UnusedLabelElimination -Fixing long branch [194] beq __b4 to bne +Fixing long branch [192] beq __b4 to bne FINAL SYMBOL TABLE const byte* BITMAP = (byte*) 8192 @@ -3653,7 +3650,7 @@ reg byte x [ bitmap_plot::$1 ] FINAL ASSEMBLER -Score: 26883 +Score: 26877 // File Comments // Tests the simple bitmap plotter @@ -3990,18 +3987,15 @@ bitmap_line: { // if(dx==0 && dy==0) // [54] if(bitmap_line::dx#0!=0) goto bitmap_line::@1 -- vwuz1_neq_0_then_la1 lda.z dx - bne __b1 - lda.z dx+1 + ora.z dx+1 bne __b1 // bitmap_line::@18 // [55] if(bitmap_line::dy#0==0) goto bitmap_line::@4 -- vwuz1_eq_0_then_la1 lda.z dy - bne !+ - lda.z dy+1 + ora.z dy+1 bne !__b4+ jmp __b4 !__b4: - !: // bitmap_line::@1 __b1: // sgn_u16(x2-x1) diff --git a/src/test/ref/complex/clearscreen/clearscreen.asm b/src/test/ref/complex/clearscreen/clearscreen.asm index 09f22475c..ee354ade4 100644 --- a/src/test/ref/complex/clearscreen/clearscreen.asm +++ b/src/test/ref/complex/clearscreen/clearscreen.asm @@ -1303,8 +1303,7 @@ atan2_16: { __b10: // if(yi==0) lda.z yi+1 - bne __b11 - lda.z yi + ora.z yi bne __b11 __b12: // angle /=2 diff --git a/src/test/ref/complex/clearscreen/clearscreen.log b/src/test/ref/complex/clearscreen/clearscreen.log index f269ed0b6..b4fa0a997 100644 --- a/src/test/ref/complex/clearscreen/clearscreen.log +++ b/src/test/ref/complex/clearscreen/clearscreen.log @@ -4847,136 +4847,136 @@ Uplift Scope [irqTop] Uplift Scope [irqBottom] Uplift Scope [__start] -Uplifting [atan2_16] best 1278932 combination reg byte y [ atan2_16::shift#2 atan2_16::shift#5 atan2_16::shift#1 ] zp[2]:48 [ atan2_16::yd#5 atan2_16::yd#3 atan2_16::yd#10 atan2_16::yd#1 atan2_16::yd#2 ] zp[2]:50 [ atan2_16::xd#5 atan2_16::xd#3 atan2_16::xd#10 atan2_16::xd#1 atan2_16::xd#2 ] zp[2]:43 [ atan2_16::angle#6 atan2_16::angle#12 atan2_16::angle#13 atan2_16::angle#2 atan2_16::angle#3 ] zp[2]:38 [ atan2_16::yi#3 atan2_16::yi#8 atan2_16::yi#0 atan2_16::yi#16 atan2_16::$2 atan2_16::yi#1 atan2_16::yi#2 ] zp[2]:40 [ atan2_16::xi#3 atan2_16::xi#8 atan2_16::xi#0 atan2_16::xi#13 atan2_16::$7 atan2_16::xi#1 atan2_16::xi#2 ] reg byte a [ atan2_16::$23 ] reg byte a [ atan2_16::$22 ] reg byte x [ atan2_16::i#2 atan2_16::i#1 ] zp[2]:45 [ atan2_16::return#0 atan2_16::angle#11 atan2_16::angle#1 atan2_16::angle#4 atan2_16::angle#5 ] zp[2]:108 [ atan2_16::return#2 ] zp[2]:104 [ atan2_16::x#0 ] zp[2]:106 [ atan2_16::y#0 ] +Uplifting [atan2_16] best 1276432 combination reg byte y [ atan2_16::shift#2 atan2_16::shift#5 atan2_16::shift#1 ] zp[2]:48 [ atan2_16::yd#5 atan2_16::yd#3 atan2_16::yd#10 atan2_16::yd#1 atan2_16::yd#2 ] zp[2]:50 [ atan2_16::xd#5 atan2_16::xd#3 atan2_16::xd#10 atan2_16::xd#1 atan2_16::xd#2 ] zp[2]:43 [ atan2_16::angle#6 atan2_16::angle#12 atan2_16::angle#13 atan2_16::angle#2 atan2_16::angle#3 ] zp[2]:38 [ atan2_16::yi#3 atan2_16::yi#8 atan2_16::yi#0 atan2_16::yi#16 atan2_16::$2 atan2_16::yi#1 atan2_16::yi#2 ] zp[2]:40 [ atan2_16::xi#3 atan2_16::xi#8 atan2_16::xi#0 atan2_16::xi#13 atan2_16::$7 atan2_16::xi#1 atan2_16::xi#2 ] reg byte a [ atan2_16::$23 ] reg byte a [ atan2_16::$22 ] reg byte x [ atan2_16::i#2 atan2_16::i#1 ] zp[2]:45 [ atan2_16::return#0 atan2_16::angle#11 atan2_16::angle#1 atan2_16::angle#4 atan2_16::angle#5 ] zp[2]:108 [ atan2_16::return#2 ] zp[2]:104 [ atan2_16::x#0 ] zp[2]:106 [ atan2_16::y#0 ] Limited combination testing to 100 combinations of 144 possible. -Uplifting [getCharToProcess] best 1265599 combination reg byte x [ getCharToProcess::return_dist#1 getCharToProcess::return_dist#5 getCharToProcess::return_dist#6 getCharToProcess::dist#0 ] zp[1]:27 [ getCharToProcess::closest_dist#2 getCharToProcess::closest_dist#8 getCharToProcess::closest_dist#10 getCharToProcess::closest_dist#12 ] zp[1]:29 [ getCharToProcess::closest_y#7 getCharToProcess::closest_y#9 getCharToProcess::return_y#1 getCharToProcess::return_y#7 ] zp[1]:28 [ getCharToProcess::closest_x#7 getCharToProcess::closest_x#9 getCharToProcess::return_x#1 getCharToProcess::return_x#7 ] zp[1]:26 [ getCharToProcess::x#2 getCharToProcess::x#1 ] zp[1]:25 [ getCharToProcess::y#7 getCharToProcess::y#1 ] zp[2]:23 [ getCharToProcess::dist_line#6 getCharToProcess::dist_line#0 getCharToProcess::dist_line#1 ] zp[2]:21 [ getCharToProcess::screen_line#4 getCharToProcess::screen_line#0 getCharToProcess::screen_line#1 ] zp[2]:120 [ getCharToProcess::$12 ] zp[2]:122 [ getCharToProcess::$13 ] zp[2]:124 [ getCharToProcess::$8 ] zp[2]:126 [ getCharToProcess::$9 ] zp[2]:118 [ getCharToProcess::$11 ] zp[1]:65 [ getCharToProcess::return_x#0 ] zp[1]:66 [ getCharToProcess::return_y#0 ] zp[1]:67 [ getCharToProcess::return_dist#0 ] +Uplifting [getCharToProcess] best 1263099 combination reg byte x [ getCharToProcess::return_dist#1 getCharToProcess::return_dist#5 getCharToProcess::return_dist#6 getCharToProcess::dist#0 ] zp[1]:27 [ getCharToProcess::closest_dist#2 getCharToProcess::closest_dist#8 getCharToProcess::closest_dist#10 getCharToProcess::closest_dist#12 ] zp[1]:29 [ getCharToProcess::closest_y#7 getCharToProcess::closest_y#9 getCharToProcess::return_y#1 getCharToProcess::return_y#7 ] zp[1]:28 [ getCharToProcess::closest_x#7 getCharToProcess::closest_x#9 getCharToProcess::return_x#1 getCharToProcess::return_x#7 ] zp[1]:26 [ getCharToProcess::x#2 getCharToProcess::x#1 ] zp[1]:25 [ getCharToProcess::y#7 getCharToProcess::y#1 ] zp[2]:23 [ getCharToProcess::dist_line#6 getCharToProcess::dist_line#0 getCharToProcess::dist_line#1 ] zp[2]:21 [ getCharToProcess::screen_line#4 getCharToProcess::screen_line#0 getCharToProcess::screen_line#1 ] zp[2]:120 [ getCharToProcess::$12 ] zp[2]:122 [ getCharToProcess::$13 ] zp[2]:124 [ getCharToProcess::$8 ] zp[2]:126 [ getCharToProcess::$9 ] zp[2]:118 [ getCharToProcess::$11 ] zp[1]:65 [ getCharToProcess::return_x#0 ] zp[1]:66 [ getCharToProcess::return_y#0 ] zp[1]:67 [ getCharToProcess::return_dist#0 ] Limited combination testing to 100 combinations of 46656 possible. -Uplifting [init_angle_screen] best 1263999 combination zp[1]:17 [ init_angle_screen::xb#2 init_angle_screen::xb#1 ] reg byte a [ init_angle_screen::$3 ] reg byte a [ init_angle_screen::$4 ] reg byte a [ init_angle_screen::$5 ] zp[2]:110 [ init_angle_screen::angle_w#0 ] zp[2]:112 [ init_angle_screen::$7 ] zp[1]:115 [ init_angle_screen::$9 ] zp[1]:116 [ init_angle_screen::$10 ] zp[1]:117 [ init_angle_screen::$11 ] zp[1]:16 [ init_angle_screen::x#2 init_angle_screen::x#1 ] zp[1]:114 [ init_angle_screen::ang_w#0 ] zp[2]:102 [ init_angle_screen::yw#0 ] zp[2]:99 [ init_angle_screen::xw#0 ] zp[1]:11 [ init_angle_screen::y#5 init_angle_screen::y#1 ] zp[2]:14 [ init_angle_screen::screen_bottomline#6 init_angle_screen::screen_bottomline#0 init_angle_screen::screen_bottomline#1 ] zp[2]:12 [ init_angle_screen::screen_topline#6 init_angle_screen::screen_topline#7 init_angle_screen::screen_topline#1 ] zp[2]:58 [ init_angle_screen::screen#0 ] +Uplifting [init_angle_screen] best 1261499 combination zp[1]:17 [ init_angle_screen::xb#2 init_angle_screen::xb#1 ] reg byte a [ init_angle_screen::$3 ] reg byte a [ init_angle_screen::$4 ] reg byte a [ init_angle_screen::$5 ] zp[2]:110 [ init_angle_screen::angle_w#0 ] zp[2]:112 [ init_angle_screen::$7 ] zp[1]:115 [ init_angle_screen::$9 ] zp[1]:116 [ init_angle_screen::$10 ] zp[1]:117 [ init_angle_screen::$11 ] zp[1]:16 [ init_angle_screen::x#2 init_angle_screen::x#1 ] zp[1]:114 [ init_angle_screen::ang_w#0 ] zp[2]:102 [ init_angle_screen::yw#0 ] zp[2]:99 [ init_angle_screen::xw#0 ] zp[1]:11 [ init_angle_screen::y#5 init_angle_screen::y#1 ] zp[2]:14 [ init_angle_screen::screen_bottomline#6 init_angle_screen::screen_bottomline#0 init_angle_screen::screen_bottomline#1 ] zp[2]:12 [ init_angle_screen::screen_topline#6 init_angle_screen::screen_topline#7 init_angle_screen::screen_topline#1 ] zp[2]:58 [ init_angle_screen::screen#0 ] Limited combination testing to 100 combinations of 65536 possible. -Uplifting [initSprites] best 1263879 combination zp[2]:18 [ initSprites::sp#2 initSprites::sp#1 ] reg byte x [ initSprites::i#2 initSprites::i#1 ] -Uplifting [processChars] best 1263639 combination zp[1]:10 [ processChars::numActive#10 processChars::numActive#3 processChars::numActive#1 ] reg byte a [ processChars::$87 ] reg byte a [ processChars::$88 ] reg byte a [ processChars::$89 ] reg byte a [ processChars::$28 ] zp[1]:83 [ processChars::$9 ] zp[1]:84 [ processChars::$10 ] zp[1]:90 [ processChars::$73 ] zp[1]:91 [ processChars::xchar#0 ] zp[1]:92 [ processChars::$29 ] zp[1]:93 [ processChars::$79 ] zp[1]:94 [ processChars::ychar#0 ] zp[1]:95 [ processChars::$30 ] zp[1]:96 [ processChars::$25 ] zp[1]:9 [ processChars::i#10 processChars::i#1 ] zp[2]:85 [ processChars::$12 ] zp[2]:88 [ processChars::$21 ] zp[1]:87 [ processChars::ypos#0 ] zp[1]:80 [ processChars::bitmask#0 ] zp[2]:81 [ processChars::xpos#0 ] zp[1]:73 [ processChars::$13 ] zp[2]:78 [ processChars::processing#0 ] +Uplifting [initSprites] best 1261379 combination zp[2]:18 [ initSprites::sp#2 initSprites::sp#1 ] reg byte x [ initSprites::i#2 initSprites::i#1 ] +Uplifting [processChars] best 1261139 combination zp[1]:10 [ processChars::numActive#10 processChars::numActive#3 processChars::numActive#1 ] reg byte a [ processChars::$87 ] reg byte a [ processChars::$88 ] reg byte a [ processChars::$89 ] reg byte a [ processChars::$28 ] zp[1]:83 [ processChars::$9 ] zp[1]:84 [ processChars::$10 ] zp[1]:90 [ processChars::$73 ] zp[1]:91 [ processChars::xchar#0 ] zp[1]:92 [ processChars::$29 ] zp[1]:93 [ processChars::$79 ] zp[1]:94 [ processChars::ychar#0 ] zp[1]:95 [ processChars::$30 ] zp[1]:96 [ processChars::$25 ] zp[1]:9 [ processChars::i#10 processChars::i#1 ] zp[2]:85 [ processChars::$12 ] zp[2]:88 [ processChars::$21 ] zp[1]:87 [ processChars::ypos#0 ] zp[1]:80 [ processChars::bitmask#0 ] zp[2]:81 [ processChars::xpos#0 ] zp[1]:73 [ processChars::$13 ] zp[2]:78 [ processChars::processing#0 ] Limited combination testing to 100 combinations of 134217728 possible. -Uplifting [main] best 1263399 combination zp[2]:6 [ main::dst#2 main::dst#0 main::dst#1 ] zp[2]:4 [ main::src#2 main::src#1 ] zp[1]:8 [ main::i#2 main::i#1 ] reg byte a [ main::$11 ] reg byte a [ main::$12 ] reg byte a [ main::$13 ] reg byte a [ main::$14 ] zp[1]:64 [ main::$10 ] zp[1]:70 [ main::center_dist#0 ] zp[1]:68 [ main::center_x#0 ] zp[1]:69 [ main::center_y#0 ] +Uplifting [main] best 1260899 combination zp[2]:6 [ main::dst#2 main::dst#0 main::dst#1 ] zp[2]:4 [ main::src#2 main::src#1 ] zp[1]:8 [ main::i#2 main::i#1 ] reg byte a [ main::$11 ] reg byte a [ main::$12 ] reg byte a [ main::$13 ] reg byte a [ main::$14 ] zp[1]:64 [ main::$10 ] zp[1]:70 [ main::center_dist#0 ] zp[1]:68 [ main::center_x#0 ] zp[1]:69 [ main::center_y#0 ] Limited combination testing to 100 combinations of 65536 possible. -Uplifting [] best 1263399 combination zp[2]:2 [ heap_head#6 heap_head#0 ] zp[2]:54 [ SCREEN_DIST#0 ] zp[2]:52 [ SCREEN_COPY#0 ] -Uplifting [malloc] best 1263399 combination zp[2]:56 [ malloc::mem#0 ] -Uplifting [RADIX] best 1263399 combination -Uplifting [MOS6526_CIA] best 1263399 combination -Uplifting [MOS6569_VICII] best 1263399 combination -Uplifting [MOS6581_SID] best 1263399 combination -Uplifting [ProcessingChar] best 1263399 combination -Uplifting [ProcessingSprite] best 1263399 combination -Uplifting [ProcessingSprite::$0] best 1263399 combination -Uplifting [setupRasterIrq] best 1263399 combination -Uplifting [irqTop] best 1263399 combination -Uplifting [irqBottom] best 1263399 combination -Uplifting [__start] best 1263399 combination +Uplifting [] best 1260899 combination zp[2]:2 [ heap_head#6 heap_head#0 ] zp[2]:54 [ SCREEN_DIST#0 ] zp[2]:52 [ SCREEN_COPY#0 ] +Uplifting [malloc] best 1260899 combination zp[2]:56 [ malloc::mem#0 ] +Uplifting [RADIX] best 1260899 combination +Uplifting [MOS6526_CIA] best 1260899 combination +Uplifting [MOS6569_VICII] best 1260899 combination +Uplifting [MOS6581_SID] best 1260899 combination +Uplifting [ProcessingChar] best 1260899 combination +Uplifting [ProcessingSprite] best 1260899 combination +Uplifting [ProcessingSprite::$0] best 1260899 combination +Uplifting [setupRasterIrq] best 1260899 combination +Uplifting [irqTop] best 1260899 combination +Uplifting [irqBottom] best 1260899 combination +Uplifting [__start] best 1260899 combination Attempting to uplift remaining variables inzp[1]:27 [ getCharToProcess::closest_dist#2 getCharToProcess::closest_dist#8 getCharToProcess::closest_dist#10 getCharToProcess::closest_dist#12 ] -Uplifting [getCharToProcess] best 1263399 combination zp[1]:27 [ getCharToProcess::closest_dist#2 getCharToProcess::closest_dist#8 getCharToProcess::closest_dist#10 getCharToProcess::closest_dist#12 ] +Uplifting [getCharToProcess] best 1260899 combination zp[1]:27 [ getCharToProcess::closest_dist#2 getCharToProcess::closest_dist#8 getCharToProcess::closest_dist#10 getCharToProcess::closest_dist#12 ] Attempting to uplift remaining variables inzp[1]:29 [ getCharToProcess::closest_y#7 getCharToProcess::closest_y#9 getCharToProcess::return_y#1 getCharToProcess::return_y#7 ] -Uplifting [getCharToProcess] best 1263399 combination zp[1]:29 [ getCharToProcess::closest_y#7 getCharToProcess::closest_y#9 getCharToProcess::return_y#1 getCharToProcess::return_y#7 ] +Uplifting [getCharToProcess] best 1260899 combination zp[1]:29 [ getCharToProcess::closest_y#7 getCharToProcess::closest_y#9 getCharToProcess::return_y#1 getCharToProcess::return_y#7 ] Attempting to uplift remaining variables inzp[1]:32 [ startProcessing::freeIdx#2 startProcessing::freeIdx#8 startProcessing::i#2 startProcessing::i#1 ] -Uplifting [startProcessing] best 1263399 combination zp[1]:32 [ startProcessing::freeIdx#2 startProcessing::freeIdx#8 startProcessing::i#2 startProcessing::i#1 ] +Uplifting [startProcessing] best 1260899 combination zp[1]:32 [ startProcessing::freeIdx#2 startProcessing::freeIdx#8 startProcessing::i#2 startProcessing::i#1 ] Attempting to uplift remaining variables inzp[1]:128 [ startProcessing::$28 ] -Uplifting [startProcessing] best 1257399 combination reg byte a [ startProcessing::$28 ] +Uplifting [startProcessing] best 1254899 combination reg byte a [ startProcessing::$28 ] Attempting to uplift remaining variables inzp[1]:129 [ startProcessing::$29 ] -Uplifting [startProcessing] best 1251399 combination reg byte a [ startProcessing::$29 ] +Uplifting [startProcessing] best 1248899 combination reg byte a [ startProcessing::$29 ] Attempting to uplift remaining variables inzp[1]:130 [ startProcessing::$30 ] -Uplifting [startProcessing] best 1245399 combination reg byte a [ startProcessing::$30 ] +Uplifting [startProcessing] best 1242899 combination reg byte a [ startProcessing::$30 ] Attempting to uplift remaining variables inzp[1]:131 [ startProcessing::$31 ] -Uplifting [startProcessing] best 1239399 combination reg byte a [ startProcessing::$31 ] +Uplifting [startProcessing] best 1236899 combination reg byte a [ startProcessing::$31 ] Attempting to uplift remaining variables inzp[1]:132 [ startProcessing::$21 ] -Uplifting [startProcessing] best 1235399 combination reg byte a [ startProcessing::$21 ] +Uplifting [startProcessing] best 1232899 combination reg byte a [ startProcessing::$21 ] Attempting to uplift remaining variables inzp[1]:28 [ getCharToProcess::closest_x#7 getCharToProcess::closest_x#9 getCharToProcess::return_x#1 getCharToProcess::return_x#7 ] -Uplifting [getCharToProcess] best 1235399 combination zp[1]:28 [ getCharToProcess::closest_x#7 getCharToProcess::closest_x#9 getCharToProcess::return_x#1 getCharToProcess::return_x#7 ] +Uplifting [getCharToProcess] best 1232899 combination zp[1]:28 [ getCharToProcess::closest_x#7 getCharToProcess::closest_x#9 getCharToProcess::return_x#1 getCharToProcess::return_x#7 ] Attempting to uplift remaining variables inzp[1]:26 [ getCharToProcess::x#2 getCharToProcess::x#1 ] -Uplifting [getCharToProcess] best 1217399 combination reg byte y [ getCharToProcess::x#2 getCharToProcess::x#1 ] +Uplifting [getCharToProcess] best 1214899 combination reg byte y [ getCharToProcess::x#2 getCharToProcess::x#1 ] Attempting to uplift remaining variables inzp[1]:31 [ startProcessing::freeIdx#6 startProcessing::freeIdx#7 ] -Uplifting [startProcessing] best 1216499 combination reg byte x [ startProcessing::freeIdx#6 startProcessing::freeIdx#7 ] +Uplifting [startProcessing] best 1213999 combination reg byte x [ startProcessing::freeIdx#6 startProcessing::freeIdx#7 ] Attempting to uplift remaining variables inzp[1]:37 [ startProcessing::i1#2 startProcessing::i1#1 ] -Uplifting [startProcessing] best 1215599 combination reg byte x [ startProcessing::i1#2 startProcessing::i1#1 ] +Uplifting [startProcessing] best 1213099 combination reg byte x [ startProcessing::i1#2 startProcessing::i1#1 ] Attempting to uplift remaining variables inzp[1]:25 [ getCharToProcess::y#7 getCharToProcess::y#1 ] -Uplifting [getCharToProcess] best 1215599 combination zp[1]:25 [ getCharToProcess::y#7 getCharToProcess::y#1 ] +Uplifting [getCharToProcess] best 1213099 combination zp[1]:25 [ getCharToProcess::y#7 getCharToProcess::y#1 ] Attempting to uplift remaining variables inzp[1]:17 [ init_angle_screen::xb#2 init_angle_screen::xb#1 ] -Uplifting [init_angle_screen] best 1215599 combination zp[1]:17 [ init_angle_screen::xb#2 init_angle_screen::xb#1 ] +Uplifting [init_angle_screen] best 1213099 combination zp[1]:17 [ init_angle_screen::xb#2 init_angle_screen::xb#1 ] Attempting to uplift remaining variables inzp[1]:115 [ init_angle_screen::$9 ] -Uplifting [init_angle_screen] best 1214999 combination reg byte a [ init_angle_screen::$9 ] +Uplifting [init_angle_screen] best 1212499 combination reg byte a [ init_angle_screen::$9 ] Attempting to uplift remaining variables inzp[1]:116 [ init_angle_screen::$10 ] -Uplifting [init_angle_screen] best 1214599 combination reg byte a [ init_angle_screen::$10 ] +Uplifting [init_angle_screen] best 1212099 combination reg byte a [ init_angle_screen::$10 ] Attempting to uplift remaining variables inzp[1]:117 [ init_angle_screen::$11 ] -Uplifting [init_angle_screen] best 1213999 combination reg byte a [ init_angle_screen::$11 ] +Uplifting [init_angle_screen] best 1211499 combination reg byte a [ init_angle_screen::$11 ] Attempting to uplift remaining variables inzp[1]:16 [ init_angle_screen::x#2 init_angle_screen::x#1 ] -Uplifting [init_angle_screen] best 1213999 combination zp[1]:16 [ init_angle_screen::x#2 init_angle_screen::x#1 ] +Uplifting [init_angle_screen] best 1211499 combination zp[1]:16 [ init_angle_screen::x#2 init_angle_screen::x#1 ] Attempting to uplift remaining variables inzp[1]:114 [ init_angle_screen::ang_w#0 ] -Uplifting [init_angle_screen] best 1213999 combination zp[1]:114 [ init_angle_screen::ang_w#0 ] +Uplifting [init_angle_screen] best 1211499 combination zp[1]:114 [ init_angle_screen::ang_w#0 ] Attempting to uplift remaining variables inzp[1]:175 [ startProcessing::$36 ] -Uplifting [startProcessing] best 1213993 combination reg byte a [ startProcessing::$36 ] +Uplifting [startProcessing] best 1211493 combination reg byte a [ startProcessing::$36 ] Attempting to uplift remaining variables inzp[1]:176 [ startProcessing::$37 ] -Uplifting [startProcessing] best 1213987 combination reg byte a [ startProcessing::$37 ] +Uplifting [startProcessing] best 1211487 combination reg byte a [ startProcessing::$37 ] Attempting to uplift remaining variables inzp[1]:177 [ startProcessing::$38 ] -Uplifting [startProcessing] best 1213981 combination reg byte a [ startProcessing::$38 ] +Uplifting [startProcessing] best 1211481 combination reg byte a [ startProcessing::$38 ] Attempting to uplift remaining variables inzp[1]:178 [ startProcessing::$39 ] -Uplifting [startProcessing] best 1213975 combination reg byte a [ startProcessing::$39 ] +Uplifting [startProcessing] best 1211475 combination reg byte a [ startProcessing::$39 ] Attempting to uplift remaining variables inzp[1]:11 [ init_angle_screen::y#5 init_angle_screen::y#1 ] -Uplifting [init_angle_screen] best 1213975 combination zp[1]:11 [ init_angle_screen::y#5 init_angle_screen::y#1 ] +Uplifting [init_angle_screen] best 1211475 combination zp[1]:11 [ init_angle_screen::y#5 init_angle_screen::y#1 ] Attempting to uplift remaining variables inzp[1]:179 [ startProcessing::$22 ] -Uplifting [startProcessing] best 1213947 combination reg byte x [ startProcessing::$22 ] +Uplifting [startProcessing] best 1211447 combination reg byte x [ startProcessing::$22 ] Attempting to uplift remaining variables inzp[1]:152 [ startProcessing::ch#0 ] -Uplifting [startProcessing] best 1213941 combination reg byte a [ startProcessing::ch#0 ] +Uplifting [startProcessing] best 1211441 combination reg byte a [ startProcessing::ch#0 ] Attempting to uplift remaining variables inzp[1]:10 [ processChars::numActive#10 processChars::numActive#3 processChars::numActive#1 ] -Uplifting [processChars] best 1213941 combination zp[1]:10 [ processChars::numActive#10 processChars::numActive#3 processChars::numActive#1 ] +Uplifting [processChars] best 1211441 combination zp[1]:10 [ processChars::numActive#10 processChars::numActive#3 processChars::numActive#1 ] Attempting to uplift remaining variables inzp[1]:8 [ main::i#2 main::i#1 ] -Uplifting [main] best 1213941 combination zp[1]:8 [ main::i#2 main::i#1 ] +Uplifting [main] best 1211441 combination zp[1]:8 [ main::i#2 main::i#1 ] Attempting to uplift remaining variables inzp[1]:64 [ main::$10 ] -Uplifting [main] best 1213901 combination reg byte a [ main::$10 ] +Uplifting [main] best 1211401 combination reg byte a [ main::$10 ] Attempting to uplift remaining variables inzp[1]:70 [ main::center_dist#0 ] -Uplifting [main] best 1213841 combination reg byte a [ main::center_dist#0 ] +Uplifting [main] best 1211341 combination reg byte a [ main::center_dist#0 ] Attempting to uplift remaining variables inzp[1]:83 [ processChars::$9 ] -Uplifting [processChars] best 1213781 combination reg byte a [ processChars::$9 ] +Uplifting [processChars] best 1211281 combination reg byte a [ processChars::$9 ] Attempting to uplift remaining variables inzp[1]:84 [ processChars::$10 ] -Uplifting [processChars] best 1213721 combination reg byte a [ processChars::$10 ] +Uplifting [processChars] best 1211221 combination reg byte a [ processChars::$10 ] Attempting to uplift remaining variables inzp[1]:90 [ processChars::$73 ] -Uplifting [processChars] best 1213681 combination reg byte a [ processChars::$73 ] +Uplifting [processChars] best 1211181 combination reg byte a [ processChars::$73 ] Attempting to uplift remaining variables inzp[1]:91 [ processChars::xchar#0 ] -Uplifting [processChars] best 1213621 combination reg byte a [ processChars::xchar#0 ] +Uplifting [processChars] best 1211121 combination reg byte a [ processChars::xchar#0 ] Attempting to uplift remaining variables inzp[1]:92 [ processChars::$29 ] -Uplifting [processChars] best 1213581 combination reg byte a [ processChars::$29 ] +Uplifting [processChars] best 1211081 combination reg byte a [ processChars::$29 ] Attempting to uplift remaining variables inzp[1]:93 [ processChars::$79 ] -Uplifting [processChars] best 1213541 combination reg byte a [ processChars::$79 ] +Uplifting [processChars] best 1211041 combination reg byte a [ processChars::$79 ] Attempting to uplift remaining variables inzp[1]:94 [ processChars::ychar#0 ] -Uplifting [processChars] best 1213481 combination reg byte a [ processChars::ychar#0 ] +Uplifting [processChars] best 1210981 combination reg byte a [ processChars::ychar#0 ] Attempting to uplift remaining variables inzp[1]:95 [ processChars::$30 ] -Uplifting [processChars] best 1213441 combination reg byte a [ processChars::$30 ] +Uplifting [processChars] best 1210941 combination reg byte a [ processChars::$30 ] Attempting to uplift remaining variables inzp[1]:96 [ processChars::$25 ] -Uplifting [processChars] best 1213381 combination reg byte a [ processChars::$25 ] +Uplifting [processChars] best 1210881 combination reg byte a [ processChars::$25 ] Attempting to uplift remaining variables inzp[1]:173 [ startProcessing::spritePtr#0 ] -Uplifting [startProcessing] best 1213381 combination zp[1]:173 [ startProcessing::spritePtr#0 ] +Uplifting [startProcessing] best 1210881 combination zp[1]:173 [ startProcessing::spritePtr#0 ] Attempting to uplift remaining variables inzp[1]:9 [ processChars::i#10 processChars::i#1 ] -Uplifting [processChars] best 1213381 combination zp[1]:9 [ processChars::i#10 processChars::i#1 ] +Uplifting [processChars] best 1210881 combination zp[1]:9 [ processChars::i#10 processChars::i#1 ] Attempting to uplift remaining variables inzp[1]:174 [ startProcessing::$15 ] -Uplifting [startProcessing] best 1213379 combination reg byte y [ startProcessing::$15 ] +Uplifting [startProcessing] best 1210879 combination reg byte y [ startProcessing::$15 ] Attempting to uplift remaining variables inzp[1]:65 [ getCharToProcess::return_x#0 ] -Uplifting [getCharToProcess] best 1213319 combination reg byte y [ getCharToProcess::return_x#0 ] +Uplifting [getCharToProcess] best 1210819 combination reg byte y [ getCharToProcess::return_x#0 ] Attempting to uplift remaining variables inzp[1]:66 [ getCharToProcess::return_y#0 ] -Uplifting [getCharToProcess] best 1213259 combination reg byte a [ getCharToProcess::return_y#0 ] +Uplifting [getCharToProcess] best 1210759 combination reg byte a [ getCharToProcess::return_y#0 ] Attempting to uplift remaining variables inzp[1]:67 [ getCharToProcess::return_dist#0 ] -Uplifting [getCharToProcess] best 1213219 combination reg byte x [ getCharToProcess::return_dist#0 ] +Uplifting [getCharToProcess] best 1210719 combination reg byte x [ getCharToProcess::return_dist#0 ] Attempting to uplift remaining variables inzp[1]:68 [ main::center_x#0 ] -Uplifting [main] best 1213159 combination reg byte y [ main::center_x#0 ] +Uplifting [main] best 1210659 combination reg byte y [ main::center_x#0 ] Attempting to uplift remaining variables inzp[1]:69 [ main::center_y#0 ] -Uplifting [main] best 1213159 combination zp[1]:69 [ main::center_y#0 ] +Uplifting [main] best 1210659 combination zp[1]:69 [ main::center_y#0 ] Attempting to uplift remaining variables inzp[1]:145 [ startProcessing::spriteCol#0 ] -Uplifting [startProcessing] best 1213159 combination zp[1]:145 [ startProcessing::spriteCol#0 ] +Uplifting [startProcessing] best 1210659 combination zp[1]:145 [ startProcessing::spriteCol#0 ] Attempting to uplift remaining variables inzp[1]:71 [ startProcessing::center_x#0 ] -Uplifting [startProcessing] best 1213159 combination zp[1]:71 [ startProcessing::center_x#0 ] +Uplifting [startProcessing] best 1210659 combination zp[1]:71 [ startProcessing::center_x#0 ] Attempting to uplift remaining variables inzp[1]:87 [ processChars::ypos#0 ] -Uplifting [processChars] best 1213159 combination zp[1]:87 [ processChars::ypos#0 ] +Uplifting [processChars] best 1210659 combination zp[1]:87 [ processChars::ypos#0 ] Attempting to uplift remaining variables inzp[1]:80 [ processChars::bitmask#0 ] -Uplifting [processChars] best 1213159 combination zp[1]:80 [ processChars::bitmask#0 ] +Uplifting [processChars] best 1210659 combination zp[1]:80 [ processChars::bitmask#0 ] Attempting to uplift remaining variables inzp[1]:73 [ processChars::$13 ] -Uplifting [processChars] best 1213159 combination zp[1]:73 [ processChars::$13 ] +Uplifting [processChars] best 1210659 combination zp[1]:73 [ processChars::$13 ] Attempting to uplift remaining variables inzp[1]:72 [ startProcessing::center_y#0 ] -Uplifting [startProcessing] best 1213159 combination zp[1]:72 [ startProcessing::center_y#0 ] +Uplifting [startProcessing] best 1210659 combination zp[1]:72 [ startProcessing::center_y#0 ] Coalescing zero page register [ zp[2]:14 [ init_angle_screen::screen_bottomline#6 init_angle_screen::screen_bottomline#0 init_angle_screen::screen_bottomline#1 ] ] with [ zp[2]:58 [ init_angle_screen::screen#0 ] ] - score: 1 Coalescing zero page register [ zp[2]:33 [ startProcessing::chargenData#2 startProcessing::chargenData#0 startProcessing::chargenData#1 ] ] with [ zp[2]:155 [ startProcessing::$6 ] ] - score: 1 Coalescing zero page register [ zp[2]:35 [ startProcessing::spriteData#2 startProcessing::spriteData#0 startProcessing::spriteData#1 ] ] with [ zp[2]:150 [ startProcessing::$4 ] ] - score: 1 @@ -6787,8 +6787,7 @@ atan2_16: { __b10: // [263] if(atan2_16::yi#3!=0) goto atan2_16::@11 -- vwsz1_neq_0_then_la1 lda.z yi+1 - bne __b11 - lda.z yi + ora.z yi bne __b11 // [264] phi from atan2_16::@10 atan2_16::@19 to atan2_16::@12 [phi:atan2_16::@10/atan2_16::@19->atan2_16::@12] __b12_from___b10: @@ -7298,7 +7297,7 @@ Removing instruction ldy #OFFSET_STRUCT_PROCESSINGSPRITE_STATUS Succesful ASM optimization Pass5UnnecesaryLoadElimination Fixing long branch [499] bne __b1 to beq Fixing long branch [1073] bne __b2 to beq -Fixing long branch [1201] beq __b12 to bne +Fixing long branch [1200] beq __b12 to bne Fixing long branch [304] beq __b2 to bne Fixing long branch [364] bne __b4 to beq Fixing long branch [397] bcc __b6 to bcs @@ -7757,7 +7756,7 @@ reg byte a [ atan2_16::$22 ] FINAL ASSEMBLER -Score: 1113358 +Score: 1110858 // File Comments // Clears start screen throwing around the letters (by turning them into sprites) @@ -9501,8 +9500,7 @@ atan2_16: { // if(yi==0) // [263] if(atan2_16::yi#3!=0) goto atan2_16::@11 -- vwsz1_neq_0_then_la1 lda.z yi+1 - bne __b11 - lda.z yi + ora.z yi bne __b11 // [264] phi from atan2_16::@10 atan2_16::@19 to atan2_16::@12 [phi:atan2_16::@10/atan2_16::@19->atan2_16::@12] // [264] phi atan2_16::angle#6 = atan2_16::angle#12 [phi:atan2_16::@10/atan2_16::@19->atan2_16::@12#0] -- register_copy diff --git a/src/test/ref/complex/splines/truetype-splines.asm b/src/test/ref/complex/splines/truetype-splines.asm index 8ef546b84..e8c759f92 100644 --- a/src/test/ref/complex/splines/truetype-splines.asm +++ b/src/test/ref/complex/splines/truetype-splines.asm @@ -689,16 +689,13 @@ bitmap_line: { // dy = abs_u16(y2-y1) // if(dx==0 && dy==0) lda.z dx - bne __b1 - lda.z dx+1 + ora.z dx+1 bne __b1 lda.z dy - bne !+ - lda.z dy+1 + ora.z dy+1 bne !__b4+ jmp __b4 !__b4: - !: __b1: // sgn_u16(x2-x1) lda.z x2 diff --git a/src/test/ref/complex/splines/truetype-splines.log b/src/test/ref/complex/splines/truetype-splines.log index 8ee4231a0..758a62a79 100644 --- a/src/test/ref/complex/splines/truetype-splines.log +++ b/src/test/ref/complex/splines/truetype-splines.log @@ -5539,56 +5539,56 @@ Uplift Scope [Segment] Uplift Scope [Segment::SegmentType] Uplift Scope [] -Uplifting [bitmap_plot] best 828650 combination reg byte a [ bitmap_plot::y#4 bitmap_plot::y#2 bitmap_plot::y#0 bitmap_plot::y#1 bitmap_plot::y#3 ] zp[2]:298 [ bitmap_plot::$0 ] reg byte x [ bitmap_plot::$1 ] zp[2]:300 [ bitmap_plot::plotter#1 ] zp[2]:81 [ bitmap_plot::x#4 bitmap_plot::x#2 bitmap_plot::x#0 bitmap_plot::x#1 bitmap_plot::x#3 ] zp[2]:296 [ bitmap_plot::plotter#0 ] -Uplifting [bitmap_line] best 828650 combination zp[2]:46 [ bitmap_line::x#7 bitmap_line::x#6 bitmap_line::x#15 bitmap_line::x#13 bitmap_line::x#0 bitmap_line::x1#1 bitmap_line::x1#0 bitmap_line::x#12 bitmap_line::x#1 ] zp[2]:48 [ bitmap_line::y#15 bitmap_line::y#7 bitmap_line::y#13 bitmap_line::y#4 bitmap_line::y#0 bitmap_line::y1#1 bitmap_line::y1#0 bitmap_line::y#1 bitmap_line::y#2 ] zp[2]:44 [ bitmap_line::e#3 bitmap_line::e#0 bitmap_line::e#6 bitmap_line::e#1 bitmap_line::e#2 ] zp[2]:50 [ bitmap_line::e1#3 bitmap_line::e1#6 bitmap_line::e1#0 bitmap_line::e1#2 bitmap_line::e1#1 ] zp[2]:216 [ bitmap_line::dy#0 ] zp[2]:224 [ bitmap_line::sy#0 ] zp[2]:212 [ bitmap_line::dx#0 ] zp[2]:220 [ bitmap_line::sx#0 ] zp[2]:42 [ bitmap_line::y2#11 bitmap_line::y2#13 bitmap_line::y2#0 ] zp[2]:40 [ bitmap_line::x2#10 bitmap_line::x2#13 bitmap_line::x2#0 ] -Uplifting [abs_u16] best 828638 combination zp[2]:74 [ abs_u16::return#4 abs_u16::return#2 abs_u16::w#2 abs_u16::w#0 abs_u16::w#1 ] reg byte a [ abs_u16::$0 ] reg byte a [ abs_u16::$1 ] zp[2]:210 [ abs_u16::return#0 ] zp[2]:214 [ abs_u16::return#1 ] -Uplifting [sgn_u16] best 828626 combination reg byte a [ sgn_u16::$0 ] reg byte a [ sgn_u16::$1 ] zp[2]:76 [ sgn_u16::w#2 sgn_u16::w#0 sgn_u16::w#1 ] zp[2]:218 [ sgn_u16::return#0 ] zp[2]:222 [ sgn_u16::return#1 ] zp[2]:78 [ sgn_u16::return#4 ] -Uplifting [spline_8segB] best 811626 combination zp[2]:254 [ spline_8segB::$22 ] zp[2]:258 [ spline_8segB::$24 ] reg byte y [ spline_8segB::n#2 spline_8segB::n#1 ] reg byte x [ spline_8segB::$31 ] zp[2]:59 [ spline_8segB::i_y#2 spline_8segB::i_y#0 spline_8segB::i_y#1 ] zp[2]:57 [ spline_8segB::i_x#2 spline_8segB::i_x#0 spline_8segB::i_x#1 ] zp[2]:52 [ spline_8segB::p_x#2 spline_8segB::p_x#0 spline_8segB::p_x#1 ] zp[2]:260 [ spline_8segB::$25 ] zp[2]:54 [ spline_8segB::p_y#2 spline_8segB::p_y#0 spline_8segB::p_y#1 ] zp[2]:256 [ spline_8segB::$23 ] zp[2]:252 [ spline_8segB::j_y#0 ] zp[2]:250 [ spline_8segB::j_x#0 ] zp[2]:226 [ spline_8segB::$0 ] zp[2]:228 [ spline_8segB::$1 ] zp[2]:232 [ spline_8segB::$3 ] zp[2]:234 [ spline_8segB::$4 ] zp[2]:238 [ spline_8segB::$6 ] zp[2]:242 [ spline_8segB::$8 ] zp[2]:246 [ spline_8segB::$10 ] zp[2]:248 [ spline_8segB::$12 ] zp[2]:263 [ spline_8segB::$18 ] zp[2]:267 [ spline_8segB::$20 ] zp[2]:269 [ spline_8segB::$21 ] zp[2]:240 [ spline_8segB::b_x#0 ] zp[2]:244 [ spline_8segB::b_y#0 ] zp[2]:265 [ spline_8segB::$19 ] zp[2]:142 [ spline_8segB::p2_x#0 ] zp[2]:236 [ spline_8segB::a_y#0 ] zp[2]:230 [ spline_8segB::a_x#0 ] zp[2]:144 [ spline_8segB::p2_y#0 ] zp[2]:138 [ spline_8segB::p1_x#0 ] zp[2]:140 [ spline_8segB::p1_y#0 ] zp[2]:134 [ spline_8segB::p0_x#0 ] zp[2]:136 [ spline_8segB::p0_y#0 ] -Uplifting [bitmap_plot_spline_8seg] best 811626 combination zp[1]:61 [ bitmap_plot_spline_8seg::n#2 bitmap_plot_spline_8seg::n#1 ] zp[2]:64 [ bitmap_plot_spline_8seg::current_y#2 bitmap_plot_spline_8seg::current_y#0 bitmap_plot_spline_8seg::current_y#1 ] zp[2]:62 [ bitmap_plot_spline_8seg::current_x#2 bitmap_plot_spline_8seg::current_x#0 bitmap_plot_spline_8seg::current_x#1 ] zp[1]:271 [ bitmap_plot_spline_8seg::$4 ] -Uplifting [mulf16s] best 811626 combination zp[4]:70 [ mulf16s::m#4 mulf16s::m#5 mulf16s::m#1 mulf16s::m#0 mulf16s::m#2 ] zp[2]:280 [ mulf16s::$6 ] zp[2]:282 [ mulf16s::$11 ] zp[2]:284 [ mulf16s::$9 ] zp[2]:286 [ mulf16s::$12 ] zp[2]:68 [ mulf16s::b#4 mulf16s::b#0 mulf16s::b#1 mulf16s::b#2 mulf16s::b#3 ] zp[2]:66 [ mulf16s::a#4 mulf16s::a#0 mulf16s::a#1 mulf16s::a#2 mulf16s::a#3 ] zp[4]:288 [ mulf16s::return#0 ] zp[4]:150 [ mulf16s::return#2 ] zp[4]:162 [ mulf16s::return#3 ] zp[4]:176 [ mulf16s::return#4 ] zp[4]:190 [ mulf16s::return#10 ] -Uplifting [mulf16u] best 811626 combination zp[2]:272 [ mulf16u::a#0 ] zp[2]:274 [ mulf16u::b#0 ] zp[4]:303 [ mulf16u::return#0 ] zp[4]:276 [ mulf16u::return#2 ] -Uplifting [rotate] best 811010 combination zp[2]:158 [ rotate::$10 ] zp[2]:170 [ rotate::$11 ] zp[2]:184 [ rotate::$12 ] zp[2]:186 [ rotate::$5 ] zp[2]:198 [ rotate::$13 ] zp[2]:200 [ rotate::$7 ] zp[4]:154 [ rotate::$0 ] zp[4]:166 [ rotate::$2 ] zp[4]:180 [ rotate::$4 ] zp[4]:194 [ rotate::$6 ] zp[2]:202 [ rotate::yr#1 ] reg byte a [ rotate::$8 ] reg byte x [ rotate::$9 ] reg byte y [ rotate::angle#2 rotate::angle#0 rotate::angle#1 ] zp[2]:148 [ rotate::cos_a#0 ] zp[2]:174 [ rotate::sin_a#0 ] zp[2]:38 [ rotate::vector_y#2 rotate::vector_y#0 rotate::vector_y#1 ] zp[2]:206 [ rotate::return_x#2 ] zp[2]:188 [ rotate::xr#1 ] zp[2]:36 [ rotate::vector_x#2 rotate::vector_x#0 rotate::vector_x#1 ] zp[2]:208 [ rotate::return_y#2 ] zp[2]:160 [ rotate::xr#0 ] zp[2]:172 [ rotate::yr#0 ] zp[2]:101 [ rotate::return_x#0 ] zp[2]:103 [ rotate::return_y#0 ] zp[2]:121 [ rotate::return_x#1 ] zp[2]:123 [ rotate::return_y#1 ] -Uplifting [memset] best 810904 combination zp[2]:33 [ memset::dst#2 memset::dst#4 memset::dst#1 ] zp[2]:146 [ memset::end#0 ] reg byte x [ memset::c#4 ] zp[2]:28 [ memset::num#2 ] zp[2]:30 [ memset::str#3 ] -Uplifting [show_letter] best 809404 combination zp[2]:26 [ show_letter::current_y#4 show_letter::current_y#11 ] reg byte a [ show_letter::$21 ] reg byte a [ show_letter::segment_type#0 ] zp[2]:24 [ show_letter::current_x#4 show_letter::current_x#11 ] zp[2]:93 [ show_letter::to_x#0 ] zp[2]:95 [ show_letter::to_y#0 ] zp[2]:97 [ show_letter::to_x#1 ] zp[2]:99 [ show_letter::to_y#1 ] zp[2]:105 [ show_letter::to_x#2 ] zp[2]:107 [ show_letter::to_y#2 ] zp[2]:113 [ show_letter::via_x#0 ] zp[2]:115 [ show_letter::via_y#0 ] zp[2]:117 [ show_letter::via_x#1 ] zp[2]:119 [ show_letter::via_y#1 ] zp[2]:125 [ show_letter::via_x#2 ] zp[2]:127 [ show_letter::via_y#2 ] zp[1]:23 [ show_letter::i#10 show_letter::i#1 ] zp[2]:129 [ show_letter::segment_via_x#0 ] zp[2]:131 [ show_letter::segment_via_y#0 ] zp[1]:92 [ show_letter::$17 ] zp[2]:109 [ show_letter::current_x#10 ] zp[2]:111 [ show_letter::current_y#10 ] zp[1]:83 [ show_letter::angle#0 ] -Uplifting [mulf_init] best 809154 combination zp[2]:16 [ mulf_init::sqr#3 mulf_init::sqr#4 mulf_init::sqr#1 mulf_init::sqr#2 ] zp[2]:10 [ mulf_init::sqr2_lo#2 mulf_init::sqr2_lo#1 ] zp[2]:4 [ 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]:12 [ mulf_init::x_255#2 mulf_init::x_255#1 ] zp[1]:15 [ mulf_init::dir#2 mulf_init::dir#4 ] zp[1]:6 [ mulf_init::c#2 mulf_init::c#1 ] zp[2]:13 [ mulf_init::sqr2_hi#2 mulf_init::sqr2_hi#1 ] zp[2]:7 [ mulf_init::sqr1_hi#2 mulf_init::sqr1_hi#1 ] +Uplifting [bitmap_plot] best 828644 combination reg byte a [ bitmap_plot::y#4 bitmap_plot::y#2 bitmap_plot::y#0 bitmap_plot::y#1 bitmap_plot::y#3 ] zp[2]:298 [ bitmap_plot::$0 ] reg byte x [ bitmap_plot::$1 ] zp[2]:300 [ bitmap_plot::plotter#1 ] zp[2]:81 [ bitmap_plot::x#4 bitmap_plot::x#2 bitmap_plot::x#0 bitmap_plot::x#1 bitmap_plot::x#3 ] zp[2]:296 [ bitmap_plot::plotter#0 ] +Uplifting [bitmap_line] best 828644 combination zp[2]:46 [ bitmap_line::x#7 bitmap_line::x#6 bitmap_line::x#15 bitmap_line::x#13 bitmap_line::x#0 bitmap_line::x1#1 bitmap_line::x1#0 bitmap_line::x#12 bitmap_line::x#1 ] zp[2]:48 [ bitmap_line::y#15 bitmap_line::y#7 bitmap_line::y#13 bitmap_line::y#4 bitmap_line::y#0 bitmap_line::y1#1 bitmap_line::y1#0 bitmap_line::y#1 bitmap_line::y#2 ] zp[2]:44 [ bitmap_line::e#3 bitmap_line::e#0 bitmap_line::e#6 bitmap_line::e#1 bitmap_line::e#2 ] zp[2]:50 [ bitmap_line::e1#3 bitmap_line::e1#6 bitmap_line::e1#0 bitmap_line::e1#2 bitmap_line::e1#1 ] zp[2]:216 [ bitmap_line::dy#0 ] zp[2]:224 [ bitmap_line::sy#0 ] zp[2]:212 [ bitmap_line::dx#0 ] zp[2]:220 [ bitmap_line::sx#0 ] zp[2]:42 [ bitmap_line::y2#11 bitmap_line::y2#13 bitmap_line::y2#0 ] zp[2]:40 [ bitmap_line::x2#10 bitmap_line::x2#13 bitmap_line::x2#0 ] +Uplifting [abs_u16] best 828632 combination zp[2]:74 [ abs_u16::return#4 abs_u16::return#2 abs_u16::w#2 abs_u16::w#0 abs_u16::w#1 ] reg byte a [ abs_u16::$0 ] reg byte a [ abs_u16::$1 ] zp[2]:210 [ abs_u16::return#0 ] zp[2]:214 [ abs_u16::return#1 ] +Uplifting [sgn_u16] best 828620 combination reg byte a [ sgn_u16::$0 ] reg byte a [ sgn_u16::$1 ] zp[2]:76 [ sgn_u16::w#2 sgn_u16::w#0 sgn_u16::w#1 ] zp[2]:218 [ sgn_u16::return#0 ] zp[2]:222 [ sgn_u16::return#1 ] zp[2]:78 [ sgn_u16::return#4 ] +Uplifting [spline_8segB] best 811620 combination zp[2]:254 [ spline_8segB::$22 ] zp[2]:258 [ spline_8segB::$24 ] reg byte y [ spline_8segB::n#2 spline_8segB::n#1 ] reg byte x [ spline_8segB::$31 ] zp[2]:59 [ spline_8segB::i_y#2 spline_8segB::i_y#0 spline_8segB::i_y#1 ] zp[2]:57 [ spline_8segB::i_x#2 spline_8segB::i_x#0 spline_8segB::i_x#1 ] zp[2]:52 [ spline_8segB::p_x#2 spline_8segB::p_x#0 spline_8segB::p_x#1 ] zp[2]:260 [ spline_8segB::$25 ] zp[2]:54 [ spline_8segB::p_y#2 spline_8segB::p_y#0 spline_8segB::p_y#1 ] zp[2]:256 [ spline_8segB::$23 ] zp[2]:252 [ spline_8segB::j_y#0 ] zp[2]:250 [ spline_8segB::j_x#0 ] zp[2]:226 [ spline_8segB::$0 ] zp[2]:228 [ spline_8segB::$1 ] zp[2]:232 [ spline_8segB::$3 ] zp[2]:234 [ spline_8segB::$4 ] zp[2]:238 [ spline_8segB::$6 ] zp[2]:242 [ spline_8segB::$8 ] zp[2]:246 [ spline_8segB::$10 ] zp[2]:248 [ spline_8segB::$12 ] zp[2]:263 [ spline_8segB::$18 ] zp[2]:267 [ spline_8segB::$20 ] zp[2]:269 [ spline_8segB::$21 ] zp[2]:240 [ spline_8segB::b_x#0 ] zp[2]:244 [ spline_8segB::b_y#0 ] zp[2]:265 [ spline_8segB::$19 ] zp[2]:142 [ spline_8segB::p2_x#0 ] zp[2]:236 [ spline_8segB::a_y#0 ] zp[2]:230 [ spline_8segB::a_x#0 ] zp[2]:144 [ spline_8segB::p2_y#0 ] zp[2]:138 [ spline_8segB::p1_x#0 ] zp[2]:140 [ spline_8segB::p1_y#0 ] zp[2]:134 [ spline_8segB::p0_x#0 ] zp[2]:136 [ spline_8segB::p0_y#0 ] +Uplifting [bitmap_plot_spline_8seg] best 811620 combination zp[1]:61 [ bitmap_plot_spline_8seg::n#2 bitmap_plot_spline_8seg::n#1 ] zp[2]:64 [ bitmap_plot_spline_8seg::current_y#2 bitmap_plot_spline_8seg::current_y#0 bitmap_plot_spline_8seg::current_y#1 ] zp[2]:62 [ bitmap_plot_spline_8seg::current_x#2 bitmap_plot_spline_8seg::current_x#0 bitmap_plot_spline_8seg::current_x#1 ] zp[1]:271 [ bitmap_plot_spline_8seg::$4 ] +Uplifting [mulf16s] best 811620 combination zp[4]:70 [ mulf16s::m#4 mulf16s::m#5 mulf16s::m#1 mulf16s::m#0 mulf16s::m#2 ] zp[2]:280 [ mulf16s::$6 ] zp[2]:282 [ mulf16s::$11 ] zp[2]:284 [ mulf16s::$9 ] zp[2]:286 [ mulf16s::$12 ] zp[2]:68 [ mulf16s::b#4 mulf16s::b#0 mulf16s::b#1 mulf16s::b#2 mulf16s::b#3 ] zp[2]:66 [ mulf16s::a#4 mulf16s::a#0 mulf16s::a#1 mulf16s::a#2 mulf16s::a#3 ] zp[4]:288 [ mulf16s::return#0 ] zp[4]:150 [ mulf16s::return#2 ] zp[4]:162 [ mulf16s::return#3 ] zp[4]:176 [ mulf16s::return#4 ] zp[4]:190 [ mulf16s::return#10 ] +Uplifting [mulf16u] best 811620 combination zp[2]:272 [ mulf16u::a#0 ] zp[2]:274 [ mulf16u::b#0 ] zp[4]:303 [ mulf16u::return#0 ] zp[4]:276 [ mulf16u::return#2 ] +Uplifting [rotate] best 811004 combination zp[2]:158 [ rotate::$10 ] zp[2]:170 [ rotate::$11 ] zp[2]:184 [ rotate::$12 ] zp[2]:186 [ rotate::$5 ] zp[2]:198 [ rotate::$13 ] zp[2]:200 [ rotate::$7 ] zp[4]:154 [ rotate::$0 ] zp[4]:166 [ rotate::$2 ] zp[4]:180 [ rotate::$4 ] zp[4]:194 [ rotate::$6 ] zp[2]:202 [ rotate::yr#1 ] reg byte a [ rotate::$8 ] reg byte x [ rotate::$9 ] reg byte y [ rotate::angle#2 rotate::angle#0 rotate::angle#1 ] zp[2]:148 [ rotate::cos_a#0 ] zp[2]:174 [ rotate::sin_a#0 ] zp[2]:38 [ rotate::vector_y#2 rotate::vector_y#0 rotate::vector_y#1 ] zp[2]:206 [ rotate::return_x#2 ] zp[2]:188 [ rotate::xr#1 ] zp[2]:36 [ rotate::vector_x#2 rotate::vector_x#0 rotate::vector_x#1 ] zp[2]:208 [ rotate::return_y#2 ] zp[2]:160 [ rotate::xr#0 ] zp[2]:172 [ rotate::yr#0 ] zp[2]:101 [ rotate::return_x#0 ] zp[2]:103 [ rotate::return_y#0 ] zp[2]:121 [ rotate::return_x#1 ] zp[2]:123 [ rotate::return_y#1 ] +Uplifting [memset] best 810898 combination zp[2]:33 [ memset::dst#2 memset::dst#4 memset::dst#1 ] zp[2]:146 [ memset::end#0 ] reg byte x [ memset::c#4 ] zp[2]:28 [ memset::num#2 ] zp[2]:30 [ memset::str#3 ] +Uplifting [show_letter] best 809398 combination zp[2]:26 [ show_letter::current_y#4 show_letter::current_y#11 ] reg byte a [ show_letter::$21 ] reg byte a [ show_letter::segment_type#0 ] zp[2]:24 [ show_letter::current_x#4 show_letter::current_x#11 ] zp[2]:93 [ show_letter::to_x#0 ] zp[2]:95 [ show_letter::to_y#0 ] zp[2]:97 [ show_letter::to_x#1 ] zp[2]:99 [ show_letter::to_y#1 ] zp[2]:105 [ show_letter::to_x#2 ] zp[2]:107 [ show_letter::to_y#2 ] zp[2]:113 [ show_letter::via_x#0 ] zp[2]:115 [ show_letter::via_y#0 ] zp[2]:117 [ show_letter::via_x#1 ] zp[2]:119 [ show_letter::via_y#1 ] zp[2]:125 [ show_letter::via_x#2 ] zp[2]:127 [ show_letter::via_y#2 ] zp[1]:23 [ show_letter::i#10 show_letter::i#1 ] zp[2]:129 [ show_letter::segment_via_x#0 ] zp[2]:131 [ show_letter::segment_via_y#0 ] zp[1]:92 [ show_letter::$17 ] zp[2]:109 [ show_letter::current_x#10 ] zp[2]:111 [ show_letter::current_y#10 ] zp[1]:83 [ show_letter::angle#0 ] +Uplifting [mulf_init] best 809148 combination zp[2]:16 [ mulf_init::sqr#3 mulf_init::sqr#4 mulf_init::sqr#1 mulf_init::sqr#2 ] zp[2]:10 [ mulf_init::sqr2_lo#2 mulf_init::sqr2_lo#1 ] zp[2]:4 [ 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]:12 [ mulf_init::x_255#2 mulf_init::x_255#1 ] zp[1]:15 [ mulf_init::dir#2 mulf_init::dir#4 ] zp[1]:6 [ mulf_init::c#2 mulf_init::c#1 ] zp[2]:13 [ mulf_init::sqr2_hi#2 mulf_init::sqr2_hi#1 ] zp[2]:7 [ mulf_init::sqr1_hi#2 mulf_init::sqr1_hi#1 ] Limited combination testing to 100 combinations of 1024 possible. -Uplifting [bitmap_init] best 808644 combination zp[2]:21 [ bitmap_init::yoffs#2 bitmap_init::yoffs#4 bitmap_init::yoffs#1 ] reg byte a [ bitmap_init::bits#3 bitmap_init::bits#4 bitmap_init::bits#1 ] reg byte x [ bitmap_init::x#2 bitmap_init::x#1 ] reg byte x [ bitmap_init::y#2 bitmap_init::y#1 ] reg byte a [ bitmap_init::$4 ] zp[1]:89 [ bitmap_init::$5 ] zp[1]:90 [ bitmap_init::$6 ] zp[1]:87 [ bitmap_init::$7 ] +Uplifting [bitmap_init] best 808638 combination zp[2]:21 [ bitmap_init::yoffs#2 bitmap_init::yoffs#4 bitmap_init::yoffs#1 ] reg byte a [ bitmap_init::bits#3 bitmap_init::bits#4 bitmap_init::bits#1 ] reg byte x [ bitmap_init::x#2 bitmap_init::x#1 ] reg byte x [ bitmap_init::y#2 bitmap_init::y#1 ] reg byte a [ bitmap_init::$4 ] zp[1]:89 [ bitmap_init::$5 ] zp[1]:90 [ bitmap_init::$6 ] zp[1]:87 [ bitmap_init::$7 ] Limited combination testing to 100 combinations of 15360 possible. -Uplifting [main] best 805044 combination reg byte x [ main::w#4 main::w#1 ] zp[1]:2 [ main::angle#2 main::angle#1 ] -Uplifting [SplineVector16] best 805044 combination -Uplifting [SplineVector32] best 805044 combination -Uplifting [bitmap_clear] best 805044 combination -Uplifting [MOS6526_CIA] best 805044 combination -Uplifting [MOS6569_VICII] best 805044 combination -Uplifting [MOS6581_SID] best 805044 combination -Uplifting [RADIX] best 805044 combination -Uplifting [Segment] best 805044 combination -Uplifting [Segment::SegmentType] best 805044 combination -Uplifting [] best 805044 combination +Uplifting [main] best 805038 combination reg byte x [ main::w#4 main::w#1 ] zp[1]:2 [ main::angle#2 main::angle#1 ] +Uplifting [SplineVector16] best 805038 combination +Uplifting [SplineVector32] best 805038 combination +Uplifting [bitmap_clear] best 805038 combination +Uplifting [MOS6526_CIA] best 805038 combination +Uplifting [MOS6569_VICII] best 805038 combination +Uplifting [MOS6581_SID] best 805038 combination +Uplifting [RADIX] best 805038 combination +Uplifting [Segment] best 805038 combination +Uplifting [Segment::SegmentType] best 805038 combination +Uplifting [] best 805038 combination Attempting to uplift remaining variables inzp[1]:61 [ bitmap_plot_spline_8seg::n#2 bitmap_plot_spline_8seg::n#1 ] -Uplifting [bitmap_plot_spline_8seg] best 805044 combination zp[1]:61 [ bitmap_plot_spline_8seg::n#2 bitmap_plot_spline_8seg::n#1 ] +Uplifting [bitmap_plot_spline_8seg] best 805038 combination zp[1]:61 [ bitmap_plot_spline_8seg::n#2 bitmap_plot_spline_8seg::n#1 ] Attempting to uplift remaining variables inzp[1]:271 [ bitmap_plot_spline_8seg::$4 ] -Uplifting [bitmap_plot_spline_8seg] best 805044 combination zp[1]:271 [ bitmap_plot_spline_8seg::$4 ] +Uplifting [bitmap_plot_spline_8seg] best 805038 combination zp[1]:271 [ bitmap_plot_spline_8seg::$4 ] Attempting to uplift remaining variables inzp[1]:23 [ show_letter::i#10 show_letter::i#1 ] -Uplifting [show_letter] best 805044 combination zp[1]:23 [ show_letter::i#10 show_letter::i#1 ] +Uplifting [show_letter] best 805038 combination zp[1]:23 [ show_letter::i#10 show_letter::i#1 ] Attempting to uplift remaining variables inzp[1]:92 [ show_letter::$17 ] -Uplifting [show_letter] best 805044 combination zp[1]:92 [ show_letter::$17 ] +Uplifting [show_letter] best 805038 combination zp[1]:92 [ show_letter::$17 ] Attempting to uplift remaining variables inzp[1]:83 [ show_letter::angle#0 ] -Uplifting [show_letter] best 805044 combination zp[1]:83 [ show_letter::angle#0 ] +Uplifting [show_letter] best 805038 combination zp[1]:83 [ show_letter::angle#0 ] Attempting to uplift remaining variables inzp[1]:89 [ bitmap_init::$5 ] -Uplifting [bitmap_init] best 804984 combination reg byte a [ bitmap_init::$5 ] +Uplifting [bitmap_init] best 804978 combination reg byte a [ bitmap_init::$5 ] Attempting to uplift remaining variables inzp[1]:90 [ bitmap_init::$6 ] -Uplifting [bitmap_init] best 804924 combination reg byte a [ bitmap_init::$6 ] +Uplifting [bitmap_init] best 804918 combination reg byte a [ bitmap_init::$6 ] Attempting to uplift remaining variables inzp[1]:12 [ mulf_init::x_255#2 mulf_init::x_255#1 ] -Uplifting [mulf_init] best 804784 combination reg byte x [ mulf_init::x_255#2 mulf_init::x_255#1 ] +Uplifting [mulf_init] best 804778 combination reg byte x [ mulf_init::x_255#2 mulf_init::x_255#1 ] Attempting to uplift remaining variables inzp[1]:15 [ mulf_init::dir#2 mulf_init::dir#4 ] -Uplifting [mulf_init] best 804784 combination zp[1]:15 [ mulf_init::dir#2 mulf_init::dir#4 ] +Uplifting [mulf_init] best 804778 combination zp[1]:15 [ mulf_init::dir#2 mulf_init::dir#4 ] Attempting to uplift remaining variables inzp[1]:6 [ mulf_init::c#2 mulf_init::c#1 ] -Uplifting [mulf_init] best 804784 combination zp[1]:6 [ mulf_init::c#2 mulf_init::c#1 ] +Uplifting [mulf_init] best 804778 combination zp[1]:6 [ mulf_init::c#2 mulf_init::c#1 ] Attempting to uplift remaining variables inzp[1]:87 [ bitmap_init::$7 ] -Uplifting [bitmap_init] best 804784 combination zp[1]:87 [ bitmap_init::$7 ] +Uplifting [bitmap_init] best 804778 combination zp[1]:87 [ bitmap_init::$7 ] Attempting to uplift remaining variables inzp[1]:2 [ main::angle#2 main::angle#1 ] -Uplifting [main] best 804784 combination zp[1]:2 [ main::angle#2 main::angle#1 ] +Uplifting [main] best 804778 combination zp[1]:2 [ main::angle#2 main::angle#1 ] Coalescing zero page register [ zp[2]:46 [ bitmap_line::x#7 bitmap_line::x#6 bitmap_line::x#15 bitmap_line::x#13 bitmap_line::x#0 bitmap_line::x1#1 bitmap_line::x1#0 bitmap_line::x#12 bitmap_line::x#1 ] ] with [ zp[2]:81 [ bitmap_plot::x#4 bitmap_plot::x#2 bitmap_plot::x#0 bitmap_plot::x#1 bitmap_plot::x#3 ] ] - score: 4 Coalescing zero page register [ zp[2]:66 [ mulf16s::a#4 mulf16s::a#0 mulf16s::a#1 mulf16s::a#2 mulf16s::a#3 ] ] with [ zp[2]:148 [ rotate::cos_a#0 ] ] - score: 2 Coalescing zero page register [ zp[2]:66 [ mulf16s::a#4 mulf16s::a#0 mulf16s::a#1 mulf16s::a#2 mulf16s::a#3 rotate::cos_a#0 ] ] with [ zp[2]:174 [ rotate::sin_a#0 ] ] - score: 2 @@ -6795,18 +6795,15 @@ bitmap_line: { // [188] bitmap_line::dy#0 = abs_u16::return#1 // [189] if(bitmap_line::dx#0!=0) goto bitmap_line::@1 -- vwuz1_neq_0_then_la1 lda.z dx - bne __b1 - lda.z dx+1 + ora.z dx+1 bne __b1 jmp __b18 // bitmap_line::@18 __b18: // [190] if(bitmap_line::dy#0==0) goto bitmap_line::@4 -- vwuz1_eq_0_then_la1 lda.z dy - bne !+ - lda.z dy+1 + ora.z dy+1 beq __b4 - !: jmp __b1 // bitmap_line::@1 __b1: @@ -8220,8 +8217,8 @@ Removing instruction __b2: Removing instruction __breturn: Removing instruction __breturn: Succesful ASM optimization Pass5UnusedLabelElimination -Fixing long branch [974] bne __b1 to beq -Fixing long branch [589] beq __b4 to bne +Fixing long branch [971] bne __b1 to beq +Fixing long branch [587] beq __b4 to bne FINAL SYMBOL TABLE const nomodify byte* BITMAP_GRAPHICS = (byte*) 24576 @@ -8701,7 +8698,7 @@ reg byte x [ bitmap_plot::$1 ] FINAL ASSEMBLER -Score: 668854 +Score: 668848 // File Comments // Show a few simple splines using the splines library @@ -9736,18 +9733,15 @@ bitmap_line: { // if(dx==0 && dy==0) // [189] if(bitmap_line::dx#0!=0) goto bitmap_line::@1 -- vwuz1_neq_0_then_la1 lda.z dx - bne __b1 - lda.z dx+1 + ora.z dx+1 bne __b1 // bitmap_line::@18 // [190] if(bitmap_line::dy#0==0) goto bitmap_line::@4 -- vwuz1_eq_0_then_la1 lda.z dy - bne !+ - lda.z dy+1 + ora.z dy+1 bne !__b4+ jmp __b4 !__b4: - !: // bitmap_line::@1 __b1: // sgn_u16(x2-x1) diff --git a/src/test/ref/cordic-atan2-16-ref.asm b/src/test/ref/cordic-atan2-16-ref.asm index 49ad0d6ef..989821790 100644 --- a/src/test/ref/cordic-atan2-16-ref.asm +++ b/src/test/ref/cordic-atan2-16-ref.asm @@ -269,8 +269,7 @@ atan2_16: { __b10: // if(yi==0) lda.z yi+1 - bne __b11 - lda.z yi + ora.z yi bne __b11 __b12: // angle /=2 diff --git a/src/test/ref/cordic-atan2-16-ref.log b/src/test/ref/cordic-atan2-16-ref.log index 013abbb32..460749137 100644 --- a/src/test/ref/cordic-atan2-16-ref.log +++ b/src/test/ref/cordic-atan2-16-ref.log @@ -2251,36 +2251,36 @@ Uplift Scope [MOS6569_VICII] Uplift Scope [MOS6581_SID] Uplift Scope [RADIX] -Uplifting [atan2_16] best 1158637 combination reg byte y [ atan2_16::shift#2 atan2_16::shift#5 atan2_16::shift#1 ] zp[2]:30 [ atan2_16::yd#5 atan2_16::yd#3 atan2_16::yd#10 atan2_16::yd#1 atan2_16::yd#2 ] zp[2]:32 [ atan2_16::xd#5 atan2_16::xd#3 atan2_16::xd#10 atan2_16::xd#1 atan2_16::xd#2 ] zp[2]:25 [ atan2_16::angle#6 atan2_16::angle#12 atan2_16::angle#13 atan2_16::angle#2 atan2_16::angle#3 ] zp[2]:20 [ atan2_16::yi#3 atan2_16::yi#8 atan2_16::yi#0 atan2_16::yi#16 atan2_16::$2 atan2_16::yi#1 atan2_16::yi#2 ] zp[2]:22 [ atan2_16::xi#3 atan2_16::xi#8 atan2_16::xi#0 atan2_16::xi#13 atan2_16::$7 atan2_16::xi#1 atan2_16::xi#2 ] reg byte a [ atan2_16::$23 ] reg byte a [ atan2_16::$22 ] reg byte x [ atan2_16::i#2 atan2_16::i#1 ] zp[2]:27 [ atan2_16::return#0 atan2_16::angle#11 atan2_16::angle#1 atan2_16::angle#4 atan2_16::angle#5 ] zp[2]:47 [ atan2_16::return#2 ] zp[2]:43 [ atan2_16::x#0 ] zp[2]:45 [ atan2_16::y#0 ] +Uplifting [atan2_16] best 1156137 combination reg byte y [ atan2_16::shift#2 atan2_16::shift#5 atan2_16::shift#1 ] zp[2]:30 [ atan2_16::yd#5 atan2_16::yd#3 atan2_16::yd#10 atan2_16::yd#1 atan2_16::yd#2 ] zp[2]:32 [ atan2_16::xd#5 atan2_16::xd#3 atan2_16::xd#10 atan2_16::xd#1 atan2_16::xd#2 ] zp[2]:25 [ atan2_16::angle#6 atan2_16::angle#12 atan2_16::angle#13 atan2_16::angle#2 atan2_16::angle#3 ] zp[2]:20 [ atan2_16::yi#3 atan2_16::yi#8 atan2_16::yi#0 atan2_16::yi#16 atan2_16::$2 atan2_16::yi#1 atan2_16::yi#2 ] zp[2]:22 [ atan2_16::xi#3 atan2_16::xi#8 atan2_16::xi#0 atan2_16::xi#13 atan2_16::$7 atan2_16::xi#1 atan2_16::xi#2 ] reg byte a [ atan2_16::$23 ] reg byte a [ atan2_16::$22 ] reg byte x [ atan2_16::i#2 atan2_16::i#1 ] zp[2]:27 [ atan2_16::return#0 atan2_16::angle#11 atan2_16::angle#1 atan2_16::angle#4 atan2_16::angle#5 ] zp[2]:47 [ atan2_16::return#2 ] zp[2]:43 [ atan2_16::x#0 ] zp[2]:45 [ atan2_16::y#0 ] Limited combination testing to 100 combinations of 144 possible. -Uplifting [init_font_hex] best 1139637 combination reg byte x [ init_font_hex::i#2 init_font_hex::i#1 ] reg byte a [ init_font_hex::$1 ] reg byte a [ init_font_hex::$2 ] zp[1]:19 [ init_font_hex::idx#5 init_font_hex::idx#2 ] zp[1]:61 [ init_font_hex::$0 ] zp[1]:64 [ init_font_hex::idx#3 ] zp[1]:17 [ init_font_hex::c1#4 init_font_hex::c1#1 ] zp[2]:13 [ init_font_hex::charset#2 init_font_hex::charset#5 init_font_hex::charset#0 ] zp[2]:15 [ init_font_hex::proto_lo#4 init_font_hex::proto_lo#1 ] zp[2]:10 [ init_font_hex::proto_hi#6 init_font_hex::proto_hi#1 ] zp[1]:12 [ init_font_hex::c#6 init_font_hex::c#1 ] +Uplifting [init_font_hex] best 1137137 combination reg byte x [ init_font_hex::i#2 init_font_hex::i#1 ] reg byte a [ init_font_hex::$1 ] reg byte a [ init_font_hex::$2 ] zp[1]:19 [ init_font_hex::idx#5 init_font_hex::idx#2 ] zp[1]:61 [ init_font_hex::$0 ] zp[1]:64 [ init_font_hex::idx#3 ] zp[1]:17 [ init_font_hex::c1#4 init_font_hex::c1#1 ] zp[2]:13 [ init_font_hex::charset#2 init_font_hex::charset#5 init_font_hex::charset#0 ] zp[2]:15 [ init_font_hex::proto_lo#4 init_font_hex::proto_lo#1 ] zp[2]:10 [ init_font_hex::proto_hi#6 init_font_hex::proto_hi#1 ] zp[1]:12 [ init_font_hex::c#6 init_font_hex::c#1 ] Limited combination testing to 100 combinations of 6912 possible. -Uplifting [diff] best 1138133 combination reg byte a [ diff::return#1 diff::$4 diff::$2 ] reg byte a [ diff::bb2#0 ] reg byte x [ diff::bb1#0 ] reg byte a [ diff::return#0 ] +Uplifting [diff] best 1135633 combination reg byte a [ diff::return#1 diff::$4 diff::$2 ] reg byte a [ diff::bb2#0 ] reg byte x [ diff::bb1#0 ] reg byte a [ diff::return#0 ] Limited combination testing to 100 combinations of 128 possible. -Uplifting [print_char] best 1138124 combination reg byte a [ print_char::ch#2 print_char::ch#0 print_char::ch#1 ] -Uplifting [main] best 1136224 combination zp[2]:49 [ main::angle_w#0 ] zp[2]:51 [ main::$4 ] reg byte a [ main::$6 ] reg byte a [ main::$7 ] zp[1]:3 [ main::x#2 main::x#1 ] zp[2]:4 [ main::screen_ref#2 main::screen_ref#5 main::screen_ref#1 ] zp[2]:8 [ main::screen#2 main::screen#5 main::screen#1 ] zp[2]:6 [ main::diff_sum#2 main::diff_sum#7 main::diff_sum#1 ] zp[2]:39 [ main::xw#0 ] zp[2]:41 [ main::yw#0 ] reg byte x [ main::ang_w#0 ] zp[1]:2 [ main::y#4 main::y#1 ] +Uplifting [print_char] best 1135624 combination reg byte a [ print_char::ch#2 print_char::ch#0 print_char::ch#1 ] +Uplifting [main] best 1133724 combination zp[2]:49 [ main::angle_w#0 ] zp[2]:51 [ main::$4 ] reg byte a [ main::$6 ] reg byte a [ main::$7 ] zp[1]:3 [ main::x#2 main::x#1 ] zp[2]:4 [ main::screen_ref#2 main::screen_ref#5 main::screen_ref#1 ] zp[2]:8 [ main::screen#2 main::screen#5 main::screen#1 ] zp[2]:6 [ main::diff_sum#2 main::diff_sum#7 main::diff_sum#1 ] zp[2]:39 [ main::xw#0 ] zp[2]:41 [ main::yw#0 ] reg byte x [ main::ang_w#0 ] zp[1]:2 [ main::y#4 main::y#1 ] Limited combination testing to 100 combinations of 128 possible. -Uplifting [] best 1136224 combination zp[2]:37 [ print_char_cursor#19 print_char_cursor#26 print_char_cursor#20 ] -Uplifting [print_uchar] best 1136206 combination reg byte a [ print_uchar::$0 ] reg byte x [ print_uchar::$2 ] reg byte x [ print_uchar::b#2 print_uchar::b#0 print_uchar::b#1 ] -Uplifting [print_uint] best 1136206 combination zp[2]:59 [ print_uint::w#0 ] -Uplifting [MOS6526_CIA] best 1136206 combination -Uplifting [MOS6569_VICII] best 1136206 combination -Uplifting [MOS6581_SID] best 1136206 combination -Uplifting [RADIX] best 1136206 combination +Uplifting [] best 1133724 combination zp[2]:37 [ print_char_cursor#19 print_char_cursor#26 print_char_cursor#20 ] +Uplifting [print_uchar] best 1133706 combination reg byte a [ print_uchar::$0 ] reg byte x [ print_uchar::$2 ] reg byte x [ print_uchar::b#2 print_uchar::b#0 print_uchar::b#1 ] +Uplifting [print_uint] best 1133706 combination zp[2]:59 [ print_uint::w#0 ] +Uplifting [MOS6526_CIA] best 1133706 combination +Uplifting [MOS6569_VICII] best 1133706 combination +Uplifting [MOS6581_SID] best 1133706 combination +Uplifting [RADIX] best 1133706 combination Attempting to uplift remaining variables inzp[1]:19 [ init_font_hex::idx#5 init_font_hex::idx#2 ] -Uplifting [init_font_hex] best 1136206 combination zp[1]:19 [ init_font_hex::idx#5 init_font_hex::idx#2 ] +Uplifting [init_font_hex] best 1133706 combination zp[1]:19 [ init_font_hex::idx#5 init_font_hex::idx#2 ] Attempting to uplift remaining variables inzp[1]:61 [ init_font_hex::$0 ] -Uplifting [init_font_hex] best 1136206 combination zp[1]:61 [ init_font_hex::$0 ] +Uplifting [init_font_hex] best 1133706 combination zp[1]:61 [ init_font_hex::$0 ] Attempting to uplift remaining variables inzp[1]:64 [ init_font_hex::idx#3 ] -Uplifting [init_font_hex] best 1135606 combination reg byte y [ init_font_hex::idx#3 ] +Uplifting [init_font_hex] best 1133106 combination reg byte y [ init_font_hex::idx#3 ] Attempting to uplift remaining variables inzp[1]:17 [ init_font_hex::c1#4 init_font_hex::c1#1 ] -Uplifting [init_font_hex] best 1135606 combination zp[1]:17 [ init_font_hex::c1#4 init_font_hex::c1#1 ] +Uplifting [init_font_hex] best 1133106 combination zp[1]:17 [ init_font_hex::c1#4 init_font_hex::c1#1 ] Attempting to uplift remaining variables inzp[1]:12 [ init_font_hex::c#6 init_font_hex::c#1 ] -Uplifting [init_font_hex] best 1135606 combination zp[1]:12 [ init_font_hex::c#6 init_font_hex::c#1 ] +Uplifting [init_font_hex] best 1133106 combination zp[1]:12 [ init_font_hex::c#6 init_font_hex::c#1 ] Attempting to uplift remaining variables inzp[1]:3 [ main::x#2 main::x#1 ] -Uplifting [main] best 1135606 combination zp[1]:3 [ main::x#2 main::x#1 ] +Uplifting [main] best 1133106 combination zp[1]:3 [ main::x#2 main::x#1 ] Attempting to uplift remaining variables inzp[1]:2 [ main::y#4 main::y#1 ] -Uplifting [main] best 1135606 combination zp[1]:2 [ main::y#4 main::y#1 ] +Uplifting [main] best 1133106 combination zp[1]:2 [ main::y#4 main::y#1 ] Coalescing zero page register [ zp[2]:6 [ main::diff_sum#2 main::diff_sum#7 main::diff_sum#1 ] ] with [ zp[2]:59 [ print_uint::w#0 ] ] - score: 1 Coalescing zero page register [ zp[2]:25 [ atan2_16::angle#6 atan2_16::angle#12 atan2_16::angle#13 atan2_16::angle#2 atan2_16::angle#3 ] ] with [ zp[2]:27 [ atan2_16::return#0 atan2_16::angle#11 atan2_16::angle#1 atan2_16::angle#4 atan2_16::angle#5 ] ] - score: 1 Coalescing zero page register [ zp[2]:39 [ main::xw#0 ] ] with [ zp[2]:43 [ atan2_16::x#0 ] ] - score: 1 @@ -2728,8 +2728,7 @@ atan2_16: { __b10: // [62] if(atan2_16::yi#3!=0) goto atan2_16::@11 -- vwsz1_neq_0_then_la1 lda.z yi+1 - bne __b11 - lda.z yi + ora.z yi bne __b11 // [63] phi from atan2_16::@10 atan2_16::@19 to atan2_16::@12 [phi:atan2_16::@10/atan2_16::@19->atan2_16::@12] __b12_from___b10: @@ -3248,7 +3247,7 @@ Removing instruction jmp __b3 Succesful ASM optimization Pass5NextJumpElimination Removing instruction __b3: Succesful ASM optimization Pass5UnusedLabelElimination -Fixing long branch [311] beq __b12 to bne +Fixing long branch [310] beq __b12 to bne Fixing long branch [205] bpl __b1 to bmi Fixing long branch [217] bpl __b4 to bmi @@ -3459,7 +3458,7 @@ reg byte x [ print_uchar::$2 ] FINAL ASSEMBLER -Score: 1044103 +Score: 1041603 // File Comments // Find atan2(x, y) using the CORDIC method @@ -3863,8 +3862,7 @@ atan2_16: { // if(yi==0) // [62] if(atan2_16::yi#3!=0) goto atan2_16::@11 -- vwsz1_neq_0_then_la1 lda.z yi+1 - bne __b11 - lda.z yi + ora.z yi bne __b11 // [63] phi from atan2_16::@10 atan2_16::@19 to atan2_16::@12 [phi:atan2_16::@10/atan2_16::@19->atan2_16::@12] // [63] phi atan2_16::angle#6 = atan2_16::angle#12 [phi:atan2_16::@10/atan2_16::@19->atan2_16::@12#0] -- register_copy diff --git a/src/test/ref/cordic-atan2-16.asm b/src/test/ref/cordic-atan2-16.asm index 941072d23..6a9cf98ad 100644 --- a/src/test/ref/cordic-atan2-16.asm +++ b/src/test/ref/cordic-atan2-16.asm @@ -234,8 +234,7 @@ atan2_16: { __b10: // if(yi==0) lda.z yi+1 - bne __b11 - lda.z yi + ora.z yi bne __b11 __b12: // angle /=2 diff --git a/src/test/ref/cordic-atan2-16.log b/src/test/ref/cordic-atan2-16.log index 59c6f6502..11cbcdea8 100644 --- a/src/test/ref/cordic-atan2-16.log +++ b/src/test/ref/cordic-atan2-16.log @@ -1672,29 +1672,29 @@ Uplift Scope [MOS6569_VICII] Uplift Scope [MOS6581_SID] Uplift Scope [] -Uplifting [atan2_16] best 1149797 combination reg byte y [ atan2_16::shift#2 atan2_16::shift#5 atan2_16::shift#1 ] zp[2]:26 [ atan2_16::yd#5 atan2_16::yd#3 atan2_16::yd#10 atan2_16::yd#1 atan2_16::yd#2 ] zp[2]:28 [ atan2_16::xd#5 atan2_16::xd#3 atan2_16::xd#10 atan2_16::xd#1 atan2_16::xd#2 ] zp[2]:21 [ atan2_16::angle#6 atan2_16::angle#12 atan2_16::angle#13 atan2_16::angle#2 atan2_16::angle#3 ] zp[2]:16 [ atan2_16::yi#3 atan2_16::yi#8 atan2_16::yi#0 atan2_16::yi#16 atan2_16::$2 atan2_16::yi#1 atan2_16::yi#2 ] zp[2]:18 [ atan2_16::xi#3 atan2_16::xi#8 atan2_16::xi#0 atan2_16::xi#13 atan2_16::$7 atan2_16::xi#1 atan2_16::xi#2 ] reg byte a [ atan2_16::$23 ] reg byte a [ atan2_16::$22 ] reg byte x [ atan2_16::i#2 atan2_16::i#1 ] zp[2]:23 [ atan2_16::return#0 atan2_16::angle#11 atan2_16::angle#1 atan2_16::angle#4 atan2_16::angle#5 ] zp[2]:38 [ atan2_16::return#2 ] zp[2]:34 [ atan2_16::x#0 ] zp[2]:36 [ atan2_16::y#0 ] +Uplifting [atan2_16] best 1147297 combination reg byte y [ atan2_16::shift#2 atan2_16::shift#5 atan2_16::shift#1 ] zp[2]:26 [ atan2_16::yd#5 atan2_16::yd#3 atan2_16::yd#10 atan2_16::yd#1 atan2_16::yd#2 ] zp[2]:28 [ atan2_16::xd#5 atan2_16::xd#3 atan2_16::xd#10 atan2_16::xd#1 atan2_16::xd#2 ] zp[2]:21 [ atan2_16::angle#6 atan2_16::angle#12 atan2_16::angle#13 atan2_16::angle#2 atan2_16::angle#3 ] zp[2]:16 [ atan2_16::yi#3 atan2_16::yi#8 atan2_16::yi#0 atan2_16::yi#16 atan2_16::$2 atan2_16::yi#1 atan2_16::yi#2 ] zp[2]:18 [ atan2_16::xi#3 atan2_16::xi#8 atan2_16::xi#0 atan2_16::xi#13 atan2_16::$7 atan2_16::xi#1 atan2_16::xi#2 ] reg byte a [ atan2_16::$23 ] reg byte a [ atan2_16::$22 ] reg byte x [ atan2_16::i#2 atan2_16::i#1 ] zp[2]:23 [ atan2_16::return#0 atan2_16::angle#11 atan2_16::angle#1 atan2_16::angle#4 atan2_16::angle#5 ] zp[2]:38 [ atan2_16::return#2 ] zp[2]:34 [ atan2_16::x#0 ] zp[2]:36 [ atan2_16::y#0 ] Limited combination testing to 100 combinations of 144 possible. -Uplifting [init_font_hex] best 1130797 combination reg byte x [ init_font_hex::i#2 init_font_hex::i#1 ] reg byte a [ init_font_hex::$1 ] reg byte a [ init_font_hex::$2 ] zp[1]:15 [ init_font_hex::idx#5 init_font_hex::idx#2 ] zp[1]:45 [ init_font_hex::$0 ] zp[1]:48 [ init_font_hex::idx#3 ] zp[1]:13 [ init_font_hex::c1#4 init_font_hex::c1#1 ] zp[2]:9 [ init_font_hex::charset#2 init_font_hex::charset#5 init_font_hex::charset#0 ] zp[2]:11 [ init_font_hex::proto_lo#4 init_font_hex::proto_lo#1 ] zp[2]:6 [ init_font_hex::proto_hi#6 init_font_hex::proto_hi#1 ] zp[1]:8 [ init_font_hex::c#6 init_font_hex::c#1 ] +Uplifting [init_font_hex] best 1128297 combination reg byte x [ init_font_hex::i#2 init_font_hex::i#1 ] reg byte a [ init_font_hex::$1 ] reg byte a [ init_font_hex::$2 ] zp[1]:15 [ init_font_hex::idx#5 init_font_hex::idx#2 ] zp[1]:45 [ init_font_hex::$0 ] zp[1]:48 [ init_font_hex::idx#3 ] zp[1]:13 [ init_font_hex::c1#4 init_font_hex::c1#1 ] zp[2]:9 [ init_font_hex::charset#2 init_font_hex::charset#5 init_font_hex::charset#0 ] zp[2]:11 [ init_font_hex::proto_lo#4 init_font_hex::proto_lo#1 ] zp[2]:6 [ init_font_hex::proto_hi#6 init_font_hex::proto_hi#1 ] zp[1]:8 [ init_font_hex::c#6 init_font_hex::c#1 ] Limited combination testing to 100 combinations of 6912 possible. -Uplifting [main] best 1130197 combination zp[2]:40 [ main::angle_w#0 ] zp[2]:42 [ main::$3 ] reg byte a [ main::ang_w#0 ] zp[1]:3 [ main::x#2 main::x#1 ] zp[2]:4 [ main::screen#2 main::screen#4 main::screen#1 ] zp[2]:30 [ main::xw#0 ] zp[2]:32 [ main::yw#0 ] zp[1]:2 [ main::y#4 main::y#1 ] -Uplifting [MOS6526_CIA] best 1130197 combination -Uplifting [MOS6569_VICII] best 1130197 combination -Uplifting [MOS6581_SID] best 1130197 combination -Uplifting [] best 1130197 combination +Uplifting [main] best 1127697 combination zp[2]:40 [ main::angle_w#0 ] zp[2]:42 [ main::$3 ] reg byte a [ main::ang_w#0 ] zp[1]:3 [ main::x#2 main::x#1 ] zp[2]:4 [ main::screen#2 main::screen#4 main::screen#1 ] zp[2]:30 [ main::xw#0 ] zp[2]:32 [ main::yw#0 ] zp[1]:2 [ main::y#4 main::y#1 ] +Uplifting [MOS6526_CIA] best 1127697 combination +Uplifting [MOS6569_VICII] best 1127697 combination +Uplifting [MOS6581_SID] best 1127697 combination +Uplifting [] best 1127697 combination Attempting to uplift remaining variables inzp[1]:15 [ init_font_hex::idx#5 init_font_hex::idx#2 ] -Uplifting [init_font_hex] best 1130197 combination zp[1]:15 [ init_font_hex::idx#5 init_font_hex::idx#2 ] +Uplifting [init_font_hex] best 1127697 combination zp[1]:15 [ init_font_hex::idx#5 init_font_hex::idx#2 ] Attempting to uplift remaining variables inzp[1]:45 [ init_font_hex::$0 ] -Uplifting [init_font_hex] best 1130197 combination zp[1]:45 [ init_font_hex::$0 ] +Uplifting [init_font_hex] best 1127697 combination zp[1]:45 [ init_font_hex::$0 ] Attempting to uplift remaining variables inzp[1]:48 [ init_font_hex::idx#3 ] -Uplifting [init_font_hex] best 1129597 combination reg byte y [ init_font_hex::idx#3 ] +Uplifting [init_font_hex] best 1127097 combination reg byte y [ init_font_hex::idx#3 ] Attempting to uplift remaining variables inzp[1]:13 [ init_font_hex::c1#4 init_font_hex::c1#1 ] -Uplifting [init_font_hex] best 1129597 combination zp[1]:13 [ init_font_hex::c1#4 init_font_hex::c1#1 ] +Uplifting [init_font_hex] best 1127097 combination zp[1]:13 [ init_font_hex::c1#4 init_font_hex::c1#1 ] Attempting to uplift remaining variables inzp[1]:3 [ main::x#2 main::x#1 ] -Uplifting [main] best 1129597 combination zp[1]:3 [ main::x#2 main::x#1 ] +Uplifting [main] best 1127097 combination zp[1]:3 [ main::x#2 main::x#1 ] Attempting to uplift remaining variables inzp[1]:8 [ init_font_hex::c#6 init_font_hex::c#1 ] -Uplifting [init_font_hex] best 1129597 combination zp[1]:8 [ init_font_hex::c#6 init_font_hex::c#1 ] +Uplifting [init_font_hex] best 1127097 combination zp[1]:8 [ init_font_hex::c#6 init_font_hex::c#1 ] Attempting to uplift remaining variables inzp[1]:2 [ main::y#4 main::y#1 ] -Uplifting [main] best 1129597 combination zp[1]:2 [ main::y#4 main::y#1 ] +Uplifting [main] best 1127097 combination zp[1]:2 [ main::y#4 main::y#1 ] Coalescing zero page register [ zp[2]:21 [ atan2_16::angle#6 atan2_16::angle#12 atan2_16::angle#13 atan2_16::angle#2 atan2_16::angle#3 ] ] with [ zp[2]:23 [ atan2_16::return#0 atan2_16::angle#11 atan2_16::angle#1 atan2_16::angle#4 atan2_16::angle#5 ] ] - score: 1 Coalescing zero page register [ zp[2]:30 [ main::xw#0 ] ] with [ zp[2]:34 [ atan2_16::x#0 ] ] - score: 1 Coalescing zero page register [ zp[2]:32 [ main::yw#0 ] ] with [ zp[2]:36 [ atan2_16::y#0 ] ] - score: 1 @@ -2081,8 +2081,7 @@ atan2_16: { __b10: // [52] if(atan2_16::yi#3!=0) goto atan2_16::@11 -- vwsz1_neq_0_then_la1 lda.z yi+1 - bne __b11 - lda.z yi + ora.z yi bne __b11 // [53] phi from atan2_16::@10 atan2_16::@19 to atan2_16::@12 [phi:atan2_16::@10/atan2_16::@19->atan2_16::@12] __b12_from___b10: @@ -2436,7 +2435,7 @@ Removing instruction jmp __b1 Removing instruction jmp __b2 Removing instruction jmp __b3 Succesful ASM optimization Pass5NextJumpElimination -Fixing long branch [281] beq __b12 to bne +Fixing long branch [280] beq __b12 to bne Fixing long branch [175] bpl __b1 to bmi Fixing long branch [187] bpl __b4 to bmi @@ -2584,7 +2583,7 @@ reg byte a [ atan2_16::$22 ] FINAL ASSEMBLER -Score: 1038677 +Score: 1036177 // File Comments // Find atan2(x, y) using the CORDIC method @@ -2933,8 +2932,7 @@ atan2_16: { // if(yi==0) // [52] if(atan2_16::yi#3!=0) goto atan2_16::@11 -- vwsz1_neq_0_then_la1 lda.z yi+1 - bne __b11 - lda.z yi + ora.z yi bne __b11 // [53] phi from atan2_16::@10 atan2_16::@19 to atan2_16::@12 [phi:atan2_16::@10/atan2_16::@19->atan2_16::@12] // [53] phi atan2_16::angle#6 = atan2_16::angle#12 [phi:atan2_16::@10/atan2_16::@19->atan2_16::@12#0] -- register_copy diff --git a/src/test/ref/cordic-atan2-clear.asm b/src/test/ref/cordic-atan2-clear.asm index 544d38c0b..f005259ef 100644 --- a/src/test/ref/cordic-atan2-clear.asm +++ b/src/test/ref/cordic-atan2-clear.asm @@ -321,8 +321,7 @@ atan2_16: { __b10: // if(yi==0) lda.z yi+1 - bne __b11 - lda.z yi + ora.z yi bne __b11 __b12: // angle /=2 diff --git a/src/test/ref/cordic-atan2-clear.log b/src/test/ref/cordic-atan2-clear.log index 3f1e1984c..0e2c36acd 100644 --- a/src/test/ref/cordic-atan2-clear.log +++ b/src/test/ref/cordic-atan2-clear.log @@ -1953,41 +1953,41 @@ Uplift Scope [MOS6569_VICII] Uplift Scope [MOS6581_SID] Uplift Scope [] -Uplifting [atan2_16] best 1174659 combination reg byte y [ atan2_16::shift#2 atan2_16::shift#5 atan2_16::shift#1 ] zp[2]:31 [ atan2_16::yd#5 atan2_16::yd#3 atan2_16::yd#10 atan2_16::yd#1 atan2_16::yd#2 ] zp[2]:33 [ atan2_16::xd#5 atan2_16::xd#3 atan2_16::xd#10 atan2_16::xd#1 atan2_16::xd#2 ] zp[2]:26 [ atan2_16::angle#6 atan2_16::angle#12 atan2_16::angle#13 atan2_16::angle#2 atan2_16::angle#3 ] zp[2]:21 [ atan2_16::yi#3 atan2_16::yi#8 atan2_16::yi#0 atan2_16::yi#16 atan2_16::$2 atan2_16::yi#1 atan2_16::yi#2 ] zp[2]:23 [ atan2_16::xi#3 atan2_16::xi#8 atan2_16::xi#0 atan2_16::xi#13 atan2_16::$7 atan2_16::xi#1 atan2_16::xi#2 ] reg byte a [ atan2_16::$23 ] reg byte a [ atan2_16::$22 ] reg byte x [ atan2_16::i#2 atan2_16::i#1 ] zp[2]:28 [ atan2_16::return#0 atan2_16::angle#11 atan2_16::angle#1 atan2_16::angle#4 atan2_16::angle#5 ] zp[2]:50 [ atan2_16::return#2 ] zp[2]:46 [ atan2_16::x#0 ] zp[2]:48 [ atan2_16::y#0 ] +Uplifting [atan2_16] best 1172159 combination reg byte y [ atan2_16::shift#2 atan2_16::shift#5 atan2_16::shift#1 ] zp[2]:31 [ atan2_16::yd#5 atan2_16::yd#3 atan2_16::yd#10 atan2_16::yd#1 atan2_16::yd#2 ] zp[2]:33 [ atan2_16::xd#5 atan2_16::xd#3 atan2_16::xd#10 atan2_16::xd#1 atan2_16::xd#2 ] zp[2]:26 [ atan2_16::angle#6 atan2_16::angle#12 atan2_16::angle#13 atan2_16::angle#2 atan2_16::angle#3 ] zp[2]:21 [ atan2_16::yi#3 atan2_16::yi#8 atan2_16::yi#0 atan2_16::yi#16 atan2_16::$2 atan2_16::yi#1 atan2_16::yi#2 ] zp[2]:23 [ atan2_16::xi#3 atan2_16::xi#8 atan2_16::xi#0 atan2_16::xi#13 atan2_16::$7 atan2_16::xi#1 atan2_16::xi#2 ] reg byte a [ atan2_16::$23 ] reg byte a [ atan2_16::$22 ] reg byte x [ atan2_16::i#2 atan2_16::i#1 ] zp[2]:28 [ atan2_16::return#0 atan2_16::angle#11 atan2_16::angle#1 atan2_16::angle#4 atan2_16::angle#5 ] zp[2]:50 [ atan2_16::return#2 ] zp[2]:46 [ atan2_16::x#0 ] zp[2]:48 [ atan2_16::y#0 ] Limited combination testing to 100 combinations of 144 possible. -Uplifting [init_font_hex] best 1155659 combination reg byte x [ init_font_hex::i#2 init_font_hex::i#1 ] reg byte a [ init_font_hex::$1 ] reg byte a [ init_font_hex::$2 ] zp[1]:13 [ init_font_hex::idx#5 init_font_hex::idx#2 ] zp[1]:35 [ init_font_hex::$0 ] zp[1]:38 [ init_font_hex::idx#3 ] zp[1]:11 [ init_font_hex::c1#4 init_font_hex::c1#1 ] zp[2]:7 [ init_font_hex::charset#2 init_font_hex::charset#5 init_font_hex::charset#0 ] zp[2]:9 [ init_font_hex::proto_lo#4 init_font_hex::proto_lo#1 ] zp[2]:4 [ init_font_hex::proto_hi#6 init_font_hex::proto_hi#1 ] zp[1]:6 [ init_font_hex::c#6 init_font_hex::c#1 ] +Uplifting [init_font_hex] best 1153159 combination reg byte x [ init_font_hex::i#2 init_font_hex::i#1 ] reg byte a [ init_font_hex::$1 ] reg byte a [ init_font_hex::$2 ] zp[1]:13 [ init_font_hex::idx#5 init_font_hex::idx#2 ] zp[1]:35 [ init_font_hex::$0 ] zp[1]:38 [ init_font_hex::idx#3 ] zp[1]:11 [ init_font_hex::c1#4 init_font_hex::c1#1 ] zp[2]:7 [ init_font_hex::charset#2 init_font_hex::charset#5 init_font_hex::charset#0 ] zp[2]:9 [ init_font_hex::proto_lo#4 init_font_hex::proto_lo#1 ] zp[2]:4 [ init_font_hex::proto_hi#6 init_font_hex::proto_hi#1 ] zp[1]:6 [ init_font_hex::c#6 init_font_hex::c#1 ] Limited combination testing to 100 combinations of 6912 possible. -Uplifting [init_angle_screen] best 1154059 combination zp[1]:20 [ init_angle_screen::xb#2 init_angle_screen::xb#1 ] reg byte a [ init_angle_screen::$3 ] reg byte a [ init_angle_screen::$4 ] reg byte a [ init_angle_screen::$5 ] zp[2]:52 [ init_angle_screen::angle_w#0 ] zp[2]:54 [ init_angle_screen::$7 ] zp[1]:57 [ init_angle_screen::$9 ] zp[1]:58 [ init_angle_screen::$10 ] zp[1]:59 [ init_angle_screen::$11 ] zp[1]:19 [ init_angle_screen::x#2 init_angle_screen::x#1 ] zp[1]:56 [ init_angle_screen::ang_w#0 ] zp[2]:44 [ init_angle_screen::yw#0 ] zp[2]:41 [ init_angle_screen::xw#0 ] zp[1]:14 [ init_angle_screen::y#5 init_angle_screen::y#1 ] zp[2]:17 [ init_angle_screen::screen_bottomline#6 init_angle_screen::screen_bottomline#1 ] zp[2]:15 [ init_angle_screen::screen_topline#6 init_angle_screen::screen_topline#1 ] +Uplifting [init_angle_screen] best 1151559 combination zp[1]:20 [ init_angle_screen::xb#2 init_angle_screen::xb#1 ] reg byte a [ init_angle_screen::$3 ] reg byte a [ init_angle_screen::$4 ] reg byte a [ init_angle_screen::$5 ] zp[2]:52 [ init_angle_screen::angle_w#0 ] zp[2]:54 [ init_angle_screen::$7 ] zp[1]:57 [ init_angle_screen::$9 ] zp[1]:58 [ init_angle_screen::$10 ] zp[1]:59 [ init_angle_screen::$11 ] zp[1]:19 [ init_angle_screen::x#2 init_angle_screen::x#1 ] zp[1]:56 [ init_angle_screen::ang_w#0 ] zp[2]:44 [ init_angle_screen::yw#0 ] zp[2]:41 [ init_angle_screen::xw#0 ] zp[1]:14 [ init_angle_screen::y#5 init_angle_screen::y#1 ] zp[2]:17 [ init_angle_screen::screen_bottomline#6 init_angle_screen::screen_bottomline#1 ] zp[2]:15 [ init_angle_screen::screen_topline#6 init_angle_screen::screen_topline#1 ] Limited combination testing to 100 combinations of 65536 possible. -Uplifting [main] best 1154059 combination zp[2]:2 [ main::clear_char#5 main::clear_char#1 ] -Uplifting [MOS6526_CIA] best 1154059 combination -Uplifting [MOS6569_VICII] best 1154059 combination -Uplifting [MOS6581_SID] best 1154059 combination -Uplifting [] best 1154059 combination +Uplifting [main] best 1151559 combination zp[2]:2 [ main::clear_char#5 main::clear_char#1 ] +Uplifting [MOS6526_CIA] best 1151559 combination +Uplifting [MOS6569_VICII] best 1151559 combination +Uplifting [MOS6581_SID] best 1151559 combination +Uplifting [] best 1151559 combination Attempting to uplift remaining variables inzp[1]:13 [ init_font_hex::idx#5 init_font_hex::idx#2 ] -Uplifting [init_font_hex] best 1154059 combination zp[1]:13 [ init_font_hex::idx#5 init_font_hex::idx#2 ] +Uplifting [init_font_hex] best 1151559 combination zp[1]:13 [ init_font_hex::idx#5 init_font_hex::idx#2 ] Attempting to uplift remaining variables inzp[1]:35 [ init_font_hex::$0 ] -Uplifting [init_font_hex] best 1154059 combination zp[1]:35 [ init_font_hex::$0 ] +Uplifting [init_font_hex] best 1151559 combination zp[1]:35 [ init_font_hex::$0 ] Attempting to uplift remaining variables inzp[1]:20 [ init_angle_screen::xb#2 init_angle_screen::xb#1 ] -Uplifting [init_angle_screen] best 1154059 combination zp[1]:20 [ init_angle_screen::xb#2 init_angle_screen::xb#1 ] +Uplifting [init_angle_screen] best 1151559 combination zp[1]:20 [ init_angle_screen::xb#2 init_angle_screen::xb#1 ] Attempting to uplift remaining variables inzp[1]:38 [ init_font_hex::idx#3 ] -Uplifting [init_font_hex] best 1153459 combination reg byte y [ init_font_hex::idx#3 ] +Uplifting [init_font_hex] best 1150959 combination reg byte y [ init_font_hex::idx#3 ] Attempting to uplift remaining variables inzp[1]:57 [ init_angle_screen::$9 ] -Uplifting [init_angle_screen] best 1153059 combination reg byte a [ init_angle_screen::$9 ] +Uplifting [init_angle_screen] best 1150559 combination reg byte a [ init_angle_screen::$9 ] Attempting to uplift remaining variables inzp[1]:58 [ init_angle_screen::$10 ] -Uplifting [init_angle_screen] best 1152459 combination reg byte a [ init_angle_screen::$10 ] +Uplifting [init_angle_screen] best 1149959 combination reg byte a [ init_angle_screen::$10 ] Attempting to uplift remaining variables inzp[1]:59 [ init_angle_screen::$11 ] -Uplifting [init_angle_screen] best 1151859 combination reg byte a [ init_angle_screen::$11 ] +Uplifting [init_angle_screen] best 1149359 combination reg byte a [ init_angle_screen::$11 ] Attempting to uplift remaining variables inzp[1]:11 [ init_font_hex::c1#4 init_font_hex::c1#1 ] -Uplifting [init_font_hex] best 1151859 combination zp[1]:11 [ init_font_hex::c1#4 init_font_hex::c1#1 ] +Uplifting [init_font_hex] best 1149359 combination zp[1]:11 [ init_font_hex::c1#4 init_font_hex::c1#1 ] Attempting to uplift remaining variables inzp[1]:19 [ init_angle_screen::x#2 init_angle_screen::x#1 ] -Uplifting [init_angle_screen] best 1151859 combination zp[1]:19 [ init_angle_screen::x#2 init_angle_screen::x#1 ] +Uplifting [init_angle_screen] best 1149359 combination zp[1]:19 [ init_angle_screen::x#2 init_angle_screen::x#1 ] Attempting to uplift remaining variables inzp[1]:56 [ init_angle_screen::ang_w#0 ] -Uplifting [init_angle_screen] best 1151859 combination zp[1]:56 [ init_angle_screen::ang_w#0 ] +Uplifting [init_angle_screen] best 1149359 combination zp[1]:56 [ init_angle_screen::ang_w#0 ] Attempting to uplift remaining variables inzp[1]:14 [ init_angle_screen::y#5 init_angle_screen::y#1 ] -Uplifting [init_angle_screen] best 1151859 combination zp[1]:14 [ init_angle_screen::y#5 init_angle_screen::y#1 ] +Uplifting [init_angle_screen] best 1149359 combination zp[1]:14 [ init_angle_screen::y#5 init_angle_screen::y#1 ] Attempting to uplift remaining variables inzp[1]:6 [ init_font_hex::c#6 init_font_hex::c#1 ] -Uplifting [init_font_hex] best 1151859 combination zp[1]:6 [ init_font_hex::c#6 init_font_hex::c#1 ] +Uplifting [init_font_hex] best 1149359 combination zp[1]:6 [ init_font_hex::c#6 init_font_hex::c#1 ] Coalescing zero page register [ zp[2]:26 [ atan2_16::angle#6 atan2_16::angle#12 atan2_16::angle#13 atan2_16::angle#2 atan2_16::angle#3 ] ] with [ zp[2]:28 [ atan2_16::return#0 atan2_16::angle#11 atan2_16::angle#1 atan2_16::angle#4 atan2_16::angle#5 ] ] - score: 1 Coalescing zero page register [ zp[2]:41 [ init_angle_screen::xw#0 ] ] with [ zp[2]:46 [ atan2_16::x#0 ] ] - score: 1 Coalescing zero page register [ zp[2]:44 [ init_angle_screen::yw#0 ] ] with [ zp[2]:48 [ atan2_16::y#0 ] ] - score: 1 @@ -2494,8 +2494,7 @@ atan2_16: { __b10: // [70] if(atan2_16::yi#3!=0) goto atan2_16::@11 -- vwsz1_neq_0_then_la1 lda.z yi+1 - bne __b11 - lda.z yi + ora.z yi bne __b11 // [71] phi from atan2_16::@10 atan2_16::@19 to atan2_16::@12 [phi:atan2_16::@10/atan2_16::@19->atan2_16::@12] __b12_from___b10: @@ -2867,7 +2866,7 @@ Removing instruction jmp __b2 Removing instruction jmp __b3 Removing instruction jmp __b1 Succesful ASM optimization Pass5NextJumpElimination -Fixing long branch [352] beq __b12 to bne +Fixing long branch [351] beq __b12 to bne Fixing long branch [246] bpl __b1 to bmi Fixing long branch [258] bpl __b4 to bmi @@ -3035,7 +3034,7 @@ reg byte a [ atan2_16::$22 ] FINAL ASSEMBLER -Score: 1056709 +Score: 1054209 // File Comments // Find atan2(x, y) using the CORDIC method @@ -3500,8 +3499,7 @@ atan2_16: { // if(yi==0) // [70] if(atan2_16::yi#3!=0) goto atan2_16::@11 -- vwsz1_neq_0_then_la1 lda.z yi+1 - bne __b11 - lda.z yi + ora.z yi bne __b11 // [71] phi from atan2_16::@10 atan2_16::@19 to atan2_16::@12 [phi:atan2_16::@10/atan2_16::@19->atan2_16::@12] // [71] phi atan2_16::angle#6 = atan2_16::angle#12 [phi:atan2_16::@10/atan2_16::@19->atan2_16::@12#0] -- register_copy diff --git a/src/test/ref/examples/scrolllogo/scrolllogo.asm b/src/test/ref/examples/scrolllogo/scrolllogo.asm index f01ec4dfc..2dd6ab08b 100644 --- a/src/test/ref/examples/scrolllogo/scrolllogo.asm +++ b/src/test/ref/examples/scrolllogo/scrolllogo.asm @@ -877,8 +877,7 @@ mul16u: { __b1: // while(a!=0) lda.z a - bne __b2 - lda.z a+1 + ora.z a+1 bne __b2 // } rts diff --git a/src/test/ref/examples/scrolllogo/scrolllogo.log b/src/test/ref/examples/scrolllogo/scrolllogo.log index 7c8be798a..c3ea574aa 100644 --- a/src/test/ref/examples/scrolllogo/scrolllogo.log +++ b/src/test/ref/examples/scrolllogo/scrolllogo.log @@ -4232,58 +4232,58 @@ Uplift Scope [MOS6526_CIA] Uplift Scope [MOS6569_VICII] Uplift Scope [MOS6581_SID] -Uplifting [mul16u] best 72904 combination zp[4]:49 [ mul16u::res#2 mul16u::res#6 mul16u::res#1 ] zp[4]:53 [ mul16u::mb#2 mul16u::mb#0 mul16u::mb#1 ] reg byte a [ mul16u::$1 ] zp[2]:47 [ mul16u::a#3 mul16u::a#6 mul16u::a#1 mul16u::a#2 mul16u::a#0 ] zp[2]:45 [ mul16u::b#2 mul16u::b#1 ] zp[4]:166 [ mul16u::return#3 ] zp[4]:133 [ mul16u::return#2 ] -Uplifting [divr16u] best 72694 combination zp[2]:33 [ divr16u::rem#5 divr16u::rem#10 divr16u::rem#4 divr16u::rem#11 divr16u::rem#6 divr16u::rem#0 divr16u::rem#1 divr16u::rem#2 ] zp[2]:37 [ divr16u::quotient#3 divr16u::return#0 divr16u::quotient#1 divr16u::quotient#2 ] reg byte a [ divr16u::$1 ] reg byte a [ divr16u::$2 ] reg byte x [ divr16u::i#2 divr16u::i#1 ] zp[2]:35 [ divr16u::dividend#3 divr16u::dividend#5 divr16u::dividend#0 ] zp[2]:89 [ divr16u::return#2 ] zp[2]:93 [ divr16u::return#3 ] -Uplifting [mulu16_sel] best 72676 combination zp[2]:40 [ mulu16_sel::v1#5 mulu16_sel::v1#4 mulu16_sel::v1#0 mulu16_sel::v1#1 mulu16_sel::v1#2 mulu16_sel::v1#3 ] zp[4]:170 [ mulu16_sel::$0 ] zp[4]:174 [ mulu16_sel::$1 ] zp[2]:42 [ mulu16_sel::v2#5 mulu16_sel::v2#4 mulu16_sel::v2#0 mulu16_sel::v2#1 mulu16_sel::v2#3 ] zp[2]:178 [ mulu16_sel::return#12 ] zp[2]:107 [ mulu16_sel::return#0 ] zp[2]:111 [ mulu16_sel::return#1 ] zp[2]:115 [ mulu16_sel::return#2 ] zp[2]:121 [ mulu16_sel::return#10 ] zp[2]:125 [ mulu16_sel::return#11 ] reg byte x [ mulu16_sel::select#5 ] -Uplifting [sin16s] best 72667 combination zp[4]:19 [ sin16s::x#6 sin16s::x#4 sin16s::x#0 sin16s::x#1 sin16s::x#2 ] zp[2]:23 [ sin16s::return#1 sin16s::return#5 sin16s::sinx#1 ] zp[4]:101 [ sin16s::$4 ] zp[2]:109 [ sin16s::x2#0 ] zp[2]:117 [ sin16s::x3_6#0 ] zp[2]:123 [ sin16s::x4#0 ] zp[2]:127 [ sin16s::x5#0 ] zp[2]:129 [ sin16s::x5_128#0 ] zp[2]:113 [ sin16s::x3#0 ] zp[2]:131 [ sin16s::usinx#1 ] zp[2]:105 [ sin16s::x1#0 ] zp[2]:67 [ sin16s::return#0 ] zp[2]:119 [ sin16s::usinx#0 ] reg byte y [ sin16s::isUpper#2 ] -Uplifting [mul16s] best 72667 combination zp[4]:25 [ mul16s::m#4 mul16s::m#1 mul16s::m#0 ] zp[2]:137 [ mul16s::$6 ] zp[2]:139 [ mul16s::$11 ] zp[4]:141 [ mul16s::return#0 ] zp[2]:69 [ mul16s::a#0 ] zp[4]:71 [ mul16s::return#2 ] -Uplifting [sin16s_gen2] best 72667 combination zp[2]:8 [ sin16s_gen2::i#2 sin16s_gen2::i#1 ] zp[4]:75 [ sin16s_gen2::$6 ] zp[4]:10 [ sin16s_gen2::x#2 sin16s_gen2::x#1 ] zp[2]:79 [ sin16s_gen2::$8 ] zp[2]:14 [ sin16s_gen2::sintab#2 sin16s_gen2::sintab#0 ] zp[4]:63 [ sin16s_gen2::step#0 ] -Uplifting [loop] best 72667 combination zp[2]:81 [ loop::$7 ] zp[2]:83 [ loop::$2 ] zp[2]:85 [ loop::xpos#0 ] -Uplifting [] best 72667 combination zp[2]:16 [ xsin_idx#12 xsin_idx#21 xsin_idx#2 ] zp[2]:164 [ rem16u#0 ] -Uplifting [memset] best 72651 combination zp[2]:6 [ memset::dst#2 memset::dst#4 memset::dst#1 ] zp[2]:57 [ memset::end#0 ] reg byte x [ memset::c#4 ] zp[2]:3 [ memset::str#3 ] -Uplifting [div32u16u] best 72651 combination zp[2]:95 [ div32u16u::quotient_lo#0 ] zp[2]:91 [ div32u16u::quotient_hi#0 ] zp[4]:97 [ div32u16u::return#0 ] zp[4]:59 [ div32u16u::return#2 ] -Uplifting [main] best 72531 combination reg byte x [ main::ch#2 main::ch#1 ] -Uplifting [MOS6526_CIA] best 72531 combination -Uplifting [MOS6569_VICII] best 72531 combination -Uplifting [MOS6581_SID] best 72531 combination +Uplifting [mul16u] best 72654 combination zp[4]:49 [ mul16u::res#2 mul16u::res#6 mul16u::res#1 ] zp[4]:53 [ mul16u::mb#2 mul16u::mb#0 mul16u::mb#1 ] reg byte a [ mul16u::$1 ] zp[2]:47 [ mul16u::a#3 mul16u::a#6 mul16u::a#1 mul16u::a#2 mul16u::a#0 ] zp[2]:45 [ mul16u::b#2 mul16u::b#1 ] zp[4]:166 [ mul16u::return#3 ] zp[4]:133 [ mul16u::return#2 ] +Uplifting [divr16u] best 72444 combination zp[2]:33 [ divr16u::rem#5 divr16u::rem#10 divr16u::rem#4 divr16u::rem#11 divr16u::rem#6 divr16u::rem#0 divr16u::rem#1 divr16u::rem#2 ] zp[2]:37 [ divr16u::quotient#3 divr16u::return#0 divr16u::quotient#1 divr16u::quotient#2 ] reg byte a [ divr16u::$1 ] reg byte a [ divr16u::$2 ] reg byte x [ divr16u::i#2 divr16u::i#1 ] zp[2]:35 [ divr16u::dividend#3 divr16u::dividend#5 divr16u::dividend#0 ] zp[2]:89 [ divr16u::return#2 ] zp[2]:93 [ divr16u::return#3 ] +Uplifting [mulu16_sel] best 72426 combination zp[2]:40 [ mulu16_sel::v1#5 mulu16_sel::v1#4 mulu16_sel::v1#0 mulu16_sel::v1#1 mulu16_sel::v1#2 mulu16_sel::v1#3 ] zp[4]:170 [ mulu16_sel::$0 ] zp[4]:174 [ mulu16_sel::$1 ] zp[2]:42 [ mulu16_sel::v2#5 mulu16_sel::v2#4 mulu16_sel::v2#0 mulu16_sel::v2#1 mulu16_sel::v2#3 ] zp[2]:178 [ mulu16_sel::return#12 ] zp[2]:107 [ mulu16_sel::return#0 ] zp[2]:111 [ mulu16_sel::return#1 ] zp[2]:115 [ mulu16_sel::return#2 ] zp[2]:121 [ mulu16_sel::return#10 ] zp[2]:125 [ mulu16_sel::return#11 ] reg byte x [ mulu16_sel::select#5 ] +Uplifting [sin16s] best 72417 combination zp[4]:19 [ sin16s::x#6 sin16s::x#4 sin16s::x#0 sin16s::x#1 sin16s::x#2 ] zp[2]:23 [ sin16s::return#1 sin16s::return#5 sin16s::sinx#1 ] zp[4]:101 [ sin16s::$4 ] zp[2]:109 [ sin16s::x2#0 ] zp[2]:117 [ sin16s::x3_6#0 ] zp[2]:123 [ sin16s::x4#0 ] zp[2]:127 [ sin16s::x5#0 ] zp[2]:129 [ sin16s::x5_128#0 ] zp[2]:113 [ sin16s::x3#0 ] zp[2]:131 [ sin16s::usinx#1 ] zp[2]:105 [ sin16s::x1#0 ] zp[2]:67 [ sin16s::return#0 ] zp[2]:119 [ sin16s::usinx#0 ] reg byte y [ sin16s::isUpper#2 ] +Uplifting [mul16s] best 72417 combination zp[4]:25 [ mul16s::m#4 mul16s::m#1 mul16s::m#0 ] zp[2]:137 [ mul16s::$6 ] zp[2]:139 [ mul16s::$11 ] zp[4]:141 [ mul16s::return#0 ] zp[2]:69 [ mul16s::a#0 ] zp[4]:71 [ mul16s::return#2 ] +Uplifting [sin16s_gen2] best 72417 combination zp[2]:8 [ sin16s_gen2::i#2 sin16s_gen2::i#1 ] zp[4]:75 [ sin16s_gen2::$6 ] zp[4]:10 [ sin16s_gen2::x#2 sin16s_gen2::x#1 ] zp[2]:79 [ sin16s_gen2::$8 ] zp[2]:14 [ sin16s_gen2::sintab#2 sin16s_gen2::sintab#0 ] zp[4]:63 [ sin16s_gen2::step#0 ] +Uplifting [loop] best 72417 combination zp[2]:81 [ loop::$7 ] zp[2]:83 [ loop::$2 ] zp[2]:85 [ loop::xpos#0 ] +Uplifting [] best 72417 combination zp[2]:16 [ xsin_idx#12 xsin_idx#21 xsin_idx#2 ] zp[2]:164 [ rem16u#0 ] +Uplifting [memset] best 72401 combination zp[2]:6 [ memset::dst#2 memset::dst#4 memset::dst#1 ] zp[2]:57 [ memset::end#0 ] reg byte x [ memset::c#4 ] zp[2]:3 [ memset::str#3 ] +Uplifting [div32u16u] best 72401 combination zp[2]:95 [ div32u16u::quotient_lo#0 ] zp[2]:91 [ div32u16u::quotient_hi#0 ] zp[4]:97 [ div32u16u::return#0 ] zp[4]:59 [ div32u16u::return#2 ] +Uplifting [main] best 72281 combination reg byte x [ main::ch#2 main::ch#1 ] +Uplifting [MOS6526_CIA] best 72281 combination +Uplifting [MOS6569_VICII] best 72281 combination +Uplifting [MOS6581_SID] best 72281 combination Attempting to uplift remaining variables inzp[1]:29 [ render_logo::screen_idx#10 render_logo::screen_idx#4 render_logo::screen_idx#18 render_logo::screen_idx#3 ] -Uplifting [render_logo] best 67431 combination reg byte y [ render_logo::screen_idx#10 render_logo::screen_idx#4 render_logo::screen_idx#18 render_logo::screen_idx#3 ] +Uplifting [render_logo] best 67181 combination reg byte y [ render_logo::screen_idx#10 render_logo::screen_idx#4 render_logo::screen_idx#18 render_logo::screen_idx#3 ] Attempting to uplift remaining variables inzp[1]:32 [ render_logo::screen_idx#15 render_logo::screen_idx#21 render_logo::screen_idx#5 render_logo::screen_idx#6 ] -Uplifting [render_logo] best 62631 combination reg byte y [ render_logo::screen_idx#15 render_logo::screen_idx#21 render_logo::screen_idx#5 render_logo::screen_idx#6 ] +Uplifting [render_logo] best 62381 combination reg byte y [ render_logo::screen_idx#15 render_logo::screen_idx#21 render_logo::screen_idx#5 render_logo::screen_idx#6 ] Attempting to uplift remaining variables inzp[1]:31 [ render_logo::logo_idx#11 render_logo::logo_idx#14 render_logo::logo_idx#4 ] -Uplifting [render_logo] best 62631 combination zp[1]:31 [ render_logo::logo_idx#11 render_logo::logo_idx#14 render_logo::logo_idx#4 ] +Uplifting [render_logo] best 62381 combination zp[1]:31 [ render_logo::logo_idx#11 render_logo::logo_idx#14 render_logo::logo_idx#4 ] Attempting to uplift remaining variables inzp[1]:30 [ render_logo::logo_idx#10 render_logo::logo_idx#3 ] -Uplifting [render_logo] best 62631 combination zp[1]:30 [ render_logo::logo_idx#10 render_logo::logo_idx#3 ] +Uplifting [render_logo] best 62381 combination zp[1]:30 [ render_logo::logo_idx#10 render_logo::logo_idx#3 ] Attempting to uplift remaining variables inzp[1]:151 [ render_logo::$30 ] -Uplifting [render_logo] best 62231 combination reg byte a [ render_logo::$30 ] +Uplifting [render_logo] best 61981 combination reg byte a [ render_logo::$30 ] Attempting to uplift remaining variables inzp[1]:152 [ render_logo::$33 ] -Uplifting [render_logo] best 61831 combination reg byte a [ render_logo::$33 ] +Uplifting [render_logo] best 61581 combination reg byte a [ render_logo::$33 ] Attempting to uplift remaining variables inzp[1]:153 [ render_logo::$36 ] -Uplifting [render_logo] best 61431 combination reg byte a [ render_logo::$36 ] +Uplifting [render_logo] best 61181 combination reg byte a [ render_logo::$36 ] Attempting to uplift remaining variables inzp[1]:154 [ render_logo::$39 ] -Uplifting [render_logo] best 61031 combination reg byte a [ render_logo::$39 ] +Uplifting [render_logo] best 60781 combination reg byte a [ render_logo::$39 ] Attempting to uplift remaining variables inzp[1]:155 [ render_logo::$42 ] -Uplifting [render_logo] best 60631 combination reg byte a [ render_logo::$42 ] +Uplifting [render_logo] best 60381 combination reg byte a [ render_logo::$42 ] Attempting to uplift remaining variables inzp[1]:157 [ render_logo::$70 ] -Uplifting [render_logo] best 60231 combination reg byte a [ render_logo::$70 ] +Uplifting [render_logo] best 59981 combination reg byte a [ render_logo::$70 ] Attempting to uplift remaining variables inzp[1]:158 [ render_logo::$73 ] -Uplifting [render_logo] best 59831 combination reg byte a [ render_logo::$73 ] +Uplifting [render_logo] best 59581 combination reg byte a [ render_logo::$73 ] Attempting to uplift remaining variables inzp[1]:159 [ render_logo::$76 ] -Uplifting [render_logo] best 59431 combination reg byte a [ render_logo::$76 ] +Uplifting [render_logo] best 59181 combination reg byte a [ render_logo::$76 ] Attempting to uplift remaining variables inzp[1]:160 [ render_logo::$79 ] -Uplifting [render_logo] best 59031 combination reg byte a [ render_logo::$79 ] +Uplifting [render_logo] best 58781 combination reg byte a [ render_logo::$79 ] Attempting to uplift remaining variables inzp[1]:161 [ render_logo::$82 ] -Uplifting [render_logo] best 58631 combination reg byte a [ render_logo::$82 ] +Uplifting [render_logo] best 58381 combination reg byte a [ render_logo::$82 ] Attempting to uplift remaining variables inzp[1]:145 [ render_logo::$25 ] -Uplifting [render_logo] best 58625 combination reg byte a [ render_logo::$25 ] +Uplifting [render_logo] best 58375 combination reg byte a [ render_logo::$25 ] Attempting to uplift remaining variables inzp[1]:146 [ render_logo::$0 ] -Uplifting [render_logo] best 58619 combination reg byte a [ render_logo::$0 ] +Uplifting [render_logo] best 58369 combination reg byte a [ render_logo::$0 ] Attempting to uplift remaining variables inzp[1]:147 [ render_logo::$1 ] -Uplifting [render_logo] best 58613 combination reg byte a [ render_logo::$1 ] +Uplifting [render_logo] best 58363 combination reg byte a [ render_logo::$1 ] Attempting to uplift remaining variables inzp[1]:156 [ render_logo::logo_idx#1 ] -Uplifting [render_logo] best 58607 combination reg byte a [ render_logo::logo_idx#1 ] +Uplifting [render_logo] best 58357 combination reg byte a [ render_logo::logo_idx#1 ] Attempting to uplift remaining variables inzp[1]:150 [ render_logo::x_char#0 ] -Uplifting [render_logo] best 58607 combination zp[1]:150 [ render_logo::x_char#0 ] +Uplifting [render_logo] best 58357 combination zp[1]:150 [ render_logo::x_char#0 ] Coalescing zero page register [ zp[2]:23 [ sin16s::return#1 sin16s::return#5 sin16s::sinx#1 ] ] with [ zp[2]:131 [ sin16s::usinx#1 ] ] - score: 2 Coalescing zero page register [ zp[2]:33 [ divr16u::rem#5 divr16u::rem#10 divr16u::rem#4 divr16u::rem#11 divr16u::rem#6 divr16u::rem#0 divr16u::rem#1 divr16u::rem#2 ] ] with [ zp[2]:164 [ rem16u#0 ] ] - score: 2 Coalescing zero page register [ zp[2]:40 [ mulu16_sel::v1#5 mulu16_sel::v1#4 mulu16_sel::v1#0 mulu16_sel::v1#1 mulu16_sel::v1#2 mulu16_sel::v1#3 ] ] with [ zp[2]:113 [ sin16s::x3#0 ] ] - score: 2 @@ -5703,8 +5703,7 @@ mul16u: { __b1: // [210] if(mul16u::a#3!=0) goto mul16u::@2 -- vwuz1_neq_0_then_la1 lda.z a - bne __b2 - lda.z a+1 + ora.z a+1 bne __b2 jmp __breturn // mul16u::@return @@ -6321,7 +6320,7 @@ reg byte a [ mul16u::$1 ] FINAL ASSEMBLER -Score: 44171 +Score: 43921 // File Comments // Commodore 64 Registers and Constants @@ -7603,8 +7602,7 @@ mul16u: { // while(a!=0) // [210] if(mul16u::a#3!=0) goto mul16u::@2 -- vwuz1_neq_0_then_la1 lda.z a - bne __b2 - lda.z a+1 + ora.z a+1 bne __b2 // mul16u::@return // } diff --git a/src/test/ref/examples/sinplotter/sine-plotter.asm b/src/test/ref/examples/sinplotter/sine-plotter.asm index fa2143706..2870f3b29 100644 --- a/src/test/ref/examples/sinplotter/sine-plotter.asm +++ b/src/test/ref/examples/sinplotter/sine-plotter.asm @@ -924,8 +924,7 @@ mul16u: { __b1: // while(a!=0) lda.z a - bne __b2 - lda.z a+1 + ora.z a+1 bne __b2 // } rts diff --git a/src/test/ref/examples/sinplotter/sine-plotter.log b/src/test/ref/examples/sinplotter/sine-plotter.log index 5f794ea4c..fe4254cf0 100644 --- a/src/test/ref/examples/sinplotter/sine-plotter.log +++ b/src/test/ref/examples/sinplotter/sine-plotter.log @@ -3880,31 +3880,31 @@ Uplift Scope [MOS6581_SID] Uplift Scope [bitmap_clear] Uplift Scope [main] -Uplifting [mul16u] best 31233 combination zp[4]:58 [ mul16u::res#2 mul16u::res#6 mul16u::res#1 ] zp[4]:62 [ mul16u::mb#2 mul16u::mb#0 mul16u::mb#1 ] reg byte a [ mul16u::$1 ] zp[2]:56 [ mul16u::a#3 mul16u::a#6 mul16u::a#1 mul16u::a#2 mul16u::a#0 ] zp[2]:54 [ mul16u::b#2 mul16u::b#1 ] zp[4]:176 [ mul16u::return#3 ] zp[4]:152 [ mul16u::return#2 ] -Uplifting [wrap_y] best 31050 combination zp[2]:37 [ wrap_y::y#6 wrap_y::y#4 wrap_y::y#9 wrap_y::y#0 wrap_y::y#1 wrap_y::y#2 wrap_y::y#3 ] reg byte a [ wrap_y::return#2 ] reg byte a [ wrap_y::return#0 ] reg byte a [ wrap_y::return#1 ] -Uplifting [divr16u] best 30840 combination zp[2]:42 [ divr16u::rem#5 divr16u::rem#10 divr16u::rem#4 divr16u::rem#11 divr16u::rem#6 divr16u::rem#0 divr16u::rem#1 divr16u::rem#2 ] zp[2]:46 [ divr16u::quotient#3 divr16u::return#0 divr16u::quotient#1 divr16u::quotient#2 ] reg byte a [ divr16u::$1 ] reg byte a [ divr16u::$2 ] reg byte x [ divr16u::i#2 divr16u::i#1 ] zp[2]:44 [ divr16u::dividend#3 divr16u::dividend#5 divr16u::dividend#0 ] zp[2]:108 [ divr16u::return#2 ] zp[2]:112 [ divr16u::return#3 ] -Uplifting [mulu16_sel] best 30822 combination zp[2]:49 [ mulu16_sel::v1#5 mulu16_sel::v1#4 mulu16_sel::v1#0 mulu16_sel::v1#1 mulu16_sel::v1#2 mulu16_sel::v1#3 ] zp[4]:180 [ mulu16_sel::$0 ] zp[4]:184 [ mulu16_sel::$1 ] zp[2]:51 [ mulu16_sel::v2#5 mulu16_sel::v2#4 mulu16_sel::v2#0 mulu16_sel::v2#1 mulu16_sel::v2#3 ] zp[2]:188 [ mulu16_sel::return#12 ] zp[2]:126 [ mulu16_sel::return#0 ] zp[2]:130 [ mulu16_sel::return#1 ] zp[2]:134 [ mulu16_sel::return#2 ] zp[2]:140 [ mulu16_sel::return#10 ] zp[2]:144 [ mulu16_sel::return#11 ] reg byte x [ mulu16_sel::select#5 ] -Uplifting [sin16s] best 30813 combination zp[4]:27 [ sin16s::x#6 sin16s::x#4 sin16s::x#0 sin16s::x#1 sin16s::x#2 ] zp[2]:31 [ sin16s::return#1 sin16s::return#5 sin16s::sinx#1 ] zp[4]:120 [ sin16s::$4 ] zp[2]:128 [ sin16s::x2#0 ] zp[2]:136 [ sin16s::x3_6#0 ] zp[2]:142 [ sin16s::x4#0 ] zp[2]:146 [ sin16s::x5#0 ] zp[2]:148 [ sin16s::x5_128#0 ] zp[2]:132 [ sin16s::x3#0 ] zp[2]:150 [ sin16s::usinx#1 ] zp[2]:124 [ sin16s::x1#0 ] zp[2]:78 [ sin16s::return#0 ] zp[2]:138 [ sin16s::usinx#0 ] reg byte y [ sin16s::isUpper#2 ] -Uplifting [mul16s] best 30813 combination zp[4]:33 [ mul16s::m#4 mul16s::m#1 mul16s::m#0 ] zp[2]:156 [ mul16s::$6 ] zp[2]:158 [ mul16s::$11 ] zp[4]:160 [ mul16s::return#0 ] zp[2]:80 [ mul16s::a#0 ] zp[4]:82 [ mul16s::return#2 ] -Uplifting [bitmap_plot] best 30744 combination reg byte x [ bitmap_plot::y#2 bitmap_plot::y#0 bitmap_plot::y#1 ] zp[2]:167 [ bitmap_plot::$0 ] reg byte x [ bitmap_plot::$1 ] zp[2]:169 [ bitmap_plot::plotter#1 ] zp[2]:40 [ bitmap_plot::x#2 bitmap_plot::x#0 bitmap_plot::x#1 ] zp[2]:165 [ bitmap_plot::plotter#0 ] -Uplifting [memset] best 30728 combination zp[2]:24 [ memset::dst#2 memset::dst#4 memset::dst#1 ] zp[2]:106 [ memset::end#0 ] reg byte x [ memset::c#4 ] zp[2]:19 [ memset::num#2 ] zp[2]:21 [ memset::str#3 ] -Uplifting [bitmap_init] best 30218 combination zp[2]:5 [ bitmap_init::yoffs#2 bitmap_init::yoffs#4 bitmap_init::yoffs#1 ] reg byte a [ bitmap_init::bits#3 bitmap_init::bits#4 bitmap_init::bits#1 ] reg byte x [ bitmap_init::x#2 bitmap_init::x#1 ] reg byte x [ bitmap_init::y#2 bitmap_init::y#1 ] reg byte a [ bitmap_init::$4 ] zp[1]:68 [ bitmap_init::$5 ] zp[1]:69 [ bitmap_init::$6 ] zp[1]:66 [ bitmap_init::$7 ] +Uplifting [mul16u] best 30983 combination zp[4]:58 [ mul16u::res#2 mul16u::res#6 mul16u::res#1 ] zp[4]:62 [ mul16u::mb#2 mul16u::mb#0 mul16u::mb#1 ] reg byte a [ mul16u::$1 ] zp[2]:56 [ mul16u::a#3 mul16u::a#6 mul16u::a#1 mul16u::a#2 mul16u::a#0 ] zp[2]:54 [ mul16u::b#2 mul16u::b#1 ] zp[4]:176 [ mul16u::return#3 ] zp[4]:152 [ mul16u::return#2 ] +Uplifting [wrap_y] best 30800 combination zp[2]:37 [ wrap_y::y#6 wrap_y::y#4 wrap_y::y#9 wrap_y::y#0 wrap_y::y#1 wrap_y::y#2 wrap_y::y#3 ] reg byte a [ wrap_y::return#2 ] reg byte a [ wrap_y::return#0 ] reg byte a [ wrap_y::return#1 ] +Uplifting [divr16u] best 30590 combination zp[2]:42 [ divr16u::rem#5 divr16u::rem#10 divr16u::rem#4 divr16u::rem#11 divr16u::rem#6 divr16u::rem#0 divr16u::rem#1 divr16u::rem#2 ] zp[2]:46 [ divr16u::quotient#3 divr16u::return#0 divr16u::quotient#1 divr16u::quotient#2 ] reg byte a [ divr16u::$1 ] reg byte a [ divr16u::$2 ] reg byte x [ divr16u::i#2 divr16u::i#1 ] zp[2]:44 [ divr16u::dividend#3 divr16u::dividend#5 divr16u::dividend#0 ] zp[2]:108 [ divr16u::return#2 ] zp[2]:112 [ divr16u::return#3 ] +Uplifting [mulu16_sel] best 30572 combination zp[2]:49 [ mulu16_sel::v1#5 mulu16_sel::v1#4 mulu16_sel::v1#0 mulu16_sel::v1#1 mulu16_sel::v1#2 mulu16_sel::v1#3 ] zp[4]:180 [ mulu16_sel::$0 ] zp[4]:184 [ mulu16_sel::$1 ] zp[2]:51 [ mulu16_sel::v2#5 mulu16_sel::v2#4 mulu16_sel::v2#0 mulu16_sel::v2#1 mulu16_sel::v2#3 ] zp[2]:188 [ mulu16_sel::return#12 ] zp[2]:126 [ mulu16_sel::return#0 ] zp[2]:130 [ mulu16_sel::return#1 ] zp[2]:134 [ mulu16_sel::return#2 ] zp[2]:140 [ mulu16_sel::return#10 ] zp[2]:144 [ mulu16_sel::return#11 ] reg byte x [ mulu16_sel::select#5 ] +Uplifting [sin16s] best 30563 combination zp[4]:27 [ sin16s::x#6 sin16s::x#4 sin16s::x#0 sin16s::x#1 sin16s::x#2 ] zp[2]:31 [ sin16s::return#1 sin16s::return#5 sin16s::sinx#1 ] zp[4]:120 [ sin16s::$4 ] zp[2]:128 [ sin16s::x2#0 ] zp[2]:136 [ sin16s::x3_6#0 ] zp[2]:142 [ sin16s::x4#0 ] zp[2]:146 [ sin16s::x5#0 ] zp[2]:148 [ sin16s::x5_128#0 ] zp[2]:132 [ sin16s::x3#0 ] zp[2]:150 [ sin16s::usinx#1 ] zp[2]:124 [ sin16s::x1#0 ] zp[2]:78 [ sin16s::return#0 ] zp[2]:138 [ sin16s::usinx#0 ] reg byte y [ sin16s::isUpper#2 ] +Uplifting [mul16s] best 30563 combination zp[4]:33 [ mul16s::m#4 mul16s::m#1 mul16s::m#0 ] zp[2]:156 [ mul16s::$6 ] zp[2]:158 [ mul16s::$11 ] zp[4]:160 [ mul16s::return#0 ] zp[2]:80 [ mul16s::a#0 ] zp[4]:82 [ mul16s::return#2 ] +Uplifting [bitmap_plot] best 30494 combination reg byte x [ bitmap_plot::y#2 bitmap_plot::y#0 bitmap_plot::y#1 ] zp[2]:167 [ bitmap_plot::$0 ] reg byte x [ bitmap_plot::$1 ] zp[2]:169 [ bitmap_plot::plotter#1 ] zp[2]:40 [ bitmap_plot::x#2 bitmap_plot::x#0 bitmap_plot::x#1 ] zp[2]:165 [ bitmap_plot::plotter#0 ] +Uplifting [memset] best 30478 combination zp[2]:24 [ memset::dst#2 memset::dst#4 memset::dst#1 ] zp[2]:106 [ memset::end#0 ] reg byte x [ memset::c#4 ] zp[2]:19 [ memset::num#2 ] zp[2]:21 [ memset::str#3 ] +Uplifting [bitmap_init] best 29968 combination zp[2]:5 [ bitmap_init::yoffs#2 bitmap_init::yoffs#4 bitmap_init::yoffs#1 ] reg byte a [ bitmap_init::bits#3 bitmap_init::bits#4 bitmap_init::bits#1 ] reg byte x [ bitmap_init::x#2 bitmap_init::x#1 ] reg byte x [ bitmap_init::y#2 bitmap_init::y#1 ] reg byte a [ bitmap_init::$4 ] zp[1]:68 [ bitmap_init::$5 ] zp[1]:69 [ bitmap_init::$6 ] zp[1]:66 [ bitmap_init::$7 ] Limited combination testing to 100 combinations of 15360 possible. -Uplifting [render_sine] best 30138 combination zp[2]:17 [ render_sine::xpos#3 render_sine::xpos#9 render_sine::xpos#1 ] zp[2]:15 [ render_sine::sin_idx#2 render_sine::sin_idx#1 ] zp[2]:94 [ render_sine::$1 ] zp[2]:96 [ render_sine::sin_val#0 ] zp[2]:100 [ render_sine::$4 ] zp[2]:102 [ render_sine::sin2_val#0 ] reg byte x [ render_sine::ypos#0 ] reg byte x [ render_sine::ypos2#0 ] zp[2]:92 [ render_sine::$11 ] -Uplifting [sin16s_gen2] best 30138 combination zp[2]:7 [ sin16s_gen2::i#2 sin16s_gen2::i#1 ] zp[4]:86 [ sin16s_gen2::$6 ] zp[4]:9 [ sin16s_gen2::x#2 sin16s_gen2::x#1 ] zp[2]:90 [ sin16s_gen2::$8 ] zp[2]:13 [ sin16s_gen2::sintab#2 sin16s_gen2::sintab#0 ] zp[4]:74 [ sin16s_gen2::step#0 ] -Uplifting [div32u16u] best 30138 combination zp[2]:114 [ div32u16u::quotient_lo#0 ] zp[2]:110 [ div32u16u::quotient_hi#0 ] zp[4]:116 [ div32u16u::return#0 ] zp[4]:70 [ div32u16u::return#2 ] -Uplifting [] best 30138 combination zp[2]:174 [ rem16u#0 ] -Uplifting [MOS6526_CIA] best 30138 combination -Uplifting [MOS6569_VICII] best 30138 combination -Uplifting [MOS6581_SID] best 30138 combination -Uplifting [bitmap_clear] best 30138 combination -Uplifting [main] best 30138 combination +Uplifting [render_sine] best 29888 combination zp[2]:17 [ render_sine::xpos#3 render_sine::xpos#9 render_sine::xpos#1 ] zp[2]:15 [ render_sine::sin_idx#2 render_sine::sin_idx#1 ] zp[2]:94 [ render_sine::$1 ] zp[2]:96 [ render_sine::sin_val#0 ] zp[2]:100 [ render_sine::$4 ] zp[2]:102 [ render_sine::sin2_val#0 ] reg byte x [ render_sine::ypos#0 ] reg byte x [ render_sine::ypos2#0 ] zp[2]:92 [ render_sine::$11 ] +Uplifting [sin16s_gen2] best 29888 combination zp[2]:7 [ sin16s_gen2::i#2 sin16s_gen2::i#1 ] zp[4]:86 [ sin16s_gen2::$6 ] zp[4]:9 [ sin16s_gen2::x#2 sin16s_gen2::x#1 ] zp[2]:90 [ sin16s_gen2::$8 ] zp[2]:13 [ sin16s_gen2::sintab#2 sin16s_gen2::sintab#0 ] zp[4]:74 [ sin16s_gen2::step#0 ] +Uplifting [div32u16u] best 29888 combination zp[2]:114 [ div32u16u::quotient_lo#0 ] zp[2]:110 [ div32u16u::quotient_hi#0 ] zp[4]:116 [ div32u16u::return#0 ] zp[4]:70 [ div32u16u::return#2 ] +Uplifting [] best 29888 combination zp[2]:174 [ rem16u#0 ] +Uplifting [MOS6526_CIA] best 29888 combination +Uplifting [MOS6569_VICII] best 29888 combination +Uplifting [MOS6581_SID] best 29888 combination +Uplifting [bitmap_clear] best 29888 combination +Uplifting [main] best 29888 combination Attempting to uplift remaining variables inzp[1]:68 [ bitmap_init::$5 ] -Uplifting [bitmap_init] best 30078 combination reg byte a [ bitmap_init::$5 ] +Uplifting [bitmap_init] best 29828 combination reg byte a [ bitmap_init::$5 ] Attempting to uplift remaining variables inzp[1]:69 [ bitmap_init::$6 ] -Uplifting [bitmap_init] best 30018 combination reg byte a [ bitmap_init::$6 ] +Uplifting [bitmap_init] best 29768 combination reg byte a [ bitmap_init::$6 ] Attempting to uplift remaining variables inzp[1]:66 [ bitmap_init::$7 ] -Uplifting [bitmap_init] best 30018 combination zp[1]:66 [ bitmap_init::$7 ] +Uplifting [bitmap_init] best 29768 combination zp[1]:66 [ bitmap_init::$7 ] Coalescing zero page register [ zp[2]:17 [ render_sine::xpos#3 render_sine::xpos#9 render_sine::xpos#1 ] ] with [ zp[2]:40 [ bitmap_plot::x#2 bitmap_plot::x#0 bitmap_plot::x#1 ] ] - score: 2 Coalescing zero page register [ zp[2]:31 [ sin16s::return#1 sin16s::return#5 sin16s::sinx#1 ] ] with [ zp[2]:150 [ sin16s::usinx#1 ] ] - score: 2 Coalescing zero page register [ zp[2]:42 [ divr16u::rem#5 divr16u::rem#10 divr16u::rem#4 divr16u::rem#11 divr16u::rem#6 divr16u::rem#0 divr16u::rem#1 divr16u::rem#2 ] ] with [ zp[2]:174 [ rem16u#0 ] ] - score: 2 @@ -5363,8 +5363,7 @@ mul16u: { __b1: // [208] if(mul16u::a#3!=0) goto mul16u::@2 -- vwuz1_neq_0_then_la1 lda.z a - bne __b2 - lda.z a+1 + ora.z a+1 bne __b2 jmp __breturn // mul16u::@return @@ -5998,7 +5997,7 @@ reg byte a [ mul16u::$1 ] FINAL ASSEMBLER -Score: 24804 +Score: 24554 // File Comments // Generate a big sine and plot it on a bitmap @@ -7327,8 +7326,7 @@ mul16u: { // while(a!=0) // [208] if(mul16u::a#3!=0) goto mul16u::@2 -- vwuz1_neq_0_then_la1 lda.z a - bne __b2 - lda.z a+1 + ora.z a+1 bne __b2 // mul16u::@return // } diff --git a/src/test/ref/forrangedwords.asm b/src/test/ref/forrangedwords.asm index 76aad721a..cd75cd2d3 100644 --- a/src/test/ref/forrangedwords.asm +++ b/src/test/ref/forrangedwords.asm @@ -23,8 +23,7 @@ main: { inc.z w+1 !: lda.z w - bne __b1 - lda.z w+1 + ora.z w+1 bne __b1 lda #<-$7fff sta.z sw diff --git a/src/test/ref/forrangedwords.log b/src/test/ref/forrangedwords.log index 87108ea60..64351727e 100644 --- a/src/test/ref/forrangedwords.log +++ b/src/test/ref/forrangedwords.log @@ -204,9 +204,9 @@ REGISTER UPLIFT SCOPES Uplift Scope [main] 25.3: zp[2]:2 [ main::w#2 main::w#1 ] 25.3: zp[2]:4 [ main::sw#2 main::sw#1 ] 22: zp[1]:6 [ main::$0 ] 22: zp[1]:7 [ main::$1 ] 22: zp[1]:8 [ main::$3 ] 22: zp[1]:9 [ main::$4 ] Uplift Scope [] -Uplifting [main] best 1146 combination zp[2]:2 [ main::w#2 main::w#1 ] zp[2]:4 [ main::sw#2 main::sw#1 ] reg byte a [ main::$0 ] reg byte a [ main::$1 ] reg byte a [ main::$3 ] reg byte a [ main::$4 ] +Uplifting [main] best 1121 combination zp[2]:2 [ main::w#2 main::w#1 ] zp[2]:4 [ main::sw#2 main::sw#1 ] reg byte a [ main::$0 ] reg byte a [ main::$1 ] reg byte a [ main::$3 ] reg byte a [ main::$4 ] Limited combination testing to 100 combinations of 256 possible. -Uplifting [] best 1146 combination +Uplifting [] best 1121 combination ASSEMBLER BEFORE OPTIMIZATION // File Comments @@ -249,8 +249,7 @@ main: { !: // [7] if(main::w#1!=0) goto main::@1 -- vwuz1_neq_0_then_la1 lda.z w - bne __b1_from___b1 - lda.z w+1 + ora.z w+1 bne __b1_from___b1 // [8] phi from main::@1 to main::@2 [phi:main::@1->main::@2] __b2_from___b1: @@ -302,7 +301,6 @@ Succesful ASM optimization Pass5NextJumpElimination Removing instruction lda #>0 Succesful ASM optimization Pass5UnnecesaryLoadElimination Replacing label __b1_from___b1 with __b1 -Replacing label __b1_from___b1 with __b1 Replacing label __b2_from___b2 with __b2 Replacing label __b2_from___b2 with __b2 Removing instruction __b1_from___b1: @@ -339,7 +337,7 @@ reg byte a [ main::$4 ] FINAL ASSEMBLER -Score: 976 +Score: 951 // File Comments // Upstart @@ -381,8 +379,7 @@ main: { !: // [7] if(main::w#1!=0) goto main::@1 -- vwuz1_neq_0_then_la1 lda.z w - bne __b1 - lda.z w+1 + ora.z w+1 bne __b1 // [8] phi from main::@1 to main::@2 [phi:main::@1->main::@2] // [8] phi main::sw#2 = -$7fff [phi:main::@1->main::@2#0] -- vwsz1=vwsc1 diff --git a/src/test/ref/loophead-problem-3.asm b/src/test/ref/loophead-problem-3.asm index 6d8f816b2..3e8f80467 100644 --- a/src/test/ref/loophead-problem-3.asm +++ b/src/test/ref/loophead-problem-3.asm @@ -58,8 +58,7 @@ mul16u: { __b1: // while(a!=0) lda.z a - bne __b2 - lda.z a+1 + ora.z a+1 bne __b2 // } rts diff --git a/src/test/ref/loophead-problem-3.log b/src/test/ref/loophead-problem-3.log index cc5611821..fba3dcd31 100644 --- a/src/test/ref/loophead-problem-3.log +++ b/src/test/ref/loophead-problem-3.log @@ -353,12 +353,12 @@ Uplift Scope [MOS6569_VICII] Uplift Scope [MOS6581_SID] Uplift Scope [] -Uplifting [mul16u] best 1645 combination zp[4]:4 [ mul16u::res#2 mul16u::res#6 mul16u::res#1 ] zp[4]:8 [ mul16u::mb#2 mul16u::mb#1 ] reg byte a [ mul16u::$1 ] zp[2]:2 [ mul16u::a#2 mul16u::a#0 ] zp[4]:12 [ mul16u::return#2 ] -Uplifting [main] best 1633 combination zp[4]:16 [ main::result#0 ] reg byte a [ main::$2 ] reg byte a [ main::$3 ] zp[2]:20 [ main::kaputt#0 ] -Uplifting [MOS6526_CIA] best 1633 combination -Uplifting [MOS6569_VICII] best 1633 combination -Uplifting [MOS6581_SID] best 1633 combination -Uplifting [] best 1633 combination +Uplifting [mul16u] best 1620 combination zp[4]:4 [ mul16u::res#2 mul16u::res#6 mul16u::res#1 ] zp[4]:8 [ mul16u::mb#2 mul16u::mb#1 ] reg byte a [ mul16u::$1 ] zp[2]:2 [ mul16u::a#2 mul16u::a#0 ] zp[4]:12 [ mul16u::return#2 ] +Uplifting [main] best 1608 combination zp[4]:16 [ main::result#0 ] reg byte a [ main::$2 ] reg byte a [ main::$3 ] zp[2]:20 [ main::kaputt#0 ] +Uplifting [MOS6526_CIA] best 1608 combination +Uplifting [MOS6569_VICII] best 1608 combination +Uplifting [MOS6581_SID] best 1608 combination +Uplifting [] best 1608 combination Coalescing zero page register [ zp[4]:4 [ mul16u::res#2 mul16u::res#6 mul16u::res#1 ] ] with [ zp[4]:12 [ mul16u::return#2 ] ] - score: 1 Coalescing zero page register [ zp[4]:4 [ mul16u::res#2 mul16u::res#6 mul16u::res#1 mul16u::return#2 ] ] with [ zp[4]:16 [ main::result#0 ] ] - score: 1 Coalescing zero page register [ zp[2]:20 [ main::kaputt#0 ] ] with [ zp[2]:2 [ mul16u::a#2 mul16u::a#0 ] ] @@ -448,8 +448,7 @@ mul16u: { __b1: // [12] if(mul16u::a#2!=0) goto mul16u::@2 -- vwuz1_neq_0_then_la1 lda.z a - bne __b2 - lda.z a+1 + ora.z a+1 bne __b2 jmp __breturn // mul16u::@return @@ -564,7 +563,7 @@ reg byte a [ mul16u::$1 ] FINAL ASSEMBLER -Score: 1439 +Score: 1414 // File Comments // Program where loop-head optimization produces wrong return value @@ -649,8 +648,7 @@ mul16u: { // while(a!=0) // [12] if(mul16u::a#2!=0) goto mul16u::@2 -- vwuz1_neq_0_then_la1 lda.z a - bne __b2 - lda.z a+1 + ora.z a+1 bne __b2 // mul16u::@return // } diff --git a/src/test/ref/plasma-center.asm b/src/test/ref/plasma-center.asm index f2a08c062..d916cc125 100644 --- a/src/test/ref/plasma-center.asm +++ b/src/test/ref/plasma-center.asm @@ -807,8 +807,7 @@ atan2_16: { __b10: // if(yi==0) lda.z yi+1 - bne __b11 - lda.z yi + ora.z yi bne __b11 __b12: // angle /=2 @@ -1063,8 +1062,7 @@ bsearch16u: { sbc (pivot),y sta.z result+1 // if (result == 0) - bne __b6 - lda.z result + ora.z result bne __b6 lda.z pivot sta.z return diff --git a/src/test/ref/plasma-center.log b/src/test/ref/plasma-center.log index 9a290c176..48147f5dc 100644 --- a/src/test/ref/plasma-center.log +++ b/src/test/ref/plasma-center.log @@ -5448,70 +5448,70 @@ Uplift Scope [print_cls] Uplift Scope [main] Uplift Scope [__start] -Uplifting [bsearch16u] best 1496220 combination reg byte x [ bsearch16u::num#5 bsearch16u::num#1 bsearch16u::num#3 bsearch16u::num#0 ] zp[2]:64 [ bsearch16u::return#1 bsearch16u::return#2 bsearch16u::items#2 bsearch16u::items#1 bsearch16u::items#8 bsearch16u::$2 bsearch16u::return#7 bsearch16u::items#0 ] reg byte a [ bsearch16u::$6 ] reg byte a [ bsearch16u::$14 ] zp[2]:154 [ bsearch16u::result#0 ] zp[2]:152 [ bsearch16u::pivot#0 ] zp[2]:139 [ bsearch16u::return#3 ] zp[2]:137 [ bsearch16u::key#0 ] -Uplifting [atan2_16] best 1382220 combination reg byte y [ atan2_16::shift#2 atan2_16::shift#5 atan2_16::shift#1 ] zp[2]:60 [ atan2_16::yd#5 atan2_16::yd#3 atan2_16::yd#10 atan2_16::yd#1 atan2_16::yd#2 ] zp[2]:62 [ atan2_16::xd#5 atan2_16::xd#3 atan2_16::xd#10 atan2_16::xd#1 atan2_16::xd#2 ] zp[2]:55 [ atan2_16::angle#6 atan2_16::angle#12 atan2_16::angle#13 atan2_16::angle#2 atan2_16::angle#3 ] zp[2]:50 [ atan2_16::yi#3 atan2_16::yi#8 atan2_16::yi#0 atan2_16::yi#16 atan2_16::$2 atan2_16::yi#1 atan2_16::yi#2 ] zp[2]:52 [ atan2_16::xi#3 atan2_16::xi#8 atan2_16::xi#0 atan2_16::xi#13 atan2_16::$7 atan2_16::xi#1 atan2_16::xi#2 ] reg byte a [ atan2_16::$23 ] reg byte a [ atan2_16::$22 ] reg byte x [ atan2_16::i#2 atan2_16::i#1 ] zp[2]:57 [ atan2_16::return#0 atan2_16::angle#11 atan2_16::angle#1 atan2_16::angle#4 atan2_16::angle#5 ] zp[2]:102 [ atan2_16::return#2 ] zp[2]:98 [ atan2_16::x#0 ] zp[2]:100 [ atan2_16::y#0 ] +Uplifting [bsearch16u] best 1491220 combination reg byte x [ bsearch16u::num#5 bsearch16u::num#1 bsearch16u::num#3 bsearch16u::num#0 ] zp[2]:64 [ bsearch16u::return#1 bsearch16u::return#2 bsearch16u::items#2 bsearch16u::items#1 bsearch16u::items#8 bsearch16u::$2 bsearch16u::return#7 bsearch16u::items#0 ] reg byte a [ bsearch16u::$6 ] reg byte a [ bsearch16u::$14 ] zp[2]:154 [ bsearch16u::result#0 ] zp[2]:152 [ bsearch16u::pivot#0 ] zp[2]:139 [ bsearch16u::return#3 ] zp[2]:137 [ bsearch16u::key#0 ] +Uplifting [atan2_16] best 1377220 combination reg byte y [ atan2_16::shift#2 atan2_16::shift#5 atan2_16::shift#1 ] zp[2]:60 [ atan2_16::yd#5 atan2_16::yd#3 atan2_16::yd#10 atan2_16::yd#1 atan2_16::yd#2 ] zp[2]:62 [ atan2_16::xd#5 atan2_16::xd#3 atan2_16::xd#10 atan2_16::xd#1 atan2_16::xd#2 ] zp[2]:55 [ atan2_16::angle#6 atan2_16::angle#12 atan2_16::angle#13 atan2_16::angle#2 atan2_16::angle#3 ] zp[2]:50 [ atan2_16::yi#3 atan2_16::yi#8 atan2_16::yi#0 atan2_16::yi#16 atan2_16::$2 atan2_16::yi#1 atan2_16::yi#2 ] zp[2]:52 [ atan2_16::xi#3 atan2_16::xi#8 atan2_16::xi#0 atan2_16::xi#13 atan2_16::$7 atan2_16::xi#1 atan2_16::xi#2 ] reg byte a [ atan2_16::$23 ] reg byte a [ atan2_16::$22 ] reg byte x [ atan2_16::i#2 atan2_16::i#1 ] zp[2]:57 [ atan2_16::return#0 atan2_16::angle#11 atan2_16::angle#1 atan2_16::angle#4 atan2_16::angle#5 ] zp[2]:102 [ atan2_16::return#2 ] zp[2]:98 [ atan2_16::x#0 ] zp[2]:100 [ atan2_16::y#0 ] Limited combination testing to 100 combinations of 144 possible. -Uplifting [doplasma] best 1371220 combination reg byte x [ doplasma::x#2 doplasma::x#1 ] reg byte a [ doplasma::$2 ] zp[2]:40 [ doplasma::screen#5 doplasma::screen#6 doplasma::screen#2 ] zp[2]:36 [ doplasma::angle#4 doplasma::angle#0 doplasma::angle#1 ] zp[2]:38 [ doplasma::dist#4 doplasma::dist#0 doplasma::dist#1 ] zp[1]:42 [ doplasma::y#4 doplasma::y#1 ] zp[2]:127 [ doplasma::sin_y#0 ] zp[2]:125 [ doplasma::sin_x#0 ] -Uplifting [make_plasma_charset] best 1348120 combination reg byte y [ make_plasma_charset::b#2 make_plasma_charset::b#6 make_plasma_charset::b#1 ] reg byte x [ make_plasma_charset::ii#2 make_plasma_charset::ii#1 ] reg byte a [ make_plasma_charset::sid_rnd1_return#0 ] zp[1]:122 [ make_plasma_charset::$7 ] zp[1]:26 [ make_plasma_charset::i#2 make_plasma_charset::i#1 ] zp[2]:115 [ make_plasma_charset::$10 ] zp[2]:117 [ make_plasma_charset::$11 ] zp[2]:119 [ make_plasma_charset::$16 ] zp[1]:113 [ make_plasma_charset::s#0 ] zp[2]:22 [ make_plasma_charset::c#2 make_plasma_charset::c#1 ] zp[1]:112 [ make_plasma_charset::$3 ] zp[1]:114 [ make_plasma_charset::$12 ] +Uplifting [doplasma] best 1366220 combination reg byte x [ doplasma::x#2 doplasma::x#1 ] reg byte a [ doplasma::$2 ] zp[2]:40 [ doplasma::screen#5 doplasma::screen#6 doplasma::screen#2 ] zp[2]:36 [ doplasma::angle#4 doplasma::angle#0 doplasma::angle#1 ] zp[2]:38 [ doplasma::dist#4 doplasma::dist#0 doplasma::dist#1 ] zp[1]:42 [ doplasma::y#4 doplasma::y#1 ] zp[2]:127 [ doplasma::sin_y#0 ] zp[2]:125 [ doplasma::sin_x#0 ] +Uplifting [make_plasma_charset] best 1343120 combination reg byte y [ make_plasma_charset::b#2 make_plasma_charset::b#6 make_plasma_charset::b#1 ] reg byte x [ make_plasma_charset::ii#2 make_plasma_charset::ii#1 ] reg byte a [ make_plasma_charset::sid_rnd1_return#0 ] zp[1]:122 [ make_plasma_charset::$7 ] zp[1]:26 [ make_plasma_charset::i#2 make_plasma_charset::i#1 ] zp[2]:115 [ make_plasma_charset::$10 ] zp[2]:117 [ make_plasma_charset::$11 ] zp[2]:119 [ make_plasma_charset::$16 ] zp[1]:113 [ make_plasma_charset::s#0 ] zp[2]:22 [ make_plasma_charset::c#2 make_plasma_charset::c#1 ] zp[1]:112 [ make_plasma_charset::$3 ] zp[1]:114 [ make_plasma_charset::$12 ] Limited combination testing to 100 combinations of 9216 possible. -Uplifting [sqrt] best 1347217 combination zp[2]:141 [ sqrt::found#0 ] zp[2]:143 [ sqrt::$2 ] zp[2]:87 [ sqrt::val#0 ] zp[2]:145 [ sqrt::$1 ] reg byte a [ sqrt::return#0 ] reg byte a [ sqrt::return#2 ] -Uplifting [memset] best 1347201 combination zp[2]:32 [ memset::dst#2 memset::dst#4 memset::dst#1 ] zp[2]:123 [ memset::end#0 ] reg byte x [ memset::c#4 ] zp[2]:29 [ memset::str#3 ] -Uplifting [sqr] best 1346864 combination reg byte a [ sqr::$0 ] reg byte a [ sqr::val#2 sqr::val#1 sqr::val#0 ] zp[2]:135 [ sqr::return#0 ] zp[2]:81 [ sqr::return#3 ] zp[2]:76 [ sqr::return#2 ] -Uplifting [init_angle_screen] best 1345264 combination zp[1]:21 [ init_angle_screen::xb#2 init_angle_screen::xb#1 ] reg byte a [ init_angle_screen::$3 ] reg byte a [ init_angle_screen::$4 ] reg byte a [ init_angle_screen::$5 ] zp[2]:104 [ init_angle_screen::angle_w#0 ] zp[2]:106 [ init_angle_screen::$7 ] zp[1]:109 [ init_angle_screen::$9 ] zp[1]:110 [ init_angle_screen::$10 ] zp[1]:111 [ init_angle_screen::$11 ] zp[1]:20 [ init_angle_screen::x#2 init_angle_screen::x#1 ] zp[1]:108 [ init_angle_screen::ang_w#0 ] zp[2]:96 [ init_angle_screen::yw#0 ] zp[2]:93 [ init_angle_screen::xw#0 ] zp[1]:15 [ init_angle_screen::y#5 init_angle_screen::y#1 ] zp[2]:18 [ init_angle_screen::screen_bottomline#6 init_angle_screen::screen_bottomline#0 init_angle_screen::screen_bottomline#1 ] zp[2]:16 [ init_angle_screen::screen_topline#6 init_angle_screen::screen_topline#7 init_angle_screen::screen_topline#1 ] zp[2]:73 [ init_angle_screen::screen#0 ] +Uplifting [sqrt] best 1342217 combination zp[2]:141 [ sqrt::found#0 ] zp[2]:143 [ sqrt::$2 ] zp[2]:87 [ sqrt::val#0 ] zp[2]:145 [ sqrt::$1 ] reg byte a [ sqrt::return#0 ] reg byte a [ sqrt::return#2 ] +Uplifting [memset] best 1342201 combination zp[2]:32 [ memset::dst#2 memset::dst#4 memset::dst#1 ] zp[2]:123 [ memset::end#0 ] reg byte x [ memset::c#4 ] zp[2]:29 [ memset::str#3 ] +Uplifting [sqr] best 1341864 combination reg byte a [ sqr::$0 ] reg byte a [ sqr::val#2 sqr::val#1 sqr::val#0 ] zp[2]:135 [ sqr::return#0 ] zp[2]:81 [ sqr::return#3 ] zp[2]:76 [ sqr::return#2 ] +Uplifting [init_angle_screen] best 1340264 combination zp[1]:21 [ init_angle_screen::xb#2 init_angle_screen::xb#1 ] reg byte a [ init_angle_screen::$3 ] reg byte a [ init_angle_screen::$4 ] reg byte a [ init_angle_screen::$5 ] zp[2]:104 [ init_angle_screen::angle_w#0 ] zp[2]:106 [ init_angle_screen::$7 ] zp[1]:109 [ init_angle_screen::$9 ] zp[1]:110 [ init_angle_screen::$10 ] zp[1]:111 [ init_angle_screen::$11 ] zp[1]:20 [ init_angle_screen::x#2 init_angle_screen::x#1 ] zp[1]:108 [ init_angle_screen::ang_w#0 ] zp[2]:96 [ init_angle_screen::yw#0 ] zp[2]:93 [ init_angle_screen::xw#0 ] zp[1]:15 [ init_angle_screen::y#5 init_angle_screen::y#1 ] zp[2]:18 [ init_angle_screen::screen_bottomline#6 init_angle_screen::screen_bottomline#0 init_angle_screen::screen_bottomline#1 ] zp[2]:16 [ init_angle_screen::screen_topline#6 init_angle_screen::screen_topline#7 init_angle_screen::screen_topline#1 ] zp[2]:73 [ init_angle_screen::screen#0 ] Limited combination testing to 100 combinations of 65536 possible. -Uplifting [init_dist_screen] best 1342064 combination reg byte a [ init_dist_screen::xd#0 init_dist_screen::$16 init_dist_screen::$14 ] zp[1]:13 [ init_dist_screen::xb#2 init_dist_screen::xb#1 ] reg byte a [ init_dist_screen::x2#0 ] zp[2]:83 [ init_dist_screen::xds#0 ] zp[2]:85 [ init_dist_screen::ds#0 ] zp[1]:12 [ init_dist_screen::x#2 init_dist_screen::x#1 ] reg byte a [ init_dist_screen::d#0 ] zp[1]:11 [ init_dist_screen::yd#0 init_dist_screen::$7 init_dist_screen::$5 ] zp[1]:75 [ init_dist_screen::y2#0 ] zp[1]:6 [ init_dist_screen::y#10 init_dist_screen::y#1 ] zp[2]:9 [ init_dist_screen::screen_bottomline#11 init_dist_screen::screen_bottomline#0 init_dist_screen::screen_bottomline#1 ] zp[2]:7 [ init_dist_screen::screen_topline#11 init_dist_screen::screen#0 init_dist_screen::screen_topline#1 ] zp[2]:78 [ init_dist_screen::yds#0 ] +Uplifting [init_dist_screen] best 1337064 combination reg byte a [ init_dist_screen::xd#0 init_dist_screen::$16 init_dist_screen::$14 ] zp[1]:13 [ init_dist_screen::xb#2 init_dist_screen::xb#1 ] reg byte a [ init_dist_screen::x2#0 ] zp[2]:83 [ init_dist_screen::xds#0 ] zp[2]:85 [ init_dist_screen::ds#0 ] zp[1]:12 [ init_dist_screen::x#2 init_dist_screen::x#1 ] reg byte a [ init_dist_screen::d#0 ] zp[1]:11 [ init_dist_screen::yd#0 init_dist_screen::$7 init_dist_screen::$5 ] zp[1]:75 [ init_dist_screen::y2#0 ] zp[1]:6 [ init_dist_screen::y#10 init_dist_screen::y#1 ] zp[2]:9 [ init_dist_screen::screen_bottomline#11 init_dist_screen::screen_bottomline#0 init_dist_screen::screen_bottomline#1 ] zp[2]:7 [ init_dist_screen::screen_topline#11 init_dist_screen::screen#0 init_dist_screen::screen_topline#1 ] zp[2]:78 [ init_dist_screen::yds#0 ] Limited combination testing to 100 combinations of 6144 possible. -Uplifting [init_squares] best 1341864 combination reg byte x [ init_squares::i#2 init_squares::i#1 ] reg byte a [ init_squares::$3 ] reg byte a [ init_squares::$4 ] zp[2]:47 [ init_squares::squares#2 init_squares::squares#1 init_squares::squares#0 ] zp[2]:45 [ init_squares::sqr#2 init_squares::sqr#1 ] -Uplifting [] best 1341864 combination zp[2]:2 [ heap_head#13 heap_head#0 ] zp[2]:24 [ print_char_cursor#19 print_char_cursor#32 print_char_cursor#0 ] zp[1]:35 [ sin_offset_y#11 sin_offset_y#10 sin_offset_y#13 ] zp[1]:34 [ sin_offset_x#11 sin_offset_x#10 sin_offset_x#13 ] zp[2]:130 [ SQUARES#0 ] zp[2]:69 [ SCREEN_ANGLE#0 ] zp[2]:67 [ SCREEN_DIST#0 ] -Uplifting [malloc] best 1341864 combination zp[2]:4 [ malloc::size#3 ] zp[2]:71 [ malloc::mem#0 ] -Uplifting [MOS6526_CIA] best 1341864 combination -Uplifting [MOS6569_VICII] best 1341864 combination -Uplifting [MOS6581_SID] best 1341864 combination -Uplifting [RADIX] best 1341864 combination -Uplifting [print_char] best 1341864 combination -Uplifting [print_cls] best 1341864 combination -Uplifting [main] best 1341864 combination -Uplifting [__start] best 1341864 combination +Uplifting [init_squares] best 1336864 combination reg byte x [ init_squares::i#2 init_squares::i#1 ] reg byte a [ init_squares::$3 ] reg byte a [ init_squares::$4 ] zp[2]:47 [ init_squares::squares#2 init_squares::squares#1 init_squares::squares#0 ] zp[2]:45 [ init_squares::sqr#2 init_squares::sqr#1 ] +Uplifting [] best 1336864 combination zp[2]:2 [ heap_head#13 heap_head#0 ] zp[2]:24 [ print_char_cursor#19 print_char_cursor#32 print_char_cursor#0 ] zp[1]:35 [ sin_offset_y#11 sin_offset_y#10 sin_offset_y#13 ] zp[1]:34 [ sin_offset_x#11 sin_offset_x#10 sin_offset_x#13 ] zp[2]:130 [ SQUARES#0 ] zp[2]:69 [ SCREEN_ANGLE#0 ] zp[2]:67 [ SCREEN_DIST#0 ] +Uplifting [malloc] best 1336864 combination zp[2]:4 [ malloc::size#3 ] zp[2]:71 [ malloc::mem#0 ] +Uplifting [MOS6526_CIA] best 1336864 combination +Uplifting [MOS6569_VICII] best 1336864 combination +Uplifting [MOS6581_SID] best 1336864 combination +Uplifting [RADIX] best 1336864 combination +Uplifting [print_char] best 1336864 combination +Uplifting [print_cls] best 1336864 combination +Uplifting [main] best 1336864 combination +Uplifting [__start] best 1336864 combination Attempting to uplift remaining variables inzp[1]:122 [ make_plasma_charset::$7 ] -Uplifting [make_plasma_charset] best 1341864 combination zp[1]:122 [ make_plasma_charset::$7 ] +Uplifting [make_plasma_charset] best 1336864 combination zp[1]:122 [ make_plasma_charset::$7 ] Attempting to uplift remaining variables inzp[1]:42 [ doplasma::y#4 doplasma::y#1 ] -Uplifting [doplasma] best 1341864 combination zp[1]:42 [ doplasma::y#4 doplasma::y#1 ] +Uplifting [doplasma] best 1336864 combination zp[1]:42 [ doplasma::y#4 doplasma::y#1 ] Attempting to uplift remaining variables inzp[1]:26 [ make_plasma_charset::i#2 make_plasma_charset::i#1 ] -Uplifting [make_plasma_charset] best 1341864 combination zp[1]:26 [ make_plasma_charset::i#2 make_plasma_charset::i#1 ] +Uplifting [make_plasma_charset] best 1336864 combination zp[1]:26 [ make_plasma_charset::i#2 make_plasma_charset::i#1 ] Attempting to uplift remaining variables inzp[1]:13 [ init_dist_screen::xb#2 init_dist_screen::xb#1 ] -Uplifting [init_dist_screen] best 1341864 combination zp[1]:13 [ init_dist_screen::xb#2 init_dist_screen::xb#1 ] +Uplifting [init_dist_screen] best 1336864 combination zp[1]:13 [ init_dist_screen::xb#2 init_dist_screen::xb#1 ] Attempting to uplift remaining variables inzp[1]:21 [ init_angle_screen::xb#2 init_angle_screen::xb#1 ] -Uplifting [init_angle_screen] best 1341864 combination zp[1]:21 [ init_angle_screen::xb#2 init_angle_screen::xb#1 ] +Uplifting [init_angle_screen] best 1336864 combination zp[1]:21 [ init_angle_screen::xb#2 init_angle_screen::xb#1 ] Attempting to uplift remaining variables inzp[1]:109 [ init_angle_screen::$9 ] -Uplifting [init_angle_screen] best 1341264 combination reg byte a [ init_angle_screen::$9 ] +Uplifting [init_angle_screen] best 1336264 combination reg byte a [ init_angle_screen::$9 ] Attempting to uplift remaining variables inzp[1]:110 [ init_angle_screen::$10 ] -Uplifting [init_angle_screen] best 1340864 combination reg byte a [ init_angle_screen::$10 ] +Uplifting [init_angle_screen] best 1335864 combination reg byte a [ init_angle_screen::$10 ] Attempting to uplift remaining variables inzp[1]:111 [ init_angle_screen::$11 ] -Uplifting [init_angle_screen] best 1340264 combination reg byte a [ init_angle_screen::$11 ] +Uplifting [init_angle_screen] best 1335264 combination reg byte a [ init_angle_screen::$11 ] Attempting to uplift remaining variables inzp[1]:12 [ init_dist_screen::x#2 init_dist_screen::x#1 ] -Uplifting [init_dist_screen] best 1340264 combination zp[1]:12 [ init_dist_screen::x#2 init_dist_screen::x#1 ] +Uplifting [init_dist_screen] best 1335264 combination zp[1]:12 [ init_dist_screen::x#2 init_dist_screen::x#1 ] Attempting to uplift remaining variables inzp[1]:20 [ init_angle_screen::x#2 init_angle_screen::x#1 ] -Uplifting [init_angle_screen] best 1340264 combination zp[1]:20 [ init_angle_screen::x#2 init_angle_screen::x#1 ] +Uplifting [init_angle_screen] best 1335264 combination zp[1]:20 [ init_angle_screen::x#2 init_angle_screen::x#1 ] Attempting to uplift remaining variables inzp[1]:108 [ init_angle_screen::ang_w#0 ] -Uplifting [init_angle_screen] best 1340264 combination zp[1]:108 [ init_angle_screen::ang_w#0 ] +Uplifting [init_angle_screen] best 1335264 combination zp[1]:108 [ init_angle_screen::ang_w#0 ] Attempting to uplift remaining variables inzp[1]:11 [ init_dist_screen::yd#0 init_dist_screen::$7 init_dist_screen::$5 ] -Uplifting [init_dist_screen] best 1340194 combination reg byte a [ init_dist_screen::yd#0 init_dist_screen::$7 init_dist_screen::$5 ] +Uplifting [init_dist_screen] best 1335194 combination reg byte a [ init_dist_screen::yd#0 init_dist_screen::$7 init_dist_screen::$5 ] Attempting to uplift remaining variables inzp[1]:113 [ make_plasma_charset::s#0 ] -Uplifting [make_plasma_charset] best 1340194 combination zp[1]:113 [ make_plasma_charset::s#0 ] +Uplifting [make_plasma_charset] best 1335194 combination zp[1]:113 [ make_plasma_charset::s#0 ] Attempting to uplift remaining variables inzp[1]:75 [ init_dist_screen::y2#0 ] -Uplifting [init_dist_screen] best 1340094 combination reg byte a [ init_dist_screen::y2#0 ] +Uplifting [init_dist_screen] best 1335094 combination reg byte a [ init_dist_screen::y2#0 ] Attempting to uplift remaining variables inzp[1]:112 [ make_plasma_charset::$3 ] -Uplifting [make_plasma_charset] best 1340034 combination reg byte x [ make_plasma_charset::$3 ] +Uplifting [make_plasma_charset] best 1335034 combination reg byte x [ make_plasma_charset::$3 ] Attempting to uplift remaining variables inzp[1]:114 [ make_plasma_charset::$12 ] -Uplifting [make_plasma_charset] best 1339974 combination reg byte a [ make_plasma_charset::$12 ] +Uplifting [make_plasma_charset] best 1334974 combination reg byte a [ make_plasma_charset::$12 ] Attempting to uplift remaining variables inzp[1]:15 [ init_angle_screen::y#5 init_angle_screen::y#1 ] -Uplifting [init_angle_screen] best 1339974 combination zp[1]:15 [ init_angle_screen::y#5 init_angle_screen::y#1 ] +Uplifting [init_angle_screen] best 1334974 combination zp[1]:15 [ init_angle_screen::y#5 init_angle_screen::y#1 ] Attempting to uplift remaining variables inzp[1]:6 [ init_dist_screen::y#10 init_dist_screen::y#1 ] -Uplifting [init_dist_screen] best 1339974 combination zp[1]:6 [ init_dist_screen::y#10 init_dist_screen::y#1 ] +Uplifting [init_dist_screen] best 1334974 combination zp[1]:6 [ init_dist_screen::y#10 init_dist_screen::y#1 ] Attempting to uplift remaining variables inzp[1]:35 [ sin_offset_y#11 sin_offset_y#10 sin_offset_y#13 ] -Uplifting [] best 1339974 combination zp[1]:35 [ sin_offset_y#11 sin_offset_y#10 sin_offset_y#13 ] +Uplifting [] best 1334974 combination zp[1]:35 [ sin_offset_y#11 sin_offset_y#10 sin_offset_y#13 ] Attempting to uplift remaining variables inzp[1]:34 [ sin_offset_x#11 sin_offset_x#10 sin_offset_x#13 ] -Uplifting [] best 1339974 combination zp[1]:34 [ sin_offset_x#11 sin_offset_x#10 sin_offset_x#13 ] +Uplifting [] best 1334974 combination zp[1]:34 [ sin_offset_x#11 sin_offset_x#10 sin_offset_x#13 ] Coalescing zero page register [ zp[2]:4 [ malloc::size#3 ] ] with [ zp[2]:71 [ malloc::mem#0 ] ] - score: 1 Coalescing zero page register [ zp[2]:18 [ init_angle_screen::screen_bottomline#6 init_angle_screen::screen_bottomline#0 init_angle_screen::screen_bottomline#1 ] ] with [ zp[2]:73 [ init_angle_screen::screen#0 ] ] - score: 1 Coalescing zero page register [ zp[2]:29 [ memset::str#3 ] ] with [ zp[2]:32 [ memset::dst#2 memset::dst#4 memset::dst#1 ] ] - score: 1 @@ -6813,8 +6813,7 @@ atan2_16: { __b10: // [191] if(atan2_16::yi#3!=0) goto atan2_16::@11 -- vwsz1_neq_0_then_la1 lda.z yi+1 - bne __b11 - lda.z yi + ora.z yi bne __b11 // [192] phi from atan2_16::@10 atan2_16::@19 to atan2_16::@12 [phi:atan2_16::@10/atan2_16::@19->atan2_16::@12] __b12_from___b10: @@ -7185,8 +7184,7 @@ bsearch16u: { sta.z result+1 // [245] if(bsearch16u::result#0!=0) goto bsearch16u::@6 -- vwsz1_neq_0_then_la1 lda.z result+1 - bne __b6 - lda.z result + ora.z result bne __b6 jmp __b8 // bsearch16u::@8 @@ -7524,7 +7522,7 @@ Removing instruction jmp __b1 Removing instruction jmp __b1 Removing instruction jmp __b2 Succesful ASM optimization Pass5NextJumpElimination -Fixing long branch [759] beq __b12 to bne +Fixing long branch [758] beq __b12 to bne Fixing long branch [653] bpl __b1 to bmi Fixing long branch [665] bpl __b4 to bmi @@ -7903,7 +7901,7 @@ zp[2]:28 [ bsearch16u::result#0 memset::end#0 atan2_16::xd#5 atan2_16::xd#3 atan FINAL ASSEMBLER -Score: 1208161 +Score: 1203161 // File Comments // Plasma based on the distance/angle to the screen center @@ -9086,8 +9084,7 @@ atan2_16: { // if(yi==0) // [191] if(atan2_16::yi#3!=0) goto atan2_16::@11 -- vwsz1_neq_0_then_la1 lda.z yi+1 - bne __b11 - lda.z yi + ora.z yi bne __b11 // [192] phi from atan2_16::@10 atan2_16::@19 to atan2_16::@12 [phi:atan2_16::@10/atan2_16::@19->atan2_16::@12] // [192] phi atan2_16::angle#6 = atan2_16::angle#12 [phi:atan2_16::@10/atan2_16::@19->atan2_16::@12#0] -- register_copy @@ -9445,8 +9442,7 @@ bsearch16u: { sta.z result+1 // if (result == 0) // [245] if(bsearch16u::result#0!=0) goto bsearch16u::@6 -- vwsz1_neq_0_then_la1 - bne __b6 - lda.z result + ora.z result bne __b6 // bsearch16u::@8 // [246] bsearch16u::return#7 = bsearch16u::pivot#0 -- pwuz1=pwuz2 diff --git a/src/test/ref/primes-1000.asm b/src/test/ref/primes-1000.asm index 4d290e843..7ea6951b2 100644 --- a/src/test/ref/primes-1000.asm +++ b/src/test/ref/primes-1000.asm @@ -139,8 +139,7 @@ main: { !: // if(rem16s == 0) lda.z rem16s+1 - bne __b4 - lda.z rem16s + ora.z rem16s bne __b4 // testnum +=2 clc @@ -370,8 +369,7 @@ mul16u: { __b1: // while(a!=0) lda.z a - bne __b2 - lda.z a+1 + ora.z a+1 bne __b2 // } rts diff --git a/src/test/ref/primes-1000.log b/src/test/ref/primes-1000.log index c0e33649e..21ad7334e 100644 --- a/src/test/ref/primes-1000.log +++ b/src/test/ref/primes-1000.log @@ -3224,21 +3224,21 @@ Uplift Scope [print_sint_decimal] 456.33: zp[2]:14 [ print_sint_decimal::w#4 pri Uplift Scope [main] 202: zp[2]:78 [ main::$17 ] 101: zp[2]:74 [ main::$13 ] 22: zp[2]:54 [ main::$12 ] 22: zp[2]:56 [ main::$16 ] 22: zp[2]:72 [ main::$15 ] 22: zp[2]:82 [ main::$14 ] 22: zp[2]:84 [ main::$18 ] 16.5: zp[2]:58 [ main::p#0 ] 11: zp[4]:68 [ main::$0 ] Uplift Scope [RADIX] -Uplifting [utoa_append] best 281087 combination zp[2]:51 [ utoa_append::value#2 utoa_append::value#0 utoa_append::value#1 ] reg byte x [ utoa_append::digit#2 utoa_append::digit#1 ] zp[2]:123 [ utoa_append::sub#0 ] zp[2]:125 [ utoa_append::return#0 ] zp[2]:121 [ utoa_append::buffer#0 ] -Uplifting [divr16u] best 260087 combination zp[2]:44 [ divr16u::rem#4 divr16u::rem#10 divr16u::rem#5 divr16u::rem#0 divr16u::rem#1 divr16u::rem#2 ] zp[2]:48 [ divr16u::quotient#3 divr16u::return#0 divr16u::quotient#1 divr16u::quotient#2 ] reg byte a [ divr16u::$1 ] reg byte a [ divr16u::$2 ] reg byte x [ divr16u::i#2 divr16u::i#1 ] zp[2]:46 [ divr16u::dividend#2 divr16u::dividend#1 divr16u::dividend#0 ] zp[2]:109 [ divr16u::divisor#0 ] -Uplifting [utoa] best 258783 combination zp[2]:40 [ utoa::buffer#11 utoa::buffer#14 utoa::buffer#4 ] zp[2]:37 [ utoa::value#2 utoa::value#6 utoa::value#1 utoa::value#0 ] zp[1]:36 [ utoa::digit#2 utoa::digit#1 ] reg byte a [ utoa::$10 ] reg byte x [ utoa::started#2 utoa::started#4 ] zp[2]:119 [ utoa::digit_value#0 ] reg byte a [ utoa::$11 ] zp[2]:116 [ utoa::buffer#3 ] -Uplifting [print_char] best 258471 combination reg byte a [ print_char::ch#4 print_char::ch#0 ] -Uplifting [] best 258471 combination zp[2]:17 [ print_char_cursor#20 print_char_cursor#41 print_char_cursor#21 ] zp[2]:34 [ rem16s#10 rem16s#30 rem16s#1 ] zp[2]:129 [ rem16u#0 ] zp[2]:8 [ testnum#10 testnum#1 testnum#15 testnum#11 testnum#2 ] zp[2]:6 [ primeptr#7 primeptr#10 primeptr#1 ] zp[2]:2 [ lasttest#13 lasttest#19 lasttest#1 ] zp[2]:4 [ lastprime#17 lastprime#1 ] -Uplifting [mul16u] best 257871 combination zp[4]:21 [ mul16u::res#2 mul16u::res#6 mul16u::res#1 ] zp[4]:25 [ mul16u::mb#2 mul16u::mb#0 mul16u::mb#1 ] reg byte a [ mul16u::$1 ] zp[2]:19 [ mul16u::a#2 mul16u::a#1 mul16u::a#0 ] zp[4]:88 [ mul16u::return#2 ] zp[2]:86 [ mul16u::b#0 ] -Uplifting [print_str] best 257871 combination zp[2]:42 [ print_str::str#2 print_str::str#0 ] -Uplifting [divr16s] best 257860 combination zp[2]:31 [ divr16s::divisoru#3 divr16s::divisoru#4 divr16s::divisoru#5 ] zp[2]:29 [ divr16s::dividendu#3 divr16s::dividendu#7 divr16s::dividendu#8 ] reg byte y [ divr16s::neg#4 divr16s::neg#2 divr16s::neg#3 ] zp[2]:113 [ divr16s::dividendu#1 ] zp[2]:104 [ divr16s::dividend#0 ] zp[2]:111 [ divr16s::divisoru#1 ] zp[2]:106 [ divr16s::divisor#0 ] -Uplifting [mul16s] best 257860 combination zp[4]:10 [ mul16s::m#4 mul16s::m#5 mul16s::m#1 mul16s::m#0 mul16s::m#2 ] zp[2]:92 [ mul16s::$6 ] zp[2]:94 [ mul16s::$11 ] zp[2]:96 [ mul16s::$9 ] zp[2]:98 [ mul16s::$12 ] zp[4]:100 [ mul16s::return#0 ] zp[4]:64 [ mul16s::return#2 ] zp[2]:62 [ mul16s::b#0 ] zp[2]:60 [ mul16s::a#0 ] -Uplifting [div16s] best 257860 combination zp[2]:80 [ div16s::divisor#0 ] zp[2]:76 [ div16s::dividend#0 ] -Uplifting [print_sint_decimal] best 257860 combination zp[2]:14 [ print_sint_decimal::w#4 print_sint_decimal::w#0 print_sint_decimal::w#1 ] -Uplifting [main] best 257860 combination zp[2]:78 [ main::$17 ] zp[2]:74 [ main::$13 ] zp[2]:54 [ main::$12 ] zp[2]:56 [ main::$16 ] zp[2]:72 [ main::$15 ] zp[2]:82 [ main::$14 ] zp[2]:84 [ main::$18 ] zp[2]:58 [ main::p#0 ] zp[4]:68 [ main::$0 ] -Uplifting [RADIX] best 257860 combination +Uplifting [utoa_append] best 280587 combination zp[2]:51 [ utoa_append::value#2 utoa_append::value#0 utoa_append::value#1 ] reg byte x [ utoa_append::digit#2 utoa_append::digit#1 ] zp[2]:123 [ utoa_append::sub#0 ] zp[2]:125 [ utoa_append::return#0 ] zp[2]:121 [ utoa_append::buffer#0 ] +Uplifting [divr16u] best 259587 combination zp[2]:44 [ divr16u::rem#4 divr16u::rem#10 divr16u::rem#5 divr16u::rem#0 divr16u::rem#1 divr16u::rem#2 ] zp[2]:48 [ divr16u::quotient#3 divr16u::return#0 divr16u::quotient#1 divr16u::quotient#2 ] reg byte a [ divr16u::$1 ] reg byte a [ divr16u::$2 ] reg byte x [ divr16u::i#2 divr16u::i#1 ] zp[2]:46 [ divr16u::dividend#2 divr16u::dividend#1 divr16u::dividend#0 ] zp[2]:109 [ divr16u::divisor#0 ] +Uplifting [utoa] best 258283 combination zp[2]:40 [ utoa::buffer#11 utoa::buffer#14 utoa::buffer#4 ] zp[2]:37 [ utoa::value#2 utoa::value#6 utoa::value#1 utoa::value#0 ] zp[1]:36 [ utoa::digit#2 utoa::digit#1 ] reg byte a [ utoa::$10 ] reg byte x [ utoa::started#2 utoa::started#4 ] zp[2]:119 [ utoa::digit_value#0 ] reg byte a [ utoa::$11 ] zp[2]:116 [ utoa::buffer#3 ] +Uplifting [print_char] best 257971 combination reg byte a [ print_char::ch#4 print_char::ch#0 ] +Uplifting [] best 257971 combination zp[2]:17 [ print_char_cursor#20 print_char_cursor#41 print_char_cursor#21 ] zp[2]:34 [ rem16s#10 rem16s#30 rem16s#1 ] zp[2]:129 [ rem16u#0 ] zp[2]:8 [ testnum#10 testnum#1 testnum#15 testnum#11 testnum#2 ] zp[2]:6 [ primeptr#7 primeptr#10 primeptr#1 ] zp[2]:2 [ lasttest#13 lasttest#19 lasttest#1 ] zp[2]:4 [ lastprime#17 lastprime#1 ] +Uplifting [mul16u] best 257371 combination zp[4]:21 [ mul16u::res#2 mul16u::res#6 mul16u::res#1 ] zp[4]:25 [ mul16u::mb#2 mul16u::mb#0 mul16u::mb#1 ] reg byte a [ mul16u::$1 ] zp[2]:19 [ mul16u::a#2 mul16u::a#1 mul16u::a#0 ] zp[4]:88 [ mul16u::return#2 ] zp[2]:86 [ mul16u::b#0 ] +Uplifting [print_str] best 257371 combination zp[2]:42 [ print_str::str#2 print_str::str#0 ] +Uplifting [divr16s] best 257360 combination zp[2]:31 [ divr16s::divisoru#3 divr16s::divisoru#4 divr16s::divisoru#5 ] zp[2]:29 [ divr16s::dividendu#3 divr16s::dividendu#7 divr16s::dividendu#8 ] reg byte y [ divr16s::neg#4 divr16s::neg#2 divr16s::neg#3 ] zp[2]:113 [ divr16s::dividendu#1 ] zp[2]:104 [ divr16s::dividend#0 ] zp[2]:111 [ divr16s::divisoru#1 ] zp[2]:106 [ divr16s::divisor#0 ] +Uplifting [mul16s] best 257360 combination zp[4]:10 [ mul16s::m#4 mul16s::m#5 mul16s::m#1 mul16s::m#0 mul16s::m#2 ] zp[2]:92 [ mul16s::$6 ] zp[2]:94 [ mul16s::$11 ] zp[2]:96 [ mul16s::$9 ] zp[2]:98 [ mul16s::$12 ] zp[4]:100 [ mul16s::return#0 ] zp[4]:64 [ mul16s::return#2 ] zp[2]:62 [ mul16s::b#0 ] zp[2]:60 [ mul16s::a#0 ] +Uplifting [div16s] best 257360 combination zp[2]:80 [ div16s::divisor#0 ] zp[2]:76 [ div16s::dividend#0 ] +Uplifting [print_sint_decimal] best 257360 combination zp[2]:14 [ print_sint_decimal::w#4 print_sint_decimal::w#0 print_sint_decimal::w#1 ] +Uplifting [main] best 257360 combination zp[2]:78 [ main::$17 ] zp[2]:74 [ main::$13 ] zp[2]:54 [ main::$12 ] zp[2]:56 [ main::$16 ] zp[2]:72 [ main::$15 ] zp[2]:82 [ main::$14 ] zp[2]:84 [ main::$18 ] zp[2]:58 [ main::p#0 ] zp[4]:68 [ main::$0 ] +Uplifting [RADIX] best 257360 combination Attempting to uplift remaining variables inzp[1]:36 [ utoa::digit#2 utoa::digit#1 ] -Uplifting [utoa] best 257860 combination zp[1]:36 [ utoa::digit#2 utoa::digit#1 ] +Uplifting [utoa] best 257360 combination zp[1]:36 [ utoa::digit#2 utoa::digit#1 ] Coalescing zero page register [ zp[2]:34 [ rem16s#10 rem16s#30 rem16s#1 ] ] with [ zp[2]:129 [ rem16u#0 ] ] - score: 2 Coalescing zero page register [ zp[2]:8 [ testnum#10 testnum#1 testnum#15 testnum#11 testnum#2 ] ] with [ zp[2]:76 [ div16s::dividend#0 ] ] - score: 1 Coalescing zero page register [ zp[4]:10 [ mul16s::m#4 mul16s::m#5 mul16s::m#1 mul16s::m#0 mul16s::m#2 ] ] with [ zp[4]:88 [ mul16u::return#2 ] ] - score: 1 @@ -3488,8 +3488,7 @@ main: { !: // [23] if(rem16s#10!=0) goto main::@4 -- vwsz1_neq_0_then_la1 lda.z rem16s+1 - bne __b4_from___b9 - lda.z rem16s + ora.z rem16s bne __b4_from___b9 jmp __b5 // main::@5 @@ -3842,8 +3841,7 @@ mul16u: { __b1: // [76] if(mul16u::a#2!=0) goto mul16u::@2 -- vwuz1_neq_0_then_la1 lda.z a - bne __b2 - lda.z a+1 + ora.z a+1 bne __b2 jmp __breturn // mul16u::@return @@ -4439,7 +4437,6 @@ Removing instruction lda #>0 Succesful ASM optimization Pass5UnnecesaryLoadElimination Replacing label __b2_from___b8 with __b2 Replacing label __b4_from___b9 with __b4 -Replacing label __b4_from___b9 with __b4 Replacing label __b3_from___b4 with __b3 Replacing label __b1_from___b11 with __b1 Replacing label __b1_from___b5 with __b1 @@ -4556,7 +4553,7 @@ Removing instruction __b5: Succesful ASM optimization Pass5UnusedLabelElimination Removing unreachable instruction rts Succesful ASM optimization Pass5UnreachableCodeElimination -Fixing long branch [190] bmi __b1 to bpl +Fixing long branch [189] bmi __b1 to bpl FINAL SYMBOL TABLE const byte* DIGITS[] = "0123456789abcdef"z @@ -4778,7 +4775,7 @@ reg byte a [ divr16u::$2 ] FINAL ASSEMBLER -Score: 211151 +Score: 210651 // File Comments // Calculates the 1000 first primes @@ -4970,8 +4967,7 @@ main: { // if(rem16s == 0) // [23] if(rem16s#10!=0) goto main::@4 -- vwsz1_neq_0_then_la1 lda.z rem16s+1 - bne __b4 - lda.z rem16s + ora.z rem16s bne __b4 // main::@5 // testnum +=2 @@ -5301,8 +5297,7 @@ mul16u: { // while(a!=0) // [76] if(mul16u::a#2!=0) goto mul16u::@2 -- vwuz1_neq_0_then_la1 lda.z a - bne __b2 - lda.z a+1 + ora.z a+1 bne __b2 // mul16u::@return // } diff --git a/src/test/ref/screen-center-angle.asm b/src/test/ref/screen-center-angle.asm index 99f65c9fc..25cc41c3c 100644 --- a/src/test/ref/screen-center-angle.asm +++ b/src/test/ref/screen-center-angle.asm @@ -410,8 +410,7 @@ atan2_16: { __b10: // if(yi==0) lda.z yi+1 - bne __b11 - lda.z yi + ora.z yi bne __b11 __b12: // angle /=2 diff --git a/src/test/ref/screen-center-angle.log b/src/test/ref/screen-center-angle.log index c1204bc9f..98e1a91d9 100644 --- a/src/test/ref/screen-center-angle.log +++ b/src/test/ref/screen-center-angle.log @@ -2521,50 +2521,50 @@ Uplift Scope [MOS6581_SID] Uplift Scope [clock_start] Uplift Scope [] -Uplifting [atan2_16] best 1159759 combination reg byte y [ atan2_16::shift#2 atan2_16::shift#5 atan2_16::shift#1 ] zp[2]:29 [ atan2_16::yd#5 atan2_16::yd#3 atan2_16::yd#10 atan2_16::yd#1 atan2_16::yd#2 ] zp[2]:31 [ atan2_16::xd#5 atan2_16::xd#3 atan2_16::xd#10 atan2_16::xd#1 atan2_16::xd#2 ] zp[2]:24 [ atan2_16::angle#6 atan2_16::angle#12 atan2_16::angle#13 atan2_16::angle#2 atan2_16::angle#3 ] zp[2]:19 [ atan2_16::yi#3 atan2_16::yi#8 atan2_16::yi#0 atan2_16::yi#16 atan2_16::$2 atan2_16::yi#1 atan2_16::yi#2 ] zp[2]:21 [ atan2_16::xi#3 atan2_16::xi#8 atan2_16::xi#0 atan2_16::xi#13 atan2_16::$7 atan2_16::xi#1 atan2_16::xi#2 ] reg byte a [ atan2_16::$23 ] reg byte a [ atan2_16::$22 ] reg byte x [ atan2_16::i#2 atan2_16::i#1 ] zp[2]:26 [ atan2_16::return#0 atan2_16::angle#11 atan2_16::angle#1 atan2_16::angle#4 atan2_16::angle#5 ] zp[2]:74 [ atan2_16::return#2 ] zp[2]:70 [ atan2_16::x#0 ] zp[2]:72 [ atan2_16::y#0 ] +Uplifting [atan2_16] best 1157259 combination reg byte y [ atan2_16::shift#2 atan2_16::shift#5 atan2_16::shift#1 ] zp[2]:29 [ atan2_16::yd#5 atan2_16::yd#3 atan2_16::yd#10 atan2_16::yd#1 atan2_16::yd#2 ] zp[2]:31 [ atan2_16::xd#5 atan2_16::xd#3 atan2_16::xd#10 atan2_16::xd#1 atan2_16::xd#2 ] zp[2]:24 [ atan2_16::angle#6 atan2_16::angle#12 atan2_16::angle#13 atan2_16::angle#2 atan2_16::angle#3 ] zp[2]:19 [ atan2_16::yi#3 atan2_16::yi#8 atan2_16::yi#0 atan2_16::yi#16 atan2_16::$2 atan2_16::yi#1 atan2_16::yi#2 ] zp[2]:21 [ atan2_16::xi#3 atan2_16::xi#8 atan2_16::xi#0 atan2_16::xi#13 atan2_16::$7 atan2_16::xi#1 atan2_16::xi#2 ] reg byte a [ atan2_16::$23 ] reg byte a [ atan2_16::$22 ] reg byte x [ atan2_16::i#2 atan2_16::i#1 ] zp[2]:26 [ atan2_16::return#0 atan2_16::angle#11 atan2_16::angle#1 atan2_16::angle#4 atan2_16::angle#5 ] zp[2]:74 [ atan2_16::return#2 ] zp[2]:70 [ atan2_16::x#0 ] zp[2]:72 [ atan2_16::y#0 ] Limited combination testing to 100 combinations of 144 possible. -Uplifting [init_font_hex] best 1140759 combination reg byte x [ init_font_hex::i#2 init_font_hex::i#1 ] reg byte a [ init_font_hex::$1 ] reg byte a [ init_font_hex::$2 ] zp[1]:11 [ init_font_hex::idx#5 init_font_hex::idx#2 ] zp[1]:59 [ init_font_hex::$0 ] zp[1]:62 [ init_font_hex::idx#3 ] zp[1]:9 [ init_font_hex::c1#4 init_font_hex::c1#1 ] zp[2]:5 [ init_font_hex::charset#2 init_font_hex::charset#5 init_font_hex::charset#0 ] zp[2]:7 [ init_font_hex::proto_lo#4 init_font_hex::proto_lo#1 ] zp[2]:2 [ init_font_hex::proto_hi#6 init_font_hex::proto_hi#1 ] zp[1]:4 [ init_font_hex::c#6 init_font_hex::c#1 ] +Uplifting [init_font_hex] best 1138259 combination reg byte x [ init_font_hex::i#2 init_font_hex::i#1 ] reg byte a [ init_font_hex::$1 ] reg byte a [ init_font_hex::$2 ] zp[1]:11 [ init_font_hex::idx#5 init_font_hex::idx#2 ] zp[1]:59 [ init_font_hex::$0 ] zp[1]:62 [ init_font_hex::idx#3 ] zp[1]:9 [ init_font_hex::c1#4 init_font_hex::c1#1 ] zp[2]:5 [ init_font_hex::charset#2 init_font_hex::charset#5 init_font_hex::charset#0 ] zp[2]:7 [ init_font_hex::proto_lo#4 init_font_hex::proto_lo#1 ] zp[2]:2 [ init_font_hex::proto_hi#6 init_font_hex::proto_hi#1 ] zp[1]:4 [ init_font_hex::c#6 init_font_hex::c#1 ] Limited combination testing to 100 combinations of 6912 possible. -Uplifting [print_char_at] best 1140752 combination reg byte x [ print_char_at::ch#2 print_char_at::ch#0 print_char_at::ch#1 ] zp[2]:41 [ print_char_at::at#2 print_char_at::at#0 print_char_at::at#1 ] -Uplifting [init_angle_screen] best 1139152 combination zp[1]:18 [ init_angle_screen::xb#2 init_angle_screen::xb#1 ] reg byte a [ init_angle_screen::$3 ] reg byte a [ init_angle_screen::$4 ] reg byte a [ init_angle_screen::$5 ] zp[2]:76 [ init_angle_screen::angle_w#0 ] zp[2]:78 [ init_angle_screen::$7 ] zp[1]:81 [ init_angle_screen::$9 ] zp[1]:82 [ init_angle_screen::$10 ] zp[1]:83 [ init_angle_screen::$11 ] zp[1]:17 [ init_angle_screen::x#2 init_angle_screen::x#1 ] zp[1]:80 [ init_angle_screen::ang_w#0 ] zp[2]:68 [ init_angle_screen::yw#0 ] zp[2]:65 [ init_angle_screen::xw#0 ] zp[1]:12 [ init_angle_screen::y#5 init_angle_screen::y#1 ] zp[2]:15 [ init_angle_screen::screen_bottomline#6 init_angle_screen::screen_bottomline#1 ] zp[2]:13 [ init_angle_screen::screen_topline#6 init_angle_screen::screen_topline#1 ] +Uplifting [print_char_at] best 1138252 combination reg byte x [ print_char_at::ch#2 print_char_at::ch#0 print_char_at::ch#1 ] zp[2]:41 [ print_char_at::at#2 print_char_at::at#0 print_char_at::at#1 ] +Uplifting [init_angle_screen] best 1136652 combination zp[1]:18 [ init_angle_screen::xb#2 init_angle_screen::xb#1 ] reg byte a [ init_angle_screen::$3 ] reg byte a [ init_angle_screen::$4 ] reg byte a [ init_angle_screen::$5 ] zp[2]:76 [ init_angle_screen::angle_w#0 ] zp[2]:78 [ init_angle_screen::$7 ] zp[1]:81 [ init_angle_screen::$9 ] zp[1]:82 [ init_angle_screen::$10 ] zp[1]:83 [ init_angle_screen::$11 ] zp[1]:17 [ init_angle_screen::x#2 init_angle_screen::x#1 ] zp[1]:80 [ init_angle_screen::ang_w#0 ] zp[2]:68 [ init_angle_screen::yw#0 ] zp[2]:65 [ init_angle_screen::xw#0 ] zp[1]:12 [ init_angle_screen::y#5 init_angle_screen::y#1 ] zp[2]:15 [ init_angle_screen::screen_bottomline#6 init_angle_screen::screen_bottomline#1 ] zp[2]:13 [ init_angle_screen::screen_topline#6 init_angle_screen::screen_topline#1 ] Limited combination testing to 100 combinations of 65536 possible. -Uplifting [print_uchar_at] best 1139144 combination reg byte a [ print_uchar_at::$0 ] reg byte y [ print_uchar_at::$2 ] zp[2]:38 [ print_uchar_at::at#2 print_uchar_at::at#0 print_uchar_at::at#1 ] zp[1]:37 [ print_uchar_at::b#2 print_uchar_at::b#0 print_uchar_at::b#1 ] -Uplifting [print_uint_at] best 1139144 combination zp[2]:33 [ print_uint_at::w#2 print_uint_at::w#0 print_uint_at::w#1 ] zp[2]:35 [ print_uint_at::at#2 ] -Uplifting [clock] best 1139144 combination zp[4]:84 [ clock::return#0 ] zp[4]:43 [ clock::return#2 ] -Uplifting [print_ulong_at] best 1139144 combination zp[4]:55 [ print_ulong_at::dw#0 ] -Uplifting [main] best 1139144 combination zp[4]:47 [ main::$4 ] zp[4]:51 [ main::cyclecount#0 ] -Uplifting [RADIX] best 1139144 combination -Uplifting [MOS6526_CIA] best 1139144 combination -Uplifting [MOS6569_VICII] best 1139144 combination -Uplifting [MOS6581_SID] best 1139144 combination -Uplifting [clock_start] best 1139144 combination -Uplifting [] best 1139144 combination +Uplifting [print_uchar_at] best 1136644 combination reg byte a [ print_uchar_at::$0 ] reg byte y [ print_uchar_at::$2 ] zp[2]:38 [ print_uchar_at::at#2 print_uchar_at::at#0 print_uchar_at::at#1 ] zp[1]:37 [ print_uchar_at::b#2 print_uchar_at::b#0 print_uchar_at::b#1 ] +Uplifting [print_uint_at] best 1136644 combination zp[2]:33 [ print_uint_at::w#2 print_uint_at::w#0 print_uint_at::w#1 ] zp[2]:35 [ print_uint_at::at#2 ] +Uplifting [clock] best 1136644 combination zp[4]:84 [ clock::return#0 ] zp[4]:43 [ clock::return#2 ] +Uplifting [print_ulong_at] best 1136644 combination zp[4]:55 [ print_ulong_at::dw#0 ] +Uplifting [main] best 1136644 combination zp[4]:47 [ main::$4 ] zp[4]:51 [ main::cyclecount#0 ] +Uplifting [RADIX] best 1136644 combination +Uplifting [MOS6526_CIA] best 1136644 combination +Uplifting [MOS6569_VICII] best 1136644 combination +Uplifting [MOS6581_SID] best 1136644 combination +Uplifting [clock_start] best 1136644 combination +Uplifting [] best 1136644 combination Attempting to uplift remaining variables inzp[1]:11 [ init_font_hex::idx#5 init_font_hex::idx#2 ] -Uplifting [init_font_hex] best 1139144 combination zp[1]:11 [ init_font_hex::idx#5 init_font_hex::idx#2 ] +Uplifting [init_font_hex] best 1136644 combination zp[1]:11 [ init_font_hex::idx#5 init_font_hex::idx#2 ] Attempting to uplift remaining variables inzp[1]:59 [ init_font_hex::$0 ] -Uplifting [init_font_hex] best 1139144 combination zp[1]:59 [ init_font_hex::$0 ] +Uplifting [init_font_hex] best 1136644 combination zp[1]:59 [ init_font_hex::$0 ] Attempting to uplift remaining variables inzp[1]:18 [ init_angle_screen::xb#2 init_angle_screen::xb#1 ] -Uplifting [init_angle_screen] best 1139144 combination zp[1]:18 [ init_angle_screen::xb#2 init_angle_screen::xb#1 ] +Uplifting [init_angle_screen] best 1136644 combination zp[1]:18 [ init_angle_screen::xb#2 init_angle_screen::xb#1 ] Attempting to uplift remaining variables inzp[1]:62 [ init_font_hex::idx#3 ] -Uplifting [init_font_hex] best 1138544 combination reg byte y [ init_font_hex::idx#3 ] +Uplifting [init_font_hex] best 1136044 combination reg byte y [ init_font_hex::idx#3 ] Attempting to uplift remaining variables inzp[1]:81 [ init_angle_screen::$9 ] -Uplifting [init_angle_screen] best 1137944 combination reg byte a [ init_angle_screen::$9 ] +Uplifting [init_angle_screen] best 1135444 combination reg byte a [ init_angle_screen::$9 ] Attempting to uplift remaining variables inzp[1]:82 [ init_angle_screen::$10 ] -Uplifting [init_angle_screen] best 1137544 combination reg byte a [ init_angle_screen::$10 ] +Uplifting [init_angle_screen] best 1135044 combination reg byte a [ init_angle_screen::$10 ] Attempting to uplift remaining variables inzp[1]:83 [ init_angle_screen::$11 ] -Uplifting [init_angle_screen] best 1136944 combination reg byte a [ init_angle_screen::$11 ] +Uplifting [init_angle_screen] best 1134444 combination reg byte a [ init_angle_screen::$11 ] Attempting to uplift remaining variables inzp[1]:9 [ init_font_hex::c1#4 init_font_hex::c1#1 ] -Uplifting [init_font_hex] best 1136944 combination zp[1]:9 [ init_font_hex::c1#4 init_font_hex::c1#1 ] +Uplifting [init_font_hex] best 1134444 combination zp[1]:9 [ init_font_hex::c1#4 init_font_hex::c1#1 ] Attempting to uplift remaining variables inzp[1]:17 [ init_angle_screen::x#2 init_angle_screen::x#1 ] -Uplifting [init_angle_screen] best 1136944 combination zp[1]:17 [ init_angle_screen::x#2 init_angle_screen::x#1 ] +Uplifting [init_angle_screen] best 1134444 combination zp[1]:17 [ init_angle_screen::x#2 init_angle_screen::x#1 ] Attempting to uplift remaining variables inzp[1]:80 [ init_angle_screen::ang_w#0 ] -Uplifting [init_angle_screen] best 1136944 combination zp[1]:80 [ init_angle_screen::ang_w#0 ] +Uplifting [init_angle_screen] best 1134444 combination zp[1]:80 [ init_angle_screen::ang_w#0 ] Attempting to uplift remaining variables inzp[1]:37 [ print_uchar_at::b#2 print_uchar_at::b#0 print_uchar_at::b#1 ] -Uplifting [print_uchar_at] best 1136944 combination zp[1]:37 [ print_uchar_at::b#2 print_uchar_at::b#0 print_uchar_at::b#1 ] +Uplifting [print_uchar_at] best 1134444 combination zp[1]:37 [ print_uchar_at::b#2 print_uchar_at::b#0 print_uchar_at::b#1 ] Attempting to uplift remaining variables inzp[1]:12 [ init_angle_screen::y#5 init_angle_screen::y#1 ] -Uplifting [init_angle_screen] best 1136944 combination zp[1]:12 [ init_angle_screen::y#5 init_angle_screen::y#1 ] +Uplifting [init_angle_screen] best 1134444 combination zp[1]:12 [ init_angle_screen::y#5 init_angle_screen::y#1 ] Attempting to uplift remaining variables inzp[1]:4 [ init_font_hex::c#6 init_font_hex::c#1 ] -Uplifting [init_font_hex] best 1136944 combination zp[1]:4 [ init_font_hex::c#6 init_font_hex::c#1 ] +Uplifting [init_font_hex] best 1134444 combination zp[1]:4 [ init_font_hex::c#6 init_font_hex::c#1 ] Coalescing zero page register [ zp[2]:35 [ print_uint_at::at#2 ] ] with [ zp[2]:38 [ print_uchar_at::at#2 print_uchar_at::at#0 print_uchar_at::at#1 ] ] - score: 2 Coalescing zero page register [ zp[2]:24 [ atan2_16::angle#6 atan2_16::angle#12 atan2_16::angle#13 atan2_16::angle#2 atan2_16::angle#3 ] ] with [ zp[2]:26 [ atan2_16::return#0 atan2_16::angle#11 atan2_16::angle#1 atan2_16::angle#4 atan2_16::angle#5 ] ] - score: 1 Coalescing zero page register [ zp[4]:43 [ clock::return#2 ] ] with [ zp[4]:47 [ main::$4 ] ] - score: 1 @@ -3205,8 +3205,7 @@ atan2_16: { __b10: // [90] if(atan2_16::yi#3!=0) goto atan2_16::@11 -- vwsz1_neq_0_then_la1 lda.z yi+1 - bne __b11 - lda.z yi + ora.z yi bne __b11 // [91] phi from atan2_16::@10 atan2_16::@19 to atan2_16::@12 [phi:atan2_16::@10/atan2_16::@19->atan2_16::@12] __b12_from___b10: @@ -3717,7 +3716,7 @@ Removing instruction jmp __b2 Removing instruction jmp __b3 Removing instruction jmp __b1 Succesful ASM optimization Pass5NextJumpElimination -Fixing long branch [428] beq __b12 to bne +Fixing long branch [427] beq __b12 to bne Fixing long branch [322] bpl __b1 to bmi Fixing long branch [334] bpl __b4 to bmi @@ -3941,7 +3940,7 @@ reg byte y [ print_uchar_at::$2 ] FINAL ASSEMBLER -Score: 1044967 +Score: 1042467 // File Comments // Calculate the angle to the center of the screen - and show it using font-hex @@ -4527,8 +4526,7 @@ atan2_16: { // if(yi==0) // [90] if(atan2_16::yi#3!=0) goto atan2_16::@11 -- vwsz1_neq_0_then_la1 lda.z yi+1 - bne __b11 - lda.z yi + ora.z yi bne __b11 // [91] phi from atan2_16::@10 atan2_16::@19 to atan2_16::@12 [phi:atan2_16::@10/atan2_16::@19->atan2_16::@12] // [91] phi atan2_16::angle#6 = atan2_16::angle#12 [phi:atan2_16::@10/atan2_16::@19->atan2_16::@12#0] -- register_copy diff --git a/src/test/ref/screen-center-distance.asm b/src/test/ref/screen-center-distance.asm index 86c5557de..5fa323f98 100644 --- a/src/test/ref/screen-center-distance.asm +++ b/src/test/ref/screen-center-distance.asm @@ -568,8 +568,7 @@ bsearch16u: { sbc (pivot),y sta.z result+1 // if (result == 0) - bne __b6 - lda.z result + ora.z result bne __b6 lda.z pivot sta.z return diff --git a/src/test/ref/screen-center-distance.log b/src/test/ref/screen-center-distance.log index 317bd95b2..56b6dd944 100644 --- a/src/test/ref/screen-center-distance.log +++ b/src/test/ref/screen-center-distance.log @@ -3102,49 +3102,49 @@ Uplift Scope [MOS6581_SID] Uplift Scope [clock_start] Uplift Scope [] -Uplifting [bsearch16u] best 263239 combination reg byte x [ bsearch16u::num#5 bsearch16u::num#1 bsearch16u::num#3 bsearch16u::num#0 ] zp[2]:33 [ bsearch16u::return#1 bsearch16u::return#2 bsearch16u::items#2 bsearch16u::items#8 bsearch16u::$2 bsearch16u::return#7 bsearch16u::items#0 ] reg byte a [ bsearch16u::$6 ] reg byte a [ bsearch16u::$14 ] zp[2]:102 [ bsearch16u::result#0 ] zp[2]:100 [ bsearch16u::pivot#0 ] zp[2]:89 [ bsearch16u::return#3 ] zp[2]:87 [ bsearch16u::key#0 ] -Uplifting [init_font_hex] best 244239 combination reg byte x [ init_font_hex::i#2 init_font_hex::i#1 ] reg byte a [ init_font_hex::$1 ] reg byte a [ init_font_hex::$2 ] zp[1]:13 [ init_font_hex::idx#5 init_font_hex::idx#2 ] zp[1]:58 [ init_font_hex::$0 ] zp[1]:61 [ init_font_hex::idx#3 ] zp[1]:11 [ init_font_hex::c1#4 init_font_hex::c1#1 ] zp[2]:5 [ init_font_hex::charset#2 init_font_hex::charset#5 init_font_hex::charset#0 ] zp[2]:9 [ init_font_hex::proto_lo#4 init_font_hex::proto_lo#1 ] zp[2]:2 [ init_font_hex::proto_hi#6 init_font_hex::proto_hi#1 ] zp[1]:4 [ init_font_hex::c#6 init_font_hex::c#1 ] +Uplifting [bsearch16u] best 260739 combination reg byte x [ bsearch16u::num#5 bsearch16u::num#1 bsearch16u::num#3 bsearch16u::num#0 ] zp[2]:33 [ bsearch16u::return#1 bsearch16u::return#2 bsearch16u::items#2 bsearch16u::items#8 bsearch16u::$2 bsearch16u::return#7 bsearch16u::items#0 ] reg byte a [ bsearch16u::$6 ] reg byte a [ bsearch16u::$14 ] zp[2]:102 [ bsearch16u::result#0 ] zp[2]:100 [ bsearch16u::pivot#0 ] zp[2]:89 [ bsearch16u::return#3 ] zp[2]:87 [ bsearch16u::key#0 ] +Uplifting [init_font_hex] best 241739 combination reg byte x [ init_font_hex::i#2 init_font_hex::i#1 ] reg byte a [ init_font_hex::$1 ] reg byte a [ init_font_hex::$2 ] zp[1]:13 [ init_font_hex::idx#5 init_font_hex::idx#2 ] zp[1]:58 [ init_font_hex::$0 ] zp[1]:61 [ init_font_hex::idx#3 ] zp[1]:11 [ init_font_hex::c1#4 init_font_hex::c1#1 ] zp[2]:5 [ init_font_hex::charset#2 init_font_hex::charset#5 init_font_hex::charset#0 ] zp[2]:9 [ init_font_hex::proto_lo#4 init_font_hex::proto_lo#1 ] zp[2]:2 [ init_font_hex::proto_hi#6 init_font_hex::proto_hi#1 ] zp[1]:4 [ init_font_hex::c#6 init_font_hex::c#1 ] Limited combination testing to 100 combinations of 6912 possible. -Uplifting [sqrt] best 243336 combination zp[2]:91 [ sqrt::found#0 ] zp[2]:93 [ sqrt::$2 ] zp[2]:74 [ sqrt::val#0 ] zp[2]:95 [ sqrt::$1 ] reg byte a [ sqrt::return#0 ] reg byte a [ sqrt::return#2 ] -Uplifting [sqr] best 242999 combination reg byte a [ sqr::$0 ] reg byte a [ sqr::val#2 sqr::val#1 sqr::val#0 ] zp[2]:85 [ sqr::return#0 ] zp[2]:68 [ sqr::return#3 ] zp[2]:63 [ sqr::return#2 ] -Uplifting [print_char_at] best 242992 combination reg byte x [ print_char_at::ch#2 print_char_at::ch#0 print_char_at::ch#1 ] zp[2]:40 [ print_char_at::at#2 print_char_at::at#0 print_char_at::at#1 ] -Uplifting [init_dist_screen] best 239792 combination reg byte a [ init_dist_screen::xd#0 init_dist_screen::$16 init_dist_screen::$14 ] zp[1]:21 [ init_dist_screen::xb#2 init_dist_screen::xb#1 ] reg byte a [ init_dist_screen::x2#0 ] zp[2]:70 [ init_dist_screen::xds#0 ] zp[2]:72 [ init_dist_screen::ds#0 ] zp[1]:20 [ init_dist_screen::x#2 init_dist_screen::x#1 ] reg byte a [ init_dist_screen::d#0 ] zp[1]:19 [ init_dist_screen::yd#0 init_dist_screen::$7 init_dist_screen::$5 ] zp[1]:62 [ init_dist_screen::y2#0 ] zp[1]:14 [ init_dist_screen::y#10 init_dist_screen::y#1 ] zp[2]:17 [ init_dist_screen::screen_bottomline#11 init_dist_screen::screen_bottomline#1 ] zp[2]:15 [ init_dist_screen::screen_topline#11 init_dist_screen::screen_topline#1 ] zp[2]:65 [ init_dist_screen::yds#0 ] +Uplifting [sqrt] best 240836 combination zp[2]:91 [ sqrt::found#0 ] zp[2]:93 [ sqrt::$2 ] zp[2]:74 [ sqrt::val#0 ] zp[2]:95 [ sqrt::$1 ] reg byte a [ sqrt::return#0 ] reg byte a [ sqrt::return#2 ] +Uplifting [sqr] best 240499 combination reg byte a [ sqr::$0 ] reg byte a [ sqr::val#2 sqr::val#1 sqr::val#0 ] zp[2]:85 [ sqr::return#0 ] zp[2]:68 [ sqr::return#3 ] zp[2]:63 [ sqr::return#2 ] +Uplifting [print_char_at] best 240492 combination reg byte x [ print_char_at::ch#2 print_char_at::ch#0 print_char_at::ch#1 ] zp[2]:40 [ print_char_at::at#2 print_char_at::at#0 print_char_at::at#1 ] +Uplifting [init_dist_screen] best 237292 combination reg byte a [ init_dist_screen::xd#0 init_dist_screen::$16 init_dist_screen::$14 ] zp[1]:21 [ init_dist_screen::xb#2 init_dist_screen::xb#1 ] reg byte a [ init_dist_screen::x2#0 ] zp[2]:70 [ init_dist_screen::xds#0 ] zp[2]:72 [ init_dist_screen::ds#0 ] zp[1]:20 [ init_dist_screen::x#2 init_dist_screen::x#1 ] reg byte a [ init_dist_screen::d#0 ] zp[1]:19 [ init_dist_screen::yd#0 init_dist_screen::$7 init_dist_screen::$5 ] zp[1]:62 [ init_dist_screen::y2#0 ] zp[1]:14 [ init_dist_screen::y#10 init_dist_screen::y#1 ] zp[2]:17 [ init_dist_screen::screen_bottomline#11 init_dist_screen::screen_bottomline#1 ] zp[2]:15 [ init_dist_screen::screen_topline#11 init_dist_screen::screen_topline#1 ] zp[2]:65 [ init_dist_screen::yds#0 ] Limited combination testing to 100 combinations of 6144 possible. -Uplifting [init_squares] best 239592 combination reg byte x [ init_squares::i#2 init_squares::i#1 ] reg byte a [ init_squares::$3 ] reg byte a [ init_squares::$4 ] zp[2]:24 [ init_squares::sqr#2 init_squares::sqr#1 ] zp[2]:26 [ init_squares::squares#2 init_squares::squares#1 ] -Uplifting [print_uchar_at] best 239584 combination reg byte a [ print_uchar_at::$0 ] reg byte y [ print_uchar_at::$2 ] zp[2]:37 [ print_uchar_at::at#2 print_uchar_at::at#0 print_uchar_at::at#1 ] zp[1]:36 [ print_uchar_at::b#2 print_uchar_at::b#0 print_uchar_at::b#1 ] -Uplifting [print_uint_at] best 239584 combination zp[2]:29 [ print_uint_at::w#2 print_uint_at::w#0 print_uint_at::w#1 ] zp[2]:31 [ print_uint_at::at#2 ] -Uplifting [clock] best 239584 combination zp[4]:78 [ clock::return#0 ] zp[4]:42 [ clock::return#2 ] -Uplifting [print_ulong_at] best 239584 combination zp[4]:54 [ print_ulong_at::dw#0 ] -Uplifting [main] best 239584 combination zp[4]:46 [ main::$4 ] zp[4]:50 [ main::cyclecount#0 ] -Uplifting [RADIX] best 239584 combination -Uplifting [malloc] best 239584 combination -Uplifting [MOS6526_CIA] best 239584 combination -Uplifting [MOS6569_VICII] best 239584 combination -Uplifting [MOS6581_SID] best 239584 combination -Uplifting [clock_start] best 239584 combination -Uplifting [] best 239584 combination +Uplifting [init_squares] best 237092 combination reg byte x [ init_squares::i#2 init_squares::i#1 ] reg byte a [ init_squares::$3 ] reg byte a [ init_squares::$4 ] zp[2]:24 [ init_squares::sqr#2 init_squares::sqr#1 ] zp[2]:26 [ init_squares::squares#2 init_squares::squares#1 ] +Uplifting [print_uchar_at] best 237084 combination reg byte a [ print_uchar_at::$0 ] reg byte y [ print_uchar_at::$2 ] zp[2]:37 [ print_uchar_at::at#2 print_uchar_at::at#0 print_uchar_at::at#1 ] zp[1]:36 [ print_uchar_at::b#2 print_uchar_at::b#0 print_uchar_at::b#1 ] +Uplifting [print_uint_at] best 237084 combination zp[2]:29 [ print_uint_at::w#2 print_uint_at::w#0 print_uint_at::w#1 ] zp[2]:31 [ print_uint_at::at#2 ] +Uplifting [clock] best 237084 combination zp[4]:78 [ clock::return#0 ] zp[4]:42 [ clock::return#2 ] +Uplifting [print_ulong_at] best 237084 combination zp[4]:54 [ print_ulong_at::dw#0 ] +Uplifting [main] best 237084 combination zp[4]:46 [ main::$4 ] zp[4]:50 [ main::cyclecount#0 ] +Uplifting [RADIX] best 237084 combination +Uplifting [malloc] best 237084 combination +Uplifting [MOS6526_CIA] best 237084 combination +Uplifting [MOS6569_VICII] best 237084 combination +Uplifting [MOS6581_SID] best 237084 combination +Uplifting [clock_start] best 237084 combination +Uplifting [] best 237084 combination Attempting to uplift remaining variables inzp[1]:13 [ init_font_hex::idx#5 init_font_hex::idx#2 ] -Uplifting [init_font_hex] best 239584 combination zp[1]:13 [ init_font_hex::idx#5 init_font_hex::idx#2 ] +Uplifting [init_font_hex] best 237084 combination zp[1]:13 [ init_font_hex::idx#5 init_font_hex::idx#2 ] Attempting to uplift remaining variables inzp[1]:58 [ init_font_hex::$0 ] -Uplifting [init_font_hex] best 239584 combination zp[1]:58 [ init_font_hex::$0 ] +Uplifting [init_font_hex] best 237084 combination zp[1]:58 [ init_font_hex::$0 ] Attempting to uplift remaining variables inzp[1]:21 [ init_dist_screen::xb#2 init_dist_screen::xb#1 ] -Uplifting [init_dist_screen] best 239584 combination zp[1]:21 [ init_dist_screen::xb#2 init_dist_screen::xb#1 ] +Uplifting [init_dist_screen] best 237084 combination zp[1]:21 [ init_dist_screen::xb#2 init_dist_screen::xb#1 ] Attempting to uplift remaining variables inzp[1]:61 [ init_font_hex::idx#3 ] -Uplifting [init_font_hex] best 238984 combination reg byte y [ init_font_hex::idx#3 ] +Uplifting [init_font_hex] best 236484 combination reg byte y [ init_font_hex::idx#3 ] Attempting to uplift remaining variables inzp[1]:11 [ init_font_hex::c1#4 init_font_hex::c1#1 ] -Uplifting [init_font_hex] best 238984 combination zp[1]:11 [ init_font_hex::c1#4 init_font_hex::c1#1 ] +Uplifting [init_font_hex] best 236484 combination zp[1]:11 [ init_font_hex::c1#4 init_font_hex::c1#1 ] Attempting to uplift remaining variables inzp[1]:20 [ init_dist_screen::x#2 init_dist_screen::x#1 ] -Uplifting [init_dist_screen] best 238984 combination zp[1]:20 [ init_dist_screen::x#2 init_dist_screen::x#1 ] +Uplifting [init_dist_screen] best 236484 combination zp[1]:20 [ init_dist_screen::x#2 init_dist_screen::x#1 ] Attempting to uplift remaining variables inzp[1]:19 [ init_dist_screen::yd#0 init_dist_screen::$7 init_dist_screen::$5 ] -Uplifting [init_dist_screen] best 238914 combination reg byte a [ init_dist_screen::yd#0 init_dist_screen::$7 init_dist_screen::$5 ] +Uplifting [init_dist_screen] best 236414 combination reg byte a [ init_dist_screen::yd#0 init_dist_screen::$7 init_dist_screen::$5 ] Attempting to uplift remaining variables inzp[1]:36 [ print_uchar_at::b#2 print_uchar_at::b#0 print_uchar_at::b#1 ] -Uplifting [print_uchar_at] best 238914 combination zp[1]:36 [ print_uchar_at::b#2 print_uchar_at::b#0 print_uchar_at::b#1 ] +Uplifting [print_uchar_at] best 236414 combination zp[1]:36 [ print_uchar_at::b#2 print_uchar_at::b#0 print_uchar_at::b#1 ] Attempting to uplift remaining variables inzp[1]:62 [ init_dist_screen::y2#0 ] -Uplifting [init_dist_screen] best 238814 combination reg byte a [ init_dist_screen::y2#0 ] +Uplifting [init_dist_screen] best 236314 combination reg byte a [ init_dist_screen::y2#0 ] Attempting to uplift remaining variables inzp[1]:4 [ init_font_hex::c#6 init_font_hex::c#1 ] -Uplifting [init_font_hex] best 238814 combination zp[1]:4 [ init_font_hex::c#6 init_font_hex::c#1 ] +Uplifting [init_font_hex] best 236314 combination zp[1]:4 [ init_font_hex::c#6 init_font_hex::c#1 ] Attempting to uplift remaining variables inzp[1]:14 [ init_dist_screen::y#10 init_dist_screen::y#1 ] -Uplifting [init_dist_screen] best 238814 combination zp[1]:14 [ init_dist_screen::y#10 init_dist_screen::y#1 ] +Uplifting [init_dist_screen] best 236314 combination zp[1]:14 [ init_dist_screen::y#10 init_dist_screen::y#1 ] Coalescing zero page register [ zp[2]:31 [ print_uint_at::at#2 ] ] with [ zp[2]:37 [ print_uchar_at::at#2 print_uchar_at::at#0 print_uchar_at::at#1 ] ] - score: 2 Coalescing zero page register [ zp[2]:33 [ bsearch16u::return#1 bsearch16u::return#2 bsearch16u::items#2 bsearch16u::items#8 bsearch16u::$2 bsearch16u::return#7 bsearch16u::items#0 ] ] with [ zp[2]:89 [ bsearch16u::return#3 ] ] - score: 1 Coalescing zero page register [ zp[4]:42 [ clock::return#2 ] ] with [ zp[4]:46 [ main::$4 ] ] - score: 1 @@ -4044,8 +4044,7 @@ bsearch16u: { sta.z result+1 // [137] if(bsearch16u::result#0!=0) goto bsearch16u::@6 -- vwsz1_neq_0_then_la1 lda.z result+1 - bne __b6 - lda.z result + ora.z result bne __b6 jmp __b8 // bsearch16u::@8 @@ -4570,7 +4569,7 @@ reg byte y [ print_uchar_at::$2 ] FINAL ASSEMBLER -Score: 203667 +Score: 201167 // File Comments // Calculate the distance to the center of the screen - and show it using font-hex @@ -5399,8 +5398,7 @@ bsearch16u: { sta.z result+1 // if (result == 0) // [137] if(bsearch16u::result#0!=0) goto bsearch16u::@6 -- vwsz1_neq_0_then_la1 - bne __b6 - lda.z result + ora.z result bne __b6 // bsearch16u::@8 // [138] bsearch16u::return#7 = bsearch16u::pivot#0 -- pwuz1=pwuz2 diff --git a/src/test/ref/screen-show-spiral-buckets.asm b/src/test/ref/screen-show-spiral-buckets.asm index e4aa38b1d..e72379939 100644 --- a/src/test/ref/screen-show-spiral-buckets.asm +++ b/src/test/ref/screen-show-spiral-buckets.asm @@ -895,8 +895,7 @@ atan2_16: { __b10: // if(yi==0) lda.z yi+1 - bne __b11 - lda.z yi + ora.z yi bne __b11 __b12: // angle /=2 @@ -1124,8 +1123,7 @@ bsearch16u: { sbc (pivot),y sta.z result+1 // if (result == 0) - bne __b6 - lda.z result + ora.z result bne __b6 lda.z pivot sta.z return diff --git a/src/test/ref/screen-show-spiral-buckets.log b/src/test/ref/screen-show-spiral-buckets.log index 554374ff9..e936aa8e6 100644 --- a/src/test/ref/screen-show-spiral-buckets.log +++ b/src/test/ref/screen-show-spiral-buckets.log @@ -5013,58 +5013,58 @@ Uplift Scope [MOS6581_SID] Uplift Scope [RADIX] Uplift Scope [__start] -Uplifting [bsearch16u] best 1349001 combination reg byte x [ bsearch16u::num#5 bsearch16u::num#1 bsearch16u::num#3 bsearch16u::num#0 ] zp[2]:61 [ bsearch16u::return#1 bsearch16u::return#2 bsearch16u::items#2 bsearch16u::items#1 bsearch16u::items#8 bsearch16u::$2 bsearch16u::return#7 bsearch16u::items#0 ] reg byte a [ bsearch16u::$6 ] reg byte a [ bsearch16u::$14 ] zp[2]:172 [ bsearch16u::result#0 ] zp[2]:170 [ bsearch16u::pivot#0 ] zp[2]:157 [ bsearch16u::return#3 ] zp[2]:155 [ bsearch16u::key#0 ] -Uplifting [atan2_16] best 1235001 combination reg byte y [ atan2_16::shift#2 atan2_16::shift#5 atan2_16::shift#1 ] zp[2]:57 [ atan2_16::yd#5 atan2_16::yd#3 atan2_16::yd#10 atan2_16::yd#1 atan2_16::yd#2 ] zp[2]:59 [ atan2_16::xd#5 atan2_16::xd#3 atan2_16::xd#10 atan2_16::xd#1 atan2_16::xd#2 ] zp[2]:52 [ atan2_16::angle#6 atan2_16::angle#12 atan2_16::angle#13 atan2_16::angle#2 atan2_16::angle#3 ] zp[2]:47 [ atan2_16::yi#3 atan2_16::yi#8 atan2_16::yi#0 atan2_16::yi#16 atan2_16::$2 atan2_16::yi#1 atan2_16::yi#2 ] zp[2]:49 [ atan2_16::xi#3 atan2_16::xi#8 atan2_16::xi#0 atan2_16::xi#13 atan2_16::$7 atan2_16::xi#1 atan2_16::xi#2 ] reg byte a [ atan2_16::$23 ] reg byte a [ atan2_16::$22 ] reg byte x [ atan2_16::i#2 atan2_16::i#1 ] zp[2]:54 [ atan2_16::return#0 atan2_16::angle#11 atan2_16::angle#1 atan2_16::angle#4 atan2_16::angle#5 ] zp[2]:118 [ atan2_16::return#2 ] zp[2]:114 [ atan2_16::x#0 ] zp[2]:116 [ atan2_16::y#0 ] +Uplifting [bsearch16u] best 1344001 combination reg byte x [ bsearch16u::num#5 bsearch16u::num#1 bsearch16u::num#3 bsearch16u::num#0 ] zp[2]:61 [ bsearch16u::return#1 bsearch16u::return#2 bsearch16u::items#2 bsearch16u::items#1 bsearch16u::items#8 bsearch16u::$2 bsearch16u::return#7 bsearch16u::items#0 ] reg byte a [ bsearch16u::$6 ] reg byte a [ bsearch16u::$14 ] zp[2]:172 [ bsearch16u::result#0 ] zp[2]:170 [ bsearch16u::pivot#0 ] zp[2]:157 [ bsearch16u::return#3 ] zp[2]:155 [ bsearch16u::key#0 ] +Uplifting [atan2_16] best 1230001 combination reg byte y [ atan2_16::shift#2 atan2_16::shift#5 atan2_16::shift#1 ] zp[2]:57 [ atan2_16::yd#5 atan2_16::yd#3 atan2_16::yd#10 atan2_16::yd#1 atan2_16::yd#2 ] zp[2]:59 [ atan2_16::xd#5 atan2_16::xd#3 atan2_16::xd#10 atan2_16::xd#1 atan2_16::xd#2 ] zp[2]:52 [ atan2_16::angle#6 atan2_16::angle#12 atan2_16::angle#13 atan2_16::angle#2 atan2_16::angle#3 ] zp[2]:47 [ atan2_16::yi#3 atan2_16::yi#8 atan2_16::yi#0 atan2_16::yi#16 atan2_16::$2 atan2_16::yi#1 atan2_16::yi#2 ] zp[2]:49 [ atan2_16::xi#3 atan2_16::xi#8 atan2_16::xi#0 atan2_16::xi#13 atan2_16::$7 atan2_16::xi#1 atan2_16::xi#2 ] reg byte a [ atan2_16::$23 ] reg byte a [ atan2_16::$22 ] reg byte x [ atan2_16::i#2 atan2_16::i#1 ] zp[2]:54 [ atan2_16::return#0 atan2_16::angle#11 atan2_16::angle#1 atan2_16::angle#4 atan2_16::angle#5 ] zp[2]:118 [ atan2_16::return#2 ] zp[2]:114 [ atan2_16::x#0 ] zp[2]:116 [ atan2_16::y#0 ] Limited combination testing to 100 combinations of 144 possible. -Uplifting [sqrt] best 1234098 combination zp[2]:159 [ sqrt::found#0 ] zp[2]:161 [ sqrt::$2 ] zp[2]:103 [ sqrt::val#0 ] zp[2]:163 [ sqrt::$1 ] reg byte a [ sqrt::return#0 ] reg byte a [ sqrt::return#2 ] -Uplifting [sqr] best 1233761 combination reg byte a [ sqr::$0 ] reg byte a [ sqr::val#2 sqr::val#1 sqr::val#0 ] zp[2]:153 [ sqr::return#0 ] zp[2]:97 [ sqr::return#3 ] zp[2]:92 [ sqr::return#2 ] -Uplifting [init_angle_screen] best 1232161 combination zp[1]:28 [ init_angle_screen::xb#2 init_angle_screen::xb#1 ] reg byte a [ init_angle_screen::$3 ] reg byte a [ init_angle_screen::$4 ] reg byte a [ init_angle_screen::$5 ] zp[2]:120 [ init_angle_screen::angle_w#0 ] zp[2]:122 [ init_angle_screen::$7 ] zp[1]:125 [ init_angle_screen::$9 ] zp[1]:126 [ init_angle_screen::$10 ] zp[1]:127 [ init_angle_screen::$11 ] zp[1]:27 [ init_angle_screen::x#2 init_angle_screen::x#1 ] zp[1]:124 [ init_angle_screen::ang_w#0 ] zp[2]:112 [ init_angle_screen::yw#0 ] zp[2]:109 [ init_angle_screen::xw#0 ] zp[1]:22 [ init_angle_screen::y#5 init_angle_screen::y#1 ] zp[2]:25 [ init_angle_screen::screen_bottomline#6 init_angle_screen::screen_bottomline#0 init_angle_screen::screen_bottomline#1 ] zp[2]:23 [ init_angle_screen::screen_topline#6 init_angle_screen::screen_topline#7 init_angle_screen::screen_topline#1 ] zp[2]:76 [ init_angle_screen::screen#0 ] +Uplifting [sqrt] best 1229098 combination zp[2]:159 [ sqrt::found#0 ] zp[2]:161 [ sqrt::$2 ] zp[2]:103 [ sqrt::val#0 ] zp[2]:163 [ sqrt::$1 ] reg byte a [ sqrt::return#0 ] reg byte a [ sqrt::return#2 ] +Uplifting [sqr] best 1228761 combination reg byte a [ sqr::$0 ] reg byte a [ sqr::val#2 sqr::val#1 sqr::val#0 ] zp[2]:153 [ sqr::return#0 ] zp[2]:97 [ sqr::return#3 ] zp[2]:92 [ sqr::return#2 ] +Uplifting [init_angle_screen] best 1227161 combination zp[1]:28 [ init_angle_screen::xb#2 init_angle_screen::xb#1 ] reg byte a [ init_angle_screen::$3 ] reg byte a [ init_angle_screen::$4 ] reg byte a [ init_angle_screen::$5 ] zp[2]:120 [ init_angle_screen::angle_w#0 ] zp[2]:122 [ init_angle_screen::$7 ] zp[1]:125 [ init_angle_screen::$9 ] zp[1]:126 [ init_angle_screen::$10 ] zp[1]:127 [ init_angle_screen::$11 ] zp[1]:27 [ init_angle_screen::x#2 init_angle_screen::x#1 ] zp[1]:124 [ init_angle_screen::ang_w#0 ] zp[2]:112 [ init_angle_screen::yw#0 ] zp[2]:109 [ init_angle_screen::xw#0 ] zp[1]:22 [ init_angle_screen::y#5 init_angle_screen::y#1 ] zp[2]:25 [ init_angle_screen::screen_bottomline#6 init_angle_screen::screen_bottomline#0 init_angle_screen::screen_bottomline#1 ] zp[2]:23 [ init_angle_screen::screen_topline#6 init_angle_screen::screen_topline#7 init_angle_screen::screen_topline#1 ] zp[2]:76 [ init_angle_screen::screen#0 ] Limited combination testing to 100 combinations of 65536 possible. -Uplifting [init_dist_screen] best 1228961 combination reg byte a [ init_dist_screen::xd#0 init_dist_screen::$16 init_dist_screen::$14 ] zp[1]:20 [ init_dist_screen::xb#2 init_dist_screen::xb#1 ] reg byte a [ init_dist_screen::x2#0 ] zp[2]:99 [ init_dist_screen::xds#0 ] zp[2]:101 [ init_dist_screen::ds#0 ] zp[1]:19 [ init_dist_screen::x#2 init_dist_screen::x#1 ] reg byte a [ init_dist_screen::d#0 ] zp[1]:18 [ init_dist_screen::yd#0 init_dist_screen::$7 init_dist_screen::$5 ] zp[1]:91 [ init_dist_screen::y2#0 ] zp[1]:13 [ init_dist_screen::y#10 init_dist_screen::y#1 ] zp[2]:16 [ init_dist_screen::screen_bottomline#11 init_dist_screen::screen_bottomline#0 init_dist_screen::screen_bottomline#1 ] zp[2]:14 [ init_dist_screen::screen_topline#11 init_dist_screen::screen#0 init_dist_screen::screen_topline#1 ] zp[2]:94 [ init_dist_screen::yds#0 ] +Uplifting [init_dist_screen] best 1223961 combination reg byte a [ init_dist_screen::xd#0 init_dist_screen::$16 init_dist_screen::$14 ] zp[1]:20 [ init_dist_screen::xb#2 init_dist_screen::xb#1 ] reg byte a [ init_dist_screen::x2#0 ] zp[2]:99 [ init_dist_screen::xds#0 ] zp[2]:101 [ init_dist_screen::ds#0 ] zp[1]:19 [ init_dist_screen::x#2 init_dist_screen::x#1 ] reg byte a [ init_dist_screen::d#0 ] zp[1]:18 [ init_dist_screen::yd#0 init_dist_screen::$7 init_dist_screen::$5 ] zp[1]:91 [ init_dist_screen::y2#0 ] zp[1]:13 [ init_dist_screen::y#10 init_dist_screen::y#1 ] zp[2]:16 [ init_dist_screen::screen_bottomline#11 init_dist_screen::screen_bottomline#0 init_dist_screen::screen_bottomline#1 ] zp[2]:14 [ init_dist_screen::screen_topline#11 init_dist_screen::screen#0 init_dist_screen::screen_topline#1 ] zp[2]:94 [ init_dist_screen::yds#0 ] Limited combination testing to 100 combinations of 6144 possible. -Uplifting [init_squares] best 1228761 combination reg byte x [ init_squares::i#2 init_squares::i#1 ] reg byte a [ init_squares::$3 ] reg byte a [ init_squares::$4 ] zp[2]:44 [ init_squares::squares#2 init_squares::squares#1 init_squares::squares#0 ] zp[2]:42 [ init_squares::sqr#2 init_squares::sqr#1 ] -Uplifting [init_buckets] best 1228481 combination reg byte y [ init_buckets::i#2 init_buckets::i#1 ] reg byte y [ init_buckets::i3#2 init_buckets::i3#1 ] zp[2]:30 [ init_buckets::dist#4 init_buckets::dist#6 init_buckets::dist#1 ] zp[2]:32 [ init_buckets::i1#2 init_buckets::i1#1 ] zp[2]:34 [ init_buckets::i2#2 init_buckets::i2#1 ] zp[2]:128 [ init_buckets::$15 ] zp[2]:132 [ init_buckets::$11 ] zp[2]:134 [ init_buckets::$16 ] zp[2]:137 [ init_buckets::$14 ] zp[2]:139 [ init_buckets::$12 ] zp[2]:141 [ init_buckets::$17 ] reg byte a [ init_buckets::$13 ] zp[2]:39 [ init_buckets::i4#2 init_buckets::i4#1 ] zp[2]:37 [ init_buckets::dist#5 init_buckets::dist#8 init_buckets::dist#3 ] zp[2]:145 [ init_buckets::$7 ] zp[2]:143 [ init_buckets::bucket#0 ] zp[1]:136 [ init_buckets::distance#0 ] zp[2]:130 [ init_buckets::$4 ] zp[2]:78 [ init_buckets::screen#0 ] -Uplifting [main] best 1227041 combination zp[2]:11 [ main::min_offset#5 main::min_offset#9 main::offset#0 main::min_offset#11 ] zp[1]:10 [ main::min_angle#2 main::min_angle#5 main::min_angle#1 ] zp[2]:8 [ main::min_offset#2 main::min_offset#8 ] reg byte a [ main::$24 ] zp[2]:87 [ main::fill#0 ] zp[2]:89 [ main::angle#0 ] reg byte x [ main::i#2 main::i#1 ] reg byte a [ main::$23 ] zp[2]:84 [ main::fill1#0 ] zp[1]:6 [ main::bucket_idx#6 main::bucket_idx#1 ] zp[1]:83 [ main::bucket_size#0 ] zp[2]:81 [ main::bucket#0 ] +Uplifting [init_squares] best 1223761 combination reg byte x [ init_squares::i#2 init_squares::i#1 ] reg byte a [ init_squares::$3 ] reg byte a [ init_squares::$4 ] zp[2]:44 [ init_squares::squares#2 init_squares::squares#1 init_squares::squares#0 ] zp[2]:42 [ init_squares::sqr#2 init_squares::sqr#1 ] +Uplifting [init_buckets] best 1223481 combination reg byte y [ init_buckets::i#2 init_buckets::i#1 ] reg byte y [ init_buckets::i3#2 init_buckets::i3#1 ] zp[2]:30 [ init_buckets::dist#4 init_buckets::dist#6 init_buckets::dist#1 ] zp[2]:32 [ init_buckets::i1#2 init_buckets::i1#1 ] zp[2]:34 [ init_buckets::i2#2 init_buckets::i2#1 ] zp[2]:128 [ init_buckets::$15 ] zp[2]:132 [ init_buckets::$11 ] zp[2]:134 [ init_buckets::$16 ] zp[2]:137 [ init_buckets::$14 ] zp[2]:139 [ init_buckets::$12 ] zp[2]:141 [ init_buckets::$17 ] reg byte a [ init_buckets::$13 ] zp[2]:39 [ init_buckets::i4#2 init_buckets::i4#1 ] zp[2]:37 [ init_buckets::dist#5 init_buckets::dist#8 init_buckets::dist#3 ] zp[2]:145 [ init_buckets::$7 ] zp[2]:143 [ init_buckets::bucket#0 ] zp[1]:136 [ init_buckets::distance#0 ] zp[2]:130 [ init_buckets::$4 ] zp[2]:78 [ init_buckets::screen#0 ] +Uplifting [main] best 1222041 combination zp[2]:11 [ main::min_offset#5 main::min_offset#9 main::offset#0 main::min_offset#11 ] zp[1]:10 [ main::min_angle#2 main::min_angle#5 main::min_angle#1 ] zp[2]:8 [ main::min_offset#2 main::min_offset#8 ] reg byte a [ main::$24 ] zp[2]:87 [ main::fill#0 ] zp[2]:89 [ main::angle#0 ] reg byte x [ main::i#2 main::i#1 ] reg byte a [ main::$23 ] zp[2]:84 [ main::fill1#0 ] zp[1]:6 [ main::bucket_idx#6 main::bucket_idx#1 ] zp[1]:83 [ main::bucket_size#0 ] zp[2]:81 [ main::bucket#0 ] Limited combination testing to 100 combinations of 256 possible. -Uplifting [malloc] best 1227041 combination zp[2]:4 [ malloc::size#7 malloc::size#1 ] zp[2]:74 [ malloc::mem#0 ] -Uplifting [] best 1227041 combination zp[2]:2 [ heap_head#19 heap_head#0 ] zp[2]:148 [ SQUARES#0 ] zp[2]:64 [ SCREEN_DIST#0 ] zp[2]:66 [ SCREEN_ANGLE#0 ] zp[2]:72 [ BUCKET_IDX#0 ] zp[2]:70 [ BUCKETS#0 ] zp[2]:68 [ BUCKET_SIZES#0 ] -Uplifting [MOS6526_CIA] best 1227041 combination -Uplifting [MOS6569_VICII] best 1227041 combination -Uplifting [MOS6581_SID] best 1227041 combination -Uplifting [RADIX] best 1227041 combination -Uplifting [__start] best 1227041 combination +Uplifting [malloc] best 1222041 combination zp[2]:4 [ malloc::size#7 malloc::size#1 ] zp[2]:74 [ malloc::mem#0 ] +Uplifting [] best 1222041 combination zp[2]:2 [ heap_head#19 heap_head#0 ] zp[2]:148 [ SQUARES#0 ] zp[2]:64 [ SCREEN_DIST#0 ] zp[2]:66 [ SCREEN_ANGLE#0 ] zp[2]:72 [ BUCKET_IDX#0 ] zp[2]:70 [ BUCKETS#0 ] zp[2]:68 [ BUCKET_SIZES#0 ] +Uplifting [MOS6526_CIA] best 1222041 combination +Uplifting [MOS6569_VICII] best 1222041 combination +Uplifting [MOS6581_SID] best 1222041 combination +Uplifting [RADIX] best 1222041 combination +Uplifting [__start] best 1222041 combination Attempting to uplift remaining variables inzp[1]:20 [ init_dist_screen::xb#2 init_dist_screen::xb#1 ] -Uplifting [init_dist_screen] best 1227041 combination zp[1]:20 [ init_dist_screen::xb#2 init_dist_screen::xb#1 ] +Uplifting [init_dist_screen] best 1222041 combination zp[1]:20 [ init_dist_screen::xb#2 init_dist_screen::xb#1 ] Attempting to uplift remaining variables inzp[1]:28 [ init_angle_screen::xb#2 init_angle_screen::xb#1 ] -Uplifting [init_angle_screen] best 1227041 combination zp[1]:28 [ init_angle_screen::xb#2 init_angle_screen::xb#1 ] +Uplifting [init_angle_screen] best 1222041 combination zp[1]:28 [ init_angle_screen::xb#2 init_angle_screen::xb#1 ] Attempting to uplift remaining variables inzp[1]:125 [ init_angle_screen::$9 ] -Uplifting [init_angle_screen] best 1226441 combination reg byte a [ init_angle_screen::$9 ] +Uplifting [init_angle_screen] best 1221441 combination reg byte a [ init_angle_screen::$9 ] Attempting to uplift remaining variables inzp[1]:126 [ init_angle_screen::$10 ] -Uplifting [init_angle_screen] best 1226041 combination reg byte a [ init_angle_screen::$10 ] +Uplifting [init_angle_screen] best 1221041 combination reg byte a [ init_angle_screen::$10 ] Attempting to uplift remaining variables inzp[1]:127 [ init_angle_screen::$11 ] -Uplifting [init_angle_screen] best 1225441 combination reg byte a [ init_angle_screen::$11 ] +Uplifting [init_angle_screen] best 1220441 combination reg byte a [ init_angle_screen::$11 ] Attempting to uplift remaining variables inzp[1]:19 [ init_dist_screen::x#2 init_dist_screen::x#1 ] -Uplifting [init_dist_screen] best 1225441 combination zp[1]:19 [ init_dist_screen::x#2 init_dist_screen::x#1 ] +Uplifting [init_dist_screen] best 1220441 combination zp[1]:19 [ init_dist_screen::x#2 init_dist_screen::x#1 ] Attempting to uplift remaining variables inzp[1]:27 [ init_angle_screen::x#2 init_angle_screen::x#1 ] -Uplifting [init_angle_screen] best 1225441 combination zp[1]:27 [ init_angle_screen::x#2 init_angle_screen::x#1 ] +Uplifting [init_angle_screen] best 1220441 combination zp[1]:27 [ init_angle_screen::x#2 init_angle_screen::x#1 ] Attempting to uplift remaining variables inzp[1]:124 [ init_angle_screen::ang_w#0 ] -Uplifting [init_angle_screen] best 1225441 combination zp[1]:124 [ init_angle_screen::ang_w#0 ] +Uplifting [init_angle_screen] best 1220441 combination zp[1]:124 [ init_angle_screen::ang_w#0 ] Attempting to uplift remaining variables inzp[1]:18 [ init_dist_screen::yd#0 init_dist_screen::$7 init_dist_screen::$5 ] -Uplifting [init_dist_screen] best 1225371 combination reg byte a [ init_dist_screen::yd#0 init_dist_screen::$7 init_dist_screen::$5 ] +Uplifting [init_dist_screen] best 1220371 combination reg byte a [ init_dist_screen::yd#0 init_dist_screen::$7 init_dist_screen::$5 ] Attempting to uplift remaining variables inzp[1]:10 [ main::min_angle#2 main::min_angle#5 main::min_angle#1 ] -Uplifting [main] best 1225371 combination zp[1]:10 [ main::min_angle#2 main::min_angle#5 main::min_angle#1 ] +Uplifting [main] best 1220371 combination zp[1]:10 [ main::min_angle#2 main::min_angle#5 main::min_angle#1 ] Attempting to uplift remaining variables inzp[1]:91 [ init_dist_screen::y2#0 ] -Uplifting [init_dist_screen] best 1225271 combination reg byte a [ init_dist_screen::y2#0 ] +Uplifting [init_dist_screen] best 1220271 combination reg byte a [ init_dist_screen::y2#0 ] Attempting to uplift remaining variables inzp[1]:22 [ init_angle_screen::y#5 init_angle_screen::y#1 ] -Uplifting [init_angle_screen] best 1225271 combination zp[1]:22 [ init_angle_screen::y#5 init_angle_screen::y#1 ] +Uplifting [init_angle_screen] best 1220271 combination zp[1]:22 [ init_angle_screen::y#5 init_angle_screen::y#1 ] Attempting to uplift remaining variables inzp[1]:13 [ init_dist_screen::y#10 init_dist_screen::y#1 ] -Uplifting [init_dist_screen] best 1225271 combination zp[1]:13 [ init_dist_screen::y#10 init_dist_screen::y#1 ] +Uplifting [init_dist_screen] best 1220271 combination zp[1]:13 [ init_dist_screen::y#10 init_dist_screen::y#1 ] Attempting to uplift remaining variables inzp[1]:136 [ init_buckets::distance#0 ] -Uplifting [init_buckets] best 1225271 combination zp[1]:136 [ init_buckets::distance#0 ] +Uplifting [init_buckets] best 1220271 combination zp[1]:136 [ init_buckets::distance#0 ] Attempting to uplift remaining variables inzp[1]:6 [ main::bucket_idx#6 main::bucket_idx#1 ] -Uplifting [main] best 1225271 combination zp[1]:6 [ main::bucket_idx#6 main::bucket_idx#1 ] +Uplifting [main] best 1220271 combination zp[1]:6 [ main::bucket_idx#6 main::bucket_idx#1 ] Attempting to uplift remaining variables inzp[1]:83 [ main::bucket_size#0 ] -Uplifting [main] best 1225271 combination zp[1]:83 [ main::bucket_size#0 ] +Uplifting [main] best 1220271 combination zp[1]:83 [ main::bucket_size#0 ] Coalescing zero page register [ zp[2]:4 [ malloc::size#7 malloc::size#1 ] ] with [ zp[2]:74 [ malloc::mem#0 ] ] - score: 1 Coalescing zero page register [ zp[2]:4 [ malloc::size#7 malloc::size#1 malloc::mem#0 ] ] with [ zp[2]:128 [ init_buckets::$15 ] ] - score: 1 Coalescing zero page register [ zp[2]:8 [ main::min_offset#2 main::min_offset#8 ] ] with [ zp[2]:84 [ main::fill1#0 ] ] - score: 1 @@ -6457,8 +6457,7 @@ atan2_16: { __b10: // [200] if(atan2_16::yi#3!=0) goto atan2_16::@11 -- vwsz1_neq_0_then_la1 lda.z yi+1 - bne __b11 - lda.z yi + ora.z yi bne __b11 // [201] phi from atan2_16::@10 atan2_16::@19 to atan2_16::@12 [phi:atan2_16::@10/atan2_16::@19->atan2_16::@12] __b12_from___b10: @@ -6790,8 +6789,7 @@ bsearch16u: { sta.z result+1 // [248] if(bsearch16u::result#0!=0) goto bsearch16u::@6 -- vwsz1_neq_0_then_la1 lda.z result+1 - bne __b6 - lda.z result + ora.z result bne __b6 jmp __b8 // bsearch16u::@8 @@ -7121,7 +7119,7 @@ Removing instruction ldy #0 Succesful ASM optimization Pass5UnnecesaryLoadElimination Removing instruction __b1: Succesful ASM optimization Pass5UnusedLabelElimination -Fixing long branch [845] beq __b12 to bne +Fixing long branch [844] beq __b12 to bne Fixing long branch [739] bpl __b1 to bmi Fixing long branch [751] bpl __b4 to bmi @@ -7485,7 +7483,7 @@ zp[2]:42 [ bsearch16u::result#0 init_buckets::$14 init_buckets::$12 init_buckets FINAL ASSEMBLER -Score: 1116708 +Score: 1111708 // File Comments // Fill screen using a spiral based on distance-to-center / angle-to-center @@ -8760,8 +8758,7 @@ atan2_16: { // if(yi==0) // [200] if(atan2_16::yi#3!=0) goto atan2_16::@11 -- vwsz1_neq_0_then_la1 lda.z yi+1 - bne __b11 - lda.z yi + ora.z yi bne __b11 // [201] phi from atan2_16::@10 atan2_16::@19 to atan2_16::@12 [phi:atan2_16::@10/atan2_16::@19->atan2_16::@12] // [201] phi atan2_16::angle#6 = atan2_16::angle#12 [phi:atan2_16::@10/atan2_16::@19->atan2_16::@12#0] -- register_copy @@ -9080,8 +9077,7 @@ bsearch16u: { sta.z result+1 // if (result == 0) // [248] if(bsearch16u::result#0!=0) goto bsearch16u::@6 -- vwsz1_neq_0_then_la1 - bne __b6 - lda.z result + ora.z result bne __b6 // bsearch16u::@8 // [249] bsearch16u::return#7 = bsearch16u::pivot#0 -- pwuz1=pwuz2 diff --git a/src/test/ref/screen-show-spiral.asm b/src/test/ref/screen-show-spiral.asm index 0126ab5c8..e168c4df9 100644 --- a/src/test/ref/screen-show-spiral.asm +++ b/src/test/ref/screen-show-spiral.asm @@ -606,8 +606,7 @@ atan2_16: { __b10: // if(yi==0) lda.z yi+1 - bne __b11 - lda.z yi + ora.z yi bne __b11 __b12: // angle /=2 @@ -835,8 +834,7 @@ bsearch16u: { sbc (pivot),y sta.z result+1 // if (result == 0) - bne __b6 - lda.z result + ora.z result bne __b6 lda.z pivot sta.z return diff --git a/src/test/ref/screen-show-spiral.log b/src/test/ref/screen-show-spiral.log index a6cdd5b91..f8390c413 100644 --- a/src/test/ref/screen-show-spiral.log +++ b/src/test/ref/screen-show-spiral.log @@ -3801,45 +3801,45 @@ Uplift Scope [] 12,104.4: zp[2]:2 [ heap_head#13 heap_head#0 ] 16.15: zp[2]:102 Uplift Scope [RADIX] Uplift Scope [__start] -Uplifting [bsearch16u] best 1342286 combination reg byte x [ bsearch16u::num#5 bsearch16u::num#1 bsearch16u::num#3 bsearch16u::num#0 ] zp[2]:54 [ bsearch16u::return#1 bsearch16u::return#2 bsearch16u::items#2 bsearch16u::items#1 bsearch16u::items#8 bsearch16u::$2 bsearch16u::return#7 bsearch16u::items#0 ] reg byte a [ bsearch16u::$6 ] reg byte a [ bsearch16u::$14 ] zp[2]:126 [ bsearch16u::result#0 ] zp[2]:124 [ bsearch16u::pivot#0 ] zp[2]:111 [ bsearch16u::return#3 ] zp[2]:109 [ bsearch16u::key#0 ] -Uplifting [atan2_16] best 1228286 combination reg byte y [ atan2_16::shift#2 atan2_16::shift#5 atan2_16::shift#1 ] zp[2]:50 [ atan2_16::yd#5 atan2_16::yd#3 atan2_16::yd#10 atan2_16::yd#1 atan2_16::yd#2 ] zp[2]:52 [ atan2_16::xd#5 atan2_16::xd#3 atan2_16::xd#10 atan2_16::xd#1 atan2_16::xd#2 ] zp[2]:45 [ atan2_16::angle#6 atan2_16::angle#12 atan2_16::angle#13 atan2_16::angle#2 atan2_16::angle#3 ] zp[2]:40 [ atan2_16::yi#3 atan2_16::yi#8 atan2_16::yi#0 atan2_16::yi#16 atan2_16::$2 atan2_16::yi#1 atan2_16::yi#2 ] zp[2]:42 [ atan2_16::xi#3 atan2_16::xi#8 atan2_16::xi#0 atan2_16::xi#13 atan2_16::$7 atan2_16::xi#1 atan2_16::xi#2 ] reg byte a [ atan2_16::$23 ] reg byte a [ atan2_16::$22 ] reg byte x [ atan2_16::i#2 atan2_16::i#1 ] zp[2]:47 [ atan2_16::return#0 atan2_16::angle#11 atan2_16::angle#1 atan2_16::angle#4 atan2_16::angle#5 ] zp[2]:92 [ atan2_16::return#2 ] zp[2]:88 [ atan2_16::x#0 ] zp[2]:90 [ atan2_16::y#0 ] +Uplifting [bsearch16u] best 1337286 combination reg byte x [ bsearch16u::num#5 bsearch16u::num#1 bsearch16u::num#3 bsearch16u::num#0 ] zp[2]:54 [ bsearch16u::return#1 bsearch16u::return#2 bsearch16u::items#2 bsearch16u::items#1 bsearch16u::items#8 bsearch16u::$2 bsearch16u::return#7 bsearch16u::items#0 ] reg byte a [ bsearch16u::$6 ] reg byte a [ bsearch16u::$14 ] zp[2]:126 [ bsearch16u::result#0 ] zp[2]:124 [ bsearch16u::pivot#0 ] zp[2]:111 [ bsearch16u::return#3 ] zp[2]:109 [ bsearch16u::key#0 ] +Uplifting [atan2_16] best 1223286 combination reg byte y [ atan2_16::shift#2 atan2_16::shift#5 atan2_16::shift#1 ] zp[2]:50 [ atan2_16::yd#5 atan2_16::yd#3 atan2_16::yd#10 atan2_16::yd#1 atan2_16::yd#2 ] zp[2]:52 [ atan2_16::xd#5 atan2_16::xd#3 atan2_16::xd#10 atan2_16::xd#1 atan2_16::xd#2 ] zp[2]:45 [ atan2_16::angle#6 atan2_16::angle#12 atan2_16::angle#13 atan2_16::angle#2 atan2_16::angle#3 ] zp[2]:40 [ atan2_16::yi#3 atan2_16::yi#8 atan2_16::yi#0 atan2_16::yi#16 atan2_16::$2 atan2_16::yi#1 atan2_16::yi#2 ] zp[2]:42 [ atan2_16::xi#3 atan2_16::xi#8 atan2_16::xi#0 atan2_16::xi#13 atan2_16::$7 atan2_16::xi#1 atan2_16::xi#2 ] reg byte a [ atan2_16::$23 ] reg byte a [ atan2_16::$22 ] reg byte x [ atan2_16::i#2 atan2_16::i#1 ] zp[2]:47 [ atan2_16::return#0 atan2_16::angle#11 atan2_16::angle#1 atan2_16::angle#4 atan2_16::angle#5 ] zp[2]:92 [ atan2_16::return#2 ] zp[2]:88 [ atan2_16::x#0 ] zp[2]:90 [ atan2_16::y#0 ] Limited combination testing to 100 combinations of 144 possible. -Uplifting [sqrt] best 1227383 combination zp[2]:113 [ sqrt::found#0 ] zp[2]:115 [ sqrt::$2 ] zp[2]:77 [ sqrt::val#0 ] zp[2]:117 [ sqrt::$1 ] reg byte a [ sqrt::return#0 ] reg byte a [ sqrt::return#2 ] -Uplifting [sqr] best 1227046 combination reg byte a [ sqr::$0 ] reg byte a [ sqr::val#2 sqr::val#1 sqr::val#0 ] zp[2]:107 [ sqr::return#0 ] zp[2]:71 [ sqr::return#3 ] zp[2]:66 [ sqr::return#2 ] -Uplifting [init_angle_screen] best 1225446 combination zp[1]:33 [ init_angle_screen::xb#2 init_angle_screen::xb#1 ] reg byte a [ init_angle_screen::$3 ] reg byte a [ init_angle_screen::$4 ] reg byte a [ init_angle_screen::$5 ] zp[2]:94 [ init_angle_screen::angle_w#0 ] zp[2]:96 [ init_angle_screen::$7 ] zp[1]:99 [ init_angle_screen::$9 ] zp[1]:100 [ init_angle_screen::$10 ] zp[1]:101 [ init_angle_screen::$11 ] zp[1]:32 [ init_angle_screen::x#2 init_angle_screen::x#1 ] zp[1]:98 [ init_angle_screen::ang_w#0 ] zp[2]:86 [ init_angle_screen::yw#0 ] zp[2]:83 [ init_angle_screen::xw#0 ] zp[1]:27 [ init_angle_screen::y#5 init_angle_screen::y#1 ] zp[2]:30 [ init_angle_screen::screen_bottomline#6 init_angle_screen::screen_bottomline#0 init_angle_screen::screen_bottomline#1 ] zp[2]:28 [ init_angle_screen::screen_topline#6 init_angle_screen::screen_topline#7 init_angle_screen::screen_topline#1 ] zp[2]:63 [ init_angle_screen::screen#0 ] +Uplifting [sqrt] best 1222383 combination zp[2]:113 [ sqrt::found#0 ] zp[2]:115 [ sqrt::$2 ] zp[2]:77 [ sqrt::val#0 ] zp[2]:117 [ sqrt::$1 ] reg byte a [ sqrt::return#0 ] reg byte a [ sqrt::return#2 ] +Uplifting [sqr] best 1222046 combination reg byte a [ sqr::$0 ] reg byte a [ sqr::val#2 sqr::val#1 sqr::val#0 ] zp[2]:107 [ sqr::return#0 ] zp[2]:71 [ sqr::return#3 ] zp[2]:66 [ sqr::return#2 ] +Uplifting [init_angle_screen] best 1220446 combination zp[1]:33 [ init_angle_screen::xb#2 init_angle_screen::xb#1 ] reg byte a [ init_angle_screen::$3 ] reg byte a [ init_angle_screen::$4 ] reg byte a [ init_angle_screen::$5 ] zp[2]:94 [ init_angle_screen::angle_w#0 ] zp[2]:96 [ init_angle_screen::$7 ] zp[1]:99 [ init_angle_screen::$9 ] zp[1]:100 [ init_angle_screen::$10 ] zp[1]:101 [ init_angle_screen::$11 ] zp[1]:32 [ init_angle_screen::x#2 init_angle_screen::x#1 ] zp[1]:98 [ init_angle_screen::ang_w#0 ] zp[2]:86 [ init_angle_screen::yw#0 ] zp[2]:83 [ init_angle_screen::xw#0 ] zp[1]:27 [ init_angle_screen::y#5 init_angle_screen::y#1 ] zp[2]:30 [ init_angle_screen::screen_bottomline#6 init_angle_screen::screen_bottomline#0 init_angle_screen::screen_bottomline#1 ] zp[2]:28 [ init_angle_screen::screen_topline#6 init_angle_screen::screen_topline#7 init_angle_screen::screen_topline#1 ] zp[2]:63 [ init_angle_screen::screen#0 ] Limited combination testing to 100 combinations of 65536 possible. -Uplifting [init_dist_screen] best 1222246 combination reg byte a [ init_dist_screen::xd#0 init_dist_screen::$16 init_dist_screen::$14 ] zp[1]:25 [ init_dist_screen::xb#2 init_dist_screen::xb#1 ] reg byte a [ init_dist_screen::x2#0 ] zp[2]:73 [ init_dist_screen::xds#0 ] zp[2]:75 [ init_dist_screen::ds#0 ] zp[1]:24 [ init_dist_screen::x#2 init_dist_screen::x#1 ] reg byte a [ init_dist_screen::d#0 ] zp[1]:23 [ init_dist_screen::yd#0 init_dist_screen::$7 init_dist_screen::$5 ] zp[1]:65 [ init_dist_screen::y2#0 ] zp[1]:18 [ init_dist_screen::y#10 init_dist_screen::y#1 ] zp[2]:21 [ init_dist_screen::screen_bottomline#11 init_dist_screen::screen_bottomline#0 init_dist_screen::screen_bottomline#1 ] zp[2]:19 [ init_dist_screen::screen_topline#11 init_dist_screen::screen#0 init_dist_screen::screen_topline#1 ] zp[2]:68 [ init_dist_screen::yds#0 ] +Uplifting [init_dist_screen] best 1217246 combination reg byte a [ init_dist_screen::xd#0 init_dist_screen::$16 init_dist_screen::$14 ] zp[1]:25 [ init_dist_screen::xb#2 init_dist_screen::xb#1 ] reg byte a [ init_dist_screen::x2#0 ] zp[2]:73 [ init_dist_screen::xds#0 ] zp[2]:75 [ init_dist_screen::ds#0 ] zp[1]:24 [ init_dist_screen::x#2 init_dist_screen::x#1 ] reg byte a [ init_dist_screen::d#0 ] zp[1]:23 [ init_dist_screen::yd#0 init_dist_screen::$7 init_dist_screen::$5 ] zp[1]:65 [ init_dist_screen::y2#0 ] zp[1]:18 [ init_dist_screen::y#10 init_dist_screen::y#1 ] zp[2]:21 [ init_dist_screen::screen_bottomline#11 init_dist_screen::screen_bottomline#0 init_dist_screen::screen_bottomline#1 ] zp[2]:19 [ init_dist_screen::screen_topline#11 init_dist_screen::screen#0 init_dist_screen::screen_topline#1 ] zp[2]:68 [ init_dist_screen::yds#0 ] Limited combination testing to 100 combinations of 6144 possible. -Uplifting [init_squares] best 1222046 combination reg byte x [ init_squares::i#2 init_squares::i#1 ] reg byte a [ init_squares::$3 ] reg byte a [ init_squares::$4 ] zp[2]:37 [ init_squares::squares#2 init_squares::squares#1 init_squares::squares#0 ] zp[2]:35 [ init_squares::sqr#2 init_squares::sqr#1 ] -Uplifting [main] best 1222046 combination zp[2]:16 [ main::min_dist_angle#3 main::min_dist_angle#7 main::min_dist_angle#8 main::dist_angle#0 ] zp[2]:14 [ main::min_fill#5 main::min_fill#2 main::min_fill#10 ] zp[2]:12 [ main::min_dist_angle#2 main::min_dist_angle#6 ] zp[2]:6 [ main::fill#2 main::fill#1 ] zp[2]:10 [ main::angle#2 main::angle#0 main::angle#1 ] zp[2]:8 [ main::dist#2 main::dist#0 main::dist#1 ] -Uplifting [malloc] best 1222046 combination zp[2]:4 [ malloc::size#3 ] zp[2]:61 [ malloc::mem#0 ] -Uplifting [] best 1222046 combination zp[2]:2 [ heap_head#13 heap_head#0 ] zp[2]:102 [ SQUARES#0 ] zp[2]:59 [ SCREEN_ANGLE#0 ] zp[2]:57 [ SCREEN_DIST#0 ] -Uplifting [RADIX] best 1222046 combination -Uplifting [__start] best 1222046 combination +Uplifting [init_squares] best 1217046 combination reg byte x [ init_squares::i#2 init_squares::i#1 ] reg byte a [ init_squares::$3 ] reg byte a [ init_squares::$4 ] zp[2]:37 [ init_squares::squares#2 init_squares::squares#1 init_squares::squares#0 ] zp[2]:35 [ init_squares::sqr#2 init_squares::sqr#1 ] +Uplifting [main] best 1217046 combination zp[2]:16 [ main::min_dist_angle#3 main::min_dist_angle#7 main::min_dist_angle#8 main::dist_angle#0 ] zp[2]:14 [ main::min_fill#5 main::min_fill#2 main::min_fill#10 ] zp[2]:12 [ main::min_dist_angle#2 main::min_dist_angle#6 ] zp[2]:6 [ main::fill#2 main::fill#1 ] zp[2]:10 [ main::angle#2 main::angle#0 main::angle#1 ] zp[2]:8 [ main::dist#2 main::dist#0 main::dist#1 ] +Uplifting [malloc] best 1217046 combination zp[2]:4 [ malloc::size#3 ] zp[2]:61 [ malloc::mem#0 ] +Uplifting [] best 1217046 combination zp[2]:2 [ heap_head#13 heap_head#0 ] zp[2]:102 [ SQUARES#0 ] zp[2]:59 [ SCREEN_ANGLE#0 ] zp[2]:57 [ SCREEN_DIST#0 ] +Uplifting [RADIX] best 1217046 combination +Uplifting [__start] best 1217046 combination Attempting to uplift remaining variables inzp[1]:25 [ init_dist_screen::xb#2 init_dist_screen::xb#1 ] -Uplifting [init_dist_screen] best 1222046 combination zp[1]:25 [ init_dist_screen::xb#2 init_dist_screen::xb#1 ] +Uplifting [init_dist_screen] best 1217046 combination zp[1]:25 [ init_dist_screen::xb#2 init_dist_screen::xb#1 ] Attempting to uplift remaining variables inzp[1]:33 [ init_angle_screen::xb#2 init_angle_screen::xb#1 ] -Uplifting [init_angle_screen] best 1222046 combination zp[1]:33 [ init_angle_screen::xb#2 init_angle_screen::xb#1 ] +Uplifting [init_angle_screen] best 1217046 combination zp[1]:33 [ init_angle_screen::xb#2 init_angle_screen::xb#1 ] Attempting to uplift remaining variables inzp[1]:99 [ init_angle_screen::$9 ] -Uplifting [init_angle_screen] best 1221446 combination reg byte a [ init_angle_screen::$9 ] +Uplifting [init_angle_screen] best 1216446 combination reg byte a [ init_angle_screen::$9 ] Attempting to uplift remaining variables inzp[1]:100 [ init_angle_screen::$10 ] -Uplifting [init_angle_screen] best 1221046 combination reg byte a [ init_angle_screen::$10 ] +Uplifting [init_angle_screen] best 1216046 combination reg byte a [ init_angle_screen::$10 ] Attempting to uplift remaining variables inzp[1]:101 [ init_angle_screen::$11 ] -Uplifting [init_angle_screen] best 1220446 combination reg byte a [ init_angle_screen::$11 ] +Uplifting [init_angle_screen] best 1215446 combination reg byte a [ init_angle_screen::$11 ] Attempting to uplift remaining variables inzp[1]:24 [ init_dist_screen::x#2 init_dist_screen::x#1 ] -Uplifting [init_dist_screen] best 1220446 combination zp[1]:24 [ init_dist_screen::x#2 init_dist_screen::x#1 ] +Uplifting [init_dist_screen] best 1215446 combination zp[1]:24 [ init_dist_screen::x#2 init_dist_screen::x#1 ] Attempting to uplift remaining variables inzp[1]:32 [ init_angle_screen::x#2 init_angle_screen::x#1 ] -Uplifting [init_angle_screen] best 1220446 combination zp[1]:32 [ init_angle_screen::x#2 init_angle_screen::x#1 ] +Uplifting [init_angle_screen] best 1215446 combination zp[1]:32 [ init_angle_screen::x#2 init_angle_screen::x#1 ] Attempting to uplift remaining variables inzp[1]:98 [ init_angle_screen::ang_w#0 ] -Uplifting [init_angle_screen] best 1220446 combination zp[1]:98 [ init_angle_screen::ang_w#0 ] +Uplifting [init_angle_screen] best 1215446 combination zp[1]:98 [ init_angle_screen::ang_w#0 ] Attempting to uplift remaining variables inzp[1]:23 [ init_dist_screen::yd#0 init_dist_screen::$7 init_dist_screen::$5 ] -Uplifting [init_dist_screen] best 1220376 combination reg byte a [ init_dist_screen::yd#0 init_dist_screen::$7 init_dist_screen::$5 ] +Uplifting [init_dist_screen] best 1215376 combination reg byte a [ init_dist_screen::yd#0 init_dist_screen::$7 init_dist_screen::$5 ] Attempting to uplift remaining variables inzp[1]:65 [ init_dist_screen::y2#0 ] -Uplifting [init_dist_screen] best 1220276 combination reg byte a [ init_dist_screen::y2#0 ] +Uplifting [init_dist_screen] best 1215276 combination reg byte a [ init_dist_screen::y2#0 ] Attempting to uplift remaining variables inzp[1]:27 [ init_angle_screen::y#5 init_angle_screen::y#1 ] -Uplifting [init_angle_screen] best 1220276 combination zp[1]:27 [ init_angle_screen::y#5 init_angle_screen::y#1 ] +Uplifting [init_angle_screen] best 1215276 combination zp[1]:27 [ init_angle_screen::y#5 init_angle_screen::y#1 ] Attempting to uplift remaining variables inzp[1]:18 [ init_dist_screen::y#10 init_dist_screen::y#1 ] -Uplifting [init_dist_screen] best 1220276 combination zp[1]:18 [ init_dist_screen::y#10 init_dist_screen::y#1 ] +Uplifting [init_dist_screen] best 1215276 combination zp[1]:18 [ init_dist_screen::y#10 init_dist_screen::y#1 ] Coalescing zero page register [ zp[2]:4 [ malloc::size#3 ] ] with [ zp[2]:61 [ malloc::mem#0 ] ] - score: 1 Coalescing zero page register [ zp[2]:30 [ init_angle_screen::screen_bottomline#6 init_angle_screen::screen_bottomline#0 init_angle_screen::screen_bottomline#1 ] ] with [ zp[2]:63 [ init_angle_screen::screen#0 ] ] - score: 1 Coalescing zero page register [ zp[2]:45 [ atan2_16::angle#6 atan2_16::angle#12 atan2_16::angle#13 atan2_16::angle#2 atan2_16::angle#3 ] ] with [ zp[2]:47 [ atan2_16::return#0 atan2_16::angle#11 atan2_16::angle#1 atan2_16::angle#4 atan2_16::angle#5 ] ] - score: 1 @@ -4791,8 +4791,7 @@ atan2_16: { __b10: // [139] if(atan2_16::yi#3!=0) goto atan2_16::@11 -- vwsz1_neq_0_then_la1 lda.z yi+1 - bne __b11 - lda.z yi + ora.z yi bne __b11 // [140] phi from atan2_16::@10 atan2_16::@19 to atan2_16::@12 [phi:atan2_16::@10/atan2_16::@19->atan2_16::@12] __b12_from___b10: @@ -5124,8 +5123,7 @@ bsearch16u: { sta.z result+1 // [187] if(bsearch16u::result#0!=0) goto bsearch16u::@6 -- vwsz1_neq_0_then_la1 lda.z result+1 - bne __b6 - lda.z result + ora.z result bne __b6 jmp __b8 // bsearch16u::@8 @@ -5383,7 +5381,7 @@ Removing instruction jmp __b1 Succesful ASM optimization Pass5NextJumpElimination Removing instruction ldy #0 Succesful ASM optimization Pass5UnnecesaryLoadElimination -Fixing long branch [593] beq __b12 to bne +Fixing long branch [592] beq __b12 to bne Fixing long branch [487] bpl __b1 to bmi Fixing long branch [499] bpl __b4 to bmi @@ -5680,7 +5678,7 @@ zp[2]:38 [ bsearch16u::result#0 init_angle_screen::yw#0 atan2_16::y#0 ] FINAL ASSEMBLER -Score: 1112770 +Score: 1107770 // File Comments // Fill screen using a spiral based on distance-to-center / angle-to-center @@ -6556,8 +6554,7 @@ atan2_16: { // if(yi==0) // [139] if(atan2_16::yi#3!=0) goto atan2_16::@11 -- vwsz1_neq_0_then_la1 lda.z yi+1 - bne __b11 - lda.z yi + ora.z yi bne __b11 // [140] phi from atan2_16::@10 atan2_16::@19 to atan2_16::@12 [phi:atan2_16::@10/atan2_16::@19->atan2_16::@12] // [140] phi atan2_16::angle#6 = atan2_16::angle#12 [phi:atan2_16::@10/atan2_16::@19->atan2_16::@12#0] -- register_copy @@ -6876,8 +6873,7 @@ bsearch16u: { sta.z result+1 // if (result == 0) // [187] if(bsearch16u::result#0!=0) goto bsearch16u::@6 -- vwsz1_neq_0_then_la1 - bne __b6 - lda.z result + ora.z result bne __b6 // bsearch16u::@8 // [188] bsearch16u::return#7 = bsearch16u::pivot#0 -- pwuz1=pwuz2 diff --git a/src/test/ref/sinusgen16.asm b/src/test/ref/sinusgen16.asm index 4e7ba80a3..5ad2ddd30 100644 --- a/src/test/ref/sinusgen16.asm +++ b/src/test/ref/sinusgen16.asm @@ -699,8 +699,7 @@ mul16u: { __b1: // while(a!=0) lda.z a - bne __b2 - lda.z a+1 + ora.z a+1 bne __b2 // } rts diff --git a/src/test/ref/sinusgen16.log b/src/test/ref/sinusgen16.log index 9b50b7c49..16f26e3e6 100644 --- a/src/test/ref/sinusgen16.log +++ b/src/test/ref/sinusgen16.log @@ -2817,22 +2817,22 @@ Uplift Scope [main] 26: zp[2]:2 [ main::st1#2 main::st1#1 ] 6.6: zp[2]:51 [ main Uplift Scope [RADIX] Uplift Scope [print_cls] -Uplifting [mul16u] best 23634 combination zp[4]:43 [ mul16u::res#2 mul16u::res#6 mul16u::res#1 ] zp[4]:47 [ mul16u::mb#2 mul16u::mb#0 mul16u::mb#1 ] reg byte a [ mul16u::$1 ] zp[2]:41 [ mul16u::a#2 mul16u::a#1 mul16u::a#0 ] zp[4]:117 [ mul16u::return#2 ] zp[2]:115 [ mul16u::b#0 ] -Uplifting [print_char] best 23319 combination reg byte a [ print_char::ch#5 print_char::ch#0 print_char::ch#3 print_char::ch#4 ] -Uplifting [divr16u] best 23109 combination zp[2]:28 [ divr16u::rem#5 divr16u::rem#10 divr16u::rem#4 divr16u::rem#11 divr16u::rem#6 divr16u::rem#0 divr16u::rem#1 divr16u::rem#2 ] zp[2]:32 [ divr16u::quotient#3 divr16u::return#0 divr16u::quotient#1 divr16u::quotient#2 ] reg byte a [ divr16u::$1 ] reg byte a [ divr16u::$2 ] reg byte x [ divr16u::i#2 divr16u::i#1 ] zp[2]:30 [ divr16u::dividend#3 divr16u::dividend#5 divr16u::dividend#0 ] zp[2]:67 [ divr16u::return#2 ] zp[2]:71 [ divr16u::return#3 ] -Uplifting [] best 23109 combination zp[2]:26 [ print_char_cursor#36 print_char_cursor#58 print_char_cursor#54 print_char_cursor#20 print_char_cursor#1 print_char_cursor#12 ] zp[2]:113 [ rem16u#0 ] -Uplifting [mulu16_sel] best 23091 combination zp[2]:35 [ mulu16_sel::v1#5 mulu16_sel::v1#4 mulu16_sel::v1#0 mulu16_sel::v1#1 mulu16_sel::v1#2 mulu16_sel::v1#3 ] zp[4]:121 [ mulu16_sel::$0 ] zp[4]:125 [ mulu16_sel::$1 ] zp[2]:37 [ mulu16_sel::v2#5 mulu16_sel::v2#4 mulu16_sel::v2#0 mulu16_sel::v2#1 mulu16_sel::v2#3 ] zp[2]:129 [ mulu16_sel::return#12 ] zp[2]:85 [ mulu16_sel::return#0 ] zp[2]:89 [ mulu16_sel::return#1 ] zp[2]:93 [ mulu16_sel::return#2 ] zp[2]:99 [ mulu16_sel::return#10 ] zp[2]:103 [ mulu16_sel::return#11 ] reg byte x [ mulu16_sel::select#5 ] -Uplifting [print_uchar] best 23073 combination reg byte a [ print_uchar::$0 ] reg byte x [ print_uchar::$2 ] reg byte x [ print_uchar::b#2 print_uchar::b#0 print_uchar::b#1 ] -Uplifting [print_str] best 23073 combination zp[2]:12 [ print_str::str#3 print_str::str#6 print_str::str#0 ] -Uplifting [sin16s] best 23064 combination zp[4]:17 [ sin16s::x#6 sin16s::x#4 sin16s::x#0 sin16s::x#1 sin16s::x#2 ] zp[2]:21 [ sin16s::return#1 sin16s::return#5 sin16s::sinx#1 ] zp[4]:79 [ sin16s::$4 ] zp[2]:87 [ sin16s::x2#0 ] zp[2]:95 [ sin16s::x3_6#0 ] zp[2]:101 [ sin16s::x4#0 ] zp[2]:105 [ sin16s::x5#0 ] zp[2]:107 [ sin16s::x5_128#0 ] zp[2]:91 [ sin16s::x3#0 ] zp[2]:109 [ sin16s::usinx#1 ] zp[2]:83 [ sin16s::x1#0 ] zp[2]:61 [ sin16s::return#0 ] zp[2]:97 [ sin16s::usinx#0 ] reg byte y [ sin16s::isUpper#2 ] -Uplifting [memset] best 23064 combination zp[2]:23 [ memset::dst#2 memset::dst#1 ] -Uplifting [print_uint] best 23064 combination zp[2]:65 [ print_uint::w#0 ] -Uplifting [sin16s_gen] best 23064 combination zp[2]:4 [ sin16s_gen::i#2 sin16s_gen::i#1 ] zp[2]:63 [ sin16s_gen::$2 ] zp[4]:6 [ sin16s_gen::x#2 sin16s_gen::x#1 ] zp[2]:10 [ sin16s_gen::sintab#2 sin16s_gen::sintab#0 ] zp[4]:57 [ sin16s_gen::step#0 ] -Uplifting [print_sint] best 23064 combination zp[2]:14 [ print_sint::w#4 print_sint::w#0 print_sint::w#1 ] -Uplifting [div32u16u] best 23064 combination zp[2]:73 [ div32u16u::quotient_lo#0 ] zp[2]:69 [ div32u16u::quotient_hi#0 ] zp[4]:75 [ div32u16u::return#0 ] zp[4]:53 [ div32u16u::return#2 ] -Uplifting [main] best 23064 combination zp[2]:2 [ main::st1#2 main::st1#1 ] zp[2]:51 [ main::sw#0 ] -Uplifting [RADIX] best 23064 combination -Uplifting [print_cls] best 23064 combination +Uplifting [mul16u] best 23384 combination zp[4]:43 [ mul16u::res#2 mul16u::res#6 mul16u::res#1 ] zp[4]:47 [ mul16u::mb#2 mul16u::mb#0 mul16u::mb#1 ] reg byte a [ mul16u::$1 ] zp[2]:41 [ mul16u::a#2 mul16u::a#1 mul16u::a#0 ] zp[4]:117 [ mul16u::return#2 ] zp[2]:115 [ mul16u::b#0 ] +Uplifting [print_char] best 23069 combination reg byte a [ print_char::ch#5 print_char::ch#0 print_char::ch#3 print_char::ch#4 ] +Uplifting [divr16u] best 22859 combination zp[2]:28 [ divr16u::rem#5 divr16u::rem#10 divr16u::rem#4 divr16u::rem#11 divr16u::rem#6 divr16u::rem#0 divr16u::rem#1 divr16u::rem#2 ] zp[2]:32 [ divr16u::quotient#3 divr16u::return#0 divr16u::quotient#1 divr16u::quotient#2 ] reg byte a [ divr16u::$1 ] reg byte a [ divr16u::$2 ] reg byte x [ divr16u::i#2 divr16u::i#1 ] zp[2]:30 [ divr16u::dividend#3 divr16u::dividend#5 divr16u::dividend#0 ] zp[2]:67 [ divr16u::return#2 ] zp[2]:71 [ divr16u::return#3 ] +Uplifting [] best 22859 combination zp[2]:26 [ print_char_cursor#36 print_char_cursor#58 print_char_cursor#54 print_char_cursor#20 print_char_cursor#1 print_char_cursor#12 ] zp[2]:113 [ rem16u#0 ] +Uplifting [mulu16_sel] best 22841 combination zp[2]:35 [ mulu16_sel::v1#5 mulu16_sel::v1#4 mulu16_sel::v1#0 mulu16_sel::v1#1 mulu16_sel::v1#2 mulu16_sel::v1#3 ] zp[4]:121 [ mulu16_sel::$0 ] zp[4]:125 [ mulu16_sel::$1 ] zp[2]:37 [ mulu16_sel::v2#5 mulu16_sel::v2#4 mulu16_sel::v2#0 mulu16_sel::v2#1 mulu16_sel::v2#3 ] zp[2]:129 [ mulu16_sel::return#12 ] zp[2]:85 [ mulu16_sel::return#0 ] zp[2]:89 [ mulu16_sel::return#1 ] zp[2]:93 [ mulu16_sel::return#2 ] zp[2]:99 [ mulu16_sel::return#10 ] zp[2]:103 [ mulu16_sel::return#11 ] reg byte x [ mulu16_sel::select#5 ] +Uplifting [print_uchar] best 22823 combination reg byte a [ print_uchar::$0 ] reg byte x [ print_uchar::$2 ] reg byte x [ print_uchar::b#2 print_uchar::b#0 print_uchar::b#1 ] +Uplifting [print_str] best 22823 combination zp[2]:12 [ print_str::str#3 print_str::str#6 print_str::str#0 ] +Uplifting [sin16s] best 22814 combination zp[4]:17 [ sin16s::x#6 sin16s::x#4 sin16s::x#0 sin16s::x#1 sin16s::x#2 ] zp[2]:21 [ sin16s::return#1 sin16s::return#5 sin16s::sinx#1 ] zp[4]:79 [ sin16s::$4 ] zp[2]:87 [ sin16s::x2#0 ] zp[2]:95 [ sin16s::x3_6#0 ] zp[2]:101 [ sin16s::x4#0 ] zp[2]:105 [ sin16s::x5#0 ] zp[2]:107 [ sin16s::x5_128#0 ] zp[2]:91 [ sin16s::x3#0 ] zp[2]:109 [ sin16s::usinx#1 ] zp[2]:83 [ sin16s::x1#0 ] zp[2]:61 [ sin16s::return#0 ] zp[2]:97 [ sin16s::usinx#0 ] reg byte y [ sin16s::isUpper#2 ] +Uplifting [memset] best 22814 combination zp[2]:23 [ memset::dst#2 memset::dst#1 ] +Uplifting [print_uint] best 22814 combination zp[2]:65 [ print_uint::w#0 ] +Uplifting [sin16s_gen] best 22814 combination zp[2]:4 [ sin16s_gen::i#2 sin16s_gen::i#1 ] zp[2]:63 [ sin16s_gen::$2 ] zp[4]:6 [ sin16s_gen::x#2 sin16s_gen::x#1 ] zp[2]:10 [ sin16s_gen::sintab#2 sin16s_gen::sintab#0 ] zp[4]:57 [ sin16s_gen::step#0 ] +Uplifting [print_sint] best 22814 combination zp[2]:14 [ print_sint::w#4 print_sint::w#0 print_sint::w#1 ] +Uplifting [div32u16u] best 22814 combination zp[2]:73 [ div32u16u::quotient_lo#0 ] zp[2]:69 [ div32u16u::quotient_hi#0 ] zp[4]:75 [ div32u16u::return#0 ] zp[4]:53 [ div32u16u::return#2 ] +Uplifting [main] best 22814 combination zp[2]:2 [ main::st1#2 main::st1#1 ] zp[2]:51 [ main::sw#0 ] +Uplifting [RADIX] best 22814 combination +Uplifting [print_cls] best 22814 combination Coalescing zero page register [ zp[2]:21 [ sin16s::return#1 sin16s::return#5 sin16s::sinx#1 ] ] with [ zp[2]:109 [ sin16s::usinx#1 ] ] - score: 2 Coalescing zero page register [ zp[2]:28 [ divr16u::rem#5 divr16u::rem#10 divr16u::rem#4 divr16u::rem#11 divr16u::rem#6 divr16u::rem#0 divr16u::rem#1 divr16u::rem#2 ] ] with [ zp[2]:113 [ rem16u#0 ] ] - score: 2 Coalescing zero page register [ zp[2]:35 [ mulu16_sel::v1#5 mulu16_sel::v1#4 mulu16_sel::v1#0 mulu16_sel::v1#1 mulu16_sel::v1#2 mulu16_sel::v1#3 ] ] with [ zp[2]:91 [ sin16s::x3#0 ] ] - score: 2 @@ -3948,8 +3948,7 @@ mul16u: { __b1: // [154] if(mul16u::a#2!=0) goto mul16u::@2 -- vwuz1_neq_0_then_la1 lda.z a - bne __b2 - lda.z a+1 + ora.z a+1 bne __b2 jmp __breturn // mul16u::@return @@ -4421,7 +4420,7 @@ reg byte a [ mul16u::$1 ] FINAL ASSEMBLER -Score: 19419 +Score: 19169 // File Comments // Generates a 16-bit signed sine @@ -5439,8 +5438,7 @@ mul16u: { // while(a!=0) // [154] if(mul16u::a#2!=0) goto mul16u::@2 -- vwuz1_neq_0_then_la1 lda.z a - bne __b2 - lda.z a+1 + ora.z a+1 bne __b2 // mul16u::@return // } diff --git a/src/test/ref/sinusgen16b.asm b/src/test/ref/sinusgen16b.asm index 486846312..ab291e1ae 100644 --- a/src/test/ref/sinusgen16b.asm +++ b/src/test/ref/sinusgen16b.asm @@ -969,8 +969,7 @@ mul16u: { __b1: // while(a!=0) lda.z a - bne __b2 - lda.z a+1 + ora.z a+1 bne __b2 // } rts diff --git a/src/test/ref/sinusgen16b.log b/src/test/ref/sinusgen16b.log index 3bccf6c3a..54e26a07f 100644 --- a/src/test/ref/sinusgen16b.log +++ b/src/test/ref/sinusgen16b.log @@ -3740,26 +3740,26 @@ Uplift Scope [main] 18.33: zp[1]:6 [ main::i#2 main::i#1 ] 10.33: zp[2]:4 [ main Uplift Scope [RADIX] Uplift Scope [print_cls] -Uplifting [mul16u] best 26733 combination zp[4]:59 [ mul16u::res#2 mul16u::res#6 mul16u::res#1 ] zp[4]:63 [ mul16u::mb#2 mul16u::mb#0 mul16u::mb#1 ] reg byte a [ mul16u::$1 ] zp[2]:57 [ mul16u::a#2 mul16u::a#1 mul16u::a#0 ] zp[4]:173 [ mul16u::return#2 ] zp[2]:171 [ mul16u::b#0 ] -Uplifting [print_char] best 26418 combination reg byte a [ print_char::ch#5 print_char::ch#0 print_char::ch#3 print_char::ch#4 ] -Uplifting [divr16u] best 26208 combination zp[2]:44 [ divr16u::rem#5 divr16u::rem#10 divr16u::rem#4 divr16u::rem#11 divr16u::rem#6 divr16u::rem#0 divr16u::rem#1 divr16u::rem#2 ] zp[2]:48 [ divr16u::quotient#3 divr16u::return#0 divr16u::quotient#1 divr16u::quotient#2 ] reg byte a [ divr16u::$1 ] reg byte a [ divr16u::$2 ] reg byte x [ divr16u::i#2 divr16u::i#1 ] zp[2]:46 [ divr16u::dividend#3 divr16u::dividend#5 divr16u::dividend#0 ] zp[2]:95 [ divr16u::return#2 ] zp[2]:99 [ divr16u::return#3 ] -Uplifting [] best 26208 combination zp[2]:42 [ print_char_cursor#36 print_char_cursor#57 print_char_cursor#54 print_char_cursor#55 print_char_cursor#1 print_char_cursor#12 ] zp[2]:169 [ rem16u#0 ] -Uplifting [mulu16_sel] best 26175 combination zp[2]:51 [ mulu16_sel::v1#10 mulu16_sel::v1#4 mulu16_sel::v1#0 mulu16_sel::v1#1 mulu16_sel::v1#2 mulu16_sel::v1#3 mulu16_sel::v1#9 mulu16_sel::v1#5 mulu16_sel::v1#6 mulu16_sel::v1#7 mulu16_sel::v1#8 ] zp[2]:53 [ mulu16_sel::v2#10 mulu16_sel::v2#4 mulu16_sel::v2#0 mulu16_sel::v2#1 mulu16_sel::v2#3 mulu16_sel::v2#9 mulu16_sel::v2#5 mulu16_sel::v2#6 mulu16_sel::v2#8 ] zp[4]:177 [ mulu16_sel::$0 ] zp[4]:181 [ mulu16_sel::$1 ] zp[2]:113 [ mulu16_sel::return#0 ] zp[2]:117 [ mulu16_sel::return#1 ] zp[2]:121 [ mulu16_sel::return#14 ] zp[2]:127 [ mulu16_sel::return#15 ] zp[2]:131 [ mulu16_sel::return#16 ] zp[2]:141 [ mulu16_sel::return#18 ] zp[2]:145 [ mulu16_sel::return#19 ] zp[2]:149 [ mulu16_sel::return#20 ] zp[2]:155 [ mulu16_sel::return#10 ] zp[2]:159 [ mulu16_sel::return#11 ] zp[2]:185 [ mulu16_sel::return#17 ] reg byte x [ mulu16_sel::select#10 ] -Uplifting [print_uchar] best 26157 combination reg byte a [ print_uchar::$0 ] reg byte x [ print_uchar::$2 ] reg byte x [ print_uchar::b#2 print_uchar::b#0 print_uchar::b#1 ] -Uplifting [print_str] best 26157 combination zp[2]:23 [ print_str::str#3 print_str::str#6 print_str::str#0 ] -Uplifting [sin16s] best 26148 combination zp[4]:28 [ sin16s::x#6 sin16s::x#4 sin16s::x#0 sin16s::x#1 sin16s::x#2 ] zp[2]:32 [ sin16s::return#1 sin16s::return#5 sin16s::sinx#1 ] zp[4]:107 [ sin16s::$4 ] zp[2]:115 [ sin16s::x2#0 ] zp[2]:123 [ sin16s::x3_6#0 ] zp[2]:129 [ sin16s::x4#0 ] zp[2]:133 [ sin16s::x5#0 ] zp[2]:135 [ sin16s::x5_128#0 ] zp[2]:119 [ sin16s::x3#0 ] zp[2]:137 [ sin16s::usinx#1 ] zp[2]:111 [ sin16s::x1#0 ] zp[2]:77 [ sin16s::return#0 ] zp[2]:125 [ sin16s::usinx#0 ] reg byte y [ sin16s::isUpper#2 ] -Uplifting [sin16sb] best 26139 combination zp[2]:35 [ sin16sb::x#6 sin16sb::x#4 sin16sb::x#0 sin16sb::x#1 sin16sb::x#2 ] zp[2]:37 [ sin16sb::return#1 sin16sb::return#5 sin16sb::sinx#1 ] zp[2]:143 [ sin16sb::x2#0 ] zp[2]:151 [ sin16sb::x3_6#0 ] zp[2]:157 [ sin16sb::x4#0 ] zp[2]:161 [ sin16sb::x5#0 ] zp[2]:163 [ sin16sb::x5_128#0 ] zp[2]:147 [ sin16sb::x3#0 ] zp[2]:165 [ sin16sb::usinx#1 ] zp[2]:139 [ sin16sb::x1#0 ] zp[2]:89 [ sin16sb::return#0 ] zp[2]:153 [ sin16sb::usinx#0 ] reg byte y [ sin16sb::isUpper#2 ] -Uplifting [memset] best 26139 combination zp[2]:39 [ memset::dst#2 memset::dst#1 ] -Uplifting [print_uint] best 26139 combination zp[2]:93 [ print_uint::w#0 ] -Uplifting [sin16s_gen] best 26139 combination zp[2]:7 [ sin16s_gen::i#2 sin16s_gen::i#1 ] zp[2]:79 [ sin16s_gen::$2 ] zp[4]:9 [ sin16s_gen::x#2 sin16s_gen::x#1 ] zp[2]:13 [ sin16s_gen::sintab#2 sin16s_gen::sintab#0 ] zp[4]:73 [ sin16s_gen::step#0 ] -Uplifting [sin16s_genb] best 26139 combination zp[2]:15 [ sin16s_genb::i#2 sin16s_genb::i#1 ] zp[2]:91 [ sin16s_genb::$3 ] zp[4]:17 [ sin16s_genb::x#2 sin16s_genb::x#1 ] zp[2]:21 [ sin16s_genb::sintab#2 sin16s_genb::sintab#0 ] zp[4]:85 [ sin16s_genb::step#0 ] -Uplifting [print_sint] best 26139 combination zp[2]:25 [ print_sint::w#4 print_sint::w#0 print_sint::w#1 ] -Uplifting [div32u16u] best 26139 combination zp[2]:101 [ div32u16u::quotient_lo#0 ] zp[2]:97 [ div32u16u::quotient_hi#0 ] zp[4]:103 [ div32u16u::return#0 ] zp[4]:69 [ div32u16u::return#2 ] zp[4]:81 [ div32u16u::return#3 ] -Uplifting [main] best 26139 combination zp[1]:6 [ main::i#2 main::i#1 ] zp[2]:4 [ main::st2#2 main::st2#1 ] zp[2]:2 [ main::st1#2 main::st1#1 ] zp[2]:67 [ main::sw#0 ] -Uplifting [RADIX] best 26139 combination -Uplifting [print_cls] best 26139 combination +Uplifting [mul16u] best 26483 combination zp[4]:59 [ mul16u::res#2 mul16u::res#6 mul16u::res#1 ] zp[4]:63 [ mul16u::mb#2 mul16u::mb#0 mul16u::mb#1 ] reg byte a [ mul16u::$1 ] zp[2]:57 [ mul16u::a#2 mul16u::a#1 mul16u::a#0 ] zp[4]:173 [ mul16u::return#2 ] zp[2]:171 [ mul16u::b#0 ] +Uplifting [print_char] best 26168 combination reg byte a [ print_char::ch#5 print_char::ch#0 print_char::ch#3 print_char::ch#4 ] +Uplifting [divr16u] best 25958 combination zp[2]:44 [ divr16u::rem#5 divr16u::rem#10 divr16u::rem#4 divr16u::rem#11 divr16u::rem#6 divr16u::rem#0 divr16u::rem#1 divr16u::rem#2 ] zp[2]:48 [ divr16u::quotient#3 divr16u::return#0 divr16u::quotient#1 divr16u::quotient#2 ] reg byte a [ divr16u::$1 ] reg byte a [ divr16u::$2 ] reg byte x [ divr16u::i#2 divr16u::i#1 ] zp[2]:46 [ divr16u::dividend#3 divr16u::dividend#5 divr16u::dividend#0 ] zp[2]:95 [ divr16u::return#2 ] zp[2]:99 [ divr16u::return#3 ] +Uplifting [] best 25958 combination zp[2]:42 [ print_char_cursor#36 print_char_cursor#57 print_char_cursor#54 print_char_cursor#55 print_char_cursor#1 print_char_cursor#12 ] zp[2]:169 [ rem16u#0 ] +Uplifting [mulu16_sel] best 25925 combination zp[2]:51 [ mulu16_sel::v1#10 mulu16_sel::v1#4 mulu16_sel::v1#0 mulu16_sel::v1#1 mulu16_sel::v1#2 mulu16_sel::v1#3 mulu16_sel::v1#9 mulu16_sel::v1#5 mulu16_sel::v1#6 mulu16_sel::v1#7 mulu16_sel::v1#8 ] zp[2]:53 [ mulu16_sel::v2#10 mulu16_sel::v2#4 mulu16_sel::v2#0 mulu16_sel::v2#1 mulu16_sel::v2#3 mulu16_sel::v2#9 mulu16_sel::v2#5 mulu16_sel::v2#6 mulu16_sel::v2#8 ] zp[4]:177 [ mulu16_sel::$0 ] zp[4]:181 [ mulu16_sel::$1 ] zp[2]:113 [ mulu16_sel::return#0 ] zp[2]:117 [ mulu16_sel::return#1 ] zp[2]:121 [ mulu16_sel::return#14 ] zp[2]:127 [ mulu16_sel::return#15 ] zp[2]:131 [ mulu16_sel::return#16 ] zp[2]:141 [ mulu16_sel::return#18 ] zp[2]:145 [ mulu16_sel::return#19 ] zp[2]:149 [ mulu16_sel::return#20 ] zp[2]:155 [ mulu16_sel::return#10 ] zp[2]:159 [ mulu16_sel::return#11 ] zp[2]:185 [ mulu16_sel::return#17 ] reg byte x [ mulu16_sel::select#10 ] +Uplifting [print_uchar] best 25907 combination reg byte a [ print_uchar::$0 ] reg byte x [ print_uchar::$2 ] reg byte x [ print_uchar::b#2 print_uchar::b#0 print_uchar::b#1 ] +Uplifting [print_str] best 25907 combination zp[2]:23 [ print_str::str#3 print_str::str#6 print_str::str#0 ] +Uplifting [sin16s] best 25898 combination zp[4]:28 [ sin16s::x#6 sin16s::x#4 sin16s::x#0 sin16s::x#1 sin16s::x#2 ] zp[2]:32 [ sin16s::return#1 sin16s::return#5 sin16s::sinx#1 ] zp[4]:107 [ sin16s::$4 ] zp[2]:115 [ sin16s::x2#0 ] zp[2]:123 [ sin16s::x3_6#0 ] zp[2]:129 [ sin16s::x4#0 ] zp[2]:133 [ sin16s::x5#0 ] zp[2]:135 [ sin16s::x5_128#0 ] zp[2]:119 [ sin16s::x3#0 ] zp[2]:137 [ sin16s::usinx#1 ] zp[2]:111 [ sin16s::x1#0 ] zp[2]:77 [ sin16s::return#0 ] zp[2]:125 [ sin16s::usinx#0 ] reg byte y [ sin16s::isUpper#2 ] +Uplifting [sin16sb] best 25889 combination zp[2]:35 [ sin16sb::x#6 sin16sb::x#4 sin16sb::x#0 sin16sb::x#1 sin16sb::x#2 ] zp[2]:37 [ sin16sb::return#1 sin16sb::return#5 sin16sb::sinx#1 ] zp[2]:143 [ sin16sb::x2#0 ] zp[2]:151 [ sin16sb::x3_6#0 ] zp[2]:157 [ sin16sb::x4#0 ] zp[2]:161 [ sin16sb::x5#0 ] zp[2]:163 [ sin16sb::x5_128#0 ] zp[2]:147 [ sin16sb::x3#0 ] zp[2]:165 [ sin16sb::usinx#1 ] zp[2]:139 [ sin16sb::x1#0 ] zp[2]:89 [ sin16sb::return#0 ] zp[2]:153 [ sin16sb::usinx#0 ] reg byte y [ sin16sb::isUpper#2 ] +Uplifting [memset] best 25889 combination zp[2]:39 [ memset::dst#2 memset::dst#1 ] +Uplifting [print_uint] best 25889 combination zp[2]:93 [ print_uint::w#0 ] +Uplifting [sin16s_gen] best 25889 combination zp[2]:7 [ sin16s_gen::i#2 sin16s_gen::i#1 ] zp[2]:79 [ sin16s_gen::$2 ] zp[4]:9 [ sin16s_gen::x#2 sin16s_gen::x#1 ] zp[2]:13 [ sin16s_gen::sintab#2 sin16s_gen::sintab#0 ] zp[4]:73 [ sin16s_gen::step#0 ] +Uplifting [sin16s_genb] best 25889 combination zp[2]:15 [ sin16s_genb::i#2 sin16s_genb::i#1 ] zp[2]:91 [ sin16s_genb::$3 ] zp[4]:17 [ sin16s_genb::x#2 sin16s_genb::x#1 ] zp[2]:21 [ sin16s_genb::sintab#2 sin16s_genb::sintab#0 ] zp[4]:85 [ sin16s_genb::step#0 ] +Uplifting [print_sint] best 25889 combination zp[2]:25 [ print_sint::w#4 print_sint::w#0 print_sint::w#1 ] +Uplifting [div32u16u] best 25889 combination zp[2]:101 [ div32u16u::quotient_lo#0 ] zp[2]:97 [ div32u16u::quotient_hi#0 ] zp[4]:103 [ div32u16u::return#0 ] zp[4]:69 [ div32u16u::return#2 ] zp[4]:81 [ div32u16u::return#3 ] +Uplifting [main] best 25889 combination zp[1]:6 [ main::i#2 main::i#1 ] zp[2]:4 [ main::st2#2 main::st2#1 ] zp[2]:2 [ main::st1#2 main::st1#1 ] zp[2]:67 [ main::sw#0 ] +Uplifting [RADIX] best 25889 combination +Uplifting [print_cls] best 25889 combination Attempting to uplift remaining variables inzp[1]:6 [ main::i#2 main::i#1 ] -Uplifting [main] best 26139 combination zp[1]:6 [ main::i#2 main::i#1 ] +Uplifting [main] best 25889 combination zp[1]:6 [ main::i#2 main::i#1 ] Coalescing zero page register [ zp[2]:32 [ sin16s::return#1 sin16s::return#5 sin16s::sinx#1 ] ] with [ zp[2]:137 [ sin16s::usinx#1 ] ] - score: 2 Coalescing zero page register [ zp[2]:37 [ sin16sb::return#1 sin16sb::return#5 sin16sb::sinx#1 ] ] with [ zp[2]:165 [ sin16sb::usinx#1 ] ] - score: 2 Coalescing zero page register [ zp[2]:44 [ divr16u::rem#5 divr16u::rem#10 divr16u::rem#4 divr16u::rem#11 divr16u::rem#6 divr16u::rem#0 divr16u::rem#1 divr16u::rem#2 ] ] with [ zp[2]:169 [ rem16u#0 ] ] - score: 2 @@ -5297,8 +5297,7 @@ mul16u: { __b1: // [212] if(mul16u::a#2!=0) goto mul16u::@2 -- vwuz1_neq_0_then_la1 lda.z a - bne __b2 - lda.z a+1 + ora.z a+1 bne __b2 jmp __breturn // mul16u::@return @@ -5901,7 +5900,7 @@ reg byte a [ mul16u::$1 ] FINAL ASSEMBLER -Score: 21818 +Score: 21568 // File Comments // Generates a 16-bit signed sine @@ -7306,8 +7305,7 @@ mul16u: { // while(a!=0) // [212] if(mul16u::a#2!=0) goto mul16u::@2 -- vwuz1_neq_0_then_la1 lda.z a - bne __b2 - lda.z a+1 + ora.z a+1 bne __b2 // mul16u::@return // } diff --git a/src/test/ref/sinusgen8b.asm b/src/test/ref/sinusgen8b.asm index c7bfc884b..87dbb7729 100644 --- a/src/test/ref/sinusgen8b.asm +++ b/src/test/ref/sinusgen8b.asm @@ -990,8 +990,7 @@ mul16u: { __b1: // while(a!=0) lda.z a - bne __b2 - lda.z a+1 + ora.z a+1 bne __b2 // } rts diff --git a/src/test/ref/sinusgen8b.log b/src/test/ref/sinusgen8b.log index bca7f52ad..9b959905f 100644 --- a/src/test/ref/sinusgen8b.log +++ b/src/test/ref/sinusgen8b.log @@ -3968,58 +3968,58 @@ Uplift Scope [div16u] 37.33: zp[2]:99 [ div16u::return#0 ] 22: zp[2]:78 [ div16u Uplift Scope [RADIX] Uplift Scope [print_cls] -Uplifting [mul8u] best 34950 combination zp[2]:53 [ mul8u::res#2 mul8u::res#6 mul8u::res#1 ] zp[2]:55 [ mul8u::mb#2 mul8u::mb#0 mul8u::mb#1 ] reg byte a [ mul8u::$1 ] reg byte x [ mul8u::a#2 mul8u::a#1 mul8u::a#0 ] zp[2]:167 [ mul8u::return#2 ] reg byte a [ mul8u::b#0 ] -Uplifting [mul16u] best 34350 combination zp[4]:59 [ mul16u::res#2 mul16u::res#6 mul16u::res#1 ] zp[4]:63 [ mul16u::mb#2 mul16u::mb#0 mul16u::mb#1 ] reg byte a [ mul16u::$1 ] zp[2]:57 [ mul16u::a#2 mul16u::a#1 mul16u::a#0 ] zp[4]:176 [ mul16u::return#2 ] zp[2]:174 [ mul16u::b#0 ] -Uplifting [divr16u] best 34140 combination zp[2]:37 [ divr16u::rem#6 divr16u::rem#11 divr16u::rem#5 divr16u::rem#10 divr16u::rem#7 divr16u::rem#0 divr16u::rem#1 divr16u::rem#2 ] zp[2]:41 [ divr16u::quotient#3 divr16u::return#0 divr16u::quotient#1 divr16u::quotient#2 ] reg byte a [ divr16u::$1 ] reg byte a [ divr16u::$2 ] reg byte x [ divr16u::i#2 divr16u::i#1 ] zp[2]:39 [ divr16u::dividend#4 divr16u::dividend#6 divr16u::dividend#0 ] zp[2]:97 [ divr16u::return#2 ] zp[2]:116 [ divr16u::return#3 ] zp[2]:120 [ divr16u::return#4 ] -Uplifting [print_char] best 33825 combination reg byte a [ print_char::ch#5 print_char::ch#0 print_char::ch#3 print_char::ch#4 ] -Uplifting [] best 33825 combination zp[2]:35 [ print_char_cursor#29 print_char_cursor#45 print_char_cursor#10 ] zp[2]:164 [ rem16u#0 ] -Uplifting [mulu16_sel] best 33807 combination zp[2]:47 [ mulu16_sel::v1#5 mulu16_sel::v1#4 mulu16_sel::v1#0 mulu16_sel::v1#1 mulu16_sel::v1#2 mulu16_sel::v1#3 ] zp[4]:180 [ mulu16_sel::$0 ] zp[4]:184 [ mulu16_sel::$1 ] zp[2]:49 [ mulu16_sel::v2#5 mulu16_sel::v2#4 mulu16_sel::v2#0 mulu16_sel::v2#1 mulu16_sel::v2#3 ] zp[2]:188 [ mulu16_sel::return#12 ] zp[2]:134 [ mulu16_sel::return#0 ] zp[2]:138 [ mulu16_sel::return#1 ] zp[2]:142 [ mulu16_sel::return#2 ] zp[2]:148 [ mulu16_sel::return#10 ] zp[2]:152 [ mulu16_sel::return#11 ] reg byte x [ mulu16_sel::select#5 ] -Uplifting [mulu8_sel] best 33749 combination reg byte x [ mulu8_sel::v1#5 mulu8_sel::v1#2 mulu8_sel::v1#3 mulu8_sel::v1#4 mulu8_sel::v1#0 mulu8_sel::v1#1 ] zp[2]:169 [ mulu8_sel::$0 ] zp[2]:171 [ mulu8_sel::$1 ] reg byte y [ mulu8_sel::v2#5 mulu8_sel::v2#3 mulu8_sel::v2#4 mulu8_sel::v2#0 mulu8_sel::v2#1 ] reg byte a [ mulu8_sel::return#12 ] reg byte a [ mulu8_sel::return#0 ] zp[1]:106 [ mulu8_sel::return#1 ] zp[1]:108 [ mulu8_sel::return#2 ] zp[1]:111 [ mulu8_sel::return#10 ] zp[1]:113 [ mulu8_sel::return#11 ] zp[1]:46 [ mulu8_sel::select#5 ] +Uplifting [mul8u] best 34700 combination zp[2]:53 [ mul8u::res#2 mul8u::res#6 mul8u::res#1 ] zp[2]:55 [ mul8u::mb#2 mul8u::mb#0 mul8u::mb#1 ] reg byte a [ mul8u::$1 ] reg byte x [ mul8u::a#2 mul8u::a#1 mul8u::a#0 ] zp[2]:167 [ mul8u::return#2 ] reg byte a [ mul8u::b#0 ] +Uplifting [mul16u] best 34100 combination zp[4]:59 [ mul16u::res#2 mul16u::res#6 mul16u::res#1 ] zp[4]:63 [ mul16u::mb#2 mul16u::mb#0 mul16u::mb#1 ] reg byte a [ mul16u::$1 ] zp[2]:57 [ mul16u::a#2 mul16u::a#1 mul16u::a#0 ] zp[4]:176 [ mul16u::return#2 ] zp[2]:174 [ mul16u::b#0 ] +Uplifting [divr16u] best 33890 combination zp[2]:37 [ divr16u::rem#6 divr16u::rem#11 divr16u::rem#5 divr16u::rem#10 divr16u::rem#7 divr16u::rem#0 divr16u::rem#1 divr16u::rem#2 ] zp[2]:41 [ divr16u::quotient#3 divr16u::return#0 divr16u::quotient#1 divr16u::quotient#2 ] reg byte a [ divr16u::$1 ] reg byte a [ divr16u::$2 ] reg byte x [ divr16u::i#2 divr16u::i#1 ] zp[2]:39 [ divr16u::dividend#4 divr16u::dividend#6 divr16u::dividend#0 ] zp[2]:97 [ divr16u::return#2 ] zp[2]:116 [ divr16u::return#3 ] zp[2]:120 [ divr16u::return#4 ] +Uplifting [print_char] best 33575 combination reg byte a [ print_char::ch#5 print_char::ch#0 print_char::ch#3 print_char::ch#4 ] +Uplifting [] best 33575 combination zp[2]:35 [ print_char_cursor#29 print_char_cursor#45 print_char_cursor#10 ] zp[2]:164 [ rem16u#0 ] +Uplifting [mulu16_sel] best 33557 combination zp[2]:47 [ mulu16_sel::v1#5 mulu16_sel::v1#4 mulu16_sel::v1#0 mulu16_sel::v1#1 mulu16_sel::v1#2 mulu16_sel::v1#3 ] zp[4]:180 [ mulu16_sel::$0 ] zp[4]:184 [ mulu16_sel::$1 ] zp[2]:49 [ mulu16_sel::v2#5 mulu16_sel::v2#4 mulu16_sel::v2#0 mulu16_sel::v2#1 mulu16_sel::v2#3 ] zp[2]:188 [ mulu16_sel::return#12 ] zp[2]:134 [ mulu16_sel::return#0 ] zp[2]:138 [ mulu16_sel::return#1 ] zp[2]:142 [ mulu16_sel::return#2 ] zp[2]:148 [ mulu16_sel::return#10 ] zp[2]:152 [ mulu16_sel::return#11 ] reg byte x [ mulu16_sel::select#5 ] +Uplifting [mulu8_sel] best 33499 combination reg byte x [ mulu8_sel::v1#5 mulu8_sel::v1#2 mulu8_sel::v1#3 mulu8_sel::v1#4 mulu8_sel::v1#0 mulu8_sel::v1#1 ] zp[2]:169 [ mulu8_sel::$0 ] zp[2]:171 [ mulu8_sel::$1 ] reg byte y [ mulu8_sel::v2#5 mulu8_sel::v2#3 mulu8_sel::v2#4 mulu8_sel::v2#0 mulu8_sel::v2#1 ] reg byte a [ mulu8_sel::return#12 ] reg byte a [ mulu8_sel::return#0 ] zp[1]:106 [ mulu8_sel::return#1 ] zp[1]:108 [ mulu8_sel::return#2 ] zp[1]:111 [ mulu8_sel::return#10 ] zp[1]:113 [ mulu8_sel::return#11 ] zp[1]:46 [ mulu8_sel::select#5 ] Limited combination testing to 100 combinations of 196608 possible. -Uplifting [sin8s] best 33696 combination zp[2]:21 [ sin8s::x#6 sin8s::x#4 sin8s::x#0 sin8s::x#1 sin8s::x#2 ] reg byte x [ sin8s::usinx#4 sin8s::usinx#1 sin8s::usinx#2 ] reg byte a [ sin8s::return#1 sin8s::return#5 sin8s::sinx#1 ] zp[2]:101 [ sin8s::$4 ] reg byte a [ sin8s::x2#0 ] reg byte a [ sin8s::x3_6#0 ] zp[1]:112 [ sin8s::x4#0 ] zp[1]:114 [ sin8s::x5#0 ] zp[1]:115 [ sin8s::x5_128#0 ] zp[1]:107 [ sin8s::x3#0 ] zp[1]:103 [ sin8s::x1#0 ] zp[1]:82 [ sin8s::return#0 ] zp[1]:110 [ sin8s::usinx#0 ] zp[1]:20 [ sin8s::isUpper#10 ] +Uplifting [sin8s] best 33446 combination zp[2]:21 [ sin8s::x#6 sin8s::x#4 sin8s::x#0 sin8s::x#1 sin8s::x#2 ] reg byte x [ sin8s::usinx#4 sin8s::usinx#1 sin8s::usinx#2 ] reg byte a [ sin8s::return#1 sin8s::return#5 sin8s::sinx#1 ] zp[2]:101 [ sin8s::$4 ] reg byte a [ sin8s::x2#0 ] reg byte a [ sin8s::x3_6#0 ] zp[1]:112 [ sin8s::x4#0 ] zp[1]:114 [ sin8s::x5#0 ] zp[1]:115 [ sin8s::x5_128#0 ] zp[1]:107 [ sin8s::x3#0 ] zp[1]:103 [ sin8s::x1#0 ] zp[1]:82 [ sin8s::return#0 ] zp[1]:110 [ sin8s::usinx#0 ] zp[1]:20 [ sin8s::isUpper#10 ] Limited combination testing to 100 combinations of 5308416 possible. -Uplifting [print_str] best 33696 combination zp[2]:18 [ print_str::str#2 print_str::str#0 ] -Uplifting [sin16s] best 33687 combination zp[4]:26 [ sin16s::x#6 sin16s::x#4 sin16s::x#0 sin16s::x#1 sin16s::x#2 ] zp[2]:30 [ sin16s::return#1 sin16s::return#5 sin16s::sinx#1 ] zp[4]:128 [ sin16s::$4 ] zp[2]:136 [ sin16s::x2#0 ] zp[2]:144 [ sin16s::x3_6#0 ] zp[2]:150 [ sin16s::x4#0 ] zp[2]:154 [ sin16s::x5#0 ] zp[2]:156 [ sin16s::x5_128#0 ] zp[2]:140 [ sin16s::x3#0 ] zp[2]:158 [ sin16s::usinx#1 ] zp[2]:132 [ sin16s::x1#0 ] zp[2]:92 [ sin16s::return#0 ] zp[2]:146 [ sin16s::usinx#0 ] reg byte y [ sin16s::isUpper#2 ] -Uplifting [print_uchar] best 33672 combination reg byte a [ print_uchar::$0 ] reg byte x [ print_uchar::$2 ] reg byte x [ print_uchar::b#0 ] -Uplifting [memset] best 33672 combination zp[2]:32 [ memset::dst#2 memset::dst#1 ] -Uplifting [sin16s_gen] best 33672 combination zp[2]:9 [ sin16s_gen::i#2 sin16s_gen::i#1 ] zp[2]:94 [ sin16s_gen::$2 ] zp[4]:11 [ sin16s_gen::x#2 sin16s_gen::x#1 ] zp[2]:15 [ sin16s_gen::sintab#2 sin16s_gen::sintab#0 ] zp[4]:88 [ sin16s_gen::step#0 ] -Uplifting [sin8s_gen] best 33612 combination zp[2]:3 [ sin8s_gen::i#2 sin8s_gen::i#1 ] reg byte a [ sin8s_gen::$2 ] zp[2]:5 [ sin8s_gen::x#2 sin8s_gen::x#1 ] zp[2]:7 [ sin8s_gen::sintab#2 sin8s_gen::sintab#0 ] zp[2]:80 [ sin8s_gen::step#0 ] -Uplifting [print_schar] best 33576 combination reg byte x [ print_schar::b#4 print_schar::b#0 print_schar::b#1 ] -Uplifting [div32u16u] best 33576 combination zp[2]:122 [ div32u16u::quotient_lo#0 ] zp[2]:118 [ div32u16u::quotient_hi#0 ] zp[4]:124 [ div32u16u::return#0 ] zp[4]:84 [ div32u16u::return#2 ] -Uplifting [main] best 33496 combination zp[2]:68 [ main::$10 ] zp[2]:70 [ main::$9 ] zp[2]:72 [ main::$3 ] zp[2]:74 [ main::sw#0 ] reg byte a [ main::sd#0 ] zp[1]:2 [ main::i#2 main::i#1 ] reg byte a [ main::$11 ] zp[1]:67 [ main::sb#0 ] -Uplifting [div16u] best 33496 combination zp[2]:99 [ div16u::return#0 ] zp[2]:78 [ div16u::return#2 ] -Uplifting [RADIX] best 33496 combination -Uplifting [print_cls] best 33496 combination +Uplifting [print_str] best 33446 combination zp[2]:18 [ print_str::str#2 print_str::str#0 ] +Uplifting [sin16s] best 33437 combination zp[4]:26 [ sin16s::x#6 sin16s::x#4 sin16s::x#0 sin16s::x#1 sin16s::x#2 ] zp[2]:30 [ sin16s::return#1 sin16s::return#5 sin16s::sinx#1 ] zp[4]:128 [ sin16s::$4 ] zp[2]:136 [ sin16s::x2#0 ] zp[2]:144 [ sin16s::x3_6#0 ] zp[2]:150 [ sin16s::x4#0 ] zp[2]:154 [ sin16s::x5#0 ] zp[2]:156 [ sin16s::x5_128#0 ] zp[2]:140 [ sin16s::x3#0 ] zp[2]:158 [ sin16s::usinx#1 ] zp[2]:132 [ sin16s::x1#0 ] zp[2]:92 [ sin16s::return#0 ] zp[2]:146 [ sin16s::usinx#0 ] reg byte y [ sin16s::isUpper#2 ] +Uplifting [print_uchar] best 33422 combination reg byte a [ print_uchar::$0 ] reg byte x [ print_uchar::$2 ] reg byte x [ print_uchar::b#0 ] +Uplifting [memset] best 33422 combination zp[2]:32 [ memset::dst#2 memset::dst#1 ] +Uplifting [sin16s_gen] best 33422 combination zp[2]:9 [ sin16s_gen::i#2 sin16s_gen::i#1 ] zp[2]:94 [ sin16s_gen::$2 ] zp[4]:11 [ sin16s_gen::x#2 sin16s_gen::x#1 ] zp[2]:15 [ sin16s_gen::sintab#2 sin16s_gen::sintab#0 ] zp[4]:88 [ sin16s_gen::step#0 ] +Uplifting [sin8s_gen] best 33362 combination zp[2]:3 [ sin8s_gen::i#2 sin8s_gen::i#1 ] reg byte a [ sin8s_gen::$2 ] zp[2]:5 [ sin8s_gen::x#2 sin8s_gen::x#1 ] zp[2]:7 [ sin8s_gen::sintab#2 sin8s_gen::sintab#0 ] zp[2]:80 [ sin8s_gen::step#0 ] +Uplifting [print_schar] best 33326 combination reg byte x [ print_schar::b#4 print_schar::b#0 print_schar::b#1 ] +Uplifting [div32u16u] best 33326 combination zp[2]:122 [ div32u16u::quotient_lo#0 ] zp[2]:118 [ div32u16u::quotient_hi#0 ] zp[4]:124 [ div32u16u::return#0 ] zp[4]:84 [ div32u16u::return#2 ] +Uplifting [main] best 33246 combination zp[2]:68 [ main::$10 ] zp[2]:70 [ main::$9 ] zp[2]:72 [ main::$3 ] zp[2]:74 [ main::sw#0 ] reg byte a [ main::sd#0 ] zp[1]:2 [ main::i#2 main::i#1 ] reg byte a [ main::$11 ] zp[1]:67 [ main::sb#0 ] +Uplifting [div16u] best 33246 combination zp[2]:99 [ div16u::return#0 ] zp[2]:78 [ div16u::return#2 ] +Uplifting [RADIX] best 33246 combination +Uplifting [print_cls] best 33246 combination Attempting to uplift remaining variables inzp[1]:106 [ mulu8_sel::return#1 ] -Uplifting [mulu8_sel] best 33490 combination reg byte a [ mulu8_sel::return#1 ] +Uplifting [mulu8_sel] best 33240 combination reg byte a [ mulu8_sel::return#1 ] Attempting to uplift remaining variables inzp[1]:108 [ mulu8_sel::return#2 ] -Uplifting [mulu8_sel] best 33484 combination reg byte a [ mulu8_sel::return#2 ] +Uplifting [mulu8_sel] best 33234 combination reg byte a [ mulu8_sel::return#2 ] Attempting to uplift remaining variables inzp[1]:111 [ mulu8_sel::return#10 ] -Uplifting [mulu8_sel] best 33478 combination reg byte a [ mulu8_sel::return#10 ] +Uplifting [mulu8_sel] best 33228 combination reg byte a [ mulu8_sel::return#10 ] Attempting to uplift remaining variables inzp[1]:112 [ sin8s::x4#0 ] -Uplifting [sin8s] best 33474 combination reg byte a [ sin8s::x4#0 ] +Uplifting [sin8s] best 33224 combination reg byte a [ sin8s::x4#0 ] Attempting to uplift remaining variables inzp[1]:113 [ mulu8_sel::return#11 ] -Uplifting [mulu8_sel] best 33468 combination reg byte a [ mulu8_sel::return#11 ] +Uplifting [mulu8_sel] best 33218 combination reg byte a [ mulu8_sel::return#11 ] Attempting to uplift remaining variables inzp[1]:114 [ sin8s::x5#0 ] -Uplifting [sin8s] best 33462 combination reg byte a [ sin8s::x5#0 ] +Uplifting [sin8s] best 33212 combination reg byte a [ sin8s::x5#0 ] Attempting to uplift remaining variables inzp[1]:115 [ sin8s::x5_128#0 ] -Uplifting [sin8s] best 33456 combination reg byte a [ sin8s::x5_128#0 ] +Uplifting [sin8s] best 33206 combination reg byte a [ sin8s::x5_128#0 ] Attempting to uplift remaining variables inzp[1]:46 [ mulu8_sel::select#5 ] -Uplifting [mulu8_sel] best 33456 combination zp[1]:46 [ mulu8_sel::select#5 ] +Uplifting [mulu8_sel] best 33206 combination zp[1]:46 [ mulu8_sel::select#5 ] Attempting to uplift remaining variables inzp[1]:107 [ sin8s::x3#0 ] -Uplifting [sin8s] best 33456 combination zp[1]:107 [ sin8s::x3#0 ] +Uplifting [sin8s] best 33206 combination zp[1]:107 [ sin8s::x3#0 ] Attempting to uplift remaining variables inzp[1]:103 [ sin8s::x1#0 ] -Uplifting [sin8s] best 33456 combination zp[1]:103 [ sin8s::x1#0 ] +Uplifting [sin8s] best 33206 combination zp[1]:103 [ sin8s::x1#0 ] Attempting to uplift remaining variables inzp[1]:82 [ sin8s::return#0 ] -Uplifting [sin8s] best 33396 combination reg byte a [ sin8s::return#0 ] +Uplifting [sin8s] best 33146 combination reg byte a [ sin8s::return#0 ] Attempting to uplift remaining variables inzp[1]:110 [ sin8s::usinx#0 ] -Uplifting [sin8s] best 33396 combination zp[1]:110 [ sin8s::usinx#0 ] +Uplifting [sin8s] best 33146 combination zp[1]:110 [ sin8s::usinx#0 ] Attempting to uplift remaining variables inzp[1]:20 [ sin8s::isUpper#10 ] -Uplifting [sin8s] best 33396 combination zp[1]:20 [ sin8s::isUpper#10 ] +Uplifting [sin8s] best 33146 combination zp[1]:20 [ sin8s::isUpper#10 ] Attempting to uplift remaining variables inzp[1]:2 [ main::i#2 main::i#1 ] -Uplifting [main] best 33396 combination zp[1]:2 [ main::i#2 main::i#1 ] +Uplifting [main] best 33146 combination zp[1]:2 [ main::i#2 main::i#1 ] Attempting to uplift remaining variables inzp[1]:67 [ main::sb#0 ] -Uplifting [main] best 33396 combination zp[1]:67 [ main::sb#0 ] +Uplifting [main] best 33146 combination zp[1]:67 [ main::sb#0 ] Coalescing zero page register [ zp[2]:30 [ sin16s::return#1 sin16s::return#5 sin16s::sinx#1 ] ] with [ zp[2]:158 [ sin16s::usinx#1 ] ] - score: 2 Coalescing zero page register [ zp[2]:37 [ divr16u::rem#6 divr16u::rem#11 divr16u::rem#5 divr16u::rem#10 divr16u::rem#7 divr16u::rem#0 divr16u::rem#1 divr16u::rem#2 ] ] with [ zp[2]:164 [ rem16u#0 ] ] - score: 2 Coalescing zero page register [ zp[2]:47 [ mulu16_sel::v1#5 mulu16_sel::v1#4 mulu16_sel::v1#0 mulu16_sel::v1#1 mulu16_sel::v1#2 mulu16_sel::v1#3 ] ] with [ zp[2]:140 [ sin16s::x3#0 ] ] - score: 2 @@ -5603,8 +5603,7 @@ mul16u: { __b1: // [234] if(mul16u::a#2!=0) goto mul16u::@2 -- vwuz1_neq_0_then_la1 lda.z a - bne __b2 - lda.z a+1 + ora.z a+1 bne __b2 jmp __breturn // mul16u::@return @@ -6280,7 +6279,7 @@ reg byte a [ mul16u::$1 ] FINAL ASSEMBLER -Score: 28020 +Score: 27770 // File Comments // Sine Generator functions using only multiplication, addition and bit shifting @@ -7735,8 +7734,7 @@ mul16u: { // while(a!=0) // [234] if(mul16u::a#2!=0) goto mul16u::@2 -- vwuz1_neq_0_then_la1 lda.z a - bne __b2 - lda.z a+1 + ora.z a+1 bne __b2 // mul16u::@return // } diff --git a/src/test/ref/struct-array-problem-1.asm b/src/test/ref/struct-array-problem-1.asm new file mode 100644 index 000000000..cb9840647 --- /dev/null +++ b/src/test/ref/struct-array-problem-1.asm @@ -0,0 +1,91 @@ +// Demonstrates problem with structs containing arrays and auto-type conversion +// https://gitlab.com/camelot/kickc/-/issues/593 +.pc = $801 "Basic" +:BasicUpstart(main) +.pc = $80d "Program" + .const SIZEOF_STRUCT_HOSTSLOTS = 0 + .label OUT = $8000 +main: { + // slots1 = {"some data that would fit a normal 8x32 double array"} + ldy #SIZEOF_STRUCT_HOSTSLOTS + !: + lda __0-1,y + sta slots1-1,y + dey + bne !- + // slots2 = {"more data that would fit a normal 8x32 double array"} + ldy #SIZEOF_STRUCT_HOSTSLOTS + !: + lda __1-1,y + sta slots2-1,y + dey + bne !- + // doStuff(&slots1) + lda #slots1 + sta.z doStuff.hs+1 + jsr doStuff + // doStuff(&slots2) + lda #slots2 + sta.z doStuff.hs+1 + jsr doStuff + // } + rts + slots1: .fill SIZEOF_STRUCT_HOSTSLOTS, 0 + slots2: .fill SIZEOF_STRUCT_HOSTSLOTS, 0 +} +// doStuff(struct hostslots* zp(2) hs) +doStuff: { + .label hsp = 5 + .label i = 4 + .label hs = 2 + lda #0 + sta.z i + __b1: + // for(unsigned char i = 0; i < 8; i++) + lda.z i + cmp #8 + bcc __b2 + // } + rts + __b2: + // i * HOSTSLOT_SIZE + lda.z i + asl + asl + asl + asl + asl + // hsp = hs->host[i * HOSTSLOT_SIZE] + // should be: + // if (hs->host[i][0] != 0) { + .assert "Missing ASM fragment Fragment not found pbuz1=_ptr_pbuz2_derefidx_vbuaa. Attempted variations pbuz1=_ptr_pbuz2_derefidx_vbuaa ", 0, 1 + // if (*hsp != 0) + ldy #0 + lda (hsp),y + cmp #0 + bne __b3 + // *(OUT + i) = 2 + lda #2 + ldy.z i + sta OUT,y + __b4: + // for(unsigned char i = 0; i < 8; i++) + inc.z i + jmp __b1 + __b3: + // *(OUT + i) = 1 + lda #1 + ldy.z i + sta OUT,y + jmp __b4 +} + __0: .text "some data that would fit a normal 8x32 double array" + .byte 0 + .fill $cc, 0 + __1: .text "more data that would fit a normal 8x32 double array" + .byte 0 + .fill $cc, 0 diff --git a/src/test/ref/struct-array-problem-1.cfg b/src/test/ref/struct-array-problem-1.cfg new file mode 100644 index 000000000..04dd837d3 --- /dev/null +++ b/src/test/ref/struct-array-problem-1.cfg @@ -0,0 +1,40 @@ + +void main() +main: scope:[main] from + [0] *(&main::slots1) = memcpy(*(&$0), struct hostslots, SIZEOF_STRUCT_HOSTSLOTS) + [1] *(&main::slots2) = memcpy(*(&$1), struct hostslots, SIZEOF_STRUCT_HOSTSLOTS) + [2] call doStuff + to:main::@1 +main::@1: scope:[main] from main + [3] phi() + [4] call doStuff + to:main::@return +main::@return: scope:[main] from main::@1 + [5] return + to:@return + +void doStuff(struct hostslots* doStuff::hs) +doStuff: scope:[doStuff] from main main::@1 + [6] doStuff::hs#4 = phi( main/&main::slots1, main::@1/&main::slots2 ) + to:doStuff::@1 +doStuff::@1: scope:[doStuff] from doStuff doStuff::@4 + [7] doStuff::i#2 = phi( doStuff/0, doStuff::@4/doStuff::i#1 ) + [8] if(doStuff::i#2<8) goto doStuff::@2 + to:doStuff::@return +doStuff::@return: scope:[doStuff] from doStuff::@1 + [9] return + to:@return +doStuff::@2: scope:[doStuff] from doStuff::@1 + [10] doStuff::$1 = doStuff::i#2 << 5 + [11] doStuff::hsp#0 = (byte*)((byte*)doStuff::hs#4)[doStuff::$1] + [12] if(*doStuff::hsp#0!=0) goto doStuff::@3 + to:doStuff::@5 +doStuff::@5: scope:[doStuff] from doStuff::@2 + [13] OUT[doStuff::i#2] = 2 + to:doStuff::@4 +doStuff::@4: scope:[doStuff] from doStuff::@3 doStuff::@5 + [14] doStuff::i#1 = ++ doStuff::i#2 + to:doStuff::@1 +doStuff::@3: scope:[doStuff] from doStuff::@2 + [15] OUT[doStuff::i#2] = 1 + to:doStuff::@4 diff --git a/src/test/ref/struct-array-problem-1.log b/src/test/ref/struct-array-problem-1.log new file mode 100644 index 000000000..971e415cd --- /dev/null +++ b/src/test/ref/struct-array-problem-1.log @@ -0,0 +1,670 @@ +Fixing struct type size struct hostslots to 256 +Fixing struct type SIZE_OF struct hostslots to 256 +Fixing struct type SIZE_OF struct hostslots to 256 +Setting struct to load/store in variable affected by address-of main::$0 = call doStuff &main::slots1 +Setting struct to load/store in variable affected by address-of main::$1 = call doStuff &main::slots2 + +CONTROL FLOW GRAPH SSA + +void main() +main: scope:[main] from __start + *(&main::slots1) = memcpy(*(&$0), struct hostslots, SIZEOF_STRUCT_HOSTSLOTS) + main::slots1 = struct-unwound {*(&main::slots1)} + *(&main::slots2) = memcpy(*(&$1), struct hostslots, SIZEOF_STRUCT_HOSTSLOTS) + main::slots2 = struct-unwound {*(&main::slots2)} + doStuff::hs#0 = &main::slots1 + call doStuff + to:main::@1 +main::@1: scope:[main] from main + doStuff::hs#1 = &main::slots2 + call doStuff + to:main::@2 +main::@2: scope:[main] from main::@1 + to:main::@return +main::@return: scope:[main] from main::@2 + return + to:@return + +void doStuff(struct hostslots* doStuff::hs) +doStuff: scope:[doStuff] from main main::@1 + doStuff::hs#4 = phi( main/doStuff::hs#0, main::@1/doStuff::hs#1 ) + doStuff::i#0 = 0 + to:doStuff::@1 +doStuff::@1: scope:[doStuff] from doStuff doStuff::@4 + doStuff::hs#3 = phi( doStuff/doStuff::hs#4, doStuff::@4/doStuff::hs#5 ) + doStuff::i#2 = phi( doStuff/doStuff::i#0, doStuff::@4/doStuff::i#1 ) + doStuff::$0 = doStuff::i#2 < 8 + if(doStuff::$0) goto doStuff::@2 + to:doStuff::@return +doStuff::@2: scope:[doStuff] from doStuff::@1 + doStuff::hs#2 = phi( doStuff::@1/doStuff::hs#3 ) + doStuff::i#3 = phi( doStuff::@1/doStuff::i#2 ) + doStuff::$1 = doStuff::i#3 * $20 + doStuff::$6 = (byte*)doStuff::hs#2 + doStuff::$5 = doStuff::$6 + OFFSET_STRUCT_HOSTSLOTS_HOST + doStuff::hsp#0 = ((byte*)) doStuff::$5[doStuff::$1] + doStuff::$2 = *doStuff::hsp#0 != 0 + if(doStuff::$2) goto doStuff::@3 + to:doStuff::@5 +doStuff::@3: scope:[doStuff] from doStuff::@2 + doStuff::hs#6 = phi( doStuff::@2/doStuff::hs#2 ) + doStuff::i#4 = phi( doStuff::@2/doStuff::i#3 ) + doStuff::$4 = OUT + doStuff::i#4 + *doStuff::$4 = 1 + to:doStuff::@4 +doStuff::@5: scope:[doStuff] from doStuff::@2 + doStuff::hs#7 = phi( doStuff::@2/doStuff::hs#2 ) + doStuff::i#5 = phi( doStuff::@2/doStuff::i#3 ) + doStuff::$3 = OUT + doStuff::i#5 + *doStuff::$3 = 2 + to:doStuff::@4 +doStuff::@4: scope:[doStuff] from doStuff::@3 doStuff::@5 + doStuff::hs#5 = phi( doStuff::@3/doStuff::hs#6, doStuff::@5/doStuff::hs#7 ) + doStuff::i#6 = phi( doStuff::@3/doStuff::i#4, doStuff::@5/doStuff::i#5 ) + doStuff::i#1 = ++ doStuff::i#6 + to:doStuff::@1 +doStuff::@return: scope:[doStuff] from doStuff::@1 + return + to:@return + +void __start() +__start: scope:[__start] from + call main + to:__start::@1 +__start::@1: scope:[__start] from __start + to:__start::@return +__start::@return: scope:[__start] from __start::@1 + return + to:@return + +SYMBOL TABLE SSA +const struct hostslots $0 = { host: "some data that would fit a normal 8x32 double array" } +const struct hostslots $1 = { host: "more data that would fit a normal 8x32 double array" } +const byte OFFSET_STRUCT_HOSTSLOTS_HOST = 0 +const nomodify byte* OUT = (byte*)$8000 +const byte SIZEOF_STRUCT_HOSTSLOTS = 0 +void __start() +void doStuff(struct hostslots* doStuff::hs) +bool~ doStuff::$0 +number~ doStuff::$1 +bool~ doStuff::$2 +byte*~ doStuff::$3 +byte*~ doStuff::$4 +byte*~ doStuff::$5 +byte*~ doStuff::$6 +struct hostslots* doStuff::hs +struct hostslots* doStuff::hs#0 +struct hostslots* doStuff::hs#1 +struct hostslots* doStuff::hs#2 +struct hostslots* doStuff::hs#3 +struct hostslots* doStuff::hs#4 +struct hostslots* doStuff::hs#5 +struct hostslots* doStuff::hs#6 +struct hostslots* doStuff::hs#7 +byte* doStuff::hsp +byte* doStuff::hsp#0 +byte doStuff::i +byte doStuff::i#0 +byte doStuff::i#1 +byte doStuff::i#2 +byte doStuff::i#3 +byte doStuff::i#4 +byte doStuff::i#5 +byte doStuff::i#6 +void main() +struct hostslots main::slots1 loadstore +struct hostslots main::slots2 loadstore + +Adding number conversion cast (unumber) 8 in doStuff::$0 = doStuff::i#2 < 8 +Adding number conversion cast (unumber) $20 in doStuff::$1 = doStuff::i#3 * $20 +Adding number conversion cast (unumber) doStuff::$1 in doStuff::$1 = doStuff::i#3 * (unumber)$20 +Adding number conversion cast (unumber) 0 in doStuff::$2 = *doStuff::hsp#0 != 0 +Adding number conversion cast (unumber) 1 in *doStuff::$4 = 1 +Adding number conversion cast (unumber) 2 in *doStuff::$3 = 2 +Successful SSA optimization PassNAddNumberTypeConversions +Inlining cast doStuff::hsp#0 = (byte*)doStuff::$5[doStuff::$1] +Inlining cast *doStuff::$4 = (unumber)1 +Inlining cast *doStuff::$3 = (unumber)2 +Successful SSA optimization Pass2InlineCast +Simplifying constant pointer cast (byte*) 32768 +Simplifying constant integer cast 8 +Simplifying constant integer cast $20 +Simplifying constant integer cast 0 +Simplifying constant integer cast 1 +Simplifying constant integer cast 2 +Successful SSA optimization PassNCastSimplification +Finalized unsigned number type 8 +Finalized unsigned number type $20 +Finalized unsigned number type 0 +Finalized unsigned number type 1 +Finalized unsigned number type 2 +Successful SSA optimization PassNFinalizeNumberTypeConversions +Inferred type updated to byte in doStuff::$1 = doStuff::i#3 * $20 +Alias doStuff::i#2 = doStuff::i#3 doStuff::i#4 doStuff::i#5 +Alias doStuff::hs#2 = doStuff::hs#3 doStuff::hs#6 doStuff::hs#7 +Successful SSA optimization Pass2AliasElimination +Alias doStuff::i#2 = doStuff::i#6 +Alias doStuff::hs#2 = doStuff::hs#5 +Successful SSA optimization Pass2AliasElimination +Identical Phi Values doStuff::hs#2 doStuff::hs#4 +Successful SSA optimization Pass2IdenticalPhiElimination +Simple Condition doStuff::$0 [13] if(doStuff::i#2<8) goto doStuff::@2 +Simple Condition doStuff::$2 [19] if(*doStuff::hsp#0!=0) goto doStuff::@3 +Successful SSA optimization Pass2ConditionalJumpSimplification +Removing C-classic struct-unwound assignment [1] main::slots1 = struct-unwound {*(&main::slots1)} +Removing C-classic struct-unwound assignment [3] main::slots2 = struct-unwound {*(&main::slots2)} +Constant doStuff::hs#0 = &main::slots1 +Constant doStuff::hs#1 = &main::slots2 +Constant doStuff::i#0 = 0 +Successful SSA optimization Pass2ConstantIdentification +Converting *(pointer+n) to pointer[n] [21] *doStuff::$4 = 1 -- OUT[doStuff::i#2] +Converting *(pointer+n) to pointer[n] [23] *doStuff::$3 = 2 -- OUT[doStuff::i#2] +Successful SSA optimization Pass2InlineDerefIdx +Simplifying expression containing zero doStuff::$6 in [16] doStuff::$5 = doStuff::$6 + OFFSET_STRUCT_HOSTSLOTS_HOST +Successful SSA optimization PassNSimplifyExpressionWithZero +Eliminating unused variable doStuff::$4 and assignment [13] doStuff::$4 = OUT + doStuff::i#2 +Eliminating unused variable doStuff::$3 and assignment [15] doStuff::$3 = OUT + doStuff::i#2 +Eliminating unused constant OFFSET_STRUCT_HOSTSLOTS_HOST +Successful SSA optimization PassNEliminateUnusedVars +Removing unused procedure __start +Removing unused procedure block __start +Removing unused procedure block __start::@1 +Removing unused procedure block __start::@return +Successful SSA optimization PassNEliminateEmptyStart +Alias doStuff::$5 = doStuff::$6 +Successful SSA optimization Pass2AliasElimination +Inlining Noop Cast [9] doStuff::$5 = (byte*)doStuff::hs#4 keeping doStuff::hs#4 +Successful SSA optimization Pass2NopCastInlining +Rewriting multiplication to use shift [8] doStuff::$1 = doStuff::i#2 * $20 +Successful SSA optimization Pass2MultiplyToShiftRewriting +Inlining constant with var siblings doStuff::hs#0 +Inlining constant with var siblings doStuff::hs#1 +Inlining constant with var siblings doStuff::i#0 +Constant inlined doStuff::hs#0 = &main::slots1 +Constant inlined doStuff::hs#1 = &main::slots2 +Constant inlined doStuff::i#0 = 0 +Successful SSA optimization Pass2ConstantInlining +Adding NOP phi() at start of main::@1 +Adding NOP phi() at start of main::@2 +CALL GRAPH +Calls in [main] to doStuff:2 doStuff:4 + +Created 2 initial phi equivalence classes +Coalesced [16] doStuff::i#7 = doStuff::i#1 +Coalesced down to 2 phi equivalence classes +Culled Empty Block label main::@2 +Adding NOP phi() at start of main::@1 + +FINAL CONTROL FLOW GRAPH + +void main() +main: scope:[main] from + [0] *(&main::slots1) = memcpy(*(&$0), struct hostslots, SIZEOF_STRUCT_HOSTSLOTS) + [1] *(&main::slots2) = memcpy(*(&$1), struct hostslots, SIZEOF_STRUCT_HOSTSLOTS) + [2] call doStuff + to:main::@1 +main::@1: scope:[main] from main + [3] phi() + [4] call doStuff + to:main::@return +main::@return: scope:[main] from main::@1 + [5] return + to:@return + +void doStuff(struct hostslots* doStuff::hs) +doStuff: scope:[doStuff] from main main::@1 + [6] doStuff::hs#4 = phi( main/&main::slots1, main::@1/&main::slots2 ) + to:doStuff::@1 +doStuff::@1: scope:[doStuff] from doStuff doStuff::@4 + [7] doStuff::i#2 = phi( doStuff/0, doStuff::@4/doStuff::i#1 ) + [8] if(doStuff::i#2<8) goto doStuff::@2 + to:doStuff::@return +doStuff::@return: scope:[doStuff] from doStuff::@1 + [9] return + to:@return +doStuff::@2: scope:[doStuff] from doStuff::@1 + [10] doStuff::$1 = doStuff::i#2 << 5 + [11] doStuff::hsp#0 = (byte*)((byte*)doStuff::hs#4)[doStuff::$1] + [12] if(*doStuff::hsp#0!=0) goto doStuff::@3 + to:doStuff::@5 +doStuff::@5: scope:[doStuff] from doStuff::@2 + [13] OUT[doStuff::i#2] = 2 + to:doStuff::@4 +doStuff::@4: scope:[doStuff] from doStuff::@3 doStuff::@5 + [14] doStuff::i#1 = ++ doStuff::i#2 + to:doStuff::@1 +doStuff::@3: scope:[doStuff] from doStuff::@2 + [15] OUT[doStuff::i#2] = 1 + to:doStuff::@4 + + +VARIABLE REGISTER WEIGHTS +void doStuff(struct hostslots* doStuff::hs) +byte~ doStuff::$1 101.0 +struct hostslots* doStuff::hs +struct hostslots* doStuff::hs#4 +byte* doStuff::hsp +byte* doStuff::hsp#0 202.0 +byte doStuff::i +byte doStuff::i#1 202.0 +byte doStuff::i#2 86.57142857142857 +void main() +struct hostslots main::slots1 loadstore +struct hostslots main::slots2 loadstore + +Initial phi equivalence classes +[ doStuff::hs#4 ] +[ doStuff::i#2 doStuff::i#1 ] +Added variable doStuff::$1 to live range equivalence class [ doStuff::$1 ] +Added variable doStuff::hsp#0 to live range equivalence class [ doStuff::hsp#0 ] +Added variable main::slots1 to live range equivalence class [ main::slots1 ] +Added variable main::slots2 to live range equivalence class [ main::slots2 ] +Complete equivalence classes +[ doStuff::hs#4 ] +[ doStuff::i#2 doStuff::i#1 ] +[ doStuff::$1 ] +[ doStuff::hsp#0 ] +[ main::slots1 ] +[ main::slots2 ] +Allocated zp[2]:2 [ doStuff::hs#4 ] +Allocated zp[1]:4 [ doStuff::i#2 doStuff::i#1 ] +Allocated zp[1]:5 [ doStuff::$1 ] +Allocated zp[2]:6 [ doStuff::hsp#0 ] +Allocated mem[256] [ main::slots1 ] +Allocated mem[256] [ main::slots2 ] +Warning! Unknown fragment for statement [11] doStuff::hsp#0 = (byte*)((byte*)doStuff::hs#4)[doStuff::$1] +Missing ASM fragment Fragment not found pbuz1=_ptr_pbuz2_derefidx_vbuz3. Attempted variations pbuz1=_ptr_pbuz2_derefidx_vbuz3 +/Users/jespergravgaard/c64/kickc/src/test/kc/struct-array-problem-1.c:23:9: +REGISTER UPLIFT POTENTIAL REGISTERS +Statement [0] *(&main::slots1) = memcpy(*(&$0), struct hostslots, SIZEOF_STRUCT_HOSTSLOTS) [ main::slots2 ] ( [ main::slots2 ] { } ) always clobbers reg byte a reg byte y +Statement [1] *(&main::slots2) = memcpy(*(&$1), struct hostslots, SIZEOF_STRUCT_HOSTSLOTS) [ ] ( [ ] { } ) always clobbers reg byte a reg byte y +Statement [10] doStuff::$1 = doStuff::i#2 << 5 [ doStuff::hs#4 doStuff::i#2 doStuff::$1 ] ( doStuff:2 [ doStuff::hs#4 doStuff::i#2 doStuff::$1 ] { } doStuff:4 [ doStuff::hs#4 doStuff::i#2 doStuff::$1 ] { } ) always clobbers reg byte a +Removing always clobbered register reg byte a as potential for zp[1]:4 [ doStuff::i#2 doStuff::i#1 ] +Potential register analysis [11] doStuff::hsp#0 = (byte*)((byte*)doStuff::hs#4)[doStuff::$1] missing fragment Fragment not found pbuz1=_ptr_pbuz2_derefidx_vbuz3. Attempted variations pbuz1=_ptr_pbuz2_derefidx_vbuz3 allocation: zp[1]:5 [ doStuff::$1 ] zp[2]:6 [ doStuff::hsp#0 ] zp[2]:2 [ doStuff::hs#4 ] +Potential register analysis [11] doStuff::hsp#0 = (byte*)((byte*)doStuff::hs#4)[doStuff::$1] missing fragment Fragment not found pbuz1=_ptr_pbuz2_derefidx_vbuaa. Attempted variations pbuz1=_ptr_pbuz2_derefidx_vbuaa allocation: reg byte a [ doStuff::$1 ] zp[2]:6 [ doStuff::hsp#0 ] zp[2]:2 [ doStuff::hs#4 ] +Potential register analysis [11] doStuff::hsp#0 = (byte*)((byte*)doStuff::hs#4)[doStuff::$1] missing fragment Fragment not found pbuz1=_ptr_pbuz2_derefidx_vbuxx. Attempted variations pbuz1=_ptr_pbuz2_derefidx_vbuxx allocation: reg byte x [ doStuff::$1 ] zp[2]:6 [ doStuff::hsp#0 ] zp[2]:2 [ doStuff::hs#4 ] +Potential register analysis [11] doStuff::hsp#0 = (byte*)((byte*)doStuff::hs#4)[doStuff::$1] missing fragment Fragment not found pbuz1=_ptr_pbuz2_derefidx_vbuyy. Attempted variations pbuz1=_ptr_pbuz2_derefidx_vbuyy allocation: reg byte y [ doStuff::$1 ] zp[2]:6 [ doStuff::hsp#0 ] zp[2]:2 [ doStuff::hs#4 ] +MISSING FRAGMENTS + Fragment not found pbuz1=_ptr_pbuz2_derefidx_vbuz3. Attempted variations pbuz1=_ptr_pbuz2_derefidx_vbuz3 + Fragment not found pbuz1=_ptr_pbuz2_derefidx_vbuaa. Attempted variations pbuz1=_ptr_pbuz2_derefidx_vbuaa + Fragment not found pbuz1=_ptr_pbuz2_derefidx_vbuxx. Attempted variations pbuz1=_ptr_pbuz2_derefidx_vbuxx + Fragment not found pbuz1=_ptr_pbuz2_derefidx_vbuyy. Attempted variations pbuz1=_ptr_pbuz2_derefidx_vbuyy +Statement [11] doStuff::hsp#0 = (byte*)((byte*)doStuff::hs#4)[doStuff::$1] [ doStuff::hs#4 doStuff::i#2 doStuff::hsp#0 ] ( doStuff:2 [ doStuff::hs#4 doStuff::i#2 doStuff::hsp#0 ] { } doStuff:4 [ doStuff::hs#4 doStuff::i#2 doStuff::hsp#0 ] { } ) always clobbers reg byte a reg byte x reg byte y +Removing always clobbered register reg byte x as potential for zp[1]:4 [ doStuff::i#2 doStuff::i#1 ] +Removing always clobbered register reg byte y as potential for zp[1]:4 [ doStuff::i#2 doStuff::i#1 ] +Statement [12] if(*doStuff::hsp#0!=0) goto doStuff::@3 [ doStuff::hs#4 doStuff::i#2 ] ( doStuff:2 [ doStuff::hs#4 doStuff::i#2 ] { } doStuff:4 [ doStuff::hs#4 doStuff::i#2 ] { } ) always clobbers reg byte a reg byte y +Statement [13] OUT[doStuff::i#2] = 2 [ doStuff::hs#4 doStuff::i#2 ] ( doStuff:2 [ doStuff::hs#4 doStuff::i#2 ] { } doStuff:4 [ doStuff::hs#4 doStuff::i#2 ] { } ) always clobbers reg byte a reg byte y +Statement [15] OUT[doStuff::i#2] = 1 [ doStuff::hs#4 doStuff::i#2 ] ( doStuff:2 [ doStuff::hs#4 doStuff::i#2 ] { } doStuff:4 [ doStuff::hs#4 doStuff::i#2 ] { } ) always clobbers reg byte a reg byte y +Statement [0] *(&main::slots1) = memcpy(*(&$0), struct hostslots, SIZEOF_STRUCT_HOSTSLOTS) [ main::slots2 ] ( [ main::slots2 ] { } ) always clobbers reg byte a reg byte y +Statement [1] *(&main::slots2) = memcpy(*(&$1), struct hostslots, SIZEOF_STRUCT_HOSTSLOTS) [ ] ( [ ] { } ) always clobbers reg byte a reg byte y +Statement [8] if(doStuff::i#2<8) goto doStuff::@2 [ doStuff::hs#4 doStuff::i#2 ] ( doStuff:2 [ doStuff::hs#4 doStuff::i#2 ] { } doStuff:4 [ doStuff::hs#4 doStuff::i#2 ] { } ) always clobbers reg byte a +Statement [10] doStuff::$1 = doStuff::i#2 << 5 [ doStuff::hs#4 doStuff::i#2 doStuff::$1 ] ( doStuff:2 [ doStuff::hs#4 doStuff::i#2 doStuff::$1 ] { } doStuff:4 [ doStuff::hs#4 doStuff::i#2 doStuff::$1 ] { } ) always clobbers reg byte a +Potential register analysis [11] doStuff::hsp#0 = (byte*)((byte*)doStuff::hs#4)[doStuff::$1] missing fragment Fragment not found pbuz1=_ptr_pbuz2_derefidx_vbuz3. Attempted variations pbuz1=_ptr_pbuz2_derefidx_vbuz3 allocation: zp[1]:5 [ doStuff::$1 ] zp[2]:6 [ doStuff::hsp#0 ] zp[2]:2 [ doStuff::hs#4 ] +Potential register analysis [11] doStuff::hsp#0 = (byte*)((byte*)doStuff::hs#4)[doStuff::$1] missing fragment Fragment not found pbuz1=_ptr_pbuz2_derefidx_vbuaa. Attempted variations pbuz1=_ptr_pbuz2_derefidx_vbuaa allocation: reg byte a [ doStuff::$1 ] zp[2]:6 [ doStuff::hsp#0 ] zp[2]:2 [ doStuff::hs#4 ] +Potential register analysis [11] doStuff::hsp#0 = (byte*)((byte*)doStuff::hs#4)[doStuff::$1] missing fragment Fragment not found pbuz1=_ptr_pbuz2_derefidx_vbuxx. Attempted variations pbuz1=_ptr_pbuz2_derefidx_vbuxx allocation: reg byte x [ doStuff::$1 ] zp[2]:6 [ doStuff::hsp#0 ] zp[2]:2 [ doStuff::hs#4 ] +Potential register analysis [11] doStuff::hsp#0 = (byte*)((byte*)doStuff::hs#4)[doStuff::$1] missing fragment Fragment not found pbuz1=_ptr_pbuz2_derefidx_vbuyy. Attempted variations pbuz1=_ptr_pbuz2_derefidx_vbuyy allocation: reg byte y [ doStuff::$1 ] zp[2]:6 [ doStuff::hsp#0 ] zp[2]:2 [ doStuff::hs#4 ] +MISSING FRAGMENTS + Fragment not found pbuz1=_ptr_pbuz2_derefidx_vbuz3. Attempted variations pbuz1=_ptr_pbuz2_derefidx_vbuz3 + Fragment not found pbuz1=_ptr_pbuz2_derefidx_vbuaa. Attempted variations pbuz1=_ptr_pbuz2_derefidx_vbuaa + Fragment not found pbuz1=_ptr_pbuz2_derefidx_vbuxx. Attempted variations pbuz1=_ptr_pbuz2_derefidx_vbuxx + Fragment not found pbuz1=_ptr_pbuz2_derefidx_vbuyy. Attempted variations pbuz1=_ptr_pbuz2_derefidx_vbuyy +Statement [11] doStuff::hsp#0 = (byte*)((byte*)doStuff::hs#4)[doStuff::$1] [ doStuff::hs#4 doStuff::i#2 doStuff::hsp#0 ] ( doStuff:2 [ doStuff::hs#4 doStuff::i#2 doStuff::hsp#0 ] { } doStuff:4 [ doStuff::hs#4 doStuff::i#2 doStuff::hsp#0 ] { } ) always clobbers reg byte a reg byte x reg byte y +Statement [12] if(*doStuff::hsp#0!=0) goto doStuff::@3 [ doStuff::hs#4 doStuff::i#2 ] ( doStuff:2 [ doStuff::hs#4 doStuff::i#2 ] { } doStuff:4 [ doStuff::hs#4 doStuff::i#2 ] { } ) always clobbers reg byte a reg byte y +Statement [13] OUT[doStuff::i#2] = 2 [ doStuff::hs#4 doStuff::i#2 ] ( doStuff:2 [ doStuff::hs#4 doStuff::i#2 ] { } doStuff:4 [ doStuff::hs#4 doStuff::i#2 ] { } ) always clobbers reg byte a reg byte y +Statement [15] OUT[doStuff::i#2] = 1 [ doStuff::hs#4 doStuff::i#2 ] ( doStuff:2 [ doStuff::hs#4 doStuff::i#2 ] { } doStuff:4 [ doStuff::hs#4 doStuff::i#2 ] { } ) always clobbers reg byte a reg byte y +Potential registers zp[2]:2 [ doStuff::hs#4 ] : zp[2]:2 , +Potential registers zp[1]:4 [ doStuff::i#2 doStuff::i#1 ] : zp[1]:4 , +Potential registers zp[1]:5 [ doStuff::$1 ] : zp[1]:5 , reg byte a , reg byte x , reg byte y , +Potential registers zp[2]:6 [ doStuff::hsp#0 ] : zp[2]:6 , +Potential registers mem[256] [ main::slots1 ] : mem[256] , +Potential registers mem[256] [ main::slots2 ] : mem[256] , + +REGISTER UPLIFT SCOPES +Uplift Scope [doStuff] 288.57: zp[1]:4 [ doStuff::i#2 doStuff::i#1 ] 202: zp[2]:6 [ doStuff::hsp#0 ] 101: zp[1]:5 [ doStuff::$1 ] 0: zp[2]:2 [ doStuff::hs#4 ] +Uplift Scope [hostslots] +Uplift Scope [main] 0: mem[256] [ main::slots1 ] 0: mem[256] [ main::slots2 ] +Uplift Scope [] + +Warning! Unknown fragment for statement [11] doStuff::hsp#0 = (byte*)((byte*)doStuff::hs#4)[doStuff::$1] +Missing ASM fragment Fragment not found pbuz1=_ptr_pbuz2_derefidx_vbuz3. Attempted variations pbuz1=_ptr_pbuz2_derefidx_vbuz3 +/Users/jespergravgaard/c64/kickc/src/test/kc/struct-array-problem-1.c:23:9: +Warning! Unknown fragment for statement [11] doStuff::hsp#0 = (byte*)((byte*)doStuff::hs#4)[doStuff::$1] +Missing ASM fragment Fragment not found pbuz1=_ptr_pbuz2_derefidx_vbuaa. Attempted variations pbuz1=_ptr_pbuz2_derefidx_vbuaa +/Users/jespergravgaard/c64/kickc/src/test/kc/struct-array-problem-1.c:23:9: +Warning! Unknown fragment for statement [11] doStuff::hsp#0 = (byte*)((byte*)doStuff::hs#4)[doStuff::$1] +Missing ASM fragment Fragment not found pbuz1=_ptr_pbuz2_derefidx_vbuxx. Attempted variations pbuz1=_ptr_pbuz2_derefidx_vbuxx +/Users/jespergravgaard/c64/kickc/src/test/kc/struct-array-problem-1.c:23:9: +Warning! Unknown fragment for statement [11] doStuff::hsp#0 = (byte*)((byte*)doStuff::hs#4)[doStuff::$1] +Missing ASM fragment Fragment not found pbuz1=_ptr_pbuz2_derefidx_vbuyy. Attempted variations pbuz1=_ptr_pbuz2_derefidx_vbuyy +/Users/jespergravgaard/c64/kickc/src/test/kc/struct-array-problem-1.c:23:9: +Uplifting [doStuff] best 887 combination zp[1]:4 [ doStuff::i#2 doStuff::i#1 ] zp[2]:6 [ doStuff::hsp#0 ] reg byte a [ doStuff::$1 ] zp[2]:2 [ doStuff::hs#4 ] +Warning! Unknown fragment for statement [11] doStuff::hsp#0 = (byte*)((byte*)doStuff::hs#4)[doStuff::$1] +Missing ASM fragment Fragment not found pbuz1=_ptr_pbuz2_derefidx_vbuaa. Attempted variations pbuz1=_ptr_pbuz2_derefidx_vbuaa +/Users/jespergravgaard/c64/kickc/src/test/kc/struct-array-problem-1.c:23:9: +Uplifting [hostslots] best 887 combination +Warning! Unknown fragment for statement [11] doStuff::hsp#0 = (byte*)((byte*)doStuff::hs#4)[doStuff::$1] +Missing ASM fragment Fragment not found pbuz1=_ptr_pbuz2_derefidx_vbuaa. Attempted variations pbuz1=_ptr_pbuz2_derefidx_vbuaa +/Users/jespergravgaard/c64/kickc/src/test/kc/struct-array-problem-1.c:23:9: +Uplifting [main] best 887 combination mem[256] [ main::slots1 ] mem[256] [ main::slots2 ] +Warning! Unknown fragment for statement [11] doStuff::hsp#0 = (byte*)((byte*)doStuff::hs#4)[doStuff::$1] +Missing ASM fragment Fragment not found pbuz1=_ptr_pbuz2_derefidx_vbuaa. Attempted variations pbuz1=_ptr_pbuz2_derefidx_vbuaa +/Users/jespergravgaard/c64/kickc/src/test/kc/struct-array-problem-1.c:23:9: +Uplifting [] best 887 combination +Attempting to uplift remaining variables inzp[1]:4 [ doStuff::i#2 doStuff::i#1 ] +Warning! Unknown fragment for statement [11] doStuff::hsp#0 = (byte*)((byte*)doStuff::hs#4)[doStuff::$1] +Missing ASM fragment Fragment not found pbuz1=_ptr_pbuz2_derefidx_vbuaa. Attempted variations pbuz1=_ptr_pbuz2_derefidx_vbuaa +/Users/jespergravgaard/c64/kickc/src/test/kc/struct-array-problem-1.c:23:9: +Uplifting [doStuff] best 887 combination zp[1]:4 [ doStuff::i#2 doStuff::i#1 ] +Allocated (was zp[2]:6) zp[2]:5 [ doStuff::hsp#0 ] +Warning! Unknown fragment for statement [11] doStuff::hsp#0 = (byte*)((byte*)doStuff::hs#4)[doStuff::$1] +Missing ASM fragment Fragment not found pbuz1=_ptr_pbuz2_derefidx_vbuaa. Attempted variations pbuz1=_ptr_pbuz2_derefidx_vbuaa +/Users/jespergravgaard/c64/kickc/src/test/kc/struct-array-problem-1.c:23:9: + +ASSEMBLER BEFORE OPTIMIZATION + // File Comments +// Demonstrates problem with structs containing arrays and auto-type conversion +// https://gitlab.com/camelot/kickc/-/issues/593 + // Upstart +.pc = $801 "Basic" +:BasicUpstart(main) +.pc = $80d "Program" + // Global Constants & labels + .const SIZEOF_STRUCT_HOSTSLOTS = 0 + .label OUT = $8000 + // main +main: { + // [0] *(&main::slots1) = memcpy(*(&$0), struct hostslots, SIZEOF_STRUCT_HOSTSLOTS) -- _deref_pssc1=_deref_pssc2_memcpy_vbuc3 + ldy #SIZEOF_STRUCT_HOSTSLOTS + !: + lda __0-1,y + sta slots1-1,y + dey + bne !- + // [1] *(&main::slots2) = memcpy(*(&$1), struct hostslots, SIZEOF_STRUCT_HOSTSLOTS) -- _deref_pssc1=_deref_pssc2_memcpy_vbuc3 + ldy #SIZEOF_STRUCT_HOSTSLOTS + !: + lda __1-1,y + sta slots2-1,y + dey + bne !- + // [2] call doStuff + // [6] phi from main to doStuff [phi:main->doStuff] + doStuff_from_main: + // [6] phi doStuff::hs#4 = &main::slots1 [phi:main->doStuff#0] -- pssz1=pssc1 + lda #slots1 + sta.z doStuff.hs+1 + jsr doStuff + // [3] phi from main to main::@1 [phi:main->main::@1] + __b1_from_main: + jmp __b1 + // main::@1 + __b1: + // [4] call doStuff + // [6] phi from main::@1 to doStuff [phi:main::@1->doStuff] + doStuff_from___b1: + // [6] phi doStuff::hs#4 = &main::slots2 [phi:main::@1->doStuff#0] -- pssz1=pssc1 + lda #slots2 + sta.z doStuff.hs+1 + jsr doStuff + jmp __breturn + // main::@return + __breturn: + // [5] return + rts + slots1: .fill SIZEOF_STRUCT_HOSTSLOTS, 0 + slots2: .fill SIZEOF_STRUCT_HOSTSLOTS, 0 +} + // doStuff +// doStuff(struct hostslots* zp(2) hs) +doStuff: { + .label hsp = 5 + .label i = 4 + .label hs = 2 + // [7] phi from doStuff to doStuff::@1 [phi:doStuff->doStuff::@1] + __b1_from_doStuff: + // [7] phi doStuff::i#2 = 0 [phi:doStuff->doStuff::@1#0] -- vbuz1=vbuc1 + lda #0 + sta.z i + jmp __b1 + // doStuff::@1 + __b1: + // [8] if(doStuff::i#2<8) goto doStuff::@2 -- vbuz1_lt_vbuc1_then_la1 + lda.z i + cmp #8 + bcc __b2 + jmp __breturn + // doStuff::@return + __breturn: + // [9] return + rts + // doStuff::@2 + __b2: + // [10] doStuff::$1 = doStuff::i#2 << 5 -- vbuaa=vbuz1_rol_5 + lda.z i + asl + asl + asl + asl + asl + // [11] doStuff::hsp#0 = (byte*)((byte*)doStuff::hs#4)[doStuff::$1] + // should be: + // if (hs->host[i][0] != 0) { + .assert "Missing ASM fragment Fragment not found pbuz1=_ptr_pbuz2_derefidx_vbuaa. Attempted variations pbuz1=_ptr_pbuz2_derefidx_vbuaa ", 0, 1 + // [12] if(*doStuff::hsp#0!=0) goto doStuff::@3 -- _deref_pbuz1_neq_0_then_la1 + ldy #0 + lda (hsp),y + cmp #0 + bne __b3 + jmp __b5 + // doStuff::@5 + __b5: + // [13] OUT[doStuff::i#2] = 2 -- pbuc1_derefidx_vbuz1=vbuc2 + lda #2 + ldy.z i + sta OUT,y + jmp __b4 + // doStuff::@4 + __b4: + // [14] doStuff::i#1 = ++ doStuff::i#2 -- vbuz1=_inc_vbuz1 + inc.z i + // [7] phi from doStuff::@4 to doStuff::@1 [phi:doStuff::@4->doStuff::@1] + __b1_from___b4: + // [7] phi doStuff::i#2 = doStuff::i#1 [phi:doStuff::@4->doStuff::@1#0] -- register_copy + jmp __b1 + // doStuff::@3 + __b3: + // [15] OUT[doStuff::i#2] = 1 -- pbuc1_derefidx_vbuz1=vbuc2 + lda #1 + ldy.z i + sta OUT,y + jmp __b4 +} + // File Data + __0: .text "some data that would fit a normal 8x32 double array" + .byte 0 + .fill $cc, 0 + __1: .text "more data that would fit a normal 8x32 double array" + .byte 0 + .fill $cc, 0 + +ASSEMBLER OPTIMIZATIONS +Removing instruction jmp __b1 +Removing instruction jmp __breturn +Removing instruction jmp __b1 +Removing instruction jmp __breturn +Removing instruction jmp __b5 +Removing instruction jmp __b4 +Succesful ASM optimization Pass5NextJumpElimination +Removing instruction __b1_from_main: +Removing instruction doStuff_from___b1: +Succesful ASM optimization Pass5RedundantLabelElimination +Removing instruction doStuff_from_main: +Removing instruction __b1: +Removing instruction __breturn: +Removing instruction __b1_from_doStuff: +Removing instruction __breturn: +Removing instruction __b5: +Removing instruction __b1_from___b4: +Succesful ASM optimization Pass5UnusedLabelElimination + +FINAL SYMBOL TABLE +const struct hostslots $0 = { host: "some data that would fit a normal 8x32 double array" } +const struct hostslots $1 = { host: "more data that would fit a normal 8x32 double array" } +const nomodify byte* OUT = (byte*) 32768 +const byte SIZEOF_STRUCT_HOSTSLOTS = 0 +void doStuff(struct hostslots* doStuff::hs) +byte~ doStuff::$1 reg byte a 101.0 +struct hostslots* doStuff::hs +struct hostslots* doStuff::hs#4 hs zp[2]:2 +byte* doStuff::hsp +byte* doStuff::hsp#0 hsp zp[2]:5 202.0 +byte doStuff::i +byte doStuff::i#1 i zp[1]:4 202.0 +byte doStuff::i#2 i zp[1]:4 86.57142857142857 +void main() +struct hostslots main::slots1 loadstore mem[256] +struct hostslots main::slots2 loadstore mem[256] + +zp[2]:2 [ doStuff::hs#4 ] +zp[1]:4 [ doStuff::i#2 doStuff::i#1 ] +reg byte a [ doStuff::$1 ] +zp[2]:5 [ doStuff::hsp#0 ] +mem[256] [ main::slots1 ] +mem[256] [ main::slots2 ] + + +FINAL ASSEMBLER +Score: 761 + + // File Comments +// Demonstrates problem with structs containing arrays and auto-type conversion +// https://gitlab.com/camelot/kickc/-/issues/593 + // Upstart +.pc = $801 "Basic" +:BasicUpstart(main) +.pc = $80d "Program" + // Global Constants & labels + .const SIZEOF_STRUCT_HOSTSLOTS = 0 + .label OUT = $8000 + // main +main: { + // slots1 = {"some data that would fit a normal 8x32 double array"} + // [0] *(&main::slots1) = memcpy(*(&$0), struct hostslots, SIZEOF_STRUCT_HOSTSLOTS) -- _deref_pssc1=_deref_pssc2_memcpy_vbuc3 + ldy #SIZEOF_STRUCT_HOSTSLOTS + !: + lda __0-1,y + sta slots1-1,y + dey + bne !- + // slots2 = {"more data that would fit a normal 8x32 double array"} + // [1] *(&main::slots2) = memcpy(*(&$1), struct hostslots, SIZEOF_STRUCT_HOSTSLOTS) -- _deref_pssc1=_deref_pssc2_memcpy_vbuc3 + ldy #SIZEOF_STRUCT_HOSTSLOTS + !: + lda __1-1,y + sta slots2-1,y + dey + bne !- + // doStuff(&slots1) + // [2] call doStuff + // [6] phi from main to doStuff [phi:main->doStuff] + // [6] phi doStuff::hs#4 = &main::slots1 [phi:main->doStuff#0] -- pssz1=pssc1 + lda #slots1 + sta.z doStuff.hs+1 + jsr doStuff + // [3] phi from main to main::@1 [phi:main->main::@1] + // main::@1 + // doStuff(&slots2) + // [4] call doStuff + // [6] phi from main::@1 to doStuff [phi:main::@1->doStuff] + // [6] phi doStuff::hs#4 = &main::slots2 [phi:main::@1->doStuff#0] -- pssz1=pssc1 + lda #slots2 + sta.z doStuff.hs+1 + jsr doStuff + // main::@return + // } + // [5] return + rts + slots1: .fill SIZEOF_STRUCT_HOSTSLOTS, 0 + slots2: .fill SIZEOF_STRUCT_HOSTSLOTS, 0 +} + // doStuff +// doStuff(struct hostslots* zp(2) hs) +doStuff: { + .label hsp = 5 + .label i = 4 + .label hs = 2 + // [7] phi from doStuff to doStuff::@1 [phi:doStuff->doStuff::@1] + // [7] phi doStuff::i#2 = 0 [phi:doStuff->doStuff::@1#0] -- vbuz1=vbuc1 + lda #0 + sta.z i + // doStuff::@1 + __b1: + // for(unsigned char i = 0; i < 8; i++) + // [8] if(doStuff::i#2<8) goto doStuff::@2 -- vbuz1_lt_vbuc1_then_la1 + lda.z i + cmp #8 + bcc __b2 + // doStuff::@return + // } + // [9] return + rts + // doStuff::@2 + __b2: + // i * HOSTSLOT_SIZE + // [10] doStuff::$1 = doStuff::i#2 << 5 -- vbuaa=vbuz1_rol_5 + lda.z i + asl + asl + asl + asl + asl + // hsp = hs->host[i * HOSTSLOT_SIZE] + // [11] doStuff::hsp#0 = (byte*)((byte*)doStuff::hs#4)[doStuff::$1] + // should be: + // if (hs->host[i][0] != 0) { + .assert "Missing ASM fragment Fragment not found pbuz1=_ptr_pbuz2_derefidx_vbuaa. Attempted variations pbuz1=_ptr_pbuz2_derefidx_vbuaa ", 0, 1 + // if (*hsp != 0) + // [12] if(*doStuff::hsp#0!=0) goto doStuff::@3 -- _deref_pbuz1_neq_0_then_la1 + ldy #0 + lda (hsp),y + cmp #0 + bne __b3 + // doStuff::@5 + // *(OUT + i) = 2 + // [13] OUT[doStuff::i#2] = 2 -- pbuc1_derefidx_vbuz1=vbuc2 + lda #2 + ldy.z i + sta OUT,y + // doStuff::@4 + __b4: + // for(unsigned char i = 0; i < 8; i++) + // [14] doStuff::i#1 = ++ doStuff::i#2 -- vbuz1=_inc_vbuz1 + inc.z i + // [7] phi from doStuff::@4 to doStuff::@1 [phi:doStuff::@4->doStuff::@1] + // [7] phi doStuff::i#2 = doStuff::i#1 [phi:doStuff::@4->doStuff::@1#0] -- register_copy + jmp __b1 + // doStuff::@3 + __b3: + // *(OUT + i) = 1 + // [15] OUT[doStuff::i#2] = 1 -- pbuc1_derefidx_vbuz1=vbuc2 + lda #1 + ldy.z i + sta OUT,y + jmp __b4 +} + // File Data + __0: .text "some data that would fit a normal 8x32 double array" + .byte 0 + .fill $cc, 0 + __1: .text "more data that would fit a normal 8x32 double array" + .byte 0 + .fill $cc, 0 + diff --git a/src/test/ref/struct-array-problem-1.sym b/src/test/ref/struct-array-problem-1.sym new file mode 100644 index 000000000..34424f63b --- /dev/null +++ b/src/test/ref/struct-array-problem-1.sym @@ -0,0 +1,23 @@ +const struct hostslots $0 = { host: "some data that would fit a normal 8x32 double array" } +const struct hostslots $1 = { host: "more data that would fit a normal 8x32 double array" } +const nomodify byte* OUT = (byte*) 32768 +const byte SIZEOF_STRUCT_HOSTSLOTS = 0 +void doStuff(struct hostslots* doStuff::hs) +byte~ doStuff::$1 reg byte a 101.0 +struct hostslots* doStuff::hs +struct hostslots* doStuff::hs#4 hs zp[2]:2 +byte* doStuff::hsp +byte* doStuff::hsp#0 hsp zp[2]:5 202.0 +byte doStuff::i +byte doStuff::i#1 i zp[1]:4 202.0 +byte doStuff::i#2 i zp[1]:4 86.57142857142857 +void main() +struct hostslots main::slots1 loadstore mem[256] +struct hostslots main::slots2 loadstore mem[256] + +zp[2]:2 [ doStuff::hs#4 ] +zp[1]:4 [ doStuff::i#2 doStuff::i#1 ] +reg byte a [ doStuff::$1 ] +zp[2]:5 [ doStuff::hsp#0 ] +mem[256] [ main::slots1 ] +mem[256] [ main::slots2 ] diff --git a/src/test/ref/test-multiply-16bit.asm b/src/test/ref/test-multiply-16bit.asm index 35ddc9586..443b49d01 100644 --- a/src/test/ref/test-multiply-16bit.asm +++ b/src/test/ref/test-multiply-16bit.asm @@ -503,10 +503,8 @@ muls16u: { .label b = $1a // if(a!=0) lda.z a - bne !+ - lda.z a+1 + ora.z a+1 beq __b4 - !: lda #<0 sta.z m sta.z m+1 @@ -583,8 +581,7 @@ mul16u: { __b1: // while(a!=0) lda.z a - bne __b2 - lda.z a+1 + ora.z a+1 bne __b2 // } rts diff --git a/src/test/ref/test-multiply-16bit.log b/src/test/ref/test-multiply-16bit.log index 20217cb88..4bae31cda 100644 --- a/src/test/ref/test-multiply-16bit.log +++ b/src/test/ref/test-multiply-16bit.log @@ -5301,41 +5301,41 @@ Uplift Scope [print_ln] Uplift Scope [print_cls] Uplift Scope [main] -Uplifting [mul16u] best 557186 combination zp[4]:44 [ mul16u::res#2 mul16u::res#6 mul16u::res#1 ] zp[4]:48 [ mul16u::mb#2 mul16u::mb#0 mul16u::mb#1 ] reg byte a [ mul16u::$1 ] zp[2]:42 [ mul16u::a#3 mul16u::a#6 mul16u::a#1 mul16u::a#2 mul16u::a#0 ] zp[2]:40 [ mul16u::b#2 mul16u::b#0 mul16u::b#1 ] zp[4]:194 [ mul16u::return#2 ] zp[4]:105 [ mul16u::return#3 ] -Uplifting [muls16s] best 557186 combination zp[4]:60 [ muls16s::return#0 muls16s::m#3 muls16s::m#1 muls16s::m#5 muls16s::m#2 ] zp[2]:58 [ muls16s::j#2 muls16s::j#1 ] zp[2]:64 [ muls16s::i#2 muls16s::i#1 ] zp[2]:139 [ muls16s::b#0 ] zp[2]:137 [ muls16s::a#0 ] zp[4]:141 [ muls16s::return#2 ] -Uplifting [muls16u] best 557186 combination zp[2]:34 [ muls16u::i#2 muls16u::i#1 ] zp[4]:36 [ muls16u::return#0 muls16u::m#3 muls16u::m#1 ] zp[2]:95 [ muls16u::b#0 ] zp[2]:93 [ muls16u::a#0 ] zp[4]:97 [ muls16u::return#2 ] -Uplifting [print_char] best 556865 combination reg byte a [ print_char::ch#7 print_char::ch#0 print_char::ch#5 print_char::ch#6 ] -Uplifting [] best 556865 combination zp[2]:77 [ print_char_cursor#140 print_char_cursor#89 print_char_cursor#136 print_char_cursor#157 print_char_cursor#152 print_char_cursor#223 print_char_cursor#148 print_char_cursor#1 print_char_cursor#183 print_char_cursor#21 print_char_cursor#190 print_char_cursor#145 print_char_cursor#141 ] zp[2]:56 [ print_line_cursor#23 print_line_cursor#45 print_line_cursor#0 ] -Uplifting [print_uchar] best 556847 combination reg byte a [ print_uchar::$0 ] reg byte x [ print_uchar::$2 ] reg byte x [ print_uchar::b#2 print_uchar::b#0 print_uchar::b#1 ] -Uplifting [print_str] best 556847 combination zp[2]:32 [ print_str::str#15 print_str::str#18 print_str::str#0 ] -Uplifting [mulf16u] best 556847 combination zp[2]:52 [ mulf16u::a#2 mulf16u::a#1 mulf16u::a#0 ] zp[2]:54 [ mulf16u::b#2 mulf16u::b#1 mulf16u::b#0 ] zp[4]:190 [ mulf16u::return#0 ] zp[4]:210 [ mulf16u::return#2 ] zp[4]:113 [ mulf16u::return#3 ] -Uplifting [mul16s] best 556847 combination zp[4]:66 [ mul16s::m#4 mul16s::m#5 mul16s::m#1 mul16s::m#0 mul16s::m#2 ] zp[2]:198 [ mul16s::$6 ] zp[2]:200 [ mul16s::$11 ] zp[2]:202 [ mul16s::$9 ] zp[2]:204 [ mul16s::$12 ] zp[4]:206 [ mul16s::return#0 ] zp[4]:153 [ mul16s::return#2 ] zp[2]:151 [ mul16s::b#0 ] zp[2]:149 [ mul16s::a#0 ] -Uplifting [mulf16s] best 556847 combination zp[4]:70 [ mulf16s::m#4 mulf16s::m#5 mulf16s::m#1 mulf16s::m#0 mulf16s::m#2 ] zp[2]:214 [ mulf16s::$6 ] zp[2]:216 [ mulf16s::$11 ] zp[2]:218 [ mulf16s::$9 ] zp[2]:220 [ mulf16s::$12 ] zp[4]:222 [ mulf16s::return#0 ] zp[4]:165 [ mulf16s::return#2 ] zp[2]:163 [ mulf16s::b#0 ] zp[2]:161 [ mulf16s::a#0 ] -Uplifting [print_uint] best 556847 combination zp[2]:75 [ print_uint::w#5 print_uint::w#3 print_uint::w#4 print_uint::w#0 print_uint::w#1 print_uint::w#2 ] -Uplifting [print_ulong] best 556847 combination zp[4]:79 [ print_ulong::dw#4 print_ulong::dw#1 print_ulong::dw#2 print_ulong::dw#3 print_ulong::dw#0 ] -Uplifting [mul16u_compare] best 554747 combination zp[2]:17 [ mul16u_compare::a#2 mul16u_compare::a#6 mul16u_compare::a#1 ] reg byte x [ mul16u_compare::ok#3 mul16u_compare::ok#4 ] reg byte y [ mul16u_compare::j#10 mul16u_compare::j#1 ] zp[2]:19 [ mul16u_compare::b#2 mul16u_compare::b#6 mul16u_compare::b#1 ] zp[1]:16 [ mul16u_compare::i#12 mul16u_compare::i#1 ] zp[4]:117 [ mul16u_compare::mf#0 ] zp[4]:101 [ mul16u_compare::ms#0 ] zp[4]:109 [ mul16u_compare::mn#0 ] -Uplifting [mul16s_compare] best 552647 combination zp[2]:24 [ mul16s_compare::a#2 mul16s_compare::a#6 mul16s_compare::a#1 ] reg byte x [ mul16s_compare::ok#3 mul16s_compare::ok#4 ] reg byte y [ mul16s_compare::j#10 mul16s_compare::j#1 ] zp[2]:26 [ mul16s_compare::b#2 mul16s_compare::b#6 mul16s_compare::b#1 ] zp[1]:23 [ mul16s_compare::i#12 mul16s_compare::i#1 ] zp[4]:169 [ mul16s_compare::mf#0 ] zp[4]:145 [ mul16s_compare::ms#0 ] zp[4]:157 [ mul16s_compare::mn#0 ] -Uplifting [print_slong] best 552647 combination zp[4]:85 [ print_slong::dw#6 print_slong::dw#0 print_slong::dw#4 print_slong::dw#1 print_slong::dw#2 print_slong::dw#3 ] -Uplifting [print_sint] best 552647 combination zp[2]:83 [ print_sint::w#5 print_sint::w#0 print_sint::w#3 print_sint::w#1 print_sint::w#2 ] -Uplifting [memset] best 552647 combination zp[2]:30 [ memset::dst#2 memset::dst#1 ] -Uplifting [mulf_init] best 552397 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 [mul16u] best 554683 combination zp[4]:44 [ mul16u::res#2 mul16u::res#6 mul16u::res#1 ] zp[4]:48 [ mul16u::mb#2 mul16u::mb#0 mul16u::mb#1 ] reg byte a [ mul16u::$1 ] zp[2]:42 [ mul16u::a#3 mul16u::a#6 mul16u::a#1 mul16u::a#2 mul16u::a#0 ] zp[2]:40 [ mul16u::b#2 mul16u::b#0 mul16u::b#1 ] zp[4]:194 [ mul16u::return#2 ] zp[4]:105 [ mul16u::return#3 ] +Uplifting [muls16s] best 554683 combination zp[4]:60 [ muls16s::return#0 muls16s::m#3 muls16s::m#1 muls16s::m#5 muls16s::m#2 ] zp[2]:58 [ muls16s::j#2 muls16s::j#1 ] zp[2]:64 [ muls16s::i#2 muls16s::i#1 ] zp[2]:139 [ muls16s::b#0 ] zp[2]:137 [ muls16s::a#0 ] zp[4]:141 [ muls16s::return#2 ] +Uplifting [muls16u] best 554683 combination zp[2]:34 [ muls16u::i#2 muls16u::i#1 ] zp[4]:36 [ muls16u::return#0 muls16u::m#3 muls16u::m#1 ] zp[2]:95 [ muls16u::b#0 ] zp[2]:93 [ muls16u::a#0 ] zp[4]:97 [ muls16u::return#2 ] +Uplifting [print_char] best 554362 combination reg byte a [ print_char::ch#7 print_char::ch#0 print_char::ch#5 print_char::ch#6 ] +Uplifting [] best 554362 combination zp[2]:77 [ print_char_cursor#140 print_char_cursor#89 print_char_cursor#136 print_char_cursor#157 print_char_cursor#152 print_char_cursor#223 print_char_cursor#148 print_char_cursor#1 print_char_cursor#183 print_char_cursor#21 print_char_cursor#190 print_char_cursor#145 print_char_cursor#141 ] zp[2]:56 [ print_line_cursor#23 print_line_cursor#45 print_line_cursor#0 ] +Uplifting [print_uchar] best 554344 combination reg byte a [ print_uchar::$0 ] reg byte x [ print_uchar::$2 ] reg byte x [ print_uchar::b#2 print_uchar::b#0 print_uchar::b#1 ] +Uplifting [print_str] best 554344 combination zp[2]:32 [ print_str::str#15 print_str::str#18 print_str::str#0 ] +Uplifting [mulf16u] best 554344 combination zp[2]:52 [ mulf16u::a#2 mulf16u::a#1 mulf16u::a#0 ] zp[2]:54 [ mulf16u::b#2 mulf16u::b#1 mulf16u::b#0 ] zp[4]:190 [ mulf16u::return#0 ] zp[4]:210 [ mulf16u::return#2 ] zp[4]:113 [ mulf16u::return#3 ] +Uplifting [mul16s] best 554344 combination zp[4]:66 [ mul16s::m#4 mul16s::m#5 mul16s::m#1 mul16s::m#0 mul16s::m#2 ] zp[2]:198 [ mul16s::$6 ] zp[2]:200 [ mul16s::$11 ] zp[2]:202 [ mul16s::$9 ] zp[2]:204 [ mul16s::$12 ] zp[4]:206 [ mul16s::return#0 ] zp[4]:153 [ mul16s::return#2 ] zp[2]:151 [ mul16s::b#0 ] zp[2]:149 [ mul16s::a#0 ] +Uplifting [mulf16s] best 554344 combination zp[4]:70 [ mulf16s::m#4 mulf16s::m#5 mulf16s::m#1 mulf16s::m#0 mulf16s::m#2 ] zp[2]:214 [ mulf16s::$6 ] zp[2]:216 [ mulf16s::$11 ] zp[2]:218 [ mulf16s::$9 ] zp[2]:220 [ mulf16s::$12 ] zp[4]:222 [ mulf16s::return#0 ] zp[4]:165 [ mulf16s::return#2 ] zp[2]:163 [ mulf16s::b#0 ] zp[2]:161 [ mulf16s::a#0 ] +Uplifting [print_uint] best 554344 combination zp[2]:75 [ print_uint::w#5 print_uint::w#3 print_uint::w#4 print_uint::w#0 print_uint::w#1 print_uint::w#2 ] +Uplifting [print_ulong] best 554344 combination zp[4]:79 [ print_ulong::dw#4 print_ulong::dw#1 print_ulong::dw#2 print_ulong::dw#3 print_ulong::dw#0 ] +Uplifting [mul16u_compare] best 552244 combination zp[2]:17 [ mul16u_compare::a#2 mul16u_compare::a#6 mul16u_compare::a#1 ] reg byte x [ mul16u_compare::ok#3 mul16u_compare::ok#4 ] reg byte y [ mul16u_compare::j#10 mul16u_compare::j#1 ] zp[2]:19 [ mul16u_compare::b#2 mul16u_compare::b#6 mul16u_compare::b#1 ] zp[1]:16 [ mul16u_compare::i#12 mul16u_compare::i#1 ] zp[4]:117 [ mul16u_compare::mf#0 ] zp[4]:101 [ mul16u_compare::ms#0 ] zp[4]:109 [ mul16u_compare::mn#0 ] +Uplifting [mul16s_compare] best 550144 combination zp[2]:24 [ mul16s_compare::a#2 mul16s_compare::a#6 mul16s_compare::a#1 ] reg byte x [ mul16s_compare::ok#3 mul16s_compare::ok#4 ] reg byte y [ mul16s_compare::j#10 mul16s_compare::j#1 ] zp[2]:26 [ mul16s_compare::b#2 mul16s_compare::b#6 mul16s_compare::b#1 ] zp[1]:23 [ mul16s_compare::i#12 mul16s_compare::i#1 ] zp[4]:169 [ mul16s_compare::mf#0 ] zp[4]:145 [ mul16s_compare::ms#0 ] zp[4]:157 [ mul16s_compare::mn#0 ] +Uplifting [print_slong] best 550144 combination zp[4]:85 [ print_slong::dw#6 print_slong::dw#0 print_slong::dw#4 print_slong::dw#1 print_slong::dw#2 print_slong::dw#3 ] +Uplifting [print_sint] best 550144 combination zp[2]:83 [ print_sint::w#5 print_sint::w#0 print_sint::w#3 print_sint::w#1 print_sint::w#2 ] +Uplifting [memset] best 550144 combination zp[2]:30 [ memset::dst#2 memset::dst#1 ] +Uplifting [mulf_init] best 549894 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 [mul16u_error] best 552397 combination zp[2]:121 [ mul16u_error::a#0 ] zp[2]:123 [ mul16u_error::b#0 ] zp[4]:125 [ mul16u_error::ms#0 ] zp[4]:129 [ mul16u_error::mn#0 ] zp[4]:133 [ mul16u_error::mf#0 ] -Uplifting [mul16s_error] best 552397 combination zp[2]:173 [ mul16s_error::a#0 ] zp[2]:175 [ mul16s_error::b#0 ] zp[4]:177 [ mul16s_error::ms#0 ] zp[4]:181 [ mul16s_error::mn#0 ] zp[4]:185 [ mul16s_error::mf#0 ] -Uplifting [RADIX] best 552397 combination -Uplifting [print_ln] best 552397 combination -Uplifting [print_cls] best 552397 combination -Uplifting [main] best 552397 combination +Uplifting [mul16u_error] best 549894 combination zp[2]:121 [ mul16u_error::a#0 ] zp[2]:123 [ mul16u_error::b#0 ] zp[4]:125 [ mul16u_error::ms#0 ] zp[4]:129 [ mul16u_error::mn#0 ] zp[4]:133 [ mul16u_error::mf#0 ] +Uplifting [mul16s_error] best 549894 combination zp[2]:173 [ mul16s_error::a#0 ] zp[2]:175 [ mul16s_error::b#0 ] zp[4]:177 [ mul16s_error::ms#0 ] zp[4]:181 [ mul16s_error::mn#0 ] zp[4]:185 [ mul16s_error::mf#0 ] +Uplifting [RADIX] best 549894 combination +Uplifting [print_ln] best 549894 combination +Uplifting [print_cls] best 549894 combination +Uplifting [main] best 549894 combination Attempting to uplift remaining variables inzp[1]:16 [ mul16u_compare::i#12 mul16u_compare::i#1 ] -Uplifting [mul16u_compare] best 552397 combination zp[1]:16 [ mul16u_compare::i#12 mul16u_compare::i#1 ] +Uplifting [mul16u_compare] best 549894 combination zp[1]:16 [ mul16u_compare::i#12 mul16u_compare::i#1 ] Attempting to uplift remaining variables inzp[1]:23 [ mul16s_compare::i#12 mul16s_compare::i#1 ] -Uplifting [mul16s_compare] best 552397 combination zp[1]:23 [ mul16s_compare::i#12 mul16s_compare::i#1 ] +Uplifting [mul16s_compare] best 549894 combination zp[1]:23 [ mul16s_compare::i#12 mul16s_compare::i#1 ] Attempting to uplift remaining variables inzp[1]:10 [ mulf_init::x_255#2 mulf_init::x_255#1 ] -Uplifting [mulf_init] best 552257 combination reg byte x [ mulf_init::x_255#2 mulf_init::x_255#1 ] +Uplifting [mulf_init] best 549754 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 552257 combination zp[1]:13 [ mulf_init::dir#2 mulf_init::dir#4 ] +Uplifting [mulf_init] best 549754 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 552257 combination zp[1]:4 [ mulf_init::c#2 mulf_init::c#1 ] +Uplifting [mulf_init] best 549754 combination zp[1]:4 [ mulf_init::c#2 mulf_init::c#1 ] Coalescing zero page register [ zp[2]:17 [ mul16u_compare::a#2 mul16u_compare::a#6 mul16u_compare::a#1 ] ] with [ zp[2]:52 [ mulf16u::a#2 mulf16u::a#1 mulf16u::a#0 ] ] - score: 1 Coalescing zero page register [ zp[2]:17 [ mul16u_compare::a#2 mul16u_compare::a#6 mul16u_compare::a#1 mulf16u::a#2 mulf16u::a#1 mulf16u::a#0 ] ] with [ zp[2]:93 [ muls16u::a#0 ] ] - score: 1 Coalescing zero page register [ zp[2]:17 [ mul16u_compare::a#2 mul16u_compare::a#6 mul16u_compare::a#1 mulf16u::a#2 mulf16u::a#1 mulf16u::a#0 muls16u::a#0 ] ] with [ zp[2]:121 [ mul16u_error::a#0 ] ] - score: 1 @@ -6306,10 +6306,8 @@ muls16u: { .label b = $1a // [146] if(muls16u::a#0==0) goto muls16u::@1 -- vwuz1_eq_0_then_la1 lda.z a - bne !+ - lda.z a+1 + ora.z a+1 beq __b1_from_muls16u - !: // [147] phi from muls16u to muls16u::@2 [phi:muls16u->muls16u::@2] __b2_from_muls16u: // [147] phi muls16u::m#3 = 0 [phi:muls16u->muls16u::@2#0] -- vduz1=vduc1 @@ -6421,8 +6419,7 @@ mul16u: { __b1: // [156] if(mul16u::a#3!=0) goto mul16u::@2 -- vwuz1_neq_0_then_la1 lda.z a - bne __b2 - lda.z a+1 + ora.z a+1 bne __b2 jmp __breturn // mul16u::@return @@ -8387,7 +8384,7 @@ reg byte x [ print_uchar::$2 ] FINAL ASSEMBLER -Score: 467180 +Score: 464677 // File Comments // Test the fast multiplication library @@ -9214,10 +9211,8 @@ muls16u: { // if(a!=0) // [146] if(muls16u::a#0==0) goto muls16u::@1 -- vwuz1_eq_0_then_la1 lda.z a - bne !+ - lda.z a+1 + ora.z a+1 beq __b4 - !: // [147] phi from muls16u to muls16u::@2 [phi:muls16u->muls16u::@2] // [147] phi muls16u::m#3 = 0 [phi:muls16u->muls16u::@2#0] -- vduz1=vduc1 lda #<0 @@ -9320,8 +9315,7 @@ mul16u: { // while(a!=0) // [156] if(mul16u::a#3!=0) goto mul16u::@2 -- vwuz1_neq_0_then_la1 lda.z a - bne __b2 - lda.z a+1 + ora.z a+1 bne __b2 // mul16u::@return // }