diff --git a/src/main/fragment/pbuc1_derefidx_pbuz1_derefidx_vbuyy=vbuaa.asm b/src/main/fragment/pbuc1_derefidx_pbuz1_derefidx_vbuyy=vbuaa.asm index 92b6520bf..90a6c770c 100644 --- a/src/main/fragment/pbuc1_derefidx_pbuz1_derefidx_vbuyy=vbuaa.asm +++ b/src/main/fragment/pbuc1_derefidx_pbuz1_derefidx_vbuyy=vbuaa.asm @@ -1,3 +1,5 @@ +pha lda ({z1}),y tay -lda {c1},y \ No newline at end of file +pla +sta {c1},y \ No newline at end of file diff --git a/src/test/java/dk/camelot64/kickc/test/TestFragments.java b/src/test/java/dk/camelot64/kickc/test/TestFragments.java index 7d344846b..77c866884 100644 --- a/src/test/java/dk/camelot64/kickc/test/TestFragments.java +++ b/src/test/java/dk/camelot64/kickc/test/TestFragments.java @@ -131,7 +131,8 @@ public class TestFragments { "pbuc1_derefidx_vbuz1=pbuz2_derefidx_vbuz1_band_pbuz3_derefidx_vbuc2", "vbuxx=pbuz1_derefidx_vbuc1_band_pbuz2_derefidx_vbuc2", "_deref_pbuz1=pbuz2_derefidx_vbuc1_band_pbuz3_derefidx_vbuc2", - "pbuz1_derefidx_vbuaa=pbuz2_derefidx_vbuc1_band_pbuz3_derefidx_vbuc2"); + "pbuz1_derefidx_vbuaa=pbuz2_derefidx_vbuc1_band_pbuz3_derefidx_vbuc2", + "pbuc1_derefidx_pbuz1_derefidx_vbuc2=pbuz1_derefidx_vbuc3"); testFragments("fragments-complex", signaturesComplex); } diff --git a/src/test/java/dk/camelot64/kickc/test/TestPrograms.java b/src/test/java/dk/camelot64/kickc/test/TestPrograms.java index cc253699d..0dddbe7b0 100644 --- a/src/test/java/dk/camelot64/kickc/test/TestPrograms.java +++ b/src/test/java/dk/camelot64/kickc/test/TestPrograms.java @@ -37,7 +37,7 @@ public class TestPrograms { @Test public void testBlackhole() throws IOException, URISyntaxException { - compileAndCompare("complex/blackhole/blackhole"); + compileAndCompare("complex/blackhole/blackhole", log()); } // TODO: Optimize unused IRQ's away (and other unused funtions that reference each other circularly) diff --git a/src/test/ref/complex/blackhole/blackhole.asm b/src/test/ref/complex/blackhole/blackhole.asm index 054851514..1aac54d32 100644 --- a/src/test/ref/complex/blackhole/blackhole.asm +++ b/src/test/ref/complex/blackhole/blackhole.asm @@ -710,9 +710,11 @@ processChars: { ldy #OFFSET_STRUCT_PROCESSINGSPRITE_PTR lda (processing),y ldy #OFFSET_STRUCT_PROCESSINGSPRITE_ID + pha lda (processing),y tay - lda SCREEN+SPRITE_PTRS,y + pla + sta SCREEN+SPRITE_PTRS,y // Set status lda #STATUS_PROCESSING ldy #OFFSET_STRUCT_PROCESSINGSPRITE_STATUS diff --git a/src/test/ref/complex/blackhole/blackhole.log b/src/test/ref/complex/blackhole/blackhole.log index b139555b9..2fa723476 100644 --- a/src/test/ref/complex/blackhole/blackhole.log +++ b/src/test/ref/complex/blackhole/blackhole.log @@ -4604,9 +4604,11 @@ processChars: { ldy #OFFSET_STRUCT_PROCESSINGSPRITE_PTR lda (processing),y ldy #OFFSET_STRUCT_PROCESSINGSPRITE_ID + pha lda (processing),y tay - lda SCREEN+SPRITE_PTRS,y + pla + sta SCREEN+SPRITE_PTRS,y //SEG325 [181] *((byte*)(struct ProcessingSprite*) processChars::processing#0 + (const byte) OFFSET_STRUCT_PROCESSINGSPRITE_STATUS) ← (const byte) STATUS_PROCESSING#0 -- pbuz1_derefidx_vbuc1=vbuc2 // Set status lda #STATUS_PROCESSING @@ -5156,65 +5158,65 @@ Uplift Scope [ProcessingSprite] Uplift Scope [setupRasterIrq] Uplift Scope [] -Uplifting [getCharToProcess] best 254157 combination zp ZP_WORD:22 [ getCharToProcess::return_dist#1 getCharToProcess::return_dist#5 getCharToProcess::return_dist#6 getCharToProcess::dist#0 ] zp ZP_WORD:18 [ getCharToProcess::closest_dist#2 getCharToProcess::closest_dist#8 getCharToProcess::closest_dist#10 getCharToProcess::closest_dist#12 ] zp ZP_BYTE:21 [ getCharToProcess::closest_y#7 getCharToProcess::closest_y#9 getCharToProcess::return_y#1 getCharToProcess::return_y#7 ] reg byte a [ getCharToProcess::$14 ] zp ZP_BYTE:20 [ getCharToProcess::closest_x#7 getCharToProcess::closest_x#9 getCharToProcess::return_x#1 getCharToProcess::return_x#7 ] zp ZP_BYTE:17 [ getCharToProcess::x#2 getCharToProcess::x#1 ] zp ZP_BYTE:77 [ getCharToProcess::$13 ] zp ZP_BYTE:16 [ getCharToProcess::y#7 getCharToProcess::y#1 ] zp ZP_WORD:14 [ getCharToProcess::screen_line#4 getCharToProcess::screen_line#1 ] zp ZP_BYTE:40 [ getCharToProcess::return_x#0 ] zp ZP_BYTE:41 [ getCharToProcess::return_y#0 ] zp ZP_WORD:42 [ getCharToProcess::return_dist#0 ] zp ZP_WORD:81 [ getCharToProcess::$15 ] zp ZP_WORD:83 [ getCharToProcess::$16 ] zp ZP_WORD:85 [ getCharToProcess::$10 ] zp ZP_WORD:87 [ getCharToProcess::$11 ] zp ZP_WORD:79 [ getCharToProcess::$9 ] +Uplifting [getCharToProcess] best 254232 combination zp ZP_WORD:22 [ getCharToProcess::return_dist#1 getCharToProcess::return_dist#5 getCharToProcess::return_dist#6 getCharToProcess::dist#0 ] zp ZP_WORD:18 [ getCharToProcess::closest_dist#2 getCharToProcess::closest_dist#8 getCharToProcess::closest_dist#10 getCharToProcess::closest_dist#12 ] zp ZP_BYTE:21 [ getCharToProcess::closest_y#7 getCharToProcess::closest_y#9 getCharToProcess::return_y#1 getCharToProcess::return_y#7 ] reg byte a [ getCharToProcess::$14 ] zp ZP_BYTE:20 [ getCharToProcess::closest_x#7 getCharToProcess::closest_x#9 getCharToProcess::return_x#1 getCharToProcess::return_x#7 ] zp ZP_BYTE:17 [ getCharToProcess::x#2 getCharToProcess::x#1 ] zp ZP_BYTE:77 [ getCharToProcess::$13 ] zp ZP_BYTE:16 [ getCharToProcess::y#7 getCharToProcess::y#1 ] zp ZP_WORD:14 [ getCharToProcess::screen_line#4 getCharToProcess::screen_line#1 ] zp ZP_BYTE:40 [ getCharToProcess::return_x#0 ] zp ZP_BYTE:41 [ getCharToProcess::return_y#0 ] zp ZP_WORD:42 [ getCharToProcess::return_dist#0 ] zp ZP_WORD:81 [ getCharToProcess::$15 ] zp ZP_WORD:83 [ getCharToProcess::$16 ] zp ZP_WORD:85 [ getCharToProcess::$10 ] zp ZP_WORD:87 [ getCharToProcess::$11 ] zp ZP_WORD:79 [ getCharToProcess::$9 ] Limited combination testing to 100 combinations of 8748 possible. -Uplifting [startProcessing] best 248353 combination zp ZP_BYTE:10 [ startProcessing::freeIdx#2 startProcessing::freeIdx#8 startProcessing::i#2 startProcessing::i#1 ] reg byte a [ startProcessing::$21 ] reg byte x [ startProcessing::freeIdx#6 startProcessing::freeIdx#7 ] zp ZP_WORD:11 [ startProcessing::spriteData#2 startProcessing::spriteData#0 startProcessing::spriteData#1 ] reg byte x [ startProcessing::i1#2 startProcessing::i1#1 ] zp ZP_WORD:51 [ startProcessing::$0 ] zp ZP_WORD:53 [ startProcessing::$1 ] zp ZP_WORD:55 [ startProcessing::$3 ] zp ZP_WORD:57 [ startProcessing::$4 ] reg byte a [ startProcessing::$6 ] zp ZP_WORD:66 [ startProcessing::$30 ] zp ZP_WORD:68 [ startProcessing::$31 ] zp ZP_WORD:70 [ startProcessing::$12 ] zp ZP_WORD:72 [ startProcessing::$13 ] zp ZP_WORD:64 [ startProcessing::$11 ] zp ZP_BYTE:76 [ startProcessing::$22 ] zp ZP_WORD:74 [ startProcessing::screenPtr#0 ] zp ZP_BYTE:49 [ startProcessing::center_y#0 ] zp ZP_BYTE:48 [ startProcessing::center_x#0 ] zp ZP_BYTE:62 [ startProcessing::spriteY#0 ] zp ZP_WORD:59 [ startProcessing::spriteX#0 ] zp ZP_BYTE:63 [ startProcessing::spritePtr#0 ] +Uplifting [startProcessing] best 248428 combination zp ZP_BYTE:10 [ startProcessing::freeIdx#2 startProcessing::freeIdx#8 startProcessing::i#2 startProcessing::i#1 ] reg byte a [ startProcessing::$21 ] reg byte x [ startProcessing::freeIdx#6 startProcessing::freeIdx#7 ] zp ZP_WORD:11 [ startProcessing::spriteData#2 startProcessing::spriteData#0 startProcessing::spriteData#1 ] reg byte x [ startProcessing::i1#2 startProcessing::i1#1 ] zp ZP_WORD:51 [ startProcessing::$0 ] zp ZP_WORD:53 [ startProcessing::$1 ] zp ZP_WORD:55 [ startProcessing::$3 ] zp ZP_WORD:57 [ startProcessing::$4 ] reg byte a [ startProcessing::$6 ] zp ZP_WORD:66 [ startProcessing::$30 ] zp ZP_WORD:68 [ startProcessing::$31 ] zp ZP_WORD:70 [ startProcessing::$12 ] zp ZP_WORD:72 [ startProcessing::$13 ] zp ZP_WORD:64 [ startProcessing::$11 ] zp ZP_BYTE:76 [ startProcessing::$22 ] zp ZP_WORD:74 [ startProcessing::screenPtr#0 ] zp ZP_BYTE:49 [ startProcessing::center_y#0 ] zp ZP_BYTE:48 [ startProcessing::center_x#0 ] zp ZP_BYTE:62 [ startProcessing::spriteY#0 ] zp ZP_WORD:59 [ startProcessing::spriteX#0 ] zp ZP_BYTE:63 [ startProcessing::spritePtr#0 ] Limited combination testing to 100 combinations of 20736 possible. -Uplifting [mul8u] best 247327 combination zp ZP_WORD:31 [ mul8u::res#2 mul8u::res#6 mul8u::res#1 ] zp ZP_WORD:33 [ mul8u::mb#2 mul8u::mb#0 mul8u::mb#1 ] reg byte x [ mul8u::a#3 mul8u::a#6 mul8u::a#2 mul8u::a#1 mul8u::a#0 ] reg byte a [ mul8u::$1 ] reg byte a [ mul8u::b#1 ] reg byte a [ mul8u::b#0 ] zp ZP_WORD:89 [ mul8u::return#2 ] zp ZP_WORD:94 [ mul8u::return#3 ] +Uplifting [mul8u] best 247402 combination zp ZP_WORD:31 [ mul8u::res#2 mul8u::res#6 mul8u::res#1 ] zp ZP_WORD:33 [ mul8u::mb#2 mul8u::mb#0 mul8u::mb#1 ] reg byte x [ mul8u::a#3 mul8u::a#6 mul8u::a#2 mul8u::a#1 mul8u::a#0 ] reg byte a [ mul8u::$1 ] reg byte a [ mul8u::b#1 ] reg byte a [ mul8u::b#0 ] zp ZP_WORD:89 [ mul8u::return#2 ] zp ZP_WORD:94 [ mul8u::return#3 ] Limited combination testing to 100 combinations of 192 possible. -Uplifting [initSquareTables] best 247167 combination reg byte a [ initSquareTables::x_dist#0 initSquareTables::$4 initSquareTables::$2 ] reg byte a [ initSquareTables::y_dist#0 initSquareTables::$12 initSquareTables::$10 ] zp ZP_BYTE:24 [ initSquareTables::x#2 initSquareTables::x#1 ] zp ZP_BYTE:26 [ initSquareTables::y#2 initSquareTables::y#1 ] zp ZP_BYTE:93 [ initSquareTables::$16 ] zp ZP_BYTE:98 [ initSquareTables::$17 ] zp ZP_WORD:91 [ initSquareTables::$6 ] zp ZP_WORD:96 [ initSquareTables::$14 ] +Uplifting [initSquareTables] best 247242 combination reg byte a [ initSquareTables::x_dist#0 initSquareTables::$4 initSquareTables::$2 ] reg byte a [ initSquareTables::y_dist#0 initSquareTables::$12 initSquareTables::$10 ] zp ZP_BYTE:24 [ initSquareTables::x#2 initSquareTables::x#1 ] zp ZP_BYTE:26 [ initSquareTables::y#2 initSquareTables::y#1 ] zp ZP_BYTE:93 [ initSquareTables::$16 ] zp ZP_BYTE:98 [ initSquareTables::$17 ] zp ZP_WORD:91 [ initSquareTables::$6 ] zp ZP_WORD:96 [ initSquareTables::$14 ] Limited combination testing to 100 combinations of 2304 possible. -Uplifting [main] best 246787 combination zp ZP_WORD:3 [ main::sp#2 main::sp#1 ] zp ZP_WORD:5 [ main::src#2 main::src#1 ] zp ZP_WORD:7 [ main::dst#2 main::dst#1 ] zp ZP_WORD:46 [ main::center_dist#0 ] reg byte y [ main::i#2 main::i#1 ] reg byte x [ main::$17 ] reg byte y [ main::center_x#0 ] reg byte x [ main::center_y#0 ] -Uplifting [processChars] best 246547 combination reg byte a [ processChars::$18 ] reg byte a [ processChars::$9 ] reg byte a [ processChars::$10 ] reg byte a [ processChars::$12 ] zp ZP_BYTE:108 [ processChars::$16 ] zp ZP_BYTE:36 [ processChars::i#10 processChars::i#1 ] zp ZP_BYTE:106 [ processChars::$13 ] zp ZP_BYTE:103 [ processChars::bitmask#0 ] zp ZP_WORD:101 [ processChars::processing#0 ] +Uplifting [main] best 246862 combination zp ZP_WORD:3 [ main::sp#2 main::sp#1 ] zp ZP_WORD:5 [ main::src#2 main::src#1 ] zp ZP_WORD:7 [ main::dst#2 main::dst#1 ] zp ZP_WORD:46 [ main::center_dist#0 ] reg byte y [ main::i#2 main::i#1 ] reg byte x [ main::$17 ] reg byte y [ main::center_x#0 ] reg byte x [ main::center_y#0 ] +Uplifting [processChars] best 246622 combination reg byte a [ processChars::$18 ] reg byte a [ processChars::$9 ] reg byte a [ processChars::$10 ] reg byte a [ processChars::$12 ] zp ZP_BYTE:108 [ processChars::$16 ] zp ZP_BYTE:36 [ processChars::i#10 processChars::i#1 ] zp ZP_BYTE:106 [ processChars::$13 ] zp ZP_BYTE:103 [ processChars::bitmask#0 ] zp ZP_WORD:101 [ processChars::processing#0 ] Limited combination testing to 100 combinations of 2048 possible. -Uplifting [irqTop] best 246367 combination reg byte x [ irqTop::i#2 irqTop::i#1 ] reg byte x [ irqTop::i1#2 irqTop::i1#1 ] -Uplifting [irqBottom] best 246277 combination reg byte x [ irqBottom::i#2 irqBottom::i#1 ] -Uplifting [ProcessingChar] best 246277 combination -Uplifting [ProcessingSprite] best 246277 combination -Uplifting [setupRasterIrq] best 246277 combination -Uplifting [] best 246277 combination +Uplifting [irqTop] best 246442 combination reg byte x [ irqTop::i#2 irqTop::i#1 ] reg byte x [ irqTop::i1#2 irqTop::i1#1 ] +Uplifting [irqBottom] best 246352 combination reg byte x [ irqBottom::i#2 irqBottom::i#1 ] +Uplifting [ProcessingChar] best 246352 combination +Uplifting [ProcessingSprite] best 246352 combination +Uplifting [setupRasterIrq] best 246352 combination +Uplifting [] best 246352 combination Attempting to uplift remaining variables inzp ZP_BYTE:10 [ startProcessing::freeIdx#2 startProcessing::freeIdx#8 startProcessing::i#2 startProcessing::i#1 ] -Uplifting [startProcessing] best 246277 combination zp ZP_BYTE:10 [ startProcessing::freeIdx#2 startProcessing::freeIdx#8 startProcessing::i#2 startProcessing::i#1 ] +Uplifting [startProcessing] best 246352 combination zp ZP_BYTE:10 [ startProcessing::freeIdx#2 startProcessing::freeIdx#8 startProcessing::i#2 startProcessing::i#1 ] Attempting to uplift remaining variables inzp ZP_BYTE:21 [ getCharToProcess::closest_y#7 getCharToProcess::closest_y#9 getCharToProcess::return_y#1 getCharToProcess::return_y#7 ] -Uplifting [getCharToProcess] best 246277 combination zp ZP_BYTE:21 [ getCharToProcess::closest_y#7 getCharToProcess::closest_y#9 getCharToProcess::return_y#1 getCharToProcess::return_y#7 ] +Uplifting [getCharToProcess] best 246352 combination zp ZP_BYTE:21 [ getCharToProcess::closest_y#7 getCharToProcess::closest_y#9 getCharToProcess::return_y#1 getCharToProcess::return_y#7 ] Attempting to uplift remaining variables inzp ZP_BYTE:20 [ getCharToProcess::closest_x#7 getCharToProcess::closest_x#9 getCharToProcess::return_x#1 getCharToProcess::return_x#7 ] -Uplifting [getCharToProcess] best 246277 combination zp ZP_BYTE:20 [ getCharToProcess::closest_x#7 getCharToProcess::closest_x#9 getCharToProcess::return_x#1 getCharToProcess::return_x#7 ] +Uplifting [getCharToProcess] best 246352 combination zp ZP_BYTE:20 [ getCharToProcess::closest_x#7 getCharToProcess::closest_x#9 getCharToProcess::return_x#1 getCharToProcess::return_x#7 ] Attempting to uplift remaining variables inzp ZP_BYTE:17 [ getCharToProcess::x#2 getCharToProcess::x#1 ] -Uplifting [getCharToProcess] best 246277 combination zp ZP_BYTE:17 [ getCharToProcess::x#2 getCharToProcess::x#1 ] +Uplifting [getCharToProcess] best 246352 combination zp ZP_BYTE:17 [ getCharToProcess::x#2 getCharToProcess::x#1 ] Attempting to uplift remaining variables inzp ZP_BYTE:77 [ getCharToProcess::$13 ] -Uplifting [getCharToProcess] best 242277 combination reg byte x [ getCharToProcess::$13 ] +Uplifting [getCharToProcess] best 242352 combination reg byte x [ getCharToProcess::$13 ] Attempting to uplift remaining variables inzp ZP_BYTE:16 [ getCharToProcess::y#7 getCharToProcess::y#1 ] -Uplifting [getCharToProcess] best 242277 combination zp ZP_BYTE:16 [ getCharToProcess::y#7 getCharToProcess::y#1 ] +Uplifting [getCharToProcess] best 242352 combination zp ZP_BYTE:16 [ getCharToProcess::y#7 getCharToProcess::y#1 ] Attempting to uplift remaining variables inzp ZP_BYTE:24 [ initSquareTables::x#2 initSquareTables::x#1 ] -Uplifting [initSquareTables] best 242277 combination zp ZP_BYTE:24 [ initSquareTables::x#2 initSquareTables::x#1 ] +Uplifting [initSquareTables] best 242352 combination zp ZP_BYTE:24 [ initSquareTables::x#2 initSquareTables::x#1 ] Attempting to uplift remaining variables inzp ZP_BYTE:26 [ initSquareTables::y#2 initSquareTables::y#1 ] -Uplifting [initSquareTables] best 242277 combination zp ZP_BYTE:26 [ initSquareTables::y#2 initSquareTables::y#1 ] +Uplifting [initSquareTables] best 242352 combination zp ZP_BYTE:26 [ initSquareTables::y#2 initSquareTables::y#1 ] Attempting to uplift remaining variables inzp ZP_BYTE:93 [ initSquareTables::$16 ] -Uplifting [initSquareTables] best 242237 combination reg byte a [ initSquareTables::$16 ] +Uplifting [initSquareTables] best 242312 combination reg byte a [ initSquareTables::$16 ] Attempting to uplift remaining variables inzp ZP_BYTE:98 [ initSquareTables::$17 ] -Uplifting [initSquareTables] best 242197 combination reg byte a [ initSquareTables::$17 ] +Uplifting [initSquareTables] best 242272 combination reg byte a [ initSquareTables::$17 ] Attempting to uplift remaining variables inzp ZP_BYTE:108 [ processChars::$16 ] -Uplifting [processChars] best 242137 combination reg byte a [ processChars::$16 ] +Uplifting [processChars] best 242212 combination reg byte a [ processChars::$16 ] Attempting to uplift remaining variables inzp ZP_BYTE:36 [ processChars::i#10 processChars::i#1 ] -Uplifting [processChars] best 242137 combination zp ZP_BYTE:36 [ processChars::i#10 processChars::i#1 ] +Uplifting [processChars] best 242212 combination zp ZP_BYTE:36 [ processChars::i#10 processChars::i#1 ] Attempting to uplift remaining variables inzp ZP_BYTE:106 [ processChars::$13 ] -Uplifting [processChars] best 242067 combination reg byte x [ processChars::$13 ] +Uplifting [processChars] best 242142 combination reg byte x [ processChars::$13 ] Attempting to uplift remaining variables inzp ZP_BYTE:40 [ getCharToProcess::return_x#0 ] -Uplifting [getCharToProcess] best 242007 combination reg byte y [ getCharToProcess::return_x#0 ] +Uplifting [getCharToProcess] best 242082 combination reg byte y [ getCharToProcess::return_x#0 ] Attempting to uplift remaining variables inzp ZP_BYTE:41 [ getCharToProcess::return_y#0 ] -Uplifting [getCharToProcess] best 241947 combination reg byte x [ getCharToProcess::return_y#0 ] +Uplifting [getCharToProcess] best 242022 combination reg byte x [ getCharToProcess::return_y#0 ] Attempting to uplift remaining variables inzp ZP_BYTE:103 [ processChars::bitmask#0 ] -Uplifting [processChars] best 241947 combination zp ZP_BYTE:103 [ processChars::bitmask#0 ] +Uplifting [processChars] best 242022 combination zp ZP_BYTE:103 [ processChars::bitmask#0 ] Attempting to uplift remaining variables inzp ZP_BYTE:76 [ startProcessing::$22 ] -Uplifting [startProcessing] best 241928 combination reg byte x [ startProcessing::$22 ] +Uplifting [startProcessing] best 242003 combination reg byte x [ startProcessing::$22 ] Attempting to uplift remaining variables inzp ZP_BYTE:49 [ startProcessing::center_y#0 ] -Uplifting [startProcessing] best 241928 combination zp ZP_BYTE:49 [ startProcessing::center_y#0 ] +Uplifting [startProcessing] best 242003 combination zp ZP_BYTE:49 [ startProcessing::center_y#0 ] Attempting to uplift remaining variables inzp ZP_BYTE:48 [ startProcessing::center_x#0 ] -Uplifting [startProcessing] best 241928 combination zp ZP_BYTE:48 [ startProcessing::center_x#0 ] +Uplifting [startProcessing] best 242003 combination zp ZP_BYTE:48 [ startProcessing::center_x#0 ] Attempting to uplift remaining variables inzp ZP_BYTE:62 [ startProcessing::spriteY#0 ] -Uplifting [startProcessing] best 241926 combination reg byte y [ startProcessing::spriteY#0 ] +Uplifting [startProcessing] best 242001 combination reg byte y [ startProcessing::spriteY#0 ] Attempting to uplift remaining variables inzp ZP_BYTE:63 [ startProcessing::spritePtr#0 ] -Uplifting [startProcessing] best 241926 combination zp ZP_BYTE:63 [ startProcessing::spritePtr#0 ] +Uplifting [startProcessing] best 242001 combination zp ZP_BYTE:63 [ startProcessing::spritePtr#0 ] Coalescing zero page register with common assignment [ zp ZP_WORD:11 [ startProcessing::spriteData#2 startProcessing::spriteData#0 startProcessing::spriteData#1 ] ] with [ zp ZP_WORD:53 [ startProcessing::$1 ] ] - score: 1 Coalescing zero page register with common assignment [ zp ZP_WORD:22 [ getCharToProcess::return_dist#1 getCharToProcess::return_dist#5 getCharToProcess::return_dist#6 getCharToProcess::dist#0 ] ] with [ zp ZP_WORD:42 [ getCharToProcess::return_dist#0 ] ] - score: 1 Coalescing zero page register with common assignment [ zp ZP_WORD:31 [ mul8u::res#2 mul8u::res#6 mul8u::res#1 ] ] with [ zp ZP_WORD:89 [ mul8u::return#2 ] ] - score: 1 @@ -6439,9 +6441,11 @@ processChars: { ldy #OFFSET_STRUCT_PROCESSINGSPRITE_PTR lda (processing),y ldy #OFFSET_STRUCT_PROCESSINGSPRITE_ID + pha lda (processing),y tay - lda SCREEN+SPRITE_PTRS,y + pla + sta SCREEN+SPRITE_PTRS,y //SEG325 [181] *((byte*)(struct ProcessingSprite*) processChars::processing#0 + (const byte) OFFSET_STRUCT_PROCESSINGSPRITE_STATUS) ← (const byte) STATUS_PROCESSING#0 -- pbuz1_derefidx_vbuc1=vbuc2 // Set status lda #STATUS_PROCESSING @@ -6835,7 +6839,7 @@ Succesful ASM optimization Pass5UnnecesaryLoadElimination Removing instruction bbegin: Succesful ASM optimization Pass5UnusedLabelElimination Fixing long branch [326] bne b2 to beq -Fixing long branch [752] bne b1 to beq +Fixing long branch [754] bne b1 to beq Fixing long branch [188] bne b3 to beq Fixing long branch [194] beq b8 to bne Fixing long branch [374] beq b11 to bne @@ -7243,7 +7247,7 @@ reg byte a [ processChars::$16 ] FINAL ASSEMBLER -Score: 225871 +Score: 225946 //SEG0 File Comments // Black Hole at the center of the BASIC screen sucking in letters @@ -8282,9 +8286,11 @@ processChars: { ldy #OFFSET_STRUCT_PROCESSINGSPRITE_PTR lda (processing),y ldy #OFFSET_STRUCT_PROCESSINGSPRITE_ID + pha lda (processing),y tay - lda SCREEN+SPRITE_PTRS,y + pla + sta SCREEN+SPRITE_PTRS,y //SEG325 [181] *((byte*)(struct ProcessingSprite*) processChars::processing#0 + (const byte) OFFSET_STRUCT_PROCESSINGSPRITE_STATUS) ← (const byte) STATUS_PROCESSING#0 -- pbuz1_derefidx_vbuc1=vbuc2 // Set status lda #STATUS_PROCESSING diff --git a/src/test/ref/fragments-complex.log b/src/test/ref/fragments-complex.log index abf4dfe18..6a0257aab 100644 --- a/src/test/ref/fragments-complex.log +++ b/src/test/ref/fragments-complex.log @@ -41,3 +41,12 @@ pbuz1_derefidx_vbuaa=pbuz2_derefidx_vbuc1_band_pbuz3_derefidx_vbuc2 < pbuz1_dere and ({z3}),y ldy $ff sta ({z1}),y +pbuc1_derefidx_pbuz1_derefidx_vbuc2=pbuz1_derefidx_vbuc3 < pbuc1_derefidx_pbuz1_derefidx_vbuc2=pbuz1_derefidx_vbuyy < pbuc1_derefidx_pbuz1_derefidx_vbuc2=vbuaa < pbuc1_derefidx_pbuz1_derefidx_vbuyy=vbuaa - clobber:A Y cycles:29.0 + ldy #{c3} + lda ({z1}),y + ldy #{c2} + pha + lda ({z1}),y + tay + pla + sta {c1},y