1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-11-22 16:33:48 +00:00

Added missing fragments and a few new pretty hairy synthesis rules.. Closes #577

This commit is contained in:
jespergravgaard 2020-11-20 23:01:01 +01:00
parent 9a38de88ce
commit 5c0618f9e8
20 changed files with 2529 additions and 2777 deletions

View File

@ -1,4 +1,4 @@
//KICKC FRAGMENT CACHE 10dedb3bb9 10dedb58e1
//KICKC FRAGMENT CACHE 1005e43111 1005e44e5d
//FRAGMENT vbuz1=vbuc1
lda #{c1}
sta {z1}
@ -7,6 +7,16 @@ lda #<{c1}
sta {z1}
lda #>{c1}
sta {z1}+1
//FRAGMENT vbuz1=_deref_pbuc1
lda {c1}
sta {z1}
//FRAGMENT vbuz1_lt_vbuc1_then_la1
lda {z1}
cmp #{c1}
bcc {la1}
//FRAGMENT vbuz1=vbuz2
lda {z2}
sta {z1}
//FRAGMENT vduz1=vduz2
lda {z2}
sta {z1}
@ -16,10 +26,52 @@ lda {z2}+2
sta {z1}+2
lda {z2}+3
sta {z1}+3
//FRAGMENT vbuz1_lt_vbuc1_then_la1
lda {z1}
cmp #{c1}
bcc {la1}
//FRAGMENT vwuz1=_word_vbuz2
lda {z2}
sta {z1}
lda #0
sta {z1}+1
//FRAGMENT vwuz1=vwuz2_rol_2
lda {z2}
asl
sta {z1}
lda {z2}+1
rol
sta {z1}+1
asl {z1}
rol {z1}+1
//FRAGMENT vwuz1=vwuz2_plus_vwuz3
lda {z2}
clc
adc {z3}
sta {z1}
lda {z2}+1
adc {z3}+1
sta {z1}+1
//FRAGMENT vwuz1=vwuz2_rol_3
lda {z2}
asl
sta {z1}
lda {z2}+1
rol
sta {z1}+1
asl {z1}
rol {z1}+1
asl {z1}
rol {z1}+1
//FRAGMENT pbuz1=pbuc1_plus_vwuz2
clc
lda {z2}
adc #<{c1}
sta {z1}
lda {z2}+1
adc #>{c1}
sta {z1}+1
//FRAGMENT pbuz1=pbuz2
lda {z2}
sta {z1}
lda {z2}+1
sta {z1}+1
//FRAGMENT pbuz1=pbuz1_plus_vbuc1
lda #{c1}
clc
@ -44,15 +96,9 @@ inw {z1}
lda #{c1}
cmp {z1}
bne {la1}
//FRAGMENT vbuz1=vbuz2
lda {z2}
sta {z1}
//FRAGMENT _deref_pbuc1=vbuc2
lda #{c2}
sta {c1}
//FRAGMENT vbuz1=_deref_pbuc1
lda {c1}
sta {z1}
//FRAGMENT vduz1=vduc1
lda #<{c1}
sta {z1}
@ -149,11 +195,6 @@ cmp {z1}
beq {la1}
!:
bcc {la1}
//FRAGMENT pbuz1=pbuz2
lda {z2}
sta {z1}
lda {z2}+1
sta {z1}+1
//FRAGMENT vwuz1=vwuz2
lda {z2}
sta {z1}
@ -333,9 +374,34 @@ lda {z1}
sec
sbc {z2}
sta {z1}
//FRAGMENT vbuaa=_deref_pbuc1
lda {c1}
//FRAGMENT vbuxx=_deref_pbuc1
ldx {c1}
//FRAGMENT vbuaa_lt_vbuc1_then_la1
cmp #{c1}
bcc {la1}
//FRAGMENT vbuaa=vbuz1
lda {z1}
//FRAGMENT vbuxx=vbuz1
ldx {z1}
//FRAGMENT vbuz1=vbuxx
stx {z1}
//FRAGMENT vwuz1=_word_vbuxx
txa
sta {z1}
lda #0
sta {z1}+1
//FRAGMENT vwuz1=_word_vbuyy
tya
sta {z1}
lda #0
sta {z1}+1
//FRAGMENT vwuz1=_word_vbuzz
tza
sta {z1}
lda #0
sta {z1}+1
//FRAGMENT pbuz1_derefidx_vbuaa=vbuc1
taz
lda #{c1}
@ -371,10 +437,6 @@ cmp #{c1}
bne {la1}
//FRAGMENT vbuz1=vbuaa
sta {z1}
//FRAGMENT vbuaa=_deref_pbuc1
lda {c1}
//FRAGMENT vbuxx=_deref_pbuc1
ldx {c1}
//FRAGMENT pbuc1_derefidx_vbuxx=_inc_pbuc1_derefidx_vbuxx
inc {c1},x
//FRAGMENT pbuc1_derefidx_vbuxx_eq_vbuc2_then_la1
@ -387,10 +449,6 @@ tay
lda {c1},y
cmp #{c2}
beq {la1}
//FRAGMENT vbuaa=vbuz1
lda {z1}
//FRAGMENT vbuxx=vbuz1
ldx {z1}
//FRAGMENT vbuaa=pbuc1_derefidx_vbuz1
ldy {z1}
lda {c1},y
@ -1842,8 +1900,6 @@ sta ({z1}),y
tza
ldy #0
sta ({z1}),y
//FRAGMENT vbuz1=vbuxx
stx {z1}
//FRAGMENT vbuaa_le_vbuc1_then_la1
cmp #{c1}
bcc {la1}
@ -2168,6 +2224,10 @@ sbc #1
//FRAGMENT vbuc1_eq_vbuyy_then_la1
cpy #{c1}
beq {la1}
//FRAGMENT vbuyy=_deref_pbuc1
ldy {c1}
//FRAGMENT vbuzz=_deref_pbuc1
ldz {c1}
//FRAGMENT vbuyy_le_vbuaa_then_la1
sty $ff
cmp $ff
@ -2206,6 +2266,26 @@ dex
stz $ff
cpy $ff
bcc {la1}
//FRAGMENT vwuz1=vwuz2_plus_vwuz1
lda {z1}
clc
adc {z2}
sta {z1}
lda {z1}+1
adc {z2}+1
sta {z1}+1
//FRAGMENT pbuz1=pbuc1_plus_vwuz1
clc
lda {z1}
adc #<{c1}
sta {z1}
lda {z1}+1
adc #>{c1}
sta {z1}+1
//FRAGMENT vwuz1=vwuz1_rol_3
asw {z1}
asw {z1}
asw {z1}
//FRAGMENT pbuc1_derefidx_vbuzz=vbuzz
tza
tax
@ -2439,83 +2519,3 @@ sty {c1}
//FRAGMENT _deref_pbsc1=vbszz
tza
sta {c1}
//FRAGMENT vwuz1=_word_vbuz2
lda {z2}
sta {z1}
lda #0
sta {z1}+1
//FRAGMENT vwuz1=vwuz2_rol_2
lda {z2}
asl
sta {z1}
lda {z2}+1
rol
sta {z1}+1
asl {z1}
rol {z1}+1
//FRAGMENT vwuz1=vwuz2_plus_vwuz3
lda {z2}
clc
adc {z3}
sta {z1}
lda {z2}+1
adc {z3}+1
sta {z1}+1
//FRAGMENT vwuz1=vwuz2_rol_3
lda {z2}
asl
sta {z1}
lda {z2}+1
rol
sta {z1}+1
asl {z1}
rol {z1}+1
asl {z1}
rol {z1}+1
//FRAGMENT pbuz1=pbuc1_plus_vwuz2
clc
lda {z2}
adc #<{c1}
sta {z1}
lda {z2}+1
adc #>{c1}
sta {z1}+1
//FRAGMENT vwuz1=_word_vbuxx
txa
sta {z1}
lda #0
sta {z1}+1
//FRAGMENT vwuz1=_word_vbuyy
tya
sta {z1}
lda #0
sta {z1}+1
//FRAGMENT vwuz1=_word_vbuzz
tza
sta {z1}
lda #0
sta {z1}+1
//FRAGMENT vbuyy=_deref_pbuc1
ldy {c1}
//FRAGMENT vbuzz=_deref_pbuc1
ldz {c1}
//FRAGMENT vwuz1=vwuz2_plus_vwuz1
lda {z1}
clc
adc {z2}
sta {z1}
lda {z1}+1
adc {z2}+1
sta {z1}+1
//FRAGMENT pbuz1=pbuc1_plus_vwuz1
clc
lda {z1}
adc #<{c1}
sta {z1}
lda {z1}+1
adc #>{c1}
sta {z1}+1
//FRAGMENT vwuz1=vwuz1_rol_3
asw {z1}
asw {z1}
asw {z1}

