diff --git a/src/main/fragment/cache/fragment-cache-csg65ce02.asm b/src/main/fragment/cache/fragment-cache-csg65ce02.asm index 1b5fe6283..bcb319d64 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 12beec37ea 12beec5182 +//KICKC FRAGMENT CACHE 11e0585d5e 11e05876ff //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 6d3f30609..8a2d3a957 100644 --- a/src/main/fragment/cache/fragment-cache-mega45gs02.asm +++ b/src/main/fragment/cache/fragment-cache-mega45gs02.asm @@ -1,67 +1,19 @@ -//KICKC FRAGMENT CACHE 12beec37ea 12beec5182 -//FRAGMENT _deref_pbuc1=vbuc2 -lda #{c2} -sta {c1} -//FRAGMENT _deref_pbuc1=_deref_pbuc1_bor_vbuc2 -lda #{c2} -ora {c1} -sta {c1} +//KICKC FRAGMENT CACHE 11e0585d5e 11e05876ff +//FRAGMENT vbuz1=vbuc1 +lda #{c1} +sta {z1} //FRAGMENT pbuz1=pbuc1 lda #<{c1} sta {z1} lda #>{c1} sta {z1}+1 -//FRAGMENT pbuz1_lt_pbuc1_then_la1 -lda {z1}+1 -cmp #>{c1} -bcc {la1} -bne !+ -lda {z1} -cmp #<{c1} -bcc {la1} -!: -//FRAGMENT _deref_pbuc1=_deref_pbuc2 -lda {c2} +//FRAGMENT _deref_pbuc1=_deref_pbuc1_bor_vbuc2 +lda #{c2} +ora {c1} +sta {c1} +//FRAGMENT _deref_pbuc1=vbuc2 +lda #{c2} sta {c1} -//FRAGMENT vbuz1=_lo_pbuz2 -lda {z2} -sta {z1} -//FRAGMENT _deref_pbuz1=vbuz2 -lda {z2} -ldy #0 -sta ({z1}),y -//FRAGMENT pbuz1=_inc_pbuz1 -inw {z1} -//FRAGMENT _deref_pbuz1=vbuc1 -lda #{c1} -ldy #0 -sta ({z1}),y -//FRAGMENT vbuaa=_lo_pbuz1 -lda {z1} -//FRAGMENT vbuxx=_lo_pbuz1 -ldx {z1} -//FRAGMENT _deref_pbuz1=vbuaa -ldy #0 -sta ({z1}),y -//FRAGMENT _deref_pbuz1=vbuxx -txa -ldy #0 -sta ({z1}),y -//FRAGMENT _deref_pbuz1=vbuyy -tya -ldy #0 -sta ({z1}),y -//FRAGMENT _deref_pbuz1=vbuzz -tza -ldy #0 -sta ({z1}),y -//FRAGMENT vbuyy=_lo_pbuz1 -ldy {z1} -//FRAGMENT vbuzz=_lo_pbuz1 -ldz {z1} -//FRAGMENT vbuz1=vbuc1 -lda #{c1} -sta {z1} //FRAGMENT vbuz1=_inc_vbuz1 inc {z1} //FRAGMENT vbuz1=vbuz2 @@ -88,6 +40,8 @@ dec {z1} ldy #0 lda ({z2}),y sta {z1} +//FRAGMENT pbuz1=_inc_pbuz1 +inw {z1} //FRAGMENT vbuz1_neq_0_then_la1 lda {z1} cmp #0 @@ -180,6 +134,10 @@ bne {la1} lda {z1} cmp #<{c1} bne {la1} +//FRAGMENT _deref_pbuz1=vbuc1 +lda #{c1} +ldy #0 +sta ({z1}),y //FRAGMENT vbuaa=vbuz1 lda {z1} //FRAGMENT vbuxx=vbuz1 @@ -1290,6 +1248,10 @@ sta {z1} lda #0 adc {z2}+1 sta {z1}+1 +//FRAGMENT _deref_pbuz1=vbuz2 +lda {z2} +ldy #0 +sta ({z1}),y //FRAGMENT vbuaa=_deref_pbuc1_plus_1 lda {c1} inc @@ -1325,6 +1287,18 @@ sta ({z1}),y txa ldz {z2} sta ({z1}),z +//FRAGMENT _deref_pbuz1=vbuxx +txa +ldy #0 +sta ({z1}),y +//FRAGMENT _deref_pbuz1=vbuyy +tya +ldy #0 +sta ({z1}),y +//FRAGMENT _deref_pbuz1=vbuzz +tza +ldy #0 +sta ({z1}),y //FRAGMENT pbuz1_derefidx_vbuz2=vbuyy tya ldy {z2} @@ -1536,6 +1510,9 @@ tay tza sty $ff ora $ff +//FRAGMENT _deref_pbuc1=_deref_pbuc2 +lda {c2} +sta {c1} //FRAGMENT vduz1=vduc1 lda #<{c1} sta {z1} diff --git a/src/main/fragment/cache/fragment-cache-mos6502.asm b/src/main/fragment/cache/fragment-cache-mos6502.asm index bf917b621..818b0a7dc 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 12beec37ea 12beec5182 +//KICKC FRAGMENT CACHE 11e0585d5e 11e05876ff //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 eca89487f..0774c0039 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 12beec37ea 12beec5182 +//KICKC FRAGMENT CACHE 11e0585d5e 11e05876ff //FRAGMENT vbuz1=vbuc1 lda #{c1} sta {z1} @@ -6053,155 +6053,6 @@ tay //FRAGMENT vboz1=vboyy tya sta {z1} -//FRAGMENT vbuz1=_byte_pwuc1_derefidx_vbuz2 -ldy {z2} -lda {c1},y -sta {z1} -//FRAGMENT pwuc1_derefidx_vbuz1=pwuc1_derefidx_vbuz1_plus_1 -ldx {z1} -inc {c1},x -bne !+ -inc {c1}+1,x -!: -//FRAGMENT pwuc1_derefidx_vbuz1_lt_vbuc2_then_la1 -ldy {z1} -lda {c1}+1,y -bne !+ -lda {c1},y -cmp #{c2} -bcc {la1} -!: -//FRAGMENT pwuc1_derefidx_vbuz1=vbuc2 -lda {z1} -ldx #{c2} -tay -txa -sta {c1},y -//FRAGMENT pbuz1=pbuz2_plus_pwuc1_derefidx_vbuz3 -ldy {z3} -clc -lda {z2} -adc {c1},y -sta {z1} -lda {z2}+1 -adc {c1}+1,y -sta {z1}+1 -//FRAGMENT vbuz1=_byte_pwuc1_derefidx_vbuaa -tay -lda {c1},y -sta {z1} -//FRAGMENT vbuz1=_byte_pwuc1_derefidx_vbuxx -lda {c1},x -sta {z1} -//FRAGMENT vbuz1=_byte_pwuc1_derefidx_vbuyy -lda {c1},y -sta {z1} -//FRAGMENT vbuaa=_byte_pwuc1_derefidx_vbuz1 -ldy {z1} -lda {c1},y -//FRAGMENT vbuaa=_byte_pwuc1_derefidx_vbuaa -tay -lda {c1},y -//FRAGMENT vbuaa=_byte_pwuc1_derefidx_vbuxx -lda {c1},x -//FRAGMENT vbuaa=_byte_pwuc1_derefidx_vbuyy -lda {c1},y -//FRAGMENT vbuxx=_byte_pwuc1_derefidx_vbuz1 -ldx {z1} -lda {c1},x -tax -//FRAGMENT vbuxx=_byte_pwuc1_derefidx_vbuaa -tax -lda {c1},x -tax -//FRAGMENT vbuxx=_byte_pwuc1_derefidx_vbuxx -lda {c1},x -tax -//FRAGMENT vbuxx=_byte_pwuc1_derefidx_vbuyy -lda {c1},y -tax -//FRAGMENT vbuyy=_byte_pwuc1_derefidx_vbuz1 -ldy {z1} -lda {c1},y -tay -//FRAGMENT vbuyy=_byte_pwuc1_derefidx_vbuaa -tay -lda {c1},y -tay -//FRAGMENT vbuyy=_byte_pwuc1_derefidx_vbuxx -lda {c1},x -tay -//FRAGMENT vbuyy=_byte_pwuc1_derefidx_vbuyy -lda {c1},y -tay -//FRAGMENT pwuc1_derefidx_vbuxx=pwuc1_derefidx_vbuxx_plus_1 -inc {c1},x -bne !+ -inc {c1}+1,x -!: -//FRAGMENT pwuc1_derefidx_vbuxx_lt_vbuc2_then_la1 -lda {c1}+1,x -bne !+ -lda {c1},x -cmp #{c2} -bcc {la1} -!: -//FRAGMENT pwuc1_derefidx_vbuyy_lt_vbuc2_then_la1 -lda {c1}+1,y -bne !+ -lda {c1},y -cmp #{c2} -bcc {la1} -!: -//FRAGMENT pwuc1_derefidx_vbuaa=vbuc2 -ldx #{c2} -tay -txa -sta {c1},y -//FRAGMENT pwuc1_derefidx_vbuxx=vbuc2 -lda #{c2} -sta {c1},x -lda #0 -sta {c1}+1,x -//FRAGMENT pwuc1_derefidx_vbuyy=vbuc2 -lda #{c2} -sta {c1},y -lda #0 -sta {c1}+1,y -//FRAGMENT pbuz1=pbuz2_plus_pwuc1_derefidx_vbuaa -tay -clc -lda {z2} -adc {c1},y -sta {z1} -lda {z2}+1 -adc {c1}+1,y -sta {z1}+1 -//FRAGMENT pbuz1=pbuz2_plus_pwuc1_derefidx_vbuxx -txa -tay -clc -lda {z2} -adc {c1},y -sta {z1} -lda {z2}+1 -adc {c1}+1,y -sta {z1}+1 -//FRAGMENT pbuz1=pbuz2_plus_pwuc1_derefidx_vbuyy -clc -lda {z2} -adc {c1},y -sta {z1} -lda {z2}+1 -adc {c1}+1,y -sta {z1}+1 -//FRAGMENT pwuc1_derefidx_vbuyy=pwuc1_derefidx_vbuyy_plus_1 -tya -tax -inc {c1},x -bne !+ -inc {c1}+1,x -!: //FRAGMENT vbuz1=vbuc1_bor_vbuz2 lda #{c1} ora {z2} @@ -8575,6 +8426,27 @@ sta {z1} lda {z1}+1 eor {z2}+1 sta {z1}+1 +//FRAGMENT vwuz1_lt_vbuc1_then_la1 +lda {z1}+1 +bne !+ +lda {z1} +cmp #{c1} +bcc {la1} +!: +//FRAGMENT vwuz1=_word_vduz2 +lda {z2} +sta {z1} +lda {z2}+1 +sta {z1}+1 +//FRAGMENT vduz1=vwuz2_dword_vwuz3 +lda {z2} +sta {z1}+2 +lda {z2}+1 +sta {z1}+3 +lda {z3} +sta {z1} +lda {z3}+1 +sta {z1}+1 //FRAGMENT _deref_pbuz1_eq_vbuz2_then_la1 lda {z2} ldy #0 @@ -12487,15 +12359,6 @@ sta {z1} lda {z2}+1 adc #>{c1} sta {z1}+1 -//FRAGMENT vduz1=vwuz2_dword_vwuz3 -lda {z2} -sta {z1}+2 -lda {z2}+1 -sta {z1}+3 -lda {z3} -sta {z1} -lda {z3}+1 -sta {z1}+1 //FRAGMENT vduz1_lt_vduc1_then_la1 lda {z1}+3 cmp #>{c1}>>$10 @@ -12663,6 +12526,184 @@ rol {z1}+3 dex bne !- !e: +//FRAGMENT pssz1=pssc1 +lda #<{c1} +sta {z1} +lda #>{c1} +sta {z1}+1 +//FRAGMENT vwuz1=vwuz1_minus_1 +lda {z1} +sec +sbc #1 +sta {z1} +lda {z1}+1 +sbc #0 +sta {z1}+1 +//FRAGMENT vbuz1=vbuz1_minus_1 +dec {z1} +//FRAGMENT pbsz1_derefidx_vbuc1=pbsz1_derefidx_vbuc1_plus_pbsz1_derefidx_vbuc2 +ldy #{c2} +lda ({z1}),y +ldy #{c1} +tax +lda ({z1}),y +sty $ff + +stx $ff +clc +adc $ff +ldy $ff +sta ({z1}),y +//FRAGMENT pbsz1_derefidx_vbuc1_lt_vbsc2_then_la1 +ldy #{c1} +lda ({z1}),y + +sec +sbc #{c2} +bvc !+ +eor #$80 +!: +bmi {la1} +//FRAGMENT pbsz1_derefidx_vbuc1=vbsc2 +lda #{c1} +tay +lda #{c2} +sta ({z1}),y +//FRAGMENT pwsz1_derefidx_vbuc1_gt_vwsc2_then_la1 +ldy #{c1} +lda #<{c2} +cmp ({z1}),y +iny +lda #>{c2} +sbc ({z1}),y +bvc !+ +eor #$80 +!: +bmi {la1} +!e: +//FRAGMENT pwsz1_derefidx_vbuc1_ge_vwsc2_then_la1 +ldy #{c1} +lda ({z1}),y +cmp #<{c2} +iny +lda ({z1}),y +sbc #>{c2} +bvc !+ +eor #$80 +!: +bpl {la1} +//FRAGMENT pwsz1_derefidx_vbuc1=pwsz1_derefidx_vbuc1_plus_pbsz1_derefidx_vbuc2 +ldy #{c2} +lda ({z1}),y +sta $fe +ora #$7f +bmi !+ +lda #0 +!: +sta $ff +ldy #{c1} +clc +lda ({z1}),y +adc $fe +sta ({z1}),y +iny +lda ({z1}),y +adc $fe +sta ({z1}),y +//FRAGMENT pbuc1_derefidx_vbuz1_ge_vbuc2_then_la1 +ldy {z1} +lda {c1},y +cmp #{c2} +bcs {la1} +//FRAGMENT vwsz1=pwsz2_derefidx_vbuc1_ror_vbuc2 +ldx #{c2} +ldy #{c1} +lda ({z2}),y +sta {z1} +iny +lda ({z2}),y +sta {z1}+1 +cpx #0 +beq !e+ +!: +lda {z1}+1 +cmp #$80 +ror {z1}+1 +ror {z1} +dex +bne !- +!e: +//FRAGMENT pbuc1_derefidx_vbuz1=_byte_vwsz2 +ldy {z1} +lda {z2} +sta {c1},y +//FRAGMENT pssz1=pssz1_plus_vbuc1 +lda #{c1} +clc +adc {z1} +sta {z1} +bcc !+ +inc {z1}+1 +!: +//FRAGMENT pwsz1_derefidx_vbuc1=vwsc2 +ldy #{c1} +lda #<{c2} +sta ({z1}),y +iny +lda #>{c2} +sta ({z1}),y +//FRAGMENT pbsz1_derefidx_vbuc1=vbsz2 +lda #{c1} +tay +lda {z2} +sta ({z1}),y +//FRAGMENT pbuc1_derefidx_vbuz1_lt_vbuc2_then_la1 +ldy {z1} +lda {c1},y +cmp #{c2} +bcc {la1} +//FRAGMENT vbuc1_eq_pbuc2_derefidx_vbuz1_then_la1 +ldy {z1} +lda {c2},y +cmp #{c1} +beq {la1} +//FRAGMENT pbsz1_derefidx_vbuc1=vbsxx +lda #{c1} +tay +txa +sta ({z1}),y +//FRAGMENT pbuc1_derefidx_vbuaa_lt_vbuc2_then_la1 +tay +lda {c1},y +cmp #{c2} +bcc {la1} +//FRAGMENT pbuc1_derefidx_vbuxx_lt_vbuc2_then_la1 +lda {c1},x +cmp #{c2} +bcc {la1} +//FRAGMENT pbuc1_derefidx_vbuyy_lt_vbuc2_then_la1 +lda {c1},y +cmp #{c2} +bcc {la1} +//FRAGMENT vbuc1_eq_pbuc2_derefidx_vbuaa_then_la1 +tay +lda {c2},y +cmp #{c1} +beq {la1} +//FRAGMENT vbuc1_eq_pbuc2_derefidx_vbuxx_then_la1 +lda {c2},x +cmp #{c1} +beq {la1} +//FRAGMENT vbuc1_eq_pbuc2_derefidx_vbuyy_then_la1 +lda {c2},y +cmp #{c1} +beq {la1} +//FRAGMENT vbuxx=vbuxx_minus_1 +dex +//FRAGMENT vbuyy=vbuyy_minus_1 +tya +tay +dey //FRAGMENT vwsz1_neq_vwsc1_then_la1 lda {z1}+1 cmp #>{c1} @@ -12670,312 +12711,6 @@ bne {la1} lda {z1} cmp #<{c1} bne {la1} -//FRAGMENT pwuc1_derefidx_vbuz1=vbuz2 -lda {z1} -ldx {z2} -tay -txa -sta {c1},y -//FRAGMENT vbuz1=_deref_pbuc1_band_vbuc2 -lda #{c2} -and {c1} -sta {z1} -//FRAGMENT _deref_pbuc1_lt_vbuz1_then_la1 -lda {c1} -cmp {z1} -bcc {la1} -//FRAGMENT vbuz1_ge_pbuc1_derefidx_(pbuc2_derefidx_vbuz2)_then_la1 -lda {z1} -ldx {z2} -ldy {c2},x -cmp {c1},y -bcs {la1} -//FRAGMENT vbuz1_lt_pbuc1_derefidx_(pbuc2_derefidx_vbuz2)_then_la1 -lda {z1} -ldx {z2} -ldy {c2},x -cmp {c1},y -bcc {la1} -//FRAGMENT vbuz1=pbuc1_derefidx_(pbuc2_derefidx_vbuz2) -ldx {z2} -ldy {c2},x -ldx {c1},y -stx {z1} -//FRAGMENT pbuc1_derefidx_vbuz1=pbuc2_derefidx_(pbuc3_derefidx_vbuz2) -ldx {z2} -ldy {c3},x -lda {c2},y -ldx {z1} -sta {c1},x -//FRAGMENT vbuz1=_lo_pwuc1_derefidx_vbuz2 -ldy {z2} -lda {c1},y -sta {z1} -//FRAGMENT vbuz1=_hi_pwuc1_derefidx_vbuz2 -ldy {z2} -lda {c1}+1,y -sta {z1} -//FRAGMENT pwuc1_derefidx_vbuz1=vbuxx -lda {z1} -tay -txa -sta {c1},y -//FRAGMENT pwuc1_derefidx_vbuz1=vbuyy -tya -ldy {z1} -sta {c1},y -lda #0 -sta {c1}+1,y -//FRAGMENT pwuc1_derefidx_vbuaa=vbuz1 -ldx {z1} -tay -txa -sta {c1},y -//FRAGMENT pwuc1_derefidx_vbuaa=vbuxx -tay -txa -sta {c1},y -//FRAGMENT pwuc1_derefidx_vbuaa=vbuyy -sty $ff -ldx $ff -tay -txa -sta {c1},y -//FRAGMENT pwuc1_derefidx_vbuxx=vbuz1 -lda {z1} -sta {c1},x -lda #0 -sta {c1}+1,x -//FRAGMENT pwuc1_derefidx_vbuxx=vbuxx -txa -sta {c1},x -lda #0 -sta {c1}+1,x -//FRAGMENT pwuc1_derefidx_vbuxx=vbuyy -tya -sta {c1},x -lda #0 -sta {c1}+1,x -//FRAGMENT pwuc1_derefidx_vbuyy=vbuz1 -lda {z1} -sta {c1},y -lda #0 -sta {c1}+1,y -//FRAGMENT pwuc1_derefidx_vbuyy=vbuxx -tya -tay -txa -sta {c1},y -//FRAGMENT pwuc1_derefidx_vbuyy=vbuyy -tya -sta {c1},y -lda #0 -sta {c1}+1,y -//FRAGMENT vbuaa=_deref_pbuc1_band_vbuc2 -lda #{c2} -and {c1} -//FRAGMENT vbuxx=_deref_pbuc1_band_vbuc2 -lda #{c2} -and {c1} -tax -//FRAGMENT vbuyy=_deref_pbuc1_band_vbuc2 -lda #{c2} -and {c1} -tay -//FRAGMENT _deref_pbuc1_lt_vbuaa_then_la1 -ldy {c1} -sta $ff -cpy $ff -bcc {la1} -//FRAGMENT vbuz1_ge_pbuc1_derefidx_(pbuc2_derefidx_vbuaa)_then_la1 -tax -lda {z1} -ldy {c2},x -cmp {c1},y -bcs {la1} -//FRAGMENT vbuz1_ge_pbuc1_derefidx_(pbuc2_derefidx_vbuxx)_then_la1 -lda {z1} -ldy {c2},x -cmp {c1},y -bcs {la1} -//FRAGMENT vbuz1_ge_pbuc1_derefidx_(pbuc2_derefidx_vbuyy)_then_la1 -lda {z1} -ldx {c2},y -cmp {c1},x -bcs {la1} -//FRAGMENT vbuaa_ge_pbuc1_derefidx_(pbuc2_derefidx_vbuz1)_then_la1 -ldx {z1} -ldy {c2},x -cmp {c1},y -bcs {la1} -//FRAGMENT vbuz1_lt_pbuc1_derefidx_(pbuc2_derefidx_vbuxx)_then_la1 -lda {z1} -ldy {c2},x -cmp {c1},y -bcc {la1} -//FRAGMENT vbuz1_lt_pbuc1_derefidx_(pbuc2_derefidx_vbuyy)_then_la1 -lda {z1} -ldx {c2},y -cmp {c1},x -bcc {la1} -//FRAGMENT vbuxx_lt_pbuc1_derefidx_(pbuc2_derefidx_vbuz1)_then_la1 -ldy {z1} -txa -ldx {c2},y -cmp {c1},x -bcc {la1} -//FRAGMENT vbuxx_lt_pbuc1_derefidx_(pbuc2_derefidx_vbuxx)_then_la1 -txa -ldy {c2},x -cmp {c1},y -bcc {la1} -//FRAGMENT vbuxx_lt_pbuc1_derefidx_(pbuc2_derefidx_vbuyy)_then_la1 -txa -ldx {c2},y -cmp {c1},x -bcc {la1} -//FRAGMENT vbuyy_lt_pbuc1_derefidx_(pbuc2_derefidx_vbuz1)_then_la1 -ldx {z1} -tya -ldy {c2},x -cmp {c1},y -bcc {la1} -//FRAGMENT vbuyy_lt_pbuc1_derefidx_(pbuc2_derefidx_vbuxx)_then_la1 -tya -ldy {c2},x -cmp {c1},y -bcc {la1} -//FRAGMENT vbuyy_lt_pbuc1_derefidx_(pbuc2_derefidx_vbuyy)_then_la1 -tya -ldx {c2},y -cmp {c1},x -bcc {la1} -//FRAGMENT vbuaa=pbuc1_derefidx_(pbuc2_derefidx_vbuz1) -ldx {z1} -ldy {c2},x -lda {c1},y -//FRAGMENT vbuxx=pbuc1_derefidx_(pbuc2_derefidx_vbuz1) -ldx {z1} -ldy {c2},x -ldx {c1},y -//FRAGMENT vbuyy=pbuc1_derefidx_(pbuc2_derefidx_vbuz1) -ldy {z1} -ldx {c2},y -ldy {c1},x -//FRAGMENT vbuaa=_lo_pwuc1_derefidx_vbuz1 -ldy {z1} -lda {c1},y -//FRAGMENT vbuxx=_lo_pwuc1_derefidx_vbuz1 -ldx {z1} -lda {c1},x -tax -//FRAGMENT vbuyy=_lo_pwuc1_derefidx_vbuz1 -ldy {z1} -lda {c1},y -tay -//FRAGMENT vbuz1=_lo_pwuc1_derefidx_vbuaa -tay -lda {c1},y -sta {z1} -//FRAGMENT vbuaa=_lo_pwuc1_derefidx_vbuaa -tay -lda {c1},y -//FRAGMENT vbuxx=_lo_pwuc1_derefidx_vbuaa -tax -lda {c1},x -tax -//FRAGMENT vbuyy=_lo_pwuc1_derefidx_vbuaa -tay -lda {c1},y -tay -//FRAGMENT vbuz1=_lo_pwuc1_derefidx_vbuxx -lda {c1},x -sta {z1} -//FRAGMENT vbuaa=_lo_pwuc1_derefidx_vbuxx -lda {c1},x -//FRAGMENT vbuxx=_lo_pwuc1_derefidx_vbuxx -lda {c1},x -tax -//FRAGMENT vbuyy=_lo_pwuc1_derefidx_vbuxx -lda {c1},x -tay -//FRAGMENT vbuz1=_lo_pwuc1_derefidx_vbuyy -lda {c1},y -sta {z1} -//FRAGMENT vbuaa=_lo_pwuc1_derefidx_vbuyy -lda {c1},y -//FRAGMENT vbuxx=_lo_pwuc1_derefidx_vbuyy -lda {c1},y -tax -//FRAGMENT vbuyy=_lo_pwuc1_derefidx_vbuyy -lda {c1},y -tay -//FRAGMENT vbuz1=_hi_pwuc1_derefidx_vbuxx -lda {c1}+1,x -sta {z1} -//FRAGMENT vbuaa=_hi_pwuc1_derefidx_vbuz1 -ldy {z1} -lda {c1}+1,y -//FRAGMENT vbuaa=_hi_pwuc1_derefidx_vbuxx -lda {c1}+1,x -//FRAGMENT vbuxx=_hi_pwuc1_derefidx_vbuz1 -ldx {z1} -lda {c1}+1,x -tax -//FRAGMENT vbuxx=_hi_pwuc1_derefidx_vbuxx -lda {c1}+1,x -tax -//FRAGMENT vbuyy=_hi_pwuc1_derefidx_vbuz1 -ldy {z1} -lda {c1}+1,y -tay -//FRAGMENT vbuyy=_hi_pwuc1_derefidx_vbuxx -lda {c1}+1,x -tay -//FRAGMENT vbuxx_ge_pbuc1_derefidx_(pbuc2_derefidx_vbuz1)_then_la1 -ldy {z1} -txa -ldx {c2},y -cmp {c1},x -bcs {la1} -//FRAGMENT vbuxx_ge_pbuc1_derefidx_(pbuc2_derefidx_vbuxx)_then_la1 -txa -ldy {c2},x -cmp {c1},y -bcs {la1} -//FRAGMENT vbuxx_ge_pbuc1_derefidx_(pbuc2_derefidx_vbuyy)_then_la1 -txa -ldx {c2},y -cmp {c1},x -bcs {la1} -//FRAGMENT vbuyy_ge_pbuc1_derefidx_(pbuc2_derefidx_vbuz1)_then_la1 -ldx {z1} -tya -ldy {c2},x -cmp {c1},y -bcs {la1} -//FRAGMENT vbuyy_ge_pbuc1_derefidx_(pbuc2_derefidx_vbuxx)_then_la1 -tya -ldy {c2},x -cmp {c1},y -bcs {la1} -//FRAGMENT vbuyy_ge_pbuc1_derefidx_(pbuc2_derefidx_vbuyy)_then_la1 -tya -ldx {c2},y -cmp {c1},x -bcs {la1} -//FRAGMENT _deref_pbuc1_lt_vbuxx_then_la1 -lda {c1} -stx $ff -cmp $ff -bcc {la1} -//FRAGMENT _deref_pbuc1_lt_vbuyy_then_la1 -ldx {c1} -sty $ff -cpx $ff -bcc {la1} -//FRAGMENT vbsxx=pbsc1_derefidx_vbuyy -ldx {c1},y //FRAGMENT pbuc1_derefidx_vbuz1=pbuz2_derefidx_vbuc2 ldx {z1} ldy #{c2} @@ -12991,19 +12726,6 @@ ldy #{c2} tax lda ({z1}),y sta {c1},x -//FRAGMENT pssz1=pssc1 -lda #<{c1} -sta {z1} -lda #>{c1} -sta {z1}+1 -//FRAGMENT pssz1=pssz1_plus_vbuc1 -lda #{c1} -clc -adc {z1} -sta {z1} -bcc !+ -inc {z1}+1 -!: //FRAGMENT pbuc1_derefidx_vbuaa=pbuz1_derefidx_vbuc2 ldy #{c2} tax @@ -13378,6 +13100,23 @@ cmp {z2} beq {la1} !: bcc {la1} +//FRAGMENT vduz1=vwuz2_dword_vwuc1 +lda #<{c1} +sta {z1} +lda #>{c1} +sta {z1}+1 +lda {z2} +sta {z1}+2 +lda {z2}+1 +sta {z1}+3 +//FRAGMENT vwuz1=vwuz1_minus_vbuc1 +sec +lda {z1} +sbc #{c1} +sta {z1} +lda {z1}+1 +sbc #0 +sta {z1}+1 //FRAGMENT vbuz1=vbuz2_plus_pbuc1_derefidx_vbuz3 lda {z2} ldy {z3} @@ -14290,6 +14029,248 @@ sta {c1},x ldx {c3},y lda {c2},x sta {c1},y +//FRAGMENT vbuz1=_deref_pbuc1_band_vbuc2 +lda #{c2} +and {c1} +sta {z1} +//FRAGMENT _deref_pbuc1_lt_vbuz1_then_la1 +lda {c1} +cmp {z1} +bcc {la1} +//FRAGMENT vbuz1_ge_pbuc1_derefidx_(pbuc2_derefidx_vbuz2)_then_la1 +lda {z1} +ldx {z2} +ldy {c2},x +cmp {c1},y +bcs {la1} +//FRAGMENT vbuz1_lt_pbuc1_derefidx_(pbuc2_derefidx_vbuz2)_then_la1 +lda {z1} +ldx {z2} +ldy {c2},x +cmp {c1},y +bcc {la1} +//FRAGMENT vbuz1=pbuc1_derefidx_(pbuc2_derefidx_vbuz2) +ldx {z2} +ldy {c2},x +ldx {c1},y +stx {z1} +//FRAGMENT pbuc1_derefidx_vbuz1=pbuc2_derefidx_(pbuc3_derefidx_vbuz2) +ldx {z2} +ldy {c3},x +lda {c2},y +ldx {z1} +sta {c1},x +//FRAGMENT vbuz1=_lo_pwuc1_derefidx_vbuz2 +ldy {z2} +lda {c1},y +sta {z1} +//FRAGMENT vbuz1=_hi_pwuc1_derefidx_vbuz2 +ldy {z2} +lda {c1}+1,y +sta {z1} +//FRAGMENT vbuaa=_deref_pbuc1_band_vbuc2 +lda #{c2} +and {c1} +//FRAGMENT vbuxx=_deref_pbuc1_band_vbuc2 +lda #{c2} +and {c1} +tax +//FRAGMENT vbuyy=_deref_pbuc1_band_vbuc2 +lda #{c2} +and {c1} +tay +//FRAGMENT _deref_pbuc1_lt_vbuaa_then_la1 +ldy {c1} +sta $ff +cpy $ff +bcc {la1} +//FRAGMENT vbuz1_ge_pbuc1_derefidx_(pbuc2_derefidx_vbuaa)_then_la1 +tax +lda {z1} +ldy {c2},x +cmp {c1},y +bcs {la1} +//FRAGMENT vbuz1_ge_pbuc1_derefidx_(pbuc2_derefidx_vbuxx)_then_la1 +lda {z1} +ldy {c2},x +cmp {c1},y +bcs {la1} +//FRAGMENT vbuz1_ge_pbuc1_derefidx_(pbuc2_derefidx_vbuyy)_then_la1 +lda {z1} +ldx {c2},y +cmp {c1},x +bcs {la1} +//FRAGMENT vbuaa_ge_pbuc1_derefidx_(pbuc2_derefidx_vbuz1)_then_la1 +ldx {z1} +ldy {c2},x +cmp {c1},y +bcs {la1} +//FRAGMENT vbuz1_lt_pbuc1_derefidx_(pbuc2_derefidx_vbuxx)_then_la1 +lda {z1} +ldy {c2},x +cmp {c1},y +bcc {la1} +//FRAGMENT vbuz1_lt_pbuc1_derefidx_(pbuc2_derefidx_vbuyy)_then_la1 +lda {z1} +ldx {c2},y +cmp {c1},x +bcc {la1} +//FRAGMENT vbuxx_lt_pbuc1_derefidx_(pbuc2_derefidx_vbuz1)_then_la1 +ldy {z1} +txa +ldx {c2},y +cmp {c1},x +bcc {la1} +//FRAGMENT vbuxx_lt_pbuc1_derefidx_(pbuc2_derefidx_vbuxx)_then_la1 +txa +ldy {c2},x +cmp {c1},y +bcc {la1} +//FRAGMENT vbuxx_lt_pbuc1_derefidx_(pbuc2_derefidx_vbuyy)_then_la1 +txa +ldx {c2},y +cmp {c1},x +bcc {la1} +//FRAGMENT vbuyy_lt_pbuc1_derefidx_(pbuc2_derefidx_vbuz1)_then_la1 +ldx {z1} +tya +ldy {c2},x +cmp {c1},y +bcc {la1} +//FRAGMENT vbuyy_lt_pbuc1_derefidx_(pbuc2_derefidx_vbuxx)_then_la1 +tya +ldy {c2},x +cmp {c1},y +bcc {la1} +//FRAGMENT vbuyy_lt_pbuc1_derefidx_(pbuc2_derefidx_vbuyy)_then_la1 +tya +ldx {c2},y +cmp {c1},x +bcc {la1} +//FRAGMENT vbuaa=pbuc1_derefidx_(pbuc2_derefidx_vbuz1) +ldx {z1} +ldy {c2},x +lda {c1},y +//FRAGMENT vbuxx=pbuc1_derefidx_(pbuc2_derefidx_vbuz1) +ldx {z1} +ldy {c2},x +ldx {c1},y +//FRAGMENT vbuyy=pbuc1_derefidx_(pbuc2_derefidx_vbuz1) +ldy {z1} +ldx {c2},y +ldy {c1},x +//FRAGMENT vbuaa=_lo_pwuc1_derefidx_vbuz1 +ldy {z1} +lda {c1},y +//FRAGMENT vbuxx=_lo_pwuc1_derefidx_vbuz1 +ldx {z1} +lda {c1},x +tax +//FRAGMENT vbuyy=_lo_pwuc1_derefidx_vbuz1 +ldy {z1} +lda {c1},y +tay +//FRAGMENT vbuz1=_lo_pwuc1_derefidx_vbuaa +tay +lda {c1},y +sta {z1} +//FRAGMENT vbuaa=_lo_pwuc1_derefidx_vbuaa +tay +lda {c1},y +//FRAGMENT vbuxx=_lo_pwuc1_derefidx_vbuaa +tax +lda {c1},x +tax +//FRAGMENT vbuyy=_lo_pwuc1_derefidx_vbuaa +tay +lda {c1},y +tay +//FRAGMENT vbuz1=_lo_pwuc1_derefidx_vbuxx +lda {c1},x +sta {z1} +//FRAGMENT vbuaa=_lo_pwuc1_derefidx_vbuxx +lda {c1},x +//FRAGMENT vbuxx=_lo_pwuc1_derefidx_vbuxx +lda {c1},x +tax +//FRAGMENT vbuyy=_lo_pwuc1_derefidx_vbuxx +lda {c1},x +tay +//FRAGMENT vbuz1=_lo_pwuc1_derefidx_vbuyy +lda {c1},y +sta {z1} +//FRAGMENT vbuaa=_lo_pwuc1_derefidx_vbuyy +lda {c1},y +//FRAGMENT vbuxx=_lo_pwuc1_derefidx_vbuyy +lda {c1},y +tax +//FRAGMENT vbuyy=_lo_pwuc1_derefidx_vbuyy +lda {c1},y +tay +//FRAGMENT vbuz1=_hi_pwuc1_derefidx_vbuxx +lda {c1}+1,x +sta {z1} +//FRAGMENT vbuaa=_hi_pwuc1_derefidx_vbuz1 +ldy {z1} +lda {c1}+1,y +//FRAGMENT vbuaa=_hi_pwuc1_derefidx_vbuxx +lda {c1}+1,x +//FRAGMENT vbuxx=_hi_pwuc1_derefidx_vbuz1 +ldx {z1} +lda {c1}+1,x +tax +//FRAGMENT vbuxx=_hi_pwuc1_derefidx_vbuxx +lda {c1}+1,x +tax +//FRAGMENT vbuyy=_hi_pwuc1_derefidx_vbuz1 +ldy {z1} +lda {c1}+1,y +tay +//FRAGMENT vbuyy=_hi_pwuc1_derefidx_vbuxx +lda {c1}+1,x +tay +//FRAGMENT vbuxx_ge_pbuc1_derefidx_(pbuc2_derefidx_vbuz1)_then_la1 +ldy {z1} +txa +ldx {c2},y +cmp {c1},x +bcs {la1} +//FRAGMENT vbuxx_ge_pbuc1_derefidx_(pbuc2_derefidx_vbuxx)_then_la1 +txa +ldy {c2},x +cmp {c1},y +bcs {la1} +//FRAGMENT vbuxx_ge_pbuc1_derefidx_(pbuc2_derefidx_vbuyy)_then_la1 +txa +ldx {c2},y +cmp {c1},x +bcs {la1} +//FRAGMENT vbuyy_ge_pbuc1_derefidx_(pbuc2_derefidx_vbuz1)_then_la1 +ldx {z1} +tya +ldy {c2},x +cmp {c1},y +bcs {la1} +//FRAGMENT vbuyy_ge_pbuc1_derefidx_(pbuc2_derefidx_vbuxx)_then_la1 +tya +ldy {c2},x +cmp {c1},y +bcs {la1} +//FRAGMENT vbuyy_ge_pbuc1_derefidx_(pbuc2_derefidx_vbuyy)_then_la1 +tya +ldx {c2},y +cmp {c1},x +bcs {la1} +//FRAGMENT _deref_pbuc1_lt_vbuxx_then_la1 +lda {c1} +stx $ff +cmp $ff +bcc {la1} +//FRAGMENT _deref_pbuc1_lt_vbuyy_then_la1 +ldx {c1} +sty $ff +cpx $ff +bcc {la1} //FRAGMENT pwsz1_lt_pwsc1_then_la1 lda {z1}+1 cmp #>{c1} @@ -17724,8 +17705,6 @@ lda ({z1}),y cmp #0 beq {la1} -//FRAGMENT vbuxx=vbuxx_minus_1 -dex //FRAGMENT pduc1_derefidx_vbuaa=pduc1_derefidx_vbuaa_plus_pduc2_derefidx_vbuaa tay clc @@ -18057,12 +18036,6 @@ tya clc adc {c1} tay -//FRAGMENT vbuz1=vbuz1_minus_1 -dec {z1} -//FRAGMENT vbuyy=vbuyy_minus_1 -tya -tay -dey //FRAGMENT vwsz1=pwsc1_derefidx_vbuz2_plus__deref_pwsz3 ldx {z2} clc @@ -18146,6 +18119,58 @@ asl {z1} rol {z1}+1 asl {z1} rol {z1}+1 +//FRAGMENT vbuz1=_byte_pwuc1_derefidx_vbuz2 +ldy {z2} +lda {c1},y +sta {z1} +//FRAGMENT vbuaa=_byte_pwuc1_derefidx_vbuz1 +ldy {z1} +lda {c1},y +//FRAGMENT vbuxx=_byte_pwuc1_derefidx_vbuz1 +ldx {z1} +lda {c1},x +tax +//FRAGMENT vbuyy=_byte_pwuc1_derefidx_vbuz1 +ldy {z1} +lda {c1},y +tay +//FRAGMENT vbuz1=_byte_pwuc1_derefidx_vbuaa +tay +lda {c1},y +sta {z1} +//FRAGMENT vbuaa=_byte_pwuc1_derefidx_vbuaa +tay +lda {c1},y +//FRAGMENT vbuxx=_byte_pwuc1_derefidx_vbuaa +tax +lda {c1},x +tax +//FRAGMENT vbuyy=_byte_pwuc1_derefidx_vbuaa +tay +lda {c1},y +tay +//FRAGMENT vbuz1=_byte_pwuc1_derefidx_vbuxx +lda {c1},x +sta {z1} +//FRAGMENT vbuaa=_byte_pwuc1_derefidx_vbuxx +lda {c1},x +//FRAGMENT vbuxx=_byte_pwuc1_derefidx_vbuxx +lda {c1},x +tax +//FRAGMENT vbuyy=_byte_pwuc1_derefidx_vbuxx +lda {c1},x +tay +//FRAGMENT vbuz1=_byte_pwuc1_derefidx_vbuyy +lda {c1},y +sta {z1} +//FRAGMENT vbuaa=_byte_pwuc1_derefidx_vbuyy +lda {c1},y +//FRAGMENT vbuxx=_byte_pwuc1_derefidx_vbuyy +lda {c1},y +tax +//FRAGMENT vbuyy=_byte_pwuc1_derefidx_vbuyy +lda {c1},y +tay //FRAGMENT pprz1=_deref_qprc1 lda {c1} sta {z1} @@ -18226,192 +18251,172 @@ sta {c1},x lda #{c2} ora {c1},y sta {c1},y -//FRAGMENT vwuz1_lt_vbuc1_then_la1 -lda {z1}+1 +//FRAGMENT pwuc1_derefidx_vbuz1=pwuc1_derefidx_vbuz1_plus_1 +ldx {z1} +inc {c1},x bne !+ -lda {z1} -cmp #{c1} +inc {c1}+1,x +!: +//FRAGMENT pwuc1_derefidx_vbuz1_lt_vbuc2_then_la1 +ldy {z1} +lda {c1}+1,y +bne !+ +lda {c1},y +cmp #{c2} bcc {la1} !: -//FRAGMENT vwuz1=_word_vduz2 +//FRAGMENT pwuc1_derefidx_vbuz1=vbuc2 +lda #{c2} +ldy {z1} +sta {c1},y +lda #0 +sta {c1}+1,y +//FRAGMENT pbuz1=pbuz2_plus_pwuc1_derefidx_vbuz3 +ldy {z3} +clc lda {z2} +adc {c1},y sta {z1} lda {z2}+1 +adc {c1}+1,y sta {z1}+1 -//FRAGMENT vwuz1=vwuz1_minus_1 -lda {z1} -sec -sbc #1 -sta {z1} -lda {z1}+1 -sbc #0 -sta {z1}+1 -//FRAGMENT pbsz1_derefidx_vbuc1=pbsz1_derefidx_vbuc1_plus_pbsz1_derefidx_vbuc2 -ldy #{c2} -lda ({z1}),y -ldy #{c1} -tax -lda ({z1}),y -sty $ff - -stx $ff -clc -adc $ff -ldy $ff -sta ({z1}),y -//FRAGMENT pbsz1_derefidx_vbuc1_lt_vbsc2_then_la1 -ldy #{c1} -lda ({z1}),y - -sec -sbc #{c2} -bvc !+ -eor #$80 +//FRAGMENT pwuc1_derefidx_vbuxx=pwuc1_derefidx_vbuxx_plus_1 +inc {c1},x +bne !+ +inc {c1}+1,x !: -bmi {la1} -//FRAGMENT pbsz1_derefidx_vbuc1=vbsc2 -lda #{c1} -tay -lda #{c2} -sta ({z1}),y -//FRAGMENT pwsz1_derefidx_vbuc1_gt_vwsc2_then_la1 -ldy #{c1} -lda #<{c2} -cmp ({z1}),y -iny -lda #>{c2} -sbc ({z1}),y -bvc !+ -eor #$80 -!: -bmi {la1} -!e: -//FRAGMENT pwsz1_derefidx_vbuc1_ge_vwsc2_then_la1 -ldy #{c1} -lda ({z1}),y -cmp #<{c2} -iny -lda ({z1}),y -sbc #>{c2} -bvc !+ -eor #$80 -!: -bpl {la1} -//FRAGMENT pwsz1_derefidx_vbuc1=pwsz1_derefidx_vbuc1_plus_pbsz1_derefidx_vbuc2 -ldy #{c2} -lda ({z1}),y -sta $fe -ora #$7f -bmi !+ -lda #0 -!: -sta $ff -ldy #{c1} -clc -lda ({z1}),y -adc $fe -sta ({z1}),y -iny -lda ({z1}),y -adc $fe -sta ({z1}),y -//FRAGMENT pbuc1_derefidx_vbuz1_ge_vbuc2_then_la1 -ldy {z1} -lda {c1},y -cmp #{c2} -bcs {la1} -//FRAGMENT vwsz1=pwsz2_derefidx_vbuc1_ror_vbuc2 -ldx #{c2} -ldy #{c1} -lda ({z2}),y -sta {z1} -iny -lda ({z2}),y -sta {z1}+1 -cpx #0 -beq !e+ -!: -lda {z1}+1 -cmp #$80 -ror {z1}+1 -ror {z1} -dex -bne !- -!e: -//FRAGMENT pbuc1_derefidx_vbuz1=_byte_vwsz2 -ldy {z1} -lda {z2} -sta {c1},y -//FRAGMENT pwsz1_derefidx_vbuc1=vwsc2 -ldy #{c1} -lda #<{c2} -sta ({z1}),y -iny -lda #>{c2} -sta ({z1}),y -//FRAGMENT pbsz1_derefidx_vbuc1=vbsz2 -lda #{c1} -tay -lda {z2} -sta ({z1}),y -//FRAGMENT pbuc1_derefidx_vbuz1_lt_vbuc2_then_la1 -ldy {z1} -lda {c1},y -cmp #{c2} -bcc {la1} -//FRAGMENT vbuc1_eq_pbuc2_derefidx_vbuz1_then_la1 -ldy {z1} -lda {c2},y -cmp #{c1} -beq {la1} -//FRAGMENT pbsz1_derefidx_vbuc1=vbsxx -lda #{c1} -tay -txa -sta ({z1}),y -//FRAGMENT pbuc1_derefidx_vbuaa_lt_vbuc2_then_la1 -tay -lda {c1},y -cmp #{c2} -bcc {la1} -//FRAGMENT pbuc1_derefidx_vbuxx_lt_vbuc2_then_la1 +//FRAGMENT pwuc1_derefidx_vbuxx_lt_vbuc2_then_la1 +lda {c1}+1,x +bne !+ lda {c1},x cmp #{c2} bcc {la1} -//FRAGMENT pbuc1_derefidx_vbuyy_lt_vbuc2_then_la1 +!: +//FRAGMENT pwuc1_derefidx_vbuyy_lt_vbuc2_then_la1 +lda {c1}+1,y +bne !+ lda {c1},y cmp #{c2} bcc {la1} -//FRAGMENT vbuc1_eq_pbuc2_derefidx_vbuaa_then_la1 +!: +//FRAGMENT pwuc1_derefidx_vbuaa=vbuc2 tay -lda {c2},y -cmp #{c1} -beq {la1} -//FRAGMENT vbuc1_eq_pbuc2_derefidx_vbuxx_then_la1 -lda {c2},x -cmp #{c1} -beq {la1} -//FRAGMENT vbuc1_eq_pbuc2_derefidx_vbuyy_then_la1 -lda {c2},y -cmp #{c1} -beq {la1} -//FRAGMENT vduz1=vwuz2_dword_vwuc1 -lda #<{c1} -sta {z1} -lda #>{c1} -sta {z1}+1 +lda #{c2} +sta {c1},y +lda #0 +sta {c1}+1,y +//FRAGMENT pwuc1_derefidx_vbuxx=vbuc2 +lda #{c2} +sta {c1},x +lda #0 +sta {c1}+1,x +//FRAGMENT pwuc1_derefidx_vbuyy=vbuc2 +lda #{c2} +sta {c1},y +lda #0 +sta {c1}+1,y +//FRAGMENT pbuz1=pbuz2_plus_pwuc1_derefidx_vbuaa +tay +clc lda {z2} -sta {z1}+2 -lda {z2}+1 -sta {z1}+3 -//FRAGMENT vwuz1=vwuz1_minus_vbuc1 -sec -lda {z1} -sbc #{c1} +adc {c1},y sta {z1} -lda {z1}+1 -sbc #0 +lda {z2}+1 +adc {c1}+1,y sta {z1}+1 +//FRAGMENT pbuz1=pbuz2_plus_pwuc1_derefidx_vbuxx +txa +tay +clc +lda {z2} +adc {c1},y +sta {z1} +lda {z2}+1 +adc {c1}+1,y +sta {z1}+1 +//FRAGMENT pbuz1=pbuz2_plus_pwuc1_derefidx_vbuyy +clc +lda {z2} +adc {c1},y +sta {z1} +lda {z2}+1 +adc {c1}+1,y +sta {z1}+1 +//FRAGMENT pwuc1_derefidx_vbuyy=pwuc1_derefidx_vbuyy_plus_1 +tya +tax +inc {c1},x +bne !+ +inc {c1}+1,x +!: +//FRAGMENT pwuc1_derefidx_vbuz1=vbuz2 +lda {z2} +ldy {z1} +sta {c1},y +lda #0 +sta {c1}+1,y +//FRAGMENT pwuc1_derefidx_vbuz1=vbuxx +ldy {z1} +txa +sta {c1},y +lda #0 +sta {c1}+1,y +//FRAGMENT pwuc1_derefidx_vbuz1=vbuyy +tya +ldy {z1} +sta {c1},y +lda #0 +sta {c1}+1,y +//FRAGMENT pwuc1_derefidx_vbuaa=vbuz1 +tay +lda {z1} +sta {c1},y +lda #0 +sta {c1}+1,y +//FRAGMENT pwuc1_derefidx_vbuaa=vbuxx +tay +txa +sta {c1},y +lda #0 +sta {c1}+1,y +//FRAGMENT pwuc1_derefidx_vbuaa=vbuyy +tax +tya +sta {c1},x +lda #0 +sta {c1}+1,x +//FRAGMENT pwuc1_derefidx_vbuxx=vbuz1 +lda {z1} +sta {c1},x +lda #0 +sta {c1}+1,x +//FRAGMENT pwuc1_derefidx_vbuxx=vbuxx +txa +sta {c1},x +lda #0 +sta {c1}+1,x +//FRAGMENT pwuc1_derefidx_vbuxx=vbuyy +tya +sta {c1},x +lda #0 +sta {c1}+1,x +//FRAGMENT pwuc1_derefidx_vbuyy=vbuz1 +lda {z1} +sta {c1},y +lda #0 +sta {c1}+1,y +//FRAGMENT pwuc1_derefidx_vbuyy=vbuxx +txa +sta {c1},y +lda #0 +sta {c1}+1,y +//FRAGMENT pwuc1_derefidx_vbuyy=vbuyy +tya +sta {c1},y +lda #0 +sta {c1}+1,y +//FRAGMENT vbsxx=pbsc1_derefidx_vbuyy +ldx {c1},y //FRAGMENT vbuz1=pbuc1_derefidx_vbuz2_plus_vbuc2 lda #{c2} ldy {z2} diff --git a/src/main/fragment/cache/fragment-cache-wdc65c02.asm b/src/main/fragment/cache/fragment-cache-wdc65c02.asm index c30c8f540..39f3e968e 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 12beec37ea 12beec5182 +//KICKC FRAGMENT CACHE 11e0585d5e 11e05876ff //FRAGMENT vbuz1=_deref_pbuc1 lda {c1} sta {z1} diff --git a/src/main/fragment/mos6502-common/pwuc1_derefidx_vbuaa=vbuxx.asm b/src/main/fragment/mos6502-common/pwuc1_derefidx_vbuaa=vbuxx.asm deleted file mode 100644 index 9c6320deb..000000000 --- a/src/main/fragment/mos6502-common/pwuc1_derefidx_vbuaa=vbuxx.asm +++ /dev/null @@ -1,3 +0,0 @@ -tay -txa -sta {c1},y \ No newline at end of file diff --git a/src/main/fragment/mos6502-common/pwuc1_derefidx_vbuyy=vbuaa .asm b/src/main/fragment/mos6502-common/pwuc1_derefidx_vbuyy=vbuaa .asm new file mode 100644 index 000000000..355a5914f --- /dev/null +++ b/src/main/fragment/mos6502-common/pwuc1_derefidx_vbuyy=vbuaa .asm @@ -0,0 +1,3 @@ +sta {c1},y +lda #0 +sta {c1}+1,y diff --git a/src/test/ref/complex/nes-balls/kickballs-2.asm b/src/test/ref/complex/nes-balls/kickballs-2.asm index 3d80bdc52..6386e9c3a 100644 --- a/src/test/ref/complex/nes-balls/kickballs-2.asm +++ b/src/test/ref/complex/nes-balls/kickballs-2.asm @@ -76,10 +76,10 @@ .label PPU = $2000 // NES CPU and audion processing unit (APU) .label APU = $4000 - .label scroll_y = $a - .label vblank_hit = $b + .label scroll_y = 9 + .label vblank_hit = $a // The random state variable - .label rand_state = 8 + .label rand_state = 7 .segment Code __start: { // scroll_y = 0 @@ -121,24 +121,24 @@ vblank: { rti } main: { - .label __9 = $1a - .label __10 = $1a - .label __11 = $1a - .label __20 = $d - .label __23 = $f - .label __25 = $11 - .label __26 = $13 - .label __31 = $14 - .label __32 = $16 - .label __33 = $18 - .label __56 = $14 - .label i = 2 - .label timer_2 = 3 - .label h_bar = $c - .label active_balls = 4 - .label sprite_idx = 7 - .label i_1 = 6 - .label timer = 5 + .label __9 = $19 + .label __10 = $19 + .label __11 = $19 + .label __12 = $1b + .label __20 = $c + .label __23 = $e + .label __25 = $10 + .label __26 = $12 + .label __31 = $13 + .label __32 = $15 + .label __33 = $17 + .label __56 = $13 + .label timer_2 = 2 + .label h_bar = $b + .label active_balls = 3 + .label sprite_idx = 6 + .label i = 5 + .label timer = 4 // asm cld ldx #$ff @@ -250,11 +250,10 @@ main: { sta.z rand_state lda #>1 sta.z rand_state+1 - sta.z i + tax __b1: // for (i = 0; i < MAX_BALLS; i++) - lda.z i - cmp #$20 + cpx #$20 bcs !__b2+ jmp __b2 !__b2: @@ -306,10 +305,10 @@ main: { __b5: lda #0 sta.z sprite_idx - sta.z i_1 + sta.z i __b6: // for (i = 0; i < active_balls; i++) - lda.z i_1 + lda.z i cmp.z active_balls bcc __b7 // poke(0x2001) = 0x98 @@ -329,7 +328,7 @@ main: { jmp __b4 __b7: // balls[i].x_position += balls[i].x_velocity - lda.z i_1 + lda.z i asl asl asl @@ -370,7 +369,7 @@ main: { bcs __b9 !: // balls[i].x_velocity ^= 0xFFFF - lda.z i_1 + lda.z i asl asl asl @@ -383,7 +382,7 @@ main: { sta balls+4+1,y __b9: // balls[i].y_position >> 8 - lda.z i_1 + lda.z i asl asl asl @@ -414,7 +413,7 @@ main: { bcs __b10 !: // balls[i].y_velocity ^= 0xFFFF - lda.z i_1 + lda.z i asl asl asl @@ -443,7 +442,7 @@ main: { sta balls+2+1,y __b10: // balls[i].y_position >> 8 - lda.z i_1 + lda.z i asl asl asl @@ -475,7 +474,7 @@ main: { // sprite_idx++; inc.z sprite_idx // for (i = 0; i < active_balls; i++) - inc.z i_1 + inc.z i jmp __b6 __b25: stx.z timer @@ -492,7 +491,7 @@ main: { and #>$3ff sta.z __10+1 // balls[i].x_velocity = rand() & 0x3FF - lda.z i + txa asl asl asl @@ -507,29 +506,31 @@ main: { // rand() & 0x0FF lda #$ff and.z __11 - tax + sta.z __12 // balls[i].y_velocity = rand() & 0x0FF - lda.z i + txa asl asl asl tay - txa + lda.z __12 sta balls+6,y + lda #0 + sta balls+6+1,y // for (i = 0; i < MAX_BALLS; i++) - inc.z i + inx jmp __b1 } // Transfer a number of bytes from the CPU memory to the PPU memory // - ppuData : Pointer in the PPU memory // - cpuData : Pointer to the CPU memory (RAM of ROM) // - size : The number of bytes to transfer -// ppuDataTransfer(void* zp($f) cpuData) +// ppuDataTransfer(void* zp($e) cpuData) ppuDataTransfer: { - .label ppuDataPrepare1_ppuData = $d - .label cpuSrc = $f - .label i = $11 - .label cpuData = $f + .label ppuDataPrepare1_ppuData = $c + .label cpuSrc = $e + .label i = $10 + .label cpuData = $e // >ppuData lda.z ppuDataPrepare1_ppuData+1 // PPU->PPUADDR = >ppuData @@ -572,11 +573,11 @@ ppuDataTransfer: { // Fill a number of bytes in the PPU memory // - ppuData : Pointer in the PPU memory // - size : The number of bytes to transfer -// ppuDataFill(word zp($f) size) +// ppuDataFill(word zp($e) size) ppuDataFill: { - .label ppuDataPrepare1_ppuData = $d - .label i = $11 - .label size = $f + .label ppuDataPrepare1_ppuData = $c + .label i = $10 + .label size = $e // >ppuData lda.z ppuDataPrepare1_ppuData+1 // PPU->PPUADDR = >ppuData @@ -620,7 +621,7 @@ rand: { .label __0 = $1c .label __1 = $1e .label __2 = $20 - .label return = $1a + .label return = $19 // rand_state << 7 lda.z rand_state+1 lsr diff --git a/src/test/ref/complex/nes-balls/kickballs-2.log b/src/test/ref/complex/nes-balls/kickballs-2.log index 493d79d0e..f40278393 100644 --- a/src/test/ref/complex/nes-balls/kickballs-2.log +++ b/src/test/ref/complex/nes-balls/kickballs-2.log @@ -2963,17 +2963,17 @@ main: { asl sta.z __38 // [60] *((word*)(const struct $0*) balls + (byte~) main::$38) ← (byte) 0 -- pwuc1_derefidx_vbuz1=vbuc2 - lda.z __38 - ldx #0 - tay - txa + lda #0 + ldy.z __38 sta balls,y + lda #0 + sta balls+1,y // [61] *((word*)(const struct $0*) balls+(byte) 2 + (byte~) main::$38) ← (byte) 0 -- pwuc1_derefidx_vbuz1=vbuc2 - lda.z __38 - ldx #0 - tay - txa + lda #0 + ldy.z __38 sta balls+2,y + lda #0 + sta balls+2+1,y // [62] phi from main::@16 to main::@5 [phi:main::@16->main::@5] __b5_from___b16: // [62] phi (byte) main::timer#15 = (byte) 0 [phi:main::@16->main::@5#0] -- vbuz1=vbuc1 @@ -3306,11 +3306,11 @@ main: { asl sta.z __36 // [112] *((word*)(const struct $0*) balls+(byte) 6 + (byte~) main::$36) ← (byte~) main::$12 -- pwuc1_derefidx_vbuz1=vbuz2 - lda.z __36 - ldx.z __12 - tay - txa + lda.z __12 + ldy.z __36 sta balls+6,y + lda #0 + sta balls+6+1,y // [113] (byte) main::i#2 ← ++ (byte) main::i#14 -- vbuz1=_inc_vbuz1 inc.z i // [48] phi from main::@23 to main::@1 [phi:main::@23->main::@1] @@ -3823,72 +3823,72 @@ Uplift Scope [$0] Uplift Scope [vblank] Uplift Scope [__start] -Uplifting [ppuDataTransfer] best 56820 combination zp[2]:13 [ ppuDataTransfer::i#2 ppuDataTransfer::i#1 ] reg byte a [ ppuDataTransfer::ppuDataPut1_val#0 ] zp[2]:15 [ ppuDataTransfer::cpuSrc#2 ppuDataTransfer::cpuSrc#6 ppuDataTransfer::cpuSrc#1 ] reg byte a [ ppuDataTransfer::ppuDataPrepare1_$0 ] reg byte a [ ppuDataTransfer::ppuDataPrepare1_$1 ] zp[2]:9 [ ppuDataTransfer::ppuDataPrepare1_ppuData#0 ] zp[2]:11 [ ppuDataTransfer::cpuData#2 ] -Uplifting [rand] best 56820 combination zp[2]:73 [ rand::$0 ] zp[2]:77 [ rand::$1 ] zp[2]:81 [ rand::$2 ] zp[2]:83 [ rand::return#0 ] zp[2]:55 [ rand::return#2 ] zp[2]:62 [ rand::return#3 ] -Uplifting [] best 56820 combination zp[2]:75 [ rand_state#0 ] zp[2]:79 [ rand_state#1 ] zp[2]:23 [ rand_state#10 rand_state#17 rand_state#11 ] zp[1]:25 [ scroll_y ] zp[1]:26 [ vblank_hit ] -Uplifting [ppuDataFill] best 56808 combination zp[2]:21 [ ppuDataFill::i#2 ppuDataFill::i#1 ] reg byte a [ ppuDataFill::ppuDataPrepare1_$0 ] reg byte a [ ppuDataFill::ppuDataPrepare1_$1 ] zp[2]:19 [ ppuDataFill::size#3 ] zp[2]:17 [ ppuDataFill::ppuDataPrepare1_ppuData#0 ] -Uplifting [RICOH_2C02] best 56808 combination -Uplifting [RICOH_2A03] best 56808 combination -Uplifting [SpriteData] best 56808 combination -Uplifting [RADIX] best 56808 combination -Uplifting [printf_format_number] best 56808 combination -Uplifting [printf_buffer_number] best 56808 combination -Uplifting [printf_format_string] best 56808 combination -Uplifting [$0] best 56808 combination -Uplifting [vblank] best 56808 combination -Uplifting [__start] best 56808 combination +Uplifting [ppuDataTransfer] best 56910 combination zp[2]:13 [ ppuDataTransfer::i#2 ppuDataTransfer::i#1 ] reg byte a [ ppuDataTransfer::ppuDataPut1_val#0 ] zp[2]:15 [ ppuDataTransfer::cpuSrc#2 ppuDataTransfer::cpuSrc#6 ppuDataTransfer::cpuSrc#1 ] reg byte a [ ppuDataTransfer::ppuDataPrepare1_$0 ] reg byte a [ ppuDataTransfer::ppuDataPrepare1_$1 ] zp[2]:9 [ ppuDataTransfer::ppuDataPrepare1_ppuData#0 ] zp[2]:11 [ ppuDataTransfer::cpuData#2 ] +Uplifting [rand] best 56910 combination zp[2]:73 [ rand::$0 ] zp[2]:77 [ rand::$1 ] zp[2]:81 [ rand::$2 ] zp[2]:83 [ rand::return#0 ] zp[2]:55 [ rand::return#2 ] zp[2]:62 [ rand::return#3 ] +Uplifting [] best 56910 combination zp[2]:75 [ rand_state#0 ] zp[2]:79 [ rand_state#1 ] zp[2]:23 [ rand_state#10 rand_state#17 rand_state#11 ] zp[1]:25 [ scroll_y ] zp[1]:26 [ vblank_hit ] +Uplifting [ppuDataFill] best 56898 combination zp[2]:21 [ ppuDataFill::i#2 ppuDataFill::i#1 ] reg byte a [ ppuDataFill::ppuDataPrepare1_$0 ] reg byte a [ ppuDataFill::ppuDataPrepare1_$1 ] zp[2]:19 [ ppuDataFill::size#3 ] zp[2]:17 [ ppuDataFill::ppuDataPrepare1_ppuData#0 ] +Uplifting [RICOH_2C02] best 56898 combination +Uplifting [RICOH_2A03] best 56898 combination +Uplifting [SpriteData] best 56898 combination +Uplifting [RADIX] best 56898 combination +Uplifting [printf_format_number] best 56898 combination +Uplifting [printf_buffer_number] best 56898 combination +Uplifting [printf_format_string] best 56898 combination +Uplifting [$0] best 56898 combination +Uplifting [vblank] best 56898 combination +Uplifting [__start] best 56898 combination Attempting to uplift remaining variables inzp[1]:36 [ main::$45 ] -Uplifting [main] best 56408 combination reg byte a [ main::$45 ] +Uplifting [main] best 56498 combination reg byte a [ main::$45 ] Attempting to uplift remaining variables inzp[1]:33 [ main::$40 ] -Uplifting [main] best 55108 combination reg byte y [ main::$40 ] +Uplifting [main] best 55198 combination reg byte y [ main::$40 ] Attempting to uplift remaining variables inzp[1]:7 [ main::i#10 main::i#4 ] -Uplifting [main] best 55108 combination zp[1]:7 [ main::i#10 main::i#4 ] +Uplifting [main] best 55198 combination zp[1]:7 [ main::i#10 main::i#4 ] Attempting to uplift remaining variables inzp[1]:37 [ main::$44 ] -Uplifting [main] best 54408 combination reg byte y [ main::$44 ] +Uplifting [main] best 54498 combination reg byte y [ main::$44 ] Attempting to uplift remaining variables inzp[1]:8 [ main::sprite_idx#3 main::sprite_idx#2 ] -Uplifting [main] best 54408 combination zp[1]:8 [ main::sprite_idx#3 main::sprite_idx#2 ] +Uplifting [main] best 54498 combination zp[1]:8 [ main::sprite_idx#3 main::sprite_idx#2 ] Attempting to uplift remaining variables inzp[1]:42 [ main::$26 ] -Uplifting [main] best 54408 combination zp[1]:42 [ main::$26 ] +Uplifting [main] best 54498 combination zp[1]:42 [ main::$26 ] Attempting to uplift remaining variables inzp[1]:44 [ main::$30 ] -Uplifting [main] best 53808 combination reg byte a [ main::$30 ] +Uplifting [main] best 53898 combination reg byte a [ main::$30 ] Attempting to uplift remaining variables inzp[1]:52 [ main::$48 ] -Uplifting [main] best 52508 combination reg byte x [ main::$48 ] +Uplifting [main] best 52598 combination reg byte x [ main::$48 ] Attempting to uplift remaining variables inzp[1]:43 [ main::$53 ] -Uplifting [main] best 51808 combination reg byte y [ main::$53 ] +Uplifting [main] best 51898 combination reg byte y [ main::$53 ] Attempting to uplift remaining variables inzp[1]:49 [ main::$50 ] -Uplifting [main] best 51108 combination reg byte y [ main::$50 ] +Uplifting [main] best 51198 combination reg byte y [ main::$50 ] Attempting to uplift remaining variables inzp[1]:6 [ main::timer#3 main::timer#15 main::timer#21 ] -Uplifting [main] best 51108 combination zp[1]:6 [ main::timer#3 main::timer#15 main::timer#21 ] +Uplifting [main] best 51198 combination zp[1]:6 [ main::timer#3 main::timer#15 main::timer#21 ] Attempting to uplift remaining variables inzp[1]:2 [ main::initNES1_i#2 main::initNES1_i#1 ] -Uplifting [main] best 50778 combination reg byte x [ main::initNES1_i#2 main::initNES1_i#1 ] +Uplifting [main] best 50868 combination reg byte x [ main::initNES1_i#2 main::initNES1_i#1 ] Attempting to uplift remaining variables inzp[1]:3 [ main::i#14 main::i#2 ] -Uplifting [main] best 50778 combination zp[1]:3 [ main::i#14 main::i#2 ] +Uplifting [main] best 50758 combination reg byte x [ main::i#14 main::i#2 ] Attempting to uplift remaining variables inzp[1]:4 [ main::timer_2#2 main::timer_2#1 ] -Uplifting [main] best 50778 combination zp[1]:4 [ main::timer_2#2 main::timer_2#1 ] +Uplifting [main] best 50758 combination zp[1]:4 [ main::timer_2#2 main::timer_2#1 ] Attempting to uplift remaining variables inzp[1]:27 [ main::initNES1_waitForVBlank1_$0 ] -Uplifting [main] best 50718 combination reg byte a [ main::initNES1_waitForVBlank1_$0 ] +Uplifting [main] best 50698 combination reg byte a [ main::initNES1_waitForVBlank1_$0 ] Attempting to uplift remaining variables inzp[1]:28 [ main::initNES1_waitForVBlank2_$0 ] -Uplifting [main] best 50658 combination reg byte a [ main::initNES1_waitForVBlank2_$0 ] +Uplifting [main] best 50638 combination reg byte a [ main::initNES1_waitForVBlank2_$0 ] Attempting to uplift remaining variables inzp[1]:30 [ main::$14 ] -Uplifting [main] best 50598 combination reg byte a [ main::$14 ] +Uplifting [main] best 50578 combination reg byte a [ main::$14 ] Attempting to uplift remaining variables inzp[1]:61 [ main::$35 ] -Uplifting [main] best 50558 combination reg byte a [ main::$35 ] +Uplifting [main] best 50538 combination reg byte a [ main::$35 ] Attempting to uplift remaining variables inzp[1]:67 [ main::$36 ] Uplifting [main] best 50498 combination reg byte a [ main::$36 ] Attempting to uplift remaining variables inzp[1]:5 [ main::active_balls#2 main::active_balls#8 main::active_balls#1 ] Uplifting [main] best 50498 combination zp[1]:5 [ main::active_balls#2 main::active_balls#8 main::active_balls#1 ] Attempting to uplift remaining variables inzp[1]:32 [ main::$38 ] -Uplifting [main] best 50488 combination reg byte x [ main::$38 ] +Uplifting [main] best 50428 combination reg byte x [ main::$38 ] Attempting to uplift remaining variables inzp[1]:25 [ scroll_y ] -Uplifting [] best 50488 combination zp[1]:25 [ scroll_y ] +Uplifting [] best 50428 combination zp[1]:25 [ scroll_y ] Attempting to uplift remaining variables inzp[1]:31 [ main::timer#1 ] -Uplifting [main] best 50428 combination reg byte x [ main::timer#1 ] +Uplifting [main] best 50368 combination reg byte x [ main::timer#1 ] Attempting to uplift remaining variables inzp[1]:66 [ main::$12 ] -Uplifting [main] best 50388 combination reg byte x [ main::$12 ] +Uplifting [main] best 50368 combination zp[1]:66 [ main::$12 ] Attempting to uplift remaining variables inzp[1]:29 [ main::h_bar#1 ] -Uplifting [main] best 50388 combination zp[1]:29 [ main::h_bar#1 ] +Uplifting [main] best 50368 combination zp[1]:29 [ main::h_bar#1 ] Attempting to uplift remaining variables inzp[1]:26 [ vblank_hit ] -Uplifting [] best 50388 combination zp[1]:26 [ vblank_hit ] +Uplifting [] best 50368 combination zp[1]:26 [ vblank_hit ] Coalescing zero page register [ zp[2]:11 [ ppuDataTransfer::cpuData#2 ] ] with [ zp[2]:15 [ ppuDataTransfer::cpuSrc#2 ppuDataTransfer::cpuSrc#6 ppuDataTransfer::cpuSrc#1 ] ] - score: 1 Coalescing zero page register [ zp[2]:23 [ rand_state#10 rand_state#17 rand_state#11 ] ] with [ zp[2]:75 [ rand_state#0 ] ] - score: 1 Coalescing zero page register [ zp[2]:23 [ rand_state#10 rand_state#17 rand_state#11 rand_state#0 ] ] with [ zp[2]:79 [ rand_state#1 ] ] - score: 1 @@ -3904,24 +3904,24 @@ Coalescing zero page register [ zp[2]:21 [ ppuDataFill::i#2 ppuDataFill::i#1 ] ] Coalescing zero page register [ zp[2]:34 [ main::$20 ] ] with [ zp[2]:17 [ ppuDataFill::ppuDataPrepare1_ppuData#0 ppuDataTransfer::ppuDataPrepare1_ppuData#0 ] ] Coalescing zero page register [ zp[2]:38 [ main::$23 ] ] with [ zp[2]:19 [ ppuDataFill::size#3 ppuDataTransfer::cpuData#2 ppuDataTransfer::cpuSrc#2 ppuDataTransfer::cpuSrc#6 ppuDataTransfer::cpuSrc#1 ] ] Coalescing zero page register [ zp[2]:40 [ main::$25 ] ] with [ zp[2]:21 [ ppuDataFill::i#2 ppuDataFill::i#1 ppuDataTransfer::i#2 ppuDataTransfer::i#1 ] ] -Allocated (was zp[1]:3) zp[1]:2 [ main::i#14 main::i#2 ] -Allocated (was zp[1]:4) zp[1]:3 [ main::timer_2#2 main::timer_2#1 ] -Allocated (was zp[1]:5) zp[1]:4 [ main::active_balls#2 main::active_balls#8 main::active_balls#1 ] -Allocated (was zp[1]:6) zp[1]:5 [ main::timer#3 main::timer#15 main::timer#21 ] -Allocated (was zp[1]:7) zp[1]:6 [ main::i#10 main::i#4 ] -Allocated (was zp[1]:8) zp[1]:7 [ main::sprite_idx#3 main::sprite_idx#2 ] -Allocated (was zp[2]:23) zp[2]:8 [ rand_state#10 rand_state#17 rand_state#11 rand_state#0 rand_state#1 ] -Allocated (was zp[1]:25) zp[1]:10 [ scroll_y ] -Allocated (was zp[1]:26) zp[1]:11 [ vblank_hit ] -Allocated (was zp[1]:29) zp[1]:12 [ main::h_bar#1 ] -Allocated (was zp[2]:34) zp[2]:13 [ main::$20 ppuDataFill::ppuDataPrepare1_ppuData#0 ppuDataTransfer::ppuDataPrepare1_ppuData#0 ] -Allocated (was zp[2]:38) zp[2]:15 [ main::$23 ppuDataFill::size#3 ppuDataTransfer::cpuData#2 ppuDataTransfer::cpuSrc#2 ppuDataTransfer::cpuSrc#6 ppuDataTransfer::cpuSrc#1 ] -Allocated (was zp[2]:40) zp[2]:17 [ main::$25 ppuDataFill::i#2 ppuDataFill::i#1 ppuDataTransfer::i#2 ppuDataTransfer::i#1 ] -Allocated (was zp[1]:42) zp[1]:19 [ main::$26 ] -Allocated (was zp[2]:45) zp[2]:20 [ main::$56 main::$31 ] -Allocated (was zp[2]:50) zp[2]:22 [ main::$32 ] -Allocated (was zp[2]:53) zp[2]:24 [ main::$33 ] -Allocated (was zp[2]:55) zp[2]:26 [ rand::return#2 main::$9 rand::return#0 main::$10 rand::return#3 main::$11 ] +Allocated (was zp[1]:4) zp[1]:2 [ main::timer_2#2 main::timer_2#1 ] +Allocated (was zp[1]:5) zp[1]:3 [ main::active_balls#2 main::active_balls#8 main::active_balls#1 ] +Allocated (was zp[1]:6) zp[1]:4 [ main::timer#3 main::timer#15 main::timer#21 ] +Allocated (was zp[1]:7) zp[1]:5 [ main::i#10 main::i#4 ] +Allocated (was zp[1]:8) zp[1]:6 [ main::sprite_idx#3 main::sprite_idx#2 ] +Allocated (was zp[2]:23) zp[2]:7 [ rand_state#10 rand_state#17 rand_state#11 rand_state#0 rand_state#1 ] +Allocated (was zp[1]:25) zp[1]:9 [ scroll_y ] +Allocated (was zp[1]:26) zp[1]:10 [ vblank_hit ] +Allocated (was zp[1]:29) zp[1]:11 [ main::h_bar#1 ] +Allocated (was zp[2]:34) zp[2]:12 [ main::$20 ppuDataFill::ppuDataPrepare1_ppuData#0 ppuDataTransfer::ppuDataPrepare1_ppuData#0 ] +Allocated (was zp[2]:38) zp[2]:14 [ main::$23 ppuDataFill::size#3 ppuDataTransfer::cpuData#2 ppuDataTransfer::cpuSrc#2 ppuDataTransfer::cpuSrc#6 ppuDataTransfer::cpuSrc#1 ] +Allocated (was zp[2]:40) zp[2]:16 [ main::$25 ppuDataFill::i#2 ppuDataFill::i#1 ppuDataTransfer::i#2 ppuDataTransfer::i#1 ] +Allocated (was zp[1]:42) zp[1]:18 [ main::$26 ] +Allocated (was zp[2]:45) zp[2]:19 [ main::$56 main::$31 ] +Allocated (was zp[2]:50) zp[2]:21 [ main::$32 ] +Allocated (was zp[2]:53) zp[2]:23 [ main::$33 ] +Allocated (was zp[2]:55) zp[2]:25 [ rand::return#2 main::$9 rand::return#0 main::$10 rand::return#3 main::$11 ] +Allocated (was zp[1]:66) zp[1]:27 [ main::$12 ] Allocated (was zp[2]:73) zp[2]:28 [ rand::$0 ] Allocated (was zp[2]:77) zp[2]:30 [ rand::$1 ] Allocated (was zp[2]:81) zp[2]:32 [ rand::$2 ] @@ -4008,10 +4008,10 @@ ASSEMBLER BEFORE OPTIMIZATION .label PPU = $2000 // NES CPU and audion processing unit (APU) .label APU = $4000 - .label scroll_y = $a - .label vblank_hit = $b + .label scroll_y = 9 + .label vblank_hit = $a // The random state variable - .label rand_state = 8 + .label rand_state = 7 .segment Code // __start __start: { @@ -4082,24 +4082,24 @@ vblank: { } // main main: { - .label __9 = $1a - .label __10 = $1a - .label __11 = $1a - .label __20 = $d - .label __23 = $f - .label __25 = $11 - .label __26 = $13 - .label __31 = $14 - .label __32 = $16 - .label __33 = $18 - .label __56 = $14 - .label i = 2 - .label timer_2 = 3 - .label h_bar = $c - .label active_balls = 4 - .label sprite_idx = 7 - .label i_1 = 6 - .label timer = 5 + .label __9 = $19 + .label __10 = $19 + .label __11 = $19 + .label __12 = $1b + .label __20 = $c + .label __23 = $e + .label __25 = $10 + .label __26 = $12 + .label __31 = $13 + .label __32 = $15 + .label __33 = $17 + .label __56 = $13 + .label timer_2 = 2 + .label h_bar = $b + .label active_balls = 3 + .label sprite_idx = 6 + .label i = 5 + .label timer = 4 jmp initNES1 // main::initNES1 initNES1: @@ -4304,15 +4304,13 @@ main: { sta.z rand_state lda #>1 sta.z rand_state+1 - // [48] phi (byte) main::i#14 = (byte) 0 [phi:main::@18->main::@1#1] -- vbuz1=vbuc1 - lda #0 - sta.z i + // [48] phi (byte) main::i#14 = (byte) 0 [phi:main::@18->main::@1#1] -- vbuxx=vbuc1 + ldx #0 jmp __b1 // main::@1 __b1: - // [49] if((byte) main::i#14<(byte) $20) goto main::@2 -- vbuz1_lt_vbuc1_then_la1 - lda.z i - cmp #$20 + // [49] if((byte) main::i#14<(byte) $20) goto main::@2 -- vbuxx_lt_vbuc1_then_la1 + cpx #$20 bcc __b2_from___b1 // [50] phi from main::@1 to main::@3 [phi:main::@1->main::@3] __b3_from___b1: @@ -4401,12 +4399,12 @@ main: { sta.z sprite_idx // [63] phi (byte) main::i#10 = (byte) 0 [phi:main::@5->main::@6#1] -- vbuz1=vbuc1 lda #0 - sta.z i_1 + sta.z i jmp __b6 // main::@6 __b6: // [64] if((byte) main::i#10<(byte) main::active_balls#8) goto main::@7 -- vbuz1_lt_vbuz2_then_la1 - lda.z i_1 + lda.z i cmp.z active_balls bcc __b7 jmp __b8 @@ -4441,7 +4439,7 @@ main: { // main::@7 __b7: // [69] (byte~) main::$40 ← (byte) main::i#10 << (byte) 3 -- vbuyy=vbuz1_rol_3 - lda.z i_1 + lda.z i asl asl asl @@ -4486,7 +4484,7 @@ main: { // main::@11 __b11: // [75] (byte~) main::$45 ← (byte) main::i#10 << (byte) 3 -- vbuaa=vbuz1_rol_3 - lda.z i_1 + lda.z i asl asl asl @@ -4502,7 +4500,7 @@ main: { // main::@9 __b9: // [77] (byte~) main::$44 ← (byte) main::i#10 << (byte) 3 -- vbuyy=vbuz1_rol_3 - lda.z i_1 + lda.z i asl asl asl @@ -4542,7 +4540,7 @@ main: { // main::@12 __b12: // [83] (byte~) main::$53 ← (byte) main::i#10 << (byte) 3 -- vbuyy=vbuz1_rol_3 - lda.z i_1 + lda.z i asl asl asl @@ -4576,7 +4574,7 @@ main: { // main::@10 __b10: // [89] (byte~) main::$50 ← (byte) main::i#10 << (byte) 3 -- vbuyy=vbuz1_rol_3 - lda.z i_1 + lda.z i asl asl asl @@ -4611,7 +4609,7 @@ main: { // [97] (byte) main::sprite_idx#2 ← ++ (byte) main::sprite_idx#3 -- vbuz1=_inc_vbuz1 inc.z sprite_idx // [98] (byte) main::i#4 ← ++ (byte) main::i#10 -- vbuz1=_inc_vbuz1 - inc.z i_1 + inc.z i // [63] phi from main::@10 to main::@6 [phi:main::@10->main::@6] __b6_from___b10: // [63] phi (byte) main::sprite_idx#3 = (byte) main::sprite_idx#2 [phi:main::@10->main::@6#0] -- register_copy @@ -4644,8 +4642,8 @@ main: { lda.z __10+1 and #>$3ff sta.z __10+1 - // [105] (byte~) main::$35 ← (byte) main::i#14 << (byte) 3 -- vbuaa=vbuz1_rol_3 - lda.z i + // [105] (byte~) main::$35 ← (byte) main::i#14 << (byte) 3 -- vbuaa=vbuxx_rol_3 + txa asl asl asl @@ -4665,21 +4663,23 @@ main: { // main::@23 __b23: // [109] (word~) main::$11 ← (word) rand::return#3 - // [110] (byte~) main::$12 ← (word~) main::$11 & (byte) $ff -- vbuxx=vwuz1_band_vbuc1 + // [110] (byte~) main::$12 ← (word~) main::$11 & (byte) $ff -- vbuz1=vwuz2_band_vbuc1 lda #$ff and.z __11 - tax - // [111] (byte~) main::$36 ← (byte) main::i#14 << (byte) 3 -- vbuaa=vbuz1_rol_3 - lda.z i - asl - asl - asl - // [112] *((word*)(const struct $0*) balls+(byte) 6 + (byte~) main::$36) ← (byte~) main::$12 -- pwuc1_derefidx_vbuaa=vbuxx - tay + sta.z __12 + // [111] (byte~) main::$36 ← (byte) main::i#14 << (byte) 3 -- vbuaa=vbuxx_rol_3 txa + asl + asl + asl + // [112] *((word*)(const struct $0*) balls+(byte) 6 + (byte~) main::$36) ← (byte~) main::$12 -- pwuc1_derefidx_vbuaa=vbuz1 + tay + lda.z __12 sta balls+6,y - // [113] (byte) main::i#2 ← ++ (byte) main::i#14 -- vbuz1=_inc_vbuz1 - inc.z i + lda #0 + sta balls+6+1,y + // [113] (byte) main::i#2 ← ++ (byte) main::i#14 -- vbuxx=_inc_vbuxx + inx // [48] phi from main::@23 to main::@1 [phi:main::@23->main::@1] __b1_from___b23: // [48] phi (word) rand_state#17 = (word) rand_state#11 [phi:main::@23->main::@1#0] -- register_copy @@ -4691,12 +4691,12 @@ main: { // - ppuData : Pointer in the PPU memory // - cpuData : Pointer to the CPU memory (RAM of ROM) // - size : The number of bytes to transfer -// ppuDataTransfer(void* zp($f) cpuData) +// ppuDataTransfer(void* zp($e) cpuData) ppuDataTransfer: { - .label ppuDataPrepare1_ppuData = $d - .label cpuSrc = $f - .label i = $11 - .label cpuData = $f + .label ppuDataPrepare1_ppuData = $c + .label cpuSrc = $e + .label i = $10 + .label cpuData = $e jmp ppuDataPrepare1 // ppuDataTransfer::ppuDataPrepare1 ppuDataPrepare1: @@ -4768,11 +4768,11 @@ ppuDataTransfer: { // Fill a number of bytes in the PPU memory // - ppuData : Pointer in the PPU memory // - size : The number of bytes to transfer -// ppuDataFill(word zp($f) size) +// ppuDataFill(word zp($e) size) ppuDataFill: { - .label ppuDataPrepare1_ppuData = $d - .label i = $11 - .label size = $f + .label ppuDataPrepare1_ppuData = $c + .label i = $10 + .label size = $e jmp ppuDataPrepare1 // ppuDataFill::ppuDataPrepare1 ppuDataPrepare1: @@ -4836,7 +4836,7 @@ rand: { .label __0 = $1c .label __1 = $1e .label __2 = $20 - .label return = $1a + .label return = $19 // [138] (word~) rand::$0 ← (word) rand_state#10 << (byte) 7 -- vwuz1=vwuz2_rol_7 lda.z rand_state+1 lsr @@ -4970,7 +4970,7 @@ Removing instruction lda #0 Removing instruction lda #0 Removing instruction lda #0 Removing instruction lda #0 -Removing instruction lda #0 +Replacing instruction ldx #0 with TAX Removing instruction lda #0 Removing instruction lda #0 Removing instruction lda #0 @@ -5066,8 +5066,8 @@ Succesful ASM optimization Pass5NextJumpElimination Removing instruction lda #0 Removing instruction lda #0 Succesful ASM optimization Pass5UnnecesaryLoadElimination -Fixing long branch [221] bcc __b2 to bcs -Fixing long branch [245] bne __b25 to beq +Fixing long branch [220] bcc __b2 to bcs +Fixing long branch [244] bne __b25 to beq FINAL SYMBOL TABLE (word) $0::x_position @@ -5145,18 +5145,18 @@ FINAL SYMBOL TABLE (const struct $0*) balls[(number) $40] = { fill( $40, 0) } (const to_nomodify byte*) h_bar_tilemap[] = { (byte) 1, (byte) 1, (byte) 1, (byte) 1, (byte) 1, (byte) 1, (byte) 1, (byte) 1, (byte) 1, (byte) 1, (byte) 1, (byte) 1, (byte) 1, (byte) 1, (byte) 1, (byte) 1, (byte) 1, (byte) 1, (byte) 1, (byte) 1, (byte) 1, (byte) 1, (byte) 1, (byte) 1, (byte) 1, (byte) 1, (byte) 1, (byte) 1, (byte) 1, (byte) 1, (byte) 1, (byte) 1 } (signed word()) main() -(word~) main::$10 zp[2]:26 101.0 -(word~) main::$11 zp[2]:26 202.0 -(byte~) main::$12 reg byte x 101.0 +(word~) main::$10 zp[2]:25 101.0 +(word~) main::$11 zp[2]:25 202.0 +(byte~) main::$12 zp[1]:27 101.0 (byte~) main::$14 reg byte a 202.0 -(word~) main::$20 zp[2]:13 2002.0 -(word~) main::$23 zp[2]:15 667.3333333333334 -(word~) main::$25 zp[2]:17 667.3333333333334 -(byte~) main::$26 zp[1]:19 1001.0 +(word~) main::$20 zp[2]:12 2002.0 +(word~) main::$23 zp[2]:14 667.3333333333334 +(word~) main::$25 zp[2]:16 667.3333333333334 +(byte~) main::$26 zp[1]:18 1001.0 (byte~) main::$30 reg byte a 1001.0 -(word~) main::$31 zp[2]:20 2002.0 -(word~) main::$32 zp[2]:22 500.5 -(word~) main::$33 zp[2]:24 1001.0 +(word~) main::$31 zp[2]:19 2002.0 +(word~) main::$32 zp[2]:21 500.5 +(word~) main::$33 zp[2]:23 1001.0 (byte~) main::$35 reg byte a 202.0 (byte~) main::$36 reg byte a 202.0 (byte~) main::$38 reg byte x 151.5 @@ -5166,8 +5166,8 @@ FINAL SYMBOL TABLE (byte~) main::$48 reg byte x 1001.0 (byte~) main::$50 reg byte y 500.5 (byte~) main::$53 reg byte y 800.8 -(word~) main::$56 zp[2]:20 2002.0 -(word~) main::$9 zp[2]:26 202.0 +(word~) main::$56 zp[2]:19 2002.0 +(word~) main::$9 zp[2]:25 202.0 (label) main::@1 (label) main::@10 (label) main::@11 @@ -5194,17 +5194,17 @@ FINAL SYMBOL TABLE (label) main::@8 (label) main::@9 (byte) main::active_balls -(byte) main::active_balls#1 active_balls zp[1]:4 75.75 -(byte) main::active_balls#2 active_balls zp[1]:4 56.11111111111111 -(byte) main::active_balls#8 active_balls zp[1]:4 37.97297297297297 +(byte) main::active_balls#1 active_balls zp[1]:3 75.75 +(byte) main::active_balls#2 active_balls zp[1]:3 56.11111111111111 +(byte) main::active_balls#8 active_balls zp[1]:3 37.97297297297297 (label) main::enableVideoOutput1 (byte) main::h_bar -(byte) main::h_bar#1 h_bar zp[1]:12 72.8409090909091 +(byte) main::h_bar#1 h_bar zp[1]:11 72.8409090909091 (byte) main::i -(byte) main::i#10 i_1 zp[1]:6 258.3225806451613 -(byte) main::i#14 i zp[1]:2 33.666666666666664 -(byte) main::i#2 i zp[1]:2 202.0 -(byte) main::i#4 i_1 zp[1]:6 2002.0 +(byte) main::i#10 i zp[1]:5 258.3225806451613 +(byte) main::i#14 reg byte x 33.666666666666664 +(byte) main::i#2 reg byte x 202.0 +(byte) main::i#4 i zp[1]:5 2002.0 (label) main::initNES1 (label) main::initNES1_@1 (label) main::initNES1_@7 @@ -5222,34 +5222,34 @@ FINAL SYMBOL TABLE (label) main::initNES1_waitForVBlank2_@1 (signed word) main::return (byte) main::sprite_idx -(byte) main::sprite_idx#2 sprite_idx zp[1]:7 1001.0 -(byte) main::sprite_idx#3 sprite_idx zp[1]:7 100.1 +(byte) main::sprite_idx#2 sprite_idx zp[1]:6 1001.0 +(byte) main::sprite_idx#3 sprite_idx zp[1]:6 100.1 (byte) main::timer (byte) main::timer#1 reg byte x 101.0 -(byte) main::timer#15 timer zp[1]:5 8.18918918918919 -(byte) main::timer#21 timer zp[1]:5 202.0 -(byte) main::timer#3 timer zp[1]:5 57.714285714285715 +(byte) main::timer#15 timer zp[1]:4 8.18918918918919 +(byte) main::timer#21 timer zp[1]:4 202.0 +(byte) main::timer#3 timer zp[1]:4 57.714285714285715 (byte) main::timer_2 -(byte) main::timer_2#1 timer_2 zp[1]:3 6.183673469387754 -(byte) main::timer_2#2 timer_2 zp[1]:3 202.0 +(byte) main::timer_2#1 timer_2 zp[1]:2 6.183673469387754 +(byte) main::timer_2#2 timer_2 zp[1]:2 202.0 (const to_nomodify byte*) palette[] = { (byte) $34, (byte) $24, (byte) $14, (byte) 4, (byte) $34, (byte) $24, (byte) $14, (byte) 4, (byte) $34, (byte) $24, (byte) $14, (byte) 4, (byte) $34, (byte) $24, (byte) $14, (byte) 4, (byte) $34, (byte) $24, (byte) $14, (byte) 4, (byte) $34, (byte) $24, (byte) $14, (byte) 4, (byte) $34, (byte) $24, (byte) $14, (byte) 4, (byte) $34, (byte) $24, (byte) $14, (byte) 4 } (void()) ppuDataFill((nomodify void*) ppuDataFill::ppuData , (byte) ppuDataFill::val , (word) ppuDataFill::size) (label) ppuDataFill::@1 (label) ppuDataFill::@2 (label) ppuDataFill::@return (word) ppuDataFill::i -(word) ppuDataFill::i#1 i zp[2]:17 2002.0 -(word) ppuDataFill::i#2 i zp[2]:17 1001.0 +(word) ppuDataFill::i#1 i zp[2]:16 2002.0 +(word) ppuDataFill::i#2 i zp[2]:16 1001.0 (nomodify void*) ppuDataFill::ppuData (label) ppuDataFill::ppuDataPrepare1 (byte~) ppuDataFill::ppuDataPrepare1_$0 reg byte a 202.0 (byte~) ppuDataFill::ppuDataPrepare1_$1 reg byte a 202.0 (nomodify void*) ppuDataFill::ppuDataPrepare1_ppuData -(nomodify void*) ppuDataFill::ppuDataPrepare1_ppuData#0 ppuDataPrepare1_ppuData zp[2]:13 67.33333333333333 +(nomodify void*) ppuDataFill::ppuDataPrepare1_ppuData#0 ppuDataPrepare1_ppuData zp[2]:12 67.33333333333333 (label) ppuDataFill::ppuDataPut1 (byte) ppuDataFill::ppuDataPut1_val (word) ppuDataFill::size -(word) ppuDataFill::size#3 size zp[2]:15 111.22222222222223 +(word) ppuDataFill::size#3 size zp[2]:14 111.22222222222223 (byte) ppuDataFill::val (void()) ppuDataTransfer((nomodify void*) ppuDataTransfer::ppuData , (nomodify void*) ppuDataTransfer::cpuData , (word) ppuDataTransfer::size) (label) ppuDataTransfer::@1 @@ -5258,20 +5258,20 @@ FINAL SYMBOL TABLE (label) ppuDataTransfer::@4 (label) ppuDataTransfer::@return (nomodify void*) ppuDataTransfer::cpuData -(nomodify void*) ppuDataTransfer::cpuData#2 cpuData zp[2]:15 +(nomodify void*) ppuDataTransfer::cpuData#2 cpuData zp[2]:14 (byte*) ppuDataTransfer::cpuSrc -(byte*) ppuDataTransfer::cpuSrc#1 cpuSrc zp[2]:15 1001.0 -(byte*) ppuDataTransfer::cpuSrc#2 cpuSrc zp[2]:15 776.0 -(byte*) ppuDataTransfer::cpuSrc#6 cpuSrc zp[2]:15 202.0 +(byte*) ppuDataTransfer::cpuSrc#1 cpuSrc zp[2]:14 1001.0 +(byte*) ppuDataTransfer::cpuSrc#2 cpuSrc zp[2]:14 776.0 +(byte*) ppuDataTransfer::cpuSrc#6 cpuSrc zp[2]:14 202.0 (word) ppuDataTransfer::i -(word) ppuDataTransfer::i#1 i zp[2]:17 2002.0 -(word) ppuDataTransfer::i#2 i zp[2]:17 600.5999999999999 +(word) ppuDataTransfer::i#1 i zp[2]:16 2002.0 +(word) ppuDataTransfer::i#2 i zp[2]:16 600.5999999999999 (nomodify void*) ppuDataTransfer::ppuData (label) ppuDataTransfer::ppuDataPrepare1 (byte~) ppuDataTransfer::ppuDataPrepare1_$0 reg byte a 202.0 (byte~) ppuDataTransfer::ppuDataPrepare1_$1 reg byte a 202.0 (nomodify void*) ppuDataTransfer::ppuDataPrepare1_ppuData -(nomodify void*) ppuDataTransfer::ppuDataPrepare1_ppuData#0 ppuDataPrepare1_ppuData zp[2]:13 67.33333333333333 +(nomodify void*) ppuDataTransfer::ppuDataPrepare1_ppuData#0 ppuDataPrepare1_ppuData zp[2]:12 67.33333333333333 (label) ppuDataTransfer::ppuDataPut1 (byte) ppuDataTransfer::ppuDataPut1_val (byte) ppuDataTransfer::ppuDataPut1_val#0 reg byte a 2002.0 @@ -5292,57 +5292,57 @@ FINAL SYMBOL TABLE (word~) rand::$2 zp[2]:32 2002.0 (label) rand::@return (word) rand::return -(word) rand::return#0 return zp[2]:26 300.75 -(word) rand::return#2 return zp[2]:26 202.0 -(word) rand::return#3 return zp[2]:26 202.0 +(word) rand::return#0 return zp[2]:25 300.75 +(word) rand::return#2 return zp[2]:25 202.0 +(word) rand::return#3 return zp[2]:25 202.0 (word) rand_state -(word) rand_state#0 rand_state zp[2]:8 1501.5 -(word) rand_state#1 rand_state zp[2]:8 1501.5 -(word) rand_state#10 rand_state zp[2]:8 1102.0 -(word) rand_state#11 rand_state zp[2]:8 137.75 -(word) rand_state#17 rand_state zp[2]:8 67.33333333333333 -(volatile byte) scroll_y loadstore zp[1]:10 105.0 +(word) rand_state#0 rand_state zp[2]:7 1501.5 +(word) rand_state#1 rand_state zp[2]:7 1501.5 +(word) rand_state#10 rand_state zp[2]:7 1102.0 +(word) rand_state#11 rand_state zp[2]:7 137.75 +(word) rand_state#17 rand_state zp[2]:7 67.33333333333333 +(volatile byte) scroll_y loadstore zp[1]:9 105.0 (const to_nomodify byte*) sine_table[(number) $100] = { (byte) $40, (byte) $42, (byte) $43, (byte) $45, (byte) $46, (byte) $48, (byte) $49, (byte) $4b, (byte) $4c, (byte) $4e, (byte) $50, (byte) $51, (byte) $53, (byte) $54, (byte) $56, (byte) $57, (byte) $58, (byte) $5a, (byte) $5b, (byte) $5d, (byte) $5e, (byte) $60, (byte) $61, (byte) $62, (byte) $64, (byte) $65, (byte) $66, (byte) $67, (byte) $69, (byte) $6a, (byte) $6b, (byte) $6c, (byte) $6d, (byte) $6e, (byte) $6f, (byte) $70, (byte) $71, (byte) $72, (byte) $73, (byte) $74, (byte) $75, (byte) $76, (byte) $77, (byte) $78, (byte) $78, (byte) $79, (byte) $7a, (byte) $7b, (byte) $7b, (byte) $7c, (byte) $7c, (byte) $7d, (byte) $7d, (byte) $7e, (byte) $7e, (byte) $7e, (byte) $7f, (byte) $7f, (byte) $7f, (byte) $80, (byte) $80, (byte) $80, (byte) $80, (byte) $80, (byte) $80, (byte) $80, (byte) $80, (byte) $80, (byte) $80, (byte) $80, (byte) $7f, (byte) $7f, (byte) $7f, (byte) $7e, (byte) $7e, (byte) $7e, (byte) $7d, (byte) $7d, (byte) $7c, (byte) $7c, (byte) $7b, (byte) $7b, (byte) $7a, (byte) $79, (byte) $78, (byte) $78, (byte) $77, (byte) $76, (byte) $75, (byte) $74, (byte) $73, (byte) $72, (byte) $71, (byte) $70, (byte) $6f, (byte) $6e, (byte) $6d, (byte) $6c, (byte) $6b, (byte) $6a, (byte) $69, (byte) $67, (byte) $66, (byte) $65, (byte) $64, (byte) $62, (byte) $61, (byte) $60, (byte) $5e, (byte) $5d, (byte) $5b, (byte) $5a, (byte) $58, (byte) $57, (byte) $56, (byte) $54, (byte) $53, (byte) $51, (byte) $50, (byte) $4e, (byte) $4c, (byte) $4b, (byte) $49, (byte) $48, (byte) $46, (byte) $45, (byte) $43, (byte) $42, (byte) $40, (byte) $3e, (byte) $3d, (byte) $3b, (byte) $3a, (byte) $38, (byte) $37, (byte) $35, (byte) $34, (byte) $32, (byte) $30, (byte) $2f, (byte) $2d, (byte) $2c, (byte) $2a, (byte) $29, (byte) $28, (byte) $26, (byte) $25, (byte) $23, (byte) $22, (byte) $20, (byte) $1f, (byte) $1e, (byte) $1c, (byte) $1b, (byte) $1a, (byte) $19, (byte) $17, (byte) $16, (byte) $15, (byte) $14, (byte) $13, (byte) $12, (byte) $11, (byte) $10, (byte) $f, (byte) $e, (byte) $d, (byte) $c, (byte) $b, (byte) $a, (byte) 9, (byte) 8, (byte) 8, (byte) 7, (byte) 6, (byte) 5, (byte) 5, (byte) 4, (byte) 4, (byte) 3, (byte) 3, (byte) 2, (byte) 2, (byte) 2, (byte) 1, (byte) 1, (byte) 1, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 1, (byte) 1, (byte) 1, (byte) 2, (byte) 2, (byte) 2, (byte) 3, (byte) 3, (byte) 4, (byte) 4, (byte) 5, (byte) 5, (byte) 6, (byte) 7, (byte) 8, (byte) 8, (byte) 9, (byte) $a, (byte) $b, (byte) $c, (byte) $d, (byte) $e, (byte) $f, (byte) $10, (byte) $11, (byte) $12, (byte) $13, (byte) $14, (byte) $15, (byte) $16, (byte) $17, (byte) $19, (byte) $1a, (byte) $1b, (byte) $1c, (byte) $1e, (byte) $1f, (byte) $20, (byte) $22, (byte) $23, (byte) $25, (byte) $26, (byte) $28, (byte) $29, (byte) $2a, (byte) $2c, (byte) $2d, (byte) $2f, (byte) $30, (byte) $32, (byte) $34, (byte) $35, (byte) $37, (byte) $38, (byte) $3a, (byte) $3b, (byte) $3d, (byte) $3e } interrupt(HARDWARE_STACK)(void()) vblank() (label) vblank::@1 (label) vblank::@return (label) vblank::ppuSpriteBufferDmaTransfer1 (struct SpriteData*) vblank::ppuSpriteBufferDmaTransfer1_spriteBuffer -(volatile byte) vblank_hit loadstore zp[1]:11 10.25925925925926 +(volatile byte) vblank_hit loadstore zp[1]:10 10.25925925925926 reg byte x [ main::initNES1_i#2 main::initNES1_i#1 ] -zp[1]:2 [ main::i#14 main::i#2 ] -zp[1]:3 [ main::timer_2#2 main::timer_2#1 ] -zp[1]:4 [ main::active_balls#2 main::active_balls#8 main::active_balls#1 ] -zp[1]:5 [ main::timer#3 main::timer#15 main::timer#21 ] -zp[1]:6 [ main::i#10 main::i#4 ] -zp[1]:7 [ main::sprite_idx#3 main::sprite_idx#2 ] -zp[2]:8 [ rand_state#10 rand_state#17 rand_state#11 rand_state#0 rand_state#1 ] -zp[1]:10 [ scroll_y ] -zp[1]:11 [ vblank_hit ] +reg byte x [ main::i#14 main::i#2 ] +zp[1]:2 [ main::timer_2#2 main::timer_2#1 ] +zp[1]:3 [ main::active_balls#2 main::active_balls#8 main::active_balls#1 ] +zp[1]:4 [ main::timer#3 main::timer#15 main::timer#21 ] +zp[1]:5 [ main::i#10 main::i#4 ] +zp[1]:6 [ main::sprite_idx#3 main::sprite_idx#2 ] +zp[2]:7 [ rand_state#10 rand_state#17 rand_state#11 rand_state#0 rand_state#1 ] +zp[1]:9 [ scroll_y ] +zp[1]:10 [ vblank_hit ] reg byte a [ main::initNES1_waitForVBlank1_$0 ] reg byte a [ main::initNES1_waitForVBlank2_$0 ] -zp[1]:12 [ main::h_bar#1 ] +zp[1]:11 [ main::h_bar#1 ] reg byte a [ main::$14 ] reg byte x [ main::timer#1 ] reg byte x [ main::$38 ] reg byte y [ main::$40 ] -zp[2]:13 [ main::$20 ppuDataFill::ppuDataPrepare1_ppuData#0 ppuDataTransfer::ppuDataPrepare1_ppuData#0 ] +zp[2]:12 [ main::$20 ppuDataFill::ppuDataPrepare1_ppuData#0 ppuDataTransfer::ppuDataPrepare1_ppuData#0 ] reg byte a [ main::$45 ] reg byte y [ main::$44 ] -zp[2]:15 [ main::$23 ppuDataFill::size#3 ppuDataTransfer::cpuData#2 ppuDataTransfer::cpuSrc#2 ppuDataTransfer::cpuSrc#6 ppuDataTransfer::cpuSrc#1 ] -zp[2]:17 [ main::$25 ppuDataFill::i#2 ppuDataFill::i#1 ppuDataTransfer::i#2 ppuDataTransfer::i#1 ] -zp[1]:19 [ main::$26 ] +zp[2]:14 [ main::$23 ppuDataFill::size#3 ppuDataTransfer::cpuData#2 ppuDataTransfer::cpuSrc#2 ppuDataTransfer::cpuSrc#6 ppuDataTransfer::cpuSrc#1 ] +zp[2]:16 [ main::$25 ppuDataFill::i#2 ppuDataFill::i#1 ppuDataTransfer::i#2 ppuDataTransfer::i#1 ] +zp[1]:18 [ main::$26 ] reg byte y [ main::$53 ] reg byte a [ main::$30 ] -zp[2]:20 [ main::$56 main::$31 ] +zp[2]:19 [ main::$56 main::$31 ] reg byte y [ main::$50 ] -zp[2]:22 [ main::$32 ] +zp[2]:21 [ main::$32 ] reg byte x [ main::$48 ] -zp[2]:24 [ main::$33 ] -zp[2]:26 [ rand::return#2 main::$9 rand::return#0 main::$10 rand::return#3 main::$11 ] +zp[2]:23 [ main::$33 ] +zp[2]:25 [ rand::return#2 main::$9 rand::return#0 main::$10 rand::return#3 main::$11 ] reg byte a [ main::$35 ] -reg byte x [ main::$12 ] +zp[1]:27 [ main::$12 ] reg byte a [ main::$36 ] reg byte a [ ppuDataTransfer::ppuDataPrepare1_$0 ] reg byte a [ ppuDataTransfer::ppuDataPrepare1_$1 ] @@ -5438,10 +5438,10 @@ Score: 45543 .label PPU = $2000 // NES CPU and audion processing unit (APU) .label APU = $4000 - .label scroll_y = $a - .label vblank_hit = $b + .label scroll_y = 9 + .label vblank_hit = $a // The random state variable - .label rand_state = 8 + .label rand_state = 7 .segment Code // __start __start: { @@ -5505,24 +5505,24 @@ vblank: { } // main main: { - .label __9 = $1a - .label __10 = $1a - .label __11 = $1a - .label __20 = $d - .label __23 = $f - .label __25 = $11 - .label __26 = $13 - .label __31 = $14 - .label __32 = $16 - .label __33 = $18 - .label __56 = $14 - .label i = 2 - .label timer_2 = 3 - .label h_bar = $c - .label active_balls = 4 - .label sprite_idx = 7 - .label i_1 = 6 - .label timer = 5 + .label __9 = $19 + .label __10 = $19 + .label __11 = $19 + .label __12 = $1b + .label __20 = $c + .label __23 = $e + .label __25 = $10 + .label __26 = $12 + .label __31 = $13 + .label __32 = $15 + .label __33 = $17 + .label __56 = $13 + .label timer_2 = 2 + .label h_bar = $b + .label active_balls = 3 + .label sprite_idx = 6 + .label i = 5 + .label timer = 4 // main::initNES1 // asm // asm { cld ldx#$ff txs } @@ -5702,14 +5702,13 @@ main: { sta.z rand_state lda #>1 sta.z rand_state+1 - // [48] phi (byte) main::i#14 = (byte) 0 [phi:main::@18->main::@1#1] -- vbuz1=vbuc1 - sta.z i + // [48] phi (byte) main::i#14 = (byte) 0 [phi:main::@18->main::@1#1] -- vbuxx=vbuc1 + tax // main::@1 __b1: // for (i = 0; i < MAX_BALLS; i++) - // [49] if((byte) main::i#14<(byte) $20) goto main::@2 -- vbuz1_lt_vbuc1_then_la1 - lda.z i - cmp #$20 + // [49] if((byte) main::i#14<(byte) $20) goto main::@2 -- vbuxx_lt_vbuc1_then_la1 + cpx #$20 bcs !__b2+ jmp __b2 !__b2: @@ -5790,12 +5789,12 @@ main: { lda #0 sta.z sprite_idx // [63] phi (byte) main::i#10 = (byte) 0 [phi:main::@5->main::@6#1] -- vbuz1=vbuc1 - sta.z i_1 + sta.z i // main::@6 __b6: // for (i = 0; i < active_balls; i++) // [64] if((byte) main::i#10<(byte) main::active_balls#8) goto main::@7 -- vbuz1_lt_vbuz2_then_la1 - lda.z i_1 + lda.z i cmp.z active_balls bcc __b7 // main::@8 @@ -5828,7 +5827,7 @@ main: { __b7: // balls[i].x_position += balls[i].x_velocity // [69] (byte~) main::$40 ← (byte) main::i#10 << (byte) 3 -- vbuyy=vbuz1_rol_3 - lda.z i_1 + lda.z i asl asl asl @@ -5876,7 +5875,7 @@ main: { // main::@11 // balls[i].x_velocity ^= 0xFFFF // [75] (byte~) main::$45 ← (byte) main::i#10 << (byte) 3 -- vbuaa=vbuz1_rol_3 - lda.z i_1 + lda.z i asl asl asl @@ -5892,7 +5891,7 @@ main: { __b9: // balls[i].y_position >> 8 // [77] (byte~) main::$44 ← (byte) main::i#10 << (byte) 3 -- vbuyy=vbuz1_rol_3 - lda.z i_1 + lda.z i asl asl asl @@ -5931,7 +5930,7 @@ main: { // main::@12 // balls[i].y_velocity ^= 0xFFFF // [83] (byte~) main::$53 ← (byte) main::i#10 << (byte) 3 -- vbuyy=vbuz1_rol_3 - lda.z i_1 + lda.z i asl asl asl @@ -5967,7 +5966,7 @@ main: { __b10: // balls[i].y_position >> 8 // [89] (byte~) main::$50 ← (byte) main::i#10 << (byte) 3 -- vbuyy=vbuz1_rol_3 - lda.z i_1 + lda.z i asl asl asl @@ -6008,7 +6007,7 @@ main: { inc.z sprite_idx // for (i = 0; i < active_balls; i++) // [98] (byte) main::i#4 ← ++ (byte) main::i#10 -- vbuz1=_inc_vbuz1 - inc.z i_1 + inc.z i // [63] phi from main::@10 to main::@6 [phi:main::@10->main::@6] // [63] phi (byte) main::sprite_idx#3 = (byte) main::sprite_idx#2 [phi:main::@10->main::@6#0] -- register_copy // [63] phi (byte) main::i#10 = (byte) main::i#4 [phi:main::@10->main::@6#1] -- register_copy @@ -6039,8 +6038,8 @@ main: { and #>$3ff sta.z __10+1 // balls[i].x_velocity = rand() & 0x3FF - // [105] (byte~) main::$35 ← (byte) main::i#14 << (byte) 3 -- vbuaa=vbuz1_rol_3 - lda.z i + // [105] (byte~) main::$35 ← (byte) main::i#14 << (byte) 3 -- vbuaa=vbuxx_rol_3 + txa asl asl asl @@ -6060,23 +6059,25 @@ main: { // main::@23 // [109] (word~) main::$11 ← (word) rand::return#3 // rand() & 0x0FF - // [110] (byte~) main::$12 ← (word~) main::$11 & (byte) $ff -- vbuxx=vwuz1_band_vbuc1 + // [110] (byte~) main::$12 ← (word~) main::$11 & (byte) $ff -- vbuz1=vwuz2_band_vbuc1 lda #$ff and.z __11 - tax + sta.z __12 // balls[i].y_velocity = rand() & 0x0FF - // [111] (byte~) main::$36 ← (byte) main::i#14 << (byte) 3 -- vbuaa=vbuz1_rol_3 - lda.z i - asl - asl - asl - // [112] *((word*)(const struct $0*) balls+(byte) 6 + (byte~) main::$36) ← (byte~) main::$12 -- pwuc1_derefidx_vbuaa=vbuxx - tay + // [111] (byte~) main::$36 ← (byte) main::i#14 << (byte) 3 -- vbuaa=vbuxx_rol_3 txa + asl + asl + asl + // [112] *((word*)(const struct $0*) balls+(byte) 6 + (byte~) main::$36) ← (byte~) main::$12 -- pwuc1_derefidx_vbuaa=vbuz1 + tay + lda.z __12 sta balls+6,y + lda #0 + sta balls+6+1,y // for (i = 0; i < MAX_BALLS; i++) - // [113] (byte) main::i#2 ← ++ (byte) main::i#14 -- vbuz1=_inc_vbuz1 - inc.z i + // [113] (byte) main::i#2 ← ++ (byte) main::i#14 -- vbuxx=_inc_vbuxx + inx // [48] phi from main::@23 to main::@1 [phi:main::@23->main::@1] // [48] phi (word) rand_state#17 = (word) rand_state#11 [phi:main::@23->main::@1#0] -- register_copy // [48] phi (byte) main::i#14 = (byte) main::i#2 [phi:main::@23->main::@1#1] -- register_copy @@ -6087,12 +6088,12 @@ main: { // - ppuData : Pointer in the PPU memory // - cpuData : Pointer to the CPU memory (RAM of ROM) // - size : The number of bytes to transfer -// ppuDataTransfer(void* zp($f) cpuData) +// ppuDataTransfer(void* zp($e) cpuData) ppuDataTransfer: { - .label ppuDataPrepare1_ppuData = $d - .label cpuSrc = $f - .label i = $11 - .label cpuData = $f + .label ppuDataPrepare1_ppuData = $c + .label cpuSrc = $e + .label i = $10 + .label cpuData = $e // ppuDataTransfer::ppuDataPrepare1 // >ppuData // [115] (byte~) ppuDataTransfer::ppuDataPrepare1_$0 ← > (nomodify void*) ppuDataTransfer::ppuDataPrepare1_ppuData#0 -- vbuaa=_hi_pvoz1 @@ -6160,11 +6161,11 @@ ppuDataTransfer: { // Fill a number of bytes in the PPU memory // - ppuData : Pointer in the PPU memory // - size : The number of bytes to transfer -// ppuDataFill(word zp($f) size) +// ppuDataFill(word zp($e) size) ppuDataFill: { - .label ppuDataPrepare1_ppuData = $d - .label i = $11 - .label size = $f + .label ppuDataPrepare1_ppuData = $c + .label i = $10 + .label size = $e // ppuDataFill::ppuDataPrepare1 // >ppuData // [128] (byte~) ppuDataFill::ppuDataPrepare1_$0 ← > (nomodify void*) ppuDataFill::ppuDataPrepare1_ppuData#0 -- vbuaa=_hi_pvoz1 @@ -6226,7 +6227,7 @@ rand: { .label __0 = $1c .label __1 = $1e .label __2 = $20 - .label return = $1a + .label return = $19 // rand_state << 7 // [138] (word~) rand::$0 ← (word) rand_state#10 << (byte) 7 -- vwuz1=vwuz2_rol_7 lda.z rand_state+1 diff --git a/src/test/ref/complex/nes-balls/kickballs-2.sym b/src/test/ref/complex/nes-balls/kickballs-2.sym index 68b233077..510774c21 100644 --- a/src/test/ref/complex/nes-balls/kickballs-2.sym +++ b/src/test/ref/complex/nes-balls/kickballs-2.sym @@ -73,18 +73,18 @@ (const struct $0*) balls[(number) $40] = { fill( $40, 0) } (const to_nomodify byte*) h_bar_tilemap[] = { (byte) 1, (byte) 1, (byte) 1, (byte) 1, (byte) 1, (byte) 1, (byte) 1, (byte) 1, (byte) 1, (byte) 1, (byte) 1, (byte) 1, (byte) 1, (byte) 1, (byte) 1, (byte) 1, (byte) 1, (byte) 1, (byte) 1, (byte) 1, (byte) 1, (byte) 1, (byte) 1, (byte) 1, (byte) 1, (byte) 1, (byte) 1, (byte) 1, (byte) 1, (byte) 1, (byte) 1, (byte) 1 } (signed word()) main() -(word~) main::$10 zp[2]:26 101.0 -(word~) main::$11 zp[2]:26 202.0 -(byte~) main::$12 reg byte x 101.0 +(word~) main::$10 zp[2]:25 101.0 +(word~) main::$11 zp[2]:25 202.0 +(byte~) main::$12 zp[1]:27 101.0 (byte~) main::$14 reg byte a 202.0 -(word~) main::$20 zp[2]:13 2002.0 -(word~) main::$23 zp[2]:15 667.3333333333334 -(word~) main::$25 zp[2]:17 667.3333333333334 -(byte~) main::$26 zp[1]:19 1001.0 +(word~) main::$20 zp[2]:12 2002.0 +(word~) main::$23 zp[2]:14 667.3333333333334 +(word~) main::$25 zp[2]:16 667.3333333333334 +(byte~) main::$26 zp[1]:18 1001.0 (byte~) main::$30 reg byte a 1001.0 -(word~) main::$31 zp[2]:20 2002.0 -(word~) main::$32 zp[2]:22 500.5 -(word~) main::$33 zp[2]:24 1001.0 +(word~) main::$31 zp[2]:19 2002.0 +(word~) main::$32 zp[2]:21 500.5 +(word~) main::$33 zp[2]:23 1001.0 (byte~) main::$35 reg byte a 202.0 (byte~) main::$36 reg byte a 202.0 (byte~) main::$38 reg byte x 151.5 @@ -94,8 +94,8 @@ (byte~) main::$48 reg byte x 1001.0 (byte~) main::$50 reg byte y 500.5 (byte~) main::$53 reg byte y 800.8 -(word~) main::$56 zp[2]:20 2002.0 -(word~) main::$9 zp[2]:26 202.0 +(word~) main::$56 zp[2]:19 2002.0 +(word~) main::$9 zp[2]:25 202.0 (label) main::@1 (label) main::@10 (label) main::@11 @@ -122,17 +122,17 @@ (label) main::@8 (label) main::@9 (byte) main::active_balls -(byte) main::active_balls#1 active_balls zp[1]:4 75.75 -(byte) main::active_balls#2 active_balls zp[1]:4 56.11111111111111 -(byte) main::active_balls#8 active_balls zp[1]:4 37.97297297297297 +(byte) main::active_balls#1 active_balls zp[1]:3 75.75 +(byte) main::active_balls#2 active_balls zp[1]:3 56.11111111111111 +(byte) main::active_balls#8 active_balls zp[1]:3 37.97297297297297 (label) main::enableVideoOutput1 (byte) main::h_bar -(byte) main::h_bar#1 h_bar zp[1]:12 72.8409090909091 +(byte) main::h_bar#1 h_bar zp[1]:11 72.8409090909091 (byte) main::i -(byte) main::i#10 i_1 zp[1]:6 258.3225806451613 -(byte) main::i#14 i zp[1]:2 33.666666666666664 -(byte) main::i#2 i zp[1]:2 202.0 -(byte) main::i#4 i_1 zp[1]:6 2002.0 +(byte) main::i#10 i zp[1]:5 258.3225806451613 +(byte) main::i#14 reg byte x 33.666666666666664 +(byte) main::i#2 reg byte x 202.0 +(byte) main::i#4 i zp[1]:5 2002.0 (label) main::initNES1 (label) main::initNES1_@1 (label) main::initNES1_@7 @@ -150,34 +150,34 @@ (label) main::initNES1_waitForVBlank2_@1 (signed word) main::return (byte) main::sprite_idx -(byte) main::sprite_idx#2 sprite_idx zp[1]:7 1001.0 -(byte) main::sprite_idx#3 sprite_idx zp[1]:7 100.1 +(byte) main::sprite_idx#2 sprite_idx zp[1]:6 1001.0 +(byte) main::sprite_idx#3 sprite_idx zp[1]:6 100.1 (byte) main::timer (byte) main::timer#1 reg byte x 101.0 -(byte) main::timer#15 timer zp[1]:5 8.18918918918919 -(byte) main::timer#21 timer zp[1]:5 202.0 -(byte) main::timer#3 timer zp[1]:5 57.714285714285715 +(byte) main::timer#15 timer zp[1]:4 8.18918918918919 +(byte) main::timer#21 timer zp[1]:4 202.0 +(byte) main::timer#3 timer zp[1]:4 57.714285714285715 (byte) main::timer_2 -(byte) main::timer_2#1 timer_2 zp[1]:3 6.183673469387754 -(byte) main::timer_2#2 timer_2 zp[1]:3 202.0 +(byte) main::timer_2#1 timer_2 zp[1]:2 6.183673469387754 +(byte) main::timer_2#2 timer_2 zp[1]:2 202.0 (const to_nomodify byte*) palette[] = { (byte) $34, (byte) $24, (byte) $14, (byte) 4, (byte) $34, (byte) $24, (byte) $14, (byte) 4, (byte) $34, (byte) $24, (byte) $14, (byte) 4, (byte) $34, (byte) $24, (byte) $14, (byte) 4, (byte) $34, (byte) $24, (byte) $14, (byte) 4, (byte) $34, (byte) $24, (byte) $14, (byte) 4, (byte) $34, (byte) $24, (byte) $14, (byte) 4, (byte) $34, (byte) $24, (byte) $14, (byte) 4 } (void()) ppuDataFill((nomodify void*) ppuDataFill::ppuData , (byte) ppuDataFill::val , (word) ppuDataFill::size) (label) ppuDataFill::@1 (label) ppuDataFill::@2 (label) ppuDataFill::@return (word) ppuDataFill::i -(word) ppuDataFill::i#1 i zp[2]:17 2002.0 -(word) ppuDataFill::i#2 i zp[2]:17 1001.0 +(word) ppuDataFill::i#1 i zp[2]:16 2002.0 +(word) ppuDataFill::i#2 i zp[2]:16 1001.0 (nomodify void*) ppuDataFill::ppuData (label) ppuDataFill::ppuDataPrepare1 (byte~) ppuDataFill::ppuDataPrepare1_$0 reg byte a 202.0 (byte~) ppuDataFill::ppuDataPrepare1_$1 reg byte a 202.0 (nomodify void*) ppuDataFill::ppuDataPrepare1_ppuData -(nomodify void*) ppuDataFill::ppuDataPrepare1_ppuData#0 ppuDataPrepare1_ppuData zp[2]:13 67.33333333333333 +(nomodify void*) ppuDataFill::ppuDataPrepare1_ppuData#0 ppuDataPrepare1_ppuData zp[2]:12 67.33333333333333 (label) ppuDataFill::ppuDataPut1 (byte) ppuDataFill::ppuDataPut1_val (word) ppuDataFill::size -(word) ppuDataFill::size#3 size zp[2]:15 111.22222222222223 +(word) ppuDataFill::size#3 size zp[2]:14 111.22222222222223 (byte) ppuDataFill::val (void()) ppuDataTransfer((nomodify void*) ppuDataTransfer::ppuData , (nomodify void*) ppuDataTransfer::cpuData , (word) ppuDataTransfer::size) (label) ppuDataTransfer::@1 @@ -186,20 +186,20 @@ (label) ppuDataTransfer::@4 (label) ppuDataTransfer::@return (nomodify void*) ppuDataTransfer::cpuData -(nomodify void*) ppuDataTransfer::cpuData#2 cpuData zp[2]:15 +(nomodify void*) ppuDataTransfer::cpuData#2 cpuData zp[2]:14 (byte*) ppuDataTransfer::cpuSrc -(byte*) ppuDataTransfer::cpuSrc#1 cpuSrc zp[2]:15 1001.0 -(byte*) ppuDataTransfer::cpuSrc#2 cpuSrc zp[2]:15 776.0 -(byte*) ppuDataTransfer::cpuSrc#6 cpuSrc zp[2]:15 202.0 +(byte*) ppuDataTransfer::cpuSrc#1 cpuSrc zp[2]:14 1001.0 +(byte*) ppuDataTransfer::cpuSrc#2 cpuSrc zp[2]:14 776.0 +(byte*) ppuDataTransfer::cpuSrc#6 cpuSrc zp[2]:14 202.0 (word) ppuDataTransfer::i -(word) ppuDataTransfer::i#1 i zp[2]:17 2002.0 -(word) ppuDataTransfer::i#2 i zp[2]:17 600.5999999999999 +(word) ppuDataTransfer::i#1 i zp[2]:16 2002.0 +(word) ppuDataTransfer::i#2 i zp[2]:16 600.5999999999999 (nomodify void*) ppuDataTransfer::ppuData (label) ppuDataTransfer::ppuDataPrepare1 (byte~) ppuDataTransfer::ppuDataPrepare1_$0 reg byte a 202.0 (byte~) ppuDataTransfer::ppuDataPrepare1_$1 reg byte a 202.0 (nomodify void*) ppuDataTransfer::ppuDataPrepare1_ppuData -(nomodify void*) ppuDataTransfer::ppuDataPrepare1_ppuData#0 ppuDataPrepare1_ppuData zp[2]:13 67.33333333333333 +(nomodify void*) ppuDataTransfer::ppuDataPrepare1_ppuData#0 ppuDataPrepare1_ppuData zp[2]:12 67.33333333333333 (label) ppuDataTransfer::ppuDataPut1 (byte) ppuDataTransfer::ppuDataPut1_val (byte) ppuDataTransfer::ppuDataPut1_val#0 reg byte a 2002.0 @@ -220,57 +220,57 @@ (word~) rand::$2 zp[2]:32 2002.0 (label) rand::@return (word) rand::return -(word) rand::return#0 return zp[2]:26 300.75 -(word) rand::return#2 return zp[2]:26 202.0 -(word) rand::return#3 return zp[2]:26 202.0 +(word) rand::return#0 return zp[2]:25 300.75 +(word) rand::return#2 return zp[2]:25 202.0 +(word) rand::return#3 return zp[2]:25 202.0 (word) rand_state -(word) rand_state#0 rand_state zp[2]:8 1501.5 -(word) rand_state#1 rand_state zp[2]:8 1501.5 -(word) rand_state#10 rand_state zp[2]:8 1102.0 -(word) rand_state#11 rand_state zp[2]:8 137.75 -(word) rand_state#17 rand_state zp[2]:8 67.33333333333333 -(volatile byte) scroll_y loadstore zp[1]:10 105.0 +(word) rand_state#0 rand_state zp[2]:7 1501.5 +(word) rand_state#1 rand_state zp[2]:7 1501.5 +(word) rand_state#10 rand_state zp[2]:7 1102.0 +(word) rand_state#11 rand_state zp[2]:7 137.75 +(word) rand_state#17 rand_state zp[2]:7 67.33333333333333 +(volatile byte) scroll_y loadstore zp[1]:9 105.0 (const to_nomodify byte*) sine_table[(number) $100] = { (byte) $40, (byte) $42, (byte) $43, (byte) $45, (byte) $46, (byte) $48, (byte) $49, (byte) $4b, (byte) $4c, (byte) $4e, (byte) $50, (byte) $51, (byte) $53, (byte) $54, (byte) $56, (byte) $57, (byte) $58, (byte) $5a, (byte) $5b, (byte) $5d, (byte) $5e, (byte) $60, (byte) $61, (byte) $62, (byte) $64, (byte) $65, (byte) $66, (byte) $67, (byte) $69, (byte) $6a, (byte) $6b, (byte) $6c, (byte) $6d, (byte) $6e, (byte) $6f, (byte) $70, (byte) $71, (byte) $72, (byte) $73, (byte) $74, (byte) $75, (byte) $76, (byte) $77, (byte) $78, (byte) $78, (byte) $79, (byte) $7a, (byte) $7b, (byte) $7b, (byte) $7c, (byte) $7c, (byte) $7d, (byte) $7d, (byte) $7e, (byte) $7e, (byte) $7e, (byte) $7f, (byte) $7f, (byte) $7f, (byte) $80, (byte) $80, (byte) $80, (byte) $80, (byte) $80, (byte) $80, (byte) $80, (byte) $80, (byte) $80, (byte) $80, (byte) $80, (byte) $7f, (byte) $7f, (byte) $7f, (byte) $7e, (byte) $7e, (byte) $7e, (byte) $7d, (byte) $7d, (byte) $7c, (byte) $7c, (byte) $7b, (byte) $7b, (byte) $7a, (byte) $79, (byte) $78, (byte) $78, (byte) $77, (byte) $76, (byte) $75, (byte) $74, (byte) $73, (byte) $72, (byte) $71, (byte) $70, (byte) $6f, (byte) $6e, (byte) $6d, (byte) $6c, (byte) $6b, (byte) $6a, (byte) $69, (byte) $67, (byte) $66, (byte) $65, (byte) $64, (byte) $62, (byte) $61, (byte) $60, (byte) $5e, (byte) $5d, (byte) $5b, (byte) $5a, (byte) $58, (byte) $57, (byte) $56, (byte) $54, (byte) $53, (byte) $51, (byte) $50, (byte) $4e, (byte) $4c, (byte) $4b, (byte) $49, (byte) $48, (byte) $46, (byte) $45, (byte) $43, (byte) $42, (byte) $40, (byte) $3e, (byte) $3d, (byte) $3b, (byte) $3a, (byte) $38, (byte) $37, (byte) $35, (byte) $34, (byte) $32, (byte) $30, (byte) $2f, (byte) $2d, (byte) $2c, (byte) $2a, (byte) $29, (byte) $28, (byte) $26, (byte) $25, (byte) $23, (byte) $22, (byte) $20, (byte) $1f, (byte) $1e, (byte) $1c, (byte) $1b, (byte) $1a, (byte) $19, (byte) $17, (byte) $16, (byte) $15, (byte) $14, (byte) $13, (byte) $12, (byte) $11, (byte) $10, (byte) $f, (byte) $e, (byte) $d, (byte) $c, (byte) $b, (byte) $a, (byte) 9, (byte) 8, (byte) 8, (byte) 7, (byte) 6, (byte) 5, (byte) 5, (byte) 4, (byte) 4, (byte) 3, (byte) 3, (byte) 2, (byte) 2, (byte) 2, (byte) 1, (byte) 1, (byte) 1, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 1, (byte) 1, (byte) 1, (byte) 2, (byte) 2, (byte) 2, (byte) 3, (byte) 3, (byte) 4, (byte) 4, (byte) 5, (byte) 5, (byte) 6, (byte) 7, (byte) 8, (byte) 8, (byte) 9, (byte) $a, (byte) $b, (byte) $c, (byte) $d, (byte) $e, (byte) $f, (byte) $10, (byte) $11, (byte) $12, (byte) $13, (byte) $14, (byte) $15, (byte) $16, (byte) $17, (byte) $19, (byte) $1a, (byte) $1b, (byte) $1c, (byte) $1e, (byte) $1f, (byte) $20, (byte) $22, (byte) $23, (byte) $25, (byte) $26, (byte) $28, (byte) $29, (byte) $2a, (byte) $2c, (byte) $2d, (byte) $2f, (byte) $30, (byte) $32, (byte) $34, (byte) $35, (byte) $37, (byte) $38, (byte) $3a, (byte) $3b, (byte) $3d, (byte) $3e } interrupt(HARDWARE_STACK)(void()) vblank() (label) vblank::@1 (label) vblank::@return (label) vblank::ppuSpriteBufferDmaTransfer1 (struct SpriteData*) vblank::ppuSpriteBufferDmaTransfer1_spriteBuffer -(volatile byte) vblank_hit loadstore zp[1]:11 10.25925925925926 +(volatile byte) vblank_hit loadstore zp[1]:10 10.25925925925926 reg byte x [ main::initNES1_i#2 main::initNES1_i#1 ] -zp[1]:2 [ main::i#14 main::i#2 ] -zp[1]:3 [ main::timer_2#2 main::timer_2#1 ] -zp[1]:4 [ main::active_balls#2 main::active_balls#8 main::active_balls#1 ] -zp[1]:5 [ main::timer#3 main::timer#15 main::timer#21 ] -zp[1]:6 [ main::i#10 main::i#4 ] -zp[1]:7 [ main::sprite_idx#3 main::sprite_idx#2 ] -zp[2]:8 [ rand_state#10 rand_state#17 rand_state#11 rand_state#0 rand_state#1 ] -zp[1]:10 [ scroll_y ] -zp[1]:11 [ vblank_hit ] +reg byte x [ main::i#14 main::i#2 ] +zp[1]:2 [ main::timer_2#2 main::timer_2#1 ] +zp[1]:3 [ main::active_balls#2 main::active_balls#8 main::active_balls#1 ] +zp[1]:4 [ main::timer#3 main::timer#15 main::timer#21 ] +zp[1]:5 [ main::i#10 main::i#4 ] +zp[1]:6 [ main::sprite_idx#3 main::sprite_idx#2 ] +zp[2]:7 [ rand_state#10 rand_state#17 rand_state#11 rand_state#0 rand_state#1 ] +zp[1]:9 [ scroll_y ] +zp[1]:10 [ vblank_hit ] reg byte a [ main::initNES1_waitForVBlank1_$0 ] reg byte a [ main::initNES1_waitForVBlank2_$0 ] -zp[1]:12 [ main::h_bar#1 ] +zp[1]:11 [ main::h_bar#1 ] reg byte a [ main::$14 ] reg byte x [ main::timer#1 ] reg byte x [ main::$38 ] reg byte y [ main::$40 ] -zp[2]:13 [ main::$20 ppuDataFill::ppuDataPrepare1_ppuData#0 ppuDataTransfer::ppuDataPrepare1_ppuData#0 ] +zp[2]:12 [ main::$20 ppuDataFill::ppuDataPrepare1_ppuData#0 ppuDataTransfer::ppuDataPrepare1_ppuData#0 ] reg byte a [ main::$45 ] reg byte y [ main::$44 ] -zp[2]:15 [ main::$23 ppuDataFill::size#3 ppuDataTransfer::cpuData#2 ppuDataTransfer::cpuSrc#2 ppuDataTransfer::cpuSrc#6 ppuDataTransfer::cpuSrc#1 ] -zp[2]:17 [ main::$25 ppuDataFill::i#2 ppuDataFill::i#1 ppuDataTransfer::i#2 ppuDataTransfer::i#1 ] -zp[1]:19 [ main::$26 ] +zp[2]:14 [ main::$23 ppuDataFill::size#3 ppuDataTransfer::cpuData#2 ppuDataTransfer::cpuSrc#2 ppuDataTransfer::cpuSrc#6 ppuDataTransfer::cpuSrc#1 ] +zp[2]:16 [ main::$25 ppuDataFill::i#2 ppuDataFill::i#1 ppuDataTransfer::i#2 ppuDataTransfer::i#1 ] +zp[1]:18 [ main::$26 ] reg byte y [ main::$53 ] reg byte a [ main::$30 ] -zp[2]:20 [ main::$56 main::$31 ] +zp[2]:19 [ main::$56 main::$31 ] reg byte y [ main::$50 ] -zp[2]:22 [ main::$32 ] +zp[2]:21 [ main::$32 ] reg byte x [ main::$48 ] -zp[2]:24 [ main::$33 ] -zp[2]:26 [ rand::return#2 main::$9 rand::return#0 main::$10 rand::return#3 main::$11 ] +zp[2]:23 [ main::$33 ] +zp[2]:25 [ rand::return#2 main::$9 rand::return#0 main::$10 rand::return#3 main::$11 ] reg byte a [ main::$35 ] -reg byte x [ main::$12 ] +zp[1]:27 [ main::$12 ] reg byte a [ main::$36 ] reg byte a [ ppuDataTransfer::ppuDataPrepare1_$0 ] reg byte a [ ppuDataTransfer::ppuDataPrepare1_$1 ] diff --git a/src/test/ref/complex/prebob/vogel-sprites.asm b/src/test/ref/complex/prebob/vogel-sprites.asm index d1c93e114..287792016 100644 --- a/src/test/ref/complex/prebob/vogel-sprites.asm +++ b/src/test/ref/complex/prebob/vogel-sprites.asm @@ -101,6 +101,8 @@ init: { tay txa sta PLEX_XPOS,y + lda #0 + sta PLEX_XPOS+1,y // i*8 lda.z i asl @@ -199,6 +201,8 @@ loop: { tay txa sta PLEX_XPOS,y + lda #0 + sta PLEX_XPOS+1,y // mulf8s(r, SIN[a]) lda.z r ldy.z a diff --git a/src/test/ref/complex/prebob/vogel-sprites.log b/src/test/ref/complex/prebob/vogel-sprites.log index 941c36ae2..b192c46c5 100644 --- a/src/test/ref/complex/prebob/vogel-sprites.log +++ b/src/test/ref/complex/prebob/vogel-sprites.log @@ -3381,11 +3381,11 @@ init: { asl sta.z __9 // [24] *((const word*) PLEX_XPOS + (byte~) init::$9) ← (byte~) init::$4 -- pwuc1_derefidx_vbuz1=vbuz2 - lda.z __9 - ldx.z __4 - tay - txa + lda.z __4 + ldy.z __9 sta PLEX_XPOS,y + lda #0 + sta PLEX_XPOS+1,y // [25] (byte~) init::$5 ← (byte) init::i#2 << (byte) 3 -- vbuz1=vbuz2_rol_3 lda.z i asl @@ -3576,11 +3576,11 @@ loop: { asl sta.z __20 // [56] *((const word*) PLEX_XPOS + (byte~) loop::$20) ← (byte~) loop::$4 -- pwuc1_derefidx_vbuz1=vbuz2 - lda.z __20 - ldx.z __4 - tay - txa + lda.z __4 + ldy.z __20 sta PLEX_XPOS,y + lda #0 + sta PLEX_XPOS+1,y // [57] (signed byte) mulf8s::a#1 ← (signed byte) loop::r#2 -- vbsz1=vbsz2 lda.z r sta.z mulf8s.a @@ -5057,97 +5057,97 @@ Uplift Scope [MOS6581_SID] Uplift Scope [main] Uplift Scope [__start] -Uplifting [plexSort] best 105188 combination reg byte x [ plexSort::s#3 plexSort::s#1 plexSort::s#6 ] reg byte x [ plexSort::plexFreePrepare1_s#2 plexSort::plexFreePrepare1_s#1 ] reg byte x [ plexSort::s#2 ] zp[1]:28 [ plexSort::m#2 plexSort::m#1 ] zp[1]:76 [ plexSort::nxt_y#0 ] zp[1]:75 [ plexSort::nxt_idx#0 ] +Uplifting [plexSort] best 105518 combination reg byte x [ plexSort::s#3 plexSort::s#1 plexSort::s#6 ] reg byte x [ plexSort::plexFreePrepare1_s#2 plexSort::plexFreePrepare1_s#1 ] reg byte x [ plexSort::s#2 ] zp[1]:28 [ plexSort::m#2 plexSort::m#1 ] zp[1]:76 [ plexSort::nxt_y#0 ] zp[1]:75 [ plexSort::nxt_idx#0 ] Limited combination testing to 100 combinations of 972 possible. -Uplifting [mulf8u_prepared] best 105182 combination reg byte a [ mulf8u_prepared::b#0 ] zp[2]:101 [ mulf8u_prepared::return#0 ] zp[2]:94 [ mulf8u_prepared::return#2 ] -Uplifting [mulf8s_prepared] best 105158 combination zp[2]:31 [ mulf8s_prepared::m#4 mulf8s_prepared::m#5 mulf8s_prepared::m#1 mulf8s_prepared::m#0 mulf8s_prepared::m#2 ] reg byte a [ mulf8s_prepared::$6 ] reg byte a [ mulf8s_prepared::$11 ] reg byte a [ mulf8s_prepared::$9 ] reg byte a [ mulf8s_prepared::$12 ] zp[1]:72 [ mulf8s_prepared::b#0 ] +Uplifting [mulf8u_prepared] best 105512 combination reg byte a [ mulf8u_prepared::b#0 ] zp[2]:101 [ mulf8u_prepared::return#0 ] zp[2]:94 [ mulf8u_prepared::return#2 ] +Uplifting [mulf8s_prepared] best 105488 combination zp[2]:31 [ mulf8s_prepared::m#4 mulf8s_prepared::m#5 mulf8s_prepared::m#1 mulf8s_prepared::m#0 mulf8s_prepared::m#2 ] reg byte a [ mulf8s_prepared::$6 ] reg byte a [ mulf8s_prepared::$11 ] reg byte a [ mulf8s_prepared::$9 ] reg byte a [ mulf8s_prepared::$12 ] zp[1]:72 [ mulf8s_prepared::b#0 ] Limited combination testing to 100 combinations of 512 possible. -Uplifting [plexShowSprite] best 105138 combination reg byte a [ plexShowSprite::plexFreeAdd1_$0 ] reg byte a [ plexShowSprite::plexFreeAdd1_$1 ] reg byte a [ plexShowSprite::plexFreeAdd1_$2 ] reg byte a [ plexShowSprite::xpos_idx#0 ] zp[1]:85 [ plexShowSprite::$2 ] zp[1]:86 [ plexShowSprite::$3 ] zp[1]:87 [ plexShowSprite::$9 ] zp[1]:88 [ plexShowSprite::$5 ] zp[1]:89 [ plexShowSprite::$6 ] zp[1]:79 [ plexShowSprite::plexFreeAdd1_ypos#0 ] zp[1]:84 [ plexShowSprite::$11 ] zp[1]:78 [ plexShowSprite::plex_sprite_idx2#0 ] +Uplifting [plexShowSprite] best 105468 combination reg byte a [ plexShowSprite::plexFreeAdd1_$0 ] reg byte a [ plexShowSprite::plexFreeAdd1_$1 ] reg byte a [ plexShowSprite::plexFreeAdd1_$2 ] reg byte a [ plexShowSprite::xpos_idx#0 ] zp[1]:85 [ plexShowSprite::$2 ] zp[1]:86 [ plexShowSprite::$3 ] zp[1]:87 [ plexShowSprite::$9 ] zp[1]:88 [ plexShowSprite::$5 ] zp[1]:89 [ plexShowSprite::$6 ] zp[1]:79 [ plexShowSprite::plexFreeAdd1_ypos#0 ] zp[1]:84 [ plexShowSprite::$11 ] zp[1]:78 [ plexShowSprite::plex_sprite_idx2#0 ] Limited combination testing to 100 combinations of 1572864 possible. -Uplifting [mulf8u_prepare] best 105132 combination reg byte a [ mulf8u_prepare::a#0 ] -Uplifting [loop] best 103332 combination zp[1]:63 [ loop::plexFreeNextYpos1_return#0 ] zp[2]:45 [ loop::$1 ] zp[2]:47 [ loop::$2 ] zp[2]:49 [ loop::x#0 ] reg byte a [ loop::$20 ] zp[2]:55 [ loop::$5 ] zp[2]:57 [ loop::$6 ] zp[2]:59 [ loop::y#0 ] reg byte a [ loop::$8 ] reg byte a [ loop::$11 ] zp[1]:8 [ loop::i1#5 loop::i1#1 ] zp[1]:7 [ loop::i#2 loop::i#1 ] zp[1]:51 [ loop::$4 ] zp[1]:6 [ loop::a#2 loop::a#1 loop::a#6 ] zp[1]:5 [ loop::r#2 loop::r#1 ] zp[1]:65 [ loop::$18 ] zp[1]:4 [ loop::angle#6 loop::angle#1 ] +Uplifting [mulf8u_prepare] best 105462 combination reg byte a [ mulf8u_prepare::a#0 ] +Uplifting [loop] best 103862 combination zp[1]:63 [ loop::plexFreeNextYpos1_return#0 ] zp[2]:45 [ loop::$1 ] zp[2]:47 [ loop::$2 ] zp[2]:49 [ loop::x#0 ] reg byte a [ loop::$20 ] zp[2]:55 [ loop::$5 ] zp[2]:57 [ loop::$6 ] zp[2]:59 [ loop::y#0 ] reg byte a [ loop::$8 ] reg byte a [ loop::$11 ] zp[1]:8 [ loop::i1#5 loop::i1#1 ] zp[1]:7 [ loop::i#2 loop::i#1 ] zp[1]:51 [ loop::$4 ] zp[1]:6 [ loop::a#2 loop::a#1 loop::a#6 ] zp[1]:5 [ loop::r#2 loop::r#1 ] zp[1]:65 [ loop::$18 ] zp[1]:4 [ loop::angle#6 loop::angle#1 ] Limited combination testing to 100 combinations of 24576 possible. -Uplifting [mulf_init] best 103082 combination zp[2]:22 [ mulf_init::sqr#3 mulf_init::sqr#4 mulf_init::sqr#1 mulf_init::sqr#2 ] zp[2]:16 [ mulf_init::sqr2_lo#2 mulf_init::sqr2_lo#1 ] zp[2]:10 [ 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]:18 [ mulf_init::x_255#2 mulf_init::x_255#1 ] zp[1]:21 [ mulf_init::dir#2 mulf_init::dir#4 ] zp[1]:12 [ mulf_init::c#2 mulf_init::c#1 ] zp[2]:19 [ mulf_init::sqr2_hi#2 mulf_init::sqr2_hi#1 ] zp[2]:13 [ mulf_init::sqr1_hi#2 mulf_init::sqr1_hi#1 ] +Uplifting [mulf_init] best 103612 combination zp[2]:22 [ mulf_init::sqr#3 mulf_init::sqr#4 mulf_init::sqr#1 mulf_init::sqr#2 ] zp[2]:16 [ mulf_init::sqr2_lo#2 mulf_init::sqr2_lo#1 ] zp[2]:10 [ 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]:18 [ mulf_init::x_255#2 mulf_init::x_255#1 ] zp[1]:21 [ mulf_init::dir#2 mulf_init::dir#4 ] zp[1]:12 [ mulf_init::c#2 mulf_init::c#1 ] zp[2]:19 [ mulf_init::sqr2_hi#2 mulf_init::sqr2_hi#1 ] zp[2]:13 [ mulf_init::sqr1_hi#2 mulf_init::sqr1_hi#1 ] Limited combination testing to 100 combinations of 1024 possible. -Uplifting [mulf8s] best 101876 combination reg byte x [ mulf8s::b#2 mulf8s::b#1 mulf8s::b#0 ] reg byte a [ mulf8s::mulf8s_prepare1_a#0 mulf8s::a#1 mulf8s::a#0 ] zp[2]:73 [ mulf8s::return#0 ] zp[2]:43 [ mulf8s::return#2 ] zp[2]:53 [ mulf8s::return#3 ] -Uplifting [keyboard_matrix_read] best 101864 combination reg byte a [ keyboard_matrix_read::return#0 ] reg byte a [ keyboard_matrix_read::return#2 ] -Uplifting [] best 101864 combination zp[1]:35 [ plex_sprite_msb ] zp[1]:33 [ plex_show_idx ] zp[1]:34 [ plex_sprite_idx ] zp[1]:36 [ plex_free_next ] -Uplifting [plexInit] best 101744 combination reg byte x [ plexInit::i#2 plexInit::i#1 ] -Uplifting [memset] best 101744 combination zp[2]:24 [ memset::dst#2 memset::dst#1 ] -Uplifting [keyboard_key_pressed] best 101555 combination reg byte a [ keyboard_key_pressed::$2 ] reg byte a [ keyboard_key_pressed::return#0 ] reg byte a [ keyboard_key_pressed::return#3 ] reg byte a [ keyboard_key_pressed::return#2 ] +Uplifting [mulf8s] best 102406 combination reg byte x [ mulf8s::b#2 mulf8s::b#1 mulf8s::b#0 ] reg byte a [ mulf8s::mulf8s_prepare1_a#0 mulf8s::a#1 mulf8s::a#0 ] zp[2]:73 [ mulf8s::return#0 ] zp[2]:43 [ mulf8s::return#2 ] zp[2]:53 [ mulf8s::return#3 ] +Uplifting [keyboard_matrix_read] best 102394 combination reg byte a [ keyboard_matrix_read::return#0 ] reg byte a [ keyboard_matrix_read::return#2 ] +Uplifting [] best 102394 combination zp[1]:35 [ plex_sprite_msb ] zp[1]:33 [ plex_show_idx ] zp[1]:34 [ plex_sprite_idx ] zp[1]:36 [ plex_free_next ] +Uplifting [plexInit] best 102274 combination reg byte x [ plexInit::i#2 plexInit::i#1 ] +Uplifting [memset] best 102274 combination zp[2]:24 [ memset::dst#2 memset::dst#1 ] +Uplifting [keyboard_key_pressed] best 102085 combination reg byte a [ keyboard_key_pressed::$2 ] reg byte a [ keyboard_key_pressed::return#0 ] reg byte a [ keyboard_key_pressed::return#3 ] reg byte a [ keyboard_key_pressed::return#2 ] Limited combination testing to 100 combinations of 256 possible. -Uplifting [init] best 101335 combination reg byte x [ init::i1#2 init::i1#1 ] zp[1]:2 [ init::i#2 init::i#1 ] reg byte a [ init::$10 ] reg byte a [ init::$3 ] zp[1]:40 [ init::$9 ] zp[1]:41 [ init::$5 ] zp[1]:42 [ init::$6 ] zp[1]:39 [ init::$4 ] +Uplifting [init] best 101865 combination reg byte x [ init::i1#2 init::i1#1 ] zp[1]:2 [ init::i#2 init::i#1 ] reg byte a [ init::$10 ] reg byte a [ init::$3 ] zp[1]:40 [ init::$9 ] zp[1]:41 [ init::$5 ] zp[1]:42 [ init::$6 ] zp[1]:39 [ init::$4 ] Limited combination testing to 100 combinations of 27648 possible. -Uplifting [exit] best 101275 combination reg byte a [ exit::$0 ] -Uplifting [MOS6526_CIA] best 101275 combination -Uplifting [MOS6569_VICII] best 101275 combination -Uplifting [MOS6581_SID] best 101275 combination -Uplifting [main] best 101275 combination -Uplifting [__start] best 101275 combination +Uplifting [exit] best 101805 combination reg byte a [ exit::$0 ] +Uplifting [MOS6526_CIA] best 101805 combination +Uplifting [MOS6569_VICII] best 101805 combination +Uplifting [MOS6581_SID] best 101805 combination +Uplifting [main] best 101805 combination +Uplifting [__start] best 101805 combination Attempting to uplift remaining variables inzp[1]:28 [ plexSort::m#2 plexSort::m#1 ] -Uplifting [plexSort] best 101275 combination zp[1]:28 [ plexSort::m#2 plexSort::m#1 ] +Uplifting [plexSort] best 101805 combination zp[1]:28 [ plexSort::m#2 plexSort::m#1 ] Attempting to uplift remaining variables inzp[1]:76 [ plexSort::nxt_y#0 ] -Uplifting [plexSort] best 101275 combination zp[1]:76 [ plexSort::nxt_y#0 ] +Uplifting [plexSort] best 101805 combination zp[1]:76 [ plexSort::nxt_y#0 ] Attempting to uplift remaining variables inzp[1]:75 [ plexSort::nxt_idx#0 ] -Uplifting [plexSort] best 101275 combination zp[1]:75 [ plexSort::nxt_idx#0 ] +Uplifting [plexSort] best 101805 combination zp[1]:75 [ plexSort::nxt_idx#0 ] Attempting to uplift remaining variables inzp[1]:85 [ plexShowSprite::$2 ] -Uplifting [plexShowSprite] best 101269 combination reg byte a [ plexShowSprite::$2 ] +Uplifting [plexShowSprite] best 101799 combination reg byte a [ plexShowSprite::$2 ] Attempting to uplift remaining variables inzp[1]:86 [ plexShowSprite::$3 ] -Uplifting [plexShowSprite] best 101263 combination reg byte a [ plexShowSprite::$3 ] +Uplifting [plexShowSprite] best 101793 combination reg byte a [ plexShowSprite::$3 ] Attempting to uplift remaining variables inzp[1]:87 [ plexShowSprite::$9 ] -Uplifting [plexShowSprite] best 101257 combination reg byte a [ plexShowSprite::$9 ] +Uplifting [plexShowSprite] best 101787 combination reg byte a [ plexShowSprite::$9 ] Attempting to uplift remaining variables inzp[1]:88 [ plexShowSprite::$5 ] -Uplifting [plexShowSprite] best 101251 combination reg byte x [ plexShowSprite::$5 ] +Uplifting [plexShowSprite] best 101781 combination reg byte x [ plexShowSprite::$5 ] Attempting to uplift remaining variables inzp[1]:89 [ plexShowSprite::$6 ] -Uplifting [plexShowSprite] best 101247 combination reg byte a [ plexShowSprite::$6 ] +Uplifting [plexShowSprite] best 101777 combination reg byte a [ plexShowSprite::$6 ] Attempting to uplift remaining variables inzp[1]:79 [ plexShowSprite::plexFreeAdd1_ypos#0 ] -Uplifting [plexShowSprite] best 101238 combination reg byte a [ plexShowSprite::plexFreeAdd1_ypos#0 ] +Uplifting [plexShowSprite] best 101768 combination reg byte a [ plexShowSprite::plexFreeAdd1_ypos#0 ] Attempting to uplift remaining variables inzp[1]:72 [ mulf8s_prepared::b#0 ] -Uplifting [mulf8s_prepared] best 101238 combination zp[1]:72 [ mulf8s_prepared::b#0 ] +Uplifting [mulf8s_prepared] best 101768 combination zp[1]:72 [ mulf8s_prepared::b#0 ] Attempting to uplift remaining variables inzp[1]:84 [ plexShowSprite::$11 ] -Uplifting [plexShowSprite] best 101231 combination reg byte x [ plexShowSprite::$11 ] +Uplifting [plexShowSprite] best 101761 combination reg byte x [ plexShowSprite::$11 ] Attempting to uplift remaining variables inzp[1]:63 [ loop::plexFreeNextYpos1_return#0 ] -Uplifting [loop] best 101231 combination zp[1]:63 [ loop::plexFreeNextYpos1_return#0 ] +Uplifting [loop] best 101761 combination zp[1]:63 [ loop::plexFreeNextYpos1_return#0 ] Attempting to uplift remaining variables inzp[1]:78 [ plexShowSprite::plex_sprite_idx2#0 ] -Uplifting [plexShowSprite] best 101231 combination zp[1]:78 [ plexShowSprite::plex_sprite_idx2#0 ] +Uplifting [plexShowSprite] best 101761 combination zp[1]:78 [ plexShowSprite::plex_sprite_idx2#0 ] Attempting to uplift remaining variables inzp[1]:8 [ loop::i1#5 loop::i1#1 ] -Uplifting [loop] best 101231 combination zp[1]:8 [ loop::i1#5 loop::i1#1 ] +Uplifting [loop] best 101761 combination zp[1]:8 [ loop::i1#5 loop::i1#1 ] Attempting to uplift remaining variables inzp[1]:7 [ loop::i#2 loop::i#1 ] -Uplifting [loop] best 101231 combination zp[1]:7 [ loop::i#2 loop::i#1 ] +Uplifting [loop] best 101761 combination zp[1]:7 [ loop::i#2 loop::i#1 ] Attempting to uplift remaining variables inzp[1]:18 [ mulf_init::x_255#2 mulf_init::x_255#1 ] -Uplifting [mulf_init] best 101091 combination reg byte x [ mulf_init::x_255#2 mulf_init::x_255#1 ] +Uplifting [mulf_init] best 101621 combination reg byte x [ mulf_init::x_255#2 mulf_init::x_255#1 ] Attempting to uplift remaining variables inzp[1]:21 [ mulf_init::dir#2 mulf_init::dir#4 ] -Uplifting [mulf_init] best 101091 combination zp[1]:21 [ mulf_init::dir#2 mulf_init::dir#4 ] +Uplifting [mulf_init] best 101621 combination zp[1]:21 [ mulf_init::dir#2 mulf_init::dir#4 ] Attempting to uplift remaining variables inzp[1]:35 [ plex_sprite_msb ] -Uplifting [] best 101091 combination zp[1]:35 [ plex_sprite_msb ] +Uplifting [] best 101621 combination zp[1]:35 [ plex_sprite_msb ] Attempting to uplift remaining variables inzp[1]:12 [ mulf_init::c#2 mulf_init::c#1 ] -Uplifting [mulf_init] best 101091 combination zp[1]:12 [ mulf_init::c#2 mulf_init::c#1 ] +Uplifting [mulf_init] best 101621 combination zp[1]:12 [ mulf_init::c#2 mulf_init::c#1 ] Attempting to uplift remaining variables inzp[1]:33 [ plex_show_idx ] -Uplifting [] best 101091 combination zp[1]:33 [ plex_show_idx ] +Uplifting [] best 101621 combination zp[1]:33 [ plex_show_idx ] Attempting to uplift remaining variables inzp[1]:51 [ loop::$4 ] -Uplifting [loop] best 100491 combination reg byte x [ loop::$4 ] +Uplifting [loop] best 101221 combination reg byte x [ loop::$4 ] Attempting to uplift remaining variables inzp[1]:6 [ loop::a#2 loop::a#1 loop::a#6 ] -Uplifting [loop] best 100491 combination zp[1]:6 [ loop::a#2 loop::a#1 loop::a#6 ] +Uplifting [loop] best 101221 combination zp[1]:6 [ loop::a#2 loop::a#1 loop::a#6 ] Attempting to uplift remaining variables inzp[1]:34 [ plex_sprite_idx ] -Uplifting [] best 100491 combination zp[1]:34 [ plex_sprite_idx ] +Uplifting [] best 101221 combination zp[1]:34 [ plex_sprite_idx ] Attempting to uplift remaining variables inzp[1]:5 [ loop::r#2 loop::r#1 ] -Uplifting [loop] best 100491 combination zp[1]:5 [ loop::r#2 loop::r#1 ] +Uplifting [loop] best 101221 combination zp[1]:5 [ loop::r#2 loop::r#1 ] Attempting to uplift remaining variables inzp[1]:36 [ plex_free_next ] -Uplifting [] best 100491 combination zp[1]:36 [ plex_free_next ] +Uplifting [] best 101221 combination zp[1]:36 [ plex_free_next ] Attempting to uplift remaining variables inzp[1]:2 [ init::i#2 init::i#1 ] -Uplifting [init] best 100491 combination zp[1]:2 [ init::i#2 init::i#1 ] +Uplifting [init] best 101221 combination zp[1]:2 [ init::i#2 init::i#1 ] Attempting to uplift remaining variables inzp[1]:40 [ init::$9 ] -Uplifting [init] best 100431 combination reg byte a [ init::$9 ] +Uplifting [init] best 101181 combination reg byte a [ init::$9 ] Attempting to uplift remaining variables inzp[1]:41 [ init::$5 ] -Uplifting [init] best 100391 combination reg byte a [ init::$5 ] +Uplifting [init] best 101141 combination reg byte a [ init::$5 ] Attempting to uplift remaining variables inzp[1]:42 [ init::$6 ] -Uplifting [init] best 100331 combination reg byte a [ init::$6 ] +Uplifting [init] best 101081 combination reg byte a [ init::$6 ] Attempting to uplift remaining variables inzp[1]:65 [ loop::$18 ] -Uplifting [loop] best 100271 combination reg byte a [ loop::$18 ] +Uplifting [loop] best 101021 combination reg byte a [ loop::$18 ] Attempting to uplift remaining variables inzp[1]:39 [ init::$4 ] -Uplifting [init] best 100211 combination reg byte x [ init::$4 ] +Uplifting [init] best 100981 combination reg byte x [ init::$4 ] Attempting to uplift remaining variables inzp[1]:4 [ loop::angle#6 loop::angle#1 ] -Uplifting [loop] best 100211 combination zp[1]:4 [ loop::angle#6 loop::angle#1 ] +Uplifting [loop] best 100981 combination zp[1]:4 [ loop::angle#6 loop::angle#1 ] Coalescing zero page register [ zp[2]:31 [ mulf8s_prepared::m#4 mulf8s_prepared::m#5 mulf8s_prepared::m#1 mulf8s_prepared::m#0 mulf8s_prepared::m#2 ] ] with [ zp[2]:73 [ mulf8s::return#0 ] ] - score: 1 Coalescing zero page register [ zp[2]:31 [ mulf8s_prepared::m#4 mulf8s_prepared::m#5 mulf8s_prepared::m#1 mulf8s_prepared::m#0 mulf8s_prepared::m#2 mulf8s::return#0 ] ] with [ zp[2]:94 [ mulf8u_prepared::return#2 ] ] - score: 1 Coalescing zero page register [ zp[2]:43 [ mulf8s::return#2 ] ] with [ zp[2]:45 [ loop::$1 ] ] - score: 1 @@ -5342,6 +5342,8 @@ init: { tay txa sta PLEX_XPOS,y + lda #0 + sta PLEX_XPOS+1,y // [25] (byte~) init::$5 ← (byte) init::i#2 << (byte) 3 -- vbuaa=vbuz1_rol_3 lda.z i asl @@ -5508,6 +5510,8 @@ loop: { tay txa sta PLEX_XPOS,y + lda #0 + sta PLEX_XPOS+1,y // [57] (signed byte) mulf8s::a#1 ← (signed byte) loop::r#2 -- vbsaa=vbsz1 lda.z r // [58] (signed byte) mulf8s::b#1 ← *((const signed byte*) SIN + (byte) loop::a#2) -- vbsxx=pbsc1_derefidx_vbuz1 @@ -7150,7 +7154,7 @@ reg byte a [ keyboard_matrix_read::return#0 ] FINAL ASSEMBLER -Score: 74020 +Score: 74790 // File Comments // Same animation using a multiplexer @@ -7299,6 +7303,8 @@ init: { tay txa sta PLEX_XPOS,y + lda #0 + sta PLEX_XPOS+1,y // i*8 // [25] (byte~) init::$5 ← (byte) init::i#2 << (byte) 3 -- vbuaa=vbuz1_rol_3 lda.z i @@ -7455,6 +7461,8 @@ loop: { tay txa sta PLEX_XPOS,y + lda #0 + sta PLEX_XPOS+1,y // mulf8s(r, SIN[a]) // [57] (signed byte) mulf8s::a#1 ← (signed byte) loop::r#2 -- vbsaa=vbsz1 lda.z r diff --git a/src/test/ref/index-sizeof-reuse-2.asm b/src/test/ref/index-sizeof-reuse-2.asm index 3c8c6873e..7ecd489b5 100644 --- a/src/test/ref/index-sizeof-reuse-2.asm +++ b/src/test/ref/index-sizeof-reuse-2.asm @@ -62,10 +62,10 @@ main: { // entities[i] =0 lda.z i asl - ldx #0 tay - txa + lda #0 sta entities,y + sta entities+1,y __b6: // line[entities[i]] = '*' lda.z i diff --git a/src/test/ref/index-sizeof-reuse-2.log b/src/test/ref/index-sizeof-reuse-2.log index fd62fb6cd..48304d237 100644 --- a/src/test/ref/index-sizeof-reuse-2.log +++ b/src/test/ref/index-sizeof-reuse-2.log @@ -393,11 +393,11 @@ main: { asl sta.z __8 // [12] *((const word*) entities + (byte~) main::$8) ← (byte) 0 -- pwuc1_derefidx_vbuz1=vbuc2 - lda.z __8 - ldx #0 - tay - txa + lda #0 + ldy.z __8 sta entities,y + lda #0 + sta entities+1,y jmp __b6 // main::@6 __b6: @@ -481,13 +481,13 @@ REGISTER UPLIFT SCOPES Uplift Scope [main] 248.62: zp[1]:2 [ main::i#2 main::i#1 ] 202: zp[1]:6 [ main::$9 ] 202: zp[1]:7 [ main::$8 ] 202: zp[1]:8 [ main::$7 ] 202: zp[2]:9 [ main::$11 ] 134.67: zp[2]:3 [ main::line#2 main::line#1 ] 101: zp[1]:5 [ main::$5 ] Uplift Scope [] -Uplifting [main] best 19305 combination zp[1]:2 [ main::i#2 main::i#1 ] reg byte a [ main::$9 ] reg byte a [ main::$8 ] reg byte a [ main::$7 ] zp[2]:9 [ main::$11 ] zp[2]:3 [ main::line#2 main::line#1 ] zp[1]:5 [ main::$5 ] +Uplifting [main] best 19805 combination zp[1]:2 [ main::i#2 main::i#1 ] reg byte a [ main::$9 ] reg byte a [ main::$8 ] reg byte a [ main::$7 ] zp[2]:9 [ main::$11 ] zp[2]:3 [ main::line#2 main::line#1 ] zp[1]:5 [ main::$5 ] Limited combination testing to 100 combinations of 384 possible. -Uplifting [] best 19305 combination +Uplifting [] best 19805 combination Attempting to uplift remaining variables inzp[1]:2 [ main::i#2 main::i#1 ] -Uplifting [main] best 19305 combination zp[1]:2 [ main::i#2 main::i#1 ] +Uplifting [main] best 19805 combination zp[1]:2 [ main::i#2 main::i#1 ] Attempting to uplift remaining variables inzp[1]:5 [ main::$5 ] -Uplifting [main] best 18305 combination reg byte x [ main::$5 ] +Uplifting [main] best 18805 combination reg byte x [ main::$5 ] Allocated (was zp[2]:9) zp[2]:5 [ main::$11 ] ASSEMBLER BEFORE OPTIMIZATION @@ -580,10 +580,11 @@ main: { lda.z i asl // [12] *((const word*) entities + (byte~) main::$8) ← (byte) 0 -- pwuc1_derefidx_vbuaa=vbuc2 - ldx #0 tay - txa + lda #0 sta entities,y + lda #0 + sta entities+1,y jmp __b6 // main::@6 __b6: @@ -632,6 +633,8 @@ Removing instruction jmp __b5 Removing instruction jmp __b7 Removing instruction jmp __b6 Succesful ASM optimization Pass5NextJumpElimination +Removing instruction lda #0 +Succesful ASM optimization Pass5UnnecesaryLoadElimination Removing instruction __b2: Removing instruction __b3_from___b2: Removing instruction __b5: @@ -674,7 +677,7 @@ zp[2]:5 [ main::$11 ] FINAL ASSEMBLER -Score: 16802 +Score: 17102 // File Comments // Test that the multiplication of a idx*sizeof(element) is reused inside loops @@ -765,10 +768,10 @@ main: { lda.z i asl // [12] *((const word*) entities + (byte~) main::$8) ← (byte) 0 -- pwuc1_derefidx_vbuaa=vbuc2 - ldx #0 tay - txa + lda #0 sta entities,y + sta entities+1,y // main::@6 __b6: // line[entities[i]] = '*' diff --git a/src/test/ref/type-inference.asm b/src/test/ref/type-inference.asm index 78f5c86d3..4db532e67 100644 --- a/src/test/ref/type-inference.asm +++ b/src/test/ref/type-inference.asm @@ -4,23 +4,25 @@ .pc = $80d "Program" main: { .label screen = $400 - .label b = 2 - lda #0 - sta.z b + .label __0 = 2 + ldy #0 __b1: // -0x30+b - lax.z b - axs #-[-$30] + tya + clc + adc #-$30 + sta.z __0 // screen[b] = -0x30+b - lda.z b + tya asl - tay - txa - sta screen,y + tax + lda.z __0 + sta screen,x + lda #0 + sta screen+1,x // for( byte b: 0..20) - inc.z b - lda #$15 - cmp.z b + iny + cpy #$15 bne __b1 // } rts diff --git a/src/test/ref/type-inference.log b/src/test/ref/type-inference.log index db52a4e9f..0b12fb1a7 100644 --- a/src/test/ref/type-inference.log +++ b/src/test/ref/type-inference.log @@ -163,11 +163,11 @@ main: { asl sta.z __2 // [4] *((const nomodify word*) main::screen + (byte~) main::$2) ← (byte~) main::$0 -- pwuc1_derefidx_vbuz1=vbuz2 - lda.z __2 - ldx.z __0 - tay - txa + lda.z __0 + ldy.z __2 sta screen,y + lda #0 + sta screen+1,y // [5] (byte) main::b#1 ← ++ (byte) main::b#2 -- vbuz1=_inc_vbuz1 inc.z b // [6] if((byte) main::b#1!=(byte) $15) goto main::@1 -- vbuz1_neq_vbuc1_then_la1 @@ -198,10 +198,11 @@ REGISTER UPLIFT SCOPES Uplift Scope [main] 27.5: zp[1]:2 [ main::b#2 main::b#1 ] 22: zp[1]:4 [ main::$2 ] 11: zp[1]:3 [ main::$0 ] Uplift Scope [] -Uplifting [main] best 461 combination zp[1]:2 [ main::b#2 main::b#1 ] reg byte a [ main::$2 ] reg byte x [ main::$0 ] -Uplifting [] best 461 combination -Attempting to uplift remaining variables inzp[1]:2 [ main::b#2 main::b#1 ] -Uplifting [main] best 461 combination zp[1]:2 [ main::b#2 main::b#1 ] +Uplifting [main] best 481 combination reg byte y [ main::b#2 main::b#1 ] reg byte x [ main::$2 ] zp[1]:3 [ main::$0 ] +Uplifting [] best 481 combination +Attempting to uplift remaining variables inzp[1]:3 [ main::$0 ] +Uplifting [main] best 481 combination zp[1]:3 [ main::$0 ] +Allocated (was zp[1]:3) zp[1]:2 [ main::$0 ] ASSEMBLER BEFORE OPTIMIZATION // File Comments @@ -214,12 +215,11 @@ ASSEMBLER BEFORE OPTIMIZATION // main main: { .label screen = $400 - .label b = 2 + .label __0 = 2 // [1] phi from main to main::@1 [phi:main->main::@1] __b1_from_main: - // [1] phi (byte) main::b#2 = (byte) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1 - lda #0 - sta.z b + // [1] phi (byte) main::b#2 = (byte) 0 [phi:main->main::@1#0] -- vbuyy=vbuc1 + ldy #0 jmp __b1 // [1] phi from main::@1 to main::@1 [phi:main::@1->main::@1] __b1_from___b1: @@ -227,21 +227,24 @@ main: { jmp __b1 // main::@1 __b1: - // [2] (byte~) main::$0 ← (byte) -$30 + (byte) main::b#2 -- vbuxx=vbuc1_plus_vbuz1 - lax.z b - axs #-[-$30] - // [3] (byte~) main::$2 ← (byte) main::b#2 << (byte) 1 -- vbuaa=vbuz1_rol_1 - lda.z b + // [2] (byte~) main::$0 ← (byte) -$30 + (byte) main::b#2 -- vbuz1=vbuc1_plus_vbuyy + tya + clc + adc #-$30 + sta.z __0 + // [3] (byte~) main::$2 ← (byte) main::b#2 << (byte) 1 -- vbuxx=vbuyy_rol_1 + tya asl - // [4] *((const nomodify word*) main::screen + (byte~) main::$2) ← (byte~) main::$0 -- pwuc1_derefidx_vbuaa=vbuxx - tay - txa - sta screen,y - // [5] (byte) main::b#1 ← ++ (byte) main::b#2 -- vbuz1=_inc_vbuz1 - inc.z b - // [6] if((byte) main::b#1!=(byte) $15) goto main::@1 -- vbuz1_neq_vbuc1_then_la1 - lda #$15 - cmp.z b + tax + // [4] *((const nomodify word*) main::screen + (byte~) main::$2) ← (byte~) main::$0 -- pwuc1_derefidx_vbuxx=vbuz1 + lda.z __0 + sta screen,x + lda #0 + sta screen+1,x + // [5] (byte) main::b#1 ← ++ (byte) main::b#2 -- vbuyy=_inc_vbuyy + iny + // [6] if((byte) main::b#1!=(byte) $15) goto main::@1 -- vbuyy_neq_vbuc1_then_la1 + cpy #$15 bne __b1_from___b1 jmp __breturn // main::@return @@ -266,22 +269,22 @@ Succesful ASM optimization Pass5NextJumpElimination FINAL SYMBOL TABLE (void()) main() -(byte~) main::$0 reg byte x 11.0 -(byte~) main::$2 reg byte a 22.0 +(byte~) main::$0 zp[1]:2 11.0 +(byte~) main::$2 reg byte x 22.0 (label) main::@1 (label) main::@return (byte) main::b -(byte) main::b#1 b zp[1]:2 16.5 -(byte) main::b#2 b zp[1]:2 11.0 +(byte) main::b#1 reg byte y 16.5 +(byte) main::b#2 reg byte y 11.0 (const nomodify word*) main::screen = (word*) 1024 -zp[1]:2 [ main::b#2 main::b#1 ] -reg byte x [ main::$0 ] -reg byte a [ main::$2 ] +reg byte y [ main::b#2 main::b#1 ] +zp[1]:2 [ main::$0 ] +reg byte x [ main::$2 ] FINAL ASSEMBLER -Score: 371 +Score: 391 // File Comments // Test inference of integer types in expressions @@ -293,33 +296,35 @@ Score: 371 // main main: { .label screen = $400 - .label b = 2 + .label __0 = 2 // [1] phi from main to main::@1 [phi:main->main::@1] - // [1] phi (byte) main::b#2 = (byte) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1 - lda #0 - sta.z b + // [1] phi (byte) main::b#2 = (byte) 0 [phi:main->main::@1#0] -- vbuyy=vbuc1 + ldy #0 // [1] phi from main::@1 to main::@1 [phi:main::@1->main::@1] // [1] phi (byte) main::b#2 = (byte) main::b#1 [phi:main::@1->main::@1#0] -- register_copy // main::@1 __b1: // -0x30+b - // [2] (byte~) main::$0 ← (byte) -$30 + (byte) main::b#2 -- vbuxx=vbuc1_plus_vbuz1 - lax.z b - axs #-[-$30] + // [2] (byte~) main::$0 ← (byte) -$30 + (byte) main::b#2 -- vbuz1=vbuc1_plus_vbuyy + tya + clc + adc #-$30 + sta.z __0 // screen[b] = -0x30+b - // [3] (byte~) main::$2 ← (byte) main::b#2 << (byte) 1 -- vbuaa=vbuz1_rol_1 - lda.z b + // [3] (byte~) main::$2 ← (byte) main::b#2 << (byte) 1 -- vbuxx=vbuyy_rol_1 + tya asl - // [4] *((const nomodify word*) main::screen + (byte~) main::$2) ← (byte~) main::$0 -- pwuc1_derefidx_vbuaa=vbuxx - tay - txa - sta screen,y + tax + // [4] *((const nomodify word*) main::screen + (byte~) main::$2) ← (byte~) main::$0 -- pwuc1_derefidx_vbuxx=vbuz1 + lda.z __0 + sta screen,x + lda #0 + sta screen+1,x // for( byte b: 0..20) - // [5] (byte) main::b#1 ← ++ (byte) main::b#2 -- vbuz1=_inc_vbuz1 - inc.z b - // [6] if((byte) main::b#1!=(byte) $15) goto main::@1 -- vbuz1_neq_vbuc1_then_la1 - lda #$15 - cmp.z b + // [5] (byte) main::b#1 ← ++ (byte) main::b#2 -- vbuyy=_inc_vbuyy + iny + // [6] if((byte) main::b#1!=(byte) $15) goto main::@1 -- vbuyy_neq_vbuc1_then_la1 + cpy #$15 bne __b1 // main::@return // } diff --git a/src/test/ref/type-inference.sym b/src/test/ref/type-inference.sym index a78bb7a63..a9fc02e7f 100644 --- a/src/test/ref/type-inference.sym +++ b/src/test/ref/type-inference.sym @@ -1,13 +1,13 @@ (void()) main() -(byte~) main::$0 reg byte x 11.0 -(byte~) main::$2 reg byte a 22.0 +(byte~) main::$0 zp[1]:2 11.0 +(byte~) main::$2 reg byte x 22.0 (label) main::@1 (label) main::@return (byte) main::b -(byte) main::b#1 b zp[1]:2 16.5 -(byte) main::b#2 b zp[1]:2 11.0 +(byte) main::b#1 reg byte y 16.5 +(byte) main::b#2 reg byte y 11.0 (const nomodify word*) main::screen = (word*) 1024 -zp[1]:2 [ main::b#2 main::b#1 ] -reg byte x [ main::$0 ] -reg byte a [ main::$2 ] +reg byte y [ main::b#2 main::b#1 ] +zp[1]:2 [ main::$0 ] +reg byte x [ main::$2 ]