View File

@ -1,4 +1,4 @@
//KICKC FRAGMENT CACHE 10dedb3bb9 10dedb58e1
//KICKC FRAGMENT CACHE 1005e43111 1005e44e5d
//FRAGMENT _deref_pbuc1=vbuc2
lda #{c2}
sta {c1}

View File

@ -1,4 +1,4 @@
//KICKC FRAGMENT CACHE 10dedb3bb9 10dedb58e1
//KICKC FRAGMENT CACHE 1005e43111 1005e44e5d
//FRAGMENT vbuz1=vbuc1
lda #{c1}
sta {z1}

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
//KICKC FRAGMENT CACHE 10dedb3bb9 10dedb58e1
//KICKC FRAGMENT CACHE 1005e43111 1005e44e5d
//FRAGMENT vbuz1=_deref_pbuc1
lda {c1}
sta {z1}

View File

@ -0,0 +1,2 @@
clc
adc {m1}+1

View File

@ -0,0 +1,5 @@
cmp {m1}
bcc !+
lda {m1}+1
beq {la1}
!:

View File

@ -0,0 +1,4 @@
lsr
sta {m1}
lda #0
sta {m1}+1

View File

@ -0,0 +1,4 @@
ldy {m1}+1
bne {la1}
cmp {m1}
bcc {la1}

View File

@ -1,7 +1,5 @@
lda {m1}+1
bne {la1}
lda {m1}
cmp #{c1}
beq !+
bcs {la1}
!:
lda #{c1}
cmp {m1}
bcc {la1}

View File

@ -0,0 +1,4 @@
lda {m1}+1
bne {la1}
cpx {m1}
bcc {la1}

View File

@ -0,0 +1,4 @@
lda {m1}+1
bne {la1}
cpy {m1}
bcc {la1}

View File

@ -362,6 +362,8 @@ class AsmFragmentTemplateSynthesisRule {
String rvalAa = ".*=.*aa.*|.*_.*aa.*|...aa_(lt|gt|le|ge|eq|neq)_.*";
String rvalXx = ".*=.*xx.*|.*_.*xx.*|...xx_(lt|gt|le|ge|eq|neq)_.*";
String rvalYy = ".*=.*yy.*|.*_.*yy.*|...yy_(lt|gt|le|ge|eq|neq)_.*";
String rvalYy2 = ".*=.*yy.*";
String rvalXx2 = ".*=.*xx.*";
String rvalZz = ".*=.*zz.*|.*_.*zz.*|...zz_(lt|gt|le|ge|eq|neq)_.*";
String rvalZ1 = ".*=.*z1.*|.*_.*z1.*|...z1_(lt|gt|le|ge|eq|neq)_.*";
String rvalZ2 = ".*=.*z2.*|.*_.*z2.*|...z2_(lt|gt|le|ge|eq|neq)_.*";
@ -775,17 +777,23 @@ class AsmFragmentTemplateSynthesisRule {
// Rewrite left-size C1,y to use AA and a STA C1,y
synths.add(new AsmFragmentTemplateSynthesisRule("pb(.)c1_derefidx_vbuyy=(.*)", null, null, "vb$1aa=$2", "sta {c1},y", null, "yy"));
// Rewrite C1,y to save and reload YY from $FF
synths.add(new AsmFragmentTemplateSynthesisRule("pb(.)c1_derefidx_vbuyy=(.*)", null, "sty $ff\n" , "vb$1aa=$2", "ldy $ff\nsta {c1},y", null));
synths.add(new AsmFragmentTemplateSynthesisRule("pb(.)c1_derefidx_vbuyy=(.*)", null, "sty $ff" , "vb$1aa=$2", "ldy $ff\nsta {c1},y", null));
// Rewrite C1,y to use AA
synths.add(new AsmFragmentTemplateSynthesisRule("pb(.)c1_derefidx_vbuyy=(.*)", null, null , "vb$1aa=$2", "sta {c1},y", null, "yy"));
// Rewrite (Z1),y to save and reload YY from $FF
synths.add(new AsmFragmentTemplateSynthesisRule("pb(.)z1_derefidx_vbuyy=(.*)", twoZM1, "sty $ff\n" , "vb$1aa=$2", "ldy $ff\nsta ({z1}),y", mapZM1));
synths.add(new AsmFragmentTemplateSynthesisRule("pb(.)z1_derefidx_vbuyy=(.*)", twoZM1, "sty $ff" , "vb$1aa=$2", "ldy $ff\nsta ({z1}),y", mapZM1));
// Rewrite (Z1),y to use AA
synths.add(new AsmFragmentTemplateSynthesisRule("pb(.)z1_derefidx_vbuyy=(.*)", twoZM1, null , "vb$1aa=$2", "sta ({z1}),y", mapZM1, "yy"));
if(targetCpu.getCpu65xx().hasRegisterZ())
// Rewrite (Z1),z to save and reload ZZ from $FF
synths.add(new AsmFragmentTemplateSynthesisRule("pb(.)z1_derefidx_vbuzz=(.*)", twoZM1, "stz $ff\n" , "vb$1aa=$2", "ldz $ff\nsta ({z1}),z", mapZM1));
synths.add(new AsmFragmentTemplateSynthesisRule("pb(.)z1_derefidx_vbuzz=(.*)", twoZM1, "stz $ff" , "vb$1aa=$2", "ldz $ff\nsta ({z1}),z", mapZM1));
// Rewrite left-size C1,x to use AA and a STA C1,x
synths.add(new AsmFragmentTemplateSynthesisRule("pb(.)c1_derefidx_vbuxx=(.*)", null, null, "vb$1aa=$2", "sta {c1},x", null, "xx"));
// Rewrite C1,x to save and reload XX from $FF
synths.add(new AsmFragmentTemplateSynthesisRule("pb(.)c1_derefidx_vbuxx=(.*)", null, "stx $ff\n" , "vb$1aa=$2", "ldx $ff\nsta {c1},x", null));
synths.add(new AsmFragmentTemplateSynthesisRule("pb(.)c1_derefidx_vbuxx=(.*)", null, "stx $ff" , "vb$1aa=$2", "ldx $ff\nsta {c1},x", null));
// Rewrite C1,x to use AA
synths.add(new AsmFragmentTemplateSynthesisRule("pb(.)c1_derefidx_vbuxx=(.*)", null, null , "vb$1aa=$2", "sta {c1},x", null, "xx"));
// Rewrite (Z1),x to save Y to $FF and reload it into YY
synths.add(new AsmFragmentTemplateSynthesisRule("pb(.)z1_derefidx_vbuxx=(.*)", twoZM1, "stx $ff" , "vb$1aa=$2", "ldy $ff\nsta ({z1}),y", mapZM1));
if(targetCpu.getCpu65xx().hasRegisterZ())
@ -904,6 +912,11 @@ class AsmFragmentTemplateSynthesisRule {
// Remove any parenthesis ending up around values
synths.add(new AsmFragmentTemplateSynthesisRule("(.*)\\(([vp][bwd][us][mzcaxy][123456axyz])\\)(.*)", null, null, "$1$2$3", null, null));
// Rewrite (pbuc1_derefidx_vbuxx) to use YY
synths.add(new AsmFragmentTemplateSynthesisRule("(.*)\\(pb(.)c1_derefidx_vbuxx\\)(.*)", rvalYy+"|"+twoC1, "ldy {c1},x" , "$1vb$2yy$3", null, mapC1, "yy"));
// Rewrite 2 * (pbuc1_derefidx_vbuxx) to use YY
synths.add(new AsmFragmentTemplateSynthesisRule("(.*)\\(pb(.)c1_derefidx_vbuxx\\)(.*)\\(pb(.)c1_derefidx_vbuxx\\)(.*)", rvalYy+"|"+threeC1, "ldy {c1},x" , "$1vb$2yy$3vb$4yy$5", null, mapC1, "yy"));
synths.add(new AsmFragmentTemplateSynthesisRule("(.*)_derefidx_vbuz1_(.*)", rvalYy+"|"+twoZM1, "ldy {z1}", "$1_derefidx_vbuyy_$2", null, mapZM1));
if(targetCpu.getCpu65xx().hasRegisterZ())
synths.add(new AsmFragmentTemplateSynthesisRule("(.*)_derefidx_vbuz1_(.*)", rvalZz+"|"+twoZM1, "ldz {z1}", "$1_derefidx_vbuzz_$2", null, mapZM1));

View File

@ -301,14 +301,11 @@ main: {
ldy #5
tax
lda (d),y
sty.z $ff
stx.z $ff
clc
adc.z $ff
ldy.z $ff
sta (d),y
// if (d->vx<-32)
ldy #5
lda (d),y
sec
sbc #-$20
@ -328,9 +325,8 @@ main: {
!:
bmi __b21
// d->ax=-1
lda #7
tay
lda #-1
ldy #7
sta (d),y
__b21:
// if (d->y>248<<F)
@ -359,9 +355,8 @@ main: {
!:
bpl __b23
// d->vy=1<<F
lda #6
tay
lda #1<<F
ldy #6
sta (d),y
__b23:
// d->x+=d->vx
@ -468,16 +463,14 @@ main: {
jmp __b17
__b22:
// d->vy=-1<<F
lda #6
tay
lda #-1<<F
ldy #6
sta (d),y
jmp __b23
__b20:
// d->ax=1
lda #7
tay
lda #1
ldy #7
sta (d),y
jmp __b21
__b13:
@ -517,14 +510,12 @@ main: {
lda #>$70<<F
sta (d1),y
// d->vx=(sbyte)i
lda #5
tay
ldy #5
txa
sta (d1),y
// d->ax=1
lda #7
tay
lda #1
ldy #7
sta (d1),y
// d->y=24<<F
ldy #3
@ -534,14 +525,12 @@ main: {
lda #>$18<<F
sta (d1),y
// d->vy=1<<F
lda #6
tay
lda #1<<F
ldy #6
sta (d1),y
// d->ay=1
lda #8
tay
lda #1
ldy #8
sta (d1),y
// i+=1
inx

View File

@ -3346,31 +3346,31 @@ Uplift Scope [$4]
Uplift Scope [$5]
Uplift Scope []
Uplifting [Print00] best 71417 combination reg byte x [ Print00::v#5 Print00::v#3 Print00::v0#0 Print00::v#1 Print00::v#2 ] reg byte y [ Print00::c#5 Print00::c#2 ] reg byte y [ Print00::c#10 Print00::c#4 ]
Uplifting [GetSprite] best 70121 combination reg byte x [ GetSprite::return#2 GetSprite::t0#3 GetSprite::t0#2 ] reg byte x [ GetSprite::return#4 ]
Uplifting [AddSprite] best 68878 combination reg byte y [ AddSprite::t0#3 AddSprite::t0#2 ] reg byte x [ AddSprite::sn#1 ]
Uplifting [main] best 68458 combination zp[1]:13 [ main::i#22 main::i#9 ] zp[2]:14 [ main::d#10 main::d#2 ] zp[2]:28 [ main::$27 ] zp[2]:30 [ main::$28 ] zp[2]:17 [ main::oCount#7 main::oCount#17 main::oCount#20 main::oCount#2 ] zp[1]:16 [ main::objects#12 main::objects#9 main::objects#17 main::objects#1 main::objects#15 ] reg byte x [ main::i#12 main::i#2 ] reg byte x [ main::i#14 main::i#4 ] zp[2]:6 [ main::c#11 main::c#4 ] zp[2]:4 [ main::c#10 main::c#2 ] reg byte x [ main::i#17 main::i#7 ] zp[1]:32 [ main::$132 ] reg byte a [ main::$52 ] zp[2]:38 [ main::$112 ] zp[2]:40 [ main::$109 ] zp[2]:42 [ main::$110 ] zp[2]:10 [ main::c#16 main::c#18 main::c#7 ] zp[1]:9 [ main::type#4 main::type#10 main::type#2 ] zp[1]:26 [ main::i#11 ] zp[2]:36 [ main::$111 ] zp[1]:12 [ main::stopIt#5 main::stopIt#15 ] zp[2]:34 [ main::d1#0 ]
Uplifting [Print00] best 69937 combination reg byte x [ Print00::v#5 Print00::v#3 Print00::v0#0 Print00::v#1 Print00::v#2 ] reg byte y [ Print00::c#5 Print00::c#2 ] reg byte y [ Print00::c#10 Print00::c#4 ]
Uplifting [GetSprite] best 68641 combination reg byte x [ GetSprite::return#2 GetSprite::t0#3 GetSprite::t0#2 ] reg byte x [ GetSprite::return#4 ]
Uplifting [AddSprite] best 67398 combination reg byte y [ AddSprite::t0#3 AddSprite::t0#2 ] reg byte x [ AddSprite::sn#1 ]
Uplifting [main] best 66978 combination zp[1]:13 [ main::i#22 main::i#9 ] zp[2]:14 [ main::d#10 main::d#2 ] zp[2]:28 [ main::$27 ] zp[2]:30 [ main::$28 ] zp[2]:17 [ main::oCount#7 main::oCount#17 main::oCount#20 main::oCount#2 ] zp[1]:16 [ main::objects#12 main::objects#9 main::objects#17 main::objects#1 main::objects#15 ] reg byte x [ main::i#12 main::i#2 ] reg byte x [ main::i#14 main::i#4 ] zp[2]:6 [ main::c#11 main::c#4 ] zp[2]:4 [ main::c#10 main::c#2 ] reg byte x [ main::i#17 main::i#7 ] zp[1]:32 [ main::$132 ] reg byte a [ main::$52 ] zp[2]:38 [ main::$112 ] zp[2]:40 [ main::$109 ] zp[2]:42 [ main::$110 ] zp[2]:10 [ main::c#16 main::c#18 main::c#7 ] zp[1]:9 [ main::type#4 main::type#10 main::type#2 ] zp[1]:26 [ main::i#11 ] zp[2]:36 [ main::$111 ] zp[1]:12 [ main::stopIt#5 main::stopIt#15 ] zp[2]:34 [ main::d1#0 ]
Limited combination testing to 100 combinations of 1728 possible.
Uplifting [DelSprite] best 68422 combination reg byte x [ DelSprite::sn#0 ]
Uplifting [$0] best 68422 combination
Uplifting [$1] best 68422 combination
Uplifting [$2] best 68422 combination
Uplifting [$3] best 68422 combination
Uplifting [$4] best 68422 combination
Uplifting [$5] best 68422 combination
Uplifting [] best 68422 combination
Uplifting [DelSprite] best 66942 combination reg byte x [ DelSprite::sn#0 ]
Uplifting [$0] best 66942 combination
Uplifting [$1] best 66942 combination
Uplifting [$2] best 66942 combination
Uplifting [$3] best 66942 combination
Uplifting [$4] best 66942 combination
Uplifting [$5] best 66942 combination
Uplifting [] best 66942 combination
Attempting to uplift remaining variables inzp[1]:13 [ main::i#22 main::i#9 ]
Uplifting [main] best 68422 combination zp[1]:13 [ main::i#22 main::i#9 ]
Uplifting [main] best 66942 combination zp[1]:13 [ main::i#22 main::i#9 ]
Attempting to uplift remaining variables inzp[1]:16 [ main::objects#12 main::objects#9 main::objects#17 main::objects#1 main::objects#15 ]
Uplifting [main] best 68422 combination zp[1]:16 [ main::objects#12 main::objects#9 main::objects#17 main::objects#1 main::objects#15 ]
Uplifting [main] best 66942 combination zp[1]:16 [ main::objects#12 main::objects#9 main::objects#17 main::objects#1 main::objects#15 ]
Attempting to uplift remaining variables inzp[1]:32 [ main::$132 ]
Uplifting [main] best 68402 combination reg byte a [ main::$132 ]
Uplifting [main] best 66922 combination reg byte a [ main::$132 ]
Attempting to uplift remaining variables inzp[1]:9 [ main::type#4 main::type#10 main::type#2 ]
Uplifting [main] best 68402 combination zp[1]:9 [ main::type#4 main::type#10 main::type#2 ]
Uplifting [main] best 66922 combination zp[1]:9 [ main::type#4 main::type#10 main::type#2 ]
Attempting to uplift remaining variables inzp[1]:26 [ main::i#11 ]
Uplifting [main] best 68192 combination reg byte x [ main::i#11 ]
Uplifting [main] best 66712 combination reg byte x [ main::i#11 ]
Attempting to uplift remaining variables inzp[1]:12 [ main::stopIt#5 main::stopIt#15 ]
Uplifting [main] best 68192 combination zp[1]:12 [ main::stopIt#5 main::stopIt#15 ]
Uplifting [main] best 66712 combination zp[1]:12 [ main::stopIt#5 main::stopIt#15 ]
Allocated (was zp[2]:4) zp[2]:2 [ main::c#10 main::c#2 ]
Allocated (was zp[2]:6) zp[2]:4 [ main::c#11 main::c#4 ]
Allocated (was zp[1]:9) zp[1]:6 [ main::type#4 main::type#10 main::type#2 ]
@ -3826,11 +3826,9 @@ main: {
ldy #5
tax
lda (d),y
sty.z $ff
stx.z $ff
clc
adc.z $ff
ldy.z $ff
sta (d),y
// [68] if(((signed byte*)main::d#10)[5]<-$20) goto main::@20 -- pbsz1_derefidx_vbuc1_lt_vbsc2_then_la1
ldy #5
@ -3857,9 +3855,8 @@ main: {
// main::@26
__b26:
// [70] ((signed byte*)main::d#10)[7] = -1 -- pbsz1_derefidx_vbuc1=vbsc2
lda #7
tay
lda #-1
ldy #7
sta (d),y
jmp __b21
// main::@21
@ -3894,9 +3891,8 @@ main: {
// main::@28
__b28:
// [73] ((signed byte*)main::d#10)[6] = (signed byte)1<<F -- pbsz1_derefidx_vbuc1=vbsc2
lda #6
tay
lda #1<<F
ldy #6
sta (d),y
jmp __b23
// main::@23
@ -4015,17 +4011,15 @@ main: {
// main::@22
__b22:
// [84] ((signed byte*)main::d#10)[6] = (signed byte)-1<<F -- pbsz1_derefidx_vbuc1=vbsc2
lda #6
tay
lda #-1<<F
ldy #6
sta (d),y
jmp __b23
// main::@20
__b20:
// [85] ((signed byte*)main::d#10)[7] = 1 -- pbsz1_derefidx_vbuc1=vbsc2
lda #7
tay
lda #1
ldy #7
sta (d),y
jmp __b21
// main::@13
@ -4081,14 +4075,12 @@ main: {
lda #>$70<<F
sta (d1),y
// [95] ((signed byte*)main::d1#0)[5] = (signed byte)main::i#17 -- pbsz1_derefidx_vbuc1=vbsxx
lda #5
tay
ldy #5
txa
sta (d1),y
// [96] ((signed byte*)main::d1#0)[7] = 1 -- pbsz1_derefidx_vbuc1=vbsc2
lda #7
tay
lda #1
ldy #7
sta (d1),y
// [97] ((signed word*)main::d1#0)[3] = (signed word)$18<<F -- pwsz1_derefidx_vbuc1=vwsc2
ldy #3
@ -4098,14 +4090,12 @@ main: {
lda #>$18<<F
sta (d1),y
// [98] ((signed byte*)main::d1#0)[6] = (signed byte)1<<F -- pbsz1_derefidx_vbuc1=vbsc2
lda #6
tay
lda #1<<F
ldy #6
sta (d1),y
// [99] ((signed byte*)main::d1#0)[8] = 1 -- pbsz1_derefidx_vbuc1=vbsc2
lda #8
tay
lda #1
ldy #8
sta (d1),y
jmp __b15
// main::@15
@ -4460,6 +4450,7 @@ Removing instruction lda #>0
Removing instruction lda #0
Removing instruction lda #>0
Removing instruction lda #>0
Removing instruction ldy #5
Removing instruction ldy #0
Removing instruction ldy #0
Succesful ASM optimization Pass5UnnecesaryLoadElimination
@ -4562,8 +4553,8 @@ Fixing long branch [101] bcc __b9 to bcs
Fixing long branch [107] bcc __b9 to bcs
Fixing long branch [145] bcc __b13 to bcs
Fixing long branch [166] bcc __b18 to bcs
Fixing long branch [263] bmi __b20 to bpl
Fixing long branch [288] bmi __b22 to bpl
Fixing long branch [260] bmi __b20 to bpl
Fixing long branch [284] bmi __b22 to bpl
FINAL SYMBOL TABLE
void AddSprite(byte AddSprite::sn)
@ -4697,7 +4688,7 @@ zp[2]:28 [ main::$110 ]
FINAL ASSEMBLER
Score: 62612
Score: 60932
// File Comments
// bubbles64 - Q&D C64 port of the bubbles demo from vbcc6502's NES exmaples
@ -5135,15 +5126,12 @@ main: {
ldy #5
tax
lda (d),y
sty.z $ff
stx.z $ff
clc
adc.z $ff
ldy.z $ff
sta (d),y
// if (d->vx<-32)
// [68] if(((signed byte*)main::d#10)[5]<-$20) goto main::@20 -- pbsz1_derefidx_vbuc1_lt_vbsc2_then_la1
ldy #5
lda (d),y
sec
sbc #-$20
@ -5167,9 +5155,8 @@ main: {
// main::@26
// d->ax=-1
// [70] ((signed byte*)main::d#10)[7] = -1 -- pbsz1_derefidx_vbuc1=vbsc2
lda #7
tay
lda #-1
ldy #7
sta (d),y
// main::@21
__b21:
@ -5204,9 +5191,8 @@ main: {
// main::@28
// d->vy=1<<F
// [73] ((signed byte*)main::d#10)[6] = (signed byte)1<<F -- pbsz1_derefidx_vbuc1=vbsc2
lda #6
tay
lda #1<<F
ldy #6
sta (d),y
// main::@23
__b23:
@ -5331,18 +5317,16 @@ main: {
__b22:
// d->vy=-1<<F
// [84] ((signed byte*)main::d#10)[6] = (signed byte)-1<<F -- pbsz1_derefidx_vbuc1=vbsc2
lda #6
tay
lda #-1<<F
ldy #6
sta (d),y
jmp __b23
// main::@20
__b20:
// d->ax=1
// [85] ((signed byte*)main::d#10)[7] = 1 -- pbsz1_derefidx_vbuc1=vbsc2
lda #7
tay
lda #1
ldy #7
sta (d),y
jmp __b21
// main::@13
@ -5398,15 +5382,13 @@ main: {
sta (d1),y
// d->vx=(sbyte)i
// [95] ((signed byte*)main::d1#0)[5] = (signed byte)main::i#17 -- pbsz1_derefidx_vbuc1=vbsxx
lda #5
tay
ldy #5
txa
sta (d1),y
// d->ax=1
// [96] ((signed byte*)main::d1#0)[7] = 1 -- pbsz1_derefidx_vbuc1=vbsc2
lda #7
tay
lda #1
ldy #7
sta (d1),y
// d->y=24<<F
// [97] ((signed word*)main::d1#0)[3] = (signed word)$18<<F -- pwsz1_derefidx_vbuc1=vwsc2
@ -5418,15 +5400,13 @@ main: {
sta (d1),y
// d->vy=1<<F
// [98] ((signed byte*)main::d1#0)[6] = (signed byte)1<<F -- pbsz1_derefidx_vbuc1=vbsc2
lda #6
tay
lda #1<<F
ldy #6
sta (d1),y
// d->ay=1
// [99] ((signed byte*)main::d1#0)[8] = 1 -- pbsz1_derefidx_vbuc1=vbsc2
lda #8
tay
lda #1
ldy #8
sta (d1),y
// main::@15
// i+=1

View File

@ -56,10 +56,10 @@
.label PETSCII = $1000
.label COSTAB = SINTAB+$40
// The current canvas being rendered to the screen - in D018 format.
.label canvas_show_memory = $11
.label canvas_show_memory = $13
// Flag signalling that the canvas on screen needs to be updated.
// Set to 1 by the renderer when a new canvas is ready for showing, and to 0 by the raster when the canvas is shown on screen.
.label canvas_show_flag = $12
.label canvas_show_flag = $14
__start: {
.const __init1_toD0181_return = (>(SCREEN&$3fff)*4)|(>CANVAS2)/4&$f
// canvas_show_memory = toD018(SCREEN, CANVAS2)
@ -146,12 +146,12 @@ main: {
// Setup 16x16 canvas for rendering
.label screen = 5
.label y = 2
.label x0 = $13
.label y0 = $14
.label x0 = $15
.label y0 = $16
.label x1 = $c
.label y1 = $15
.label y1 = $17
.label x2 = $c
.label y2 = $16
.label y2 = $18
.label p0_idx = 7
.label p1_idx = 8
.label p2_idx = 9
@ -389,12 +389,12 @@ kbhit: {
rts
}
// Copies the character c (an unsigned char) to the first num characters of the object pointed to by the argument str.
// memset(void* zp($1f) str, byte register(X) c, word zp($1c) num)
// memset(void* zp($20) str, byte register(X) c, word zp($1e) num)
memset: {
.label end = $1c
.label dst = $1f
.label num = $1c
.label str = $1f
.label end = $1e
.label dst = $20
.label num = $1e
.label str = $20
// if(num>0)
lda.z num
bne !+
@ -493,27 +493,27 @@ clock_start: {
}
// Draw a EOR friendly line between two points
// Uses bresenham line drawing routine
// line(byte zp($f) x1, byte zp($10) y1, byte zp($c) x2, byte zp($d) y2)
// line(byte zp($10) x1, byte zp($11) y1, byte zp($c) x2, byte zp($d) y2)
line: {
.label plot2___1 = $1e
.label plot5___1 = $27
.label x1 = $f
.label y1 = $10
.label x1 = $10
.label y1 = $11
.label x2 = $c
.label y2 = $d
.label x = $f
.label y = $10
.label dx = $17
.label dy = $18
.label sx = $19
.label sy = $1a
.label plot1_column = $21
.label plot2_y = $1b
.label plot2_column = $1c
.label plot3_column = $1f
.label e1 = $e
.label plot4_column = $23
.label plot5_column = $25
.label x = $10
.label y = $11
.label dx = $19
.label dy = $1a
.label sx = $1b
.label sy = $1c
.label e2 = $12
.label plot1_column = $22
.label e = $e
.label plot2_y = $1d
.label plot2_column = $1e
.label plot3_column = $20
.label e1 = $f
.label plot4_column = $24
.label plot5_column = $26
.label plot6_column = $28
// abs_u8(x2-x1)
lda.z x2
@ -570,7 +570,7 @@ line: {
// e = dy/2
lda.z dy
lsr
tax
sta.z e
__b6:
// y += sy
lda.z y
@ -578,14 +578,13 @@ line: {
adc.z sy
sta.z y
// e += dx
txa
lda.z e
clc
adc.z dx
tax
sta.z e
// if(e>dy)
lda.z dy
stx.z $ff
cmp.z $ff
cmp.z e
bcs __b7
// plot(x, y-sy)
lda.z y
@ -607,13 +606,11 @@ line: {
// x&7
lda #7
and.z x
sta.z plot2___1
// column[y] |= plot_bit[x&7]
ldy.z plot2_y
tax
lda (plot2_column),y
ldy.z plot2___1
ora plot_bit,y
ldy.z plot2_y
ora plot_bit,x
sta (plot2_column),y
// x += sx
lda.z x
@ -621,10 +618,10 @@ line: {
adc.z sx
sta.z x
// e -= dy
txa
lda.z e
sec
sbc.z dy
tax
sta.z e
__b7:
// while (y != y2)
lda.z y
@ -740,7 +737,7 @@ line: {
// e = dx/2
lda.z dx
lsr
tax
sta.z e2
plot5:
// x/8
lda.z x
@ -757,13 +754,11 @@ line: {
// x&7
lda #7
and.z x
sta.z plot5___1
// column[y] |= plot_bit[x&7]
ldy.z y
tax
lda (plot5_column),y
ldy.z plot5___1
ora plot_bit,y
ldy.z y
ora plot_bit,x
sta (plot5_column),y
// x += sx
lda.z x
@ -771,14 +766,13 @@ line: {
adc.z sx
sta.z x
// e += dy
txa
lda.z e2
clc
adc.z dy
tax
sta.z e2
// if(e>dx)
lda.z dx
stx.z $ff
cmp.z $ff
cmp.z e2
bcs __b13
// y += sy
tya
@ -786,10 +780,10 @@ line: {
adc.z sy
sta.z y
// e -= dx
txa
lda.z e2
sec
sbc.z dx
tax
sta.z e2
__b13:
// while (x != x2)
lda.z x
@ -818,11 +812,11 @@ line: {
rts
}
// EOR fill from the line buffer onto the canvas
// eorfill(byte* zp($1f) canvas)
// eorfill(byte* zp($20) canvas)
eorfill: {
.label canvas = $1f
.label line_column = $1c
.label fill_column = $1f
.label canvas = $20
.label line_column = $1e
.label fill_column = $20
lda #<LINE_BUFFER
sta.z line_column
lda #>LINE_BUFFER

File diff suppressed because it is too large Load Diff

View File

@ -52,23 +52,23 @@ byte abs_u8::u
byte abs_u8::u#0 reg byte a 2002.0
byte abs_u8::u#1 reg byte a 2002.0
byte abs_u8::u#2 reg byte a 10668.333333333332
volatile byte canvas_show_flag loadstore zp[1]:18 19.75
volatile byte canvas_show_memory loadstore zp[1]:17 2.9855072463768115
volatile byte canvas_show_flag loadstore zp[1]:20 19.75
volatile byte canvas_show_memory loadstore zp[1]:19 2.9855072463768115
void clock_start()
void eorfill(byte* eorfill::line_buffer , byte* eorfill::canvas)
byte* eorfill::canvas
byte* eorfill::canvas#0 canvas zp[2]:31 551.0
byte* eorfill::canvas#0 canvas zp[2]:32 551.0
byte eorfill::eor
byte eorfill::eor#0 reg byte a 150001.5
byte eorfill::eor#1 reg byte a 1000001.0
byte eorfill::eor#2 reg byte a 1050001.5
byte* eorfill::fill_column
byte* eorfill::fill_column#1 fill_column zp[2]:31 100001.0
byte* eorfill::fill_column#2 fill_column zp[2]:31 130100.5
byte* eorfill::fill_column#1 fill_column zp[2]:32 100001.0
byte* eorfill::fill_column#2 fill_column zp[2]:32 130100.5
byte* eorfill::line_buffer
byte* eorfill::line_column
byte* eorfill::line_column#1 line_column zp[2]:28 66667.33333333333
byte* eorfill::line_column#2 line_column zp[2]:28 144444.88888888888
byte* eorfill::line_column#1 line_column zp[2]:30 66667.33333333333
byte* eorfill::line_column#2 line_column zp[2]:30 144444.88888888888
byte eorfill::x
byte eorfill::x#1 reg byte x 200002.0
byte eorfill::x#2 reg byte x 27273.0
@ -95,60 +95,60 @@ byte kbhit::return#2 reg byte a 4.0
void line(byte* line::canvas , byte line::x1 , byte line::y1 , byte line::x2 , byte line::y2)
byte* line::canvas
byte line::dx
byte line::dx#0 dx zp[1]:23 19462.805970149253
byte line::dx#0 dx zp[1]:25 19462.805970149253
byte line::dy
byte line::dy#0 dy zp[1]:24 22285.85714285714
byte line::dy#0 dy zp[1]:26 22285.85714285714
byte line::e
byte line::e#0 reg byte x 2002.0
byte line::e#1 reg byte x 44444.88888888889
byte line::e#2 reg byte x 200002.0
byte line::e#3 reg byte x 100501.5
byte line::e#5 reg byte x 150001.5
byte line::e#0 e zp[1]:14 2002.0
byte line::e#1 e zp[1]:14 44444.88888888889
byte line::e#2 e zp[1]:14 200002.0
byte line::e#3 e zp[1]:14 100501.5
byte line::e#5 e zp[1]:14 150001.5
byte line::e1
byte line::e1#0 e1 zp[1]:14 2002.0
byte line::e1#1 e1 zp[1]:14 1033334.6666666666
byte line::e1#2 e1 zp[1]:14 28571.714285714286
byte line::e1#3 e1 zp[1]:14 1050502.0
byte line::e1#0 e1 zp[1]:15 2002.0
byte line::e1#1 e1 zp[1]:15 1033334.6666666666
byte line::e1#2 e1 zp[1]:15 28571.714285714286
byte line::e1#3 e1 zp[1]:15 1050502.0
byte line::e2
byte line::e2#0 reg byte x 2002.0
byte line::e2#1 reg byte x 133334.66666666666
byte line::e2#2 reg byte x 200002.0
byte line::e2#3 reg byte x 28714.714285714286
byte line::e2#7 reg byte x 150001.5
byte line::e2#0 e2 zp[1]:18 2002.0
byte line::e2#1 e2 zp[1]:18 133334.66666666666
byte line::e2#2 e2 zp[1]:18 200002.0
byte line::e2#3 e2 zp[1]:18 28714.714285714286
byte line::e2#7 e2 zp[1]:18 150001.5
byte~ line::plot1_$0 reg byte a 2002.0
byte~ line::plot1_$1 reg byte a 2002.0
byte~ line::plot1_$2 reg byte a 2002.0
byte* line::plot1_column
byte* line::plot1_column#0 plot1_column zp[2]:33 1501.5
byte* line::plot1_column#0 plot1_column zp[2]:34 1501.5
byte line::plot1_x
byte line::plot1_y
byte~ line::plot2_$0 reg byte a 200002.0
byte~ line::plot2_$1 zp[1]:30 200002.0
byte~ line::plot2_$1 reg byte a 200002.0
byte~ line::plot2_$2 reg byte a 200002.0
byte* line::plot2_column
byte* line::plot2_column#0 plot2_column zp[2]:28 150001.5
byte* line::plot2_column#0 plot2_column zp[2]:30 150001.5
byte line::plot2_x
byte line::plot2_y
byte line::plot2_y#0 plot2_y zp[1]:27 60000.600000000006
byte line::plot2_y#0 plot2_y zp[1]:29 60000.600000000006
byte~ line::plot3_$0 reg byte a 2002.0
byte~ line::plot3_$1 reg byte a 2002.0
byte~ line::plot3_$2 reg byte a 2002.0
byte* line::plot3_column
byte* line::plot3_column#0 plot3_column zp[2]:31 1501.5
byte* line::plot3_column#0 plot3_column zp[2]:32 1501.5
byte line::plot3_x
byte line::plot3_y
byte~ line::plot4_$0 reg byte a 200002.0
byte~ line::plot4_$1 reg byte a 200002.0
byte~ line::plot4_$2 reg byte a 200002.0
byte* line::plot4_column
byte* line::plot4_column#0 plot4_column zp[2]:35 150001.5
byte* line::plot4_column#0 plot4_column zp[2]:36 150001.5
byte line::plot4_x
byte line::plot4_y
byte~ line::plot5_$0 reg byte a 200002.0
byte~ line::plot5_$1 zp[1]:39 200002.0
byte~ line::plot5_$1 reg byte a 200002.0
byte~ line::plot5_$2 reg byte a 200002.0
byte* line::plot5_column
byte* line::plot5_column#0 plot5_column zp[2]:37 150001.5
byte* line::plot5_column#0 plot5_column zp[2]:38 150001.5
byte line::plot5_x
byte line::plot5_y
byte~ line::plot6_$0 reg byte a 2002.0
@ -159,42 +159,42 @@ byte* line::plot6_column#0 plot6_column zp[2]:40 1501.5
byte line::plot6_x
byte line::plot6_y
byte line::sx
byte line::sx#0 sx zp[1]:25 5135.6949152542375
byte line::sx#0 sx zp[1]:27 5135.6949152542375
byte line::sy
byte line::sy#0 sy zp[1]:26 23672.836363636365
byte line::sy#0 sy zp[1]:28 23672.836363636365
byte line::x
byte line::x#0 x zp[1]:15 228.4375
byte line::x#1 x zp[1]:15 100001.0
byte line::x#10 x zp[1]:15 66834.16666666666
byte line::x#12 x zp[1]:15 30200.5
byte line::x#15 x zp[1]:15 50100.6
byte line::x#17 x zp[1]:15 60401.0
byte line::x#18 x zp[1]:15 550251.25
byte line::x#19 x zp[1]:15 62500.625
byte line::x#0 x zp[1]:16 228.4375
byte line::x#1 x zp[1]:16 100001.0
byte line::x#10 x zp[1]:16 66834.16666666666
byte line::x#12 x zp[1]:16 30200.5
byte line::x#15 x zp[1]:16 50100.6
byte line::x#17 x zp[1]:16 60401.0
byte line::x#18 x zp[1]:16 550251.25
byte line::x#19 x zp[1]:16 62500.625
byte line::x1
byte line::x1#0 x1 zp[1]:15 50.5
byte line::x1#1 x1 zp[1]:15 50.5
byte line::x1#2 x1 zp[1]:15 50.5
byte line::x1#0 x1 zp[1]:16 50.5
byte line::x1#1 x1 zp[1]:16 50.5
byte line::x1#2 x1 zp[1]:16 50.5
byte line::x2
byte line::x2#0 x2 zp[1]:12 101.0
byte line::x2#1 x2 zp[1]:12 101.0
byte line::x2#15 x2 zp[1]:12 3612.625
byte line::x2#2 x2 zp[1]:12 101.0
byte line::y
byte line::y#0 y zp[1]:16 239.27777777777777
byte line::y#1 y zp[1]:16 1001.0
byte line::y#10 y zp[1]:16 23647.411764705877
byte line::y#11 y zp[1]:16 2101004.0
byte line::y#12 y zp[1]:16 209091.36363636365
byte line::y#13 y zp[1]:16 55667.33333333333
byte line::y#15 y zp[1]:16 50334.16666666667
byte line::y#17 y zp[1]:16 583.9166666666667
byte line::y#4 y zp[1]:16 100001.0
byte line::y#7 y zp[1]:16 201003.0
byte line::y#0 y zp[1]:17 239.27777777777777
byte line::y#1 y zp[1]:17 1001.0
byte line::y#10 y zp[1]:17 23647.411764705877
byte line::y#11 y zp[1]:17 2101004.0
byte line::y#12 y zp[1]:17 209091.36363636365
byte line::y#13 y zp[1]:17 55667.33333333333
byte line::y#15 y zp[1]:17 50334.16666666667
byte line::y#17 y zp[1]:17 583.9166666666667
byte line::y#4 y zp[1]:17 100001.0
byte line::y#7 y zp[1]:17 201003.0
byte line::y1
byte line::y1#0 y1 zp[1]:16 67.33333333333333
byte line::y1#1 y1 zp[1]:16 67.33333333333333
byte line::y1#2 y1 zp[1]:16 67.33333333333333
byte line::y1#0 y1 zp[1]:17 67.33333333333333
byte line::y1#1 y1 zp[1]:17 67.33333333333333
byte line::y1#2 y1 zp[1]:17 67.33333333333333
byte line::y2
byte line::y2#0 y2 zp[1]:13 202.0
byte line::y2#1 y2 zp[1]:13 202.0
@ -238,7 +238,7 @@ byte main::x
byte main::x#1 reg byte y 2002.0
byte main::x#2 reg byte y 1001.0
byte main::x0
byte main::x0#0 x0 zp[1]:19 16.833333333333332
byte main::x0#0 x0 zp[1]:21 16.833333333333332
byte main::x1
byte main::x1#0 x1 zp[1]:12 33.666666666666664
byte main::x2
@ -247,25 +247,25 @@ byte main::y
byte main::y#1 y zp[1]:2 202.0
byte main::y#2 y zp[1]:2 36.72727272727273
byte main::y0
byte main::y0#0 y0 zp[1]:20 16.833333333333332
byte main::y0#0 y0 zp[1]:22 16.833333333333332
byte main::y1
byte main::y1#0 y1 zp[1]:21 33.666666666666664
byte main::y1#0 y1 zp[1]:23 33.666666666666664
byte main::y2
byte main::y2#0 y2 zp[1]:22 43.285714285714285
byte main::y2#0 y2 zp[1]:24 43.285714285714285
void* memset(void* memset::str , byte memset::c , word memset::num)
byte memset::c
byte memset::c#6 reg byte x 12500.125
byte* memset::dst
byte* memset::dst#1 dst zp[2]:31 200002.0
byte* memset::dst#2 dst zp[2]:31 133668.3333333333
byte* memset::dst#4 dst zp[2]:31 2002.0
byte* memset::dst#1 dst zp[2]:32 200002.0
byte* memset::dst#2 dst zp[2]:32 133668.3333333333
byte* memset::dst#4 dst zp[2]:32 2002.0
byte* memset::end
byte* memset::end#0 end zp[2]:28 16833.666666666664
byte* memset::end#0 end zp[2]:30 16833.666666666664
word memset::num
word memset::num#4 num zp[2]:28 1001.0
word memset::num#4 num zp[2]:30 1001.0
void* memset::return
void* memset::str
void* memset::str#5 str zp[2]:31
void* memset::str#5 str zp[2]:32
const byte* plot_bit[8] = { $80, $40, $20, $10, 8, 4, 2, 1 }
const byte** plot_column[$10] = { LINE_BUFFER, LINE_BUFFER+(byte)1*$80, LINE_BUFFER+(word)2*$80, LINE_BUFFER+(word)3*$80, LINE_BUFFER+(word)4*$80, LINE_BUFFER+(word)5*$80, LINE_BUFFER+(word)6*$80, LINE_BUFFER+(word)7*$80, LINE_BUFFER+(word)8*$80, LINE_BUFFER+(word)9*$80, LINE_BUFFER+(word)$a*$80, LINE_BUFFER+(word)$b*$80, LINE_BUFFER+(word)$c*$80, LINE_BUFFER+(word)$d*$80, LINE_BUFFER+(word)$e*$80, LINE_BUFFER+(word)$f*$80 }
void setup_irq()
@ -292,55 +292,55 @@ reg byte x [ main::c#2 main::c#4 main::c#1 ]
reg byte x [ memset::c#6 ]
zp[1]:12 [ line::x2#15 line::x2#0 line::x2#1 line::x2#2 main::x1#0 main::x2#0 ]
zp[1]:13 [ line::y2#13 line::y2#10 line::y2#0 line::y2#1 line::y2#2 line::y2#3 ]
reg byte x [ line::e#3 line::e#0 line::e#5 line::e#2 line::e#1 ]
zp[1]:14 [ line::e1#3 line::e1#0 line::e1#1 line::e1#2 ]
zp[1]:15 [ line::x#10 line::x#12 line::x#18 line::x#15 line::x#0 line::x1#0 line::x1#1 line::x1#2 line::x#17 line::x#1 line::x#19 ]
zp[1]:16 [ line::y#13 line::y#15 line::y#11 line::y#7 line::y#17 line::y#0 line::y1#0 line::y1#1 line::y1#2 line::y#1 line::y#10 line::y#12 line::y#4 ]
reg byte x [ line::e2#3 line::e2#7 line::e2#0 line::e2#2 line::e2#1 ]
zp[1]:14 [ line::e#3 line::e#0 line::e#5 line::e#2 line::e#1 ]
zp[1]:15 [ line::e1#3 line::e1#0 line::e1#1 line::e1#2 ]
zp[1]:16 [ line::x#10 line::x#12 line::x#18 line::x#15 line::x#0 line::x1#0 line::x1#1 line::x1#2 line::x#17 line::x#1 line::x#19 ]
zp[1]:17 [ line::y#13 line::y#15 line::y#11 line::y#7 line::y#17 line::y#0 line::y1#0 line::y1#1 line::y1#2 line::y#1 line::y#10 line::y#12 line::y#4 ]
zp[1]:18 [ line::e2#3 line::e2#7 line::e2#0 line::e2#2 line::e2#1 ]
reg byte x [ eorfill::x#2 eorfill::x#1 ]
reg byte y [ eorfill::y#2 eorfill::y#1 ]
reg byte a [ eorfill::eor#2 eorfill::eor#0 eorfill::eor#1 ]
reg byte a [ abs_u8::return#4 abs_u8::return#2 abs_u8::u#2 abs_u8::u#0 abs_u8::u#1 ]
reg byte a [ sgn_u8::u#2 sgn_u8::u#0 sgn_u8::u#1 ]
reg byte a [ sgn_u8::return#4 ]
zp[1]:17 [ canvas_show_memory ]
zp[1]:18 [ canvas_show_flag ]
zp[1]:19 [ canvas_show_memory ]
zp[1]:20 [ canvas_show_flag ]
reg byte a [ kbhit::return#2 ]
reg byte a [ irq_bottom_2::$0 ]
zp[1]:19 [ main::x0#0 ]
zp[1]:20 [ main::y0#0 ]
zp[1]:21 [ main::y1#0 ]
zp[1]:22 [ main::y2#0 ]
zp[1]:21 [ main::x0#0 ]
zp[1]:22 [ main::y0#0 ]
zp[1]:23 [ main::y1#0 ]
zp[1]:24 [ main::y2#0 ]
reg byte a [ kbhit::return#0 ]
reg byte a [ abs_u8::return#0 ]
zp[1]:23 [ line::dx#0 ]
zp[1]:25 [ line::dx#0 ]
reg byte a [ abs_u8::return#1 ]
zp[1]:24 [ line::dy#0 ]
zp[1]:26 [ line::dy#0 ]
reg byte a [ sgn_u8::return#0 ]
zp[1]:25 [ line::sx#0 ]
zp[1]:27 [ line::sx#0 ]
reg byte a [ sgn_u8::return#1 ]
zp[1]:26 [ line::sy#0 ]
zp[1]:27 [ line::plot2_y#0 ]
zp[1]:28 [ line::sy#0 ]
zp[1]:29 [ line::plot2_y#0 ]
reg byte a [ line::plot2_$0 ]
reg byte a [ line::plot2_$2 ]
zp[2]:28 [ line::plot2_column#0 eorfill::line_column#2 eorfill::line_column#1 memset::num#4 memset::end#0 ]
zp[1]:30 [ line::plot2_$1 ]
zp[2]:30 [ line::plot2_column#0 eorfill::line_column#2 eorfill::line_column#1 memset::num#4 memset::end#0 ]
reg byte a [ line::plot2_$1 ]
reg byte a [ line::plot3_$0 ]
reg byte a [ line::plot3_$2 ]
zp[2]:31 [ line::plot3_column#0 eorfill::fill_column#2 eorfill::canvas#0 eorfill::fill_column#1 memset::str#5 memset::dst#2 memset::dst#4 memset::dst#1 ]
zp[2]:32 [ line::plot3_column#0 eorfill::fill_column#2 eorfill::canvas#0 eorfill::fill_column#1 memset::str#5 memset::dst#2 memset::dst#4 memset::dst#1 ]
reg byte a [ line::plot3_$1 ]
reg byte a [ line::plot1_$0 ]
reg byte a [ line::plot1_$2 ]
zp[2]:33 [ line::plot1_column#0 ]
zp[2]:34 [ line::plot1_column#0 ]
reg byte a [ line::plot1_$1 ]
reg byte a [ line::plot4_$0 ]
reg byte a [ line::plot4_$2 ]
zp[2]:35 [ line::plot4_column#0 ]
zp[2]:36 [ line::plot4_column#0 ]
reg byte a [ line::plot4_$1 ]
reg byte a [ line::plot5_$0 ]
reg byte a [ line::plot5_$2 ]
zp[2]:37 [ line::plot5_column#0 ]
zp[1]:39 [ line::plot5_$1 ]
zp[2]:38 [ line::plot5_column#0 ]
reg byte a [ line::plot5_$1 ]
reg byte a [ line::plot6_$0 ]
reg byte a [ line::plot6_$2 ]
zp[2]:40 [ line::plot6_column#0 ]

View File

@ -50,11 +50,9 @@ position_sprite: {
// if (x > 255)
lda.z x+1
bne __b1
lda.z x
cmp #$ff
beq !+
bcs __b1
!:
lda #$ff
cmp.z x
bcc __b1
// 1 << spriteno
lda #1
ldy.z spriteno

View File

@ -330,17 +330,17 @@ Uplift Scope [MOS6569_VICII]
Uplift Scope [MOS6581_SID]
Uplift Scope []
Uplifting [position_sprite] best 925 combination reg byte a [ position_sprite::$2 ] reg byte a [ position_sprite::$4 ] reg byte a [ position_sprite::$5 ] reg byte a [ position_sprite::$6 ] zp[1]:8 [ position_sprite::$1 ] zp[1]:5 [ position_sprite::spriteno#0 ] zp[2]:6 [ position_sprite::x#0 ]
Uplifting [position_sprite] best 923 combination reg byte a [ position_sprite::$2 ] reg byte a [ position_sprite::$4 ] reg byte a [ position_sprite::$5 ] reg byte a [ position_sprite::$6 ] zp[1]:8 [ position_sprite::$1 ] zp[1]:5 [ position_sprite::spriteno#0 ] zp[2]:6 [ position_sprite::x#0 ]
Limited combination testing to 100 combinations of 2304 possible.
Uplifting [main] best 805 combination reg byte x [ main::s#2 main::s#1 ] zp[2]:3 [ main::xpos#2 main::xpos#1 ]
Uplifting [MOS6526_CIA] best 805 combination
Uplifting [MOS6569_VICII] best 805 combination
Uplifting [MOS6581_SID] best 805 combination
Uplifting [] best 805 combination
Uplifting [main] best 803 combination reg byte x [ main::s#2 main::s#1 ] zp[2]:3 [ main::xpos#2 main::xpos#1 ]
Uplifting [MOS6526_CIA] best 803 combination
Uplifting [MOS6569_VICII] best 803 combination
Uplifting [MOS6581_SID] best 803 combination
Uplifting [] best 803 combination
Attempting to uplift remaining variables inzp[1]:8 [ position_sprite::$1 ]
Uplifting [position_sprite] best 798 combination reg byte y [ position_sprite::$1 ]
Uplifting [position_sprite] best 796 combination reg byte y [ position_sprite::$1 ]
Attempting to uplift remaining variables inzp[1]:5 [ position_sprite::spriteno#0 ]
Uplifting [position_sprite] best 798 combination zp[1]:5 [ position_sprite::spriteno#0 ]
Uplifting [position_sprite] best 796 combination zp[1]:5 [ position_sprite::spriteno#0 ]
Coalescing zero page register [ zp[2]:3 [ main::xpos#2 main::xpos#1 ] ] with [ zp[2]:6 [ position_sprite::x#0 ] ] - score: 1
Allocated (was zp[2]:3) zp[2]:2 [ main::xpos#2 main::xpos#1 position_sprite::x#0 ]
Allocated (was zp[1]:5) zp[1]:4 [ position_sprite::spriteno#0 ]
@ -423,11 +423,9 @@ position_sprite: {
// [13] if(position_sprite::x#0>$ff) goto position_sprite::@1 -- vwuz1_gt_vbuc1_then_la1
lda.z x+1
bne __b1
lda.z x
cmp #$ff
beq !+
bcs __b1
!:
lda #$ff
cmp.z x
bcc __b1
jmp __b2
// position_sprite::@2
__b2:
@ -527,7 +525,7 @@ reg byte a [ position_sprite::$6 ]
FINAL ASSEMBLER
Score: 555
Score: 553
// File Comments
// Tests rolling sprite MSB by variable amount
@ -607,11 +605,9 @@ position_sprite: {
// [13] if(position_sprite::x#0>$ff) goto position_sprite::@1 -- vwuz1_gt_vbuc1_then_la1
lda.z x+1
bne __b1
lda.z x
cmp #$ff
beq !+
bcs __b1
!:
lda #$ff
cmp.z x
bcc __b1
// position_sprite::@2
// 1 << spriteno
// [14] position_sprite::$4 = 1 << position_sprite::spriteno#0 -- vbuaa=vbuc1_rol_vbuz1