diff --git a/src/main/java/dk/camelot64/kickc/Compiler.java b/src/main/java/dk/camelot64/kickc/Compiler.java index 483767f7d..2322dec92 100644 --- a/src/main/java/dk/camelot64/kickc/Compiler.java +++ b/src/main/java/dk/camelot64/kickc/Compiler.java @@ -455,6 +455,7 @@ public class Compiler { pass5Optimizations.add(new Pass5UnnecesaryLoadElimination(program)); pass5Optimizations.add(new Pass5RedundantLabelElimination(program)); pass5Optimizations.add(new Pass5UnusedLabelElimination(program)); + pass5Optimizations.add(new Pass5SkipBegin(program)); pass5Optimizations.add(new Pass5DoubleJumpElimination(program)); pass5Optimizations.add(new Pass5UnreachableCodeElimination(program)); pass5Optimizations.add(new Pass5RelabelLongLabels(program)); diff --git a/src/main/java/dk/camelot64/kickc/asm/AsmBasicUpstart.java b/src/main/java/dk/camelot64/kickc/asm/AsmBasicUpstart.java index 9b9a5d652..e0c69c54e 100644 --- a/src/main/java/dk/camelot64/kickc/asm/AsmBasicUpstart.java +++ b/src/main/java/dk/camelot64/kickc/asm/AsmBasicUpstart.java @@ -3,11 +3,19 @@ package dk.camelot64.kickc.asm; /** Set the program counter */ public class AsmBasicUpstart implements AsmLine { - private final String function; + private String label; private int index; - public AsmBasicUpstart(String function) { - this.function = function; + public AsmBasicUpstart(String label) { + this.label = label; + } + + public String getLabel() { + return label; + } + + public void setLabel(String label) { + this.label = label; } @Override @@ -22,7 +30,7 @@ public class AsmBasicUpstart implements AsmLine { @Override public String getAsm() { - return ":BasicUpstart(" + function + ")"; + return ":BasicUpstart(" + label + ")"; } @Override diff --git a/src/main/java/dk/camelot64/kickc/model/values/SymbolRef.java b/src/main/java/dk/camelot64/kickc/model/values/SymbolRef.java index b0a103172..65d595985 100644 --- a/src/main/java/dk/camelot64/kickc/model/values/SymbolRef.java +++ b/src/main/java/dk/camelot64/kickc/model/values/SymbolRef.java @@ -9,6 +9,7 @@ public class SymbolRef implements Value { public static final String BEGIN_BLOCK_NAME = "@begin"; public static final String END_BLOCK_NAME = "@end"; public static final String PROCEXIT_BLOCK_NAME = "@return"; + public static final String MAIN_PROC_NAME = "main"; /** The full name of the variable. Allowing lookup in the symbol table. */ private String fullName; diff --git a/src/main/java/dk/camelot64/kickc/passes/Pass4CodeGeneration.java b/src/main/java/dk/camelot64/kickc/passes/Pass4CodeGeneration.java index 162ae810c..d1d6aa43a 100644 --- a/src/main/java/dk/camelot64/kickc/passes/Pass4CodeGeneration.java +++ b/src/main/java/dk/camelot64/kickc/passes/Pass4CodeGeneration.java @@ -47,7 +47,7 @@ public class Pass4CodeGeneration { asm.startSegment( currentScope, null, "Basic Upstart"); asm.addLine(new AsmSetPc("Basic", AsmFormat.getAsmNumber(0x0801))); - asm.addLine(new AsmBasicUpstart("main")); + asm.addLine(new AsmBasicUpstart("bbegin")); asm.addLine(new AsmSetPc("Program", AsmFormat.getAsmNumber(0x080d))); // Generate global ZP labels diff --git a/src/main/java/dk/camelot64/kickc/passes/Pass5RedundantLabelElimination.java b/src/main/java/dk/camelot64/kickc/passes/Pass5RedundantLabelElimination.java index c5759dbe3..817ff86d0 100644 --- a/src/main/java/dk/camelot64/kickc/passes/Pass5RedundantLabelElimination.java +++ b/src/main/java/dk/camelot64/kickc/passes/Pass5RedundantLabelElimination.java @@ -29,20 +29,25 @@ public class Pass5RedundantLabelElimination extends Pass5AsmOptimization { currentScope = ((AsmScopeBegin) line).getLabel(); } else if(line instanceof AsmScopeEnd) { currentScope = ""; + } else if(line instanceof AsmBasicUpstart) { + String labelStr = ((AsmBasicUpstart) line).getLabel(); + String labelReplacementStr = getLabelReplacement(redundantLabelSet, currentScope, labelStr); + if(labelReplacementStr!=null) { + getLog().append("Replacing label " + labelStr + " with " + labelReplacementStr); + ((AsmBasicUpstart) line).setLabel(labelReplacementStr); + } } else if(line instanceof AsmInstruction) { AsmInstruction instruction = (AsmInstruction) line; if(instruction.getType().isJump()) { String labelStr = instruction.getParameter(); - if(!labelStr.contains("!")) { - // If redundant - Replace with the shortest - for(RedundantLabels redundantLabels : redundantLabelSet) { - if(redundantLabels.getScope().equals(currentScope) && redundantLabels.isRedundant(labelStr)) { - getLog().append("Replacing label " + labelStr + " with " + redundantLabels.getKeep()); - instruction.setParameter(redundantLabels.getKeep()); - } - } + String labelReplacementStr = getLabelReplacement(redundantLabelSet, currentScope, labelStr); + if(labelReplacementStr!=null) { + getLog().append("Replacing label " + labelStr + " with " + labelReplacementStr); + instruction.setParameter(labelReplacementStr); } + } + } else if(line instanceof AsmLabel) { AsmLabel label = (AsmLabel) line; String labelStr = label.getLabel(); @@ -61,6 +66,26 @@ public class Pass5RedundantLabelElimination extends Pass5AsmOptimization { return removeLines.size() > 0; } + /** + * Look for a replacement for a label. Return the replacement if found. + * @param redundantLabelSet The set of all redundant labels. + * @param currentScope The current scope + * @param labelStr The label string to replace + * @return The replacement for the passed label. Null if it should not be replaced. + */ + private String getLabelReplacement(List redundantLabelSet, String currentScope, String labelStr) { + String labelReplacementStr = null; + if(!labelStr.contains("!")) { + // If redundant - Replace with the shortest + for(RedundantLabels redundantLabels : redundantLabelSet) { + if(redundantLabels.getScope().equals(currentScope) && redundantLabels.isRedundant(labelStr)) { + labelReplacementStr = redundantLabels.getKeep(); + } + } + } + return labelReplacementStr; + } + /** * Find all redundant labels in the ASM * @@ -116,7 +141,12 @@ public class Pass5RedundantLabelElimination extends Pass5AsmOptimization { } public void add(String label) { - if(keep.length() < label.length()) { + if("bbegin".equals(label)) { + redundant.add(label); + keep = label; + } else if("bbegin".equals(keep)) { + redundant.add(label); + } else if(keep.length() < label.length()) { redundant.add(label); } else { redundant.add(keep); diff --git a/src/main/java/dk/camelot64/kickc/passes/Pass5SkipBegin.java b/src/main/java/dk/camelot64/kickc/passes/Pass5SkipBegin.java new file mode 100644 index 000000000..09571151b --- /dev/null +++ b/src/main/java/dk/camelot64/kickc/passes/Pass5SkipBegin.java @@ -0,0 +1,94 @@ +package dk.camelot64.kickc.passes; + +import dk.camelot64.kickc.asm.AsmBasicUpstart; +import dk.camelot64.kickc.asm.AsmInstruction; +import dk.camelot64.kickc.asm.AsmLine; +import dk.camelot64.kickc.asm.AsmSegment; +import dk.camelot64.kickc.model.ControlFlowBlock; +import dk.camelot64.kickc.model.Program; +import dk.camelot64.kickc.model.statements.Statement; +import dk.camelot64.kickc.model.statements.StatementCall; +import dk.camelot64.kickc.model.statements.StatementKickAsm; +import dk.camelot64.kickc.model.statements.StatementPhiBlock; +import dk.camelot64.kickc.model.values.LabelRef; +import dk.camelot64.kickc.model.values.ProcedureRef; +import dk.camelot64.kickc.model.values.SymbolRef; + +import java.util.ListIterator; + +/** + * If the static code section from @begin to @end only has a call to main then modify BasicUpstart to call main directly + */ +public class Pass5SkipBegin extends Pass5AsmOptimization { + + public Pass5SkipBegin(Program program) { + super(program); + } + + public boolean optimize() { + ControlFlowBlock beginBlock = getProgram().getGraph().getBlock(new LabelRef(SymbolRef.BEGIN_BLOCK_NAME)); + boolean canSkip = canSkipBegin(beginBlock); + boolean optimized = false; + if(canSkip) { + // Change BasicUpstart() to call main directly and remove the JSR main + for(AsmSegment segment : getAsmProgram().getSegments()) { + ListIterator lineIterator = segment.getLines().listIterator(); + while(lineIterator.hasNext()) { + AsmLine line = lineIterator.next(); + if(line instanceof AsmBasicUpstart) { + AsmBasicUpstart basicUpstart = (AsmBasicUpstart) line; + if(!SymbolRef.MAIN_PROC_NAME.equals(basicUpstart.getLabel())) { + basicUpstart.setLabel(SymbolRef.MAIN_PROC_NAME); + optimized = true; + getLog().append("Updating BasicUpstart to call main directly"); + } + } else if(line instanceof AsmInstruction) { + AsmInstruction instruction = (AsmInstruction) line; + if(instruction.getType().getMnemnonic().equals("jsr")) { + if(instruction.getParameter().equals(SymbolRef.MAIN_PROC_NAME)) { + lineIterator.remove(); + optimized = true; + getLog().append("Removing instruction " + line.getAsm()); + } + } + } + } + } + } + return optimized; + } + + /** + * Examines whether the @begin/@end code can be skipped + * This looks through all statements to check that the only one is a call to main() + * + * @param block The block to examine (initially the @begin block) + * @return true if the @begin/@end code can be skipped + */ + private boolean canSkipBegin(ControlFlowBlock block) { + for(Statement statement : block.getStatements()) { + if(statement instanceof StatementPhiBlock) { + if(((StatementPhiBlock) statement).getPhiVariables().size() > 0) { + return false; + } + } else if(statement instanceof StatementCall) { + ProcedureRef procedure = ((StatementCall) statement).getProcedure(); + if(!SymbolRef.MAIN_PROC_NAME.equals(procedure.getFullName())) { + return false; + } + } else if(statement instanceof StatementKickAsm){ + // KASM-statements do not prevent skipping begin + } else { + return false; + } + } + if(block.getConditionalSuccessor() != null) { + return false; + } + if(block.getDefaultSuccessor() != null) { + ControlFlowBlock successor = getProgram().getGraph().getBlock(block.getDefaultSuccessor()); + return canSkipBegin(successor); + } + return true; + } +} diff --git a/src/main/java/dk/camelot64/kickc/passes/Pass5UnusedLabelElimination.java b/src/main/java/dk/camelot64/kickc/passes/Pass5UnusedLabelElimination.java index cfeec7634..61f28de5f 100644 --- a/src/main/java/dk/camelot64/kickc/passes/Pass5UnusedLabelElimination.java +++ b/src/main/java/dk/camelot64/kickc/passes/Pass5UnusedLabelElimination.java @@ -28,6 +28,9 @@ public class Pass5UnusedLabelElimination extends Pass5AsmOptimization { currentScope = ((AsmScopeBegin) line).getLabel(); } else if(line instanceof AsmScopeEnd) { currentScope = ""; + } else if(line instanceof AsmBasicUpstart) { + String labelStr = currentScope + "::" + ((AsmBasicUpstart) line).getLabel(); + usedLabels.add(labelStr); } else if(line instanceof AsmInstruction) { AsmInstruction instruction = (AsmInstruction) line; if(instruction.getType().isJump()) { diff --git a/src/test/kc/examples/tetris/test-sprites.asm b/src/test/kc/examples/tetris/test-sprites.asm deleted file mode 100644 index c5f6c2845..000000000 --- a/src/test/kc/examples/tetris/test-sprites.asm +++ /dev/null @@ -1,16 +0,0 @@ - - -.label PLAYFIELD_SPRITES = $3000 - -.pc = PLAYFIELD_SPRITES "PLayfield Sprites" -.var charset = LoadPicture("nes-playfield.png", List().add($010101, $000000)) -.for(var sy=0;sy<10;sy++) { - .for(var sx=0;sx<3;sx++) { - .for (var y=0;y<21; y++) { - .for (var c=0; c<3; c++) { - .byte charset.getSinglecolorByte(sx*3+c,sy*21+y) - } - } - .byte 0 - } -} diff --git a/src/test/kc/examples/tetris/test-sprites.kc b/src/test/kc/examples/tetris/test-sprites.kc index aeccd7499..cc714ef5a 100644 --- a/src/test/kc/examples/tetris/test-sprites.kc +++ b/src/test/kc/examples/tetris/test-sprites.kc @@ -46,12 +46,6 @@ volatile byte irq_cnt = 0; // Setup the IRQ void init_irq() { - // Stup the first IRQ position - irq_raster_next = IRQ_RASTER_FIRST; - irq_sprite_ypos = 50; - irq_sprite_ptr = toSpritePtr(PLAYFIELD_SPRITES); - irq_cnt = 0; - asm { sei } // Disable CIA 1 Timer IRQ *CIA1_INTERRUPT = CIA_INTERRUPT_CLEAR; diff --git a/src/test/ref/array-length-symbolic-min.asm b/src/test/ref/array-length-symbolic-min.asm index 481b5424c..d7bf5d16c 100644 --- a/src/test/ref/array-length-symbolic-min.asm +++ b/src/test/ref/array-length-symbolic-min.asm @@ -2,7 +2,6 @@ :BasicUpstart(main) .pc = $80d "Program" .const SZ = $f - jsr main main: { ldx #0 b1: diff --git a/src/test/ref/array-length-symbolic-min.log b/src/test/ref/array-length-symbolic-min.log index ded0a4dea..a0115d31d 100644 --- a/src/test/ref/array-length-symbolic-min.log +++ b/src/test/ref/array-length-symbolic-min.log @@ -138,7 +138,7 @@ Allocated zp ZP_BYTE:2 [ main::sub#2 main::sub#1 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .const SZ = $f @@ -204,7 +204,7 @@ Uplifting [] best 263 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .const SZ = $f @@ -260,19 +260,23 @@ Removing instruction jmp b1 Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination Replacing label b1_from_b1 with b1 -Removing instruction bbegin: Removing instruction b1_from_bbegin: +Removing instruction b1: Removing instruction main_from_b1: Removing instruction bend_from_b1: Removing instruction b1_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b1: Removing instruction bend: Removing instruction b1_from_main: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Removing instruction jmp b1 Succesful ASM optimization Pass5NextJumpElimination +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @1 @@ -294,7 +298,7 @@ reg byte x [ main::sub#2 main::sub#1 ] FINAL ASSEMBLER -Score: 167 +Score: 161 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -307,7 +311,6 @@ Score: 167 //SEG4 @1 //SEG5 [2] call main //SEG6 [4] phi from @1 to main [phi:@1->main] - jsr main //SEG7 [3] phi from @1 to @end [phi:@1->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/array-length-symbolic.asm b/src/test/ref/array-length-symbolic.asm index 95f19bc0a..713abe2fc 100644 --- a/src/test/ref/array-length-symbolic.asm +++ b/src/test/ref/array-length-symbolic.asm @@ -3,7 +3,6 @@ .pc = $80d "Program" .const ITEM_COUNT = 3 .const ITEM_SIZE = 5 - jsr main main: { .label cur_item = 2 lda #main] - jsr main //SEG7 [3] phi from @1 to @end [phi:@1->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/arrays-init.asm b/src/test/ref/arrays-init.asm index 840bb4d6a..d0726e755 100644 --- a/src/test/ref/arrays-init.asm +++ b/src/test/ref/arrays-init.asm @@ -2,7 +2,6 @@ :BasicUpstart(main) .pc = $80d "Program" .label SCREEN = $400 - jsr main main: { lda #'c' sta b diff --git a/src/test/ref/arrays-init.log b/src/test/ref/arrays-init.log index 7b8befe30..b0ce21dda 100644 --- a/src/test/ref/arrays-init.log +++ b/src/test/ref/arrays-init.log @@ -118,7 +118,7 @@ Complete equivalence classes INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label SCREEN = $400 @@ -176,7 +176,7 @@ Uplifting [] best 51 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label SCREEN = $400 @@ -225,14 +225,18 @@ Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination Removing instruction lda b Succesful ASM optimization Pass5UnnecesaryLoadElimination -Removing instruction bbegin: Removing instruction b1_from_bbegin: +Removing instruction b1: Removing instruction bend_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b1: Removing instruction bend: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @1 @@ -252,7 +256,7 @@ FINAL SYMBOL TABLE FINAL ASSEMBLER -Score: 38 +Score: 32 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -264,7 +268,6 @@ Score: 38 //SEG3 [1] phi from @begin to @1 [phi:@begin->@1] //SEG4 @1 //SEG5 [2] call main - jsr main //SEG6 [3] phi from @1 to @end [phi:@1->@end] //SEG7 @end //SEG8 main diff --git a/src/test/ref/asm-clobber.asm b/src/test/ref/asm-clobber.asm index abaf65c13..170739e25 100644 --- a/src/test/ref/asm-clobber.asm +++ b/src/test/ref/asm-clobber.asm @@ -2,7 +2,6 @@ :BasicUpstart(main) .pc = $80d "Program" .label SCREEN = $400 - jsr main main: { .label l = 2 ldx #0 diff --git a/src/test/ref/asm-clobber.log b/src/test/ref/asm-clobber.log index cf68fae8a..59c880c51 100644 --- a/src/test/ref/asm-clobber.log +++ b/src/test/ref/asm-clobber.log @@ -275,7 +275,7 @@ Allocated zp ZP_BYTE:5 [ main::l#2 main::l#1 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label SCREEN = $400 @@ -424,7 +424,7 @@ Allocated (was zp ZP_BYTE:5) zp ZP_BYTE:2 [ main::l#2 main::l#1 ] ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label SCREEN = $400 @@ -550,8 +550,8 @@ Replacing label b2_from_b2 with b2 Replacing label b1_from_b5 with b1 Replacing label b4_from_b4 with b4 Replacing label b3_from_b7 with b3 -Removing instruction bbegin: Removing instruction b1_from_bbegin: +Removing instruction b1: Removing instruction main_from_b1: Removing instruction bend_from_b1: Removing instruction b1_from_b5: @@ -561,7 +561,6 @@ Removing instruction b3_from_b7: Removing instruction b4_from_b3: Removing instruction b4_from_b4: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b1: Removing instruction bend: Removing instruction b1_from_main: Removing instruction b5: @@ -569,11 +568,16 @@ Removing instruction b3_from_b5: Removing instruction b7: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Removing instruction jmp b1 Removing instruction jmp b2 Removing instruction jmp b3 Removing instruction jmp b4 Succesful ASM optimization Pass5NextJumpElimination +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @1 @@ -609,7 +613,7 @@ zp ZP_BYTE:2 [ main::l#2 main::l#1 ] FINAL ASSEMBLER -Score: 4682 +Score: 4676 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -622,7 +626,6 @@ Score: 4682 //SEG4 @1 //SEG5 [2] call main //SEG6 [4] phi from @1 to main [phi:@1->main] - jsr main //SEG7 [3] phi from @1 to @end [phi:@1->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/bitmap-plotter.asm b/src/test/ref/bitmap-plotter.asm index 4fa32cba9..dfcf6c610 100644 --- a/src/test/ref/bitmap-plotter.asm +++ b/src/test/ref/bitmap-plotter.asm @@ -12,7 +12,6 @@ .label SCREEN = $400 .label BITMAP = $2000 .const plots_cnt = 8 - jsr main main: { lda #0 sta BGCOL diff --git a/src/test/ref/bitmap-plotter.log b/src/test/ref/bitmap-plotter.log index a49688305..32f33df98 100644 --- a/src/test/ref/bitmap-plotter.log +++ b/src/test/ref/bitmap-plotter.log @@ -1034,7 +1034,7 @@ Allocated zp ZP_BYTE:36 [ init_plot_tables::$10 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label D011 = $d011 @@ -1597,7 +1597,7 @@ Allocated (was zp ZP_WORD:22) zp ZP_WORD:6 [ plot::plotter_y#1 plot::plotter_y#2 ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label D011 = $d011 @@ -2008,8 +2008,8 @@ Replacing label b1_from_b1 with b1 Replacing label b1_from_b1 with b1 Replacing label b2_from_b2 with b2 Replacing label b2_from_b2 with b2 -Removing instruction bbegin: Removing instruction b5_from_bbegin: +Removing instruction b5: Removing instruction bend_from_b5: Removing instruction b5_from_main: Removing instruction init_plot_tables_from_b5: @@ -2023,7 +2023,6 @@ Removing instruction b2_from_b10: Removing instruction b1_from_b1: Removing instruction b2_from_b2: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b5: Removing instruction bend: Removing instruction init_screen_from_main: Removing instruction b5: @@ -2043,6 +2042,9 @@ Removing instruction b1_from_init_screen: Removing instruction b2_from_b1: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Skipping double jump to b2 in bne b10 Succesful ASM optimization Pass5DoubleJumpElimination Removing instruction jmp b1 @@ -2051,6 +2053,7 @@ Removing instruction jmp b3 Removing instruction jmp b1 Removing instruction jmp b2 Succesful ASM optimization Pass5NextJumpElimination +Removing instruction bbegin: Removing instruction b10: Succesful ASM optimization Pass5UnusedLabelElimination Removing unreachable instruction jmp b2 @@ -2197,7 +2200,7 @@ reg byte a [ init_plot_tables::$10 ] FINAL ASSEMBLER -Score: 6207 +Score: 6201 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -2219,7 +2222,6 @@ Score: 6207 //SEG3 [1] phi from @begin to @5 [phi:@begin->@5] //SEG4 @5 //SEG5 [2] call main - jsr main //SEG6 [3] phi from @5 to @end [phi:@5->@end] //SEG7 @end //SEG8 main diff --git a/src/test/ref/bitwise-not.asm b/src/test/ref/bitwise-not.asm index 848853dfb..757870bf0 100644 --- a/src/test/ref/bitwise-not.asm +++ b/src/test/ref/bitwise-not.asm @@ -1,7 +1,6 @@ .pc = $801 "Basic" :BasicUpstart(main) .pc = $80d "Program" - jsr main main: { .label SCREEN = $400 lda #1^$ff diff --git a/src/test/ref/bitwise-not.log b/src/test/ref/bitwise-not.log index 09f2a75b4..33fdf4399 100644 --- a/src/test/ref/bitwise-not.log +++ b/src/test/ref/bitwise-not.log @@ -124,7 +124,7 @@ Allocated zp ZP_BYTE:3 [ main::$1 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -201,7 +201,7 @@ Uplifting [] best 289 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -259,18 +259,22 @@ Removing instruction jmp b1 Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination Replacing label b1_from_b1 with b1 -Removing instruction bbegin: Removing instruction b1_from_bbegin: +Removing instruction b1: Removing instruction bend_from_b1: Removing instruction b1_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b1: Removing instruction bend: Removing instruction b1_from_main: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Removing instruction jmp b1 Succesful ASM optimization Pass5NextJumpElimination +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @1 @@ -291,7 +295,7 @@ reg byte a [ main::$1 ] FINAL ASSEMBLER -Score: 193 +Score: 187 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -302,7 +306,6 @@ Score: 193 //SEG3 [1] phi from @begin to @1 [phi:@begin->@1] //SEG4 @1 //SEG5 [2] call main - jsr main //SEG6 [3] phi from @1 to @end [phi:@1->@end] //SEG7 @end //SEG8 main diff --git a/src/test/ref/bool-const.asm b/src/test/ref/bool-const.asm index 9f58075e8..3d14a3e53 100644 --- a/src/test/ref/bool-const.asm +++ b/src/test/ref/bool-const.asm @@ -2,7 +2,6 @@ :BasicUpstart(main) .pc = $80d "Program" .label SCREEN = $400 - jsr main main: { jsr bool_const_if jsr bool_const_vars diff --git a/src/test/ref/bool-const.log b/src/test/ref/bool-const.log index 50688b4d7..024ced0fe 100644 --- a/src/test/ref/bool-const.log +++ b/src/test/ref/bool-const.log @@ -316,7 +316,7 @@ Complete equivalence classes INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label SCREEN = $400 @@ -430,7 +430,7 @@ Uplifting [] best 180 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label SCREEN = $400 @@ -536,8 +536,8 @@ Removing instruction jmp breturn Removing instruction jmp b1 Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination -Removing instruction bbegin: Removing instruction b4_from_bbegin: +Removing instruction b4: Removing instruction main_from_b4: Removing instruction bend_from_b4: Removing instruction b1_from_main: @@ -545,7 +545,6 @@ Removing instruction bool_const_vars_from_b1: Removing instruction b2_from_b1: Removing instruction bool_const_inline_from_b2: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b4: Removing instruction bend: Removing instruction bool_const_if_from_main: Removing instruction b1: @@ -558,6 +557,11 @@ Removing instruction breturn: Removing instruction b1: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @4 @@ -588,7 +592,7 @@ FINAL SYMBOL TABLE FINAL ASSEMBLER -Score: 66 +Score: 60 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -601,7 +605,6 @@ Score: 66 //SEG4 @4 //SEG5 [2] call main //SEG6 [4] phi from @4 to main [phi:@4->main] - jsr main //SEG7 [3] phi from @4 to @end [phi:@4->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/bool-function.asm b/src/test/ref/bool-function.asm index d1dbb00a1..270c09c18 100644 --- a/src/test/ref/bool-function.asm +++ b/src/test/ref/bool-function.asm @@ -1,7 +1,6 @@ .pc = $801 "Basic" :BasicUpstart(main) .pc = $80d "Program" - jsr main main: { .label screen = $400 ldx #0 diff --git a/src/test/ref/bool-function.log b/src/test/ref/bool-function.log index 5610c09ab..cb5cc57bd 100644 --- a/src/test/ref/bool-function.log +++ b/src/test/ref/bool-function.log @@ -257,7 +257,7 @@ Allocated zp ZP_BOOL:10 [ isSet::return#1 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -424,7 +424,7 @@ Allocated (was zp ZP_BOOL:4) zp ZP_BOOL:2 [ isSet::b#0 ] ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -538,13 +538,12 @@ Removing instruction jmp breturn Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination Replacing label b1_from_b3 with b1 -Removing instruction bbegin: Removing instruction b2_from_bbegin: +Removing instruction b2: Removing instruction main_from_b2: Removing instruction bend_from_b2: Removing instruction b1_from_b3: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b2: Removing instruction bend: Removing instruction b1_from_main: Removing instruction b7: @@ -552,8 +551,13 @@ Removing instruction b4: Removing instruction breturn: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Removing instruction jmp b1 Succesful ASM optimization Pass5NextJumpElimination +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @2 @@ -597,7 +601,7 @@ reg byte a [ isSet::return#1 ] FINAL ASSEMBLER -Score: 546 +Score: 540 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -609,7 +613,6 @@ Score: 546 //SEG4 @2 //SEG5 [2] call main //SEG6 [4] phi from @2 to main [phi:@2->main] - jsr main //SEG7 [3] phi from @2 to @end [phi:@2->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/bool-ifs.asm b/src/test/ref/bool-ifs.asm index d4569c203..b2cb02792 100644 --- a/src/test/ref/bool-ifs.asm +++ b/src/test/ref/bool-ifs.asm @@ -1,7 +1,6 @@ .pc = $801 "Basic" :BasicUpstart(main) .pc = $80d "Program" - jsr main main: { jsr bool_and jsr bool_or diff --git a/src/test/ref/bool-ifs.log b/src/test/ref/bool-ifs.log index 038822f96..4a70a6661 100644 --- a/src/test/ref/bool-ifs.log +++ b/src/test/ref/bool-ifs.log @@ -555,7 +555,7 @@ Allocated zp ZP_BYTE:10 [ bool_and::$1 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -937,7 +937,7 @@ Uplifting [] best 2548 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -1252,8 +1252,8 @@ Replacing label b1_from_b3 with b1 Replacing label b1_from_b3 with b1 Replacing label b1_from_b3 with b1 Replacing label b1_from_b3 with b1 -Removing instruction bbegin: Removing instruction b5_from_bbegin: +Removing instruction b5: Removing instruction main_from_b5: Removing instruction bend_from_b5: Removing instruction b1_from_main: @@ -1267,7 +1267,6 @@ Removing instruction b1_from_b3: Removing instruction b1_from_b3: Removing instruction b1_from_b3: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b5: Removing instruction bend: Removing instruction bool_and_from_main: Removing instruction b1: @@ -1288,11 +1287,16 @@ Removing instruction breturn: Removing instruction b1_from_bool_and: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Removing instruction jmp b1 Removing instruction jmp b1 Removing instruction jmp b1 Removing instruction jmp b1 Succesful ASM optimization Pass5NextJumpElimination +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @5 @@ -1371,7 +1375,7 @@ reg byte a [ bool_and::$1 ] FINAL ASSEMBLER -Score: 1810 +Score: 1804 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -1383,7 +1387,6 @@ Score: 1810 //SEG4 @5 //SEG5 [2] call main //SEG6 [4] phi from @5 to main [phi:@5->main] - jsr main //SEG7 [3] phi from @5 to @end [phi:@5->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/bool-pointer.asm b/src/test/ref/bool-pointer.asm index b5dc8dd7e..970cf6afd 100644 --- a/src/test/ref/bool-pointer.asm +++ b/src/test/ref/bool-pointer.asm @@ -1,7 +1,6 @@ .pc = $801 "Basic" :BasicUpstart(main) .pc = $80d "Program" - jsr main main: { lda #1 sta $400 diff --git a/src/test/ref/bool-pointer.log b/src/test/ref/bool-pointer.log index febb0661c..442835f06 100644 --- a/src/test/ref/bool-pointer.log +++ b/src/test/ref/bool-pointer.log @@ -116,7 +116,7 @@ Complete equivalence classes INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -178,7 +178,7 @@ Uplifting [] best 56 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -230,13 +230,17 @@ Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination Removing instruction lda $400+2 Succesful ASM optimization Pass5UnnecesaryLoadElimination -Removing instruction bbegin: Removing instruction b1_from_bbegin: +Removing instruction b1: Removing instruction bend_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b1: Removing instruction bend: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @1 @@ -250,7 +254,7 @@ FINAL SYMBOL TABLE FINAL ASSEMBLER -Score: 43 +Score: 37 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -261,7 +265,6 @@ Score: 43 //SEG3 [1] phi from @begin to @1 [phi:@begin->@1] //SEG4 @1 //SEG5 [2] call main - jsr main //SEG6 [3] phi from @1 to @end [phi:@1->@end] //SEG7 @end //SEG8 main diff --git a/src/test/ref/bool-vars.asm b/src/test/ref/bool-vars.asm index 7d8ed63ba..d4e70cf96 100644 --- a/src/test/ref/bool-vars.asm +++ b/src/test/ref/bool-vars.asm @@ -1,7 +1,6 @@ .pc = $801 "Basic" :BasicUpstart(main) .pc = $80d "Program" - jsr main main: { jsr bool_and jsr bool_or diff --git a/src/test/ref/bool-vars.log b/src/test/ref/bool-vars.log index ab2aba7bc..e205faf33 100644 --- a/src/test/ref/bool-vars.log +++ b/src/test/ref/bool-vars.log @@ -620,7 +620,7 @@ Allocated zp ZP_BYTE:11 [ bool_and::$1 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -1028,7 +1028,7 @@ Allocated (was zp ZP_BOOL:8) zp ZP_BOOL:3 [ bool_complex::o2#0 ] ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -1358,8 +1358,8 @@ Replacing label b1_from_b3 with b1 Replacing label b1_from_b3 with b1 Replacing label b1_from_b3 with b1 Replacing label b1_from_b3 with b1 -Removing instruction bbegin: Removing instruction b5_from_bbegin: +Removing instruction b5: Removing instruction main_from_b5: Removing instruction bend_from_b5: Removing instruction b1_from_main: @@ -1373,7 +1373,6 @@ Removing instruction b1_from_b3: Removing instruction b1_from_b3: Removing instruction b1_from_b3: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b5: Removing instruction bend: Removing instruction bool_and_from_main: Removing instruction b1: @@ -1394,11 +1393,16 @@ Removing instruction breturn: Removing instruction b1_from_bool_and: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Removing instruction jmp b1 Removing instruction jmp b1 Removing instruction jmp b1 Removing instruction jmp b1 Succesful ASM optimization Pass5NextJumpElimination +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @5 @@ -1493,7 +1497,7 @@ reg byte a [ bool_and::$1 ] FINAL ASSEMBLER -Score: 2095 +Score: 2089 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -1505,7 +1509,6 @@ Score: 2095 //SEG4 @5 //SEG5 [2] call main //SEG6 [4] phi from @5 to main [phi:@5->main] - jsr main //SEG7 [3] phi from @5 to @end [phi:@5->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/bresenham.asm b/src/test/ref/bresenham.asm index 468591c7a..dc3c1edec 100644 --- a/src/test/ref/bresenham.asm +++ b/src/test/ref/bresenham.asm @@ -3,7 +3,6 @@ .pc = $80d "Program" .const STAR = $51 .label SCREEN = $400 - jsr main main: { .const x1 = $27 .const y1 = $18 diff --git a/src/test/ref/bresenham.log b/src/test/ref/bresenham.log index 2c82a5b1e..701edf6e1 100644 --- a/src/test/ref/bresenham.log +++ b/src/test/ref/bresenham.log @@ -356,7 +356,7 @@ Allocated zp ZP_BYTE:6 [ main::y#2 main::y#4 main::y#1 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .const STAR = $51 @@ -506,7 +506,7 @@ Allocated (was zp ZP_BYTE:6) zp ZP_BYTE:5 [ main::y#2 main::y#4 main::y#1 ] ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .const STAR = $51 @@ -630,22 +630,26 @@ Removing instruction lda #4 Succesful ASM optimization Pass5UnnecesaryLoadElimination Replacing label b2_from_b1 with b2 Replacing label b1_from_b2 with b1 -Removing instruction bbegin: Removing instruction b1_from_bbegin: +Removing instruction b1: Removing instruction main_from_b1: Removing instruction bend_from_b1: Removing instruction b1_from_b2: Removing instruction b2_from_b1: Removing instruction b2_from_b3: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b1: Removing instruction bend: Removing instruction b1_from_main: Removing instruction b3: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Removing instruction jmp b1 Succesful ASM optimization Pass5NextJumpElimination +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @1 @@ -695,7 +699,7 @@ zp ZP_BYTE:5 [ main::y#2 main::y#4 main::y#1 ] FINAL ASSEMBLER -Score: 992 +Score: 986 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -709,7 +713,6 @@ Score: 992 //SEG4 @1 //SEG5 [2] call main //SEG6 [4] phi from @1 to main [phi:@1->main] - jsr main //SEG7 [3] phi from @1 to @end [phi:@1->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/bresenhamarr.asm b/src/test/ref/bresenhamarr.asm index f14708f16..d75054fc4 100644 --- a/src/test/ref/bresenhamarr.asm +++ b/src/test/ref/bresenhamarr.asm @@ -1,7 +1,6 @@ .pc = $801 "Basic" :BasicUpstart(main) .pc = $80d "Program" - jsr main main: { .const STAR = $51 .label screen = $400 diff --git a/src/test/ref/bresenhamarr.log b/src/test/ref/bresenhamarr.log index 156ecd7ba..a86f6bb6d 100644 --- a/src/test/ref/bresenhamarr.log +++ b/src/test/ref/bresenhamarr.log @@ -347,7 +347,7 @@ Allocated zp ZP_BYTE:6 [ main::y#2 main::y#4 main::y#1 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -499,7 +499,7 @@ Allocated (was zp ZP_BYTE:6) zp ZP_BYTE:4 [ main::y#2 main::y#4 main::y#1 ] ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -631,22 +631,26 @@ Succesful ASM optimization Pass5UnnecesaryLoadElimination Replacing label b2_from_b1 with b2 Replacing label b2_from_b1 with b2 Replacing label b1_from_b2 with b1 -Removing instruction bbegin: Removing instruction b1_from_bbegin: +Removing instruction b1: Removing instruction main_from_b1: Removing instruction bend_from_b1: Removing instruction b1_from_b2: Removing instruction b2_from_b1: Removing instruction b2_from_b3: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b1: Removing instruction bend: Removing instruction b1_from_main: Removing instruction b3: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Removing instruction jmp b1 Succesful ASM optimization Pass5NextJumpElimination +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @1 @@ -696,7 +700,7 @@ zp ZP_BYTE:4 [ main::y#2 main::y#4 main::y#1 ] FINAL ASSEMBLER -Score: 1072 +Score: 1066 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -708,7 +712,6 @@ Score: 1072 //SEG4 @1 //SEG5 [2] call main //SEG6 [4] phi from @1 to main [phi:@1->main] - jsr main //SEG7 [3] phi from @1 to @end [phi:@1->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/c64dtv-8bppcharstretch.asm b/src/test/ref/c64dtv-8bppcharstretch.asm index 86615cd74..228e5e8c1 100644 --- a/src/test/ref/c64dtv-8bppcharstretch.asm +++ b/src/test/ref/c64dtv-8bppcharstretch.asm @@ -41,7 +41,6 @@ .label DTV_PLANEB_MODULO_HI = $d048 .label SCREEN = $7c00 .label CHARSET8 = $8000 - jsr main main: { sei lda #PROCPORT_DDR_MEMORY_MASK diff --git a/src/test/ref/c64dtv-8bppcharstretch.log b/src/test/ref/c64dtv-8bppcharstretch.log index 572c9e685..60c318712 100644 --- a/src/test/ref/c64dtv-8bppcharstretch.log +++ b/src/test/ref/c64dtv-8bppcharstretch.log @@ -1916,7 +1916,7 @@ Allocated zp ZP_BYTE:26 [ gfx_init_screen0::$3 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label PROCPORT_DDR = 0 @@ -2667,7 +2667,7 @@ Allocated (was zp ZP_BYTE:10) zp ZP_BYTE:9 [ gfx_init_plane_charset8::col#2 gfx_ ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label PROCPORT_DDR = 0 @@ -3255,8 +3255,8 @@ Replacing label b2_from_b6 with b2 Replacing label b1_from_b7 with b1 Replacing label b2_from_b2 with b2 Replacing label b1_from_b3 with b1 -Removing instruction bbegin: Removing instruction b9_from_bbegin: +Removing instruction b9: Removing instruction bend_from_b9: Removing instruction b1_from_b1: Removing instruction b1_from_gfx_init: @@ -3269,7 +3269,6 @@ Removing instruction b1_from_b3: Removing instruction b2_from_b1: Removing instruction b2_from_b2: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b9: Removing instruction bend: Removing instruction gfx_init_from_main: Removing instruction b17: @@ -3294,6 +3293,9 @@ Removing instruction b1_from_gfx_init_screen0: Removing instruction b3: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Relabelling long label b4_from_b3 to b5 Succesful ASM optimization Pass5RelabelLongLabels Removing instruction jmp b1 @@ -3303,6 +3305,8 @@ Removing instruction jmp b3 Removing instruction jmp b1 Removing instruction jmp b2 Succesful ASM optimization Pass5NextJumpElimination +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @9 @@ -3634,7 +3638,7 @@ reg byte a [ gfx_init_screen0::$3 ] FINAL ASSEMBLER -Score: 75383 +Score: 75377 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -3685,7 +3689,6 @@ Score: 75383 //SEG3 [1] phi from @begin to @9 [phi:@begin->@9] //SEG4 @9 //SEG5 [2] call main - jsr main //SEG6 [3] phi from @9 to @end [phi:@9->@end] //SEG7 @end //SEG8 main diff --git a/src/test/ref/c64dtv-8bppchunkystretch.asm b/src/test/ref/c64dtv-8bppchunkystretch.asm index 6ea46f37d..c5606ac48 100644 --- a/src/test/ref/c64dtv-8bppchunkystretch.asm +++ b/src/test/ref/c64dtv-8bppchunkystretch.asm @@ -33,7 +33,6 @@ .label DTV_PLANEB_MODULO_LO = $d047 .label DTV_PLANEB_MODULO_HI = $d048 .label CHUNKY = $8000 - jsr main main: { sei lda #PROCPORT_DDR_MEMORY_MASK diff --git a/src/test/ref/c64dtv-8bppchunkystretch.log b/src/test/ref/c64dtv-8bppchunkystretch.log index 55d85605e..8673472c1 100644 --- a/src/test/ref/c64dtv-8bppchunkystretch.log +++ b/src/test/ref/c64dtv-8bppchunkystretch.log @@ -1567,7 +1567,7 @@ Allocated zp ZP_BYTE:16 [ gfx_init_chunky::c#0 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label PROCPORT_DDR = 0 @@ -2092,7 +2092,7 @@ Allocated (was zp ZP_WORD:14) zp ZP_WORD:7 [ gfx_init_chunky::$6 ] ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label PROCPORT_DDR = 0 @@ -2521,8 +2521,8 @@ Replacing label b3_from_b2 with b3 Replacing label b2_from_b3 with b2 Replacing label b2_from_b3 with b2 Replacing label b1_from_b5 with b1 -Removing instruction bbegin: Removing instruction b7_from_bbegin: +Removing instruction b7: Removing instruction bend_from_b7: Removing instruction b1_from_b1: Removing instruction b1_from_b5: @@ -2532,7 +2532,6 @@ Removing instruction b3_from_b2: Removing instruction b6_from_b5: Removing instruction dtvSetCpuBankSegment1_from_b6: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b7: Removing instruction bend: Removing instruction gfx_init_chunky_from_main: Removing instruction b17: @@ -2549,11 +2548,16 @@ Removing instruction b6: Removing instruction breturn: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Removing instruction jmp b1 Removing instruction jmp b1 Removing instruction jmp b2 Removing instruction jmp b3 Succesful ASM optimization Pass5NextJumpElimination +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @7 @@ -2832,7 +2836,7 @@ reg byte a [ gfx_init_chunky::c#0 ] FINAL ASSEMBLER -Score: 19888 +Score: 19882 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -2875,7 +2879,6 @@ Score: 19888 //SEG3 [1] phi from @begin to @7 [phi:@begin->@7] //SEG4 @7 //SEG5 [2] call main - jsr main //SEG6 [3] phi from @7 to @end [phi:@7->@end] //SEG7 @end //SEG8 main diff --git a/src/test/ref/c64dtv-blittermin.asm b/src/test/ref/c64dtv-blittermin.asm index a3e4a339b..78b2a07e2 100644 --- a/src/test/ref/c64dtv-blittermin.asm +++ b/src/test/ref/c64dtv-blittermin.asm @@ -44,7 +44,6 @@ .const DTV_BLIT_STATUS_BUSY = 1 .label SCREEN = $400 .const SRCA_LEN = 9 - jsr main main: { lda #DTV_FEATURE_ENABLE sta DTV_FEATURE diff --git a/src/test/ref/c64dtv-blittermin.log b/src/test/ref/c64dtv-blittermin.log index f61324675..5848c1a88 100644 --- a/src/test/ref/c64dtv-blittermin.log +++ b/src/test/ref/c64dtv-blittermin.log @@ -1177,7 +1177,7 @@ Allocated zp ZP_BYTE:3 [ main::$15 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label DTV_FEATURE = $d03f @@ -1464,7 +1464,7 @@ Uplifting [] best 2815 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label DTV_FEATURE = $d03f @@ -1677,17 +1677,19 @@ Removing instruction lda #0 Removing instruction lda #0 Succesful ASM optimization Pass5UnnecesaryLoadElimination Replacing label b2_from_b3 with b2 -Removing instruction bbegin: Removing instruction b6_from_bbegin: +Removing instruction b6: Removing instruction bend_from_b6: Removing instruction b2_from_b3: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b6: Removing instruction bend: Removing instruction b2_from_main: Removing instruction b3: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Skipping double jump to b2 in bne b2_from_b2 Succesful ASM optimization Pass5DoubleJumpElimination Relabelling long label b2_from_b2 to b1 @@ -1696,6 +1698,8 @@ Removing instruction jmp b2 Succesful ASM optimization Pass5NextJumpElimination Removing instruction b1: Succesful ASM optimization Pass5RedundantLabelElimination +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination Removing instruction jmp b2 Succesful ASM optimization Pass5NextJumpElimination @@ -1940,7 +1944,7 @@ reg byte a [ main::$15 ] FINAL ASSEMBLER -Score: 1567 +Score: 1561 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -1994,7 +1998,6 @@ Score: 1567 //SEG3 [1] phi from @begin to @6 [phi:@begin->@6] //SEG4 @6 //SEG5 [2] call main - jsr main //SEG6 [3] phi from @6 to @end [phi:@6->@end] //SEG7 @end //SEG8 main diff --git a/src/test/ref/c64dtv-color.asm b/src/test/ref/c64dtv-color.asm index 8b6c970f0..8ed712916 100644 --- a/src/test/ref/c64dtv-color.asm +++ b/src/test/ref/c64dtv-color.asm @@ -10,7 +10,6 @@ .const DTV_HIGHCOLOR = 4 .const DTV_BADLINE_OFF = $20 .label DTV_PALETTE = $d200 - jsr main main: { sei lda #DTV_FEATURE_ENABLE diff --git a/src/test/ref/c64dtv-color.log b/src/test/ref/c64dtv-color.log index 4c6380aee..eafcccaed 100644 --- a/src/test/ref/c64dtv-color.log +++ b/src/test/ref/c64dtv-color.log @@ -1076,7 +1076,7 @@ Allocated zp ZP_BYTE:3 [ main::c#2 main::c#1 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label RASTER = $d012 @@ -1227,7 +1227,7 @@ Uplifting [] best 11689 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label RASTER = $d012 @@ -1355,21 +1355,25 @@ Removing instruction jmp b8 Succesful ASM optimization Pass5NextJumpElimination Replacing label b7_from_b7 with b7 Replacing label b8_from_b8 with b8 -Removing instruction bbegin: Removing instruction b6_from_bbegin: +Removing instruction b6: Removing instruction bend_from_b6: Removing instruction b7_from_b7: Removing instruction b8_from_b8: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b6: Removing instruction bend: Removing instruction b6: Removing instruction b7_from_b6: Removing instruction b8_from_b7: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Removing instruction jmp b7 Removing instruction jmp b8 Succesful ASM optimization Pass5NextJumpElimination +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @6 @@ -1577,7 +1581,7 @@ reg byte x [ main::c#2 main::c#1 ] FINAL ASSEMBLER -Score: 10180 +Score: 10174 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -1597,7 +1601,6 @@ Score: 10180 //SEG3 [1] phi from @begin to @6 [phi:@begin->@6] //SEG4 @6 //SEG5 [2] call main - jsr main //SEG6 [3] phi from @6 to @end [phi:@6->@end] //SEG7 @end //SEG8 main diff --git a/src/test/ref/c64dtv-gfxexplorer.asm b/src/test/ref/c64dtv-gfxexplorer.asm index 6d81b76b6..84ba661b7 100644 --- a/src/test/ref/c64dtv-gfxexplorer.asm +++ b/src/test/ref/c64dtv-gfxexplorer.asm @@ -127,7 +127,6 @@ .label keyboard_events_size = 9 .label keyboard_modifiers = 2 .label form_cursor_count = $e - jsr main main: { sei lda #PROCPORT_DDR_MEMORY_MASK diff --git a/src/test/ref/c64dtv-gfxexplorer.log b/src/test/ref/c64dtv-gfxexplorer.log index 35dce694e..5fbd5994f 100644 --- a/src/test/ref/c64dtv-gfxexplorer.log +++ b/src/test/ref/c64dtv-gfxexplorer.log @@ -13738,7 +13738,7 @@ Allocated zp ZP_BYTE:356 [ gfx_init_screen0::$3 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label PROCPORT_DDR = 0 @@ -20872,7 +20872,7 @@ Allocated (was zp ZP_DWORD:292) zp ZP_DWORD:19 [ gfx_init_plane_fill::$0 ] ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label PROCPORT_DDR = 0 @@ -26439,8 +26439,8 @@ Replacing label b2_from_b2 with b2 Replacing label b1_from_b3 with b1 Replacing label b2_from_b2 with b2 Replacing label b1_from_b3 with b1 -Removing instruction bbegin: Removing instruction b68_from_bbegin: +Removing instruction b68: Removing instruction bend_from_b68: Removing instruction b7_from_main: Removing instruction gfx_init_from_b7: @@ -26656,7 +26656,6 @@ Removing instruction b1_from_b3: Removing instruction b2_from_b1: Removing instruction b2_from_b2: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b68: Removing instruction bend: Removing instruction b7: Removing instruction b1_from_b7: @@ -26936,6 +26935,9 @@ Removing instruction b3: Removing instruction breturn: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Skipping double jump to b15 in bne b15_from_b15 Skipping double jump to breturn_from_b9 in bne b9 Skipping double jump to breturn_from_b3 in bne b3 @@ -27048,6 +27050,7 @@ Removing instruction lda x0 Succesful ASM optimization Pass5UnnecesaryLoadElimination Removing instruction b2: Succesful ASM optimization Pass5RedundantLabelElimination +Removing instruction bbegin: Removing instruction b17: Removing instruction b9: Removing instruction b3: @@ -27072,18 +27075,18 @@ Removing instruction b37: Succesful ASM optimization Pass5UnusedLabelElimination Removing unreachable instruction jmp b7 Succesful ASM optimization Pass5UnreachableCodeElimination -Fixing long branch [687] beq b5 to bne -Fixing long branch [691] beq b6 to bne -Fixing long branch [695] beq b7 to bne -Fixing long branch [699] beq b8 to bne -Fixing long branch [685] beq b4 to bne -Fixing long branch [705] beq b9 to bne -Fixing long branch [709] beq b10 to bne -Fixing long branch [713] beq b11 to bne -Fixing long branch [717] beq b12 to bne -Fixing long branch [683] beq b3 to bne -Fixing long branch [723] beq b13 to bne -Fixing long branch [1247] bmi b2 to bpl +Fixing long branch [686] beq b5 to bne +Fixing long branch [690] beq b6 to bne +Fixing long branch [694] beq b7 to bne +Fixing long branch [698] beq b8 to bne +Fixing long branch [684] beq b4 to bne +Fixing long branch [704] beq b9 to bne +Fixing long branch [708] beq b10 to bne +Fixing long branch [712] beq b11 to bne +Fixing long branch [716] beq b12 to bne +Fixing long branch [682] beq b3 to bne +Fixing long branch [722] beq b13 to bne +Fixing long branch [1246] bmi b2 to bpl FINAL SYMBOL TABLE (label) @68 @@ -28790,7 +28793,7 @@ reg byte a [ gfx_init_screen0::$3 ] FINAL ASSEMBLER -Score: 11370523 +Score: 11370517 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -28927,7 +28930,6 @@ Score: 11370523 //SEG3 [1] phi from @begin to @68 [phi:@begin->@68] //SEG4 @68 //SEG5 [2] call main - jsr main //SEG6 [3] phi from @68 to @end [phi:@68->@end] //SEG7 @end //SEG8 main diff --git a/src/test/ref/c64dtv-gfxmodes.asm b/src/test/ref/c64dtv-gfxmodes.asm index 2b4a7a9cc..50e284627 100644 --- a/src/test/ref/c64dtv-gfxmodes.asm +++ b/src/test/ref/c64dtv-gfxmodes.asm @@ -78,7 +78,6 @@ .label print_char_cursor = 5 .label dtv_control = 4 .label print_line_cursor = $d - jsr main main: { sei lda #PROCPORT_DDR_MEMORY_MASK diff --git a/src/test/ref/c64dtv-gfxmodes.log b/src/test/ref/c64dtv-gfxmodes.log index 3bd38a1d6..c0bbb77ac 100644 --- a/src/test/ref/c64dtv-gfxmodes.log +++ b/src/test/ref/c64dtv-gfxmodes.log @@ -12580,7 +12580,7 @@ Allocated zp ZP_BYTE:295 [ print_str_lines::ch#0 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label PROCPORT_DDR = 0 @@ -19226,7 +19226,7 @@ Allocated (was zp ZP_WORD:157) zp ZP_WORD:13 [ print_line_cursor#18 print_line_c ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label PROCPORT_DDR = 0 @@ -24159,8 +24159,8 @@ Replacing label b1_from_b1 with b1 Replacing label b1_from_b1 with b1 Replacing label b1_from_b1 with b1 Replacing label b1_from_b1 with b1 -Removing instruction bbegin: Removing instruction b54_from_bbegin: +Removing instruction b54: Removing instruction bend_from_b54: Removing instruction b2_from_main: Removing instruction b2_from_b2: @@ -24370,7 +24370,6 @@ Removing instruction b1_from_print_ln: Removing instruction b1_from_b1: Removing instruction b1_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b54: Removing instruction bend: Removing instruction b1_from_menu: Removing instruction b2_from_b1: @@ -24576,6 +24575,9 @@ Removing instruction b1_from_print_cls: Removing instruction breturn: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Skipping double jump to b14 in beq b46 Skipping double jump to b4 in jmp b1_from_b30 Skipping double jump to b2 in bne b10 @@ -24651,13 +24653,14 @@ Removing instruction lda x0 Succesful ASM optimization Pass5UnnecesaryLoadElimination Removing instruction b1: Succesful ASM optimization Pass5RedundantLabelElimination +Removing instruction bbegin: Removing instruction b46: Removing instruction b10: Succesful ASM optimization Pass5UnusedLabelElimination Removing unreachable instruction jmp b14 Removing unreachable instruction jmp b2 Succesful ASM optimization Pass5UnreachableCodeElimination -Fixing long branch [227] beq b4 to bne +Fixing long branch [226] beq b4 to bne FINAL SYMBOL TABLE (label) @54 @@ -26175,7 +26178,7 @@ reg byte a [ print_str_lines::ch#0 ] FINAL ASSEMBLER -Score: 2306078 +Score: 2306072 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -26263,7 +26266,6 @@ Score: 2306078 //SEG3 [1] phi from @begin to @54 [phi:@begin->@54] //SEG4 @54 //SEG5 [2] call main - jsr main //SEG6 [3] phi from @54 to @end [phi:@54->@end] //SEG7 @end //SEG8 main diff --git a/src/test/ref/callconstparam.asm b/src/test/ref/callconstparam.asm index 4e9e624c1..2a29dcc8f 100644 --- a/src/test/ref/callconstparam.asm +++ b/src/test/ref/callconstparam.asm @@ -2,7 +2,6 @@ :BasicUpstart(main) .pc = $80d "Program" .label screen = 3 - jsr main main: { lda #2 sta line.x1 diff --git a/src/test/ref/callconstparam.log b/src/test/ref/callconstparam.log index 7e8796ff1..d852dbc40 100644 --- a/src/test/ref/callconstparam.log +++ b/src/test/ref/callconstparam.log @@ -229,7 +229,7 @@ Allocated zp ZP_WORD:4 [ screen#10 screen#14 screen#11 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label screen = 4 @@ -346,7 +346,7 @@ Allocated (was zp ZP_WORD:4) zp ZP_WORD:3 [ screen#10 screen#14 screen#11 ] ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label screen = 3 @@ -444,8 +444,8 @@ Removing instruction jmp b1 Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination Replacing label b1_from_b1 with b1 -Removing instruction bbegin: Removing instruction b2_from_bbegin: +Removing instruction b2: Removing instruction main_from_b2: Removing instruction bend_from_b2: Removing instruction b1_from_main: @@ -453,13 +453,17 @@ Removing instruction line_from_b1: Removing instruction b1_from_line: Removing instruction b1_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b2: Removing instruction bend: Removing instruction line_from_main: Removing instruction b1: Removing instruction breturn: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @2 @@ -489,7 +493,7 @@ zp ZP_WORD:3 [ screen#10 screen#14 screen#11 ] FINAL ASSEMBLER -Score: 354 +Score: 348 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -502,7 +506,6 @@ Score: 354 //SEG4 @2 //SEG5 [2] call main //SEG6 [4] phi from @2 to main [phi:@2->main] - jsr main //SEG7 [3] phi from @2 to @end [phi:@2->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/cast-deref.asm b/src/test/ref/cast-deref.asm index 7d85f559e..66b88eecf 100644 --- a/src/test/ref/cast-deref.asm +++ b/src/test/ref/cast-deref.asm @@ -1,7 +1,6 @@ .pc = $801 "Basic" :BasicUpstart(main) .pc = $80d "Program" - jsr main main: { .label SCREEN = $400 ldx #0 diff --git a/src/test/ref/cast-deref.log b/src/test/ref/cast-deref.log index eecbde4f5..51156397d 100644 --- a/src/test/ref/cast-deref.log +++ b/src/test/ref/cast-deref.log @@ -140,7 +140,7 @@ Allocated zp ZP_BYTE:2 [ main::i#2 main::i#1 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -209,7 +209,7 @@ Uplifting [] best 288 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -265,19 +265,23 @@ Removing instruction jmp b1 Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination Replacing label b1_from_b1 with b1 -Removing instruction bbegin: Removing instruction b1_from_bbegin: +Removing instruction b1: Removing instruction main_from_b1: Removing instruction bend_from_b1: Removing instruction b1_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b1: Removing instruction bend: Removing instruction b1_from_main: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Removing instruction jmp b1 Succesful ASM optimization Pass5NextJumpElimination +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @1 @@ -298,7 +302,7 @@ reg byte x [ main::i#2 main::i#1 ] FINAL ASSEMBLER -Score: 192 +Score: 186 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -310,7 +314,6 @@ Score: 192 //SEG4 @1 //SEG5 [2] call main //SEG6 [4] phi from @1 to main [phi:@1->main] - jsr main //SEG7 [3] phi from @1 to @end [phi:@1->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/cast-precedence-problem.asm b/src/test/ref/cast-precedence-problem.asm index 7620013d2..84e4c463a 100644 --- a/src/test/ref/cast-precedence-problem.asm +++ b/src/test/ref/cast-precedence-problem.asm @@ -1,7 +1,6 @@ .pc = $801 "Basic" :BasicUpstart(main) .pc = $80d "Program" - jsr main main: { .label SCREEN = $400 .const min = $a diff --git a/src/test/ref/cast-precedence-problem.log b/src/test/ref/cast-precedence-problem.log index a308e52ed..5ab835517 100644 --- a/src/test/ref/cast-precedence-problem.log +++ b/src/test/ref/cast-precedence-problem.log @@ -171,7 +171,7 @@ Complete equivalence classes INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -244,7 +244,7 @@ Uplifting [] best 61 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -306,14 +306,18 @@ Removing instruction jmp bend Removing instruction jmp b3 Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination -Removing instruction bbegin: Removing instruction b1_from_bbegin: +Removing instruction b1: Removing instruction bend_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b1: Removing instruction bend: Removing instruction b3: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @1 @@ -343,7 +347,7 @@ FINAL SYMBOL TABLE FINAL ASSEMBLER -Score: 49 +Score: 43 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -354,7 +358,6 @@ Score: 49 //SEG3 [1] phi from @begin to @1 [phi:@begin->@1] //SEG4 @1 //SEG5 [2] call main - jsr main //SEG6 [3] phi from @1 to @end [phi:@1->@end] //SEG7 @end //SEG8 main diff --git a/src/test/ref/casting.asm b/src/test/ref/casting.asm index d76001af8..11423ccea 100644 --- a/src/test/ref/casting.asm +++ b/src/test/ref/casting.asm @@ -5,7 +5,6 @@ .label SCREEN2 = SCREEN+$28*3 .label SCREEN3 = SCREEN+$28*6 .label SCREEN4 = SCREEN+$28*9 - jsr main main: { ldx #0 b1: diff --git a/src/test/ref/casting.log b/src/test/ref/casting.log index a32164b20..5386a35fc 100644 --- a/src/test/ref/casting.log +++ b/src/test/ref/casting.log @@ -345,7 +345,7 @@ Allocated zp ZP_BYTE:6 [ w::b2#0 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label SCREEN = $400 @@ -502,7 +502,7 @@ Uplifting [] best 836 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label SCREEN = $400 @@ -622,8 +622,8 @@ Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination Replacing label b1_from_b1 with b1 Replacing label b1_from_b1 with b1 -Removing instruction bbegin: Removing instruction b2_from_bbegin: +Removing instruction b2: Removing instruction main_from_b2: Removing instruction bend_from_b2: Removing instruction b1_from_b1: @@ -631,7 +631,6 @@ Removing instruction b2_from_b1: Removing instruction w_from_b2: Removing instruction b1_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b2: Removing instruction bend: Removing instruction b1_from_main: Removing instruction b2: @@ -639,9 +638,14 @@ Removing instruction breturn: Removing instruction b1_from_w: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Removing instruction jmp b1 Removing instruction jmp b1 Succesful ASM optimization Pass5NextJumpElimination +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @2 @@ -689,7 +693,7 @@ reg byte x [ w::b2#0 ] FINAL ASSEMBLER -Score: 674 +Score: 668 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -705,7 +709,6 @@ Score: 674 //SEG4 @2 //SEG5 [2] call main //SEG6 [4] phi from @2 to main [phi:@2->main] - jsr main //SEG7 [3] phi from @2 to @end [phi:@2->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/chained-assignment.asm b/src/test/ref/chained-assignment.asm index 7eb6108c0..997bbe971 100644 --- a/src/test/ref/chained-assignment.asm +++ b/src/test/ref/chained-assignment.asm @@ -1,7 +1,6 @@ .pc = $801 "Basic" :BasicUpstart(main) .pc = $80d "Program" - jsr main main: { .label screen = $400 lda #'c' diff --git a/src/test/ref/chained-assignment.log b/src/test/ref/chained-assignment.log index 2acd3c95d..a024eb48d 100644 --- a/src/test/ref/chained-assignment.log +++ b/src/test/ref/chained-assignment.log @@ -114,7 +114,7 @@ Allocated zp ZP_BYTE:2 [ main::a#1 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -181,7 +181,7 @@ Uplifting [] best 59 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -235,14 +235,18 @@ Succesful ASM optimization Pass5NextJumpElimination Removing instruction lda #'c' Removing instruction lda screen+1 Succesful ASM optimization Pass5UnnecesaryLoadElimination -Removing instruction bbegin: Removing instruction b1_from_bbegin: +Removing instruction b1: Removing instruction bend_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b1: Removing instruction bend: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @1 @@ -259,7 +263,7 @@ reg byte a [ main::a#1 ] FINAL ASSEMBLER -Score: 44 +Score: 38 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -270,7 +274,6 @@ Score: 44 //SEG3 [1] phi from @begin to @1 [phi:@begin->@1] //SEG4 @1 //SEG5 [2] call main - jsr main //SEG6 [3] phi from @1 to @end [phi:@1->@end] //SEG7 @end //SEG8 main diff --git a/src/test/ref/chargen.asm b/src/test/ref/chargen.asm index 7239224bc..4152a91a8 100644 --- a/src/test/ref/chargen.asm +++ b/src/test/ref/chargen.asm @@ -4,7 +4,6 @@ .label PROCPORT = 1 .label CHARGEN = $d000 .label SCREEN = $400 - jsr main main: { .label CHAR_A = CHARGEN+8 .label bits = 3 diff --git a/src/test/ref/chargen.log b/src/test/ref/chargen.log index caebdc0fc..594ce4ab3 100644 --- a/src/test/ref/chargen.log +++ b/src/test/ref/chargen.log @@ -371,7 +371,7 @@ Allocated zp ZP_BYTE:8 [ main::$1 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label PROCPORT = 1 @@ -559,7 +559,7 @@ Uplifting [main] best 7232 combination zp ZP_BYTE:2 [ main::y#2 main::y#1 ] ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label PROCPORT = 1 @@ -710,15 +710,14 @@ Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination Replacing label b2_from_b3 with b2 Replacing label b1_from_b5 with b1 -Removing instruction bbegin: Removing instruction b1_from_bbegin: +Removing instruction b1: Removing instruction bend_from_b1: Removing instruction b1_from_b5: Removing instruction b2_from_b3: Removing instruction b4_from_b2: Removing instruction b3_from_b4: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b1: Removing instruction bend: Removing instruction b1_from_main: Removing instruction b2_from_b1: @@ -727,11 +726,16 @@ Removing instruction b5: Removing instruction b6: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Relabelling long label b3_from_b2 to b4 Succesful ASM optimization Pass5RelabelLongLabels Removing instruction jmp b1 Removing instruction jmp b2 Succesful ASM optimization Pass5NextJumpElimination +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @1 @@ -781,7 +785,7 @@ reg byte a [ main::$1 ] FINAL ASSEMBLER -Score: 5633 +Score: 5627 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -795,7 +799,6 @@ Score: 5633 //SEG3 [1] phi from @begin to @1 [phi:@begin->@1] //SEG4 @1 //SEG5 [2] call main - jsr main //SEG6 [3] phi from @1 to @end [phi:@1->@end] //SEG7 @end //SEG8 main diff --git a/src/test/ref/chessboard.asm b/src/test/ref/chessboard.asm index c728b158a..f0957dc5d 100644 --- a/src/test/ref/chessboard.asm +++ b/src/test/ref/chessboard.asm @@ -1,7 +1,6 @@ .pc = $801 "Basic" :BasicUpstart(main) .pc = $80d "Program" - jsr main main: { .label screen = 2 .label colors = 4 diff --git a/src/test/ref/chessboard.log b/src/test/ref/chessboard.log index a23b339d3..f9e10ee4c 100644 --- a/src/test/ref/chessboard.log +++ b/src/test/ref/chessboard.log @@ -248,7 +248,7 @@ Allocated zp ZP_BYTE:8 [ main::color#3 main::color#5 main::color#2 main::color#1 INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -404,7 +404,7 @@ Uplifting [main] best 4863 combination zp ZP_BYTE:6 [ main::row#4 main::row#1 ] ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -529,23 +529,27 @@ Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination Replacing label b2_from_b2 with b2 Replacing label b1_from_b3 with b1 -Removing instruction bbegin: Removing instruction b1_from_bbegin: +Removing instruction b1: Removing instruction main_from_b1: Removing instruction bend_from_b1: Removing instruction b1_from_b3: Removing instruction b2_from_b1: Removing instruction b2_from_b2: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b1: Removing instruction bend: Removing instruction b1_from_main: Removing instruction b3: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Removing instruction jmp b1 Removing instruction jmp b2 Succesful ASM optimization Pass5NextJumpElimination +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @1 @@ -582,7 +586,7 @@ reg byte x [ main::color#3 main::color#5 main::color#2 main::color#1 ] FINAL ASSEMBLER -Score: 3867 +Score: 3861 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -594,7 +598,6 @@ Score: 3867 //SEG4 @1 //SEG5 [2] call main //SEG6 [4] phi from @1 to main [phi:@1->main] - jsr main //SEG7 [3] phi from @1 to @end [phi:@1->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/compound-assignment.asm b/src/test/ref/compound-assignment.asm index c16d89ead..8b278027a 100644 --- a/src/test/ref/compound-assignment.asm +++ b/src/test/ref/compound-assignment.asm @@ -6,7 +6,6 @@ .const GREEN = 5 .const RED = 2 .label screen2 = screen1+$28 - jsr main main: { ldx #0 lda #3 diff --git a/src/test/ref/compound-assignment.log b/src/test/ref/compound-assignment.log index a5c5f359c..f7fe566a4 100644 --- a/src/test/ref/compound-assignment.log +++ b/src/test/ref/compound-assignment.log @@ -754,7 +754,7 @@ Allocated zp ZP_BYTE:3 [ test::i#11 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label screen1 = $400 @@ -1014,7 +1014,7 @@ Uplifting [test] best 250 combination zp ZP_BYTE:2 [ test::a#11 ] ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label screen1 = $400 @@ -1245,8 +1245,8 @@ Removing instruction jmp breturn Removing instruction jmp b3 Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination -Removing instruction bbegin: Removing instruction b2_from_bbegin: +Removing instruction b2: Removing instruction main_from_b2: Removing instruction bend_from_b2: Removing instruction b1_from_main: @@ -1270,7 +1270,6 @@ Removing instruction test_from_b9: Removing instruction b10_from_b9: Removing instruction test_from_b10: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b2: Removing instruction bend: Removing instruction test_from_main: Removing instruction b1: @@ -1286,6 +1285,11 @@ Removing instruction b10: Removing instruction breturn: Removing instruction b3: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @2 @@ -1331,7 +1335,7 @@ reg byte x [ test::i#11 ] FINAL ASSEMBLER -Score: 205 +Score: 199 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -1348,7 +1352,6 @@ Score: 205 //SEG4 @2 //SEG5 [2] call main //SEG6 [4] phi from @2 to main [phi:@2->main] - jsr main //SEG7 [3] phi from @2 to @end [phi:@2->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/concat-char.asm b/src/test/ref/concat-char.asm index 132322c86..3db611ffd 100644 --- a/src/test/ref/concat-char.asm +++ b/src/test/ref/concat-char.asm @@ -1,7 +1,6 @@ .pc = $801 "Basic" :BasicUpstart(main) .pc = $80d "Program" - jsr main main: { .label screen = $400 ldx #0 diff --git a/src/test/ref/concat-char.log b/src/test/ref/concat-char.log index d055a9466..c22d11162 100644 --- a/src/test/ref/concat-char.log +++ b/src/test/ref/concat-char.log @@ -131,7 +131,7 @@ Allocated zp ZP_BYTE:2 [ main::i#2 main::i#1 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -200,7 +200,7 @@ Uplifting [] best 288 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -256,19 +256,23 @@ Removing instruction jmp b1 Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination Replacing label b1_from_b1 with b1 -Removing instruction bbegin: Removing instruction b1_from_bbegin: +Removing instruction b1: Removing instruction main_from_b1: Removing instruction bend_from_b1: Removing instruction b1_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b1: Removing instruction bend: Removing instruction b1_from_main: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Removing instruction jmp b1 Succesful ASM optimization Pass5NextJumpElimination +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @1 @@ -290,7 +294,7 @@ reg byte x [ main::i#2 main::i#1 ] FINAL ASSEMBLER -Score: 192 +Score: 186 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -302,7 +306,6 @@ Score: 192 //SEG4 @1 //SEG5 [2] call main //SEG6 [4] phi from @1 to main [phi:@1->main] - jsr main //SEG7 [3] phi from @1 to @end [phi:@1->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/const-condition.asm b/src/test/ref/const-condition.asm index 666ab285f..df4edbee3 100644 --- a/src/test/ref/const-condition.asm +++ b/src/test/ref/const-condition.asm @@ -1,7 +1,6 @@ .pc = $801 "Basic" :BasicUpstart(main) .pc = $80d "Program" - jsr main main: { .label SCREEN = $400 lda #'!' diff --git a/src/test/ref/const-condition.log b/src/test/ref/const-condition.log index d9cb4f300..7558f7c6d 100644 --- a/src/test/ref/const-condition.log +++ b/src/test/ref/const-condition.log @@ -95,7 +95,7 @@ Complete equivalence classes INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -143,7 +143,7 @@ Uplifting [] best 57 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -184,16 +184,20 @@ Removing instruction jmp bend Removing instruction jmp b3 Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination -Removing instruction bbegin: Removing instruction b1_from_bbegin: +Removing instruction b1: Removing instruction main_from_b1: Removing instruction bend_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b1: Removing instruction bend: Removing instruction b3: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @1 @@ -208,7 +212,7 @@ FINAL SYMBOL TABLE FINAL ASSEMBLER -Score: 18 +Score: 12 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -220,7 +224,6 @@ Score: 18 //SEG4 @1 //SEG5 [2] call main //SEG6 [4] phi from @1 to main [phi:@1->main] - jsr main //SEG7 [3] phi from @1 to @end [phi:@1->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/const-identification.asm b/src/test/ref/const-identification.asm index fbe0fd9f8..f96f7765b 100644 --- a/src/test/ref/const-identification.asm +++ b/src/test/ref/const-identification.asm @@ -3,7 +3,6 @@ .pc = $80d "Program" .label plots = $1000 .label SCREEN = $400 - jsr main main: { ldx #0 b1: diff --git a/src/test/ref/const-identification.log b/src/test/ref/const-identification.log index d7c518d62..979217b37 100644 --- a/src/test/ref/const-identification.log +++ b/src/test/ref/const-identification.log @@ -290,7 +290,7 @@ Allocated zp ZP_BYTE:6 [ plot::$0 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label plots = $1000 @@ -444,7 +444,7 @@ Uplifting [] best 3268 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label plots = $1000 @@ -566,8 +566,8 @@ Replacing label b1_from_b1 with b1 Replacing label b2_from_b2 with b2 Replacing label b3_from_b8 with b3 Replacing label b3_from_b8 with b3 -Removing instruction bbegin: Removing instruction b3_from_bbegin: +Removing instruction b3: Removing instruction main_from_b3: Removing instruction bend_from_b3: Removing instruction b1_from_b1: @@ -576,7 +576,6 @@ Removing instruction b2_from_b2: Removing instruction line_from_b2: Removing instruction b3_from_b8: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b3: Removing instruction bend: Removing instruction b1_from_main: Removing instruction b3_from_line: @@ -584,9 +583,14 @@ Removing instruction b8: Removing instruction breturn: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Removing instruction jmp b1 Removing instruction jmp b3 Succesful ASM optimization Pass5NextJumpElimination +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @3 @@ -629,7 +633,7 @@ reg byte a [ plot::$0 ] FINAL ASSEMBLER -Score: 1969 +Score: 1963 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -643,7 +647,6 @@ Score: 1969 //SEG4 @3 //SEG5 [2] call main //SEG6 [4] phi from @3 to main [phi:@3->main] - jsr main //SEG7 [3] phi from @3 to @end [phi:@3->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/const-mult-div.asm b/src/test/ref/const-mult-div.asm index 606a67b14..a875eb2b1 100644 --- a/src/test/ref/const-mult-div.asm +++ b/src/test/ref/const-mult-div.asm @@ -1,7 +1,6 @@ .pc = $801 "Basic" :BasicUpstart(main) .pc = $80d "Program" - jsr main main: { .label screen = $400 .const b = 6*$e/3+mod($16,3) diff --git a/src/test/ref/const-mult-div.log b/src/test/ref/const-mult-div.log index 9978b108f..c9adf5d98 100644 --- a/src/test/ref/const-mult-div.log +++ b/src/test/ref/const-mult-div.log @@ -97,7 +97,7 @@ Complete equivalence classes INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -141,7 +141,7 @@ Uplifting [] best 27 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -177,14 +177,18 @@ Removing instruction jmp b1 Removing instruction jmp bend Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination -Removing instruction bbegin: Removing instruction b1_from_bbegin: +Removing instruction b1: Removing instruction bend_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b1: Removing instruction bend: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @1 @@ -200,7 +204,7 @@ FINAL SYMBOL TABLE FINAL ASSEMBLER -Score: 18 +Score: 12 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -211,7 +215,6 @@ Score: 18 //SEG3 [1] phi from @begin to @1 [phi:@begin->@1] //SEG4 @1 //SEG5 [2] call main - jsr main //SEG6 [3] phi from @1 to @end [phi:@1->@end] //SEG7 @end //SEG8 main diff --git a/src/test/ref/const-param.asm b/src/test/ref/const-param.asm index c03fcefcd..114de7b0a 100644 --- a/src/test/ref/const-param.asm +++ b/src/test/ref/const-param.asm @@ -1,7 +1,6 @@ .pc = $801 "Basic" :BasicUpstart(main) .pc = $80d "Program" - jsr main main: { .label screen = $400 .label reverse = $80 diff --git a/src/test/ref/const-param.log b/src/test/ref/const-param.log index d125ecbe6..c40732f0f 100644 --- a/src/test/ref/const-param.log +++ b/src/test/ref/const-param.log @@ -244,7 +244,7 @@ Allocated zp ZP_BYTE:9 [ sum::return#3 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -378,7 +378,7 @@ Uplifting [sum] best 79 combination reg byte a [ sum::return#3 ] ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -473,12 +473,11 @@ Removing instruction jmp b3 Removing instruction jmp breturn Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination -Removing instruction bbegin: Removing instruction b2_from_bbegin: +Removing instruction b2: Removing instruction main_from_b2: Removing instruction bend_from_b2: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b2: Removing instruction bend: Removing instruction sum_from_main: Removing instruction b1: @@ -489,6 +488,11 @@ Removing instruction b3: Removing instruction breturn: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @2 @@ -528,7 +532,7 @@ reg byte a [ sum::return#3 ] FINAL ASSEMBLER -Score: 58 +Score: 52 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -540,7 +544,6 @@ Score: 58 //SEG4 @2 //SEG5 [2] call main //SEG6 [4] phi from @2 to main [phi:@2->main] - jsr main //SEG7 [3] phi from @2 to @end [phi:@2->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/const-pointer.asm b/src/test/ref/const-pointer.asm index 1db1fa469..ebcb4632f 100644 --- a/src/test/ref/const-pointer.asm +++ b/src/test/ref/const-pointer.asm @@ -1,7 +1,6 @@ .pc = $801 "Basic" :BasicUpstart(main) .pc = $80d "Program" - jsr main main: { .label screen = $400 lda #'*' diff --git a/src/test/ref/const-pointer.log b/src/test/ref/const-pointer.log index 681f5613e..2f909d9b8 100644 --- a/src/test/ref/const-pointer.log +++ b/src/test/ref/const-pointer.log @@ -112,7 +112,7 @@ Complete equivalence classes INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -160,7 +160,7 @@ Uplifting [] best 57 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -201,16 +201,20 @@ Removing instruction jmp bend Removing instruction jmp b1 Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination -Removing instruction bbegin: Removing instruction b1_from_bbegin: +Removing instruction b1: Removing instruction main_from_b1: Removing instruction bend_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b1: Removing instruction bend: Removing instruction b1: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @1 @@ -227,7 +231,7 @@ FINAL SYMBOL TABLE FINAL ASSEMBLER -Score: 18 +Score: 12 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -239,7 +243,6 @@ Score: 18 //SEG4 @1 //SEG5 [2] call main //SEG6 [4] phi from @1 to main [phi:@1->main] - jsr main //SEG7 [3] phi from @1 to @end [phi:@1->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/const-word-pointer.asm b/src/test/ref/const-word-pointer.asm index 45cda7c18..578d4ce50 100644 --- a/src/test/ref/const-word-pointer.asm +++ b/src/test/ref/const-word-pointer.asm @@ -1,7 +1,6 @@ .pc = $801 "Basic" :BasicUpstart(main) .pc = $80d "Program" - jsr main main: { .label screen = $400 .label wp = w diff --git a/src/test/ref/const-word-pointer.log b/src/test/ref/const-word-pointer.log index c3639fb1e..8a6fb71d8 100644 --- a/src/test/ref/const-word-pointer.log +++ b/src/test/ref/const-word-pointer.log @@ -130,7 +130,7 @@ Allocated zp ZP_BYTE:7 [ main::$4 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -217,7 +217,7 @@ Uplifting [] best 75 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -277,14 +277,18 @@ Removing instruction jmp b1 Removing instruction jmp bend Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination -Removing instruction bbegin: Removing instruction b1_from_bbegin: +Removing instruction b1: Removing instruction bend_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b1: Removing instruction bend: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @1 @@ -311,7 +315,7 @@ reg byte a [ main::$4 ] FINAL ASSEMBLER -Score: 66 +Score: 60 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -322,7 +326,6 @@ Score: 66 //SEG3 [1] phi from @begin to @1 [phi:@begin->@1] //SEG4 @1 //SEG5 [2] call main - jsr main //SEG6 [3] phi from @1 to @end [phi:@1->@end] //SEG7 @end //SEG8 main diff --git a/src/test/ref/constabsmin.asm b/src/test/ref/constabsmin.asm index d6ac1c173..eadb2ce4e 100644 --- a/src/test/ref/constabsmin.asm +++ b/src/test/ref/constabsmin.asm @@ -2,7 +2,6 @@ :BasicUpstart(main) .pc = $80d "Program" .label SCREEN = $400 - jsr main main: { lda #1 sta SCREEN diff --git a/src/test/ref/constabsmin.log b/src/test/ref/constabsmin.log index f03fad331..1cd9c87b5 100644 --- a/src/test/ref/constabsmin.log +++ b/src/test/ref/constabsmin.log @@ -70,7 +70,7 @@ Complete equivalence classes INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label SCREEN = $400 @@ -113,7 +113,7 @@ Uplifting [] best 27 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label SCREEN = $400 @@ -148,14 +148,18 @@ Removing instruction jmp b1 Removing instruction jmp bend Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination -Removing instruction bbegin: Removing instruction b1_from_bbegin: +Removing instruction b1: Removing instruction bend_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b1: Removing instruction bend: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @1 @@ -169,7 +173,7 @@ FINAL SYMBOL TABLE FINAL ASSEMBLER -Score: 18 +Score: 12 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -181,7 +185,6 @@ Score: 18 //SEG3 [1] phi from @begin to @1 [phi:@begin->@1] //SEG4 @1 //SEG5 [2] call main - jsr main //SEG6 [3] phi from @1 to @end [phi:@1->@end] //SEG7 @end //SEG8 main diff --git a/src/test/ref/constant-string-concat.asm b/src/test/ref/constant-string-concat.asm index 6f14e506a..0e12e9278 100644 --- a/src/test/ref/constant-string-concat.asm +++ b/src/test/ref/constant-string-concat.asm @@ -1,7 +1,6 @@ .pc = $801 "Basic" :BasicUpstart(main) .pc = $80d "Program" - jsr main main: { .label SCREEN = $400 ldx #0 diff --git a/src/test/ref/constant-string-concat.log b/src/test/ref/constant-string-concat.log index 40329450c..68692641a 100644 --- a/src/test/ref/constant-string-concat.log +++ b/src/test/ref/constant-string-concat.log @@ -171,7 +171,7 @@ Allocated zp ZP_BYTE:2 [ main::i#2 main::i#1 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -243,7 +243,7 @@ Uplifting [] best 288 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -302,19 +302,23 @@ Removing instruction jmp b1 Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination Replacing label b1_from_b1 with b1 -Removing instruction bbegin: Removing instruction b1_from_bbegin: +Removing instruction b1: Removing instruction main_from_b1: Removing instruction bend_from_b1: Removing instruction b1_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b1: Removing instruction bend: Removing instruction b1_from_main: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Removing instruction jmp b1 Succesful ASM optimization Pass5NextJumpElimination +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @1 @@ -343,7 +347,7 @@ reg byte x [ main::i#2 main::i#1 ] FINAL ASSEMBLER -Score: 192 +Score: 186 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -355,7 +359,6 @@ Score: 192 //SEG4 @1 //SEG5 [2] call main //SEG6 [4] phi from @1 to main [phi:@1->main] - jsr main //SEG7 [3] phi from @1 to @end [phi:@1->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/constantmin.asm b/src/test/ref/constantmin.asm index dcb7e8634..4832ff399 100644 --- a/src/test/ref/constantmin.asm +++ b/src/test/ref/constantmin.asm @@ -6,7 +6,6 @@ .label VIC = $d000 .const RED = 2 .label BGCOL = VIC+$10*2+1 - jsr main main: { lda #STAR sta SCREEN diff --git a/src/test/ref/constantmin.log b/src/test/ref/constantmin.log index 4da378fff..5b9954600 100644 --- a/src/test/ref/constantmin.log +++ b/src/test/ref/constantmin.log @@ -159,7 +159,7 @@ Allocated zp ZP_BYTE:2 [ main::i#2 main::i#1 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label SCREEN = $400 @@ -239,7 +239,7 @@ Uplifting [] best 275 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label SCREEN = $400 @@ -302,18 +302,22 @@ Removing instruction jmp b1 Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination Replacing label b1_from_b1 with b1 -Removing instruction bbegin: Removing instruction b1_from_bbegin: +Removing instruction b1: Removing instruction bend_from_b1: Removing instruction b1_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b1: Removing instruction bend: Removing instruction b1_from_main: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Removing instruction jmp b1 Succesful ASM optimization Pass5NextJumpElimination +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @1 @@ -340,7 +344,7 @@ reg byte x [ main::i#2 main::i#1 ] FINAL ASSEMBLER -Score: 179 +Score: 173 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -356,7 +360,6 @@ Score: 179 //SEG3 [1] phi from @begin to @1 [phi:@begin->@1] //SEG4 @1 //SEG5 [2] call main - jsr main //SEG6 [3] phi from @1 to @end [phi:@1->@end] //SEG7 @end //SEG8 main diff --git a/src/test/ref/constants.asm b/src/test/ref/constants.asm index ed02ad687..0e195dfab 100644 --- a/src/test/ref/constants.asm +++ b/src/test/ref/constants.asm @@ -6,7 +6,6 @@ .const RED = 2 .label print_char_cursor = 5 .label print_line_cursor = 7 - jsr main main: { jsr print_cls lda #GREEN diff --git a/src/test/ref/constants.log b/src/test/ref/constants.log index c3021e459..8793d3537 100644 --- a/src/test/ref/constants.log +++ b/src/test/ref/constants.log @@ -1335,7 +1335,7 @@ Allocated zp ZP_WORD:16 [ print_cls::sc#2 print_cls::sc#1 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label BGCOL = $d021 @@ -1970,7 +1970,7 @@ Allocated (was zp ZP_WORD:10) zp ZP_WORD:7 [ print_line_cursor#24 print_line_cur ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label BGCOL = $d021 @@ -2544,8 +2544,8 @@ Replacing label b1_from_b1 with b1 Replacing label b2_from_b1 with b2 Replacing label b1_from_b1 with b1 Replacing label b1_from_b1 with b1 -Removing instruction bbegin: Removing instruction b24_from_bbegin: +Removing instruction b24: Removing instruction main_from_b24: Removing instruction bend_from_b24: Removing instruction b2_from_b1: @@ -2578,7 +2578,6 @@ Removing instruction b2_from_b3: Removing instruction print_ln_from_b2: Removing instruction b1_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b24: Removing instruction bend: Removing instruction print_cls_from_main: Removing instruction b1: @@ -2614,8 +2613,13 @@ Removing instruction print_str_from_b1: Removing instruction b1_from_print_cls: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Removing instruction jmp b1 Succesful ASM optimization Pass5NextJumpElimination +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @24 @@ -2741,7 +2745,7 @@ reg byte x [ assert_byte::b#3 ] FINAL ASSEMBLER -Score: 1846 +Score: 1840 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -2758,7 +2762,6 @@ Score: 1846 //SEG4 @24 //SEG5 [2] call main //SEG6 [4] phi from @24 to main [phi:@24->main] - jsr main //SEG7 [3] phi from @24 to @end [phi:@24->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/double-assignment.asm b/src/test/ref/double-assignment.asm index 5236dc25d..51ba5a42b 100644 --- a/src/test/ref/double-assignment.asm +++ b/src/test/ref/double-assignment.asm @@ -1,7 +1,6 @@ .pc = $801 "Basic" :BasicUpstart(main) .pc = $80d "Program" - jsr main main: { .label screen = $400 .const a = $c diff --git a/src/test/ref/double-assignment.log b/src/test/ref/double-assignment.log index 038c4873a..13d40e705 100644 --- a/src/test/ref/double-assignment.log +++ b/src/test/ref/double-assignment.log @@ -87,7 +87,7 @@ Complete equivalence classes INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -135,7 +135,7 @@ Uplifting [] best 33 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -176,14 +176,18 @@ Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination Removing instruction lda #a Succesful ASM optimization Pass5UnnecesaryLoadElimination -Removing instruction bbegin: Removing instruction b1_from_bbegin: +Removing instruction b1: Removing instruction bend_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b1: Removing instruction bend: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @1 @@ -200,7 +204,7 @@ FINAL SYMBOL TABLE FINAL ASSEMBLER -Score: 22 +Score: 16 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -211,7 +215,6 @@ Score: 22 //SEG3 [1] phi from @begin to @1 [phi:@begin->@1] //SEG4 @1 //SEG5 [2] call main - jsr main //SEG6 [3] phi from @1 to @end [phi:@1->@end] //SEG7 @end //SEG8 main diff --git a/src/test/ref/double-import.asm b/src/test/ref/double-import.asm index a007ec4e4..737cf36a4 100644 --- a/src/test/ref/double-import.asm +++ b/src/test/ref/double-import.asm @@ -3,7 +3,6 @@ .pc = $80d "Program" .label BGCOL = $d021 .const RED = 2 - jsr main main: { lda #RED sta BGCOL diff --git a/src/test/ref/double-import.log b/src/test/ref/double-import.log index bacdb9a20..0bc0b9a3d 100644 --- a/src/test/ref/double-import.log +++ b/src/test/ref/double-import.log @@ -75,7 +75,7 @@ Complete equivalence classes INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label BGCOL = $d021 @@ -119,7 +119,7 @@ Uplifting [] best 27 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label BGCOL = $d021 @@ -155,14 +155,18 @@ Removing instruction jmp b1 Removing instruction jmp bend Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination -Removing instruction bbegin: Removing instruction b1_from_bbegin: +Removing instruction b1: Removing instruction bend_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b1: Removing instruction bend: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @1 @@ -178,7 +182,7 @@ FINAL SYMBOL TABLE FINAL ASSEMBLER -Score: 18 +Score: 12 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -191,7 +195,6 @@ Score: 18 //SEG3 [1] phi from @begin to @1 [phi:@begin->@1] //SEG4 @1 //SEG5 [2] call main - jsr main //SEG6 [3] phi from @1 to @end [phi:@1->@end] //SEG7 @end //SEG8 main diff --git a/src/test/ref/dword.asm b/src/test/ref/dword.asm index beac6555c..c837e6daf 100644 --- a/src/test/ref/dword.asm +++ b/src/test/ref/dword.asm @@ -1,7 +1,6 @@ .pc = $801 "Basic" :BasicUpstart(main) .pc = $80d "Program" - jsr main main: { .const a = $ee6b2800 .label SCREEN = $400 diff --git a/src/test/ref/dword.log b/src/test/ref/dword.log index f87f3dd56..a5a992433 100644 --- a/src/test/ref/dword.log +++ b/src/test/ref/dword.log @@ -144,7 +144,7 @@ Allocated zp ZP_BYTE:7 [ main::c#0 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -237,7 +237,7 @@ Allocated (was zp ZP_DWORD:3) zp ZP_DWORD:2 [ main::b#0 ] ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -309,19 +309,23 @@ Removing instruction jmp b1 Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination Replacing label b1_from_b1 with b1 -Removing instruction bbegin: Removing instruction b1_from_bbegin: +Removing instruction b1: Removing instruction main_from_b1: Removing instruction bend_from_b1: Removing instruction b1_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b1: Removing instruction bend: Removing instruction b1_from_main: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Removing instruction jmp b1 Succesful ASM optimization Pass5NextJumpElimination +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @1 @@ -348,7 +352,7 @@ reg byte a [ main::c#0 ] FINAL ASSEMBLER -Score: 477 +Score: 471 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -360,7 +364,6 @@ Score: 477 //SEG4 @1 //SEG5 [2] call main //SEG6 [4] phi from @1 to main [phi:@1->main] - jsr main //SEG7 [3] phi from @1 to @end [phi:@1->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/emptyblock-error.asm b/src/test/ref/emptyblock-error.asm index b3b29277b..a8cde9c8f 100644 --- a/src/test/ref/emptyblock-error.asm +++ b/src/test/ref/emptyblock-error.asm @@ -2,7 +2,6 @@ :BasicUpstart(main) .pc = $80d "Program" .label B = $1000 - jsr main main: { lda #0 b2: diff --git a/src/test/ref/emptyblock-error.log b/src/test/ref/emptyblock-error.log index 375c584bd..bf4945b23 100644 --- a/src/test/ref/emptyblock-error.log +++ b/src/test/ref/emptyblock-error.log @@ -305,7 +305,7 @@ Allocated zp ZP_BYTE:2 [ a#1 a#12 a#5 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label B = $1000 @@ -413,7 +413,7 @@ Uplifting [mode] best 18376 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label B = $1000 @@ -514,8 +514,8 @@ Succesful ASM optimization Pass5NextJumpElimination Replacing label b1 with b2 Replacing label b1 with b2 Replacing label b1_from_b2 with b2 -Removing instruction bbegin: Removing instruction b3_from_bbegin: +Removing instruction b3: Removing instruction main_from_b3: Removing instruction bend_from_b3: Removing instruction b1: @@ -527,7 +527,6 @@ Removing instruction b1_from_mode: Removing instruction b1_from_b2: Removing instruction b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b3: Removing instruction bend: Removing instruction b1_from_main: Removing instruction b1_from_b2: @@ -535,6 +534,9 @@ Removing instruction b2: Removing instruction breturn: Removing instruction b7: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Skipping double jump to b2 in jmp b1_from_b7 Succesful ASM optimization Pass5DoubleJumpElimination Relabelling long label b1_from_b7 to b1 @@ -545,6 +547,8 @@ Removing instruction lda B Succesful ASM optimization Pass5UnnecesaryLoadElimination Removing instruction b1: Succesful ASM optimization Pass5RedundantLabelElimination +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @3 @@ -571,7 +575,7 @@ reg byte a [ a#1 a#12 a#5 ] FINAL ASSEMBLER -Score: 8874 +Score: 8868 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -584,7 +588,6 @@ Score: 8874 //SEG4 @3 //SEG5 [2] call main //SEG6 [4] phi from @3 to main [phi:@3->main] - jsr main //SEG7 [3] phi from @3 to @end [phi:@3->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/examples/3d/3d.asm b/src/test/ref/examples/3d/3d.asm index 6dce76516..e97727c03 100644 --- a/src/test/ref/examples/3d/3d.asm +++ b/src/test/ref/examples/3d/3d.asm @@ -1,5 +1,5 @@ .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" .label SPRITES_XPOS = $d000 .label SPRITES_YPOS = $d001 @@ -35,6 +35,7 @@ .label COSQ = SINQ+$40 .label sx = 2 .label sy = 3 +bbegin: jsr main main: { sei diff --git a/src/test/ref/examples/3d/3d.log b/src/test/ref/examples/3d/3d.log index 684e2feb8..3b787d5bf 100644 --- a/src/test/ref/examples/3d/3d.log +++ b/src/test/ref/examples/3d/3d.log @@ -5661,7 +5661,7 @@ Allocated zp ZP_WORD:116 [ debug_print_init::$92 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label SPRITES_XPOS = $d000 @@ -8405,7 +8405,7 @@ Allocated (was zp ZP_BYTE:55) zp ZP_BYTE:16 [ calculate_matrix::t10#0 ] ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label SPRITES_XPOS = $d000 @@ -10465,7 +10465,7 @@ Replacing label b1_from_b2 with b1 Replacing label b1_from_b1 with b1 Replacing label b1_from_b1 with b1 Replacing label b1_from_b1 with b1 -Removing instruction bbegin: +Removing instruction b33: Removing instruction bend_from_b33: Removing instruction b2_from_b1: Removing instruction anim_from_b2: @@ -10508,7 +10508,6 @@ Removing instruction b1_from_b2: Removing instruction b1_from_b1: Removing instruction b1_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b33: Removing instruction bend: Removing instruction b1: Removing instruction debug_print_init_from_b1: @@ -10617,9 +10616,9 @@ Removing instruction jmp b2 Removing instruction jmp b1 Removing instruction jmp b1 Succesful ASM optimization Pass5NextJumpElimination -Fixing long branch [307] bne b1 to beq -Fixing long branch [975] bne b2 to beq -Fixing long branch [985] bne b1 to beq +Fixing long branch [308] bne b1 to beq +Fixing long branch [976] bne b2 to beq +Fixing long branch [986] bne b1 to beq FINAL SYMBOL TABLE (label) @33 @@ -11247,7 +11246,7 @@ Score: 85532 //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label SPRITES_XPOS = $d000 @@ -11285,6 +11284,7 @@ Score: 85532 .label sx = 2 .label sy = 3 //SEG2 @begin +bbegin: //SEG3 @33 //SEG4 kickasm(location (const byte*) mulf_sqr1#0) {{ .for(var i=0;i<$200;i++) { .if(i<=159) { .byte round((i*i)/256) } .if(i>159 && i<=351 ) { .byte round(((i-256)*(i-256))/256) } .if(i>351) { .byte round(((512-i)*(512-i))/256) } } }} //SEG5 kickasm(location (const byte*) mulf_sqr2#0) {{ .for(var i=0;i<$200;i++) { .if(i<=159) { .byte round((-i-1)*(-i-1)/256) } .if(i>159 && i<=351 ) { .byte round(((255-i)*(255-i))/256) } .if(i>351) { .byte round(((i-511)*(i-511))/256) } } }} diff --git a/src/test/ref/examples/3d/perspective.asm b/src/test/ref/examples/3d/perspective.asm index 51e5b3b7a..ca08a6f96 100644 --- a/src/test/ref/examples/3d/perspective.asm +++ b/src/test/ref/examples/3d/perspective.asm @@ -1,5 +1,5 @@ .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" .label xr = $f0 .label yr = $f1 @@ -9,6 +9,7 @@ .label PERSP_Z = $2400 .label print_char_cursor = 4 .label print_line_cursor = 2 +bbegin: jsr main main: { sei diff --git a/src/test/ref/examples/3d/perspective.log b/src/test/ref/examples/3d/perspective.log index 6adf2345f..e0990818a 100644 --- a/src/test/ref/examples/3d/perspective.log +++ b/src/test/ref/examples/3d/perspective.log @@ -1929,7 +1929,7 @@ Allocated zp ZP_BYTE:24 [ mulf_init::$10 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label xr = $f0 @@ -2718,7 +2718,7 @@ Allocated (was zp ZP_BYTE:20) zp ZP_BYTE:6 [ mulf_init::val#0 ] ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label xr = $f0 @@ -3408,7 +3408,7 @@ Replacing label b2_from_b5 with b2 Replacing label b1_from_b1 with b1 Replacing label b1_from_b1 with b1 Replacing label b1_from_b1 with b1 -Removing instruction bbegin: +Removing instruction b27: Removing instruction bend_from_b27: Removing instruction b2_from_b1: Removing instruction do_perspective_from_b2: @@ -3443,7 +3443,6 @@ Removing instruction print_char_from_b1: Removing instruction b1_from_b1: Removing instruction b1_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b27: Removing instruction bend: Removing instruction mulf_init_from_main: Removing instruction b1: @@ -3718,7 +3717,7 @@ Score: 3787 //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label xr = $f0 @@ -3730,6 +3729,7 @@ Score: 3787 .label print_char_cursor = 4 .label print_line_cursor = 2 //SEG2 @begin +bbegin: //SEG3 @27 //SEG4 kickasm(location (const signed byte*) PERSP_Z#0) {{ { .var d = 256.0 .var z0 = 5.0 .for(var z=0;z<$100;z++) { .if(z>127) { .byte round(d / (z0 - ((z - 256) / 64.0))); } else { .byte round(d / (z0 - (z / 64.0))); } } } }} //SEG5 [2] call main diff --git a/src/test/ref/examples/bresenham/bitmap-bresenham.asm b/src/test/ref/examples/bresenham/bitmap-bresenham.asm index aad8f762c..cb2b6bfe9 100644 --- a/src/test/ref/examples/bresenham/bitmap-bresenham.asm +++ b/src/test/ref/examples/bresenham/bitmap-bresenham.asm @@ -11,7 +11,6 @@ .label SCREEN = $400 .label BITMAP = $2000 .const lines_cnt = 8 - jsr main main: { lda #0 sta BORDERCOL diff --git a/src/test/ref/examples/bresenham/bitmap-bresenham.log b/src/test/ref/examples/bresenham/bitmap-bresenham.log index 18c8aace9..2100cda54 100644 --- a/src/test/ref/examples/bresenham/bitmap-bresenham.log +++ b/src/test/ref/examples/bresenham/bitmap-bresenham.log @@ -2829,7 +2829,7 @@ Allocated zp ZP_BYTE:68 [ bitmap_init::$10 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label BORDERCOL = $d020 @@ -4249,7 +4249,7 @@ Allocated (was zp ZP_WORD:53) zp ZP_WORD:11 [ bitmap_plot::plotter_y#0 ] ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label BORDERCOL = $d020 @@ -5300,8 +5300,8 @@ Replacing label b10_from_b1 with b10 Replacing label b1_from_b2 with b1 Replacing label b4_from_b3 with b4 Replacing label b3_from_b4 with b3 -Removing instruction bbegin: Removing instruction b15_from_bbegin: +Removing instruction b15: Removing instruction bend_from_b15: Removing instruction b3_from_main: Removing instruction b4_from_b3: @@ -5337,7 +5337,6 @@ Removing instruction b4_from_b7: Removing instruction b10_from_b1: Removing instruction b2_from_b10: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b15: Removing instruction bend: Removing instruction bitmap_init_from_main: Removing instruction b3: @@ -5388,6 +5387,9 @@ Removing instruction b3_from_b2: Removing instruction b7: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Skipping double jump to b2 in bne b10 Succesful ASM optimization Pass5DoubleJumpElimination Removing instruction jmp b1 @@ -5399,6 +5401,7 @@ Removing instruction jmp b3 Succesful ASM optimization Pass5NextJumpElimination Removing instruction lda x0 Succesful ASM optimization Pass5UnnecesaryLoadElimination +Removing instruction bbegin: Removing instruction b10: Succesful ASM optimization Pass5UnusedLabelElimination Removing unreachable instruction jmp b2 @@ -5814,7 +5817,7 @@ reg byte a [ bitmap_init::$10 ] FINAL ASSEMBLER -Score: 221049 +Score: 221043 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -5835,7 +5838,6 @@ Score: 221049 //SEG3 [1] phi from @begin to @15 [phi:@begin->@15] //SEG4 @15 //SEG5 [2] call main - jsr main //SEG6 [3] phi from @15 to @end [phi:@15->@end] //SEG7 @end //SEG8 main diff --git a/src/test/ref/examples/chargen/chargen-analysis.asm b/src/test/ref/examples/chargen/chargen-analysis.asm index eeb164385..f57891c6b 100644 --- a/src/test/ref/examples/chargen/chargen-analysis.asm +++ b/src/test/ref/examples/chargen/chargen-analysis.asm @@ -61,7 +61,6 @@ .const KEY_SPACE = $3c .const KEY_Q = $3e .label SCREEN = $400 - jsr main main: { .label sc = 2 .label i = 4 diff --git a/src/test/ref/examples/chargen/chargen-analysis.log b/src/test/ref/examples/chargen/chargen-analysis.log index d6dbcff0a..3e6f2d650 100644 --- a/src/test/ref/examples/chargen/chargen-analysis.log +++ b/src/test/ref/examples/chargen/chargen-analysis.log @@ -2607,7 +2607,7 @@ Allocated zp ZP_BYTE:61 [ keyboard_get_keycode::return#0 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label PROCPORT = 1 @@ -3744,7 +3744,7 @@ Allocated (was zp ZP_WORD:23) zp ZP_WORD:11 [ mul8u::mb#2 mul8u::mb#1 ] ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label PROCPORT = 1 @@ -4653,8 +4653,8 @@ Replacing label b3_from_b4 with b3 Replacing label b2_from_b7 with b2 Replacing label b4_from_b2 with b4 Replacing label b1_from_b2 with b1 -Removing instruction bbegin: Removing instruction b19_from_bbegin: +Removing instruction b19: Removing instruction main_from_b19: Removing instruction bend_from_b19: Removing instruction b1_from_b1: @@ -4695,7 +4695,6 @@ Removing instruction b4_from_b7: Removing instruction b1_from_print_str_at: Removing instruction b1_from_b2: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b19: Removing instruction bend: Removing instruction b1_from_main: Removing instruction b13: @@ -4743,6 +4742,9 @@ Removing instruction breturn: Removing instruction breturn: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Skipping double jump to b4 in beq b41 Skipping double jump to b5 in beq b42 Skipping double jump to b6 in beq b43 @@ -4758,6 +4760,7 @@ Removing instruction jmp b10 Removing instruction jmp b2 Removing instruction jmp b3 Succesful ASM optimization Pass5NextJumpElimination +Removing instruction bbegin: Removing instruction b44: Removing instruction b43: Removing instruction b42: @@ -5213,7 +5216,7 @@ reg byte a [ keyboard_get_keycode::return#0 ] FINAL ASSEMBLER -Score: 628899 +Score: 628893 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -5285,7 +5288,6 @@ Score: 628899 //SEG4 @19 //SEG5 [2] call main //SEG6 [4] phi from @19 to main [phi:@19->main] - jsr main //SEG7 [3] phi from @19 to @end [phi:@19->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/examples/fastmultiply/fastmultiply8.kc.asm b/src/test/ref/examples/fastmultiply/fastmultiply8.kc.asm index 63f196508..71f6d63bd 100644 --- a/src/test/ref/examples/fastmultiply/fastmultiply8.kc.asm +++ b/src/test/ref/examples/fastmultiply/fastmultiply8.kc.asm @@ -1,5 +1,5 @@ .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" .label print_line_cursor = $400 .label ap = $fd @@ -7,6 +7,7 @@ .label cp = $ff .label mulf_sqr1 = $2000 .label mulf_sqr2 = $2200 +bbegin: jsr main main: { .label at = 2 diff --git a/src/test/ref/examples/fastmultiply/fastmultiply8.kc.log b/src/test/ref/examples/fastmultiply/fastmultiply8.kc.log index 45ed2b704..f8e460f1a 100644 --- a/src/test/ref/examples/fastmultiply/fastmultiply8.kc.log +++ b/src/test/ref/examples/fastmultiply/fastmultiply8.kc.log @@ -1305,7 +1305,7 @@ Allocated zp ZP_BYTE:31 [ fmul8::return#1 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label print_line_cursor = $400 @@ -1977,7 +1977,7 @@ Allocated (was zp ZP_BYTE:14) zp ZP_BYTE:11 [ print_char_at::ch#4 print_char_at: ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label print_line_cursor = $400 @@ -2506,7 +2506,7 @@ Replacing label b1_from_b1 with b1 Replacing label b2_from_b2 with b2 Replacing label b1_from_b1 with b1 Replacing label b1_from_b1 with b1 -Removing instruction bbegin: +Removing instruction b22: Removing instruction main_from_b22: Removing instruction bend_from_b22: Removing instruction b1_from_b8: @@ -2518,7 +2518,6 @@ Removing instruction b1_from_b1: Removing instruction b2_from_b2: Removing instruction b1_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b22: Removing instruction bend: Removing instruction init_screen_from_main: Removing instruction b1_from_main: @@ -2702,7 +2701,7 @@ Score: 10542 //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label print_line_cursor = $400 @@ -2712,6 +2711,7 @@ Score: 10542 .label mulf_sqr1 = $2000 .label mulf_sqr2 = $2200 //SEG2 @begin +bbegin: //SEG3 @22 //SEG4 kickasm(location (const byte*) mulf_sqr1#0) {{ .for(var i=0;i<$200;i++) { .if(i<=159) { .byte round((i*i)/256) } .if(i>159 && i<=351 ) { .byte round(((i-256)*(i-256))/256) } .if(i>351) { .byte round(((512-i)*(512-i))/256) } } }} //SEG5 kickasm(location (const byte*) mulf_sqr2#0) {{ .for(var i=0;i<$200;i++) { .if(i<=159) { .byte round((-i-1)*(-i-1)/256) } .if(i>159 && i<=351 ) { .byte round(((255-i)*(255-i))/256) } .if(i>351) { .byte round(((i-511)*(i-511))/256) } } }} diff --git a/src/test/ref/examples/helloworld/helloworld.asm b/src/test/ref/examples/helloworld/helloworld.asm index 8bfa8b401..9a8b575ee 100644 --- a/src/test/ref/examples/helloworld/helloworld.asm +++ b/src/test/ref/examples/helloworld/helloworld.asm @@ -3,7 +3,6 @@ .pc = $80d "Program" .label print_char_cursor = 4 .label print_line_cursor = 2 - jsr main main: { jsr print_str jsr print_ln diff --git a/src/test/ref/examples/helloworld/helloworld.log b/src/test/ref/examples/helloworld/helloworld.log index eb5c2cfb6..ec992d453 100644 --- a/src/test/ref/examples/helloworld/helloworld.log +++ b/src/test/ref/examples/helloworld/helloworld.log @@ -321,7 +321,7 @@ Allocated zp ZP_WORD:6 [ print_char_cursor#10 print_char_cursor#1 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label print_char_cursor = 6 @@ -480,7 +480,7 @@ Allocated (was zp ZP_WORD:6) zp ZP_WORD:4 [ print_char_cursor#10 print_char_curs ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label print_char_cursor = 4 @@ -628,15 +628,14 @@ Removing instruction ldy #0 Succesful ASM optimization Pass5UnnecesaryLoadElimination Replacing label b1_from_b1 with b1 Replacing label b1_from_b1 with b1 -Removing instruction bbegin: Removing instruction b20_from_bbegin: +Removing instruction b20: Removing instruction main_from_b20: Removing instruction bend_from_b20: Removing instruction b1_from_main: Removing instruction print_ln_from_b1: Removing instruction b1_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b20: Removing instruction bend: Removing instruction print_str_from_main: Removing instruction b1: @@ -647,8 +646,13 @@ Removing instruction b1_from_print_str: Removing instruction breturn: Removing instruction b1_from_b2: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Removing instruction jmp b1 Succesful ASM optimization Pass5NextJumpElimination +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @20 @@ -682,7 +686,7 @@ zp ZP_WORD:4 [ print_char_cursor#10 print_char_cursor#1 ] FINAL ASSEMBLER -Score: 1241 +Score: 1235 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -696,7 +700,6 @@ Score: 1241 //SEG4 @20 //SEG5 [2] call main //SEG6 [4] phi from @20 to main [phi:@20->main] - jsr main //SEG7 [3] phi from @20 to @end [phi:@20->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/examples/irq/irq-hyperscreen.asm b/src/test/ref/examples/irq/irq-hyperscreen.asm index 604bd080d..b97906bab 100644 --- a/src/test/ref/examples/irq/irq-hyperscreen.asm +++ b/src/test/ref/examples/irq/irq-hyperscreen.asm @@ -14,7 +14,6 @@ .const WHITE = 1 .const RED = 2 .label GHOST_BYTE = $3fff - jsr main main: { lda #0 sta GHOST_BYTE diff --git a/src/test/ref/examples/irq/irq-hyperscreen.log b/src/test/ref/examples/irq/irq-hyperscreen.log index 772240e57..9c7fe7027 100644 --- a/src/test/ref/examples/irq/irq-hyperscreen.log +++ b/src/test/ref/examples/irq/irq-hyperscreen.log @@ -556,7 +556,7 @@ Complete equivalence classes INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label RASTER = $d012 @@ -714,7 +714,7 @@ Uplifting [] best 175 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label RASTER = $d012 @@ -845,16 +845,20 @@ Removing instruction jmp breturn Removing instruction jmp breturn Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination -Removing instruction bbegin: Removing instruction b7_from_bbegin: +Removing instruction b7: Removing instruction bend_from_b7: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b7: Removing instruction bend: Removing instruction breturn: Removing instruction breturn: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @7 @@ -963,7 +967,7 @@ interrupt(KERNEL_KEYBOARD)(void()) irq_bottom_2() FINAL ASSEMBLER -Score: 160 +Score: 154 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -987,7 +991,6 @@ Score: 160 //SEG3 [1] phi from @begin to @7 [phi:@begin->@7] //SEG4 @7 //SEG5 [2] call main - jsr main //SEG6 [3] phi from @7 to @end [phi:@7->@end] //SEG7 @end //SEG8 main diff --git a/src/test/ref/examples/multiplexer/simple-multiplexer.asm b/src/test/ref/examples/multiplexer/simple-multiplexer.asm index 7c11a3d58..7bb737703 100644 --- a/src/test/ref/examples/multiplexer/simple-multiplexer.asm +++ b/src/test/ref/examples/multiplexer/simple-multiplexer.asm @@ -1,5 +1,5 @@ .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" .label SPRITES_XPOS = $d000 .label SPRITES_YPOS = $d001 @@ -22,6 +22,7 @@ .label plex_free_next = 3 .label plex_show_idx = 4 .label plex_sprite_msb = 5 +bbegin: jsr main main: { sei diff --git a/src/test/ref/examples/multiplexer/simple-multiplexer.log b/src/test/ref/examples/multiplexer/simple-multiplexer.log index 16055441c..febb9e4bb 100644 --- a/src/test/ref/examples/multiplexer/simple-multiplexer.log +++ b/src/test/ref/examples/multiplexer/simple-multiplexer.log @@ -2454,7 +2454,7 @@ Allocated zp ZP_BYTE:32 [ init::$6 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label SPRITES_XPOS = $d000 @@ -3268,7 +3268,7 @@ Allocated (was zp ZP_BYTE:24) zp ZP_BYTE:10 [ plexShowSprite::xpos_idx#0 ] ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label SPRITES_XPOS = $d000 @@ -3891,9 +3891,9 @@ Replacing label b3_from_b8 with b3 Replacing label b1_from_b1 with b1 Replacing label b2_from_b2 with b2 Replacing label b1_from_b1 with b1 -Removing instruction bbegin: Removing instruction b12: Removing instruction b15_from_b12: +Removing instruction b15: Removing instruction bend_from_b15: Removing instruction b1_from_main: Removing instruction loop_from_b1: @@ -3914,7 +3914,6 @@ Removing instruction plexSetScreen1_from_plexInit: Removing instruction b1_from_plexSetScreen1: Removing instruction b1_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b15: Removing instruction bend: Removing instruction b1: Removing instruction breturn: @@ -4236,7 +4235,7 @@ Score: 63466 //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label SPRITES_XPOS = $d000 @@ -4261,6 +4260,7 @@ Score: 63466 .label plex_show_idx = 4 .label plex_sprite_msb = 5 //SEG2 @begin +bbegin: //SEG3 @12 //SEG4 kickasm(location (const byte*) YSIN#0) {{ .var min = 50 .var max = 250-21 .var ampl = max-min; .for(var i=0;i<256;i++) .byte round(min+(ampl/2)+(ampl/2)*sin(toRadians(360*i/256))) }} //SEG5 kickasm(location (const byte*) SPRITE#0) {{ .var pic = LoadPicture("balloon.png", List().add($000000, $ffffff)) .for (var y=0; y<21; y++) .for (var x=0;x<3; x++) .byte pic.getSinglecolorByte(x,y) }} diff --git a/src/test/ref/examples/rasterbars/raster-bars.asm b/src/test/ref/examples/rasterbars/raster-bars.asm index 602c913af..d5551cecd 100644 --- a/src/test/ref/examples/rasterbars/raster-bars.asm +++ b/src/test/ref/examples/rasterbars/raster-bars.asm @@ -4,7 +4,6 @@ .label RASTER = $d012 .label BORDERCOL = $d020 .label BGCOL = $d021 - jsr main main: { sei b2: diff --git a/src/test/ref/examples/rasterbars/raster-bars.log b/src/test/ref/examples/rasterbars/raster-bars.log index 5ada87d19..2600a64b9 100644 --- a/src/test/ref/examples/rasterbars/raster-bars.log +++ b/src/test/ref/examples/rasterbars/raster-bars.log @@ -589,7 +589,7 @@ Allocated zp ZP_BYTE:3 [ raster::i#2 raster::i#1 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label RASTER = $d012 @@ -742,7 +742,7 @@ Uplifting [] best 9585 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label RASTER = $d012 @@ -878,20 +878,24 @@ Removing instruction jmp b1 Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination Replacing label b1_from_b1 with b1 -Removing instruction bbegin: Removing instruction b6_from_bbegin: +Removing instruction b6: Removing instruction bend_from_b6: Removing instruction b5_from_b3: Removing instruction b1_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b6: Removing instruction bend: Removing instruction b5: Removing instruction b1_from_raster: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Removing instruction jmp b1 Succesful ASM optimization Pass5NextJumpElimination +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @6 @@ -1001,7 +1005,7 @@ reg byte x [ raster::i#2 raster::i#1 ] FINAL ASSEMBLER -Score: 8346 +Score: 8340 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -1015,7 +1019,6 @@ Score: 8346 //SEG3 [1] phi from @begin to @6 [phi:@begin->@6] //SEG4 @6 //SEG5 [2] call main - jsr main //SEG6 [3] phi from @6 to @end [phi:@6->@end] //SEG7 @end //SEG8 main diff --git a/src/test/ref/examples/rotate/rotate.asm b/src/test/ref/examples/rotate/rotate.asm index fb44ad533..fd2027af4 100644 --- a/src/test/ref/examples/rotate/rotate.asm +++ b/src/test/ref/examples/rotate/rotate.asm @@ -1,5 +1,5 @@ .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" .label SPRITES_XPOS = $d000 .label SPRITES_YPOS = $d001 @@ -14,6 +14,7 @@ .label COS = $2000 .label SPRITE = $3000 .label SIN = COS+$40 +bbegin: jsr main main: { sei diff --git a/src/test/ref/examples/rotate/rotate.log b/src/test/ref/examples/rotate/rotate.log index 0a36c4082..b6df32c2c 100644 --- a/src/test/ref/examples/rotate/rotate.log +++ b/src/test/ref/examples/rotate/rotate.log @@ -2274,7 +2274,7 @@ Allocated zp ZP_BYTE:75 [ mulf_init::$6 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label SPRITES_XPOS = $d000 @@ -3343,7 +3343,7 @@ Allocated (was zp ZP_BYTE:25) zp ZP_BYTE:12 [ anim::y#0 ] ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label SPRITES_XPOS = $d000 @@ -4098,8 +4098,8 @@ Replacing label b1_from_b2 with b1 Replacing label b12_from_b3 with b12 Replacing label b3_from_b4 with b3 Replacing label b3_from_b4 with b3 -Removing instruction bbegin: Removing instruction b13: +Removing instruction b16: Removing instruction bend_from_b16: Removing instruction b1_from_main: Removing instruction anim_from_b1: @@ -4120,7 +4120,6 @@ Removing instruction b3_from_b4: Removing instruction b12_from_b3: Removing instruction b4_from_b12: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b16: Removing instruction bend: Removing instruction init_from_main: Removing instruction b1: @@ -4172,7 +4171,7 @@ Removing instruction b12: Succesful ASM optimization Pass5UnusedLabelElimination Removing unreachable instruction jmp b4 Succesful ASM optimization Pass5UnreachableCodeElimination -Fixing long branch [133] bne b7 to beq +Fixing long branch [134] bne b7 to beq FINAL SYMBOL TABLE (label) @13 @@ -4488,7 +4487,7 @@ Score: 34706 //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label SPRITES_XPOS = $d000 @@ -4505,6 +4504,7 @@ Score: 34706 .label SPRITE = $3000 .label SIN = COS+$40 //SEG2 @begin +bbegin: //SEG3 @13 //SEG4 kickasm(location (const byte*) COS#0) {{ { .var min = -$7fff .var max = $7fff .var ampl = max-min; .for(var i=0;i<$140;i++) { .var rad = i*2*PI/256; .byte >round(min+(ampl/2)+(ampl/2)*cos(rad)) } } }} //SEG5 @16 diff --git a/src/test/ref/examples/scroll/scroll.asm b/src/test/ref/examples/scroll/scroll.asm index bfeb4d888..512111236 100644 --- a/src/test/ref/examples/scroll/scroll.asm +++ b/src/test/ref/examples/scroll/scroll.asm @@ -5,7 +5,6 @@ .label RASTER = $d012 .label BGCOL = $d020 .label SCROLL = $d016 - jsr main main: { .label line = SCREEN+$28 .label nxt = 2 diff --git a/src/test/ref/examples/scroll/scroll.log b/src/test/ref/examples/scroll/scroll.log index 43ad298c4..7d2ba53ca 100644 --- a/src/test/ref/examples/scroll/scroll.log +++ b/src/test/ref/examples/scroll/scroll.log @@ -621,7 +621,7 @@ Allocated zp ZP_WORD:7 [ fillscreen::cursor#2 fillscreen::cursor#1 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label SCREEN = $400 @@ -860,7 +860,7 @@ Allocated (was zp ZP_WORD:5) zp ZP_WORD:2 [ main::nxt#4 main::nxt#9 main::nxt#10 ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label SCREEN = $400 @@ -1071,8 +1071,8 @@ Replacing label b5_from_b5 with b5 Replacing label b6_from_b10 with b6 Replacing label b1_from_b1 with b1 Replacing label b1_from_b1 with b1 -Removing instruction bbegin: Removing instruction b2_from_bbegin: +Removing instruction b2: Removing instruction main_from_b2: Removing instruction bend_from_b2: Removing instruction b2_from_b2: @@ -1081,7 +1081,6 @@ Removing instruction b6_from_b10: Removing instruction b4_from_b8: Removing instruction b1_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b2: Removing instruction bend: Removing instruction fillscreen_from_main: Removing instruction b2_from_main: @@ -1095,12 +1094,17 @@ Removing instruction b2_from_b4: Removing instruction b1_from_fillscreen: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Removing instruction jmp b2 Removing instruction jmp b5 Removing instruction jmp b6 Removing instruction jmp b4 Removing instruction jmp b1 Succesful ASM optimization Pass5NextJumpElimination +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @2 @@ -1160,7 +1164,7 @@ zp ZP_WORD:2 [ main::nxt#4 main::nxt#9 main::nxt#10 main::nxt#1 fillscreen::curs FINAL ASSEMBLER -Score: 6208 +Score: 6202 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -1176,7 +1180,6 @@ Score: 6208 //SEG4 @2 //SEG5 [2] call main //SEG6 [4] phi from @2 to main [phi:@2->main] - jsr main //SEG7 [3] phi from @2 to @end [phi:@2->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/examples/scrollbig/scrollbig.asm b/src/test/ref/examples/scrollbig/scrollbig.asm index 15e446bc3..9b7e96d0d 100644 --- a/src/test/ref/examples/scrollbig/scrollbig.asm +++ b/src/test/ref/examples/scrollbig/scrollbig.asm @@ -10,7 +10,6 @@ .label current_bit = 2 .label current_chargen = 3 .label nxt = 7 - jsr main main: { jsr fillscreen lda #main] - jsr main //SEG7 [3] phi from @6 to @end [phi:@6->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/examples/scrolllogo/scrolllogo.asm b/src/test/ref/examples/scrolllogo/scrolllogo.asm index c76e900e6..589860b97 100644 --- a/src/test/ref/examples/scrolllogo/scrolllogo.asm +++ b/src/test/ref/examples/scrolllogo/scrolllogo.asm @@ -1,5 +1,5 @@ .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" .label RASTER = $d012 .label BORDERCOL = $d020 @@ -21,6 +21,7 @@ .const XSIN_SIZE = $200 .label rem16u = 2 .label xsin_idx = 2 +bbegin: jsr main main: { .const toD0181_return = (>(SCREEN&$3fff)<<2)|(>LOGO)>>2&$f diff --git a/src/test/ref/examples/scrolllogo/scrolllogo.log b/src/test/ref/examples/scrolllogo/scrolllogo.log index 3a268c115..f16a8b035 100644 --- a/src/test/ref/examples/scrolllogo/scrolllogo.log +++ b/src/test/ref/examples/scrolllogo/scrolllogo.log @@ -4098,7 +4098,7 @@ Allocated zp ZP_WORD:181 [ fill::end#0 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label RASTER = $d012 @@ -6253,7 +6253,7 @@ Allocated (was zp ZP_WORD:123) zp ZP_WORD:31 [ sin16s::x1#0 ] ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label RASTER = $d012 @@ -7780,9 +7780,9 @@ Replacing label b3_from_b2 with b3 Replacing label b1_from_b3 with b1 Replacing label b1_from_b1 with b1 Replacing label b1_from_b1 with b1 -Removing instruction bbegin: Removing instruction b25: Removing instruction b28_from_b25: +Removing instruction b28: Removing instruction bend_from_b28: Removing instruction toD0181_from_main: Removing instruction toD0181: @@ -7818,7 +7818,6 @@ Removing instruction b3_from_b5: Removing instruction b1_from_fill: Removing instruction b1_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b28: Removing instruction bend: Removing instruction b3: Removing instruction fill_from_b3: @@ -8419,7 +8418,7 @@ Score: 41407 //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label RASTER = $d012 @@ -8443,6 +8442,7 @@ Score: 41407 .label rem16u = 2 .label xsin_idx = 2 //SEG2 @begin +bbegin: //SEG3 @25 //SEG4 kickasm(location (const byte*) LOGO#0) {{ .var logoPic = LoadPicture("logo.png", List().add($444444, $808080, $000000, $ffffff)) .for (var y=0; y<6 ; y++) .for (var x=0;x<40; x++) .for(var cp=0; cp<8; cp++) .byte logoPic.getMulticolorByte(x,cp+y*8) }} //SEG5 [2] phi from @25 to @28 [phi:@25->@28] diff --git a/src/test/ref/examples/showlogo/showlogo.asm b/src/test/ref/examples/showlogo/showlogo.asm index e7d13e29a..e01939764 100644 --- a/src/test/ref/examples/showlogo/showlogo.asm +++ b/src/test/ref/examples/showlogo/showlogo.asm @@ -1,5 +1,5 @@ .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" .label BORDERCOL = $d020 .label BGCOL = $d021 @@ -15,6 +15,7 @@ .const DARK_GREY = $b .label SCREEN = $400 .label LOGO = $2000 +bbegin: jsr main main: { .const toD0181_return = (>(SCREEN&$3fff)<<2)|(>LOGO)>>2&$f diff --git a/src/test/ref/examples/showlogo/showlogo.log b/src/test/ref/examples/showlogo/showlogo.log index c9d39b8ca..7fd99dfa3 100644 --- a/src/test/ref/examples/showlogo/showlogo.log +++ b/src/test/ref/examples/showlogo/showlogo.log @@ -862,7 +862,7 @@ Allocated zp ZP_WORD:8 [ fill::end#0 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label BORDERCOL = $d020 @@ -1090,7 +1090,7 @@ Allocated (was zp ZP_WORD:6) zp ZP_WORD:4 [ fill::addr#2 fill::addr#0 fill::addr ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label BORDERCOL = $d020 @@ -1286,9 +1286,9 @@ Succesful ASM optimization Pass5UnnecesaryLoadElimination Replacing label b1_from_b1 with b1 Replacing label b1_from_b1 with b1 Replacing label b1_from_b1 with b1 -Removing instruction bbegin: Removing instruction b4: Removing instruction b6_from_b4: +Removing instruction b6: Removing instruction bend_from_b6: Removing instruction toD0181_from_main: Removing instruction toD0181: @@ -1298,7 +1298,6 @@ Removing instruction b1_from_b1: Removing instruction b1_from_fill: Removing instruction b1_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b6: Removing instruction bend: Removing instruction b9: Removing instruction fill_from_b9: @@ -1457,7 +1456,7 @@ Score: 3578 //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label BORDERCOL = $d020 @@ -1475,6 +1474,7 @@ Score: 3578 .label SCREEN = $400 .label LOGO = $2000 //SEG2 @begin +bbegin: //SEG3 @4 //SEG4 kickasm(location (const byte*) LOGO#0) {{ .var logoPic = LoadPicture("logo.png", List().add($444444, $808080, $000000, $ffffff)) .for (var y=0; y<6 ; y++) .for (var x=0;x<40; x++) .for(var cp=0; cp<8; cp++) .byte logoPic.getMulticolorByte(x,cp+y*8) }} //SEG5 [2] phi from @4 to @6 [phi:@4->@6] diff --git a/src/test/ref/examples/sinplotter/sine-plotter.asm b/src/test/ref/examples/sinplotter/sine-plotter.asm index af4896e53..4e4c63749 100644 --- a/src/test/ref/examples/sinplotter/sine-plotter.asm +++ b/src/test/ref/examples/sinplotter/sine-plotter.asm @@ -1,5 +1,5 @@ .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" .label PROCPORT_DDR = 0 .const PROCPORT_DDR_MEMORY_MASK = 7 @@ -24,6 +24,7 @@ .const SIN_SIZE = $200 .label sin2 = $1400 .label rem16u = 2 +bbegin: .label pc_restore = * .pc = $1400 .for(var i=0; i<512; i++) { diff --git a/src/test/ref/examples/sinplotter/sine-plotter.log b/src/test/ref/examples/sinplotter/sine-plotter.log index 64721ae10..850625e13 100644 --- a/src/test/ref/examples/sinplotter/sine-plotter.log +++ b/src/test/ref/examples/sinplotter/sine-plotter.log @@ -3735,7 +3735,7 @@ Allocated zp ZP_BYTE:196 [ bitmap_init::$7 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label PROCPORT_DDR = 0 @@ -5897,7 +5897,7 @@ Allocated (was zp ZP_WORD:132) zp ZP_WORD:31 [ sin16s::x1#0 ] ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label PROCPORT_DDR = 0 @@ -7502,7 +7502,7 @@ Replacing label b4_from_b3 with b4 Replacing label b3_from_b4 with b3 Replacing label b1_from_b1 with b1 Replacing label b1_from_b1 with b1 -Removing instruction bbegin: +Removing instruction b29: Removing instruction b32_from_b29: Removing instruction bend_from_b32: Removing instruction vicSelectGfxBank1_toDd001_from_vicSelectGfxBank1: @@ -7551,7 +7551,6 @@ Removing instruction b10_from_b1: Removing instruction b2_from_b10: Removing instruction b1_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b29: Removing instruction b32: Removing instruction bend: Removing instruction vicSelectGfxBank1: @@ -7654,8 +7653,8 @@ Removing unreachable instruction jmp b2 Removing unreachable instruction jmp b3 Removing unreachable instruction jmp b2 Succesful ASM optimization Pass5UnreachableCodeElimination -Fixing long branch [149] bcc b1 to bcs -Fixing long branch [155] bcc b1 to bcs +Fixing long branch [150] bcc b1 to bcs +Fixing long branch [156] bcc b1 to bcs FINAL SYMBOL TABLE (label) @29 @@ -8176,7 +8175,7 @@ Score: 28381 //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label PROCPORT_DDR = 0 @@ -8203,6 +8202,7 @@ Score: 28381 .label sin2 = $1400 .label rem16u = 2 //SEG2 @begin +bbegin: //SEG3 @29 //SEG4 kickasm {{ .label pc_restore = * .pc = $1400 .for(var i=0; i<512; i++) { .word sin(toRadians([i*360]/512))*320 } .pc = pc_restore }} .label pc_restore = * diff --git a/src/test/ref/examples/sinsprites/sinus-sprites.asm b/src/test/ref/examples/sinsprites/sinus-sprites.asm index 6335bb124..c78f53fdb 100644 --- a/src/test/ref/examples/sinsprites/sinus-sprites.asm +++ b/src/test/ref/examples/sinsprites/sinus-sprites.asm @@ -23,7 +23,6 @@ .label progress_cursor = $a .label sin_idx_x = 2 .label sin_idx_y = 3 - jsr main main: { jsr init lda #0 diff --git a/src/test/ref/examples/sinsprites/sinus-sprites.log b/src/test/ref/examples/sinsprites/sinus-sprites.log index 9a31ee3c1..a0bfda64e 100644 --- a/src/test/ref/examples/sinsprites/sinus-sprites.log +++ b/src/test/ref/examples/sinsprites/sinus-sprites.log @@ -3500,7 +3500,7 @@ Allocated zp ZP_BYTE:71 [ place_sprites::j2#1 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label PROCPORT = 1 @@ -5229,7 +5229,7 @@ Allocated (was zp ZP_WORD:21) zp ZP_WORD:12 [ prepareMEM::mem#5 prepareMEM::mem# ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label PROCPORT = 1 @@ -6659,8 +6659,8 @@ Replacing label b4_from_b5 with b4 Replacing label b2_from_b8 with b2 Replacing label b1_from_b9 with b1 Replacing label b1_from_b1 with b1 -Removing instruction bbegin: Removing instruction b60_from_bbegin: +Removing instruction b60: Removing instruction main_from_b60: Removing instruction bend_from_b60: Removing instruction b2_from_b2: @@ -6729,7 +6729,6 @@ Removing instruction b4_from_b5: Removing instruction b5_from_b4: Removing instruction b1_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b60: Removing instruction bend: Removing instruction init_from_main: Removing instruction b2_from_main: @@ -6819,6 +6818,9 @@ Removing instruction breturn: Removing instruction b1_from_place_sprites: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Skipping double jump to b4 in bcc b14 Skipping double jump to b5 in bcc b15 Succesful ASM optimization Pass5DoubleJumpElimination @@ -6840,6 +6842,7 @@ Succesful ASM optimization Pass5NextJumpElimination Removing instruction lda xidx Removing instruction lda s_gen Succesful ASM optimization Pass5UnnecesaryLoadElimination +Removing instruction bbegin: Removing instruction b15: Removing instruction b14: Succesful ASM optimization Pass5UnusedLabelElimination @@ -7257,7 +7260,7 @@ reg byte x [ place_sprites::j2#1 ] FINAL ASSEMBLER -Score: 768747 +Score: 768741 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -7291,7 +7294,6 @@ Score: 768747 //SEG4 @60 //SEG5 [2] call main //SEG6 [4] phi from @60 to main [phi:@60->main] - jsr main //SEG7 [3] phi from @60 to @end [phi:@60->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/examples/tetris/test-sprites.asm b/src/test/ref/examples/tetris/test-sprites.asm index 7ab79f47e..0456f04c3 100644 --- a/src/test/ref/examples/tetris/test-sprites.asm +++ b/src/test/ref/examples/tetris/test-sprites.asm @@ -1,5 +1,5 @@ .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" .const SPRITE_PTRS = $3f8 .label SPRITES_XPOS = $d000 @@ -33,6 +33,7 @@ .label irq_sprite_ypos = 4 .label irq_sprite_ptr = 5 .label irq_cnt = 6 +bbegin: lda #IRQ_RASTER_FIRST sta irq_raster_next lda #$32 @@ -50,15 +51,6 @@ main: { jmp b2 } init_irq: { - .const toSpritePtr2_return = PLAYFIELD_SPRITES>>6 - lda #IRQ_RASTER_FIRST - sta irq_raster_next - lda #$32 - sta irq_sprite_ypos - lda #toSpritePtr2_return - sta irq_sprite_ptr - lda #0 - sta irq_cnt sei lda #CIA_INTERRUPT_CLEAR sta CIA1_INTERRUPT diff --git a/src/test/ref/examples/tetris/test-sprites.cfg b/src/test/ref/examples/tetris/test-sprites.cfg index 54ea244db..bb20da2ca 100644 --- a/src/test/ref/examples/tetris/test-sprites.cfg +++ b/src/test/ref/examples/tetris/test-sprites.cfg @@ -2,15 +2,15 @@ [0] phi() to:@6 @6: scope:[] from @begin - [1] (byte) irq_raster_next#2 ← (const byte) IRQ_RASTER_FIRST#0 - [2] (byte) irq_sprite_ypos#2 ← (byte/signed byte/word/signed word/dword/signed dword) 50 + [1] (byte) irq_raster_next#0 ← (const byte) IRQ_RASTER_FIRST#0 + [2] (byte) irq_sprite_ypos#0 ← (byte/signed byte/word/signed word/dword/signed dword) 50 to:toSpritePtr1 toSpritePtr1: scope:[] from @6 [3] phi() to:@9 @9: scope:[] from toSpritePtr1 - [4] (byte) irq_sprite_ptr#2 ← (const byte) toSpritePtr1_return#0 - [5] (byte) irq_cnt#19 ← (byte/signed byte/word/signed word/dword/signed dword) 0 + [4] (byte) irq_sprite_ptr#0 ← (const byte) toSpritePtr1_return#0 + [5] (byte) irq_cnt#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 to:@8 @8: scope:[] from @9 kickasm(location (const byte*) PLAYFIELD_SPRITES#0) {{ .var sprites = LoadPicture("nes-playfield.png", List().add($010101, $000000)) @@ -41,104 +41,95 @@ main::@2: scope:[main] from main::@2 main::@7 [13] *((const byte*) PLAYFIELD_SCREEN#0) ← ++ *((const byte*) PLAYFIELD_SCREEN#0) to:main::@2 init_irq: scope:[init_irq] from main::@7 - [14] (byte) irq_raster_next#11 ← (const byte) IRQ_RASTER_FIRST#0 - [15] (byte) irq_sprite_ypos#11 ← (byte/signed byte/word/signed word/dword/signed dword) 50 - to:init_irq::toSpritePtr2 -init_irq::toSpritePtr2: scope:[init_irq] from init_irq - [16] phi() - to:init_irq::@1 -init_irq::@1: scope:[init_irq] from init_irq::toSpritePtr2 - [17] (byte) irq_sprite_ptr#3 ← (const byte) init_irq::toSpritePtr2_return#0 - [18] (byte) irq_cnt#11 ← (byte/signed byte/word/signed word/dword/signed dword) 0 asm { sei } - [20] *((const byte*) CIA1_INTERRUPT#0) ← (const byte) CIA_INTERRUPT_CLEAR#0 - [21] *((const byte*) VIC_CONTROL#0) ← *((const byte*) VIC_CONTROL#0) & (byte/signed byte/word/signed word/dword/signed dword) 127 - [22] *((const byte*) RASTER#0) ← (const byte) IRQ_RASTER_FIRST#0 - [23] *((const byte*) IRQ_ENABLE#0) ← (const byte) IRQ_RASTER#0 - [24] *((const void()**) KERNEL_IRQ#0) ← &interrupt(KERNEL_MIN)(void()) irq() + [15] *((const byte*) CIA1_INTERRUPT#0) ← (const byte) CIA_INTERRUPT_CLEAR#0 + [16] *((const byte*) VIC_CONTROL#0) ← *((const byte*) VIC_CONTROL#0) & (byte/signed byte/word/signed word/dword/signed dword) 127 + [17] *((const byte*) RASTER#0) ← (const byte) IRQ_RASTER_FIRST#0 + [18] *((const byte*) IRQ_ENABLE#0) ← (const byte) IRQ_RASTER#0 + [19] *((const void()**) KERNEL_IRQ#0) ← &interrupt(KERNEL_MIN)(void()) irq() asm { cli } to:init_irq::@return -init_irq::@return: scope:[init_irq] from init_irq::@1 - [26] return +init_irq::@return: scope:[init_irq] from init_irq + [21] return to:@return init_sprites: scope:[init_sprites] from main - [27] phi() + [22] phi() to:init_sprites::vicSelectGfxBank1 init_sprites::vicSelectGfxBank1: scope:[init_sprites] from init_sprites - [28] *((const byte*) CIA2_PORT_A_DDR#0) ← (byte/signed byte/word/signed word/dword/signed dword) 3 + [23] *((const byte*) CIA2_PORT_A_DDR#0) ← (byte/signed byte/word/signed word/dword/signed dword) 3 to:init_sprites::vicSelectGfxBank1_toDd001 init_sprites::vicSelectGfxBank1_toDd001: scope:[init_sprites] from init_sprites::vicSelectGfxBank1 - [29] phi() + [24] phi() to:init_sprites::vicSelectGfxBank1_@1 init_sprites::vicSelectGfxBank1_@1: scope:[init_sprites] from init_sprites::vicSelectGfxBank1_toDd001 - [30] *((const byte*) CIA2_PORT_A#0) ← (const byte) init_sprites::vicSelectGfxBank1_toDd001_return#0 + [25] *((const byte*) CIA2_PORT_A#0) ← (const byte) init_sprites::vicSelectGfxBank1_toDd001_return#0 to:init_sprites::toD0181 init_sprites::toD0181: scope:[init_sprites] from init_sprites::vicSelectGfxBank1_@1 - [31] phi() + [26] phi() to:init_sprites::@4 init_sprites::@4: scope:[init_sprites] from init_sprites::toD0181 - [32] *((const byte*) D018#0) ← (const byte) init_sprites::toD0181_return#0 - [33] *((const byte*) SPRITES_ENABLE#0) ← (byte/signed byte/word/signed word/dword/signed dword) 15 - [34] *((const byte*) SPRITES_MC#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 - [35] *((const byte*) SPRITES_EXPAND_Y#0) ← *((const byte*) SPRITES_MC#0) - [36] *((const byte*) SPRITES_EXPAND_X#0) ← *((const byte*) SPRITES_EXPAND_Y#0) + [27] *((const byte*) D018#0) ← (const byte) init_sprites::toD0181_return#0 + [28] *((const byte*) SPRITES_ENABLE#0) ← (byte/signed byte/word/signed word/dword/signed dword) 15 + [29] *((const byte*) SPRITES_MC#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 + [30] *((const byte*) SPRITES_EXPAND_Y#0) ← *((const byte*) SPRITES_MC#0) + [31] *((const byte*) SPRITES_EXPAND_X#0) ← *((const byte*) SPRITES_EXPAND_Y#0) to:init_sprites::@1 init_sprites::@1: scope:[init_sprites] from init_sprites::@1 init_sprites::@4 - [37] (byte) init_sprites::xpos#2 ← phi( init_sprites::@1/(byte) init_sprites::xpos#1 init_sprites::@4/(byte/signed byte/word/signed word/dword/signed dword) 24+(byte/signed byte/word/signed word/dword/signed dword) 14*(byte/signed byte/word/signed word/dword/signed dword) 8 ) - [37] (byte) init_sprites::s#2 ← phi( init_sprites::@1/(byte) init_sprites::s#1 init_sprites::@4/(byte/signed byte/word/signed word/dword/signed dword) 0 ) - [38] (byte) init_sprites::s2#0 ← (byte) init_sprites::s#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 - [39] *((const byte*) SPRITES_XPOS#0 + (byte) init_sprites::s2#0) ← (byte) init_sprites::xpos#2 - [40] *((const byte*) SPRITES_COLS#0 + (byte) init_sprites::s#2) ← (const byte) BLACK#0 - [41] (byte) init_sprites::xpos#1 ← (byte) init_sprites::xpos#2 + (byte/signed byte/word/signed word/dword/signed dword) 24 - [42] (byte) init_sprites::s#1 ← ++ (byte) init_sprites::s#2 - [43] if((byte) init_sprites::s#1!=(byte/signed byte/word/signed word/dword/signed dword) 4) goto init_sprites::@1 + [32] (byte) init_sprites::xpos#2 ← phi( init_sprites::@1/(byte) init_sprites::xpos#1 init_sprites::@4/(byte/signed byte/word/signed word/dword/signed dword) 24+(byte/signed byte/word/signed word/dword/signed dword) 14*(byte/signed byte/word/signed word/dword/signed dword) 8 ) + [32] (byte) init_sprites::s#2 ← phi( init_sprites::@1/(byte) init_sprites::s#1 init_sprites::@4/(byte/signed byte/word/signed word/dword/signed dword) 0 ) + [33] (byte) init_sprites::s2#0 ← (byte) init_sprites::s#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 + [34] *((const byte*) SPRITES_XPOS#0 + (byte) init_sprites::s2#0) ← (byte) init_sprites::xpos#2 + [35] *((const byte*) SPRITES_COLS#0 + (byte) init_sprites::s#2) ← (const byte) BLACK#0 + [36] (byte) init_sprites::xpos#1 ← (byte) init_sprites::xpos#2 + (byte/signed byte/word/signed word/dword/signed dword) 24 + [37] (byte) init_sprites::s#1 ← ++ (byte) init_sprites::s#2 + [38] if((byte) init_sprites::s#1!=(byte/signed byte/word/signed word/dword/signed dword) 4) goto init_sprites::@1 to:init_sprites::@return init_sprites::@return: scope:[init_sprites] from init_sprites::@1 - [44] return + [39] return to:@return irq: scope:[irq] from - [45] *((const byte*) BORDERCOL#0) ← (const byte) DARK_GREY#0 - [46] *((const byte*) SPRITES_YPOS#0) ← (byte) irq_sprite_ypos#2 - [47] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte) irq_sprite_ypos#2 - [48] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 4) ← (byte) irq_sprite_ypos#2 - [49] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 6) ← (byte) irq_sprite_ypos#2 + [40] *((const byte*) BORDERCOL#0) ← (const byte) DARK_GREY#0 + [41] *((const byte*) SPRITES_YPOS#0) ← (byte) irq_sprite_ypos#0 + [42] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte) irq_sprite_ypos#0 + [43] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 4) ← (byte) irq_sprite_ypos#0 + [44] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 6) ← (byte) irq_sprite_ypos#0 to:irq::@1 irq::@1: scope:[irq] from irq irq::@1 - [50] if(*((const byte*) RASTER#0)!=(byte) irq_sprite_ypos#2) goto irq::@1 + [45] if(*((const byte*) RASTER#0)!=(byte) irq_sprite_ypos#0) goto irq::@1 to:irq::@4 irq::@4: scope:[irq] from irq::@1 - [51] (byte) irq::ptr#0 ← (byte) irq_sprite_ptr#2 - [52] *((const byte*) PLAYFIELD_SPRITE_PTRS#0) ← (byte) irq::ptr#0 - [53] (byte) irq::ptr#1 ← ++ (byte) irq::ptr#0 - [54] *((const byte*) PLAYFIELD_SPRITE_PTRS#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte) irq::ptr#1 - [55] *((const byte*) PLAYFIELD_SPRITE_PTRS#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte) irq::ptr#1 - [56] (byte) irq::ptr#2 ← ++ (byte) irq::ptr#1 - [57] *((const byte*) PLAYFIELD_SPRITE_PTRS#0+(byte/signed byte/word/signed word/dword/signed dword) 3) ← (byte) irq::ptr#2 - [58] (byte) irq_cnt#23 ← ++ (byte) irq_cnt#19 - [59] if((byte) irq_cnt#23==(byte/signed byte/word/signed word/dword/signed dword) 10) goto irq::@2 + [46] (byte) irq::ptr#0 ← (byte) irq_sprite_ptr#0 + [47] *((const byte*) PLAYFIELD_SPRITE_PTRS#0) ← (byte) irq::ptr#0 + [48] (byte) irq::ptr#1 ← ++ (byte) irq::ptr#0 + [49] *((const byte*) PLAYFIELD_SPRITE_PTRS#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte) irq::ptr#1 + [50] *((const byte*) PLAYFIELD_SPRITE_PTRS#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte) irq::ptr#1 + [51] (byte) irq::ptr#2 ← ++ (byte) irq::ptr#1 + [52] *((const byte*) PLAYFIELD_SPRITE_PTRS#0+(byte/signed byte/word/signed word/dword/signed dword) 3) ← (byte) irq::ptr#2 + [53] (byte) irq_cnt#1 ← ++ (byte) irq_cnt#0 + [54] if((byte) irq_cnt#1==(byte/signed byte/word/signed word/dword/signed dword) 10) goto irq::@2 to:irq::@5 irq::@5: scope:[irq] from irq::@4 - [60] (byte) irq_raster_next#6 ← (byte) irq_raster_next#2 + (byte/signed byte/word/signed word/dword/signed dword) 21 - [61] (byte) irq_sprite_ypos#6 ← (byte) irq_sprite_ypos#2 + (byte/signed byte/word/signed word/dword/signed dword) 21 - [62] (byte) irq_sprite_ptr#6 ← (byte) irq_sprite_ptr#2 + (byte/signed byte/word/signed word/dword/signed dword) 3 + [55] (byte) irq_raster_next#2 ← (byte) irq_raster_next#0 + (byte/signed byte/word/signed word/dword/signed dword) 21 + [56] (byte) irq_sprite_ypos#2 ← (byte) irq_sprite_ypos#0 + (byte/signed byte/word/signed word/dword/signed dword) 21 + [57] (byte) irq_sprite_ptr#2 ← (byte) irq_sprite_ptr#0 + (byte/signed byte/word/signed word/dword/signed dword) 3 to:irq::@3 irq::@3: scope:[irq] from irq::@5 irq::@7 - [63] (byte) irq_raster_next#13 ← phi( irq::@5/(byte) irq_raster_next#6 irq::@7/(byte) irq_raster_next#20 ) - [64] *((const byte*) RASTER#0) ← (byte) irq_raster_next#13 - [65] *((const byte*) IRQ_STATUS#0) ← (const byte) IRQ_RASTER#0 - [66] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 + [58] (byte) irq_raster_next#3 ← phi( irq::@5/(byte) irq_raster_next#2 irq::@7/(byte) irq_raster_next#1 ) + [59] *((const byte*) RASTER#0) ← (byte) irq_raster_next#3 + [60] *((const byte*) IRQ_STATUS#0) ← (const byte) IRQ_RASTER#0 + [61] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 to:irq::@return irq::@return: scope:[irq] from irq::@3 - [67] return + [62] return to:@return irq::@2: scope:[irq] from irq::@4 - [68] (byte) irq_cnt#24 ← (byte/signed byte/word/signed word/dword/signed dword) 0 - [69] (byte) irq_raster_next#20 ← (const byte) IRQ_RASTER_FIRST#0 - [70] (byte) irq_sprite_ypos#26 ← (byte/signed byte/word/signed word/dword/signed dword) 50 + [63] (byte) irq_cnt#10 ← (byte/signed byte/word/signed word/dword/signed dword) 0 + [64] (byte) irq_raster_next#1 ← (const byte) IRQ_RASTER_FIRST#0 + [65] (byte) irq_sprite_ypos#1 ← (byte/signed byte/word/signed word/dword/signed dword) 50 to:irq::toSpritePtr2 irq::toSpritePtr2: scope:[irq] from irq::@2 - [71] phi() + [66] phi() to:irq::@7 irq::@7: scope:[irq] from irq::toSpritePtr2 - [72] (byte) irq_sprite_ptr#5 ← (const byte) irq::toSpritePtr2_return#0 + [67] (byte) irq_sprite_ptr#1 ← (const byte) irq::toSpritePtr2_return#0 to:irq::@3 diff --git a/src/test/ref/examples/tetris/test-sprites.log b/src/test/ref/examples/tetris/test-sprites.log index 89f30be5b..f7ae86c1f 100644 --- a/src/test/ref/examples/tetris/test-sprites.log +++ b/src/test/ref/examples/tetris/test-sprites.log @@ -3,7 +3,6 @@ Inlined call (byte~) vicSelectGfxBank::$0 ← call toDd00 (byte*) vicSelectGfxBa Inlined call call vicSelectGfxBank (byte*) PLAYFIELD_SCREEN Inlined call (byte~) init_sprites::$1 ← call toD018 (byte*) PLAYFIELD_SCREEN (byte*) PLAYFIELD_CHARSET Inlined call (byte~) $1 ← call toSpritePtr (byte*) PLAYFIELD_SPRITES -Inlined call (byte~) init_irq::$0 ← call toSpritePtr (byte*) PLAYFIELD_SPRITES Inlined call (byte~) irq::$2 ← call toSpritePtr (byte*) PLAYFIELD_SPRITES CONTROL FLOW GRAPH SSA @@ -96,52 +95,20 @@ CONTROL FLOW GRAPH SSA (byte*) PLAYFIELD_SPRITE_PTRS#0 ← (byte*~) $0 to:@6 main: scope:[main] from @8 - (byte) irq_cnt#20 ← phi( @8/(byte) irq_cnt#19 ) - (byte) irq_sprite_ptr#21 ← phi( @8/(byte) irq_sprite_ptr#20 ) - (byte) irq_sprite_ypos#23 ← phi( @8/(byte) irq_sprite_ypos#20 ) - (byte) irq_raster_next#22 ← phi( @8/(byte) irq_raster_next#21 ) call init_sprites to:main::@7 main::@7: scope:[main] from main - (byte) irq_cnt#15 ← phi( main/(byte) irq_cnt#20 ) - (byte) irq_sprite_ptr#16 ← phi( main/(byte) irq_sprite_ptr#21 ) - (byte) irq_sprite_ypos#17 ← phi( main/(byte) irq_sprite_ypos#23 ) - (byte) irq_raster_next#16 ← phi( main/(byte) irq_raster_next#22 ) call init_irq to:main::@8 main::@8: scope:[main] from main::@7 - (byte) irq_cnt#9 ← phi( main::@7/(byte) irq_cnt#4 ) - (byte) irq_sprite_ptr#9 ← phi( main::@7/(byte) irq_sprite_ptr#4 ) - (byte) irq_sprite_ypos#9 ← phi( main::@7/(byte) irq_sprite_ypos#4 ) - (byte) irq_raster_next#9 ← phi( main::@7/(byte) irq_raster_next#4 ) - (byte) irq_raster_next#0 ← (byte) irq_raster_next#9 - (byte) irq_sprite_ypos#0 ← (byte) irq_sprite_ypos#9 - (byte) irq_sprite_ptr#0 ← (byte) irq_sprite_ptr#9 - (byte) irq_cnt#0 ← (byte) irq_cnt#9 to:main::@1 main::@1: scope:[main] from main::@2 main::@8 - (byte) irq_cnt#16 ← phi( main::@2/(byte) irq_cnt#21 main::@8/(byte) irq_cnt#0 ) - (byte) irq_sprite_ptr#17 ← phi( main::@2/(byte) irq_sprite_ptr#22 main::@8/(byte) irq_sprite_ptr#0 ) - (byte) irq_sprite_ypos#18 ← phi( main::@2/(byte) irq_sprite_ypos#24 main::@8/(byte) irq_sprite_ypos#0 ) - (byte) irq_raster_next#17 ← phi( main::@2/(byte) irq_raster_next#23 main::@8/(byte) irq_raster_next#0 ) if(true) goto main::@2 to:main::@return main::@2: scope:[main] from main::@1 - (byte) irq_cnt#21 ← phi( main::@1/(byte) irq_cnt#16 ) - (byte) irq_sprite_ptr#22 ← phi( main::@1/(byte) irq_sprite_ptr#17 ) - (byte) irq_sprite_ypos#24 ← phi( main::@1/(byte) irq_sprite_ypos#18 ) - (byte) irq_raster_next#23 ← phi( main::@1/(byte) irq_raster_next#17 ) *((byte*) PLAYFIELD_SCREEN#0) ← ++ *((byte*) PLAYFIELD_SCREEN#0) to:main::@1 main::@return: scope:[main] from main::@1 - (byte) irq_cnt#10 ← phi( main::@1/(byte) irq_cnt#16 ) - (byte) irq_sprite_ptr#10 ← phi( main::@1/(byte) irq_sprite_ptr#17 ) - (byte) irq_sprite_ypos#10 ← phi( main::@1/(byte) irq_sprite_ypos#18 ) - (byte) irq_raster_next#10 ← phi( main::@1/(byte) irq_raster_next#17 ) - (byte) irq_raster_next#1 ← (byte) irq_raster_next#10 - (byte) irq_sprite_ypos#1 ← (byte) irq_sprite_ypos#10 - (byte) irq_sprite_ptr#1 ← (byte) irq_sprite_ptr#10 - (byte) irq_cnt#1 ← (byte) irq_cnt#10 return to:@return init_sprites: scope:[init_sprites] from main @@ -222,13 +189,13 @@ init_sprites::@return: scope:[init_sprites] from init_sprites::@1 to:@return @6: scope:[] from @4 (byte) IRQ_RASTER_FIRST#0 ← (byte/signed byte/word/signed word/dword/signed dword) 48 - (byte) irq_raster_next#2 ← (byte) IRQ_RASTER_FIRST#0 - (byte) irq_sprite_ypos#2 ← (byte/signed byte/word/signed word/dword/signed dword) 50 + (byte) irq_raster_next#0 ← (byte) IRQ_RASTER_FIRST#0 + (byte) irq_sprite_ypos#0 ← (byte/signed byte/word/signed word/dword/signed dword) 50 (byte*) toSpritePtr1_sprite#0 ← (byte*) PLAYFIELD_SPRITES#0 to:toSpritePtr1 toSpritePtr1: scope:[] from @6 - (byte) irq_raster_next#32 ← phi( @6/(byte) irq_raster_next#2 ) - (byte) irq_sprite_ypos#31 ← phi( @6/(byte) irq_sprite_ypos#2 ) + (byte) irq_raster_next#16 ← phi( @6/(byte) irq_raster_next#0 ) + (byte) irq_sprite_ypos#15 ← phi( @6/(byte) irq_sprite_ypos#0 ) (byte*) toSpritePtr1_sprite#1 ← phi( @6/(byte*) toSpritePtr1_sprite#0 ) (word) toSpritePtr1_$0#0 ← ((word)) (byte*) toSpritePtr1_sprite#1 (word) toSpritePtr1_$1#0 ← (word) toSpritePtr1_$0#0 >> (byte/signed byte/word/signed word/dword/signed dword) 6 @@ -236,111 +203,77 @@ toSpritePtr1: scope:[] from @6 (byte) toSpritePtr1_return#0 ← (byte) toSpritePtr1_$2#0 to:toSpritePtr1_@return toSpritePtr1_@return: scope:[] from toSpritePtr1 - (byte) irq_raster_next#28 ← phi( toSpritePtr1/(byte) irq_raster_next#32 ) - (byte) irq_sprite_ypos#28 ← phi( toSpritePtr1/(byte) irq_sprite_ypos#31 ) + (byte) irq_raster_next#15 ← phi( toSpritePtr1/(byte) irq_raster_next#16 ) + (byte) irq_sprite_ypos#13 ← phi( toSpritePtr1/(byte) irq_sprite_ypos#15 ) (byte) toSpritePtr1_return#2 ← phi( toSpritePtr1/(byte) toSpritePtr1_return#0 ) (byte) toSpritePtr1_return#1 ← (byte) toSpritePtr1_return#2 to:@9 @9: scope:[] from toSpritePtr1_@return - (byte) irq_raster_next#27 ← phi( toSpritePtr1_@return/(byte) irq_raster_next#28 ) - (byte) irq_sprite_ypos#27 ← phi( toSpritePtr1_@return/(byte) irq_sprite_ypos#28 ) + (byte) irq_raster_next#14 ← phi( toSpritePtr1_@return/(byte) irq_raster_next#15 ) + (byte) irq_sprite_ypos#12 ← phi( toSpritePtr1_@return/(byte) irq_sprite_ypos#13 ) (byte) toSpritePtr1_return#3 ← phi( toSpritePtr1_@return/(byte) toSpritePtr1_return#1 ) (byte~) $1 ← (byte) toSpritePtr1_return#3 - (byte) irq_sprite_ptr#2 ← (byte~) $1 - (byte) irq_cnt#2 ← (byte/signed byte/word/signed word/dword/signed dword) 0 + (byte) irq_sprite_ptr#0 ← (byte~) $1 + (byte) irq_cnt#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 to:@8 init_irq: scope:[init_irq] from main::@7 - (byte) irq_raster_next#3 ← (byte) IRQ_RASTER_FIRST#0 - (byte) irq_sprite_ypos#3 ← (byte/signed byte/word/signed word/dword/signed dword) 50 - (byte*) init_irq::toSpritePtr2_sprite#0 ← (byte*) PLAYFIELD_SPRITES#0 - to:init_irq::toSpritePtr2 -init_irq::toSpritePtr2: scope:[init_irq] from init_irq - (byte) irq_sprite_ypos#29 ← phi( init_irq/(byte) irq_sprite_ypos#3 ) - (byte) irq_raster_next#29 ← phi( init_irq/(byte) irq_raster_next#3 ) - (byte*) init_irq::toSpritePtr2_sprite#1 ← phi( init_irq/(byte*) init_irq::toSpritePtr2_sprite#0 ) - (word) init_irq::toSpritePtr2_$0#0 ← ((word)) (byte*) init_irq::toSpritePtr2_sprite#1 - (word) init_irq::toSpritePtr2_$1#0 ← (word) init_irq::toSpritePtr2_$0#0 >> (byte/signed byte/word/signed word/dword/signed dword) 6 - (byte) init_irq::toSpritePtr2_$2#0 ← ((byte)) (word) init_irq::toSpritePtr2_$1#0 - (byte) init_irq::toSpritePtr2_return#0 ← (byte) init_irq::toSpritePtr2_$2#0 - to:init_irq::toSpritePtr2_@return -init_irq::toSpritePtr2_@return: scope:[init_irq] from init_irq::toSpritePtr2 - (byte) irq_sprite_ypos#25 ← phi( init_irq::toSpritePtr2/(byte) irq_sprite_ypos#29 ) - (byte) irq_raster_next#24 ← phi( init_irq::toSpritePtr2/(byte) irq_raster_next#29 ) - (byte) init_irq::toSpritePtr2_return#2 ← phi( init_irq::toSpritePtr2/(byte) init_irq::toSpritePtr2_return#0 ) - (byte) init_irq::toSpritePtr2_return#1 ← (byte) init_irq::toSpritePtr2_return#2 - to:init_irq::@1 -init_irq::@1: scope:[init_irq] from init_irq::toSpritePtr2_@return - (byte) irq_sprite_ypos#19 ← phi( init_irq::toSpritePtr2_@return/(byte) irq_sprite_ypos#25 ) - (byte) irq_raster_next#18 ← phi( init_irq::toSpritePtr2_@return/(byte) irq_raster_next#24 ) - (byte) init_irq::toSpritePtr2_return#3 ← phi( init_irq::toSpritePtr2_@return/(byte) init_irq::toSpritePtr2_return#1 ) - (byte~) init_irq::$0 ← (byte) init_irq::toSpritePtr2_return#3 - (byte) irq_sprite_ptr#3 ← (byte~) init_irq::$0 - (byte) irq_cnt#3 ← (byte/signed byte/word/signed word/dword/signed dword) 0 asm { sei } *((byte*) CIA1_INTERRUPT#0) ← (byte) CIA_INTERRUPT_CLEAR#0 *((byte*) VIC_CONTROL#0) ← *((byte*) VIC_CONTROL#0) & (byte/signed byte/word/signed word/dword/signed dword) 127 *((byte*) RASTER#0) ← (byte) IRQ_RASTER_FIRST#0 *((byte*) IRQ_ENABLE#0) ← (byte) IRQ_RASTER#0 - (void()*~) init_irq::$1 ← & interrupt(KERNEL_MIN)(void()) irq() - *((void()**) KERNEL_IRQ#0) ← (void()*~) init_irq::$1 + (void()*~) init_irq::$0 ← & interrupt(KERNEL_MIN)(void()) irq() + *((void()**) KERNEL_IRQ#0) ← (void()*~) init_irq::$0 asm { cli } to:init_irq::@return -init_irq::@return: scope:[init_irq] from init_irq::@1 - (byte) irq_cnt#11 ← phi( init_irq::@1/(byte) irq_cnt#3 ) - (byte) irq_sprite_ptr#11 ← phi( init_irq::@1/(byte) irq_sprite_ptr#3 ) - (byte) irq_sprite_ypos#11 ← phi( init_irq::@1/(byte) irq_sprite_ypos#19 ) - (byte) irq_raster_next#11 ← phi( init_irq::@1/(byte) irq_raster_next#18 ) - (byte) irq_raster_next#4 ← (byte) irq_raster_next#11 - (byte) irq_sprite_ypos#4 ← (byte) irq_sprite_ypos#11 - (byte) irq_sprite_ptr#4 ← (byte) irq_sprite_ptr#11 - (byte) irq_cnt#4 ← (byte) irq_cnt#11 +init_irq::@return: scope:[init_irq] from init_irq return to:@return irq: scope:[irq] from - (byte) irq_raster_next#30 ← phi( @8/(byte) irq_raster_next#21 ) - (byte) irq_cnt#22 ← phi( @8/(byte) irq_cnt#19 ) - (byte) irq_sprite_ptr#23 ← phi( @8/(byte) irq_sprite_ptr#20 ) - (byte) irq_sprite_ypos#12 ← phi( @8/(byte) irq_sprite_ypos#20 ) + (byte) irq_raster_next#11 ← phi( @8/(byte) irq_raster_next#13 ) + (byte) irq_cnt#8 ← phi( @8/(byte) irq_cnt#11 ) + (byte) irq_sprite_ptr#9 ← phi( @8/(byte) irq_sprite_ptr#10 ) + (byte) irq_sprite_ypos#4 ← phi( @8/(byte) irq_sprite_ypos#8 ) *((byte*) BORDERCOL#0) ← (byte) DARK_GREY#0 - *((byte*) SPRITES_YPOS#0 + (byte/signed byte/word/signed word/dword/signed dword) 0) ← (byte) irq_sprite_ypos#12 - *((byte*) SPRITES_YPOS#0 + (byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte) irq_sprite_ypos#12 - *((byte*) SPRITES_YPOS#0 + (byte/signed byte/word/signed word/dword/signed dword) 4) ← (byte) irq_sprite_ypos#12 - *((byte*) SPRITES_YPOS#0 + (byte/signed byte/word/signed word/dword/signed dword) 6) ← (byte) irq_sprite_ypos#12 + *((byte*) SPRITES_YPOS#0 + (byte/signed byte/word/signed word/dword/signed dword) 0) ← (byte) irq_sprite_ypos#4 + *((byte*) SPRITES_YPOS#0 + (byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte) irq_sprite_ypos#4 + *((byte*) SPRITES_YPOS#0 + (byte/signed byte/word/signed word/dword/signed dword) 4) ← (byte) irq_sprite_ypos#4 + *((byte*) SPRITES_YPOS#0 + (byte/signed byte/word/signed word/dword/signed dword) 6) ← (byte) irq_sprite_ypos#4 to:irq::@1 irq::@1: scope:[irq] from irq irq::@1 - (byte) irq_raster_next#25 ← phi( irq/(byte) irq_raster_next#30 irq::@1/(byte) irq_raster_next#25 ) - (byte) irq_cnt#17 ← phi( irq/(byte) irq_cnt#22 irq::@1/(byte) irq_cnt#17 ) - (byte) irq_sprite_ptr#18 ← phi( irq/(byte) irq_sprite_ptr#23 irq::@1/(byte) irq_sprite_ptr#18 ) - (byte) irq_sprite_ypos#13 ← phi( irq/(byte) irq_sprite_ypos#12 irq::@1/(byte) irq_sprite_ypos#13 ) - (bool~) irq::$0 ← *((byte*) RASTER#0) != (byte) irq_sprite_ypos#13 + (byte) irq_raster_next#9 ← phi( irq/(byte) irq_raster_next#11 irq::@1/(byte) irq_raster_next#9 ) + (byte) irq_cnt#6 ← phi( irq/(byte) irq_cnt#8 irq::@1/(byte) irq_cnt#6 ) + (byte) irq_sprite_ptr#7 ← phi( irq/(byte) irq_sprite_ptr#9 irq::@1/(byte) irq_sprite_ptr#7 ) + (byte) irq_sprite_ypos#5 ← phi( irq/(byte) irq_sprite_ypos#4 irq::@1/(byte) irq_sprite_ypos#5 ) + (bool~) irq::$0 ← *((byte*) RASTER#0) != (byte) irq_sprite_ypos#5 if((bool~) irq::$0) goto irq::@1 to:irq::@4 irq::@4: scope:[irq] from irq::@1 - (byte) irq_sprite_ypos#21 ← phi( irq::@1/(byte) irq_sprite_ypos#13 ) - (byte) irq_raster_next#19 ← phi( irq::@1/(byte) irq_raster_next#25 ) - (byte) irq_cnt#12 ← phi( irq::@1/(byte) irq_cnt#17 ) - (byte) irq_sprite_ptr#12 ← phi( irq::@1/(byte) irq_sprite_ptr#18 ) - (byte) irq::ptr#0 ← (byte) irq_sprite_ptr#12 + (byte) irq_sprite_ypos#9 ← phi( irq::@1/(byte) irq_sprite_ypos#5 ) + (byte) irq_raster_next#7 ← phi( irq::@1/(byte) irq_raster_next#9 ) + (byte) irq_cnt#4 ← phi( irq::@1/(byte) irq_cnt#6 ) + (byte) irq_sprite_ptr#4 ← phi( irq::@1/(byte) irq_sprite_ptr#7 ) + (byte) irq::ptr#0 ← (byte) irq_sprite_ptr#4 *((byte*) PLAYFIELD_SPRITE_PTRS#0 + (byte/signed byte/word/signed word/dword/signed dword) 0) ← (byte) irq::ptr#0 (byte) irq::ptr#1 ← ++ (byte) irq::ptr#0 *((byte*) PLAYFIELD_SPRITE_PTRS#0 + (byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte) irq::ptr#1 *((byte*) PLAYFIELD_SPRITE_PTRS#0 + (byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte) irq::ptr#1 (byte) irq::ptr#2 ← ++ (byte) irq::ptr#1 *((byte*) PLAYFIELD_SPRITE_PTRS#0 + (byte/signed byte/word/signed word/dword/signed dword) 3) ← (byte) irq::ptr#2 - (byte) irq_cnt#5 ← ++ (byte) irq_cnt#12 - (bool~) irq::$1 ← (byte) irq_cnt#5 == (byte/signed byte/word/signed word/dword/signed dword) 10 + (byte) irq_cnt#1 ← ++ (byte) irq_cnt#4 + (bool~) irq::$1 ← (byte) irq_cnt#1 == (byte/signed byte/word/signed word/dword/signed dword) 10 if((bool~) irq::$1) goto irq::@2 to:irq::@5 irq::@2: scope:[irq] from irq::@4 - (byte) irq_cnt#6 ← (byte/signed byte/word/signed word/dword/signed dword) 0 - (byte) irq_raster_next#5 ← (byte) IRQ_RASTER_FIRST#0 - (byte) irq_sprite_ypos#5 ← (byte/signed byte/word/signed word/dword/signed dword) 50 + (byte) irq_cnt#2 ← (byte/signed byte/word/signed word/dword/signed dword) 0 + (byte) irq_raster_next#1 ← (byte) IRQ_RASTER_FIRST#0 + (byte) irq_sprite_ypos#1 ← (byte/signed byte/word/signed word/dword/signed dword) 50 (byte*) irq::toSpritePtr2_sprite#0 ← (byte*) PLAYFIELD_SPRITES#0 to:irq::toSpritePtr2 irq::toSpritePtr2: scope:[irq] from irq::@2 - (byte) irq_sprite_ypos#32 ← phi( irq::@2/(byte) irq_sprite_ypos#5 ) - (byte) irq_cnt#26 ← phi( irq::@2/(byte) irq_cnt#6 ) - (byte) irq_raster_next#31 ← phi( irq::@2/(byte) irq_raster_next#5 ) + (byte) irq_sprite_ypos#16 ← phi( irq::@2/(byte) irq_sprite_ypos#1 ) + (byte) irq_cnt#13 ← phi( irq::@2/(byte) irq_cnt#2 ) + (byte) irq_raster_next#12 ← phi( irq::@2/(byte) irq_raster_next#1 ) (byte*) irq::toSpritePtr2_sprite#1 ← phi( irq::@2/(byte*) irq::toSpritePtr2_sprite#0 ) (word) irq::toSpritePtr2_$0#0 ← ((word)) (byte*) irq::toSpritePtr2_sprite#1 (word) irq::toSpritePtr2_$1#0 ← (word) irq::toSpritePtr2_$0#0 >> (byte/signed byte/word/signed word/dword/signed dword) 6 @@ -348,54 +281,54 @@ irq::toSpritePtr2: scope:[irq] from irq::@2 (byte) irq::toSpritePtr2_return#0 ← (byte) irq::toSpritePtr2_$2#0 to:irq::toSpritePtr2_@return irq::toSpritePtr2_@return: scope:[irq] from irq::toSpritePtr2 - (byte) irq_sprite_ypos#30 ← phi( irq::toSpritePtr2/(byte) irq_sprite_ypos#32 ) - (byte) irq_cnt#25 ← phi( irq::toSpritePtr2/(byte) irq_cnt#26 ) - (byte) irq_raster_next#26 ← phi( irq::toSpritePtr2/(byte) irq_raster_next#31 ) + (byte) irq_sprite_ypos#14 ← phi( irq::toSpritePtr2/(byte) irq_sprite_ypos#16 ) + (byte) irq_cnt#12 ← phi( irq::toSpritePtr2/(byte) irq_cnt#13 ) + (byte) irq_raster_next#10 ← phi( irq::toSpritePtr2/(byte) irq_raster_next#12 ) (byte) irq::toSpritePtr2_return#2 ← phi( irq::toSpritePtr2/(byte) irq::toSpritePtr2_return#0 ) (byte) irq::toSpritePtr2_return#1 ← (byte) irq::toSpritePtr2_return#2 to:irq::@7 irq::@7: scope:[irq] from irq::toSpritePtr2_@return - (byte) irq_sprite_ypos#26 ← phi( irq::toSpritePtr2_@return/(byte) irq_sprite_ypos#30 ) - (byte) irq_cnt#24 ← phi( irq::toSpritePtr2_@return/(byte) irq_cnt#25 ) - (byte) irq_raster_next#20 ← phi( irq::toSpritePtr2_@return/(byte) irq_raster_next#26 ) + (byte) irq_sprite_ypos#11 ← phi( irq::toSpritePtr2_@return/(byte) irq_sprite_ypos#14 ) + (byte) irq_cnt#10 ← phi( irq::toSpritePtr2_@return/(byte) irq_cnt#12 ) + (byte) irq_raster_next#8 ← phi( irq::toSpritePtr2_@return/(byte) irq_raster_next#10 ) (byte) irq::toSpritePtr2_return#3 ← phi( irq::toSpritePtr2_@return/(byte) irq::toSpritePtr2_return#1 ) (byte~) irq::$2 ← (byte) irq::toSpritePtr2_return#3 - (byte) irq_sprite_ptr#5 ← (byte~) irq::$2 + (byte) irq_sprite_ptr#1 ← (byte~) irq::$2 to:irq::@3 irq::@5: scope:[irq] from irq::@4 - (byte) irq_cnt#23 ← phi( irq::@4/(byte) irq_cnt#5 ) - (byte) irq_sprite_ptr#13 ← phi( irq::@4/(byte) irq_sprite_ptr#12 ) - (byte) irq_sprite_ypos#14 ← phi( irq::@4/(byte) irq_sprite_ypos#21 ) - (byte) irq_raster_next#12 ← phi( irq::@4/(byte) irq_raster_next#19 ) - (byte) irq_raster_next#6 ← (byte) irq_raster_next#12 + (byte/signed byte/word/signed word/dword/signed dword) 21 - (byte) irq_sprite_ypos#6 ← (byte) irq_sprite_ypos#14 + (byte/signed byte/word/signed word/dword/signed dword) 21 - (byte) irq_sprite_ptr#6 ← (byte) irq_sprite_ptr#13 + (byte/signed byte/word/signed word/dword/signed dword) 3 + (byte) irq_cnt#9 ← phi( irq::@4/(byte) irq_cnt#1 ) + (byte) irq_sprite_ptr#5 ← phi( irq::@4/(byte) irq_sprite_ptr#4 ) + (byte) irq_sprite_ypos#6 ← phi( irq::@4/(byte) irq_sprite_ypos#9 ) + (byte) irq_raster_next#4 ← phi( irq::@4/(byte) irq_raster_next#7 ) + (byte) irq_raster_next#2 ← (byte) irq_raster_next#4 + (byte/signed byte/word/signed word/dword/signed dword) 21 + (byte) irq_sprite_ypos#2 ← (byte) irq_sprite_ypos#6 + (byte/signed byte/word/signed word/dword/signed dword) 21 + (byte) irq_sprite_ptr#2 ← (byte) irq_sprite_ptr#5 + (byte/signed byte/word/signed word/dword/signed dword) 3 to:irq::@3 irq::@3: scope:[irq] from irq::@5 irq::@7 - (byte) irq_sprite_ptr#19 ← phi( irq::@5/(byte) irq_sprite_ptr#6 irq::@7/(byte) irq_sprite_ptr#5 ) - (byte) irq_sprite_ypos#22 ← phi( irq::@5/(byte) irq_sprite_ypos#6 irq::@7/(byte) irq_sprite_ypos#26 ) - (byte) irq_cnt#18 ← phi( irq::@5/(byte) irq_cnt#23 irq::@7/(byte) irq_cnt#24 ) - (byte) irq_raster_next#13 ← phi( irq::@5/(byte) irq_raster_next#6 irq::@7/(byte) irq_raster_next#20 ) - *((byte*) RASTER#0) ← (byte) irq_raster_next#13 + (byte) irq_sprite_ptr#8 ← phi( irq::@5/(byte) irq_sprite_ptr#2 irq::@7/(byte) irq_sprite_ptr#1 ) + (byte) irq_sprite_ypos#10 ← phi( irq::@5/(byte) irq_sprite_ypos#2 irq::@7/(byte) irq_sprite_ypos#11 ) + (byte) irq_cnt#7 ← phi( irq::@5/(byte) irq_cnt#9 irq::@7/(byte) irq_cnt#10 ) + (byte) irq_raster_next#5 ← phi( irq::@5/(byte) irq_raster_next#2 irq::@7/(byte) irq_raster_next#8 ) + *((byte*) RASTER#0) ← (byte) irq_raster_next#5 *((byte*) IRQ_STATUS#0) ← (byte) IRQ_RASTER#0 *((byte*) BORDERCOL#0) ← (byte) BLACK#0 to:irq::@return irq::@return: scope:[irq] from irq::@3 - (byte) irq_sprite_ptr#14 ← phi( irq::@3/(byte) irq_sprite_ptr#19 ) - (byte) irq_sprite_ypos#15 ← phi( irq::@3/(byte) irq_sprite_ypos#22 ) - (byte) irq_raster_next#14 ← phi( irq::@3/(byte) irq_raster_next#13 ) - (byte) irq_cnt#13 ← phi( irq::@3/(byte) irq_cnt#18 ) - (byte) irq_cnt#7 ← (byte) irq_cnt#13 - (byte) irq_raster_next#7 ← (byte) irq_raster_next#14 - (byte) irq_sprite_ypos#7 ← (byte) irq_sprite_ypos#15 - (byte) irq_sprite_ptr#7 ← (byte) irq_sprite_ptr#14 + (byte) irq_sprite_ptr#6 ← phi( irq::@3/(byte) irq_sprite_ptr#8 ) + (byte) irq_sprite_ypos#7 ← phi( irq::@3/(byte) irq_sprite_ypos#10 ) + (byte) irq_raster_next#6 ← phi( irq::@3/(byte) irq_raster_next#5 ) + (byte) irq_cnt#5 ← phi( irq::@3/(byte) irq_cnt#7 ) + (byte) irq_cnt#3 ← (byte) irq_cnt#5 + (byte) irq_raster_next#3 ← (byte) irq_raster_next#6 + (byte) irq_sprite_ypos#3 ← (byte) irq_sprite_ypos#7 + (byte) irq_sprite_ptr#3 ← (byte) irq_sprite_ptr#6 return to:@return @8: scope:[] from @9 - (byte) irq_cnt#19 ← phi( @9/(byte) irq_cnt#2 ) - (byte) irq_sprite_ptr#20 ← phi( @9/(byte) irq_sprite_ptr#2 ) - (byte) irq_raster_next#21 ← phi( @9/(byte) irq_raster_next#27 ) - (byte) irq_sprite_ypos#20 ← phi( @9/(byte) irq_sprite_ypos#27 ) + (byte) irq_raster_next#13 ← phi( @9/(byte) irq_raster_next#14 ) + (byte) irq_cnt#11 ← phi( @9/(byte) irq_cnt#0 ) + (byte) irq_sprite_ptr#10 ← phi( @9/(byte) irq_sprite_ptr#0 ) + (byte) irq_sprite_ypos#8 ← phi( @9/(byte) irq_sprite_ypos#12 ) kickasm(location (byte*) PLAYFIELD_SPRITES#0) {{ .var sprites = LoadPicture("nes-playfield.png", List().add($010101, $000000)) .for(var sy=0;sy<10;sy++) { .for(var sx=0;sx<3;sx++) { @@ -411,14 +344,6 @@ irq::@return: scope:[irq] from irq::@3 call main to:@10 @10: scope:[] from @8 - (byte) irq_cnt#14 ← phi( @8/(byte) irq_cnt#1 ) - (byte) irq_sprite_ptr#15 ← phi( @8/(byte) irq_sprite_ptr#1 ) - (byte) irq_sprite_ypos#16 ← phi( @8/(byte) irq_sprite_ypos#1 ) - (byte) irq_raster_next#15 ← phi( @8/(byte) irq_raster_next#1 ) - (byte) irq_raster_next#8 ← (byte) irq_raster_next#15 - (byte) irq_sprite_ypos#8 ← (byte) irq_sprite_ypos#16 - (byte) irq_sprite_ptr#8 ← (byte) irq_sprite_ptr#15 - (byte) irq_cnt#8 ← (byte) irq_cnt#14 to:@end @end: scope:[] from @10 @@ -601,26 +526,8 @@ SYMBOL TABLE SSA (byte) YELLOW (byte) YELLOW#0 (void()) init_irq() -(byte~) init_irq::$0 -(void()*~) init_irq::$1 -(label) init_irq::@1 +(void()*~) init_irq::$0 (label) init_irq::@return -(label) init_irq::toSpritePtr2 -(word~) init_irq::toSpritePtr2_$0 -(word) init_irq::toSpritePtr2_$0#0 -(word~) init_irq::toSpritePtr2_$1 -(word) init_irq::toSpritePtr2_$1#0 -(byte~) init_irq::toSpritePtr2_$2 -(byte) init_irq::toSpritePtr2_$2#0 -(label) init_irq::toSpritePtr2_@return -(byte) init_irq::toSpritePtr2_return -(byte) init_irq::toSpritePtr2_return#0 -(byte) init_irq::toSpritePtr2_return#1 -(byte) init_irq::toSpritePtr2_return#2 -(byte) init_irq::toSpritePtr2_return#3 -(byte*) init_irq::toSpritePtr2_sprite -(byte*) init_irq::toSpritePtr2_sprite#0 -(byte*) init_irq::toSpritePtr2_sprite#1 (void()) init_sprites() (byte~) init_sprites::$1 (byte/signed byte/word/signed word/dword/signed dword~) init_sprites::$2 @@ -736,20 +643,7 @@ interrupt(KERNEL_MIN)(void()) irq() (byte) irq_cnt#11 (byte) irq_cnt#12 (byte) irq_cnt#13 -(byte) irq_cnt#14 -(byte) irq_cnt#15 -(byte) irq_cnt#16 -(byte) irq_cnt#17 -(byte) irq_cnt#18 -(byte) irq_cnt#19 (byte) irq_cnt#2 -(byte) irq_cnt#20 -(byte) irq_cnt#21 -(byte) irq_cnt#22 -(byte) irq_cnt#23 -(byte) irq_cnt#24 -(byte) irq_cnt#25 -(byte) irq_cnt#26 (byte) irq_cnt#3 (byte) irq_cnt#4 (byte) irq_cnt#5 @@ -767,24 +661,8 @@ interrupt(KERNEL_MIN)(void()) irq() (byte) irq_raster_next#14 (byte) irq_raster_next#15 (byte) irq_raster_next#16 -(byte) irq_raster_next#17 -(byte) irq_raster_next#18 -(byte) irq_raster_next#19 (byte) irq_raster_next#2 -(byte) irq_raster_next#20 -(byte) irq_raster_next#21 -(byte) irq_raster_next#22 -(byte) irq_raster_next#23 -(byte) irq_raster_next#24 -(byte) irq_raster_next#25 -(byte) irq_raster_next#26 -(byte) irq_raster_next#27 -(byte) irq_raster_next#28 -(byte) irq_raster_next#29 (byte) irq_raster_next#3 -(byte) irq_raster_next#30 -(byte) irq_raster_next#31 -(byte) irq_raster_next#32 (byte) irq_raster_next#4 (byte) irq_raster_next#5 (byte) irq_raster_next#6 @@ -795,20 +673,7 @@ interrupt(KERNEL_MIN)(void()) irq() (byte) irq_sprite_ptr#0 (byte) irq_sprite_ptr#1 (byte) irq_sprite_ptr#10 -(byte) irq_sprite_ptr#11 -(byte) irq_sprite_ptr#12 -(byte) irq_sprite_ptr#13 -(byte) irq_sprite_ptr#14 -(byte) irq_sprite_ptr#15 -(byte) irq_sprite_ptr#16 -(byte) irq_sprite_ptr#17 -(byte) irq_sprite_ptr#18 -(byte) irq_sprite_ptr#19 (byte) irq_sprite_ptr#2 -(byte) irq_sprite_ptr#20 -(byte) irq_sprite_ptr#21 -(byte) irq_sprite_ptr#22 -(byte) irq_sprite_ptr#23 (byte) irq_sprite_ptr#3 (byte) irq_sprite_ptr#4 (byte) irq_sprite_ptr#5 @@ -826,24 +691,8 @@ interrupt(KERNEL_MIN)(void()) irq() (byte) irq_sprite_ypos#14 (byte) irq_sprite_ypos#15 (byte) irq_sprite_ypos#16 -(byte) irq_sprite_ypos#17 -(byte) irq_sprite_ypos#18 -(byte) irq_sprite_ypos#19 (byte) irq_sprite_ypos#2 -(byte) irq_sprite_ypos#20 -(byte) irq_sprite_ypos#21 -(byte) irq_sprite_ypos#22 -(byte) irq_sprite_ypos#23 -(byte) irq_sprite_ypos#24 -(byte) irq_sprite_ypos#25 -(byte) irq_sprite_ypos#26 -(byte) irq_sprite_ypos#27 -(byte) irq_sprite_ypos#28 -(byte) irq_sprite_ypos#29 (byte) irq_sprite_ypos#3 -(byte) irq_sprite_ypos#30 -(byte) irq_sprite_ypos#31 -(byte) irq_sprite_ypos#32 (byte) irq_sprite_ypos#4 (byte) irq_sprite_ypos#5 (byte) irq_sprite_ypos#6 @@ -873,23 +722,13 @@ interrupt(KERNEL_MIN)(void()) irq() (byte*) toSpritePtr1_sprite#0 (byte*) toSpritePtr1_sprite#1 -Alias candidate removed (volatile)(byte) IRQ_RASTER_FIRST#0 = (byte) irq_raster_next#2 (byte) irq_raster_next#32 (byte) irq_raster_next#28 (byte) irq_raster_next#27 (byte) irq_raster_next#21 -Alias candidate removed (volatile)(byte) toSpritePtr1_return#0 = (byte) toSpritePtr1_$2#0 (byte) toSpritePtr1_return#2 (byte) toSpritePtr1_return#1 (byte) toSpritePtr1_return#3 (byte~) $1 (byte) irq_sprite_ptr#2 (byte) irq_sprite_ptr#20 -Alias candidate removed (volatile)(byte) init_irq::toSpritePtr2_return#0 = (byte) init_irq::toSpritePtr2_$2#0 (byte) init_irq::toSpritePtr2_return#2 (byte) init_irq::toSpritePtr2_return#1 (byte) init_irq::toSpritePtr2_return#3 (byte~) init_irq::$0 (byte) irq_sprite_ptr#3 (byte) irq_sprite_ptr#11 (byte) irq_sprite_ptr#4 -Alias candidate removed (volatile)(byte) irq::toSpritePtr2_return#0 = (byte) irq::toSpritePtr2_$2#0 (byte) irq::toSpritePtr2_return#2 (byte) irq::toSpritePtr2_return#1 (byte) irq::toSpritePtr2_return#3 (byte~) irq::$2 (byte) irq_sprite_ptr#5 +Culled Empty Block (label) main::@8 +Culled Empty Block (label) @10 +Successful SSA optimization Pass2CullEmptyBlocks +Alias candidate removed (volatile)(byte) IRQ_RASTER_FIRST#0 = (byte) irq_raster_next#0 (byte) irq_raster_next#16 (byte) irq_raster_next#15 (byte) irq_raster_next#14 (byte) irq_raster_next#13 +Alias candidate removed (volatile)(byte) toSpritePtr1_return#0 = (byte) toSpritePtr1_$2#0 (byte) toSpritePtr1_return#2 (byte) toSpritePtr1_return#1 (byte) toSpritePtr1_return#3 (byte~) $1 (byte) irq_sprite_ptr#0 (byte) irq_sprite_ptr#10 +Alias candidate removed (volatile)(byte) irq::toSpritePtr2_return#0 = (byte) irq::toSpritePtr2_$2#0 (byte) irq::toSpritePtr2_return#2 (byte) irq::toSpritePtr2_return#1 (byte) irq::toSpritePtr2_return#3 (byte~) irq::$2 (byte) irq_sprite_ptr#1 Alias (byte*) PLAYFIELD_SPRITE_PTRS#0 = (byte*~) $0 -Alias (byte) irq_raster_next#16 = (byte) irq_raster_next#22 -Alias (byte) irq_sprite_ypos#17 = (byte) irq_sprite_ypos#23 -Alias (byte) irq_sprite_ptr#16 = (byte) irq_sprite_ptr#21 -Alias (byte) irq_cnt#15 = (byte) irq_cnt#20 -Alias (byte) irq_raster_next#0 = (byte) irq_raster_next#9 -Alias (byte) irq_sprite_ypos#0 = (byte) irq_sprite_ypos#9 -Alias (byte) irq_sprite_ptr#0 = (byte) irq_sprite_ptr#9 -Alias (byte) irq_cnt#0 = (byte) irq_cnt#9 -Alias (byte) irq_raster_next#1 = (byte) irq_raster_next#23 (byte) irq_raster_next#17 (byte) irq_raster_next#10 -Alias (byte) irq_sprite_ypos#1 = (byte) irq_sprite_ypos#24 (byte) irq_sprite_ypos#18 (byte) irq_sprite_ypos#10 -Alias (byte) irq_sprite_ptr#1 = (byte) irq_sprite_ptr#22 (byte) irq_sprite_ptr#17 (byte) irq_sprite_ptr#10 -Alias (byte) irq_cnt#1 = (byte) irq_cnt#21 (byte) irq_cnt#16 (byte) irq_cnt#10 Alias (byte*) init_sprites::vicSelectGfxBank1_gfx#0 = (byte*) init_sprites::vicSelectGfxBank1_gfx#1 (byte*) init_sprites::vicSelectGfxBank1_toDd001_gfx#0 (byte*) init_sprites::vicSelectGfxBank1_toDd001_gfx#1 Alias (byte) init_sprites::vicSelectGfxBank1_toDd001_return#0 = (byte/word/dword) init_sprites::vicSelectGfxBank1_toDd001_$3#0 (byte) init_sprites::vicSelectGfxBank1_toDd001_return#2 (byte) init_sprites::vicSelectGfxBank1_toDd001_return#1 (byte) init_sprites::vicSelectGfxBank1_toDd001_return#3 (byte) init_sprites::vicSelectGfxBank1_$0#0 Alias (byte*) init_sprites::toD0181_screen#0 = (byte*) init_sprites::toD0181_screen#1 @@ -899,83 +738,51 @@ Alias (byte) init_sprites::xpos#0 = (byte/signed word/word/dword/signed dword/si Alias (byte) init_sprites::s2#0 = (byte~) init_sprites::$4 Alias (byte) init_sprites::xpos#1 = (byte/signed word/word/dword/signed dword~) init_sprites::$5 Alias (byte*) PLAYFIELD_SPRITES#0 = (byte*) toSpritePtr1_sprite#0 (byte*) toSpritePtr1_sprite#1 -Alias (byte) irq_sprite_ypos#2 = (byte) irq_sprite_ypos#31 (byte) irq_sprite_ypos#28 (byte) irq_sprite_ypos#27 (byte) irq_sprite_ypos#20 -Alias (byte*) init_irq::toSpritePtr2_sprite#0 = (byte*) init_irq::toSpritePtr2_sprite#1 -Alias (byte) irq_raster_next#11 = (byte) irq_raster_next#29 (byte) irq_raster_next#3 (byte) irq_raster_next#24 (byte) irq_raster_next#18 (byte) irq_raster_next#4 -Alias (byte) irq_sprite_ypos#11 = (byte) irq_sprite_ypos#29 (byte) irq_sprite_ypos#3 (byte) irq_sprite_ypos#25 (byte) irq_sprite_ypos#19 (byte) irq_sprite_ypos#4 -Alias (byte) irq_cnt#11 = (byte) irq_cnt#3 (byte) irq_cnt#4 -Alias (byte) irq_sprite_ptr#12 = (byte) irq_sprite_ptr#18 (byte) irq_sprite_ptr#13 -Alias (byte) irq_cnt#12 = (byte) irq_cnt#17 -Alias (byte) irq_raster_next#12 = (byte) irq_raster_next#19 (byte) irq_raster_next#25 -Alias (byte) irq_sprite_ypos#13 = (byte) irq_sprite_ypos#21 (byte) irq_sprite_ypos#14 +Alias (byte) irq_sprite_ypos#0 = (byte) irq_sprite_ypos#15 (byte) irq_sprite_ypos#13 (byte) irq_sprite_ypos#12 (byte) irq_sprite_ypos#8 +Alias (byte) irq_sprite_ptr#4 = (byte) irq_sprite_ptr#7 (byte) irq_sprite_ptr#5 +Alias (byte) irq_cnt#4 = (byte) irq_cnt#6 +Alias (byte) irq_raster_next#4 = (byte) irq_raster_next#7 (byte) irq_raster_next#9 +Alias (byte) irq_sprite_ypos#5 = (byte) irq_sprite_ypos#9 (byte) irq_sprite_ypos#6 Alias (byte*) irq::toSpritePtr2_sprite#0 = (byte*) irq::toSpritePtr2_sprite#1 -Alias (byte) irq_raster_next#20 = (byte) irq_raster_next#31 (byte) irq_raster_next#5 (byte) irq_raster_next#26 -Alias (byte) irq_cnt#24 = (byte) irq_cnt#26 (byte) irq_cnt#6 (byte) irq_cnt#25 -Alias (byte) irq_sprite_ypos#26 = (byte) irq_sprite_ypos#32 (byte) irq_sprite_ypos#5 (byte) irq_sprite_ypos#30 -Alias (byte) irq_cnt#23 = (byte) irq_cnt#5 -Alias (byte) irq_cnt#13 = (byte) irq_cnt#18 (byte) irq_cnt#7 -Alias (byte) irq_raster_next#13 = (byte) irq_raster_next#14 (byte) irq_raster_next#7 -Alias (byte) irq_sprite_ypos#15 = (byte) irq_sprite_ypos#22 (byte) irq_sprite_ypos#7 -Alias (byte) irq_sprite_ptr#14 = (byte) irq_sprite_ptr#19 (byte) irq_sprite_ptr#7 -Alias (byte) irq_cnt#19 = (byte) irq_cnt#2 -Alias (byte) irq_raster_next#15 = (byte) irq_raster_next#8 -Alias (byte) irq_sprite_ypos#16 = (byte) irq_sprite_ypos#8 -Alias (byte) irq_sprite_ptr#15 = (byte) irq_sprite_ptr#8 -Alias (byte) irq_cnt#14 = (byte) irq_cnt#8 +Alias (byte) irq_raster_next#1 = (byte) irq_raster_next#12 (byte) irq_raster_next#10 (byte) irq_raster_next#8 +Alias (byte) irq_cnt#10 = (byte) irq_cnt#13 (byte) irq_cnt#2 (byte) irq_cnt#12 +Alias (byte) irq_sprite_ypos#1 = (byte) irq_sprite_ypos#16 (byte) irq_sprite_ypos#14 (byte) irq_sprite_ypos#11 +Alias (byte) irq_cnt#1 = (byte) irq_cnt#9 +Alias (byte) irq_cnt#3 = (byte) irq_cnt#5 (byte) irq_cnt#7 +Alias (byte) irq_raster_next#3 = (byte) irq_raster_next#6 (byte) irq_raster_next#5 +Alias (byte) irq_sprite_ypos#10 = (byte) irq_sprite_ypos#7 (byte) irq_sprite_ypos#3 +Alias (byte) irq_sprite_ptr#3 = (byte) irq_sprite_ptr#6 (byte) irq_sprite_ptr#8 +Alias (byte) irq_cnt#0 = (byte) irq_cnt#11 Successful SSA optimization Pass2AliasElimination -Alias candidate removed (volatile)(byte) IRQ_RASTER_FIRST#0 = (byte) irq_raster_next#2 (byte) irq_raster_next#32 (byte) irq_raster_next#28 (byte) irq_raster_next#27 (byte) irq_raster_next#21 -Alias candidate removed (volatile)(byte) toSpritePtr1_return#0 = (byte) toSpritePtr1_$2#0 (byte) toSpritePtr1_return#2 (byte) toSpritePtr1_return#1 (byte) toSpritePtr1_return#3 (byte~) $1 (byte) irq_sprite_ptr#2 (byte) irq_sprite_ptr#20 -Alias candidate removed (volatile)(byte) init_irq::toSpritePtr2_return#0 = (byte) init_irq::toSpritePtr2_$2#0 (byte) init_irq::toSpritePtr2_return#2 (byte) init_irq::toSpritePtr2_return#1 (byte) init_irq::toSpritePtr2_return#3 (byte~) init_irq::$0 (byte) irq_sprite_ptr#3 (byte) irq_sprite_ptr#11 (byte) irq_sprite_ptr#4 -Alias candidate removed (volatile)(byte) irq::toSpritePtr2_return#0 = (byte) irq::toSpritePtr2_$2#0 (byte) irq::toSpritePtr2_return#2 (byte) irq::toSpritePtr2_return#1 (byte) irq::toSpritePtr2_return#3 (byte~) irq::$2 (byte) irq_sprite_ptr#5 -Self Phi Eliminated (byte) irq_raster_next#1 -Self Phi Eliminated (byte) irq_sprite_ypos#1 -Self Phi Eliminated (byte) irq_sprite_ptr#1 -Self Phi Eliminated (byte) irq_cnt#1 -Self Phi Eliminated (byte) irq_sprite_ypos#13 -Self Phi Eliminated (byte) irq_sprite_ptr#12 -Self Phi Eliminated (byte) irq_cnt#12 -Self Phi Eliminated (byte) irq_raster_next#12 +Alias candidate removed (volatile)(byte) IRQ_RASTER_FIRST#0 = (byte) irq_raster_next#0 (byte) irq_raster_next#16 (byte) irq_raster_next#15 (byte) irq_raster_next#14 (byte) irq_raster_next#13 +Alias candidate removed (volatile)(byte) toSpritePtr1_return#0 = (byte) toSpritePtr1_$2#0 (byte) toSpritePtr1_return#2 (byte) toSpritePtr1_return#1 (byte) toSpritePtr1_return#3 (byte~) $1 (byte) irq_sprite_ptr#0 (byte) irq_sprite_ptr#10 +Alias candidate removed (volatile)(byte) irq::toSpritePtr2_return#0 = (byte) irq::toSpritePtr2_$2#0 (byte) irq::toSpritePtr2_return#2 (byte) irq::toSpritePtr2_return#1 (byte) irq::toSpritePtr2_return#3 (byte~) irq::$2 (byte) irq_sprite_ptr#1 +Self Phi Eliminated (byte) irq_sprite_ypos#5 +Self Phi Eliminated (byte) irq_sprite_ptr#4 +Self Phi Eliminated (byte) irq_cnt#4 +Self Phi Eliminated (byte) irq_raster_next#4 Successful SSA optimization Pass2SelfPhiElimination -Redundant Phi (byte) irq_raster_next#16 (byte) irq_raster_next#21 -Redundant Phi (byte) irq_sprite_ypos#17 (byte) irq_sprite_ypos#2 -Redundant Phi (byte) irq_sprite_ptr#16 (byte) irq_sprite_ptr#20 -Redundant Phi (byte) irq_cnt#15 (byte) irq_cnt#19 -Redundant Phi (byte) irq_raster_next#0 (byte) irq_raster_next#11 -Redundant Phi (byte) irq_sprite_ypos#0 (byte) irq_sprite_ypos#11 -Redundant Phi (byte) irq_sprite_ptr#0 (byte) irq_sprite_ptr#4 -Redundant Phi (byte) irq_cnt#0 (byte) irq_cnt#11 -Redundant Phi (byte) irq_raster_next#1 (byte) irq_raster_next#0 -Redundant Phi (byte) irq_sprite_ypos#1 (byte) irq_sprite_ypos#0 -Redundant Phi (byte) irq_sprite_ptr#1 (byte) irq_sprite_ptr#0 -Redundant Phi (byte) irq_cnt#1 (byte) irq_cnt#0 -Redundant Phi (byte) irq_raster_next#32 (byte) irq_raster_next#2 +Redundant Phi (byte) irq_raster_next#16 (byte) irq_raster_next#0 Redundant Phi (byte) toSpritePtr1_return#2 (byte) toSpritePtr1_return#0 -Redundant Phi (byte) irq_raster_next#28 (byte) irq_raster_next#32 +Redundant Phi (byte) irq_raster_next#15 (byte) irq_raster_next#16 Redundant Phi (byte) toSpritePtr1_return#3 (byte) toSpritePtr1_return#1 -Redundant Phi (byte) irq_raster_next#27 (byte) irq_raster_next#28 -Redundant Phi (byte) init_irq::toSpritePtr2_return#2 (byte) init_irq::toSpritePtr2_return#0 -Redundant Phi (byte) init_irq::toSpritePtr2_return#3 (byte) init_irq::toSpritePtr2_return#1 -Redundant Phi (byte) irq_sprite_ptr#11 (byte) irq_sprite_ptr#3 -Redundant Phi (byte) irq_sprite_ypos#12 (byte) irq_sprite_ypos#2 -Redundant Phi (byte) irq_sprite_ptr#23 (byte) irq_sprite_ptr#20 -Redundant Phi (byte) irq_cnt#22 (byte) irq_cnt#19 -Redundant Phi (byte) irq_raster_next#30 (byte) irq_raster_next#21 -Redundant Phi (byte) irq_sprite_ypos#13 (byte) irq_sprite_ypos#12 -Redundant Phi (byte) irq_sprite_ptr#12 (byte) irq_sprite_ptr#23 -Redundant Phi (byte) irq_cnt#12 (byte) irq_cnt#22 -Redundant Phi (byte) irq_raster_next#12 (byte) irq_raster_next#30 +Redundant Phi (byte) irq_raster_next#14 (byte) irq_raster_next#15 +Redundant Phi (byte) irq_sprite_ypos#4 (byte) irq_sprite_ypos#0 +Redundant Phi (byte) irq_sprite_ptr#9 (byte) irq_sprite_ptr#10 +Redundant Phi (byte) irq_cnt#8 (byte) irq_cnt#0 +Redundant Phi (byte) irq_raster_next#11 (byte) irq_raster_next#13 +Redundant Phi (byte) irq_sprite_ypos#5 (byte) irq_sprite_ypos#4 +Redundant Phi (byte) irq_sprite_ptr#4 (byte) irq_sprite_ptr#9 +Redundant Phi (byte) irq_cnt#4 (byte) irq_cnt#8 +Redundant Phi (byte) irq_raster_next#4 (byte) irq_raster_next#11 Redundant Phi (byte) irq::toSpritePtr2_return#2 (byte) irq::toSpritePtr2_return#0 Redundant Phi (byte) irq::toSpritePtr2_return#3 (byte) irq::toSpritePtr2_return#1 -Redundant Phi (byte) irq_raster_next#21 (byte) irq_raster_next#27 -Redundant Phi (byte) irq_sprite_ptr#20 (byte) irq_sprite_ptr#2 -Redundant Phi (byte) irq_raster_next#15 (byte) irq_raster_next#1 -Redundant Phi (byte) irq_sprite_ypos#16 (byte) irq_sprite_ypos#1 -Redundant Phi (byte) irq_sprite_ptr#15 (byte) irq_sprite_ptr#1 -Redundant Phi (byte) irq_cnt#14 (byte) irq_cnt#1 +Redundant Phi (byte) irq_sprite_ptr#10 (byte) irq_sprite_ptr#0 +Redundant Phi (byte) irq_raster_next#13 (byte) irq_raster_next#14 Successful SSA optimization Pass2RedundantPhiElimination Simple Condition (bool~) init_sprites::$6 if((byte) init_sprites::s#1!=rangelast(0,3)) goto init_sprites::@1 -Simple Condition (bool~) irq::$0 if(*((byte*) RASTER#0)!=(byte) irq_sprite_ypos#2) goto irq::@1 -Simple Condition (bool~) irq::$1 if((byte) irq_cnt#23==(byte/signed byte/word/signed word/dword/signed dword) 10) goto irq::@2 +Simple Condition (bool~) irq::$0 if(*((byte*) RASTER#0)!=(byte) irq_sprite_ypos#0) goto irq::@1 +Simple Condition (bool~) irq::$1 if((byte) irq_cnt#1==(byte/signed byte/word/signed word/dword/signed dword) 10) goto irq::@2 Successful SSA optimization Pass2ConditionalJumpSimplification Constant (const byte*) PROCPORT_DDR#0 = ((byte*))0 Constant (const byte) PROCPORT_DDR_MEMORY_MASK#0 = 7 @@ -1062,7 +869,7 @@ Constant (const byte*) PLAYFIELD_SCREEN#0 = ((byte*))1024 Constant (const byte/signed byte/word/signed word/dword/signed dword) init_sprites::$2 = 14*8 Constant (const byte) init_sprites::s#0 = 0 Constant (const byte) IRQ_RASTER_FIRST#0 = 48 -Constant (const void()*) init_irq::$1 = &irq +Constant (const void()*) init_irq::$0 = &irq Successful SSA optimization Pass2ConstantIdentification Constant (const byte*) PLAYFIELD_SPRITE_PTRS#0 = PLAYFIELD_SCREEN#0+SPRITE_PTRS#0 Constant (const byte*) init_sprites::vicSelectGfxBank1_gfx#0 = PLAYFIELD_SCREEN#0 @@ -1070,43 +877,36 @@ Constant (const byte*) init_sprites::toD0181_screen#0 = PLAYFIELD_SCREEN#0 Constant (const byte*) init_sprites::toD0181_gfx#0 = PLAYFIELD_CHARSET#0 Constant (const byte) init_sprites::xpos#0 = 24+init_sprites::$2 Constant (const word) toSpritePtr1_$0#0 = ((word))PLAYFIELD_SPRITES#0 -Constant (const byte*) init_irq::toSpritePtr2_sprite#0 = PLAYFIELD_SPRITES#0 Constant (const byte*) irq::toSpritePtr2_sprite#0 = PLAYFIELD_SPRITES#0 Successful SSA optimization Pass2ConstantIdentification Constant (const word) init_sprites::vicSelectGfxBank1_toDd001_$0#0 = ((word))init_sprites::vicSelectGfxBank1_gfx#0 Constant (const word) init_sprites::toD0181_$0#0 = ((word))init_sprites::toD0181_screen#0 Constant (const word) init_sprites::toD0181_$4#0 = ((word))init_sprites::toD0181_gfx#0 Constant (const word) toSpritePtr1_$1#0 = toSpritePtr1_$0#0>>6 -Constant (const word) init_irq::toSpritePtr2_$0#0 = ((word))init_irq::toSpritePtr2_sprite#0 Constant (const word) irq::toSpritePtr2_$0#0 = ((word))irq::toSpritePtr2_sprite#0 Successful SSA optimization Pass2ConstantIdentification Constant (const byte) init_sprites::vicSelectGfxBank1_toDd001_$1#0 = >init_sprites::vicSelectGfxBank1_toDd001_$0#0 Constant (const word) init_sprites::toD0181_$1#0 = init_sprites::toD0181_$0#0&16383 Constant (const byte) init_sprites::toD0181_$5#0 = >init_sprites::toD0181_$4#0 Constant (const byte) toSpritePtr1_$2#0 = ((byte))toSpritePtr1_$1#0 -Constant (const word) init_irq::toSpritePtr2_$1#0 = init_irq::toSpritePtr2_$0#0>>6 Constant (const word) irq::toSpritePtr2_$1#0 = irq::toSpritePtr2_$0#0>>6 Successful SSA optimization Pass2ConstantIdentification Constant (const byte) init_sprites::vicSelectGfxBank1_toDd001_$2#0 = init_sprites::vicSelectGfxBank1_toDd001_$1#0>>6 Constant (const word) init_sprites::toD0181_$2#0 = init_sprites::toD0181_$1#0<<2 Constant (const byte) init_sprites::toD0181_$6#0 = init_sprites::toD0181_$5#0>>2 Constant (const byte) toSpritePtr1_return#0 = toSpritePtr1_$2#0 -Constant (const byte) init_irq::toSpritePtr2_$2#0 = ((byte))init_irq::toSpritePtr2_$1#0 Constant (const byte) irq::toSpritePtr2_$2#0 = ((byte))irq::toSpritePtr2_$1#0 Successful SSA optimization Pass2ConstantIdentification Constant (const byte) init_sprites::vicSelectGfxBank1_toDd001_return#0 = 3^init_sprites::vicSelectGfxBank1_toDd001_$2#0 Constant (const byte) init_sprites::toD0181_$3#0 = >init_sprites::toD0181_$2#0 Constant (const byte) init_sprites::toD0181_$7#0 = init_sprites::toD0181_$6#0&15 Constant (const byte) toSpritePtr1_return#1 = toSpritePtr1_return#0 -Constant (const byte) init_irq::toSpritePtr2_return#0 = init_irq::toSpritePtr2_$2#0 Constant (const byte) irq::toSpritePtr2_return#0 = irq::toSpritePtr2_$2#0 Successful SSA optimization Pass2ConstantIdentification Constant (const byte) init_sprites::toD0181_return#0 = init_sprites::toD0181_$3#0|init_sprites::toD0181_$7#0 Constant (const byte) $1 = toSpritePtr1_return#1 -Constant (const byte) init_irq::toSpritePtr2_return#1 = init_irq::toSpritePtr2_return#0 Constant (const byte) irq::toSpritePtr2_return#1 = irq::toSpritePtr2_return#0 Successful SSA optimization Pass2ConstantIdentification -Constant (const byte) init_irq::$0 = init_irq::toSpritePtr2_return#1 Constant (const byte) irq::$2 = irq::toSpritePtr2_return#1 Successful SSA optimization Pass2ConstantIdentification Consolidated array index constant in *(SPRITES_YPOS#0+0) @@ -1126,21 +926,15 @@ Successful SSA optimization Pass2EliminateUnusedBlocks Resolved ranged next value init_sprites::s#1 ← ++ init_sprites::s#2 to ++ Resolved ranged comparison value if(init_sprites::s#1!=rangelast(0,3)) goto init_sprites::@1 to (byte/signed byte/word/signed word/dword/signed dword) 4 Culled Empty Block (label) @4 -Culled Empty Block (label) main::@8 Culled Empty Block (label) main::@1 Culled Empty Block (label) init_sprites::vicSelectGfxBank1_toDd001_@return Culled Empty Block (label) init_sprites::@3 Culled Empty Block (label) init_sprites::toD0181_@return Culled Empty Block (label) toSpritePtr1_@return -Culled Empty Block (label) init_irq::toSpritePtr2_@return Culled Empty Block (label) irq::toSpritePtr2_@return -Culled Empty Block (label) @10 Successful SSA optimization Pass2CullEmptyBlocks -Alias (byte) irq_sprite_ptr#3 = (byte) irq_sprite_ptr#4 -Successful SSA optimization Pass2AliasElimination Inlining constant with var siblings (const byte) init_sprites::s#0 Inlining constant with var siblings (const byte) init_sprites::xpos#0 -Inlining constant with different constant siblings (const byte) init_irq::toSpritePtr2_return#1 Inlining constant with different constant siblings (const byte) irq::toSpritePtr2_return#1 Inlining constant with different constant siblings (const byte) toSpritePtr1_return#1 Constant inlined init_sprites::$2 = (byte/signed byte/word/signed word/dword/signed dword) 14*(byte/signed byte/word/signed word/dword/signed dword) 8 @@ -1153,21 +947,15 @@ Constant inlined init_sprites::toD0181_$3#0 = >((word))(const byte*) PLAYFIELD_S Constant inlined init_sprites::toD0181_$0#0 = ((word))(const byte*) PLAYFIELD_SCREEN#0 Constant inlined init_sprites::toD0181_$1#0 = ((word))(const byte*) PLAYFIELD_SCREEN#0&(word/signed word/dword/signed dword) 16383 Constant inlined $1 = (const byte) toSpritePtr1_return#0 -Constant inlined init_irq::toSpritePtr2_sprite#0 = (const byte*) PLAYFIELD_SPRITES#0 Constant inlined init_sprites::xpos#0 = (byte/signed byte/word/signed word/dword/signed dword) 24+(byte/signed byte/word/signed word/dword/signed dword) 14*(byte/signed byte/word/signed word/dword/signed dword) 8 -Constant inlined init_irq::$0 = (const byte) init_irq::toSpritePtr2_return#0 +Constant inlined init_irq::$0 = &interrupt(KERNEL_MIN)(void()) irq() Constant inlined irq::toSpritePtr2_sprite#0 = (const byte*) PLAYFIELD_SPRITES#0 Constant inlined irq::toSpritePtr2_return#1 = (const byte) irq::toSpritePtr2_return#0 -Constant inlined init_irq::$1 = &interrupt(KERNEL_MIN)(void()) irq() Constant inlined init_sprites::vicSelectGfxBank1_gfx#0 = (const byte*) PLAYFIELD_SCREEN#0 Constant inlined init_sprites::s#0 = (byte/signed byte/word/signed word/dword/signed dword) 0 -Constant inlined init_irq::toSpritePtr2_$2#0 = (const byte) init_irq::toSpritePtr2_return#0 Constant inlined init_sprites::toD0181_gfx#0 = (const byte*) PLAYFIELD_CHARSET#0 -Constant inlined init_irq::toSpritePtr2_$1#0 = ((word))(const byte*) PLAYFIELD_SPRITES#0>>(byte/signed byte/word/signed word/dword/signed dword) 6 Constant inlined init_sprites::vicSelectGfxBank1_toDd001_$1#0 = >((word))(const byte*) PLAYFIELD_SCREEN#0 Constant inlined init_sprites::vicSelectGfxBank1_toDd001_$0#0 = ((word))(const byte*) PLAYFIELD_SCREEN#0 -Constant inlined init_irq::toSpritePtr2_$0#0 = ((word))(const byte*) PLAYFIELD_SPRITES#0 -Constant inlined init_irq::toSpritePtr2_return#1 = (const byte) init_irq::toSpritePtr2_return#0 Constant inlined init_sprites::vicSelectGfxBank1_toDd001_$2#0 = >((word))(const byte*) PLAYFIELD_SCREEN#0>>(byte/signed byte/word/signed word/dword/signed dword) 6 Constant inlined init_sprites::toD0181_screen#0 = (const byte*) PLAYFIELD_SCREEN#0 Constant inlined toSpritePtr1_$1#0 = ((word))(const byte*) PLAYFIELD_SPRITES#0>>(byte/signed byte/word/signed word/dword/signed dword) 6 @@ -1187,7 +975,6 @@ Adding NOP phi() at start of toSpritePtr1 Adding NOP phi() at start of @end Adding NOP phi() at start of main Adding NOP phi() at start of main::@7 -Adding NOP phi() at start of init_irq::toSpritePtr2 Adding NOP phi() at start of init_sprites Adding NOP phi() at start of init_sprites::vicSelectGfxBank1_toDd001 Adding NOP phi() at start of init_sprites::toD0181 @@ -1197,10 +984,10 @@ Calls in [] to main:7 Calls in [main] to init_sprites:10 init_irq:12 Created 3 initial phi equivalence classes -Coalesced [45] init_sprites::s#3 ← init_sprites::s#1 -Coalesced [46] init_sprites::xpos#3 ← init_sprites::xpos#1 -Coalesced [65] irq_raster_next#33 ← irq_raster_next#6 -Coalesced [76] irq_raster_next#34 ← irq_raster_next#20 +Coalesced [40] init_sprites::s#3 ← init_sprites::s#1 +Coalesced [41] init_sprites::xpos#3 ← init_sprites::xpos#1 +Coalesced [60] irq_raster_next#17 ← irq_raster_next#2 +Coalesced [71] irq_raster_next#18 ← irq_raster_next#1 Coalesced down to 3 phi equivalence classes Culled Empty Block (label) init_sprites::@5 Adding NOP phi() at start of @begin @@ -1208,7 +995,6 @@ Adding NOP phi() at start of toSpritePtr1 Adding NOP phi() at start of @end Adding NOP phi() at start of main Adding NOP phi() at start of main::@7 -Adding NOP phi() at start of init_irq::toSpritePtr2 Adding NOP phi() at start of init_sprites Adding NOP phi() at start of init_sprites::vicSelectGfxBank1_toDd001 Adding NOP phi() at start of init_sprites::toD0181 @@ -1219,15 +1005,15 @@ FINAL CONTROL FLOW GRAPH [0] phi() to:@6 @6: scope:[] from @begin - [1] (byte) irq_raster_next#2 ← (const byte) IRQ_RASTER_FIRST#0 - [2] (byte) irq_sprite_ypos#2 ← (byte/signed byte/word/signed word/dword/signed dword) 50 + [1] (byte) irq_raster_next#0 ← (const byte) IRQ_RASTER_FIRST#0 + [2] (byte) irq_sprite_ypos#0 ← (byte/signed byte/word/signed word/dword/signed dword) 50 to:toSpritePtr1 toSpritePtr1: scope:[] from @6 [3] phi() to:@9 @9: scope:[] from toSpritePtr1 - [4] (byte) irq_sprite_ptr#2 ← (const byte) toSpritePtr1_return#0 - [5] (byte) irq_cnt#19 ← (byte/signed byte/word/signed word/dword/signed dword) 0 + [4] (byte) irq_sprite_ptr#0 ← (const byte) toSpritePtr1_return#0 + [5] (byte) irq_cnt#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 to:@8 @8: scope:[] from @9 kickasm(location (const byte*) PLAYFIELD_SPRITES#0) {{ .var sprites = LoadPicture("nes-playfield.png", List().add($010101, $000000)) @@ -1258,106 +1044,97 @@ main::@2: scope:[main] from main::@2 main::@7 [13] *((const byte*) PLAYFIELD_SCREEN#0) ← ++ *((const byte*) PLAYFIELD_SCREEN#0) to:main::@2 init_irq: scope:[init_irq] from main::@7 - [14] (byte) irq_raster_next#11 ← (const byte) IRQ_RASTER_FIRST#0 - [15] (byte) irq_sprite_ypos#11 ← (byte/signed byte/word/signed word/dword/signed dword) 50 - to:init_irq::toSpritePtr2 -init_irq::toSpritePtr2: scope:[init_irq] from init_irq - [16] phi() - to:init_irq::@1 -init_irq::@1: scope:[init_irq] from init_irq::toSpritePtr2 - [17] (byte) irq_sprite_ptr#3 ← (const byte) init_irq::toSpritePtr2_return#0 - [18] (byte) irq_cnt#11 ← (byte/signed byte/word/signed word/dword/signed dword) 0 asm { sei } - [20] *((const byte*) CIA1_INTERRUPT#0) ← (const byte) CIA_INTERRUPT_CLEAR#0 - [21] *((const byte*) VIC_CONTROL#0) ← *((const byte*) VIC_CONTROL#0) & (byte/signed byte/word/signed word/dword/signed dword) 127 - [22] *((const byte*) RASTER#0) ← (const byte) IRQ_RASTER_FIRST#0 - [23] *((const byte*) IRQ_ENABLE#0) ← (const byte) IRQ_RASTER#0 - [24] *((const void()**) KERNEL_IRQ#0) ← &interrupt(KERNEL_MIN)(void()) irq() + [15] *((const byte*) CIA1_INTERRUPT#0) ← (const byte) CIA_INTERRUPT_CLEAR#0 + [16] *((const byte*) VIC_CONTROL#0) ← *((const byte*) VIC_CONTROL#0) & (byte/signed byte/word/signed word/dword/signed dword) 127 + [17] *((const byte*) RASTER#0) ← (const byte) IRQ_RASTER_FIRST#0 + [18] *((const byte*) IRQ_ENABLE#0) ← (const byte) IRQ_RASTER#0 + [19] *((const void()**) KERNEL_IRQ#0) ← &interrupt(KERNEL_MIN)(void()) irq() asm { cli } to:init_irq::@return -init_irq::@return: scope:[init_irq] from init_irq::@1 - [26] return +init_irq::@return: scope:[init_irq] from init_irq + [21] return to:@return init_sprites: scope:[init_sprites] from main - [27] phi() + [22] phi() to:init_sprites::vicSelectGfxBank1 init_sprites::vicSelectGfxBank1: scope:[init_sprites] from init_sprites - [28] *((const byte*) CIA2_PORT_A_DDR#0) ← (byte/signed byte/word/signed word/dword/signed dword) 3 + [23] *((const byte*) CIA2_PORT_A_DDR#0) ← (byte/signed byte/word/signed word/dword/signed dword) 3 to:init_sprites::vicSelectGfxBank1_toDd001 init_sprites::vicSelectGfxBank1_toDd001: scope:[init_sprites] from init_sprites::vicSelectGfxBank1 - [29] phi() + [24] phi() to:init_sprites::vicSelectGfxBank1_@1 init_sprites::vicSelectGfxBank1_@1: scope:[init_sprites] from init_sprites::vicSelectGfxBank1_toDd001 - [30] *((const byte*) CIA2_PORT_A#0) ← (const byte) init_sprites::vicSelectGfxBank1_toDd001_return#0 + [25] *((const byte*) CIA2_PORT_A#0) ← (const byte) init_sprites::vicSelectGfxBank1_toDd001_return#0 to:init_sprites::toD0181 init_sprites::toD0181: scope:[init_sprites] from init_sprites::vicSelectGfxBank1_@1 - [31] phi() + [26] phi() to:init_sprites::@4 init_sprites::@4: scope:[init_sprites] from init_sprites::toD0181 - [32] *((const byte*) D018#0) ← (const byte) init_sprites::toD0181_return#0 - [33] *((const byte*) SPRITES_ENABLE#0) ← (byte/signed byte/word/signed word/dword/signed dword) 15 - [34] *((const byte*) SPRITES_MC#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 - [35] *((const byte*) SPRITES_EXPAND_Y#0) ← *((const byte*) SPRITES_MC#0) - [36] *((const byte*) SPRITES_EXPAND_X#0) ← *((const byte*) SPRITES_EXPAND_Y#0) + [27] *((const byte*) D018#0) ← (const byte) init_sprites::toD0181_return#0 + [28] *((const byte*) SPRITES_ENABLE#0) ← (byte/signed byte/word/signed word/dword/signed dword) 15 + [29] *((const byte*) SPRITES_MC#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 + [30] *((const byte*) SPRITES_EXPAND_Y#0) ← *((const byte*) SPRITES_MC#0) + [31] *((const byte*) SPRITES_EXPAND_X#0) ← *((const byte*) SPRITES_EXPAND_Y#0) to:init_sprites::@1 init_sprites::@1: scope:[init_sprites] from init_sprites::@1 init_sprites::@4 - [37] (byte) init_sprites::xpos#2 ← phi( init_sprites::@1/(byte) init_sprites::xpos#1 init_sprites::@4/(byte/signed byte/word/signed word/dword/signed dword) 24+(byte/signed byte/word/signed word/dword/signed dword) 14*(byte/signed byte/word/signed word/dword/signed dword) 8 ) - [37] (byte) init_sprites::s#2 ← phi( init_sprites::@1/(byte) init_sprites::s#1 init_sprites::@4/(byte/signed byte/word/signed word/dword/signed dword) 0 ) - [38] (byte) init_sprites::s2#0 ← (byte) init_sprites::s#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 - [39] *((const byte*) SPRITES_XPOS#0 + (byte) init_sprites::s2#0) ← (byte) init_sprites::xpos#2 - [40] *((const byte*) SPRITES_COLS#0 + (byte) init_sprites::s#2) ← (const byte) BLACK#0 - [41] (byte) init_sprites::xpos#1 ← (byte) init_sprites::xpos#2 + (byte/signed byte/word/signed word/dword/signed dword) 24 - [42] (byte) init_sprites::s#1 ← ++ (byte) init_sprites::s#2 - [43] if((byte) init_sprites::s#1!=(byte/signed byte/word/signed word/dword/signed dword) 4) goto init_sprites::@1 + [32] (byte) init_sprites::xpos#2 ← phi( init_sprites::@1/(byte) init_sprites::xpos#1 init_sprites::@4/(byte/signed byte/word/signed word/dword/signed dword) 24+(byte/signed byte/word/signed word/dword/signed dword) 14*(byte/signed byte/word/signed word/dword/signed dword) 8 ) + [32] (byte) init_sprites::s#2 ← phi( init_sprites::@1/(byte) init_sprites::s#1 init_sprites::@4/(byte/signed byte/word/signed word/dword/signed dword) 0 ) + [33] (byte) init_sprites::s2#0 ← (byte) init_sprites::s#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 + [34] *((const byte*) SPRITES_XPOS#0 + (byte) init_sprites::s2#0) ← (byte) init_sprites::xpos#2 + [35] *((const byte*) SPRITES_COLS#0 + (byte) init_sprites::s#2) ← (const byte) BLACK#0 + [36] (byte) init_sprites::xpos#1 ← (byte) init_sprites::xpos#2 + (byte/signed byte/word/signed word/dword/signed dword) 24 + [37] (byte) init_sprites::s#1 ← ++ (byte) init_sprites::s#2 + [38] if((byte) init_sprites::s#1!=(byte/signed byte/word/signed word/dword/signed dword) 4) goto init_sprites::@1 to:init_sprites::@return init_sprites::@return: scope:[init_sprites] from init_sprites::@1 - [44] return + [39] return to:@return irq: scope:[irq] from - [45] *((const byte*) BORDERCOL#0) ← (const byte) DARK_GREY#0 - [46] *((const byte*) SPRITES_YPOS#0) ← (byte) irq_sprite_ypos#2 - [47] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte) irq_sprite_ypos#2 - [48] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 4) ← (byte) irq_sprite_ypos#2 - [49] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 6) ← (byte) irq_sprite_ypos#2 + [40] *((const byte*) BORDERCOL#0) ← (const byte) DARK_GREY#0 + [41] *((const byte*) SPRITES_YPOS#0) ← (byte) irq_sprite_ypos#0 + [42] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte) irq_sprite_ypos#0 + [43] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 4) ← (byte) irq_sprite_ypos#0 + [44] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 6) ← (byte) irq_sprite_ypos#0 to:irq::@1 irq::@1: scope:[irq] from irq irq::@1 - [50] if(*((const byte*) RASTER#0)!=(byte) irq_sprite_ypos#2) goto irq::@1 + [45] if(*((const byte*) RASTER#0)!=(byte) irq_sprite_ypos#0) goto irq::@1 to:irq::@4 irq::@4: scope:[irq] from irq::@1 - [51] (byte) irq::ptr#0 ← (byte) irq_sprite_ptr#2 - [52] *((const byte*) PLAYFIELD_SPRITE_PTRS#0) ← (byte) irq::ptr#0 - [53] (byte) irq::ptr#1 ← ++ (byte) irq::ptr#0 - [54] *((const byte*) PLAYFIELD_SPRITE_PTRS#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte) irq::ptr#1 - [55] *((const byte*) PLAYFIELD_SPRITE_PTRS#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte) irq::ptr#1 - [56] (byte) irq::ptr#2 ← ++ (byte) irq::ptr#1 - [57] *((const byte*) PLAYFIELD_SPRITE_PTRS#0+(byte/signed byte/word/signed word/dword/signed dword) 3) ← (byte) irq::ptr#2 - [58] (byte) irq_cnt#23 ← ++ (byte) irq_cnt#19 - [59] if((byte) irq_cnt#23==(byte/signed byte/word/signed word/dword/signed dword) 10) goto irq::@2 + [46] (byte) irq::ptr#0 ← (byte) irq_sprite_ptr#0 + [47] *((const byte*) PLAYFIELD_SPRITE_PTRS#0) ← (byte) irq::ptr#0 + [48] (byte) irq::ptr#1 ← ++ (byte) irq::ptr#0 + [49] *((const byte*) PLAYFIELD_SPRITE_PTRS#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte) irq::ptr#1 + [50] *((const byte*) PLAYFIELD_SPRITE_PTRS#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte) irq::ptr#1 + [51] (byte) irq::ptr#2 ← ++ (byte) irq::ptr#1 + [52] *((const byte*) PLAYFIELD_SPRITE_PTRS#0+(byte/signed byte/word/signed word/dword/signed dword) 3) ← (byte) irq::ptr#2 + [53] (byte) irq_cnt#1 ← ++ (byte) irq_cnt#0 + [54] if((byte) irq_cnt#1==(byte/signed byte/word/signed word/dword/signed dword) 10) goto irq::@2 to:irq::@5 irq::@5: scope:[irq] from irq::@4 - [60] (byte) irq_raster_next#6 ← (byte) irq_raster_next#2 + (byte/signed byte/word/signed word/dword/signed dword) 21 - [61] (byte) irq_sprite_ypos#6 ← (byte) irq_sprite_ypos#2 + (byte/signed byte/word/signed word/dword/signed dword) 21 - [62] (byte) irq_sprite_ptr#6 ← (byte) irq_sprite_ptr#2 + (byte/signed byte/word/signed word/dword/signed dword) 3 + [55] (byte) irq_raster_next#2 ← (byte) irq_raster_next#0 + (byte/signed byte/word/signed word/dword/signed dword) 21 + [56] (byte) irq_sprite_ypos#2 ← (byte) irq_sprite_ypos#0 + (byte/signed byte/word/signed word/dword/signed dword) 21 + [57] (byte) irq_sprite_ptr#2 ← (byte) irq_sprite_ptr#0 + (byte/signed byte/word/signed word/dword/signed dword) 3 to:irq::@3 irq::@3: scope:[irq] from irq::@5 irq::@7 - [63] (byte) irq_raster_next#13 ← phi( irq::@5/(byte) irq_raster_next#6 irq::@7/(byte) irq_raster_next#20 ) - [64] *((const byte*) RASTER#0) ← (byte) irq_raster_next#13 - [65] *((const byte*) IRQ_STATUS#0) ← (const byte) IRQ_RASTER#0 - [66] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 + [58] (byte) irq_raster_next#3 ← phi( irq::@5/(byte) irq_raster_next#2 irq::@7/(byte) irq_raster_next#1 ) + [59] *((const byte*) RASTER#0) ← (byte) irq_raster_next#3 + [60] *((const byte*) IRQ_STATUS#0) ← (const byte) IRQ_RASTER#0 + [61] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 to:irq::@return irq::@return: scope:[irq] from irq::@3 - [67] return + [62] return to:@return irq::@2: scope:[irq] from irq::@4 - [68] (byte) irq_cnt#24 ← (byte/signed byte/word/signed word/dword/signed dword) 0 - [69] (byte) irq_raster_next#20 ← (const byte) IRQ_RASTER_FIRST#0 - [70] (byte) irq_sprite_ypos#26 ← (byte/signed byte/word/signed word/dword/signed dword) 50 + [63] (byte) irq_cnt#10 ← (byte/signed byte/word/signed word/dword/signed dword) 0 + [64] (byte) irq_raster_next#1 ← (const byte) IRQ_RASTER_FIRST#0 + [65] (byte) irq_sprite_ypos#1 ← (byte/signed byte/word/signed word/dword/signed dword) 50 to:irq::toSpritePtr2 irq::toSpritePtr2: scope:[irq] from irq::@2 - [71] phi() + [66] phi() to:irq::@7 irq::@7: scope:[irq] from irq::toSpritePtr2 - [72] (byte) irq_sprite_ptr#5 ← (const byte) irq::toSpritePtr2_return#0 + [67] (byte) irq_sprite_ptr#1 ← (const byte) irq::toSpritePtr2_return#0 to:irq::@3 @@ -1447,11 +1224,6 @@ VARIABLE REGISTER WEIGHTS (byte) WHITE (byte) YELLOW (void()) init_irq() -(word~) init_irq::toSpritePtr2_$0 -(word~) init_irq::toSpritePtr2_$1 -(byte~) init_irq::toSpritePtr2_$2 -(byte) init_irq::toSpritePtr2_return -(byte*) init_irq::toSpritePtr2_sprite (void()) init_sprites() (byte) init_sprites::s (byte) init_sprites::s#1 16.5 @@ -1492,26 +1264,22 @@ interrupt(KERNEL_MIN)(void()) irq() (byte) irq::toSpritePtr2_return (byte*) irq::toSpritePtr2_sprite (byte) irq_cnt -(byte) irq_cnt#11 20.0 -(byte) irq_cnt#19 0.3076923076923077 -(byte) irq_cnt#23 4.0 -(byte) irq_cnt#24 20.0 +(byte) irq_cnt#0 0.3076923076923077 +(byte) irq_cnt#1 4.0 +(byte) irq_cnt#10 20.0 (byte) irq_raster_next -(byte) irq_raster_next#11 20.0 -(byte) irq_raster_next#13 6.0 -(byte) irq_raster_next#2 0.26666666666666666 -(byte) irq_raster_next#20 1.0 -(byte) irq_raster_next#6 1.3333333333333333 +(byte) irq_raster_next#0 0.26666666666666666 +(byte) irq_raster_next#1 1.0 +(byte) irq_raster_next#2 1.3333333333333333 +(byte) irq_raster_next#3 6.0 (byte) irq_sprite_ptr -(byte) irq_sprite_ptr#2 0.3529411764705882 -(byte) irq_sprite_ptr#3 20.0 -(byte) irq_sprite_ptr#5 20.0 -(byte) irq_sprite_ptr#6 20.0 +(byte) irq_sprite_ptr#0 0.3529411764705882 +(byte) irq_sprite_ptr#1 20.0 +(byte) irq_sprite_ptr#2 20.0 (byte) irq_sprite_ypos -(byte) irq_sprite_ypos#11 20.0 -(byte) irq_sprite_ypos#2 1.4375 -(byte) irq_sprite_ypos#26 20.0 -(byte) irq_sprite_ypos#6 20.0 +(byte) irq_sprite_ypos#0 1.4375 +(byte) irq_sprite_ypos#1 20.0 +(byte) irq_sprite_ypos#2 20.0 (void()) main() (word~) toSpritePtr1_$0 (word~) toSpritePtr1_$1 @@ -1522,73 +1290,61 @@ interrupt(KERNEL_MIN)(void()) irq() Initial phi equivalence classes [ init_sprites::s#2 init_sprites::s#1 ] [ init_sprites::xpos#2 init_sprites::xpos#1 ] -[ irq_raster_next#13 irq_raster_next#6 irq_raster_next#20 ] -Added variable irq_raster_next#2 to zero page equivalence class [ irq_raster_next#2 ] -Added variable irq_sprite_ypos#2 to zero page equivalence class [ irq_sprite_ypos#2 ] -Added variable irq_sprite_ptr#2 to zero page equivalence class [ irq_sprite_ptr#2 ] -Added variable irq_cnt#19 to zero page equivalence class [ irq_cnt#19 ] -Added variable irq_raster_next#11 to zero page equivalence class [ irq_raster_next#11 ] -Added variable irq_sprite_ypos#11 to zero page equivalence class [ irq_sprite_ypos#11 ] -Added variable irq_sprite_ptr#3 to zero page equivalence class [ irq_sprite_ptr#3 ] -Added variable irq_cnt#11 to zero page equivalence class [ irq_cnt#11 ] +[ irq_raster_next#3 irq_raster_next#2 irq_raster_next#1 ] +Added variable irq_raster_next#0 to zero page equivalence class [ irq_raster_next#0 ] +Added variable irq_sprite_ypos#0 to zero page equivalence class [ irq_sprite_ypos#0 ] +Added variable irq_sprite_ptr#0 to zero page equivalence class [ irq_sprite_ptr#0 ] +Added variable irq_cnt#0 to zero page equivalence class [ irq_cnt#0 ] Added variable init_sprites::s2#0 to zero page equivalence class [ init_sprites::s2#0 ] Added variable irq::ptr#0 to zero page equivalence class [ irq::ptr#0 ] Added variable irq::ptr#1 to zero page equivalence class [ irq::ptr#1 ] Added variable irq::ptr#2 to zero page equivalence class [ irq::ptr#2 ] -Added variable irq_cnt#23 to zero page equivalence class [ irq_cnt#23 ] -Added variable irq_sprite_ypos#6 to zero page equivalence class [ irq_sprite_ypos#6 ] -Added variable irq_sprite_ptr#6 to zero page equivalence class [ irq_sprite_ptr#6 ] -Added variable irq_cnt#24 to zero page equivalence class [ irq_cnt#24 ] -Added variable irq_sprite_ypos#26 to zero page equivalence class [ irq_sprite_ypos#26 ] -Added variable irq_sprite_ptr#5 to zero page equivalence class [ irq_sprite_ptr#5 ] +Added variable irq_cnt#1 to zero page equivalence class [ irq_cnt#1 ] +Added variable irq_sprite_ypos#2 to zero page equivalence class [ irq_sprite_ypos#2 ] +Added variable irq_sprite_ptr#2 to zero page equivalence class [ irq_sprite_ptr#2 ] +Added variable irq_cnt#10 to zero page equivalence class [ irq_cnt#10 ] +Added variable irq_sprite_ypos#1 to zero page equivalence class [ irq_sprite_ypos#1 ] +Added variable irq_sprite_ptr#1 to zero page equivalence class [ irq_sprite_ptr#1 ] Complete equivalence classes [ init_sprites::s#2 init_sprites::s#1 ] [ init_sprites::xpos#2 init_sprites::xpos#1 ] -[ irq_raster_next#13 irq_raster_next#6 irq_raster_next#20 ] -[ irq_raster_next#2 ] -[ irq_sprite_ypos#2 ] -[ irq_sprite_ptr#2 ] -[ irq_cnt#19 ] -[ irq_raster_next#11 ] -[ irq_sprite_ypos#11 ] -[ irq_sprite_ptr#3 ] -[ irq_cnt#11 ] +[ irq_raster_next#3 irq_raster_next#2 irq_raster_next#1 ] +[ irq_raster_next#0 ] +[ irq_sprite_ypos#0 ] +[ irq_sprite_ptr#0 ] +[ irq_cnt#0 ] [ init_sprites::s2#0 ] [ irq::ptr#0 ] [ irq::ptr#1 ] [ irq::ptr#2 ] -[ irq_cnt#23 ] -[ irq_sprite_ypos#6 ] -[ irq_sprite_ptr#6 ] -[ irq_cnt#24 ] -[ irq_sprite_ypos#26 ] -[ irq_sprite_ptr#5 ] +[ irq_cnt#1 ] +[ irq_sprite_ypos#2 ] +[ irq_sprite_ptr#2 ] +[ irq_cnt#10 ] +[ irq_sprite_ypos#1 ] +[ irq_sprite_ptr#1 ] Allocated zp ZP_BYTE:2 [ init_sprites::s#2 init_sprites::s#1 ] Allocated zp ZP_BYTE:3 [ init_sprites::xpos#2 init_sprites::xpos#1 ] -Allocated zp ZP_BYTE:4 [ irq_raster_next#13 irq_raster_next#6 irq_raster_next#20 ] -Allocated zp ZP_BYTE:5 [ irq_raster_next#2 ] -Allocated zp ZP_BYTE:6 [ irq_sprite_ypos#2 ] -Allocated zp ZP_BYTE:7 [ irq_sprite_ptr#2 ] -Allocated zp ZP_BYTE:8 [ irq_cnt#19 ] -Allocated zp ZP_BYTE:9 [ irq_raster_next#11 ] -Allocated zp ZP_BYTE:10 [ irq_sprite_ypos#11 ] -Allocated zp ZP_BYTE:11 [ irq_sprite_ptr#3 ] -Allocated zp ZP_BYTE:12 [ irq_cnt#11 ] -Allocated zp ZP_BYTE:13 [ init_sprites::s2#0 ] -Allocated zp ZP_BYTE:14 [ irq::ptr#0 ] -Allocated zp ZP_BYTE:15 [ irq::ptr#1 ] -Allocated zp ZP_BYTE:16 [ irq::ptr#2 ] -Allocated zp ZP_BYTE:17 [ irq_cnt#23 ] -Allocated zp ZP_BYTE:18 [ irq_sprite_ypos#6 ] -Allocated zp ZP_BYTE:19 [ irq_sprite_ptr#6 ] -Allocated zp ZP_BYTE:20 [ irq_cnt#24 ] -Allocated zp ZP_BYTE:21 [ irq_sprite_ypos#26 ] -Allocated zp ZP_BYTE:22 [ irq_sprite_ptr#5 ] +Allocated zp ZP_BYTE:4 [ irq_raster_next#3 irq_raster_next#2 irq_raster_next#1 ] +Allocated zp ZP_BYTE:5 [ irq_raster_next#0 ] +Allocated zp ZP_BYTE:6 [ irq_sprite_ypos#0 ] +Allocated zp ZP_BYTE:7 [ irq_sprite_ptr#0 ] +Allocated zp ZP_BYTE:8 [ irq_cnt#0 ] +Allocated zp ZP_BYTE:9 [ init_sprites::s2#0 ] +Allocated zp ZP_BYTE:10 [ irq::ptr#0 ] +Allocated zp ZP_BYTE:11 [ irq::ptr#1 ] +Allocated zp ZP_BYTE:12 [ irq::ptr#2 ] +Allocated zp ZP_BYTE:13 [ irq_cnt#1 ] +Allocated zp ZP_BYTE:14 [ irq_sprite_ypos#2 ] +Allocated zp ZP_BYTE:15 [ irq_sprite_ptr#2 ] +Allocated zp ZP_BYTE:16 [ irq_cnt#10 ] +Allocated zp ZP_BYTE:17 [ irq_sprite_ypos#1 ] +Allocated zp ZP_BYTE:18 [ irq_sprite_ptr#1 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .const SPRITE_PTRS = $3f8 @@ -1622,29 +1378,25 @@ INITIAL ASM .label irq_raster_next = 5 .label irq_sprite_ypos = 6 .label irq_sprite_ptr = 7 - .label irq_sprite_ptr_3 = $b - .label irq_sprite_ptr_5 = $16 - .label irq_raster_next_6 = 4 - .label irq_sprite_ypos_6 = $12 - .label irq_sprite_ptr_6 = $13 - .label irq_raster_next_11 = 9 - .label irq_sprite_ypos_11 = $a - .label irq_cnt = $c - .label irq_raster_next_13 = 4 - .label irq_raster_next_20 = 4 - .label irq_cnt_19 = 8 - .label irq_cnt_23 = $11 - .label irq_cnt_24 = $14 - .label irq_sprite_ypos_26 = $15 + .label irq_cnt = 8 + .label irq_cnt_1 = $d + .label irq_raster_next_1 = 4 + .label irq_sprite_ypos_1 = $11 + .label irq_sprite_ptr_1 = $12 + .label irq_raster_next_2 = 4 + .label irq_sprite_ypos_2 = $e + .label irq_sprite_ptr_2 = $f + .label irq_raster_next_3 = 4 + .label irq_cnt_10 = $10 //SEG2 @begin bbegin: jmp b6 //SEG3 @6 b6: -//SEG4 [1] (byte) irq_raster_next#2 ← (const byte) IRQ_RASTER_FIRST#0 -- vbuz1=vbuc1 +//SEG4 [1] (byte) irq_raster_next#0 ← (const byte) IRQ_RASTER_FIRST#0 -- vbuz1=vbuc1 lda #IRQ_RASTER_FIRST sta irq_raster_next -//SEG5 [2] (byte) irq_sprite_ypos#2 ← (byte/signed byte/word/signed word/dword/signed dword) 50 -- vbuz1=vbuc1 +//SEG5 [2] (byte) irq_sprite_ypos#0 ← (byte/signed byte/word/signed word/dword/signed dword) 50 -- vbuz1=vbuc1 lda #$32 sta irq_sprite_ypos //SEG6 [3] phi from @6 to toSpritePtr1 [phi:@6->toSpritePtr1] @@ -1655,12 +1407,12 @@ toSpritePtr1: jmp b9 //SEG8 @9 b9: -//SEG9 [4] (byte) irq_sprite_ptr#2 ← (const byte) toSpritePtr1_return#0 -- vbuz1=vbuc1 +//SEG9 [4] (byte) irq_sprite_ptr#0 ← (const byte) toSpritePtr1_return#0 -- vbuz1=vbuc1 lda #toSpritePtr1_return sta irq_sprite_ptr -//SEG10 [5] (byte) irq_cnt#19 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1 +//SEG10 [5] (byte) irq_cnt#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1 lda #0 - sta irq_cnt_19 + sta irq_cnt jmp b8 //SEG11 @8 b8: @@ -1677,7 +1429,7 @@ bend: //SEG17 main main: { //SEG18 [10] call init_sprites - //SEG19 [27] phi from main to init_sprites [phi:main->init_sprites] + //SEG19 [22] phi from main to init_sprites [phi:main->init_sprites] init_sprites_from_main: jsr init_sprites //SEG20 [11] phi from main to main::@7 [phi:main->main::@7] @@ -1696,271 +1448,250 @@ main: { } //SEG25 init_irq init_irq: { - .const toSpritePtr2_return = PLAYFIELD_SPRITES>>6 - //SEG26 [14] (byte) irq_raster_next#11 ← (const byte) IRQ_RASTER_FIRST#0 -- vbuz1=vbuc1 - lda #IRQ_RASTER_FIRST - sta irq_raster_next_11 - //SEG27 [15] (byte) irq_sprite_ypos#11 ← (byte/signed byte/word/signed word/dword/signed dword) 50 -- vbuz1=vbuc1 - lda #$32 - sta irq_sprite_ypos_11 - //SEG28 [16] phi from init_irq to init_irq::toSpritePtr2 [phi:init_irq->init_irq::toSpritePtr2] - toSpritePtr2_from_init_irq: - jmp toSpritePtr2 - //SEG29 init_irq::toSpritePtr2 - toSpritePtr2: - jmp b1 - //SEG30 init_irq::@1 - b1: - //SEG31 [17] (byte) irq_sprite_ptr#3 ← (const byte) init_irq::toSpritePtr2_return#0 -- vbuz1=vbuc1 - lda #toSpritePtr2_return - sta irq_sprite_ptr_3 - //SEG32 [18] (byte) irq_cnt#11 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1 - lda #0 - sta irq_cnt - //SEG33 asm { sei } + //SEG26 asm { sei } sei - //SEG34 [20] *((const byte*) CIA1_INTERRUPT#0) ← (const byte) CIA_INTERRUPT_CLEAR#0 -- _deref_pbuc1=vbuc2 + //SEG27 [15] *((const byte*) CIA1_INTERRUPT#0) ← (const byte) CIA_INTERRUPT_CLEAR#0 -- _deref_pbuc1=vbuc2 lda #CIA_INTERRUPT_CLEAR sta CIA1_INTERRUPT - //SEG35 [21] *((const byte*) VIC_CONTROL#0) ← *((const byte*) VIC_CONTROL#0) & (byte/signed byte/word/signed word/dword/signed dword) 127 -- _deref_pbuc1=_deref_pbuc1_band_vbuc2 + //SEG28 [16] *((const byte*) VIC_CONTROL#0) ← *((const byte*) VIC_CONTROL#0) & (byte/signed byte/word/signed word/dword/signed dword) 127 -- _deref_pbuc1=_deref_pbuc1_band_vbuc2 lda VIC_CONTROL and #$7f sta VIC_CONTROL - //SEG36 [22] *((const byte*) RASTER#0) ← (const byte) IRQ_RASTER_FIRST#0 -- _deref_pbuc1=vbuc2 + //SEG29 [17] *((const byte*) RASTER#0) ← (const byte) IRQ_RASTER_FIRST#0 -- _deref_pbuc1=vbuc2 lda #IRQ_RASTER_FIRST sta RASTER - //SEG37 [23] *((const byte*) IRQ_ENABLE#0) ← (const byte) IRQ_RASTER#0 -- _deref_pbuc1=vbuc2 + //SEG30 [18] *((const byte*) IRQ_ENABLE#0) ← (const byte) IRQ_RASTER#0 -- _deref_pbuc1=vbuc2 lda #IRQ_RASTER sta IRQ_ENABLE - //SEG38 [24] *((const void()**) KERNEL_IRQ#0) ← &interrupt(KERNEL_MIN)(void()) irq() -- _deref_pptc1=pprc2 + //SEG31 [19] *((const void()**) KERNEL_IRQ#0) ← &interrupt(KERNEL_MIN)(void()) irq() -- _deref_pptc1=pprc2 lda #irq sta KERNEL_IRQ+1 - //SEG39 asm { cli } + //SEG32 asm { cli } cli jmp breturn - //SEG40 init_irq::@return + //SEG33 init_irq::@return breturn: - //SEG41 [26] return + //SEG34 [21] return rts } -//SEG42 init_sprites +//SEG35 init_sprites init_sprites: { .const vicSelectGfxBank1_toDd001_return = 3^(>PLAYFIELD_SCREEN)>>6 .const toD0181_return = (>(PLAYFIELD_SCREEN&$3fff)<<2)|(>PLAYFIELD_CHARSET)>>2&$f - .label s2 = $d + .label s2 = 9 .label xpos = 3 .label s = 2 jmp vicSelectGfxBank1 - //SEG43 init_sprites::vicSelectGfxBank1 + //SEG36 init_sprites::vicSelectGfxBank1 vicSelectGfxBank1: - //SEG44 [28] *((const byte*) CIA2_PORT_A_DDR#0) ← (byte/signed byte/word/signed word/dword/signed dword) 3 -- _deref_pbuc1=vbuc2 + //SEG37 [23] *((const byte*) CIA2_PORT_A_DDR#0) ← (byte/signed byte/word/signed word/dword/signed dword) 3 -- _deref_pbuc1=vbuc2 lda #3 sta CIA2_PORT_A_DDR - //SEG45 [29] phi from init_sprites::vicSelectGfxBank1 to init_sprites::vicSelectGfxBank1_toDd001 [phi:init_sprites::vicSelectGfxBank1->init_sprites::vicSelectGfxBank1_toDd001] + //SEG38 [24] phi from init_sprites::vicSelectGfxBank1 to init_sprites::vicSelectGfxBank1_toDd001 [phi:init_sprites::vicSelectGfxBank1->init_sprites::vicSelectGfxBank1_toDd001] vicSelectGfxBank1_toDd001_from_vicSelectGfxBank1: jmp vicSelectGfxBank1_toDd001 - //SEG46 init_sprites::vicSelectGfxBank1_toDd001 + //SEG39 init_sprites::vicSelectGfxBank1_toDd001 vicSelectGfxBank1_toDd001: jmp vicSelectGfxBank1_b1 - //SEG47 init_sprites::vicSelectGfxBank1_@1 + //SEG40 init_sprites::vicSelectGfxBank1_@1 vicSelectGfxBank1_b1: - //SEG48 [30] *((const byte*) CIA2_PORT_A#0) ← (const byte) init_sprites::vicSelectGfxBank1_toDd001_return#0 -- _deref_pbuc1=vbuc2 + //SEG41 [25] *((const byte*) CIA2_PORT_A#0) ← (const byte) init_sprites::vicSelectGfxBank1_toDd001_return#0 -- _deref_pbuc1=vbuc2 lda #vicSelectGfxBank1_toDd001_return sta CIA2_PORT_A - //SEG49 [31] phi from init_sprites::vicSelectGfxBank1_@1 to init_sprites::toD0181 [phi:init_sprites::vicSelectGfxBank1_@1->init_sprites::toD0181] + //SEG42 [26] phi from init_sprites::vicSelectGfxBank1_@1 to init_sprites::toD0181 [phi:init_sprites::vicSelectGfxBank1_@1->init_sprites::toD0181] toD0181_from_vicSelectGfxBank1_b1: jmp toD0181 - //SEG50 init_sprites::toD0181 + //SEG43 init_sprites::toD0181 toD0181: jmp b4 - //SEG51 init_sprites::@4 + //SEG44 init_sprites::@4 b4: - //SEG52 [32] *((const byte*) D018#0) ← (const byte) init_sprites::toD0181_return#0 -- _deref_pbuc1=vbuc2 + //SEG45 [27] *((const byte*) D018#0) ← (const byte) init_sprites::toD0181_return#0 -- _deref_pbuc1=vbuc2 lda #toD0181_return sta D018 - //SEG53 [33] *((const byte*) SPRITES_ENABLE#0) ← (byte/signed byte/word/signed word/dword/signed dword) 15 -- _deref_pbuc1=vbuc2 + //SEG46 [28] *((const byte*) SPRITES_ENABLE#0) ← (byte/signed byte/word/signed word/dword/signed dword) 15 -- _deref_pbuc1=vbuc2 lda #$f sta SPRITES_ENABLE - //SEG54 [34] *((const byte*) SPRITES_MC#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2 + //SEG47 [29] *((const byte*) SPRITES_MC#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2 lda #0 sta SPRITES_MC - //SEG55 [35] *((const byte*) SPRITES_EXPAND_Y#0) ← *((const byte*) SPRITES_MC#0) -- _deref_pbuc1=_deref_pbuc2 + //SEG48 [30] *((const byte*) SPRITES_EXPAND_Y#0) ← *((const byte*) SPRITES_MC#0) -- _deref_pbuc1=_deref_pbuc2 lda SPRITES_MC sta SPRITES_EXPAND_Y - //SEG56 [36] *((const byte*) SPRITES_EXPAND_X#0) ← *((const byte*) SPRITES_EXPAND_Y#0) -- _deref_pbuc1=_deref_pbuc2 + //SEG49 [31] *((const byte*) SPRITES_EXPAND_X#0) ← *((const byte*) SPRITES_EXPAND_Y#0) -- _deref_pbuc1=_deref_pbuc2 lda SPRITES_EXPAND_Y sta SPRITES_EXPAND_X - //SEG57 [37] phi from init_sprites::@4 to init_sprites::@1 [phi:init_sprites::@4->init_sprites::@1] + //SEG50 [32] phi from init_sprites::@4 to init_sprites::@1 [phi:init_sprites::@4->init_sprites::@1] b1_from_b4: - //SEG58 [37] phi (byte) init_sprites::xpos#2 = (byte/signed byte/word/signed word/dword/signed dword) 24+(byte/signed byte/word/signed word/dword/signed dword) 14*(byte/signed byte/word/signed word/dword/signed dword) 8 [phi:init_sprites::@4->init_sprites::@1#0] -- vbuz1=vbuc1 + //SEG51 [32] phi (byte) init_sprites::xpos#2 = (byte/signed byte/word/signed word/dword/signed dword) 24+(byte/signed byte/word/signed word/dword/signed dword) 14*(byte/signed byte/word/signed word/dword/signed dword) 8 [phi:init_sprites::@4->init_sprites::@1#0] -- vbuz1=vbuc1 lda #$18+$e*8 sta xpos - //SEG59 [37] phi (byte) init_sprites::s#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:init_sprites::@4->init_sprites::@1#1] -- vbuz1=vbuc1 + //SEG52 [32] phi (byte) init_sprites::s#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:init_sprites::@4->init_sprites::@1#1] -- vbuz1=vbuc1 lda #0 sta s jmp b1 - //SEG60 [37] phi from init_sprites::@1 to init_sprites::@1 [phi:init_sprites::@1->init_sprites::@1] + //SEG53 [32] phi from init_sprites::@1 to init_sprites::@1 [phi:init_sprites::@1->init_sprites::@1] b1_from_b1: - //SEG61 [37] phi (byte) init_sprites::xpos#2 = (byte) init_sprites::xpos#1 [phi:init_sprites::@1->init_sprites::@1#0] -- register_copy - //SEG62 [37] phi (byte) init_sprites::s#2 = (byte) init_sprites::s#1 [phi:init_sprites::@1->init_sprites::@1#1] -- register_copy + //SEG54 [32] phi (byte) init_sprites::xpos#2 = (byte) init_sprites::xpos#1 [phi:init_sprites::@1->init_sprites::@1#0] -- register_copy + //SEG55 [32] phi (byte) init_sprites::s#2 = (byte) init_sprites::s#1 [phi:init_sprites::@1->init_sprites::@1#1] -- register_copy jmp b1 - //SEG63 init_sprites::@1 + //SEG56 init_sprites::@1 b1: - //SEG64 [38] (byte) init_sprites::s2#0 ← (byte) init_sprites::s#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz2_rol_1 + //SEG57 [33] (byte) init_sprites::s2#0 ← (byte) init_sprites::s#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz2_rol_1 lda s asl sta s2 - //SEG65 [39] *((const byte*) SPRITES_XPOS#0 + (byte) init_sprites::s2#0) ← (byte) init_sprites::xpos#2 -- pbuc1_derefidx_vbuz1=vbuz2 + //SEG58 [34] *((const byte*) SPRITES_XPOS#0 + (byte) init_sprites::s2#0) ← (byte) init_sprites::xpos#2 -- pbuc1_derefidx_vbuz1=vbuz2 lda xpos ldy s2 sta SPRITES_XPOS,y - //SEG66 [40] *((const byte*) SPRITES_COLS#0 + (byte) init_sprites::s#2) ← (const byte) BLACK#0 -- pbuc1_derefidx_vbuz1=vbuc2 + //SEG59 [35] *((const byte*) SPRITES_COLS#0 + (byte) init_sprites::s#2) ← (const byte) BLACK#0 -- pbuc1_derefidx_vbuz1=vbuc2 ldy s lda #BLACK sta SPRITES_COLS,y - //SEG67 [41] (byte) init_sprites::xpos#1 ← (byte) init_sprites::xpos#2 + (byte/signed byte/word/signed word/dword/signed dword) 24 -- vbuz1=vbuz1_plus_vbuc1 + //SEG60 [36] (byte) init_sprites::xpos#1 ← (byte) init_sprites::xpos#2 + (byte/signed byte/word/signed word/dword/signed dword) 24 -- vbuz1=vbuz1_plus_vbuc1 lda #$18 clc adc xpos sta xpos - //SEG68 [42] (byte) init_sprites::s#1 ← ++ (byte) init_sprites::s#2 -- vbuz1=_inc_vbuz1 + //SEG61 [37] (byte) init_sprites::s#1 ← ++ (byte) init_sprites::s#2 -- vbuz1=_inc_vbuz1 inc s - //SEG69 [43] if((byte) init_sprites::s#1!=(byte/signed byte/word/signed word/dword/signed dword) 4) goto init_sprites::@1 -- vbuz1_neq_vbuc1_then_la1 + //SEG62 [38] if((byte) init_sprites::s#1!=(byte/signed byte/word/signed word/dword/signed dword) 4) goto init_sprites::@1 -- vbuz1_neq_vbuc1_then_la1 lda s cmp #4 bne b1_from_b1 jmp breturn - //SEG70 init_sprites::@return + //SEG63 init_sprites::@return breturn: - //SEG71 [44] return + //SEG64 [39] return rts } -//SEG72 irq +//SEG65 irq irq: { .const toSpritePtr2_return = PLAYFIELD_SPRITES>>6 - .label ptr = $e - .label ptr_1 = $f - .label ptr_2 = $10 - //SEG73 entry interrupt(KERNEL_MIN) - //SEG74 [45] *((const byte*) BORDERCOL#0) ← (const byte) DARK_GREY#0 -- _deref_pbuc1=vbuc2 + .label ptr = $a + .label ptr_1 = $b + .label ptr_2 = $c + //SEG66 entry interrupt(KERNEL_MIN) + //SEG67 [40] *((const byte*) BORDERCOL#0) ← (const byte) DARK_GREY#0 -- _deref_pbuc1=vbuc2 lda #DARK_GREY sta BORDERCOL - //SEG75 [46] *((const byte*) SPRITES_YPOS#0) ← (byte) irq_sprite_ypos#2 -- _deref_pbuc1=vbuz1 + //SEG68 [41] *((const byte*) SPRITES_YPOS#0) ← (byte) irq_sprite_ypos#0 -- _deref_pbuc1=vbuz1 lda irq_sprite_ypos sta SPRITES_YPOS - //SEG76 [47] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte) irq_sprite_ypos#2 -- _deref_pbuc1=vbuz1 + //SEG69 [42] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte) irq_sprite_ypos#0 -- _deref_pbuc1=vbuz1 lda irq_sprite_ypos sta SPRITES_YPOS+2 - //SEG77 [48] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 4) ← (byte) irq_sprite_ypos#2 -- _deref_pbuc1=vbuz1 + //SEG70 [43] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 4) ← (byte) irq_sprite_ypos#0 -- _deref_pbuc1=vbuz1 lda irq_sprite_ypos sta SPRITES_YPOS+4 - //SEG78 [49] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 6) ← (byte) irq_sprite_ypos#2 -- _deref_pbuc1=vbuz1 + //SEG71 [44] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 6) ← (byte) irq_sprite_ypos#0 -- _deref_pbuc1=vbuz1 lda irq_sprite_ypos sta SPRITES_YPOS+6 jmp b1 - //SEG79 irq::@1 + //SEG72 irq::@1 b1: - //SEG80 [50] if(*((const byte*) RASTER#0)!=(byte) irq_sprite_ypos#2) goto irq::@1 -- _deref_pbuc1_neq_vbuz1_then_la1 + //SEG73 [45] if(*((const byte*) RASTER#0)!=(byte) irq_sprite_ypos#0) goto irq::@1 -- _deref_pbuc1_neq_vbuz1_then_la1 lda RASTER cmp irq_sprite_ypos bne b1 jmp b4 - //SEG81 irq::@4 + //SEG74 irq::@4 b4: - //SEG82 [51] (byte) irq::ptr#0 ← (byte) irq_sprite_ptr#2 -- vbuz1=vbuz2 + //SEG75 [46] (byte) irq::ptr#0 ← (byte) irq_sprite_ptr#0 -- vbuz1=vbuz2 lda irq_sprite_ptr sta ptr - //SEG83 [52] *((const byte*) PLAYFIELD_SPRITE_PTRS#0) ← (byte) irq::ptr#0 -- _deref_pbuc1=vbuz1 + //SEG76 [47] *((const byte*) PLAYFIELD_SPRITE_PTRS#0) ← (byte) irq::ptr#0 -- _deref_pbuc1=vbuz1 lda ptr sta PLAYFIELD_SPRITE_PTRS - //SEG84 [53] (byte) irq::ptr#1 ← ++ (byte) irq::ptr#0 -- vbuz1=_inc_vbuz2 + //SEG77 [48] (byte) irq::ptr#1 ← ++ (byte) irq::ptr#0 -- vbuz1=_inc_vbuz2 ldy ptr iny sty ptr_1 - //SEG85 [54] *((const byte*) PLAYFIELD_SPRITE_PTRS#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte) irq::ptr#1 -- _deref_pbuc1=vbuz1 + //SEG78 [49] *((const byte*) PLAYFIELD_SPRITE_PTRS#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte) irq::ptr#1 -- _deref_pbuc1=vbuz1 lda ptr_1 sta PLAYFIELD_SPRITE_PTRS+1 - //SEG86 [55] *((const byte*) PLAYFIELD_SPRITE_PTRS#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte) irq::ptr#1 -- _deref_pbuc1=vbuz1 + //SEG79 [50] *((const byte*) PLAYFIELD_SPRITE_PTRS#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte) irq::ptr#1 -- _deref_pbuc1=vbuz1 lda ptr_1 sta PLAYFIELD_SPRITE_PTRS+2 - //SEG87 [56] (byte) irq::ptr#2 ← ++ (byte) irq::ptr#1 -- vbuz1=_inc_vbuz2 + //SEG80 [51] (byte) irq::ptr#2 ← ++ (byte) irq::ptr#1 -- vbuz1=_inc_vbuz2 ldy ptr_1 iny sty ptr_2 - //SEG88 [57] *((const byte*) PLAYFIELD_SPRITE_PTRS#0+(byte/signed byte/word/signed word/dword/signed dword) 3) ← (byte) irq::ptr#2 -- _deref_pbuc1=vbuz1 + //SEG81 [52] *((const byte*) PLAYFIELD_SPRITE_PTRS#0+(byte/signed byte/word/signed word/dword/signed dword) 3) ← (byte) irq::ptr#2 -- _deref_pbuc1=vbuz1 lda ptr_2 sta PLAYFIELD_SPRITE_PTRS+3 - //SEG89 [58] (byte) irq_cnt#23 ← ++ (byte) irq_cnt#19 -- vbuz1=_inc_vbuz2 - ldy irq_cnt_19 + //SEG82 [53] (byte) irq_cnt#1 ← ++ (byte) irq_cnt#0 -- vbuz1=_inc_vbuz2 + ldy irq_cnt iny - sty irq_cnt_23 - //SEG90 [59] if((byte) irq_cnt#23==(byte/signed byte/word/signed word/dword/signed dword) 10) goto irq::@2 -- vbuz1_eq_vbuc1_then_la1 - lda irq_cnt_23 + sty irq_cnt_1 + //SEG83 [54] if((byte) irq_cnt#1==(byte/signed byte/word/signed word/dword/signed dword) 10) goto irq::@2 -- vbuz1_eq_vbuc1_then_la1 + lda irq_cnt_1 cmp #$a beq b2 jmp b5 - //SEG91 irq::@5 + //SEG84 irq::@5 b5: - //SEG92 [60] (byte) irq_raster_next#6 ← (byte) irq_raster_next#2 + (byte/signed byte/word/signed word/dword/signed dword) 21 -- vbuz1=vbuz2_plus_vbuc1 + //SEG85 [55] (byte) irq_raster_next#2 ← (byte) irq_raster_next#0 + (byte/signed byte/word/signed word/dword/signed dword) 21 -- vbuz1=vbuz2_plus_vbuc1 lda #$15 clc adc irq_raster_next - sta irq_raster_next_6 - //SEG93 [61] (byte) irq_sprite_ypos#6 ← (byte) irq_sprite_ypos#2 + (byte/signed byte/word/signed word/dword/signed dword) 21 -- vbuz1=vbuz2_plus_vbuc1 + sta irq_raster_next_2 + //SEG86 [56] (byte) irq_sprite_ypos#2 ← (byte) irq_sprite_ypos#0 + (byte/signed byte/word/signed word/dword/signed dword) 21 -- vbuz1=vbuz2_plus_vbuc1 lda #$15 clc adc irq_sprite_ypos - sta irq_sprite_ypos_6 - //SEG94 [62] (byte) irq_sprite_ptr#6 ← (byte) irq_sprite_ptr#2 + (byte/signed byte/word/signed word/dword/signed dword) 3 -- vbuz1=vbuz2_plus_vbuc1 + sta irq_sprite_ypos_2 + //SEG87 [57] (byte) irq_sprite_ptr#2 ← (byte) irq_sprite_ptr#0 + (byte/signed byte/word/signed word/dword/signed dword) 3 -- vbuz1=vbuz2_plus_vbuc1 lda #3 clc adc irq_sprite_ptr - sta irq_sprite_ptr_6 - //SEG95 [63] phi from irq::@5 irq::@7 to irq::@3 [phi:irq::@5/irq::@7->irq::@3] + sta irq_sprite_ptr_2 + //SEG88 [58] phi from irq::@5 irq::@7 to irq::@3 [phi:irq::@5/irq::@7->irq::@3] b3_from_b5: b3_from_b7: - //SEG96 [63] phi (byte) irq_raster_next#13 = (byte) irq_raster_next#6 [phi:irq::@5/irq::@7->irq::@3#0] -- register_copy + //SEG89 [58] phi (byte) irq_raster_next#3 = (byte) irq_raster_next#2 [phi:irq::@5/irq::@7->irq::@3#0] -- register_copy jmp b3 - //SEG97 irq::@3 + //SEG90 irq::@3 b3: - //SEG98 [64] *((const byte*) RASTER#0) ← (byte) irq_raster_next#13 -- _deref_pbuc1=vbuz1 - lda irq_raster_next_13 + //SEG91 [59] *((const byte*) RASTER#0) ← (byte) irq_raster_next#3 -- _deref_pbuc1=vbuz1 + lda irq_raster_next_3 sta RASTER - //SEG99 [65] *((const byte*) IRQ_STATUS#0) ← (const byte) IRQ_RASTER#0 -- _deref_pbuc1=vbuc2 + //SEG92 [60] *((const byte*) IRQ_STATUS#0) ← (const byte) IRQ_RASTER#0 -- _deref_pbuc1=vbuc2 lda #IRQ_RASTER sta IRQ_STATUS - //SEG100 [66] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 -- _deref_pbuc1=vbuc2 + //SEG93 [61] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 -- _deref_pbuc1=vbuc2 lda #BLACK sta BORDERCOL jmp breturn - //SEG101 irq::@return + //SEG94 irq::@return breturn: - //SEG102 [67] return - exit interrupt(KERNEL_MIN) + //SEG95 [62] return - exit interrupt(KERNEL_MIN) jmp $ea81 - //SEG103 irq::@2 + //SEG96 irq::@2 b2: - //SEG104 [68] (byte) irq_cnt#24 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1 + //SEG97 [63] (byte) irq_cnt#10 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1 lda #0 - sta irq_cnt_24 - //SEG105 [69] (byte) irq_raster_next#20 ← (const byte) IRQ_RASTER_FIRST#0 -- vbuz1=vbuc1 + sta irq_cnt_10 + //SEG98 [64] (byte) irq_raster_next#1 ← (const byte) IRQ_RASTER_FIRST#0 -- vbuz1=vbuc1 lda #IRQ_RASTER_FIRST - sta irq_raster_next_20 - //SEG106 [70] (byte) irq_sprite_ypos#26 ← (byte/signed byte/word/signed word/dword/signed dword) 50 -- vbuz1=vbuc1 + sta irq_raster_next_1 + //SEG99 [65] (byte) irq_sprite_ypos#1 ← (byte/signed byte/word/signed word/dword/signed dword) 50 -- vbuz1=vbuc1 lda #$32 - sta irq_sprite_ypos_26 - //SEG107 [71] phi from irq::@2 to irq::toSpritePtr2 [phi:irq::@2->irq::toSpritePtr2] + sta irq_sprite_ypos_1 + //SEG100 [66] phi from irq::@2 to irq::toSpritePtr2 [phi:irq::@2->irq::toSpritePtr2] toSpritePtr2_from_b2: jmp toSpritePtr2 - //SEG108 irq::toSpritePtr2 + //SEG101 irq::toSpritePtr2 toSpritePtr2: jmp b7 - //SEG109 irq::@7 + //SEG102 irq::@7 b7: - //SEG110 [72] (byte) irq_sprite_ptr#5 ← (const byte) irq::toSpritePtr2_return#0 -- vbuz1=vbuc1 + //SEG103 [67] (byte) irq_sprite_ptr#1 ← (const byte) irq::toSpritePtr2_return#0 -- vbuz1=vbuc1 lda #toSpritePtr2_return - sta irq_sprite_ptr_5 + sta irq_sprite_ptr_1 jmp b3_from_b7 } .pc = PLAYFIELD_SPRITES "Inline" @@ -1978,179 +1709,155 @@ irq: { REGISTER UPLIFT POTENTIAL REGISTERS -Statement [1] (byte) irq_raster_next#2 ← (const byte) IRQ_RASTER_FIRST#0 [ ] ( ) always clobbers reg byte a -Statement [2] (byte) irq_sprite_ypos#2 ← (byte/signed byte/word/signed word/dword/signed dword) 50 [ ] ( ) always clobbers reg byte a -Statement [4] (byte) irq_sprite_ptr#2 ← (const byte) toSpritePtr1_return#0 [ ] ( ) always clobbers reg byte a -Statement [5] (byte) irq_cnt#19 ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( ) always clobbers reg byte a -Statement [14] (byte) irq_raster_next#11 ← (const byte) IRQ_RASTER_FIRST#0 [ ] ( main:7::init_irq:12 [ ] ) always clobbers reg byte a -Statement [15] (byte) irq_sprite_ypos#11 ← (byte/signed byte/word/signed word/dword/signed dword) 50 [ ] ( main:7::init_irq:12 [ ] ) always clobbers reg byte a -Statement [17] (byte) irq_sprite_ptr#3 ← (const byte) init_irq::toSpritePtr2_return#0 [ ] ( main:7::init_irq:12 [ ] ) always clobbers reg byte a -Statement [18] (byte) irq_cnt#11 ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( main:7::init_irq:12 [ ] ) always clobbers reg byte a -Statement [20] *((const byte*) CIA1_INTERRUPT#0) ← (const byte) CIA_INTERRUPT_CLEAR#0 [ ] ( main:7::init_irq:12 [ ] ) always clobbers reg byte a -Statement [21] *((const byte*) VIC_CONTROL#0) ← *((const byte*) VIC_CONTROL#0) & (byte/signed byte/word/signed word/dword/signed dword) 127 [ ] ( main:7::init_irq:12 [ ] ) always clobbers reg byte a -Statement [22] *((const byte*) RASTER#0) ← (const byte) IRQ_RASTER_FIRST#0 [ ] ( main:7::init_irq:12 [ ] ) always clobbers reg byte a -Statement [23] *((const byte*) IRQ_ENABLE#0) ← (const byte) IRQ_RASTER#0 [ ] ( main:7::init_irq:12 [ ] ) always clobbers reg byte a -Statement [24] *((const void()**) KERNEL_IRQ#0) ← &interrupt(KERNEL_MIN)(void()) irq() [ ] ( main:7::init_irq:12 [ ] ) always clobbers reg byte a -Statement [28] *((const byte*) CIA2_PORT_A_DDR#0) ← (byte/signed byte/word/signed word/dword/signed dword) 3 [ ] ( main:7::init_sprites:10 [ ] ) always clobbers reg byte a -Statement [30] *((const byte*) CIA2_PORT_A#0) ← (const byte) init_sprites::vicSelectGfxBank1_toDd001_return#0 [ ] ( main:7::init_sprites:10 [ ] ) always clobbers reg byte a -Statement [32] *((const byte*) D018#0) ← (const byte) init_sprites::toD0181_return#0 [ ] ( main:7::init_sprites:10 [ ] ) always clobbers reg byte a -Statement [33] *((const byte*) SPRITES_ENABLE#0) ← (byte/signed byte/word/signed word/dword/signed dword) 15 [ ] ( main:7::init_sprites:10 [ ] ) always clobbers reg byte a -Statement [34] *((const byte*) SPRITES_MC#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( main:7::init_sprites:10 [ ] ) always clobbers reg byte a -Statement [35] *((const byte*) SPRITES_EXPAND_Y#0) ← *((const byte*) SPRITES_MC#0) [ ] ( main:7::init_sprites:10 [ ] ) always clobbers reg byte a -Statement [36] *((const byte*) SPRITES_EXPAND_X#0) ← *((const byte*) SPRITES_EXPAND_Y#0) [ ] ( main:7::init_sprites:10 [ ] ) always clobbers reg byte a -Statement [38] (byte) init_sprites::s2#0 ← (byte) init_sprites::s#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 [ init_sprites::s#2 init_sprites::xpos#2 init_sprites::s2#0 ] ( main:7::init_sprites:10 [ init_sprites::s#2 init_sprites::xpos#2 init_sprites::s2#0 ] ) always clobbers reg byte a +Statement [1] (byte) irq_raster_next#0 ← (const byte) IRQ_RASTER_FIRST#0 [ ] ( ) always clobbers reg byte a +Statement [2] (byte) irq_sprite_ypos#0 ← (byte/signed byte/word/signed word/dword/signed dword) 50 [ ] ( ) always clobbers reg byte a +Statement [4] (byte) irq_sprite_ptr#0 ← (const byte) toSpritePtr1_return#0 [ ] ( ) always clobbers reg byte a +Statement [5] (byte) irq_cnt#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( ) always clobbers reg byte a +Statement [15] *((const byte*) CIA1_INTERRUPT#0) ← (const byte) CIA_INTERRUPT_CLEAR#0 [ ] ( main:7::init_irq:12 [ ] ) always clobbers reg byte a +Statement [16] *((const byte*) VIC_CONTROL#0) ← *((const byte*) VIC_CONTROL#0) & (byte/signed byte/word/signed word/dword/signed dword) 127 [ ] ( main:7::init_irq:12 [ ] ) always clobbers reg byte a +Statement [17] *((const byte*) RASTER#0) ← (const byte) IRQ_RASTER_FIRST#0 [ ] ( main:7::init_irq:12 [ ] ) always clobbers reg byte a +Statement [18] *((const byte*) IRQ_ENABLE#0) ← (const byte) IRQ_RASTER#0 [ ] ( main:7::init_irq:12 [ ] ) always clobbers reg byte a +Statement [19] *((const void()**) KERNEL_IRQ#0) ← &interrupt(KERNEL_MIN)(void()) irq() [ ] ( main:7::init_irq:12 [ ] ) always clobbers reg byte a +Statement [23] *((const byte*) CIA2_PORT_A_DDR#0) ← (byte/signed byte/word/signed word/dword/signed dword) 3 [ ] ( main:7::init_sprites:10 [ ] ) always clobbers reg byte a +Statement [25] *((const byte*) CIA2_PORT_A#0) ← (const byte) init_sprites::vicSelectGfxBank1_toDd001_return#0 [ ] ( main:7::init_sprites:10 [ ] ) always clobbers reg byte a +Statement [27] *((const byte*) D018#0) ← (const byte) init_sprites::toD0181_return#0 [ ] ( main:7::init_sprites:10 [ ] ) always clobbers reg byte a +Statement [28] *((const byte*) SPRITES_ENABLE#0) ← (byte/signed byte/word/signed word/dword/signed dword) 15 [ ] ( main:7::init_sprites:10 [ ] ) always clobbers reg byte a +Statement [29] *((const byte*) SPRITES_MC#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( main:7::init_sprites:10 [ ] ) always clobbers reg byte a +Statement [30] *((const byte*) SPRITES_EXPAND_Y#0) ← *((const byte*) SPRITES_MC#0) [ ] ( main:7::init_sprites:10 [ ] ) always clobbers reg byte a +Statement [31] *((const byte*) SPRITES_EXPAND_X#0) ← *((const byte*) SPRITES_EXPAND_Y#0) [ ] ( main:7::init_sprites:10 [ ] ) always clobbers reg byte a +Statement [33] (byte) init_sprites::s2#0 ← (byte) init_sprites::s#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 [ init_sprites::s#2 init_sprites::xpos#2 init_sprites::s2#0 ] ( main:7::init_sprites:10 [ init_sprites::s#2 init_sprites::xpos#2 init_sprites::s2#0 ] ) always clobbers reg byte a Removing always clobbered register reg byte a as potential for zp ZP_BYTE:2 [ init_sprites::s#2 init_sprites::s#1 ] Removing always clobbered register reg byte a as potential for zp ZP_BYTE:3 [ init_sprites::xpos#2 init_sprites::xpos#1 ] -Statement [39] *((const byte*) SPRITES_XPOS#0 + (byte) init_sprites::s2#0) ← (byte) init_sprites::xpos#2 [ init_sprites::s#2 init_sprites::xpos#2 ] ( main:7::init_sprites:10 [ init_sprites::s#2 init_sprites::xpos#2 ] ) always clobbers reg byte a -Statement [40] *((const byte*) SPRITES_COLS#0 + (byte) init_sprites::s#2) ← (const byte) BLACK#0 [ init_sprites::s#2 init_sprites::xpos#2 ] ( main:7::init_sprites:10 [ init_sprites::s#2 init_sprites::xpos#2 ] ) always clobbers reg byte a -Statement [41] (byte) init_sprites::xpos#1 ← (byte) init_sprites::xpos#2 + (byte/signed byte/word/signed word/dword/signed dword) 24 [ init_sprites::s#2 init_sprites::xpos#1 ] ( main:7::init_sprites:10 [ init_sprites::s#2 init_sprites::xpos#1 ] ) always clobbers reg byte a -Statement [45] *((const byte*) BORDERCOL#0) ← (const byte) DARK_GREY#0 [ irq_raster_next#2 irq_sprite_ypos#2 irq_sprite_ptr#2 irq_cnt#19 ] ( ) always clobbers reg byte a -Statement [46] *((const byte*) SPRITES_YPOS#0) ← (byte) irq_sprite_ypos#2 [ irq_raster_next#2 irq_sprite_ypos#2 irq_sprite_ptr#2 irq_cnt#19 ] ( ) always clobbers reg byte a -Statement [47] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte) irq_sprite_ypos#2 [ irq_raster_next#2 irq_sprite_ypos#2 irq_sprite_ptr#2 irq_cnt#19 ] ( ) always clobbers reg byte a -Statement [48] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 4) ← (byte) irq_sprite_ypos#2 [ irq_raster_next#2 irq_sprite_ypos#2 irq_sprite_ptr#2 irq_cnt#19 ] ( ) always clobbers reg byte a -Statement [49] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 6) ← (byte) irq_sprite_ypos#2 [ irq_raster_next#2 irq_sprite_ypos#2 irq_sprite_ptr#2 irq_cnt#19 ] ( ) always clobbers reg byte a -Statement [50] if(*((const byte*) RASTER#0)!=(byte) irq_sprite_ypos#2) goto irq::@1 [ irq_raster_next#2 irq_sprite_ypos#2 irq_sprite_ptr#2 irq_cnt#19 ] ( ) always clobbers reg byte a -Statement [58] (byte) irq_cnt#23 ← ++ (byte) irq_cnt#19 [ irq_raster_next#2 irq_sprite_ypos#2 irq_sprite_ptr#2 irq_cnt#23 ] ( ) always clobbers reg byte y -Statement [59] if((byte) irq_cnt#23==(byte/signed byte/word/signed word/dword/signed dword) 10) goto irq::@2 [ irq_raster_next#2 irq_sprite_ypos#2 irq_sprite_ptr#2 ] ( ) always clobbers reg byte a -Statement [60] (byte) irq_raster_next#6 ← (byte) irq_raster_next#2 + (byte/signed byte/word/signed word/dword/signed dword) 21 [ irq_sprite_ypos#2 irq_sprite_ptr#2 irq_raster_next#6 ] ( ) always clobbers reg byte a -Statement [61] (byte) irq_sprite_ypos#6 ← (byte) irq_sprite_ypos#2 + (byte/signed byte/word/signed word/dword/signed dword) 21 [ irq_sprite_ptr#2 irq_raster_next#6 ] ( ) always clobbers reg byte a -Statement [62] (byte) irq_sprite_ptr#6 ← (byte) irq_sprite_ptr#2 + (byte/signed byte/word/signed word/dword/signed dword) 3 [ irq_raster_next#6 ] ( ) always clobbers reg byte a -Statement [64] *((const byte*) RASTER#0) ← (byte) irq_raster_next#13 [ ] ( ) always clobbers reg byte a -Statement [65] *((const byte*) IRQ_STATUS#0) ← (const byte) IRQ_RASTER#0 [ ] ( ) always clobbers reg byte a -Statement [66] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 [ ] ( ) always clobbers reg byte a -Statement [68] (byte) irq_cnt#24 ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( ) always clobbers reg byte a -Statement [69] (byte) irq_raster_next#20 ← (const byte) IRQ_RASTER_FIRST#0 [ irq_raster_next#20 ] ( ) always clobbers reg byte a -Statement [70] (byte) irq_sprite_ypos#26 ← (byte/signed byte/word/signed word/dword/signed dword) 50 [ irq_raster_next#20 ] ( ) always clobbers reg byte a -Statement [72] (byte) irq_sprite_ptr#5 ← (const byte) irq::toSpritePtr2_return#0 [ irq_raster_next#20 ] ( ) always clobbers reg byte a -Statement [1] (byte) irq_raster_next#2 ← (const byte) IRQ_RASTER_FIRST#0 [ ] ( ) always clobbers reg byte a -Statement [2] (byte) irq_sprite_ypos#2 ← (byte/signed byte/word/signed word/dword/signed dword) 50 [ ] ( ) always clobbers reg byte a -Statement [4] (byte) irq_sprite_ptr#2 ← (const byte) toSpritePtr1_return#0 [ ] ( ) always clobbers reg byte a -Statement [5] (byte) irq_cnt#19 ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( ) always clobbers reg byte a -Statement [14] (byte) irq_raster_next#11 ← (const byte) IRQ_RASTER_FIRST#0 [ ] ( main:7::init_irq:12 [ ] ) always clobbers reg byte a -Statement [15] (byte) irq_sprite_ypos#11 ← (byte/signed byte/word/signed word/dword/signed dword) 50 [ ] ( main:7::init_irq:12 [ ] ) always clobbers reg byte a -Statement [17] (byte) irq_sprite_ptr#3 ← (const byte) init_irq::toSpritePtr2_return#0 [ ] ( main:7::init_irq:12 [ ] ) always clobbers reg byte a -Statement [18] (byte) irq_cnt#11 ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( main:7::init_irq:12 [ ] ) always clobbers reg byte a -Statement [20] *((const byte*) CIA1_INTERRUPT#0) ← (const byte) CIA_INTERRUPT_CLEAR#0 [ ] ( main:7::init_irq:12 [ ] ) always clobbers reg byte a -Statement [21] *((const byte*) VIC_CONTROL#0) ← *((const byte*) VIC_CONTROL#0) & (byte/signed byte/word/signed word/dword/signed dword) 127 [ ] ( main:7::init_irq:12 [ ] ) always clobbers reg byte a -Statement [22] *((const byte*) RASTER#0) ← (const byte) IRQ_RASTER_FIRST#0 [ ] ( main:7::init_irq:12 [ ] ) always clobbers reg byte a -Statement [23] *((const byte*) IRQ_ENABLE#0) ← (const byte) IRQ_RASTER#0 [ ] ( main:7::init_irq:12 [ ] ) always clobbers reg byte a -Statement [24] *((const void()**) KERNEL_IRQ#0) ← &interrupt(KERNEL_MIN)(void()) irq() [ ] ( main:7::init_irq:12 [ ] ) always clobbers reg byte a -Statement [28] *((const byte*) CIA2_PORT_A_DDR#0) ← (byte/signed byte/word/signed word/dword/signed dword) 3 [ ] ( main:7::init_sprites:10 [ ] ) always clobbers reg byte a -Statement [30] *((const byte*) CIA2_PORT_A#0) ← (const byte) init_sprites::vicSelectGfxBank1_toDd001_return#0 [ ] ( main:7::init_sprites:10 [ ] ) always clobbers reg byte a -Statement [32] *((const byte*) D018#0) ← (const byte) init_sprites::toD0181_return#0 [ ] ( main:7::init_sprites:10 [ ] ) always clobbers reg byte a -Statement [33] *((const byte*) SPRITES_ENABLE#0) ← (byte/signed byte/word/signed word/dword/signed dword) 15 [ ] ( main:7::init_sprites:10 [ ] ) always clobbers reg byte a -Statement [34] *((const byte*) SPRITES_MC#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( main:7::init_sprites:10 [ ] ) always clobbers reg byte a -Statement [35] *((const byte*) SPRITES_EXPAND_Y#0) ← *((const byte*) SPRITES_MC#0) [ ] ( main:7::init_sprites:10 [ ] ) always clobbers reg byte a -Statement [36] *((const byte*) SPRITES_EXPAND_X#0) ← *((const byte*) SPRITES_EXPAND_Y#0) [ ] ( main:7::init_sprites:10 [ ] ) always clobbers reg byte a -Statement [38] (byte) init_sprites::s2#0 ← (byte) init_sprites::s#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 [ init_sprites::s#2 init_sprites::xpos#2 init_sprites::s2#0 ] ( main:7::init_sprites:10 [ init_sprites::s#2 init_sprites::xpos#2 init_sprites::s2#0 ] ) always clobbers reg byte a -Statement [39] *((const byte*) SPRITES_XPOS#0 + (byte) init_sprites::s2#0) ← (byte) init_sprites::xpos#2 [ init_sprites::s#2 init_sprites::xpos#2 ] ( main:7::init_sprites:10 [ init_sprites::s#2 init_sprites::xpos#2 ] ) always clobbers reg byte a -Statement [40] *((const byte*) SPRITES_COLS#0 + (byte) init_sprites::s#2) ← (const byte) BLACK#0 [ init_sprites::s#2 init_sprites::xpos#2 ] ( main:7::init_sprites:10 [ init_sprites::s#2 init_sprites::xpos#2 ] ) always clobbers reg byte a -Statement [41] (byte) init_sprites::xpos#1 ← (byte) init_sprites::xpos#2 + (byte/signed byte/word/signed word/dword/signed dword) 24 [ init_sprites::s#2 init_sprites::xpos#1 ] ( main:7::init_sprites:10 [ init_sprites::s#2 init_sprites::xpos#1 ] ) always clobbers reg byte a -Statement [45] *((const byte*) BORDERCOL#0) ← (const byte) DARK_GREY#0 [ irq_raster_next#2 irq_sprite_ypos#2 irq_sprite_ptr#2 irq_cnt#19 ] ( ) always clobbers reg byte a -Statement [46] *((const byte*) SPRITES_YPOS#0) ← (byte) irq_sprite_ypos#2 [ irq_raster_next#2 irq_sprite_ypos#2 irq_sprite_ptr#2 irq_cnt#19 ] ( ) always clobbers reg byte a -Statement [47] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte) irq_sprite_ypos#2 [ irq_raster_next#2 irq_sprite_ypos#2 irq_sprite_ptr#2 irq_cnt#19 ] ( ) always clobbers reg byte a -Statement [48] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 4) ← (byte) irq_sprite_ypos#2 [ irq_raster_next#2 irq_sprite_ypos#2 irq_sprite_ptr#2 irq_cnt#19 ] ( ) always clobbers reg byte a -Statement [49] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 6) ← (byte) irq_sprite_ypos#2 [ irq_raster_next#2 irq_sprite_ypos#2 irq_sprite_ptr#2 irq_cnt#19 ] ( ) always clobbers reg byte a -Statement [50] if(*((const byte*) RASTER#0)!=(byte) irq_sprite_ypos#2) goto irq::@1 [ irq_raster_next#2 irq_sprite_ypos#2 irq_sprite_ptr#2 irq_cnt#19 ] ( ) always clobbers reg byte a -Statement [58] (byte) irq_cnt#23 ← ++ (byte) irq_cnt#19 [ irq_raster_next#2 irq_sprite_ypos#2 irq_sprite_ptr#2 irq_cnt#23 ] ( ) always clobbers reg byte y -Statement [59] if((byte) irq_cnt#23==(byte/signed byte/word/signed word/dword/signed dword) 10) goto irq::@2 [ irq_raster_next#2 irq_sprite_ypos#2 irq_sprite_ptr#2 ] ( ) always clobbers reg byte a -Statement [60] (byte) irq_raster_next#6 ← (byte) irq_raster_next#2 + (byte/signed byte/word/signed word/dword/signed dword) 21 [ irq_sprite_ypos#2 irq_sprite_ptr#2 irq_raster_next#6 ] ( ) always clobbers reg byte a -Statement [61] (byte) irq_sprite_ypos#6 ← (byte) irq_sprite_ypos#2 + (byte/signed byte/word/signed word/dword/signed dword) 21 [ irq_sprite_ptr#2 irq_raster_next#6 ] ( ) always clobbers reg byte a -Statement [62] (byte) irq_sprite_ptr#6 ← (byte) irq_sprite_ptr#2 + (byte/signed byte/word/signed word/dword/signed dword) 3 [ irq_raster_next#6 ] ( ) always clobbers reg byte a -Statement [64] *((const byte*) RASTER#0) ← (byte) irq_raster_next#13 [ ] ( ) always clobbers reg byte a -Statement [65] *((const byte*) IRQ_STATUS#0) ← (const byte) IRQ_RASTER#0 [ ] ( ) always clobbers reg byte a -Statement [66] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 [ ] ( ) always clobbers reg byte a -Statement [68] (byte) irq_cnt#24 ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( ) always clobbers reg byte a -Statement [69] (byte) irq_raster_next#20 ← (const byte) IRQ_RASTER_FIRST#0 [ irq_raster_next#20 ] ( ) always clobbers reg byte a -Statement [70] (byte) irq_sprite_ypos#26 ← (byte/signed byte/word/signed word/dword/signed dword) 50 [ irq_raster_next#20 ] ( ) always clobbers reg byte a -Statement [72] (byte) irq_sprite_ptr#5 ← (const byte) irq::toSpritePtr2_return#0 [ irq_raster_next#20 ] ( ) always clobbers reg byte a +Statement [34] *((const byte*) SPRITES_XPOS#0 + (byte) init_sprites::s2#0) ← (byte) init_sprites::xpos#2 [ init_sprites::s#2 init_sprites::xpos#2 ] ( main:7::init_sprites:10 [ init_sprites::s#2 init_sprites::xpos#2 ] ) always clobbers reg byte a +Statement [35] *((const byte*) SPRITES_COLS#0 + (byte) init_sprites::s#2) ← (const byte) BLACK#0 [ init_sprites::s#2 init_sprites::xpos#2 ] ( main:7::init_sprites:10 [ init_sprites::s#2 init_sprites::xpos#2 ] ) always clobbers reg byte a +Statement [36] (byte) init_sprites::xpos#1 ← (byte) init_sprites::xpos#2 + (byte/signed byte/word/signed word/dword/signed dword) 24 [ init_sprites::s#2 init_sprites::xpos#1 ] ( main:7::init_sprites:10 [ init_sprites::s#2 init_sprites::xpos#1 ] ) always clobbers reg byte a +Statement [40] *((const byte*) BORDERCOL#0) ← (const byte) DARK_GREY#0 [ irq_raster_next#0 irq_sprite_ypos#0 irq_sprite_ptr#0 irq_cnt#0 ] ( ) always clobbers reg byte a +Statement [41] *((const byte*) SPRITES_YPOS#0) ← (byte) irq_sprite_ypos#0 [ irq_raster_next#0 irq_sprite_ypos#0 irq_sprite_ptr#0 irq_cnt#0 ] ( ) always clobbers reg byte a +Statement [42] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte) irq_sprite_ypos#0 [ irq_raster_next#0 irq_sprite_ypos#0 irq_sprite_ptr#0 irq_cnt#0 ] ( ) always clobbers reg byte a +Statement [43] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 4) ← (byte) irq_sprite_ypos#0 [ irq_raster_next#0 irq_sprite_ypos#0 irq_sprite_ptr#0 irq_cnt#0 ] ( ) always clobbers reg byte a +Statement [44] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 6) ← (byte) irq_sprite_ypos#0 [ irq_raster_next#0 irq_sprite_ypos#0 irq_sprite_ptr#0 irq_cnt#0 ] ( ) always clobbers reg byte a +Statement [45] if(*((const byte*) RASTER#0)!=(byte) irq_sprite_ypos#0) goto irq::@1 [ irq_raster_next#0 irq_sprite_ypos#0 irq_sprite_ptr#0 irq_cnt#0 ] ( ) always clobbers reg byte a +Statement [53] (byte) irq_cnt#1 ← ++ (byte) irq_cnt#0 [ irq_raster_next#0 irq_sprite_ypos#0 irq_sprite_ptr#0 irq_cnt#1 ] ( ) always clobbers reg byte y +Statement [54] if((byte) irq_cnt#1==(byte/signed byte/word/signed word/dword/signed dword) 10) goto irq::@2 [ irq_raster_next#0 irq_sprite_ypos#0 irq_sprite_ptr#0 ] ( ) always clobbers reg byte a +Statement [55] (byte) irq_raster_next#2 ← (byte) irq_raster_next#0 + (byte/signed byte/word/signed word/dword/signed dword) 21 [ irq_sprite_ypos#0 irq_sprite_ptr#0 irq_raster_next#2 ] ( ) always clobbers reg byte a +Statement [56] (byte) irq_sprite_ypos#2 ← (byte) irq_sprite_ypos#0 + (byte/signed byte/word/signed word/dword/signed dword) 21 [ irq_sprite_ptr#0 irq_raster_next#2 ] ( ) always clobbers reg byte a +Statement [57] (byte) irq_sprite_ptr#2 ← (byte) irq_sprite_ptr#0 + (byte/signed byte/word/signed word/dword/signed dword) 3 [ irq_raster_next#2 ] ( ) always clobbers reg byte a +Statement [59] *((const byte*) RASTER#0) ← (byte) irq_raster_next#3 [ ] ( ) always clobbers reg byte a +Statement [60] *((const byte*) IRQ_STATUS#0) ← (const byte) IRQ_RASTER#0 [ ] ( ) always clobbers reg byte a +Statement [61] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 [ ] ( ) always clobbers reg byte a +Statement [63] (byte) irq_cnt#10 ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( ) always clobbers reg byte a +Statement [64] (byte) irq_raster_next#1 ← (const byte) IRQ_RASTER_FIRST#0 [ irq_raster_next#1 ] ( ) always clobbers reg byte a +Statement [65] (byte) irq_sprite_ypos#1 ← (byte/signed byte/word/signed word/dword/signed dword) 50 [ irq_raster_next#1 ] ( ) always clobbers reg byte a +Statement [67] (byte) irq_sprite_ptr#1 ← (const byte) irq::toSpritePtr2_return#0 [ irq_raster_next#1 ] ( ) always clobbers reg byte a +Statement [1] (byte) irq_raster_next#0 ← (const byte) IRQ_RASTER_FIRST#0 [ ] ( ) always clobbers reg byte a +Statement [2] (byte) irq_sprite_ypos#0 ← (byte/signed byte/word/signed word/dword/signed dword) 50 [ ] ( ) always clobbers reg byte a +Statement [4] (byte) irq_sprite_ptr#0 ← (const byte) toSpritePtr1_return#0 [ ] ( ) always clobbers reg byte a +Statement [5] (byte) irq_cnt#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( ) always clobbers reg byte a +Statement [15] *((const byte*) CIA1_INTERRUPT#0) ← (const byte) CIA_INTERRUPT_CLEAR#0 [ ] ( main:7::init_irq:12 [ ] ) always clobbers reg byte a +Statement [16] *((const byte*) VIC_CONTROL#0) ← *((const byte*) VIC_CONTROL#0) & (byte/signed byte/word/signed word/dword/signed dword) 127 [ ] ( main:7::init_irq:12 [ ] ) always clobbers reg byte a +Statement [17] *((const byte*) RASTER#0) ← (const byte) IRQ_RASTER_FIRST#0 [ ] ( main:7::init_irq:12 [ ] ) always clobbers reg byte a +Statement [18] *((const byte*) IRQ_ENABLE#0) ← (const byte) IRQ_RASTER#0 [ ] ( main:7::init_irq:12 [ ] ) always clobbers reg byte a +Statement [19] *((const void()**) KERNEL_IRQ#0) ← &interrupt(KERNEL_MIN)(void()) irq() [ ] ( main:7::init_irq:12 [ ] ) always clobbers reg byte a +Statement [23] *((const byte*) CIA2_PORT_A_DDR#0) ← (byte/signed byte/word/signed word/dword/signed dword) 3 [ ] ( main:7::init_sprites:10 [ ] ) always clobbers reg byte a +Statement [25] *((const byte*) CIA2_PORT_A#0) ← (const byte) init_sprites::vicSelectGfxBank1_toDd001_return#0 [ ] ( main:7::init_sprites:10 [ ] ) always clobbers reg byte a +Statement [27] *((const byte*) D018#0) ← (const byte) init_sprites::toD0181_return#0 [ ] ( main:7::init_sprites:10 [ ] ) always clobbers reg byte a +Statement [28] *((const byte*) SPRITES_ENABLE#0) ← (byte/signed byte/word/signed word/dword/signed dword) 15 [ ] ( main:7::init_sprites:10 [ ] ) always clobbers reg byte a +Statement [29] *((const byte*) SPRITES_MC#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( main:7::init_sprites:10 [ ] ) always clobbers reg byte a +Statement [30] *((const byte*) SPRITES_EXPAND_Y#0) ← *((const byte*) SPRITES_MC#0) [ ] ( main:7::init_sprites:10 [ ] ) always clobbers reg byte a +Statement [31] *((const byte*) SPRITES_EXPAND_X#0) ← *((const byte*) SPRITES_EXPAND_Y#0) [ ] ( main:7::init_sprites:10 [ ] ) always clobbers reg byte a +Statement [33] (byte) init_sprites::s2#0 ← (byte) init_sprites::s#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 [ init_sprites::s#2 init_sprites::xpos#2 init_sprites::s2#0 ] ( main:7::init_sprites:10 [ init_sprites::s#2 init_sprites::xpos#2 init_sprites::s2#0 ] ) always clobbers reg byte a +Statement [34] *((const byte*) SPRITES_XPOS#0 + (byte) init_sprites::s2#0) ← (byte) init_sprites::xpos#2 [ init_sprites::s#2 init_sprites::xpos#2 ] ( main:7::init_sprites:10 [ init_sprites::s#2 init_sprites::xpos#2 ] ) always clobbers reg byte a +Statement [35] *((const byte*) SPRITES_COLS#0 + (byte) init_sprites::s#2) ← (const byte) BLACK#0 [ init_sprites::s#2 init_sprites::xpos#2 ] ( main:7::init_sprites:10 [ init_sprites::s#2 init_sprites::xpos#2 ] ) always clobbers reg byte a +Statement [36] (byte) init_sprites::xpos#1 ← (byte) init_sprites::xpos#2 + (byte/signed byte/word/signed word/dword/signed dword) 24 [ init_sprites::s#2 init_sprites::xpos#1 ] ( main:7::init_sprites:10 [ init_sprites::s#2 init_sprites::xpos#1 ] ) always clobbers reg byte a +Statement [40] *((const byte*) BORDERCOL#0) ← (const byte) DARK_GREY#0 [ irq_raster_next#0 irq_sprite_ypos#0 irq_sprite_ptr#0 irq_cnt#0 ] ( ) always clobbers reg byte a +Statement [41] *((const byte*) SPRITES_YPOS#0) ← (byte) irq_sprite_ypos#0 [ irq_raster_next#0 irq_sprite_ypos#0 irq_sprite_ptr#0 irq_cnt#0 ] ( ) always clobbers reg byte a +Statement [42] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte) irq_sprite_ypos#0 [ irq_raster_next#0 irq_sprite_ypos#0 irq_sprite_ptr#0 irq_cnt#0 ] ( ) always clobbers reg byte a +Statement [43] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 4) ← (byte) irq_sprite_ypos#0 [ irq_raster_next#0 irq_sprite_ypos#0 irq_sprite_ptr#0 irq_cnt#0 ] ( ) always clobbers reg byte a +Statement [44] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 6) ← (byte) irq_sprite_ypos#0 [ irq_raster_next#0 irq_sprite_ypos#0 irq_sprite_ptr#0 irq_cnt#0 ] ( ) always clobbers reg byte a +Statement [45] if(*((const byte*) RASTER#0)!=(byte) irq_sprite_ypos#0) goto irq::@1 [ irq_raster_next#0 irq_sprite_ypos#0 irq_sprite_ptr#0 irq_cnt#0 ] ( ) always clobbers reg byte a +Statement [53] (byte) irq_cnt#1 ← ++ (byte) irq_cnt#0 [ irq_raster_next#0 irq_sprite_ypos#0 irq_sprite_ptr#0 irq_cnt#1 ] ( ) always clobbers reg byte y +Statement [54] if((byte) irq_cnt#1==(byte/signed byte/word/signed word/dword/signed dword) 10) goto irq::@2 [ irq_raster_next#0 irq_sprite_ypos#0 irq_sprite_ptr#0 ] ( ) always clobbers reg byte a +Statement [55] (byte) irq_raster_next#2 ← (byte) irq_raster_next#0 + (byte/signed byte/word/signed word/dword/signed dword) 21 [ irq_sprite_ypos#0 irq_sprite_ptr#0 irq_raster_next#2 ] ( ) always clobbers reg byte a +Statement [56] (byte) irq_sprite_ypos#2 ← (byte) irq_sprite_ypos#0 + (byte/signed byte/word/signed word/dword/signed dword) 21 [ irq_sprite_ptr#0 irq_raster_next#2 ] ( ) always clobbers reg byte a +Statement [57] (byte) irq_sprite_ptr#2 ← (byte) irq_sprite_ptr#0 + (byte/signed byte/word/signed word/dword/signed dword) 3 [ irq_raster_next#2 ] ( ) always clobbers reg byte a +Statement [59] *((const byte*) RASTER#0) ← (byte) irq_raster_next#3 [ ] ( ) always clobbers reg byte a +Statement [60] *((const byte*) IRQ_STATUS#0) ← (const byte) IRQ_RASTER#0 [ ] ( ) always clobbers reg byte a +Statement [61] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 [ ] ( ) always clobbers reg byte a +Statement [63] (byte) irq_cnt#10 ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( ) always clobbers reg byte a +Statement [64] (byte) irq_raster_next#1 ← (const byte) IRQ_RASTER_FIRST#0 [ irq_raster_next#1 ] ( ) always clobbers reg byte a +Statement [65] (byte) irq_sprite_ypos#1 ← (byte/signed byte/word/signed word/dword/signed dword) 50 [ irq_raster_next#1 ] ( ) always clobbers reg byte a +Statement [67] (byte) irq_sprite_ptr#1 ← (const byte) irq::toSpritePtr2_return#0 [ irq_raster_next#1 ] ( ) always clobbers reg byte a Potential registers zp ZP_BYTE:2 [ init_sprites::s#2 init_sprites::s#1 ] : zp ZP_BYTE:2 , reg byte x , reg byte y , Potential registers zp ZP_BYTE:3 [ init_sprites::xpos#2 init_sprites::xpos#1 ] : zp ZP_BYTE:3 , reg byte x , reg byte y , -Potential registers zp ZP_BYTE:4 [ irq_raster_next#13 irq_raster_next#6 irq_raster_next#20 ] : zp ZP_BYTE:4 , -Potential registers zp ZP_BYTE:5 [ irq_raster_next#2 ] : zp ZP_BYTE:5 , -Potential registers zp ZP_BYTE:6 [ irq_sprite_ypos#2 ] : zp ZP_BYTE:6 , -Potential registers zp ZP_BYTE:7 [ irq_sprite_ptr#2 ] : zp ZP_BYTE:7 , -Potential registers zp ZP_BYTE:8 [ irq_cnt#19 ] : zp ZP_BYTE:8 , -Potential registers zp ZP_BYTE:9 [ irq_raster_next#11 ] : zp ZP_BYTE:9 , -Potential registers zp ZP_BYTE:10 [ irq_sprite_ypos#11 ] : zp ZP_BYTE:10 , -Potential registers zp ZP_BYTE:11 [ irq_sprite_ptr#3 ] : zp ZP_BYTE:11 , -Potential registers zp ZP_BYTE:12 [ irq_cnt#11 ] : zp ZP_BYTE:12 , -Potential registers zp ZP_BYTE:13 [ init_sprites::s2#0 ] : zp ZP_BYTE:13 , reg byte a , reg byte x , reg byte y , -Potential registers zp ZP_BYTE:14 [ irq::ptr#0 ] : zp ZP_BYTE:14 , reg byte a , reg byte x , reg byte y , -Potential registers zp ZP_BYTE:15 [ irq::ptr#1 ] : zp ZP_BYTE:15 , reg byte a , reg byte x , reg byte y , -Potential registers zp ZP_BYTE:16 [ irq::ptr#2 ] : zp ZP_BYTE:16 , reg byte a , reg byte x , reg byte y , -Potential registers zp ZP_BYTE:17 [ irq_cnt#23 ] : zp ZP_BYTE:17 , -Potential registers zp ZP_BYTE:18 [ irq_sprite_ypos#6 ] : zp ZP_BYTE:18 , -Potential registers zp ZP_BYTE:19 [ irq_sprite_ptr#6 ] : zp ZP_BYTE:19 , -Potential registers zp ZP_BYTE:20 [ irq_cnt#24 ] : zp ZP_BYTE:20 , -Potential registers zp ZP_BYTE:21 [ irq_sprite_ypos#26 ] : zp ZP_BYTE:21 , -Potential registers zp ZP_BYTE:22 [ irq_sprite_ptr#5 ] : zp ZP_BYTE:22 , +Potential registers zp ZP_BYTE:4 [ irq_raster_next#3 irq_raster_next#2 irq_raster_next#1 ] : zp ZP_BYTE:4 , +Potential registers zp ZP_BYTE:5 [ irq_raster_next#0 ] : zp ZP_BYTE:5 , +Potential registers zp ZP_BYTE:6 [ irq_sprite_ypos#0 ] : zp ZP_BYTE:6 , +Potential registers zp ZP_BYTE:7 [ irq_sprite_ptr#0 ] : zp ZP_BYTE:7 , +Potential registers zp ZP_BYTE:8 [ irq_cnt#0 ] : zp ZP_BYTE:8 , +Potential registers zp ZP_BYTE:9 [ init_sprites::s2#0 ] : zp ZP_BYTE:9 , reg byte a , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:10 [ irq::ptr#0 ] : zp ZP_BYTE:10 , reg byte a , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:11 [ irq::ptr#1 ] : zp ZP_BYTE:11 , reg byte a , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:12 [ irq::ptr#2 ] : zp ZP_BYTE:12 , reg byte a , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:13 [ irq_cnt#1 ] : zp ZP_BYTE:13 , +Potential registers zp ZP_BYTE:14 [ irq_sprite_ypos#2 ] : zp ZP_BYTE:14 , +Potential registers zp ZP_BYTE:15 [ irq_sprite_ptr#2 ] : zp ZP_BYTE:15 , +Potential registers zp ZP_BYTE:16 [ irq_cnt#10 ] : zp ZP_BYTE:16 , +Potential registers zp ZP_BYTE:17 [ irq_sprite_ypos#1 ] : zp ZP_BYTE:17 , +Potential registers zp ZP_BYTE:18 [ irq_sprite_ptr#1 ] : zp ZP_BYTE:18 , REGISTER UPLIFT SCOPES -Uplift Scope [] 20: zp ZP_BYTE:9 [ irq_raster_next#11 ] 20: zp ZP_BYTE:10 [ irq_sprite_ypos#11 ] 20: zp ZP_BYTE:11 [ irq_sprite_ptr#3 ] 20: zp ZP_BYTE:12 [ irq_cnt#11 ] 20: zp ZP_BYTE:18 [ irq_sprite_ypos#6 ] 20: zp ZP_BYTE:19 [ irq_sprite_ptr#6 ] 20: zp ZP_BYTE:20 [ irq_cnt#24 ] 20: zp ZP_BYTE:21 [ irq_sprite_ypos#26 ] 20: zp ZP_BYTE:22 [ irq_sprite_ptr#5 ] 8.33: zp ZP_BYTE:4 [ irq_raster_next#13 irq_raster_next#6 irq_raster_next#20 ] 4: zp ZP_BYTE:17 [ irq_cnt#23 ] 1.44: zp ZP_BYTE:6 [ irq_sprite_ypos#2 ] 0.35: zp ZP_BYTE:7 [ irq_sprite_ptr#2 ] 0.31: zp ZP_BYTE:8 [ irq_cnt#19 ] 0.27: zp ZP_BYTE:5 [ irq_raster_next#2 ] -Uplift Scope [init_sprites] 25.3: zp ZP_BYTE:2 [ init_sprites::s#2 init_sprites::s#1 ] 22: zp ZP_BYTE:13 [ init_sprites::s2#0 ] 15.58: zp ZP_BYTE:3 [ init_sprites::xpos#2 init_sprites::xpos#1 ] -Uplift Scope [irq] 4: zp ZP_BYTE:16 [ irq::ptr#2 ] 3: zp ZP_BYTE:14 [ irq::ptr#0 ] 2.67: zp ZP_BYTE:15 [ irq::ptr#1 ] +Uplift Scope [] 20: zp ZP_BYTE:14 [ irq_sprite_ypos#2 ] 20: zp ZP_BYTE:15 [ irq_sprite_ptr#2 ] 20: zp ZP_BYTE:16 [ irq_cnt#10 ] 20: zp ZP_BYTE:17 [ irq_sprite_ypos#1 ] 20: zp ZP_BYTE:18 [ irq_sprite_ptr#1 ] 8.33: zp ZP_BYTE:4 [ irq_raster_next#3 irq_raster_next#2 irq_raster_next#1 ] 4: zp ZP_BYTE:13 [ irq_cnt#1 ] 1.44: zp ZP_BYTE:6 [ irq_sprite_ypos#0 ] 0.35: zp ZP_BYTE:7 [ irq_sprite_ptr#0 ] 0.31: zp ZP_BYTE:8 [ irq_cnt#0 ] 0.27: zp ZP_BYTE:5 [ irq_raster_next#0 ] +Uplift Scope [init_sprites] 25.3: zp ZP_BYTE:2 [ init_sprites::s#2 init_sprites::s#1 ] 22: zp ZP_BYTE:9 [ init_sprites::s2#0 ] 15.58: zp ZP_BYTE:3 [ init_sprites::xpos#2 init_sprites::xpos#1 ] +Uplift Scope [irq] 4: zp ZP_BYTE:12 [ irq::ptr#2 ] 3: zp ZP_BYTE:10 [ irq::ptr#0 ] 2.67: zp ZP_BYTE:11 [ irq::ptr#1 ] Uplift Scope [main] Uplift Scope [init_irq] -Uplifting [] best 1762 combination zp ZP_BYTE:9 [ irq_raster_next#11 ] zp ZP_BYTE:10 [ irq_sprite_ypos#11 ] zp ZP_BYTE:11 [ irq_sprite_ptr#3 ] zp ZP_BYTE:12 [ irq_cnt#11 ] zp ZP_BYTE:18 [ irq_sprite_ypos#6 ] zp ZP_BYTE:19 [ irq_sprite_ptr#6 ] zp ZP_BYTE:20 [ irq_cnt#24 ] zp ZP_BYTE:21 [ irq_sprite_ypos#26 ] zp ZP_BYTE:22 [ irq_sprite_ptr#5 ] zp ZP_BYTE:4 [ irq_raster_next#13 irq_raster_next#6 irq_raster_next#20 ] zp ZP_BYTE:17 [ irq_cnt#23 ] zp ZP_BYTE:6 [ irq_sprite_ypos#2 ] zp ZP_BYTE:7 [ irq_sprite_ptr#2 ] zp ZP_BYTE:8 [ irq_cnt#19 ] zp ZP_BYTE:5 [ irq_raster_next#2 ] -Uplifting [init_sprites] best 1592 combination reg byte x [ init_sprites::s#2 init_sprites::s#1 ] reg byte a [ init_sprites::s2#0 ] zp ZP_BYTE:3 [ init_sprites::xpos#2 init_sprites::xpos#1 ] -Uplifting [irq] best 1565 combination reg byte x [ irq::ptr#2 ] reg byte x [ irq::ptr#0 ] reg byte x [ irq::ptr#1 ] -Uplifting [main] best 1565 combination -Uplifting [init_irq] best 1565 combination -Attempting to uplift remaining variables inzp ZP_BYTE:9 [ irq_raster_next#11 ] -Uplifting [] best 1565 combination zp ZP_BYTE:9 [ irq_raster_next#11 ] -Attempting to uplift remaining variables inzp ZP_BYTE:10 [ irq_sprite_ypos#11 ] -Uplifting [] best 1565 combination zp ZP_BYTE:10 [ irq_sprite_ypos#11 ] -Attempting to uplift remaining variables inzp ZP_BYTE:11 [ irq_sprite_ptr#3 ] -Uplifting [] best 1565 combination zp ZP_BYTE:11 [ irq_sprite_ptr#3 ] -Attempting to uplift remaining variables inzp ZP_BYTE:12 [ irq_cnt#11 ] -Uplifting [] best 1565 combination zp ZP_BYTE:12 [ irq_cnt#11 ] -Attempting to uplift remaining variables inzp ZP_BYTE:18 [ irq_sprite_ypos#6 ] -Uplifting [] best 1565 combination zp ZP_BYTE:18 [ irq_sprite_ypos#6 ] -Attempting to uplift remaining variables inzp ZP_BYTE:19 [ irq_sprite_ptr#6 ] -Uplifting [] best 1565 combination zp ZP_BYTE:19 [ irq_sprite_ptr#6 ] -Attempting to uplift remaining variables inzp ZP_BYTE:20 [ irq_cnt#24 ] -Uplifting [] best 1565 combination zp ZP_BYTE:20 [ irq_cnt#24 ] -Attempting to uplift remaining variables inzp ZP_BYTE:21 [ irq_sprite_ypos#26 ] -Uplifting [] best 1565 combination zp ZP_BYTE:21 [ irq_sprite_ypos#26 ] -Attempting to uplift remaining variables inzp ZP_BYTE:22 [ irq_sprite_ptr#5 ] -Uplifting [] best 1565 combination zp ZP_BYTE:22 [ irq_sprite_ptr#5 ] +Uplifting [] best 1709 combination zp ZP_BYTE:14 [ irq_sprite_ypos#2 ] zp ZP_BYTE:15 [ irq_sprite_ptr#2 ] zp ZP_BYTE:16 [ irq_cnt#10 ] zp ZP_BYTE:17 [ irq_sprite_ypos#1 ] zp ZP_BYTE:18 [ irq_sprite_ptr#1 ] zp ZP_BYTE:4 [ irq_raster_next#3 irq_raster_next#2 irq_raster_next#1 ] zp ZP_BYTE:13 [ irq_cnt#1 ] zp ZP_BYTE:6 [ irq_sprite_ypos#0 ] zp ZP_BYTE:7 [ irq_sprite_ptr#0 ] zp ZP_BYTE:8 [ irq_cnt#0 ] zp ZP_BYTE:5 [ irq_raster_next#0 ] +Uplifting [init_sprites] best 1539 combination reg byte x [ init_sprites::s#2 init_sprites::s#1 ] reg byte a [ init_sprites::s2#0 ] zp ZP_BYTE:3 [ init_sprites::xpos#2 init_sprites::xpos#1 ] +Uplifting [irq] best 1512 combination reg byte x [ irq::ptr#2 ] reg byte x [ irq::ptr#0 ] reg byte x [ irq::ptr#1 ] +Uplifting [main] best 1512 combination +Uplifting [init_irq] best 1512 combination +Attempting to uplift remaining variables inzp ZP_BYTE:14 [ irq_sprite_ypos#2 ] +Uplifting [] best 1512 combination zp ZP_BYTE:14 [ irq_sprite_ypos#2 ] +Attempting to uplift remaining variables inzp ZP_BYTE:15 [ irq_sprite_ptr#2 ] +Uplifting [] best 1512 combination zp ZP_BYTE:15 [ irq_sprite_ptr#2 ] +Attempting to uplift remaining variables inzp ZP_BYTE:16 [ irq_cnt#10 ] +Uplifting [] best 1512 combination zp ZP_BYTE:16 [ irq_cnt#10 ] +Attempting to uplift remaining variables inzp ZP_BYTE:17 [ irq_sprite_ypos#1 ] +Uplifting [] best 1512 combination zp ZP_BYTE:17 [ irq_sprite_ypos#1 ] +Attempting to uplift remaining variables inzp ZP_BYTE:18 [ irq_sprite_ptr#1 ] +Uplifting [] best 1512 combination zp ZP_BYTE:18 [ irq_sprite_ptr#1 ] Attempting to uplift remaining variables inzp ZP_BYTE:3 [ init_sprites::xpos#2 init_sprites::xpos#1 ] -Uplifting [init_sprites] best 1565 combination zp ZP_BYTE:3 [ init_sprites::xpos#2 init_sprites::xpos#1 ] -Attempting to uplift remaining variables inzp ZP_BYTE:4 [ irq_raster_next#13 irq_raster_next#6 irq_raster_next#20 ] -Uplifting [] best 1565 combination zp ZP_BYTE:4 [ irq_raster_next#13 irq_raster_next#6 irq_raster_next#20 ] -Attempting to uplift remaining variables inzp ZP_BYTE:17 [ irq_cnt#23 ] -Uplifting [] best 1565 combination zp ZP_BYTE:17 [ irq_cnt#23 ] -Attempting to uplift remaining variables inzp ZP_BYTE:6 [ irq_sprite_ypos#2 ] -Uplifting [] best 1565 combination zp ZP_BYTE:6 [ irq_sprite_ypos#2 ] -Attempting to uplift remaining variables inzp ZP_BYTE:7 [ irq_sprite_ptr#2 ] -Uplifting [] best 1565 combination zp ZP_BYTE:7 [ irq_sprite_ptr#2 ] -Attempting to uplift remaining variables inzp ZP_BYTE:8 [ irq_cnt#19 ] -Uplifting [] best 1565 combination zp ZP_BYTE:8 [ irq_cnt#19 ] -Attempting to uplift remaining variables inzp ZP_BYTE:5 [ irq_raster_next#2 ] -Uplifting [] best 1565 combination zp ZP_BYTE:5 [ irq_raster_next#2 ] -Coalescing zero page register with common assignment [ zp ZP_BYTE:4 [ irq_raster_next#13 irq_raster_next#6 irq_raster_next#20 ] ] with [ zp ZP_BYTE:5 [ irq_raster_next#2 ] ] - score: 1 -Coalescing zero page register with common assignment [ zp ZP_BYTE:6 [ irq_sprite_ypos#2 ] ] with [ zp ZP_BYTE:18 [ irq_sprite_ypos#6 ] ] - score: 1 -Coalescing zero page register with common assignment [ zp ZP_BYTE:7 [ irq_sprite_ptr#2 ] ] with [ zp ZP_BYTE:19 [ irq_sprite_ptr#6 ] ] - score: 1 -Coalescing zero page register with common assignment [ zp ZP_BYTE:8 [ irq_cnt#19 ] ] with [ zp ZP_BYTE:17 [ irq_cnt#23 ] ] - score: 1 -Coalescing zero page register [ zp ZP_BYTE:4 [ irq_raster_next#13 irq_raster_next#6 irq_raster_next#20 irq_raster_next#2 ] ] with [ zp ZP_BYTE:9 [ irq_raster_next#11 ] ] -Coalescing zero page register [ zp ZP_BYTE:6 [ irq_sprite_ypos#2 irq_sprite_ypos#6 ] ] with [ zp ZP_BYTE:10 [ irq_sprite_ypos#11 ] ] -Coalescing zero page register [ zp ZP_BYTE:6 [ irq_sprite_ypos#2 irq_sprite_ypos#6 irq_sprite_ypos#11 ] ] with [ zp ZP_BYTE:21 [ irq_sprite_ypos#26 ] ] -Coalescing zero page register [ zp ZP_BYTE:7 [ irq_sprite_ptr#2 irq_sprite_ptr#6 ] ] with [ zp ZP_BYTE:11 [ irq_sprite_ptr#3 ] ] -Coalescing zero page register [ zp ZP_BYTE:7 [ irq_sprite_ptr#2 irq_sprite_ptr#6 irq_sprite_ptr#3 ] ] with [ zp ZP_BYTE:22 [ irq_sprite_ptr#5 ] ] -Coalescing zero page register [ zp ZP_BYTE:8 [ irq_cnt#19 irq_cnt#23 ] ] with [ zp ZP_BYTE:12 [ irq_cnt#11 ] ] -Coalescing zero page register [ zp ZP_BYTE:8 [ irq_cnt#19 irq_cnt#23 irq_cnt#11 ] ] with [ zp ZP_BYTE:20 [ irq_cnt#24 ] ] +Uplifting [init_sprites] best 1512 combination zp ZP_BYTE:3 [ init_sprites::xpos#2 init_sprites::xpos#1 ] +Attempting to uplift remaining variables inzp ZP_BYTE:4 [ irq_raster_next#3 irq_raster_next#2 irq_raster_next#1 ] +Uplifting [] best 1512 combination zp ZP_BYTE:4 [ irq_raster_next#3 irq_raster_next#2 irq_raster_next#1 ] +Attempting to uplift remaining variables inzp ZP_BYTE:13 [ irq_cnt#1 ] +Uplifting [] best 1512 combination zp ZP_BYTE:13 [ irq_cnt#1 ] +Attempting to uplift remaining variables inzp ZP_BYTE:6 [ irq_sprite_ypos#0 ] +Uplifting [] best 1512 combination zp ZP_BYTE:6 [ irq_sprite_ypos#0 ] +Attempting to uplift remaining variables inzp ZP_BYTE:7 [ irq_sprite_ptr#0 ] +Uplifting [] best 1512 combination zp ZP_BYTE:7 [ irq_sprite_ptr#0 ] +Attempting to uplift remaining variables inzp ZP_BYTE:8 [ irq_cnt#0 ] +Uplifting [] best 1512 combination zp ZP_BYTE:8 [ irq_cnt#0 ] +Attempting to uplift remaining variables inzp ZP_BYTE:5 [ irq_raster_next#0 ] +Uplifting [] best 1512 combination zp ZP_BYTE:5 [ irq_raster_next#0 ] +Coalescing zero page register with common assignment [ zp ZP_BYTE:4 [ irq_raster_next#3 irq_raster_next#2 irq_raster_next#1 ] ] with [ zp ZP_BYTE:5 [ irq_raster_next#0 ] ] - score: 1 +Coalescing zero page register with common assignment [ zp ZP_BYTE:6 [ irq_sprite_ypos#0 ] ] with [ zp ZP_BYTE:14 [ irq_sprite_ypos#2 ] ] - score: 1 +Coalescing zero page register with common assignment [ zp ZP_BYTE:7 [ irq_sprite_ptr#0 ] ] with [ zp ZP_BYTE:15 [ irq_sprite_ptr#2 ] ] - score: 1 +Coalescing zero page register with common assignment [ zp ZP_BYTE:8 [ irq_cnt#0 ] ] with [ zp ZP_BYTE:13 [ irq_cnt#1 ] ] - score: 1 +Coalescing zero page register [ zp ZP_BYTE:6 [ irq_sprite_ypos#0 irq_sprite_ypos#2 ] ] with [ zp ZP_BYTE:17 [ irq_sprite_ypos#1 ] ] +Coalescing zero page register [ zp ZP_BYTE:7 [ irq_sprite_ptr#0 irq_sprite_ptr#2 ] ] with [ zp ZP_BYTE:18 [ irq_sprite_ptr#1 ] ] +Coalescing zero page register [ zp ZP_BYTE:8 [ irq_cnt#0 irq_cnt#1 ] ] with [ zp ZP_BYTE:16 [ irq_cnt#10 ] ] Allocated (was zp ZP_BYTE:3) zp ZP_BYTE:2 [ init_sprites::xpos#2 init_sprites::xpos#1 ] -Allocated (was zp ZP_BYTE:4) zp ZP_BYTE:3 [ irq_raster_next#13 irq_raster_next#6 irq_raster_next#20 irq_raster_next#2 irq_raster_next#11 ] -Allocated (was zp ZP_BYTE:6) zp ZP_BYTE:4 [ irq_sprite_ypos#2 irq_sprite_ypos#6 irq_sprite_ypos#11 irq_sprite_ypos#26 ] -Allocated (was zp ZP_BYTE:7) zp ZP_BYTE:5 [ irq_sprite_ptr#2 irq_sprite_ptr#6 irq_sprite_ptr#3 irq_sprite_ptr#5 ] -Allocated (was zp ZP_BYTE:8) zp ZP_BYTE:6 [ irq_cnt#19 irq_cnt#23 irq_cnt#11 irq_cnt#24 ] +Allocated (was zp ZP_BYTE:4) zp ZP_BYTE:3 [ irq_raster_next#3 irq_raster_next#2 irq_raster_next#1 irq_raster_next#0 ] +Allocated (was zp ZP_BYTE:6) zp ZP_BYTE:4 [ irq_sprite_ypos#0 irq_sprite_ypos#2 irq_sprite_ypos#1 ] +Allocated (was zp ZP_BYTE:7) zp ZP_BYTE:5 [ irq_sprite_ptr#0 irq_sprite_ptr#2 irq_sprite_ptr#1 ] +Allocated (was zp ZP_BYTE:8) zp ZP_BYTE:6 [ irq_cnt#0 irq_cnt#1 irq_cnt#10 ] ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .const SPRITE_PTRS = $3f8 @@ -2190,10 +1897,10 @@ bbegin: jmp b6 //SEG3 @6 b6: -//SEG4 [1] (byte) irq_raster_next#2 ← (const byte) IRQ_RASTER_FIRST#0 -- vbuz1=vbuc1 +//SEG4 [1] (byte) irq_raster_next#0 ← (const byte) IRQ_RASTER_FIRST#0 -- vbuz1=vbuc1 lda #IRQ_RASTER_FIRST sta irq_raster_next -//SEG5 [2] (byte) irq_sprite_ypos#2 ← (byte/signed byte/word/signed word/dword/signed dword) 50 -- vbuz1=vbuc1 +//SEG5 [2] (byte) irq_sprite_ypos#0 ← (byte/signed byte/word/signed word/dword/signed dword) 50 -- vbuz1=vbuc1 lda #$32 sta irq_sprite_ypos //SEG6 [3] phi from @6 to toSpritePtr1 [phi:@6->toSpritePtr1] @@ -2204,10 +1911,10 @@ toSpritePtr1: jmp b9 //SEG8 @9 b9: -//SEG9 [4] (byte) irq_sprite_ptr#2 ← (const byte) toSpritePtr1_return#0 -- vbuz1=vbuc1 +//SEG9 [4] (byte) irq_sprite_ptr#0 ← (const byte) toSpritePtr1_return#0 -- vbuz1=vbuc1 lda #toSpritePtr1_return sta irq_sprite_ptr -//SEG10 [5] (byte) irq_cnt#19 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1 +//SEG10 [5] (byte) irq_cnt#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1 lda #0 sta irq_cnt jmp b8 @@ -2226,7 +1933,7 @@ bend: //SEG17 main main: { //SEG18 [10] call init_sprites - //SEG19 [27] phi from main to init_sprites [phi:main->init_sprites] + //SEG19 [22] phi from main to init_sprites [phi:main->init_sprites] init_sprites_from_main: jsr init_sprites //SEG20 [11] phi from main to main::@7 [phi:main->main::@7] @@ -2245,249 +1952,228 @@ main: { } //SEG25 init_irq init_irq: { - .const toSpritePtr2_return = PLAYFIELD_SPRITES>>6 - //SEG26 [14] (byte) irq_raster_next#11 ← (const byte) IRQ_RASTER_FIRST#0 -- vbuz1=vbuc1 - lda #IRQ_RASTER_FIRST - sta irq_raster_next - //SEG27 [15] (byte) irq_sprite_ypos#11 ← (byte/signed byte/word/signed word/dword/signed dword) 50 -- vbuz1=vbuc1 - lda #$32 - sta irq_sprite_ypos - //SEG28 [16] phi from init_irq to init_irq::toSpritePtr2 [phi:init_irq->init_irq::toSpritePtr2] - toSpritePtr2_from_init_irq: - jmp toSpritePtr2 - //SEG29 init_irq::toSpritePtr2 - toSpritePtr2: - jmp b1 - //SEG30 init_irq::@1 - b1: - //SEG31 [17] (byte) irq_sprite_ptr#3 ← (const byte) init_irq::toSpritePtr2_return#0 -- vbuz1=vbuc1 - lda #toSpritePtr2_return - sta irq_sprite_ptr - //SEG32 [18] (byte) irq_cnt#11 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1 - lda #0 - sta irq_cnt - //SEG33 asm { sei } + //SEG26 asm { sei } sei - //SEG34 [20] *((const byte*) CIA1_INTERRUPT#0) ← (const byte) CIA_INTERRUPT_CLEAR#0 -- _deref_pbuc1=vbuc2 + //SEG27 [15] *((const byte*) CIA1_INTERRUPT#0) ← (const byte) CIA_INTERRUPT_CLEAR#0 -- _deref_pbuc1=vbuc2 lda #CIA_INTERRUPT_CLEAR sta CIA1_INTERRUPT - //SEG35 [21] *((const byte*) VIC_CONTROL#0) ← *((const byte*) VIC_CONTROL#0) & (byte/signed byte/word/signed word/dword/signed dword) 127 -- _deref_pbuc1=_deref_pbuc1_band_vbuc2 + //SEG28 [16] *((const byte*) VIC_CONTROL#0) ← *((const byte*) VIC_CONTROL#0) & (byte/signed byte/word/signed word/dword/signed dword) 127 -- _deref_pbuc1=_deref_pbuc1_band_vbuc2 lda VIC_CONTROL and #$7f sta VIC_CONTROL - //SEG36 [22] *((const byte*) RASTER#0) ← (const byte) IRQ_RASTER_FIRST#0 -- _deref_pbuc1=vbuc2 + //SEG29 [17] *((const byte*) RASTER#0) ← (const byte) IRQ_RASTER_FIRST#0 -- _deref_pbuc1=vbuc2 lda #IRQ_RASTER_FIRST sta RASTER - //SEG37 [23] *((const byte*) IRQ_ENABLE#0) ← (const byte) IRQ_RASTER#0 -- _deref_pbuc1=vbuc2 + //SEG30 [18] *((const byte*) IRQ_ENABLE#0) ← (const byte) IRQ_RASTER#0 -- _deref_pbuc1=vbuc2 lda #IRQ_RASTER sta IRQ_ENABLE - //SEG38 [24] *((const void()**) KERNEL_IRQ#0) ← &interrupt(KERNEL_MIN)(void()) irq() -- _deref_pptc1=pprc2 + //SEG31 [19] *((const void()**) KERNEL_IRQ#0) ← &interrupt(KERNEL_MIN)(void()) irq() -- _deref_pptc1=pprc2 lda #irq sta KERNEL_IRQ+1 - //SEG39 asm { cli } + //SEG32 asm { cli } cli jmp breturn - //SEG40 init_irq::@return + //SEG33 init_irq::@return breturn: - //SEG41 [26] return + //SEG34 [21] return rts } -//SEG42 init_sprites +//SEG35 init_sprites init_sprites: { .const vicSelectGfxBank1_toDd001_return = 3^(>PLAYFIELD_SCREEN)>>6 .const toD0181_return = (>(PLAYFIELD_SCREEN&$3fff)<<2)|(>PLAYFIELD_CHARSET)>>2&$f .label xpos = 2 jmp vicSelectGfxBank1 - //SEG43 init_sprites::vicSelectGfxBank1 + //SEG36 init_sprites::vicSelectGfxBank1 vicSelectGfxBank1: - //SEG44 [28] *((const byte*) CIA2_PORT_A_DDR#0) ← (byte/signed byte/word/signed word/dword/signed dword) 3 -- _deref_pbuc1=vbuc2 + //SEG37 [23] *((const byte*) CIA2_PORT_A_DDR#0) ← (byte/signed byte/word/signed word/dword/signed dword) 3 -- _deref_pbuc1=vbuc2 lda #3 sta CIA2_PORT_A_DDR - //SEG45 [29] phi from init_sprites::vicSelectGfxBank1 to init_sprites::vicSelectGfxBank1_toDd001 [phi:init_sprites::vicSelectGfxBank1->init_sprites::vicSelectGfxBank1_toDd001] + //SEG38 [24] phi from init_sprites::vicSelectGfxBank1 to init_sprites::vicSelectGfxBank1_toDd001 [phi:init_sprites::vicSelectGfxBank1->init_sprites::vicSelectGfxBank1_toDd001] vicSelectGfxBank1_toDd001_from_vicSelectGfxBank1: jmp vicSelectGfxBank1_toDd001 - //SEG46 init_sprites::vicSelectGfxBank1_toDd001 + //SEG39 init_sprites::vicSelectGfxBank1_toDd001 vicSelectGfxBank1_toDd001: jmp vicSelectGfxBank1_b1 - //SEG47 init_sprites::vicSelectGfxBank1_@1 + //SEG40 init_sprites::vicSelectGfxBank1_@1 vicSelectGfxBank1_b1: - //SEG48 [30] *((const byte*) CIA2_PORT_A#0) ← (const byte) init_sprites::vicSelectGfxBank1_toDd001_return#0 -- _deref_pbuc1=vbuc2 + //SEG41 [25] *((const byte*) CIA2_PORT_A#0) ← (const byte) init_sprites::vicSelectGfxBank1_toDd001_return#0 -- _deref_pbuc1=vbuc2 lda #vicSelectGfxBank1_toDd001_return sta CIA2_PORT_A - //SEG49 [31] phi from init_sprites::vicSelectGfxBank1_@1 to init_sprites::toD0181 [phi:init_sprites::vicSelectGfxBank1_@1->init_sprites::toD0181] + //SEG42 [26] phi from init_sprites::vicSelectGfxBank1_@1 to init_sprites::toD0181 [phi:init_sprites::vicSelectGfxBank1_@1->init_sprites::toD0181] toD0181_from_vicSelectGfxBank1_b1: jmp toD0181 - //SEG50 init_sprites::toD0181 + //SEG43 init_sprites::toD0181 toD0181: jmp b4 - //SEG51 init_sprites::@4 + //SEG44 init_sprites::@4 b4: - //SEG52 [32] *((const byte*) D018#0) ← (const byte) init_sprites::toD0181_return#0 -- _deref_pbuc1=vbuc2 + //SEG45 [27] *((const byte*) D018#0) ← (const byte) init_sprites::toD0181_return#0 -- _deref_pbuc1=vbuc2 lda #toD0181_return sta D018 - //SEG53 [33] *((const byte*) SPRITES_ENABLE#0) ← (byte/signed byte/word/signed word/dword/signed dword) 15 -- _deref_pbuc1=vbuc2 + //SEG46 [28] *((const byte*) SPRITES_ENABLE#0) ← (byte/signed byte/word/signed word/dword/signed dword) 15 -- _deref_pbuc1=vbuc2 lda #$f sta SPRITES_ENABLE - //SEG54 [34] *((const byte*) SPRITES_MC#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2 + //SEG47 [29] *((const byte*) SPRITES_MC#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2 lda #0 sta SPRITES_MC - //SEG55 [35] *((const byte*) SPRITES_EXPAND_Y#0) ← *((const byte*) SPRITES_MC#0) -- _deref_pbuc1=_deref_pbuc2 + //SEG48 [30] *((const byte*) SPRITES_EXPAND_Y#0) ← *((const byte*) SPRITES_MC#0) -- _deref_pbuc1=_deref_pbuc2 lda SPRITES_MC sta SPRITES_EXPAND_Y - //SEG56 [36] *((const byte*) SPRITES_EXPAND_X#0) ← *((const byte*) SPRITES_EXPAND_Y#0) -- _deref_pbuc1=_deref_pbuc2 + //SEG49 [31] *((const byte*) SPRITES_EXPAND_X#0) ← *((const byte*) SPRITES_EXPAND_Y#0) -- _deref_pbuc1=_deref_pbuc2 lda SPRITES_EXPAND_Y sta SPRITES_EXPAND_X - //SEG57 [37] phi from init_sprites::@4 to init_sprites::@1 [phi:init_sprites::@4->init_sprites::@1] + //SEG50 [32] phi from init_sprites::@4 to init_sprites::@1 [phi:init_sprites::@4->init_sprites::@1] b1_from_b4: - //SEG58 [37] phi (byte) init_sprites::xpos#2 = (byte/signed byte/word/signed word/dword/signed dword) 24+(byte/signed byte/word/signed word/dword/signed dword) 14*(byte/signed byte/word/signed word/dword/signed dword) 8 [phi:init_sprites::@4->init_sprites::@1#0] -- vbuz1=vbuc1 + //SEG51 [32] phi (byte) init_sprites::xpos#2 = (byte/signed byte/word/signed word/dword/signed dword) 24+(byte/signed byte/word/signed word/dword/signed dword) 14*(byte/signed byte/word/signed word/dword/signed dword) 8 [phi:init_sprites::@4->init_sprites::@1#0] -- vbuz1=vbuc1 lda #$18+$e*8 sta xpos - //SEG59 [37] phi (byte) init_sprites::s#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:init_sprites::@4->init_sprites::@1#1] -- vbuxx=vbuc1 + //SEG52 [32] phi (byte) init_sprites::s#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:init_sprites::@4->init_sprites::@1#1] -- vbuxx=vbuc1 ldx #0 jmp b1 - //SEG60 [37] phi from init_sprites::@1 to init_sprites::@1 [phi:init_sprites::@1->init_sprites::@1] + //SEG53 [32] phi from init_sprites::@1 to init_sprites::@1 [phi:init_sprites::@1->init_sprites::@1] b1_from_b1: - //SEG61 [37] phi (byte) init_sprites::xpos#2 = (byte) init_sprites::xpos#1 [phi:init_sprites::@1->init_sprites::@1#0] -- register_copy - //SEG62 [37] phi (byte) init_sprites::s#2 = (byte) init_sprites::s#1 [phi:init_sprites::@1->init_sprites::@1#1] -- register_copy + //SEG54 [32] phi (byte) init_sprites::xpos#2 = (byte) init_sprites::xpos#1 [phi:init_sprites::@1->init_sprites::@1#0] -- register_copy + //SEG55 [32] phi (byte) init_sprites::s#2 = (byte) init_sprites::s#1 [phi:init_sprites::@1->init_sprites::@1#1] -- register_copy jmp b1 - //SEG63 init_sprites::@1 + //SEG56 init_sprites::@1 b1: - //SEG64 [38] (byte) init_sprites::s2#0 ← (byte) init_sprites::s#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuaa=vbuxx_rol_1 + //SEG57 [33] (byte) init_sprites::s2#0 ← (byte) init_sprites::s#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuaa=vbuxx_rol_1 txa asl - //SEG65 [39] *((const byte*) SPRITES_XPOS#0 + (byte) init_sprites::s2#0) ← (byte) init_sprites::xpos#2 -- pbuc1_derefidx_vbuaa=vbuz1 + //SEG58 [34] *((const byte*) SPRITES_XPOS#0 + (byte) init_sprites::s2#0) ← (byte) init_sprites::xpos#2 -- pbuc1_derefidx_vbuaa=vbuz1 tay lda xpos sta SPRITES_XPOS,y - //SEG66 [40] *((const byte*) SPRITES_COLS#0 + (byte) init_sprites::s#2) ← (const byte) BLACK#0 -- pbuc1_derefidx_vbuxx=vbuc2 + //SEG59 [35] *((const byte*) SPRITES_COLS#0 + (byte) init_sprites::s#2) ← (const byte) BLACK#0 -- pbuc1_derefidx_vbuxx=vbuc2 lda #BLACK sta SPRITES_COLS,x - //SEG67 [41] (byte) init_sprites::xpos#1 ← (byte) init_sprites::xpos#2 + (byte/signed byte/word/signed word/dword/signed dword) 24 -- vbuz1=vbuz1_plus_vbuc1 + //SEG60 [36] (byte) init_sprites::xpos#1 ← (byte) init_sprites::xpos#2 + (byte/signed byte/word/signed word/dword/signed dword) 24 -- vbuz1=vbuz1_plus_vbuc1 lda #$18 clc adc xpos sta xpos - //SEG68 [42] (byte) init_sprites::s#1 ← ++ (byte) init_sprites::s#2 -- vbuxx=_inc_vbuxx + //SEG61 [37] (byte) init_sprites::s#1 ← ++ (byte) init_sprites::s#2 -- vbuxx=_inc_vbuxx inx - //SEG69 [43] if((byte) init_sprites::s#1!=(byte/signed byte/word/signed word/dword/signed dword) 4) goto init_sprites::@1 -- vbuxx_neq_vbuc1_then_la1 + //SEG62 [38] if((byte) init_sprites::s#1!=(byte/signed byte/word/signed word/dword/signed dword) 4) goto init_sprites::@1 -- vbuxx_neq_vbuc1_then_la1 cpx #4 bne b1_from_b1 jmp breturn - //SEG70 init_sprites::@return + //SEG63 init_sprites::@return breturn: - //SEG71 [44] return + //SEG64 [39] return rts } -//SEG72 irq +//SEG65 irq irq: { .const toSpritePtr2_return = PLAYFIELD_SPRITES>>6 - //SEG73 entry interrupt(KERNEL_MIN) - //SEG74 [45] *((const byte*) BORDERCOL#0) ← (const byte) DARK_GREY#0 -- _deref_pbuc1=vbuc2 + //SEG66 entry interrupt(KERNEL_MIN) + //SEG67 [40] *((const byte*) BORDERCOL#0) ← (const byte) DARK_GREY#0 -- _deref_pbuc1=vbuc2 lda #DARK_GREY sta BORDERCOL - //SEG75 [46] *((const byte*) SPRITES_YPOS#0) ← (byte) irq_sprite_ypos#2 -- _deref_pbuc1=vbuz1 + //SEG68 [41] *((const byte*) SPRITES_YPOS#0) ← (byte) irq_sprite_ypos#0 -- _deref_pbuc1=vbuz1 lda irq_sprite_ypos sta SPRITES_YPOS - //SEG76 [47] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte) irq_sprite_ypos#2 -- _deref_pbuc1=vbuz1 + //SEG69 [42] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte) irq_sprite_ypos#0 -- _deref_pbuc1=vbuz1 lda irq_sprite_ypos sta SPRITES_YPOS+2 - //SEG77 [48] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 4) ← (byte) irq_sprite_ypos#2 -- _deref_pbuc1=vbuz1 + //SEG70 [43] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 4) ← (byte) irq_sprite_ypos#0 -- _deref_pbuc1=vbuz1 lda irq_sprite_ypos sta SPRITES_YPOS+4 - //SEG78 [49] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 6) ← (byte) irq_sprite_ypos#2 -- _deref_pbuc1=vbuz1 + //SEG71 [44] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 6) ← (byte) irq_sprite_ypos#0 -- _deref_pbuc1=vbuz1 lda irq_sprite_ypos sta SPRITES_YPOS+6 jmp b1 - //SEG79 irq::@1 + //SEG72 irq::@1 b1: - //SEG80 [50] if(*((const byte*) RASTER#0)!=(byte) irq_sprite_ypos#2) goto irq::@1 -- _deref_pbuc1_neq_vbuz1_then_la1 + //SEG73 [45] if(*((const byte*) RASTER#0)!=(byte) irq_sprite_ypos#0) goto irq::@1 -- _deref_pbuc1_neq_vbuz1_then_la1 lda RASTER cmp irq_sprite_ypos bne b1 jmp b4 - //SEG81 irq::@4 + //SEG74 irq::@4 b4: - //SEG82 [51] (byte) irq::ptr#0 ← (byte) irq_sprite_ptr#2 -- vbuxx=vbuz1 + //SEG75 [46] (byte) irq::ptr#0 ← (byte) irq_sprite_ptr#0 -- vbuxx=vbuz1 ldx irq_sprite_ptr - //SEG83 [52] *((const byte*) PLAYFIELD_SPRITE_PTRS#0) ← (byte) irq::ptr#0 -- _deref_pbuc1=vbuxx + //SEG76 [47] *((const byte*) PLAYFIELD_SPRITE_PTRS#0) ← (byte) irq::ptr#0 -- _deref_pbuc1=vbuxx stx PLAYFIELD_SPRITE_PTRS - //SEG84 [53] (byte) irq::ptr#1 ← ++ (byte) irq::ptr#0 -- vbuxx=_inc_vbuxx + //SEG77 [48] (byte) irq::ptr#1 ← ++ (byte) irq::ptr#0 -- vbuxx=_inc_vbuxx inx - //SEG85 [54] *((const byte*) PLAYFIELD_SPRITE_PTRS#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte) irq::ptr#1 -- _deref_pbuc1=vbuxx + //SEG78 [49] *((const byte*) PLAYFIELD_SPRITE_PTRS#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte) irq::ptr#1 -- _deref_pbuc1=vbuxx stx PLAYFIELD_SPRITE_PTRS+1 - //SEG86 [55] *((const byte*) PLAYFIELD_SPRITE_PTRS#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte) irq::ptr#1 -- _deref_pbuc1=vbuxx + //SEG79 [50] *((const byte*) PLAYFIELD_SPRITE_PTRS#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte) irq::ptr#1 -- _deref_pbuc1=vbuxx stx PLAYFIELD_SPRITE_PTRS+2 - //SEG87 [56] (byte) irq::ptr#2 ← ++ (byte) irq::ptr#1 -- vbuxx=_inc_vbuxx + //SEG80 [51] (byte) irq::ptr#2 ← ++ (byte) irq::ptr#1 -- vbuxx=_inc_vbuxx inx - //SEG88 [57] *((const byte*) PLAYFIELD_SPRITE_PTRS#0+(byte/signed byte/word/signed word/dword/signed dword) 3) ← (byte) irq::ptr#2 -- _deref_pbuc1=vbuxx + //SEG81 [52] *((const byte*) PLAYFIELD_SPRITE_PTRS#0+(byte/signed byte/word/signed word/dword/signed dword) 3) ← (byte) irq::ptr#2 -- _deref_pbuc1=vbuxx stx PLAYFIELD_SPRITE_PTRS+3 - //SEG89 [58] (byte) irq_cnt#23 ← ++ (byte) irq_cnt#19 -- vbuz1=_inc_vbuz1 + //SEG82 [53] (byte) irq_cnt#1 ← ++ (byte) irq_cnt#0 -- vbuz1=_inc_vbuz1 inc irq_cnt - //SEG90 [59] if((byte) irq_cnt#23==(byte/signed byte/word/signed word/dword/signed dword) 10) goto irq::@2 -- vbuz1_eq_vbuc1_then_la1 + //SEG83 [54] if((byte) irq_cnt#1==(byte/signed byte/word/signed word/dword/signed dword) 10) goto irq::@2 -- vbuz1_eq_vbuc1_then_la1 lda irq_cnt cmp #$a beq b2 jmp b5 - //SEG91 irq::@5 + //SEG84 irq::@5 b5: - //SEG92 [60] (byte) irq_raster_next#6 ← (byte) irq_raster_next#2 + (byte/signed byte/word/signed word/dword/signed dword) 21 -- vbuz1=vbuz1_plus_vbuc1 + //SEG85 [55] (byte) irq_raster_next#2 ← (byte) irq_raster_next#0 + (byte/signed byte/word/signed word/dword/signed dword) 21 -- vbuz1=vbuz1_plus_vbuc1 lda #$15 clc adc irq_raster_next sta irq_raster_next - //SEG93 [61] (byte) irq_sprite_ypos#6 ← (byte) irq_sprite_ypos#2 + (byte/signed byte/word/signed word/dword/signed dword) 21 -- vbuz1=vbuz1_plus_vbuc1 + //SEG86 [56] (byte) irq_sprite_ypos#2 ← (byte) irq_sprite_ypos#0 + (byte/signed byte/word/signed word/dword/signed dword) 21 -- vbuz1=vbuz1_plus_vbuc1 lda #$15 clc adc irq_sprite_ypos sta irq_sprite_ypos - //SEG94 [62] (byte) irq_sprite_ptr#6 ← (byte) irq_sprite_ptr#2 + (byte/signed byte/word/signed word/dword/signed dword) 3 -- vbuz1=vbuz1_plus_vbuc1 + //SEG87 [57] (byte) irq_sprite_ptr#2 ← (byte) irq_sprite_ptr#0 + (byte/signed byte/word/signed word/dword/signed dword) 3 -- vbuz1=vbuz1_plus_vbuc1 lda #3 clc adc irq_sprite_ptr sta irq_sprite_ptr - //SEG95 [63] phi from irq::@5 irq::@7 to irq::@3 [phi:irq::@5/irq::@7->irq::@3] + //SEG88 [58] phi from irq::@5 irq::@7 to irq::@3 [phi:irq::@5/irq::@7->irq::@3] b3_from_b5: b3_from_b7: - //SEG96 [63] phi (byte) irq_raster_next#13 = (byte) irq_raster_next#6 [phi:irq::@5/irq::@7->irq::@3#0] -- register_copy + //SEG89 [58] phi (byte) irq_raster_next#3 = (byte) irq_raster_next#2 [phi:irq::@5/irq::@7->irq::@3#0] -- register_copy jmp b3 - //SEG97 irq::@3 + //SEG90 irq::@3 b3: - //SEG98 [64] *((const byte*) RASTER#0) ← (byte) irq_raster_next#13 -- _deref_pbuc1=vbuz1 + //SEG91 [59] *((const byte*) RASTER#0) ← (byte) irq_raster_next#3 -- _deref_pbuc1=vbuz1 lda irq_raster_next sta RASTER - //SEG99 [65] *((const byte*) IRQ_STATUS#0) ← (const byte) IRQ_RASTER#0 -- _deref_pbuc1=vbuc2 + //SEG92 [60] *((const byte*) IRQ_STATUS#0) ← (const byte) IRQ_RASTER#0 -- _deref_pbuc1=vbuc2 lda #IRQ_RASTER sta IRQ_STATUS - //SEG100 [66] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 -- _deref_pbuc1=vbuc2 + //SEG93 [61] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 -- _deref_pbuc1=vbuc2 lda #BLACK sta BORDERCOL jmp breturn - //SEG101 irq::@return + //SEG94 irq::@return breturn: - //SEG102 [67] return - exit interrupt(KERNEL_MIN) + //SEG95 [62] return - exit interrupt(KERNEL_MIN) jmp $ea81 - //SEG103 irq::@2 + //SEG96 irq::@2 b2: - //SEG104 [68] (byte) irq_cnt#24 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1 + //SEG97 [63] (byte) irq_cnt#10 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1 lda #0 sta irq_cnt - //SEG105 [69] (byte) irq_raster_next#20 ← (const byte) IRQ_RASTER_FIRST#0 -- vbuz1=vbuc1 + //SEG98 [64] (byte) irq_raster_next#1 ← (const byte) IRQ_RASTER_FIRST#0 -- vbuz1=vbuc1 lda #IRQ_RASTER_FIRST sta irq_raster_next - //SEG106 [70] (byte) irq_sprite_ypos#26 ← (byte/signed byte/word/signed word/dword/signed dword) 50 -- vbuz1=vbuc1 + //SEG99 [65] (byte) irq_sprite_ypos#1 ← (byte/signed byte/word/signed word/dword/signed dword) 50 -- vbuz1=vbuc1 lda #$32 sta irq_sprite_ypos - //SEG107 [71] phi from irq::@2 to irq::toSpritePtr2 [phi:irq::@2->irq::toSpritePtr2] + //SEG100 [66] phi from irq::@2 to irq::toSpritePtr2 [phi:irq::@2->irq::toSpritePtr2] toSpritePtr2_from_b2: jmp toSpritePtr2 - //SEG108 irq::toSpritePtr2 + //SEG101 irq::toSpritePtr2 toSpritePtr2: jmp b7 - //SEG109 irq::@7 + //SEG102 irq::@7 b7: - //SEG110 [72] (byte) irq_sprite_ptr#5 ← (const byte) irq::toSpritePtr2_return#0 -- vbuz1=vbuc1 + //SEG103 [67] (byte) irq_sprite_ptr#1 ← (const byte) irq::toSpritePtr2_return#0 -- vbuz1=vbuc1 lda #toSpritePtr2_return sta irq_sprite_ptr jmp b3_from_b7 @@ -2514,8 +2200,6 @@ Removing instruction jmp b8 Removing instruction jmp bend Removing instruction jmp b7 Removing instruction jmp b2 -Removing instruction jmp toSpritePtr2 -Removing instruction jmp b1 Removing instruction jmp breturn Removing instruction jmp vicSelectGfxBank1 Removing instruction jmp vicSelectGfxBank1_toDd001 @@ -2537,14 +2221,12 @@ Removing instruction lda SPRITES_EXPAND_Y Succesful ASM optimization Pass5UnnecesaryLoadElimination Replacing label b1_from_b1 with b1 Replacing label b3_from_b7 with b3 -Removing instruction bbegin: +Removing instruction b6: Removing instruction toSpritePtr1_from_b6: Removing instruction toSpritePtr1: Removing instruction main_from_b8: Removing instruction bend_from_b8: Removing instruction b7_from_main: -Removing instruction toSpritePtr2_from_init_irq: -Removing instruction toSpritePtr2: Removing instruction vicSelectGfxBank1_toDd001_from_vicSelectGfxBank1: Removing instruction vicSelectGfxBank1_toDd001: Removing instruction toD0181_from_vicSelectGfxBank1_b1: @@ -2555,13 +2237,11 @@ Removing instruction b3_from_b7: Removing instruction toSpritePtr2_from_b2: Removing instruction toSpritePtr2: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b6: Removing instruction b9: Removing instruction b8: Removing instruction bend: Removing instruction init_sprites_from_main: Removing instruction b7: -Removing instruction b1: Removing instruction breturn: Removing instruction vicSelectGfxBank1: Removing instruction vicSelectGfxBank1_b1: @@ -2694,15 +2374,7 @@ FINAL SYMBOL TABLE (byte) WHITE (byte) YELLOW (void()) init_irq() -(label) init_irq::@1 (label) init_irq::@return -(label) init_irq::toSpritePtr2 -(word~) init_irq::toSpritePtr2_$0 -(word~) init_irq::toSpritePtr2_$1 -(byte~) init_irq::toSpritePtr2_$2 -(byte) init_irq::toSpritePtr2_return -(const byte) init_irq::toSpritePtr2_return#0 toSpritePtr2_return = ((byte))((word))(const byte*) PLAYFIELD_SPRITES#0>>(byte/signed byte/word/signed word/dword/signed dword) 6 -(byte*) init_irq::toSpritePtr2_sprite (void()) init_sprites() (label) init_sprites::@1 (label) init_sprites::@4 @@ -2761,26 +2433,22 @@ interrupt(KERNEL_MIN)(void()) irq() (const byte) irq::toSpritePtr2_return#0 toSpritePtr2_return = ((byte))((word))(const byte*) PLAYFIELD_SPRITES#0>>(byte/signed byte/word/signed word/dword/signed dword) 6 (byte*) irq::toSpritePtr2_sprite (byte) irq_cnt -(byte) irq_cnt#11 irq_cnt zp ZP_BYTE:6 20.0 -(byte) irq_cnt#19 irq_cnt zp ZP_BYTE:6 0.3076923076923077 -(byte) irq_cnt#23 irq_cnt zp ZP_BYTE:6 4.0 -(byte) irq_cnt#24 irq_cnt zp ZP_BYTE:6 20.0 +(byte) irq_cnt#0 irq_cnt zp ZP_BYTE:6 0.3076923076923077 +(byte) irq_cnt#1 irq_cnt zp ZP_BYTE:6 4.0 +(byte) irq_cnt#10 irq_cnt zp ZP_BYTE:6 20.0 (byte) irq_raster_next -(byte) irq_raster_next#11 irq_raster_next zp ZP_BYTE:3 20.0 -(byte) irq_raster_next#13 irq_raster_next zp ZP_BYTE:3 6.0 -(byte) irq_raster_next#2 irq_raster_next zp ZP_BYTE:3 0.26666666666666666 -(byte) irq_raster_next#20 irq_raster_next zp ZP_BYTE:3 1.0 -(byte) irq_raster_next#6 irq_raster_next zp ZP_BYTE:3 1.3333333333333333 +(byte) irq_raster_next#0 irq_raster_next zp ZP_BYTE:3 0.26666666666666666 +(byte) irq_raster_next#1 irq_raster_next zp ZP_BYTE:3 1.0 +(byte) irq_raster_next#2 irq_raster_next zp ZP_BYTE:3 1.3333333333333333 +(byte) irq_raster_next#3 irq_raster_next zp ZP_BYTE:3 6.0 (byte) irq_sprite_ptr -(byte) irq_sprite_ptr#2 irq_sprite_ptr zp ZP_BYTE:5 0.3529411764705882 -(byte) irq_sprite_ptr#3 irq_sprite_ptr zp ZP_BYTE:5 20.0 -(byte) irq_sprite_ptr#5 irq_sprite_ptr zp ZP_BYTE:5 20.0 -(byte) irq_sprite_ptr#6 irq_sprite_ptr zp ZP_BYTE:5 20.0 +(byte) irq_sprite_ptr#0 irq_sprite_ptr zp ZP_BYTE:5 0.3529411764705882 +(byte) irq_sprite_ptr#1 irq_sprite_ptr zp ZP_BYTE:5 20.0 +(byte) irq_sprite_ptr#2 irq_sprite_ptr zp ZP_BYTE:5 20.0 (byte) irq_sprite_ypos -(byte) irq_sprite_ypos#11 irq_sprite_ypos zp ZP_BYTE:4 20.0 -(byte) irq_sprite_ypos#2 irq_sprite_ypos zp ZP_BYTE:4 1.4375 -(byte) irq_sprite_ypos#26 irq_sprite_ypos zp ZP_BYTE:4 20.0 -(byte) irq_sprite_ypos#6 irq_sprite_ypos zp ZP_BYTE:4 20.0 +(byte) irq_sprite_ypos#0 irq_sprite_ypos zp ZP_BYTE:4 1.4375 +(byte) irq_sprite_ypos#1 irq_sprite_ypos zp ZP_BYTE:4 20.0 +(byte) irq_sprite_ypos#2 irq_sprite_ypos zp ZP_BYTE:4 20.0 (void()) main() (label) main::@2 (label) main::@7 @@ -2794,10 +2462,10 @@ interrupt(KERNEL_MIN)(void()) irq() reg byte x [ init_sprites::s#2 init_sprites::s#1 ] zp ZP_BYTE:2 [ init_sprites::xpos#2 init_sprites::xpos#1 ] -zp ZP_BYTE:3 [ irq_raster_next#13 irq_raster_next#6 irq_raster_next#20 irq_raster_next#2 irq_raster_next#11 ] -zp ZP_BYTE:4 [ irq_sprite_ypos#2 irq_sprite_ypos#6 irq_sprite_ypos#11 irq_sprite_ypos#26 ] -zp ZP_BYTE:5 [ irq_sprite_ptr#2 irq_sprite_ptr#6 irq_sprite_ptr#3 irq_sprite_ptr#5 ] -zp ZP_BYTE:6 [ irq_cnt#19 irq_cnt#23 irq_cnt#11 irq_cnt#24 ] +zp ZP_BYTE:3 [ irq_raster_next#3 irq_raster_next#2 irq_raster_next#1 irq_raster_next#0 ] +zp ZP_BYTE:4 [ irq_sprite_ypos#0 irq_sprite_ypos#2 irq_sprite_ypos#1 ] +zp ZP_BYTE:5 [ irq_sprite_ptr#0 irq_sprite_ptr#2 irq_sprite_ptr#1 ] +zp ZP_BYTE:6 [ irq_cnt#0 irq_cnt#1 irq_cnt#10 ] reg byte a [ init_sprites::s2#0 ] reg byte x [ irq::ptr#0 ] reg byte x [ irq::ptr#1 ] @@ -2805,11 +2473,11 @@ reg byte x [ irq::ptr#2 ] FINAL ASSEMBLER -Score: 1182 +Score: 1162 //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .const SPRITE_PTRS = $3f8 @@ -2845,20 +2513,21 @@ Score: 1182 .label irq_sprite_ptr = 5 .label irq_cnt = 6 //SEG2 @begin +bbegin: //SEG3 @6 -//SEG4 [1] (byte) irq_raster_next#2 ← (const byte) IRQ_RASTER_FIRST#0 -- vbuz1=vbuc1 +//SEG4 [1] (byte) irq_raster_next#0 ← (const byte) IRQ_RASTER_FIRST#0 -- vbuz1=vbuc1 lda #IRQ_RASTER_FIRST sta irq_raster_next -//SEG5 [2] (byte) irq_sprite_ypos#2 ← (byte/signed byte/word/signed word/dword/signed dword) 50 -- vbuz1=vbuc1 +//SEG5 [2] (byte) irq_sprite_ypos#0 ← (byte/signed byte/word/signed word/dword/signed dword) 50 -- vbuz1=vbuc1 lda #$32 sta irq_sprite_ypos //SEG6 [3] phi from @6 to toSpritePtr1 [phi:@6->toSpritePtr1] //SEG7 toSpritePtr1 //SEG8 @9 -//SEG9 [4] (byte) irq_sprite_ptr#2 ← (const byte) toSpritePtr1_return#0 -- vbuz1=vbuc1 +//SEG9 [4] (byte) irq_sprite_ptr#0 ← (const byte) toSpritePtr1_return#0 -- vbuz1=vbuc1 lda #toSpritePtr1_return sta irq_sprite_ptr -//SEG10 [5] (byte) irq_cnt#19 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1 +//SEG10 [5] (byte) irq_cnt#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1 lda #0 sta irq_cnt //SEG11 @8 @@ -2871,7 +2540,7 @@ Score: 1182 //SEG17 main main: { //SEG18 [10] call init_sprites - //SEG19 [27] phi from main to init_sprites [phi:main->init_sprites] + //SEG19 [22] phi from main to init_sprites [phi:main->init_sprites] jsr init_sprites //SEG20 [11] phi from main to main::@7 [phi:main->main::@7] //SEG21 main::@7 @@ -2885,207 +2554,191 @@ main: { } //SEG25 init_irq init_irq: { - .const toSpritePtr2_return = PLAYFIELD_SPRITES>>6 - //SEG26 [14] (byte) irq_raster_next#11 ← (const byte) IRQ_RASTER_FIRST#0 -- vbuz1=vbuc1 - lda #IRQ_RASTER_FIRST - sta irq_raster_next - //SEG27 [15] (byte) irq_sprite_ypos#11 ← (byte/signed byte/word/signed word/dword/signed dword) 50 -- vbuz1=vbuc1 - lda #$32 - sta irq_sprite_ypos - //SEG28 [16] phi from init_irq to init_irq::toSpritePtr2 [phi:init_irq->init_irq::toSpritePtr2] - //SEG29 init_irq::toSpritePtr2 - //SEG30 init_irq::@1 - //SEG31 [17] (byte) irq_sprite_ptr#3 ← (const byte) init_irq::toSpritePtr2_return#0 -- vbuz1=vbuc1 - lda #toSpritePtr2_return - sta irq_sprite_ptr - //SEG32 [18] (byte) irq_cnt#11 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1 - lda #0 - sta irq_cnt - //SEG33 asm { sei } + //SEG26 asm { sei } sei - //SEG34 [20] *((const byte*) CIA1_INTERRUPT#0) ← (const byte) CIA_INTERRUPT_CLEAR#0 -- _deref_pbuc1=vbuc2 + //SEG27 [15] *((const byte*) CIA1_INTERRUPT#0) ← (const byte) CIA_INTERRUPT_CLEAR#0 -- _deref_pbuc1=vbuc2 lda #CIA_INTERRUPT_CLEAR sta CIA1_INTERRUPT - //SEG35 [21] *((const byte*) VIC_CONTROL#0) ← *((const byte*) VIC_CONTROL#0) & (byte/signed byte/word/signed word/dword/signed dword) 127 -- _deref_pbuc1=_deref_pbuc1_band_vbuc2 + //SEG28 [16] *((const byte*) VIC_CONTROL#0) ← *((const byte*) VIC_CONTROL#0) & (byte/signed byte/word/signed word/dword/signed dword) 127 -- _deref_pbuc1=_deref_pbuc1_band_vbuc2 lda VIC_CONTROL and #$7f sta VIC_CONTROL - //SEG36 [22] *((const byte*) RASTER#0) ← (const byte) IRQ_RASTER_FIRST#0 -- _deref_pbuc1=vbuc2 + //SEG29 [17] *((const byte*) RASTER#0) ← (const byte) IRQ_RASTER_FIRST#0 -- _deref_pbuc1=vbuc2 lda #IRQ_RASTER_FIRST sta RASTER - //SEG37 [23] *((const byte*) IRQ_ENABLE#0) ← (const byte) IRQ_RASTER#0 -- _deref_pbuc1=vbuc2 + //SEG30 [18] *((const byte*) IRQ_ENABLE#0) ← (const byte) IRQ_RASTER#0 -- _deref_pbuc1=vbuc2 lda #IRQ_RASTER sta IRQ_ENABLE - //SEG38 [24] *((const void()**) KERNEL_IRQ#0) ← &interrupt(KERNEL_MIN)(void()) irq() -- _deref_pptc1=pprc2 + //SEG31 [19] *((const void()**) KERNEL_IRQ#0) ← &interrupt(KERNEL_MIN)(void()) irq() -- _deref_pptc1=pprc2 lda #irq sta KERNEL_IRQ+1 - //SEG39 asm { cli } + //SEG32 asm { cli } cli - //SEG40 init_irq::@return - //SEG41 [26] return + //SEG33 init_irq::@return + //SEG34 [21] return rts } -//SEG42 init_sprites +//SEG35 init_sprites init_sprites: { .const vicSelectGfxBank1_toDd001_return = 3^(>PLAYFIELD_SCREEN)>>6 .const toD0181_return = (>(PLAYFIELD_SCREEN&$3fff)<<2)|(>PLAYFIELD_CHARSET)>>2&$f .label xpos = 2 - //SEG43 init_sprites::vicSelectGfxBank1 - //SEG44 [28] *((const byte*) CIA2_PORT_A_DDR#0) ← (byte/signed byte/word/signed word/dword/signed dword) 3 -- _deref_pbuc1=vbuc2 + //SEG36 init_sprites::vicSelectGfxBank1 + //SEG37 [23] *((const byte*) CIA2_PORT_A_DDR#0) ← (byte/signed byte/word/signed word/dword/signed dword) 3 -- _deref_pbuc1=vbuc2 lda #3 sta CIA2_PORT_A_DDR - //SEG45 [29] phi from init_sprites::vicSelectGfxBank1 to init_sprites::vicSelectGfxBank1_toDd001 [phi:init_sprites::vicSelectGfxBank1->init_sprites::vicSelectGfxBank1_toDd001] - //SEG46 init_sprites::vicSelectGfxBank1_toDd001 - //SEG47 init_sprites::vicSelectGfxBank1_@1 - //SEG48 [30] *((const byte*) CIA2_PORT_A#0) ← (const byte) init_sprites::vicSelectGfxBank1_toDd001_return#0 -- _deref_pbuc1=vbuc2 + //SEG38 [24] phi from init_sprites::vicSelectGfxBank1 to init_sprites::vicSelectGfxBank1_toDd001 [phi:init_sprites::vicSelectGfxBank1->init_sprites::vicSelectGfxBank1_toDd001] + //SEG39 init_sprites::vicSelectGfxBank1_toDd001 + //SEG40 init_sprites::vicSelectGfxBank1_@1 + //SEG41 [25] *((const byte*) CIA2_PORT_A#0) ← (const byte) init_sprites::vicSelectGfxBank1_toDd001_return#0 -- _deref_pbuc1=vbuc2 lda #vicSelectGfxBank1_toDd001_return sta CIA2_PORT_A - //SEG49 [31] phi from init_sprites::vicSelectGfxBank1_@1 to init_sprites::toD0181 [phi:init_sprites::vicSelectGfxBank1_@1->init_sprites::toD0181] - //SEG50 init_sprites::toD0181 - //SEG51 init_sprites::@4 - //SEG52 [32] *((const byte*) D018#0) ← (const byte) init_sprites::toD0181_return#0 -- _deref_pbuc1=vbuc2 + //SEG42 [26] phi from init_sprites::vicSelectGfxBank1_@1 to init_sprites::toD0181 [phi:init_sprites::vicSelectGfxBank1_@1->init_sprites::toD0181] + //SEG43 init_sprites::toD0181 + //SEG44 init_sprites::@4 + //SEG45 [27] *((const byte*) D018#0) ← (const byte) init_sprites::toD0181_return#0 -- _deref_pbuc1=vbuc2 lda #toD0181_return sta D018 - //SEG53 [33] *((const byte*) SPRITES_ENABLE#0) ← (byte/signed byte/word/signed word/dword/signed dword) 15 -- _deref_pbuc1=vbuc2 + //SEG46 [28] *((const byte*) SPRITES_ENABLE#0) ← (byte/signed byte/word/signed word/dword/signed dword) 15 -- _deref_pbuc1=vbuc2 lda #$f sta SPRITES_ENABLE - //SEG54 [34] *((const byte*) SPRITES_MC#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2 + //SEG47 [29] *((const byte*) SPRITES_MC#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2 lda #0 sta SPRITES_MC - //SEG55 [35] *((const byte*) SPRITES_EXPAND_Y#0) ← *((const byte*) SPRITES_MC#0) -- _deref_pbuc1=_deref_pbuc2 + //SEG48 [30] *((const byte*) SPRITES_EXPAND_Y#0) ← *((const byte*) SPRITES_MC#0) -- _deref_pbuc1=_deref_pbuc2 sta SPRITES_EXPAND_Y - //SEG56 [36] *((const byte*) SPRITES_EXPAND_X#0) ← *((const byte*) SPRITES_EXPAND_Y#0) -- _deref_pbuc1=_deref_pbuc2 + //SEG49 [31] *((const byte*) SPRITES_EXPAND_X#0) ← *((const byte*) SPRITES_EXPAND_Y#0) -- _deref_pbuc1=_deref_pbuc2 sta SPRITES_EXPAND_X - //SEG57 [37] phi from init_sprites::@4 to init_sprites::@1 [phi:init_sprites::@4->init_sprites::@1] - //SEG58 [37] phi (byte) init_sprites::xpos#2 = (byte/signed byte/word/signed word/dword/signed dword) 24+(byte/signed byte/word/signed word/dword/signed dword) 14*(byte/signed byte/word/signed word/dword/signed dword) 8 [phi:init_sprites::@4->init_sprites::@1#0] -- vbuz1=vbuc1 + //SEG50 [32] phi from init_sprites::@4 to init_sprites::@1 [phi:init_sprites::@4->init_sprites::@1] + //SEG51 [32] phi (byte) init_sprites::xpos#2 = (byte/signed byte/word/signed word/dword/signed dword) 24+(byte/signed byte/word/signed word/dword/signed dword) 14*(byte/signed byte/word/signed word/dword/signed dword) 8 [phi:init_sprites::@4->init_sprites::@1#0] -- vbuz1=vbuc1 lda #$18+$e*8 sta xpos - //SEG59 [37] phi (byte) init_sprites::s#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:init_sprites::@4->init_sprites::@1#1] -- vbuxx=vbuc1 + //SEG52 [32] phi (byte) init_sprites::s#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:init_sprites::@4->init_sprites::@1#1] -- vbuxx=vbuc1 ldx #0 - //SEG60 [37] phi from init_sprites::@1 to init_sprites::@1 [phi:init_sprites::@1->init_sprites::@1] - //SEG61 [37] phi (byte) init_sprites::xpos#2 = (byte) init_sprites::xpos#1 [phi:init_sprites::@1->init_sprites::@1#0] -- register_copy - //SEG62 [37] phi (byte) init_sprites::s#2 = (byte) init_sprites::s#1 [phi:init_sprites::@1->init_sprites::@1#1] -- register_copy - //SEG63 init_sprites::@1 + //SEG53 [32] phi from init_sprites::@1 to init_sprites::@1 [phi:init_sprites::@1->init_sprites::@1] + //SEG54 [32] phi (byte) init_sprites::xpos#2 = (byte) init_sprites::xpos#1 [phi:init_sprites::@1->init_sprites::@1#0] -- register_copy + //SEG55 [32] phi (byte) init_sprites::s#2 = (byte) init_sprites::s#1 [phi:init_sprites::@1->init_sprites::@1#1] -- register_copy + //SEG56 init_sprites::@1 b1: - //SEG64 [38] (byte) init_sprites::s2#0 ← (byte) init_sprites::s#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuaa=vbuxx_rol_1 + //SEG57 [33] (byte) init_sprites::s2#0 ← (byte) init_sprites::s#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuaa=vbuxx_rol_1 txa asl - //SEG65 [39] *((const byte*) SPRITES_XPOS#0 + (byte) init_sprites::s2#0) ← (byte) init_sprites::xpos#2 -- pbuc1_derefidx_vbuaa=vbuz1 + //SEG58 [34] *((const byte*) SPRITES_XPOS#0 + (byte) init_sprites::s2#0) ← (byte) init_sprites::xpos#2 -- pbuc1_derefidx_vbuaa=vbuz1 tay lda xpos sta SPRITES_XPOS,y - //SEG66 [40] *((const byte*) SPRITES_COLS#0 + (byte) init_sprites::s#2) ← (const byte) BLACK#0 -- pbuc1_derefidx_vbuxx=vbuc2 + //SEG59 [35] *((const byte*) SPRITES_COLS#0 + (byte) init_sprites::s#2) ← (const byte) BLACK#0 -- pbuc1_derefidx_vbuxx=vbuc2 lda #BLACK sta SPRITES_COLS,x - //SEG67 [41] (byte) init_sprites::xpos#1 ← (byte) init_sprites::xpos#2 + (byte/signed byte/word/signed word/dword/signed dword) 24 -- vbuz1=vbuz1_plus_vbuc1 + //SEG60 [36] (byte) init_sprites::xpos#1 ← (byte) init_sprites::xpos#2 + (byte/signed byte/word/signed word/dword/signed dword) 24 -- vbuz1=vbuz1_plus_vbuc1 lda #$18 clc adc xpos sta xpos - //SEG68 [42] (byte) init_sprites::s#1 ← ++ (byte) init_sprites::s#2 -- vbuxx=_inc_vbuxx + //SEG61 [37] (byte) init_sprites::s#1 ← ++ (byte) init_sprites::s#2 -- vbuxx=_inc_vbuxx inx - //SEG69 [43] if((byte) init_sprites::s#1!=(byte/signed byte/word/signed word/dword/signed dword) 4) goto init_sprites::@1 -- vbuxx_neq_vbuc1_then_la1 + //SEG62 [38] if((byte) init_sprites::s#1!=(byte/signed byte/word/signed word/dword/signed dword) 4) goto init_sprites::@1 -- vbuxx_neq_vbuc1_then_la1 cpx #4 bne b1 - //SEG70 init_sprites::@return - //SEG71 [44] return + //SEG63 init_sprites::@return + //SEG64 [39] return rts } -//SEG72 irq +//SEG65 irq irq: { .const toSpritePtr2_return = PLAYFIELD_SPRITES>>6 - //SEG73 entry interrupt(KERNEL_MIN) - //SEG74 [45] *((const byte*) BORDERCOL#0) ← (const byte) DARK_GREY#0 -- _deref_pbuc1=vbuc2 + //SEG66 entry interrupt(KERNEL_MIN) + //SEG67 [40] *((const byte*) BORDERCOL#0) ← (const byte) DARK_GREY#0 -- _deref_pbuc1=vbuc2 lda #DARK_GREY sta BORDERCOL - //SEG75 [46] *((const byte*) SPRITES_YPOS#0) ← (byte) irq_sprite_ypos#2 -- _deref_pbuc1=vbuz1 + //SEG68 [41] *((const byte*) SPRITES_YPOS#0) ← (byte) irq_sprite_ypos#0 -- _deref_pbuc1=vbuz1 lda irq_sprite_ypos sta SPRITES_YPOS - //SEG76 [47] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte) irq_sprite_ypos#2 -- _deref_pbuc1=vbuz1 + //SEG69 [42] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte) irq_sprite_ypos#0 -- _deref_pbuc1=vbuz1 lda irq_sprite_ypos sta SPRITES_YPOS+2 - //SEG77 [48] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 4) ← (byte) irq_sprite_ypos#2 -- _deref_pbuc1=vbuz1 + //SEG70 [43] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 4) ← (byte) irq_sprite_ypos#0 -- _deref_pbuc1=vbuz1 lda irq_sprite_ypos sta SPRITES_YPOS+4 - //SEG78 [49] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 6) ← (byte) irq_sprite_ypos#2 -- _deref_pbuc1=vbuz1 + //SEG71 [44] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 6) ← (byte) irq_sprite_ypos#0 -- _deref_pbuc1=vbuz1 lda irq_sprite_ypos sta SPRITES_YPOS+6 - //SEG79 irq::@1 + //SEG72 irq::@1 b1: - //SEG80 [50] if(*((const byte*) RASTER#0)!=(byte) irq_sprite_ypos#2) goto irq::@1 -- _deref_pbuc1_neq_vbuz1_then_la1 + //SEG73 [45] if(*((const byte*) RASTER#0)!=(byte) irq_sprite_ypos#0) goto irq::@1 -- _deref_pbuc1_neq_vbuz1_then_la1 lda RASTER cmp irq_sprite_ypos bne b1 - //SEG81 irq::@4 - //SEG82 [51] (byte) irq::ptr#0 ← (byte) irq_sprite_ptr#2 -- vbuxx=vbuz1 + //SEG74 irq::@4 + //SEG75 [46] (byte) irq::ptr#0 ← (byte) irq_sprite_ptr#0 -- vbuxx=vbuz1 ldx irq_sprite_ptr - //SEG83 [52] *((const byte*) PLAYFIELD_SPRITE_PTRS#0) ← (byte) irq::ptr#0 -- _deref_pbuc1=vbuxx + //SEG76 [47] *((const byte*) PLAYFIELD_SPRITE_PTRS#0) ← (byte) irq::ptr#0 -- _deref_pbuc1=vbuxx stx PLAYFIELD_SPRITE_PTRS - //SEG84 [53] (byte) irq::ptr#1 ← ++ (byte) irq::ptr#0 -- vbuxx=_inc_vbuxx + //SEG77 [48] (byte) irq::ptr#1 ← ++ (byte) irq::ptr#0 -- vbuxx=_inc_vbuxx inx - //SEG85 [54] *((const byte*) PLAYFIELD_SPRITE_PTRS#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte) irq::ptr#1 -- _deref_pbuc1=vbuxx + //SEG78 [49] *((const byte*) PLAYFIELD_SPRITE_PTRS#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte) irq::ptr#1 -- _deref_pbuc1=vbuxx stx PLAYFIELD_SPRITE_PTRS+1 - //SEG86 [55] *((const byte*) PLAYFIELD_SPRITE_PTRS#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte) irq::ptr#1 -- _deref_pbuc1=vbuxx + //SEG79 [50] *((const byte*) PLAYFIELD_SPRITE_PTRS#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte) irq::ptr#1 -- _deref_pbuc1=vbuxx stx PLAYFIELD_SPRITE_PTRS+2 - //SEG87 [56] (byte) irq::ptr#2 ← ++ (byte) irq::ptr#1 -- vbuxx=_inc_vbuxx + //SEG80 [51] (byte) irq::ptr#2 ← ++ (byte) irq::ptr#1 -- vbuxx=_inc_vbuxx inx - //SEG88 [57] *((const byte*) PLAYFIELD_SPRITE_PTRS#0+(byte/signed byte/word/signed word/dword/signed dword) 3) ← (byte) irq::ptr#2 -- _deref_pbuc1=vbuxx + //SEG81 [52] *((const byte*) PLAYFIELD_SPRITE_PTRS#0+(byte/signed byte/word/signed word/dword/signed dword) 3) ← (byte) irq::ptr#2 -- _deref_pbuc1=vbuxx stx PLAYFIELD_SPRITE_PTRS+3 - //SEG89 [58] (byte) irq_cnt#23 ← ++ (byte) irq_cnt#19 -- vbuz1=_inc_vbuz1 + //SEG82 [53] (byte) irq_cnt#1 ← ++ (byte) irq_cnt#0 -- vbuz1=_inc_vbuz1 inc irq_cnt - //SEG90 [59] if((byte) irq_cnt#23==(byte/signed byte/word/signed word/dword/signed dword) 10) goto irq::@2 -- vbuz1_eq_vbuc1_then_la1 + //SEG83 [54] if((byte) irq_cnt#1==(byte/signed byte/word/signed word/dword/signed dword) 10) goto irq::@2 -- vbuz1_eq_vbuc1_then_la1 lda irq_cnt cmp #$a beq b2 - //SEG91 irq::@5 - //SEG92 [60] (byte) irq_raster_next#6 ← (byte) irq_raster_next#2 + (byte/signed byte/word/signed word/dword/signed dword) 21 -- vbuz1=vbuz1_plus_vbuc1 + //SEG84 irq::@5 + //SEG85 [55] (byte) irq_raster_next#2 ← (byte) irq_raster_next#0 + (byte/signed byte/word/signed word/dword/signed dword) 21 -- vbuz1=vbuz1_plus_vbuc1 lda #$15 clc adc irq_raster_next sta irq_raster_next - //SEG93 [61] (byte) irq_sprite_ypos#6 ← (byte) irq_sprite_ypos#2 + (byte/signed byte/word/signed word/dword/signed dword) 21 -- vbuz1=vbuz1_plus_vbuc1 + //SEG86 [56] (byte) irq_sprite_ypos#2 ← (byte) irq_sprite_ypos#0 + (byte/signed byte/word/signed word/dword/signed dword) 21 -- vbuz1=vbuz1_plus_vbuc1 lda #$15 clc adc irq_sprite_ypos sta irq_sprite_ypos - //SEG94 [62] (byte) irq_sprite_ptr#6 ← (byte) irq_sprite_ptr#2 + (byte/signed byte/word/signed word/dword/signed dword) 3 -- vbuz1=vbuz1_plus_vbuc1 + //SEG87 [57] (byte) irq_sprite_ptr#2 ← (byte) irq_sprite_ptr#0 + (byte/signed byte/word/signed word/dword/signed dword) 3 -- vbuz1=vbuz1_plus_vbuc1 lda #3 clc adc irq_sprite_ptr sta irq_sprite_ptr - //SEG95 [63] phi from irq::@5 irq::@7 to irq::@3 [phi:irq::@5/irq::@7->irq::@3] - //SEG96 [63] phi (byte) irq_raster_next#13 = (byte) irq_raster_next#6 [phi:irq::@5/irq::@7->irq::@3#0] -- register_copy - //SEG97 irq::@3 + //SEG88 [58] phi from irq::@5 irq::@7 to irq::@3 [phi:irq::@5/irq::@7->irq::@3] + //SEG89 [58] phi (byte) irq_raster_next#3 = (byte) irq_raster_next#2 [phi:irq::@5/irq::@7->irq::@3#0] -- register_copy + //SEG90 irq::@3 b3: - //SEG98 [64] *((const byte*) RASTER#0) ← (byte) irq_raster_next#13 -- _deref_pbuc1=vbuz1 + //SEG91 [59] *((const byte*) RASTER#0) ← (byte) irq_raster_next#3 -- _deref_pbuc1=vbuz1 lda irq_raster_next sta RASTER - //SEG99 [65] *((const byte*) IRQ_STATUS#0) ← (const byte) IRQ_RASTER#0 -- _deref_pbuc1=vbuc2 + //SEG92 [60] *((const byte*) IRQ_STATUS#0) ← (const byte) IRQ_RASTER#0 -- _deref_pbuc1=vbuc2 lda #IRQ_RASTER sta IRQ_STATUS - //SEG100 [66] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 -- _deref_pbuc1=vbuc2 + //SEG93 [61] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 -- _deref_pbuc1=vbuc2 lda #BLACK sta BORDERCOL - //SEG101 irq::@return - //SEG102 [67] return - exit interrupt(KERNEL_MIN) + //SEG94 irq::@return + //SEG95 [62] return - exit interrupt(KERNEL_MIN) jmp $ea81 - //SEG103 irq::@2 + //SEG96 irq::@2 b2: - //SEG104 [68] (byte) irq_cnt#24 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1 + //SEG97 [63] (byte) irq_cnt#10 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1 lda #0 sta irq_cnt - //SEG105 [69] (byte) irq_raster_next#20 ← (const byte) IRQ_RASTER_FIRST#0 -- vbuz1=vbuc1 + //SEG98 [64] (byte) irq_raster_next#1 ← (const byte) IRQ_RASTER_FIRST#0 -- vbuz1=vbuc1 lda #IRQ_RASTER_FIRST sta irq_raster_next - //SEG106 [70] (byte) irq_sprite_ypos#26 ← (byte/signed byte/word/signed word/dword/signed dword) 50 -- vbuz1=vbuc1 + //SEG99 [65] (byte) irq_sprite_ypos#1 ← (byte/signed byte/word/signed word/dword/signed dword) 50 -- vbuz1=vbuc1 lda #$32 sta irq_sprite_ypos - //SEG107 [71] phi from irq::@2 to irq::toSpritePtr2 [phi:irq::@2->irq::toSpritePtr2] - //SEG108 irq::toSpritePtr2 - //SEG109 irq::@7 - //SEG110 [72] (byte) irq_sprite_ptr#5 ← (const byte) irq::toSpritePtr2_return#0 -- vbuz1=vbuc1 + //SEG100 [66] phi from irq::@2 to irq::toSpritePtr2 [phi:irq::@2->irq::toSpritePtr2] + //SEG101 irq::toSpritePtr2 + //SEG102 irq::@7 + //SEG103 [67] (byte) irq_sprite_ptr#1 ← (const byte) irq::toSpritePtr2_return#0 -- vbuz1=vbuc1 lda #toSpritePtr2_return sta irq_sprite_ptr jmp b3 diff --git a/src/test/ref/examples/tetris/test-sprites.sym b/src/test/ref/examples/tetris/test-sprites.sym index 14b8b3af3..e8c234540 100644 --- a/src/test/ref/examples/tetris/test-sprites.sym +++ b/src/test/ref/examples/tetris/test-sprites.sym @@ -115,15 +115,7 @@ (byte) WHITE (byte) YELLOW (void()) init_irq() -(label) init_irq::@1 (label) init_irq::@return -(label) init_irq::toSpritePtr2 -(word~) init_irq::toSpritePtr2_$0 -(word~) init_irq::toSpritePtr2_$1 -(byte~) init_irq::toSpritePtr2_$2 -(byte) init_irq::toSpritePtr2_return -(const byte) init_irq::toSpritePtr2_return#0 toSpritePtr2_return = ((byte))((word))(const byte*) PLAYFIELD_SPRITES#0>>(byte/signed byte/word/signed word/dword/signed dword) 6 -(byte*) init_irq::toSpritePtr2_sprite (void()) init_sprites() (label) init_sprites::@1 (label) init_sprites::@4 @@ -182,26 +174,22 @@ interrupt(KERNEL_MIN)(void()) irq() (const byte) irq::toSpritePtr2_return#0 toSpritePtr2_return = ((byte))((word))(const byte*) PLAYFIELD_SPRITES#0>>(byte/signed byte/word/signed word/dword/signed dword) 6 (byte*) irq::toSpritePtr2_sprite (byte) irq_cnt -(byte) irq_cnt#11 irq_cnt zp ZP_BYTE:6 20.0 -(byte) irq_cnt#19 irq_cnt zp ZP_BYTE:6 0.3076923076923077 -(byte) irq_cnt#23 irq_cnt zp ZP_BYTE:6 4.0 -(byte) irq_cnt#24 irq_cnt zp ZP_BYTE:6 20.0 +(byte) irq_cnt#0 irq_cnt zp ZP_BYTE:6 0.3076923076923077 +(byte) irq_cnt#1 irq_cnt zp ZP_BYTE:6 4.0 +(byte) irq_cnt#10 irq_cnt zp ZP_BYTE:6 20.0 (byte) irq_raster_next -(byte) irq_raster_next#11 irq_raster_next zp ZP_BYTE:3 20.0 -(byte) irq_raster_next#13 irq_raster_next zp ZP_BYTE:3 6.0 -(byte) irq_raster_next#2 irq_raster_next zp ZP_BYTE:3 0.26666666666666666 -(byte) irq_raster_next#20 irq_raster_next zp ZP_BYTE:3 1.0 -(byte) irq_raster_next#6 irq_raster_next zp ZP_BYTE:3 1.3333333333333333 +(byte) irq_raster_next#0 irq_raster_next zp ZP_BYTE:3 0.26666666666666666 +(byte) irq_raster_next#1 irq_raster_next zp ZP_BYTE:3 1.0 +(byte) irq_raster_next#2 irq_raster_next zp ZP_BYTE:3 1.3333333333333333 +(byte) irq_raster_next#3 irq_raster_next zp ZP_BYTE:3 6.0 (byte) irq_sprite_ptr -(byte) irq_sprite_ptr#2 irq_sprite_ptr zp ZP_BYTE:5 0.3529411764705882 -(byte) irq_sprite_ptr#3 irq_sprite_ptr zp ZP_BYTE:5 20.0 -(byte) irq_sprite_ptr#5 irq_sprite_ptr zp ZP_BYTE:5 20.0 -(byte) irq_sprite_ptr#6 irq_sprite_ptr zp ZP_BYTE:5 20.0 +(byte) irq_sprite_ptr#0 irq_sprite_ptr zp ZP_BYTE:5 0.3529411764705882 +(byte) irq_sprite_ptr#1 irq_sprite_ptr zp ZP_BYTE:5 20.0 +(byte) irq_sprite_ptr#2 irq_sprite_ptr zp ZP_BYTE:5 20.0 (byte) irq_sprite_ypos -(byte) irq_sprite_ypos#11 irq_sprite_ypos zp ZP_BYTE:4 20.0 -(byte) irq_sprite_ypos#2 irq_sprite_ypos zp ZP_BYTE:4 1.4375 -(byte) irq_sprite_ypos#26 irq_sprite_ypos zp ZP_BYTE:4 20.0 -(byte) irq_sprite_ypos#6 irq_sprite_ypos zp ZP_BYTE:4 20.0 +(byte) irq_sprite_ypos#0 irq_sprite_ypos zp ZP_BYTE:4 1.4375 +(byte) irq_sprite_ypos#1 irq_sprite_ypos zp ZP_BYTE:4 20.0 +(byte) irq_sprite_ypos#2 irq_sprite_ypos zp ZP_BYTE:4 20.0 (void()) main() (label) main::@2 (label) main::@7 @@ -215,10 +203,10 @@ interrupt(KERNEL_MIN)(void()) irq() reg byte x [ init_sprites::s#2 init_sprites::s#1 ] zp ZP_BYTE:2 [ init_sprites::xpos#2 init_sprites::xpos#1 ] -zp ZP_BYTE:3 [ irq_raster_next#13 irq_raster_next#6 irq_raster_next#20 irq_raster_next#2 irq_raster_next#11 ] -zp ZP_BYTE:4 [ irq_sprite_ypos#2 irq_sprite_ypos#6 irq_sprite_ypos#11 irq_sprite_ypos#26 ] -zp ZP_BYTE:5 [ irq_sprite_ptr#2 irq_sprite_ptr#6 irq_sprite_ptr#3 irq_sprite_ptr#5 ] -zp ZP_BYTE:6 [ irq_cnt#19 irq_cnt#23 irq_cnt#11 irq_cnt#24 ] +zp ZP_BYTE:3 [ irq_raster_next#3 irq_raster_next#2 irq_raster_next#1 irq_raster_next#0 ] +zp ZP_BYTE:4 [ irq_sprite_ypos#0 irq_sprite_ypos#2 irq_sprite_ypos#1 ] +zp ZP_BYTE:5 [ irq_sprite_ptr#0 irq_sprite_ptr#2 irq_sprite_ptr#1 ] +zp ZP_BYTE:6 [ irq_cnt#0 irq_cnt#1 irq_cnt#10 ] reg byte a [ init_sprites::s2#0 ] reg byte x [ irq::ptr#0 ] reg byte x [ irq::ptr#1 ] diff --git a/src/test/ref/examples/tetris/tetris.asm b/src/test/ref/examples/tetris/tetris.asm index 2a78869ed..851af6508 100644 --- a/src/test/ref/examples/tetris/tetris.asm +++ b/src/test/ref/examples/tetris/tetris.asm @@ -1,5 +1,5 @@ .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" .label RASTER = $d012 .label BORDERCOL = $d020 @@ -61,6 +61,7 @@ .label current_piece_73 = 5 .label current_piece_74 = 5 .label current_piece_75 = 5 +bbegin: jsr main main: { .label key_event = $14 diff --git a/src/test/ref/examples/tetris/tetris.log b/src/test/ref/examples/tetris/tetris.log index e33d85ed8..405e88d01 100644 --- a/src/test/ref/examples/tetris/tetris.log +++ b/src/test/ref/examples/tetris/tetris.log @@ -7001,7 +7001,7 @@ Allocated zp ZP_WORD:143 [ fill::end#0 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label RASTER = $d012 @@ -9840,7 +9840,7 @@ Allocated (was zp ZP_BYTE:100) zp ZP_BYTE:24 [ collision::i#1 ] ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label RASTER = $d012 @@ -12053,9 +12053,9 @@ Replacing label b3_from_b3 with b3 Replacing label b2_from_b5 with b2 Replacing label b1_from_b1 with b1 Replacing label b1_from_b1 with b1 -Removing instruction bbegin: Removing instruction b23: Removing instruction b26_from_b23: +Removing instruction b26: Removing instruction main_from_b26: Removing instruction bend_from_b26: Removing instruction b22_from_b21: @@ -12133,7 +12133,6 @@ Removing instruction b3_from_b3: Removing instruction b1_from_fill: Removing instruction b1_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b26: Removing instruction bend: Removing instruction b21: Removing instruction b22: @@ -13120,7 +13119,7 @@ Score: 416966 //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label RASTER = $d012 @@ -13184,6 +13183,7 @@ Score: 416966 .label current_piece_74 = 5 .label current_piece_75 = 5 //SEG2 @begin +bbegin: //SEG3 @23 //SEG4 kickasm(location (const byte*) CHARSET#0) {{ .var charset = LoadPicture("charset.png", List().add($000000, $ffffff, $523fa0, $77c1c9)) .for (var c=0; c<16; c++) .for (var y=0;y<8; y++) .byte charset.getMulticolorByte(c,y) }} //SEG5 [2] phi from @23 to @26 [phi:@23->@26] diff --git a/src/test/ref/fibmem.asm b/src/test/ref/fibmem.asm index b18e86671..54c5d466c 100644 --- a/src/test/ref/fibmem.asm +++ b/src/test/ref/fibmem.asm @@ -2,7 +2,6 @@ :BasicUpstart(main) .pc = $80d "Program" .label fibs = $1100 - jsr main main: { lda #0 sta fibs diff --git a/src/test/ref/fibmem.log b/src/test/ref/fibmem.log index 6cd171e30..b1561c0ad 100644 --- a/src/test/ref/fibmem.log +++ b/src/test/ref/fibmem.log @@ -128,7 +128,7 @@ Allocated zp ZP_BYTE:3 [ main::$2 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label fibs = $1100 @@ -212,7 +212,7 @@ Uplifting [] best 365 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label fibs = $1100 @@ -274,18 +274,22 @@ Removing instruction jmp b1 Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination Replacing label b1_from_b1 with b1 -Removing instruction bbegin: Removing instruction b1_from_bbegin: +Removing instruction b1: Removing instruction bend_from_b1: Removing instruction b1_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b1: Removing instruction bend: Removing instruction b1_from_main: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Removing instruction jmp b1 Succesful ASM optimization Pass5NextJumpElimination +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @1 @@ -306,7 +310,7 @@ reg byte a [ main::$2 ] FINAL ASSEMBLER -Score: 269 +Score: 263 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -318,7 +322,6 @@ Score: 269 //SEG3 [1] phi from @begin to @1 [phi:@begin->@1] //SEG4 @1 //SEG5 [2] call main - jsr main //SEG6 [3] phi from @1 to @end [phi:@1->@end] //SEG7 @end //SEG8 main diff --git a/src/test/ref/fillscreen.asm b/src/test/ref/fillscreen.asm index 181d3ac42..0d0519bc4 100644 --- a/src/test/ref/fillscreen.asm +++ b/src/test/ref/fillscreen.asm @@ -2,7 +2,6 @@ :BasicUpstart(main) .pc = $80d "Program" .label SCREEN = $400 - jsr main main: { lda SCREEN jsr fillscreen diff --git a/src/test/ref/fillscreen.log b/src/test/ref/fillscreen.log index 95b48fb5c..5606d8d70 100644 --- a/src/test/ref/fillscreen.log +++ b/src/test/ref/fillscreen.log @@ -200,7 +200,7 @@ Allocated zp ZP_BYTE:4 [ fillscreen::c#0 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label SCREEN = $400 @@ -302,7 +302,7 @@ Uplifting [] best 412 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label SCREEN = $400 @@ -380,20 +380,24 @@ Removing instruction jmp b1 Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination Replacing label b1_from_b1 with b1 -Removing instruction bbegin: Removing instruction b2_from_bbegin: +Removing instruction b2: Removing instruction bend_from_b2: Removing instruction b1_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b2: Removing instruction bend: Removing instruction fillscreen_from_main: Removing instruction breturn: Removing instruction b1_from_fillscreen: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Removing instruction jmp b1 Succesful ASM optimization Pass5NextJumpElimination +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @2 @@ -426,7 +430,7 @@ reg byte a [ fillscreen::c#0 ] FINAL ASSEMBLER -Score: 313 +Score: 307 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -438,7 +442,6 @@ Score: 313 //SEG3 [1] phi from @begin to @2 [phi:@begin->@2] //SEG4 @2 //SEG5 [2] call main - jsr main //SEG6 [3] phi from @2 to @end [phi:@2->@end] //SEG7 @end //SEG8 main diff --git a/src/test/ref/flipper-rex2.asm b/src/test/ref/flipper-rex2.asm index 78a2f5a4c..ec80f26af 100644 --- a/src/test/ref/flipper-rex2.asm +++ b/src/test/ref/flipper-rex2.asm @@ -3,7 +3,6 @@ .pc = $80d "Program" .label RASTER = $d012 .label SCREEN = $400 - jsr main main: { jsr prepare b1: diff --git a/src/test/ref/flipper-rex2.log b/src/test/ref/flipper-rex2.log index fc850317a..4be3bcdb8 100644 --- a/src/test/ref/flipper-rex2.log +++ b/src/test/ref/flipper-rex2.log @@ -694,7 +694,7 @@ Allocated zp ZP_BYTE:13 [ prepare::i#2 prepare::i#1 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label RASTER = $d012 @@ -1053,7 +1053,7 @@ Allocated (was zp ZP_BYTE:11) zp ZP_BYTE:5 [ flip::c#2 flip::c#1 ] ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label RASTER = $d012 @@ -1352,8 +1352,8 @@ Replacing label b2_from_b2 with b2 Replacing label b1_from_b4 with b1 Replacing label b3_from_b3 with b3 Replacing label b1_from_b1 with b1 -Removing instruction bbegin: Removing instruction b4_from_bbegin: +Removing instruction b4: Removing instruction main_from_b4: Removing instruction bend_from_b4: Removing instruction b3_from_main: @@ -1371,7 +1371,6 @@ Removing instruction b2_from_b2: Removing instruction b3_from_b3: Removing instruction b1_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b4: Removing instruction bend: Removing instruction prepare_from_main: Removing instruction b6: @@ -1387,6 +1386,9 @@ Removing instruction breturn: Removing instruction b1_from_prepare: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Skipping double jump to b3 in bne b3_from_b3 Succesful ASM optimization Pass5DoubleJumpElimination Relabelling long label b3_from_b10 to b1 @@ -1402,6 +1404,8 @@ Removing instruction jmp b1 Succesful ASM optimization Pass5NextJumpElimination Removing instruction b2: Succesful ASM optimization Pass5RedundantLabelElimination +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination Removing instruction jmp b3 Succesful ASM optimization Pass5NextJumpElimination @@ -1488,7 +1492,7 @@ reg byte x [ prepare::i#2 prepare::i#1 ] FINAL ASSEMBLER -Score: 86700 +Score: 86694 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -1502,7 +1506,6 @@ Score: 86700 //SEG4 @4 //SEG5 [2] call main //SEG6 [4] phi from @4 to main [phi:@4->main] - jsr main //SEG7 [3] phi from @4 to @end [phi:@4->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/forclassicmin.asm b/src/test/ref/forclassicmin.asm index 009a06ebf..9ef2d1716 100644 --- a/src/test/ref/forclassicmin.asm +++ b/src/test/ref/forclassicmin.asm @@ -2,7 +2,6 @@ :BasicUpstart(main) .pc = $80d "Program" .label SCREEN = $400 - jsr main main: { ldx #0 b1: diff --git a/src/test/ref/forclassicmin.log b/src/test/ref/forclassicmin.log index 4c72233db..2dc49a609 100644 --- a/src/test/ref/forclassicmin.log +++ b/src/test/ref/forclassicmin.log @@ -121,7 +121,7 @@ Allocated zp ZP_BYTE:2 [ main::i#2 main::i#1 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label SCREEN = $400 @@ -186,7 +186,7 @@ Uplifting [] best 263 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label SCREEN = $400 @@ -241,19 +241,23 @@ Removing instruction jmp b1 Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination Replacing label b1_from_b1 with b1 -Removing instruction bbegin: Removing instruction b1_from_bbegin: +Removing instruction b1: Removing instruction main_from_b1: Removing instruction bend_from_b1: Removing instruction b1_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b1: Removing instruction bend: Removing instruction b1_from_main: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Removing instruction jmp b1 Succesful ASM optimization Pass5NextJumpElimination +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @1 @@ -272,7 +276,7 @@ reg byte x [ main::i#2 main::i#1 ] FINAL ASSEMBLER -Score: 167 +Score: 161 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -285,7 +289,6 @@ Score: 167 //SEG4 @1 //SEG5 [2] call main //SEG6 [4] phi from @1 to main [phi:@1->main] - jsr main //SEG7 [3] phi from @1 to @end [phi:@1->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/forincrementassign.asm b/src/test/ref/forincrementassign.asm index e5e453f3f..239a56936 100644 --- a/src/test/ref/forincrementassign.asm +++ b/src/test/ref/forincrementassign.asm @@ -2,7 +2,6 @@ :BasicUpstart(main) .pc = $80d "Program" .label SCREEN = $400 - jsr main main: { lda #0 b1: diff --git a/src/test/ref/forincrementassign.log b/src/test/ref/forincrementassign.log index 0b6932290..92536c76b 100644 --- a/src/test/ref/forincrementassign.log +++ b/src/test/ref/forincrementassign.log @@ -122,7 +122,7 @@ Allocated zp ZP_BYTE:2 [ main::i#2 main::i#1 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label SCREEN = $400 @@ -190,7 +190,7 @@ Uplifting [] best 283 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label SCREEN = $400 @@ -246,19 +246,23 @@ Removing instruction jmp b1 Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination Replacing label b1_from_b1 with b1 -Removing instruction bbegin: Removing instruction b1_from_bbegin: +Removing instruction b1: Removing instruction main_from_b1: Removing instruction bend_from_b1: Removing instruction b1_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b1: Removing instruction bend: Removing instruction b1_from_main: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Removing instruction jmp b1 Succesful ASM optimization Pass5NextJumpElimination +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @1 @@ -277,7 +281,7 @@ reg byte a [ main::i#2 main::i#1 ] FINAL ASSEMBLER -Score: 187 +Score: 181 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -290,7 +294,6 @@ Score: 187 //SEG4 @1 //SEG5 [2] call main //SEG6 [4] phi from @1 to main [phi:@1->main] - jsr main //SEG7 [3] phi from @1 to @end [phi:@1->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/forrangedwords.asm b/src/test/ref/forrangedwords.asm index 122074cd4..60b793ab1 100644 --- a/src/test/ref/forrangedwords.asm +++ b/src/test/ref/forrangedwords.asm @@ -1,7 +1,6 @@ .pc = $801 "Basic" :BasicUpstart(main) .pc = $80d "Program" - jsr main main: { .label SCREEN = $400 .label w = 2 diff --git a/src/test/ref/forrangedwords.log b/src/test/ref/forrangedwords.log index aef751103..792a38ab7 100644 --- a/src/test/ref/forrangedwords.log +++ b/src/test/ref/forrangedwords.log @@ -203,7 +203,7 @@ Allocated zp ZP_BYTE:9 [ main::$5 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -338,7 +338,7 @@ Coalescing zero page register [ zp ZP_WORD:2 [ main::w#2 main::w#1 ] ] with [ zp ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -448,22 +448,26 @@ Replacing label b1_from_b1 with b1 Replacing label b1_from_b1 with b1 Replacing label b2_from_b2 with b2 Replacing label b2_from_b2 with b2 -Removing instruction bbegin: Removing instruction b1_from_bbegin: +Removing instruction b1: Removing instruction main_from_b1: Removing instruction bend_from_b1: Removing instruction b1_from_b1: Removing instruction b2_from_b2: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b1: Removing instruction bend: Removing instruction b1_from_main: Removing instruction b2_from_b1: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Removing instruction jmp b1 Removing instruction jmp b2 Succesful ASM optimization Pass5NextJumpElimination +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @1 @@ -494,7 +498,7 @@ reg byte a [ main::$5 ] FINAL ASSEMBLER -Score: 982 +Score: 976 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -506,7 +510,6 @@ Score: 982 //SEG4 @1 //SEG5 [2] call main //SEG6 [4] phi from @1 to main [phi:@1->main] - jsr main //SEG7 [3] phi from @1 to @end [phi:@1->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/forrangemin.asm b/src/test/ref/forrangemin.asm index b2a545198..77d2ba557 100644 --- a/src/test/ref/forrangemin.asm +++ b/src/test/ref/forrangemin.asm @@ -3,7 +3,6 @@ .pc = $80d "Program" .label SCREEN1 = $400 .label SCREEN2 = $500 - jsr main main: { ldx #0 b1: diff --git a/src/test/ref/forrangemin.log b/src/test/ref/forrangemin.log index 34dd4bd12..67cf21cfa 100644 --- a/src/test/ref/forrangemin.log +++ b/src/test/ref/forrangemin.log @@ -183,7 +183,7 @@ Allocated zp ZP_BYTE:3 [ main::j#2 main::j#1 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label SCREEN1 = $400 @@ -273,7 +273,7 @@ Uplifting [] best 478 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label SCREEN1 = $400 @@ -350,22 +350,26 @@ Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination Replacing label b1_from_b1 with b1 Replacing label b2_from_b2 with b2 -Removing instruction bbegin: Removing instruction b1_from_bbegin: +Removing instruction b1: Removing instruction main_from_b1: Removing instruction bend_from_b1: Removing instruction b1_from_b1: Removing instruction b2_from_b2: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b1: Removing instruction bend: Removing instruction b1_from_main: Removing instruction b2_from_b1: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Removing instruction jmp b1 Removing instruction jmp b2 Succesful ASM optimization Pass5NextJumpElimination +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @1 @@ -391,7 +395,7 @@ reg byte x [ main::j#2 main::j#1 ] FINAL ASSEMBLER -Score: 322 +Score: 316 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -405,7 +409,6 @@ Score: 322 //SEG4 @1 //SEG5 [2] call main //SEG6 [4] phi from @1 to main [phi:@1->main] - jsr main //SEG7 [3] phi from @1 to @end [phi:@1->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/forrangesymbolic.asm b/src/test/ref/forrangesymbolic.asm index 6143ef36c..455eee70e 100644 --- a/src/test/ref/forrangesymbolic.asm +++ b/src/test/ref/forrangesymbolic.asm @@ -1,7 +1,6 @@ .pc = $801 "Basic" :BasicUpstart(main) .pc = $80d "Program" - jsr main main: { .label BITMAP = $2000 .label b = 2 diff --git a/src/test/ref/forrangesymbolic.log b/src/test/ref/forrangesymbolic.log index 21c16e259..1ca0d908a 100644 --- a/src/test/ref/forrangesymbolic.log +++ b/src/test/ref/forrangesymbolic.log @@ -113,7 +113,7 @@ Allocated zp ZP_WORD:2 [ main::b#2 main::b#1 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -190,7 +190,7 @@ Uplifting [] best 613 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -259,19 +259,23 @@ Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination Replacing label b1_from_b1 with b1 Replacing label b1_from_b1 with b1 -Removing instruction bbegin: Removing instruction b1_from_bbegin: +Removing instruction b1: Removing instruction main_from_b1: Removing instruction bend_from_b1: Removing instruction b1_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b1: Removing instruction bend: Removing instruction b1_from_main: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Removing instruction jmp b1 Succesful ASM optimization Pass5NextJumpElimination +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @1 @@ -290,7 +294,7 @@ zp ZP_WORD:2 [ main::b#2 main::b#1 ] FINAL ASSEMBLER -Score: 517 +Score: 511 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -302,7 +306,6 @@ Score: 517 //SEG4 @1 //SEG5 [2] call main //SEG6 [4] phi from @1 to main [phi:@1->main] - jsr main //SEG7 [3] phi from @1 to @end [phi:@1->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/fragment-synth.asm b/src/test/ref/fragment-synth.asm index 1108e1e13..fcd4c7d41 100644 --- a/src/test/ref/fragment-synth.asm +++ b/src/test/ref/fragment-synth.asm @@ -1,7 +1,6 @@ .pc = $801 "Basic" :BasicUpstart(main) .pc = $80d "Program" - jsr main main: { .label screen = $400 lda #$f0 diff --git a/src/test/ref/fragment-synth.log b/src/test/ref/fragment-synth.log index d2dfca05e..3e37dc55d 100644 --- a/src/test/ref/fragment-synth.log +++ b/src/test/ref/fragment-synth.log @@ -247,7 +247,7 @@ Allocated zp ZP_BYTE:8 [ fct::return#2 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -369,7 +369,7 @@ Uplifting [] best 101 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -463,11 +463,10 @@ Removing instruction jmp b2 Removing instruction jmp breturn Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination -Removing instruction bbegin: Removing instruction b2_from_bbegin: +Removing instruction b2: Removing instruction bend_from_b2: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b2: Removing instruction bend: Removing instruction fct_from_main: Removing instruction b1: @@ -476,6 +475,11 @@ Removing instruction b2: Removing instruction breturn: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @2 @@ -515,7 +519,7 @@ reg byte a [ fct::return#2 ] FINAL ASSEMBLER -Score: 83 +Score: 77 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -526,7 +530,6 @@ Score: 83 //SEG3 [1] phi from @begin to @2 [phi:@begin->@2] //SEG4 @2 //SEG5 [2] call main - jsr main //SEG6 [3] phi from @2 to @end [phi:@2->@end] //SEG7 @end //SEG8 main diff --git a/src/test/ref/halfscii.asm b/src/test/ref/halfscii.asm index 958bd11c5..4e13a9781 100644 --- a/src/test/ref/halfscii.asm +++ b/src/test/ref/halfscii.asm @@ -6,7 +6,6 @@ .label PROCPORT = 1 .label D018 = $d018 .label CHARSET4 = $2800 - jsr main main: { .label _1 = 8 .label _11 = 8 diff --git a/src/test/ref/halfscii.log b/src/test/ref/halfscii.log index 980182562..b4427e5e1 100644 --- a/src/test/ref/halfscii.log +++ b/src/test/ref/halfscii.log @@ -802,7 +802,7 @@ Allocated zp ZP_BYTE:37 [ main::bits_gen#7 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label SCREEN = $400 @@ -1338,7 +1338,7 @@ Allocated (was zp ZP_BYTE:13) zp ZP_BYTE:8 [ main::$1 main::$11 main::$21 main:: ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label SCREEN = $400 @@ -1651,8 +1651,8 @@ Replacing label b5_from_b4 with b5 Replacing label b1_from_b5 with b1 Replacing label b1_from_b5 with b1 Replacing label b6_from_b6 with b6 -Removing instruction bbegin: Removing instruction b1_from_bbegin: +Removing instruction b1: Removing instruction bend_from_b1: Removing instruction b1_from_b5: Removing instruction b7_from_b1: @@ -1665,7 +1665,6 @@ Removing instruction b5_from_b10: Removing instruction b5_from_b4: Removing instruction b6_from_b6: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b1: Removing instruction bend: Removing instruction b1_from_main: Removing instruction b7: @@ -1677,13 +1676,18 @@ Removing instruction b6_from_b11: Removing instruction b12: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Relabelling long label b2_from_b1 to b7 Succesful ASM optimization Pass5RelabelLongLabels Removing instruction jmp b1 Removing instruction jmp b6 Succesful ASM optimization Pass5NextJumpElimination -Fixing long branch [128] bcc b1 to bcs -Fixing long branch [134] bcc b1 to bcs +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination +Fixing long branch [127] bcc b1 to bcs +Fixing long branch [133] bcc b1 to bcs FINAL SYMBOL TABLE (label) @1 @@ -1798,7 +1802,7 @@ reg byte a [ main::bits_gen#7 ] FINAL ASSEMBLER -Score: 3114 +Score: 3108 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -1814,7 +1818,6 @@ Score: 3114 //SEG3 [1] phi from @begin to @1 [phi:@begin->@1] //SEG4 @1 //SEG5 [2] call main - jsr main //SEG6 [3] phi from @1 to @end [phi:@1->@end] //SEG7 @end //SEG8 main diff --git a/src/test/ref/helloworld2-inline.asm b/src/test/ref/helloworld2-inline.asm index 9adcb188d..b1d19659e 100644 --- a/src/test/ref/helloworld2-inline.asm +++ b/src/test/ref/helloworld2-inline.asm @@ -2,7 +2,6 @@ :BasicUpstart(main) .pc = $80d "Program" .label screen = $400 - jsr main main: { .label print22_at = screen+$50 ldx #0 diff --git a/src/test/ref/helloworld2-inline.log b/src/test/ref/helloworld2-inline.log index 35da9d175..aa06d68fd 100644 --- a/src/test/ref/helloworld2-inline.log +++ b/src/test/ref/helloworld2-inline.log @@ -288,7 +288,7 @@ Allocated zp ZP_BYTE:5 [ main::print22_j#2 main::print22_j#1 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label screen = $400 @@ -427,7 +427,7 @@ Uplifting [] best 744 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label screen = $400 @@ -531,8 +531,8 @@ Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination Replacing label print21_b1_from_print21_b1 with print21_b1 Replacing label print22_b1_from_print22_b1 with print22_b1 -Removing instruction bbegin: Removing instruction b2_from_bbegin: +Removing instruction b2: Removing instruction main_from_b2: Removing instruction bend_from_b2: Removing instruction print21_from_main: @@ -542,15 +542,19 @@ Removing instruction print22_from_print21_b1: Removing instruction print22_b1_from_print22: Removing instruction print22_b1_from_print22_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b2: Removing instruction bend: Removing instruction print21: Removing instruction print22: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Removing instruction jmp print21_b1 Removing instruction jmp print22_b1 Succesful ASM optimization Pass5NextJumpElimination +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @2 @@ -593,7 +597,7 @@ reg byte x [ main::print22_j#2 main::print22_j#1 ] FINAL ASSEMBLER -Score: 582 +Score: 576 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -606,7 +610,6 @@ Score: 582 //SEG4 @2 //SEG5 [2] call main //SEG6 [4] phi from @2 to main [phi:@2->main] - jsr main //SEG7 [3] phi from @2 to @end [phi:@2->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/helloworld2.asm b/src/test/ref/helloworld2.asm index 7c9300bf0..f371e847a 100644 --- a/src/test/ref/helloworld2.asm +++ b/src/test/ref/helloworld2.asm @@ -2,7 +2,6 @@ :BasicUpstart(main) .pc = $80d "Program" .label screen = $400 - jsr main main: { lda #main] - jsr main //SEG7 [3] phi from @2 to @end [phi:@2->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/ifmin.asm b/src/test/ref/ifmin.asm index f5334ac19..1973e92c6 100644 --- a/src/test/ref/ifmin.asm +++ b/src/test/ref/ifmin.asm @@ -2,7 +2,6 @@ :BasicUpstart(main) .pc = $80d "Program" .label SCREEN = $400 - jsr main main: { ldx #0 b1: diff --git a/src/test/ref/ifmin.log b/src/test/ref/ifmin.log index 2b0901078..60d9bf24b 100644 --- a/src/test/ref/ifmin.log +++ b/src/test/ref/ifmin.log @@ -151,7 +151,7 @@ Allocated zp ZP_BYTE:2 [ main::i#2 main::i#1 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label SCREEN = $400 @@ -225,7 +225,7 @@ Uplifting [] best 338 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label SCREEN = $400 @@ -290,20 +290,24 @@ Removing instruction jmp b2 Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination Replacing label b1_from_b2 with b1 -Removing instruction bbegin: Removing instruction b1_from_bbegin: +Removing instruction b1: Removing instruction main_from_b1: Removing instruction bend_from_b1: Removing instruction b1_from_b2: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b1: Removing instruction bend: Removing instruction b1_from_main: Removing instruction b3: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Removing instruction jmp b1 Succesful ASM optimization Pass5NextJumpElimination +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @1 @@ -324,7 +328,7 @@ reg byte x [ main::i#2 main::i#1 ] FINAL ASSEMBLER -Score: 182 +Score: 176 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -337,7 +341,6 @@ Score: 182 //SEG4 @1 //SEG5 [2] call main //SEG6 [4] phi from @1 to main [phi:@1->main] - jsr main //SEG7 [3] phi from @1 to @end [phi:@1->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/immzero.asm b/src/test/ref/immzero.asm index 8391e6d23..7f0ec6def 100644 --- a/src/test/ref/immzero.asm +++ b/src/test/ref/immzero.asm @@ -1,7 +1,6 @@ .pc = $801 "Basic" :BasicUpstart(main) .pc = $80d "Program" - jsr main main: { .label w = 2 lda #<0 diff --git a/src/test/ref/immzero.log b/src/test/ref/immzero.log index 5528038b3..8ad7a85c5 100644 --- a/src/test/ref/immzero.log +++ b/src/test/ref/immzero.log @@ -136,7 +136,7 @@ Allocated zp ZP_WORD:3 [ main::w#2 main::w#1 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -217,7 +217,7 @@ Allocated (was zp ZP_WORD:3) zp ZP_WORD:2 [ main::w#2 main::w#1 ] ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -286,19 +286,23 @@ Removing instruction lda #>0 Replacing instruction ldx #0 with TAX Succesful ASM optimization Pass5UnnecesaryLoadElimination Replacing label b1_from_b1 with b1 -Removing instruction bbegin: Removing instruction b1_from_bbegin: +Removing instruction b1: Removing instruction main_from_b1: Removing instruction bend_from_b1: Removing instruction b1_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b1: Removing instruction bend: Removing instruction b1_from_main: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Removing instruction jmp b1 Succesful ASM optimization Pass5NextJumpElimination +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @1 @@ -320,7 +324,7 @@ zp ZP_WORD:2 [ main::w#2 main::w#1 ] FINAL ASSEMBLER -Score: 357 +Score: 351 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -332,7 +336,6 @@ Score: 357 //SEG4 @1 //SEG5 [2] call main //SEG6 [4] phi from @1 to main [phi:@1->main] - jsr main //SEG7 [3] phi from @1 to @end [phi:@1->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/importing.asm b/src/test/ref/importing.asm index 58c79b4db..00f39606b 100644 --- a/src/test/ref/importing.asm +++ b/src/test/ref/importing.asm @@ -3,7 +3,6 @@ .pc = $80d "Program" .label BGCOL = $d021 .const RED = 2 - jsr main main: { .label screen = $400 lda #1 diff --git a/src/test/ref/importing.log b/src/test/ref/importing.log index 7bf2a31c4..db1d3e8ec 100644 --- a/src/test/ref/importing.log +++ b/src/test/ref/importing.log @@ -82,7 +82,7 @@ Complete equivalence classes INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label BGCOL = $d021 @@ -131,7 +131,7 @@ Uplifting [] best 33 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label BGCOL = $d021 @@ -171,14 +171,18 @@ Removing instruction jmp b1 Removing instruction jmp bend Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination -Removing instruction bbegin: Removing instruction b1_from_bbegin: +Removing instruction b1: Removing instruction bend_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b1: Removing instruction bend: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @1 @@ -196,7 +200,7 @@ FINAL SYMBOL TABLE FINAL ASSEMBLER -Score: 24 +Score: 18 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -209,7 +213,6 @@ Score: 24 //SEG3 [1] phi from @begin to @1 [phi:@begin->@1] //SEG4 @1 //SEG5 [2] call main - jsr main //SEG6 [3] phi from @1 to @end [phi:@1->@end] //SEG7 @end //SEG8 main diff --git a/src/test/ref/incd020.asm b/src/test/ref/incd020.asm index 2f77ff4dd..1a8d55175 100644 --- a/src/test/ref/incd020.asm +++ b/src/test/ref/incd020.asm @@ -2,7 +2,6 @@ :BasicUpstart(main) .pc = $80d "Program" .label BGCOL = $d020 - jsr main main: { b1: inc BGCOL diff --git a/src/test/ref/incd020.log b/src/test/ref/incd020.log index 46048bcb0..f9df1a151 100644 --- a/src/test/ref/incd020.log +++ b/src/test/ref/incd020.log @@ -95,7 +95,7 @@ Complete equivalence classes INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label BGCOL = $d020 @@ -139,7 +139,7 @@ Uplifting [] best 192 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label BGCOL = $d020 @@ -176,14 +176,18 @@ Removing instruction jmp b1 Removing instruction jmp bend Removing instruction jmp b1 Succesful ASM optimization Pass5NextJumpElimination -Removing instruction bbegin: Removing instruction b1_from_bbegin: +Removing instruction b1: Removing instruction main_from_b1: Removing instruction bend_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b1: Removing instruction bend: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @1 @@ -197,7 +201,7 @@ FINAL SYMBOL TABLE FINAL ASSEMBLER -Score: 156 +Score: 150 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -210,7 +214,6 @@ Score: 156 //SEG4 @1 //SEG5 [2] call main //SEG6 [4] phi from @1 to main [phi:@1->main] - jsr main //SEG7 [3] phi from @1 to @end [phi:@1->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/incrementinarray.asm b/src/test/ref/incrementinarray.asm index 2d65312df..ac816936d 100644 --- a/src/test/ref/incrementinarray.asm +++ b/src/test/ref/incrementinarray.asm @@ -3,7 +3,6 @@ .pc = $80d "Program" .label print_char_cursor = 6 .label print_line_cursor = 2 - jsr main main: { jsr print_cls ldx #0 diff --git a/src/test/ref/incrementinarray.log b/src/test/ref/incrementinarray.log index 705839af0..a6e39c26d 100644 --- a/src/test/ref/incrementinarray.log +++ b/src/test/ref/incrementinarray.log @@ -499,7 +499,7 @@ Allocated zp ZP_WORD:9 [ print_cls::sc#2 print_cls::sc#1 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label print_char_cursor = 7 @@ -756,7 +756,7 @@ Allocated (was zp ZP_WORD:7) zp ZP_WORD:6 [ print_char_cursor#12 print_char_curs ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label print_char_cursor = 6 @@ -985,8 +985,8 @@ Replacing label b1_from_b1 with b1 Replacing label b1_from_b1 with b1 Replacing label b1_from_b1 with b1 Replacing label b1_from_b1 with b1 -Removing instruction bbegin: Removing instruction b20_from_bbegin: +Removing instruction b20: Removing instruction main_from_b20: Removing instruction bend_from_b20: Removing instruction print_str_from_b1: @@ -996,7 +996,6 @@ Removing instruction b1_from_print_ln: Removing instruction b1_from_b1: Removing instruction b1_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b20: Removing instruction bend: Removing instruction print_cls_from_main: Removing instruction b1_from_main: @@ -1011,8 +1010,13 @@ Removing instruction b1_from_b2: Removing instruction b1_from_print_cls: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Removing instruction jmp b1 Succesful ASM optimization Pass5NextJumpElimination +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @20 @@ -1064,7 +1068,7 @@ zp ZP_WORD:6 [ print_char_cursor#12 print_char_cursor#25 print_char_cursor#30 pr FINAL ASSEMBLER -Score: 11128 +Score: 11122 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -1078,7 +1082,6 @@ Score: 11128 //SEG4 @20 //SEG5 [2] call main //SEG6 [4] phi from @20 to main [phi:@20->main] - jsr main //SEG7 [3] phi from @20 to @end [phi:@20->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/infloop-error.asm b/src/test/ref/infloop-error.asm index ee4bf4a54..e9c7431ee 100644 --- a/src/test/ref/infloop-error.asm +++ b/src/test/ref/infloop-error.asm @@ -2,7 +2,6 @@ :BasicUpstart(main) .pc = $80d "Program" .label SCREEN = $400 - jsr main main: { ldy #0 ldx #$ff diff --git a/src/test/ref/infloop-error.log b/src/test/ref/infloop-error.log index bf6f22097..19a5d8893 100644 --- a/src/test/ref/infloop-error.log +++ b/src/test/ref/infloop-error.log @@ -268,7 +268,7 @@ Allocated zp ZP_BYTE:4 [ main::max#2 main::max#3 main::max#9 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label SCREEN = $400 @@ -378,7 +378,7 @@ Uplifting [] best 652 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label SCREEN = $400 @@ -477,8 +477,8 @@ Replacing instruction lda #0 with TYA Replacing label b4_from_b2 with b4 Replacing label b5_from_b4 with b5 Replacing label b1 with b2 -Removing instruction bbegin: Removing instruction b1_from_bbegin: +Removing instruction b1: Removing instruction main_from_b1: Removing instruction bend_from_b1: Removing instruction b1: @@ -487,13 +487,17 @@ Removing instruction b4_from_b8: Removing instruction b5_from_b4: Removing instruction b5_from_b9: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b1: Removing instruction bend: Removing instruction b1_from_main: Removing instruction b8: Removing instruction b9: Removing instruction b1_from_b5: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @1 @@ -526,7 +530,7 @@ reg byte y [ main::max#2 main::max#3 main::max#9 ] FINAL ASSEMBLER -Score: 466 +Score: 460 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -539,7 +543,6 @@ Score: 466 //SEG4 @1 //SEG5 [2] call main //SEG6 [4] phi from @1 to main [phi:@1->main] - jsr main //SEG7 [3] phi from @1 to @end [phi:@1->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/init-volatiles.asm b/src/test/ref/init-volatiles.asm index 02b209205..bec7432ac 100644 --- a/src/test/ref/init-volatiles.asm +++ b/src/test/ref/init-volatiles.asm @@ -1,7 +1,8 @@ .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" .label x = 2 +bbegin: lda #$c sta x jsr main diff --git a/src/test/ref/init-volatiles.log b/src/test/ref/init-volatiles.log index e17d73dbc..472eeb1a9 100644 --- a/src/test/ref/init-volatiles.log +++ b/src/test/ref/init-volatiles.log @@ -131,7 +131,7 @@ Allocated zp ZP_BYTE:3 [ x#2 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label x = 2 @@ -205,7 +205,7 @@ Coalescing zero page register [ zp ZP_BYTE:2 [ x#5 x#0 x#1 ] ] with [ zp ZP_BYTE ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label x = 2 @@ -270,7 +270,6 @@ Removing instruction bend_from_b1: Removing instruction b1_from_main: Removing instruction b1_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction bbegin: Removing instruction b1: Removing instruction bend: Removing instruction b3: @@ -299,11 +298,12 @@ Score: 147 //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label x = 2 //SEG2 @begin +bbegin: //SEG3 [0] (byte) x#0 ← (byte/signed byte/word/signed word/dword/signed dword) 12 -- vbuz1=vbuc1 lda #$c sta x diff --git a/src/test/ref/inline-asm.asm b/src/test/ref/inline-asm.asm index 54b806d27..6eff4c9f0 100644 --- a/src/test/ref/inline-asm.asm +++ b/src/test/ref/inline-asm.asm @@ -1,7 +1,6 @@ .pc = $801 "Basic" :BasicUpstart(main) .pc = $80d "Program" - jsr main main: { lda #'a' ldx #$ff diff --git a/src/test/ref/inline-asm.log b/src/test/ref/inline-asm.log index 4a46f14d9..ad6014b6b 100644 --- a/src/test/ref/inline-asm.log +++ b/src/test/ref/inline-asm.log @@ -64,7 +64,7 @@ Complete equivalence classes INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -113,7 +113,7 @@ Uplifting [] best 49 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -154,14 +154,18 @@ Removing instruction jmp b1 Removing instruction jmp bend Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination -Removing instruction bbegin: Removing instruction b1_from_bbegin: +Removing instruction b1: Removing instruction bend_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b1: Removing instruction bend: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @1 @@ -173,7 +177,7 @@ FINAL SYMBOL TABLE FINAL ASSEMBLER -Score: 40 +Score: 34 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -184,7 +188,6 @@ Score: 40 //SEG3 [1] phi from @begin to @1 [phi:@begin->@1] //SEG4 @1 //SEG5 [2] call main - jsr main //SEG6 [3] phi from @1 to @end [phi:@1->@end] //SEG7 @end //SEG8 main diff --git a/src/test/ref/inline-assignment.asm b/src/test/ref/inline-assignment.asm index 466d523db..cf4dcaffc 100644 --- a/src/test/ref/inline-assignment.asm +++ b/src/test/ref/inline-assignment.asm @@ -2,7 +2,6 @@ :BasicUpstart(main) .pc = $80d "Program" .label SCREEN = $400 - jsr main main: { ldx #0 b1: diff --git a/src/test/ref/inline-assignment.log b/src/test/ref/inline-assignment.log index 6aead4575..7584f209c 100644 --- a/src/test/ref/inline-assignment.log +++ b/src/test/ref/inline-assignment.log @@ -121,7 +121,7 @@ Allocated zp ZP_BYTE:2 [ main::a#0 main::i#1 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label SCREEN = $400 @@ -191,7 +191,7 @@ Uplifting [] best 333 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label SCREEN = $400 @@ -249,19 +249,23 @@ Removing instruction jmp b1 Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination Replacing label b1_from_b1 with b1 -Removing instruction bbegin: Removing instruction b1_from_bbegin: +Removing instruction b1: Removing instruction main_from_b1: Removing instruction bend_from_b1: Removing instruction b1_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b1: Removing instruction bend: Removing instruction b1_from_main: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Removing instruction jmp b1 Succesful ASM optimization Pass5NextJumpElimination +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @1 @@ -281,7 +285,7 @@ reg byte x [ main::a#0 main::i#1 ] FINAL ASSEMBLER -Score: 237 +Score: 231 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -294,7 +298,6 @@ Score: 237 //SEG4 @1 //SEG5 [2] call main //SEG6 [4] phi from @1 to main [phi:@1->main] - jsr main //SEG7 [3] phi from @1 to @end [phi:@1->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/inline-function-if.asm b/src/test/ref/inline-function-if.asm index c0d8c2e63..e3173f2e6 100644 --- a/src/test/ref/inline-function-if.asm +++ b/src/test/ref/inline-function-if.asm @@ -2,7 +2,6 @@ :BasicUpstart(main) .pc = $80d "Program" .label screen = $400 - jsr main main: { .const toUpper1_ch = 'c' .const toUpper2_ch = 'm' diff --git a/src/test/ref/inline-function-if.log b/src/test/ref/inline-function-if.log index 7ae2e0f6d..d80ee92ea 100644 --- a/src/test/ref/inline-function-if.log +++ b/src/test/ref/inline-function-if.log @@ -272,7 +272,7 @@ Complete equivalence classes INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label screen = $400 @@ -340,7 +340,7 @@ Uplifting [] best 99 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label screen = $400 @@ -403,8 +403,8 @@ Removing instruction jmp toUpper2 Removing instruction jmp b2 Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination -Removing instruction bbegin: Removing instruction b2_from_bbegin: +Removing instruction b2: Removing instruction main_from_b2: Removing instruction bend_from_b2: Removing instruction toUpper1_from_main: @@ -412,12 +412,16 @@ Removing instruction toUpper1: Removing instruction toUpper2_from_b1: Removing instruction toUpper2: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b2: Removing instruction bend: Removing instruction b1: Removing instruction b2: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @2 @@ -448,7 +452,7 @@ FINAL SYMBOL TABLE FINAL ASSEMBLER -Score: 24 +Score: 18 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -461,7 +465,6 @@ Score: 24 //SEG4 @2 //SEG5 [2] call main //SEG6 [4] phi from @2 to main [phi:@2->main] - jsr main //SEG7 [3] phi from @2 to @end [phi:@2->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/inline-function-level2.asm b/src/test/ref/inline-function-level2.asm index 1d0366ce0..c3723057f 100644 --- a/src/test/ref/inline-function-level2.asm +++ b/src/test/ref/inline-function-level2.asm @@ -2,7 +2,6 @@ :BasicUpstart(main) .pc = $80d "Program" .label cur_line = 4 - jsr main main: { .const line1_xpos = 2 .const line1_xadd = $40 diff --git a/src/test/ref/inline-function-level2.log b/src/test/ref/inline-function-level2.log index d1e9f59ec..768d62bb6 100644 --- a/src/test/ref/inline-function-level2.log +++ b/src/test/ref/inline-function-level2.log @@ -544,7 +544,7 @@ Allocated zp ZP_WORD:18 [ main::plot2_$0#0 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label cur_line = 6 @@ -825,7 +825,7 @@ Allocated (was zp ZP_WORD:15) zp ZP_WORD:6 [ main::plot1_$0#0 main::plot2_$0#0 ] ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label cur_line = 4 @@ -1053,8 +1053,8 @@ Replacing label b1_from_b1 with b1 Replacing label b1_from_b1 with b1 Replacing label line1_b1_from_b4 with line1_b1 Replacing label line2_b1_from_b6 with line2_b1 -Removing instruction bbegin: Removing instruction b3_from_bbegin: +Removing instruction b3: Removing instruction main_from_b3: Removing instruction bend_from_b3: Removing instruction b1_from_b1: @@ -1065,7 +1065,6 @@ Removing instruction line2_from_b4: Removing instruction line2_b1_from_line2: Removing instruction line2_b1_from_b6: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b3: Removing instruction bend: Removing instruction b1_from_main: Removing instruction line1: @@ -1076,10 +1075,15 @@ Removing instruction plot2: Removing instruction b6: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Removing instruction jmp b1 Removing instruction jmp line1_b1 Removing instruction jmp line2_b1 Succesful ASM optimization Pass5NextJumpElimination +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @3 @@ -1157,7 +1161,7 @@ reg byte a [ main::plot2_xpos#0 ] FINAL ASSEMBLER -Score: 2372 +Score: 2366 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -1170,7 +1174,6 @@ Score: 2372 //SEG4 @3 //SEG5 [2] call main //SEG6 [4] phi from @3 to main [phi:@3->main] - jsr main //SEG7 [3] phi from @3 to @end [phi:@3->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/inline-function-min.asm b/src/test/ref/inline-function-min.asm index 723d22cd4..660569959 100644 --- a/src/test/ref/inline-function-min.asm +++ b/src/test/ref/inline-function-min.asm @@ -2,7 +2,6 @@ :BasicUpstart(main) .pc = $80d "Program" .label screen = $400 - jsr main main: { .const sum1_a = 2 .const sum1_b = 1 diff --git a/src/test/ref/inline-function-min.log b/src/test/ref/inline-function-min.log index 099992d37..22afbd671 100644 --- a/src/test/ref/inline-function-min.log +++ b/src/test/ref/inline-function-min.log @@ -267,7 +267,7 @@ Complete equivalence classes INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label screen = $400 @@ -353,7 +353,7 @@ Uplifting [] best 138 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label screen = $400 @@ -435,8 +435,8 @@ Removing instruction jmp sum3 Removing instruction jmp b3 Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination -Removing instruction bbegin: Removing instruction b2_from_bbegin: +Removing instruction b2: Removing instruction main_from_b2: Removing instruction bend_from_b2: Removing instruction sum1_from_main: @@ -446,13 +446,17 @@ Removing instruction sum2: Removing instruction sum3_from_b2: Removing instruction sum3: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b2: Removing instruction bend: Removing instruction b1: Removing instruction b2: Removing instruction b3: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @2 @@ -493,7 +497,7 @@ FINAL SYMBOL TABLE FINAL ASSEMBLER -Score: 30 +Score: 24 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -506,7 +510,6 @@ Score: 30 //SEG4 @2 //SEG5 [2] call main //SEG6 [4] phi from @2 to main [phi:@2->main] - jsr main //SEG7 [3] phi from @2 to @end [phi:@2->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/inline-function-print.asm b/src/test/ref/inline-function-print.asm index 357e80b2d..14f5b2cdd 100644 --- a/src/test/ref/inline-function-print.asm +++ b/src/test/ref/inline-function-print.asm @@ -2,7 +2,6 @@ :BasicUpstart(main) .pc = $80d "Program" .label screen = $400 - jsr main main: { .label print2_at = screen+2*$28 ldx #0 diff --git a/src/test/ref/inline-function-print.log b/src/test/ref/inline-function-print.log index 2bc51f1a0..dc6113279 100644 --- a/src/test/ref/inline-function-print.log +++ b/src/test/ref/inline-function-print.log @@ -292,7 +292,7 @@ Allocated zp ZP_BYTE:5 [ main::print2_j#2 main::print2_j#1 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label screen = $400 @@ -431,7 +431,7 @@ Uplifting [] best 744 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label screen = $400 @@ -535,8 +535,8 @@ Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination Replacing label print1_b1_from_print1_b1 with print1_b1 Replacing label print2_b1_from_print2_b1 with print2_b1 -Removing instruction bbegin: Removing instruction b2_from_bbegin: +Removing instruction b2: Removing instruction main_from_b2: Removing instruction bend_from_b2: Removing instruction print1_from_main: @@ -546,15 +546,19 @@ Removing instruction print2_from_print1_b1: Removing instruction print2_b1_from_print2: Removing instruction print2_b1_from_print2_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b2: Removing instruction bend: Removing instruction print1: Removing instruction print2: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Removing instruction jmp print1_b1 Removing instruction jmp print2_b1 Succesful ASM optimization Pass5NextJumpElimination +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @2 @@ -597,7 +601,7 @@ reg byte x [ main::print2_j#2 main::print2_j#1 ] FINAL ASSEMBLER -Score: 582 +Score: 576 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -610,7 +614,6 @@ Score: 582 //SEG4 @2 //SEG5 [2] call main //SEG6 [4] phi from @2 to main [phi:@2->main] - jsr main //SEG7 [3] phi from @2 to @end [phi:@2->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/inline-function.asm b/src/test/ref/inline-function.asm index 9e5f8af12..a55247be4 100644 --- a/src/test/ref/inline-function.asm +++ b/src/test/ref/inline-function.asm @@ -7,7 +7,6 @@ .label screen = $400 .label charset1 = $1000 .label charset2 = $1800 - jsr main main: { .const toD0181_return = screen/$40|charset1/$400 .const toD0182_return = screen/$40|charset2/$400 diff --git a/src/test/ref/inline-function.log b/src/test/ref/inline-function.log index a6cd67a14..defa7c71d 100644 --- a/src/test/ref/inline-function.log +++ b/src/test/ref/inline-function.log @@ -585,7 +585,7 @@ Complete equivalence classes INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label RASTER = $d012 @@ -677,7 +677,7 @@ Uplifting [] best 2137 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label RASTER = $d012 @@ -761,19 +761,23 @@ Removing instruction jmp b7 Removing instruction jmp toD0182 Removing instruction jmp b20 Succesful ASM optimization Pass5NextJumpElimination -Removing instruction bbegin: Removing instruction b2_from_bbegin: +Removing instruction b2: Removing instruction bend_from_b2: Removing instruction toD0181_from_b4: Removing instruction toD0181: Removing instruction toD0182_from_b7: Removing instruction toD0182: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b2: Removing instruction bend: Removing instruction b19: Removing instruction b20: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @2 @@ -822,7 +826,7 @@ FINAL SYMBOL TABLE FINAL ASSEMBLER -Score: 1978 +Score: 1972 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -839,7 +843,6 @@ Score: 1978 //SEG3 [1] phi from @begin to @2 [phi:@begin->@2] //SEG4 @2 //SEG5 [2] call main - jsr main //SEG6 [3] phi from @2 to @end [phi:@2->@end] //SEG7 @end //SEG8 main diff --git a/src/test/ref/inline-string-2.asm b/src/test/ref/inline-string-2.asm index ec0b300f8..41aaef5df 100644 --- a/src/test/ref/inline-string-2.asm +++ b/src/test/ref/inline-string-2.asm @@ -2,7 +2,6 @@ :BasicUpstart(main) .pc = $80d "Program" .label screen = 2 - jsr main main: { lda #<$400 sta screen diff --git a/src/test/ref/inline-string-2.log b/src/test/ref/inline-string-2.log index 0c0955466..d7ea7cf52 100644 --- a/src/test/ref/inline-string-2.log +++ b/src/test/ref/inline-string-2.log @@ -315,7 +315,7 @@ Allocated zp ZP_WORD:7 [ print::msg#2 print::msg#0 print::msg#1 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label screen = 3 @@ -483,7 +483,7 @@ Allocated (was zp ZP_WORD:5) zp ZP_WORD:4 [ print_msg::msg#2 print::msg#2 print: ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label screen = 2 @@ -632,8 +632,8 @@ Succesful ASM optimization Pass5NextJumpElimination Removing instruction ldy #0 Succesful ASM optimization Pass5UnnecesaryLoadElimination Replacing label b1_from_b2 with b1 -Removing instruction bbegin: Removing instruction b3_from_bbegin: +Removing instruction b3: Removing instruction main_from_b3: Removing instruction bend_from_b3: Removing instruction b1_from_main: @@ -643,7 +643,6 @@ Removing instruction b2_from_b3: Removing instruction b1_from_print: Removing instruction b1_from_b2: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b3: Removing instruction bend: Removing instruction print_msg_from_main: Removing instruction b1: @@ -653,8 +652,13 @@ Removing instruction print_from_b2: Removing instruction breturn: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Relabelling long label b2_from_print_msg to b1 Succesful ASM optimization Pass5RelabelLongLabels +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @3 @@ -692,7 +696,7 @@ zp ZP_WORD:4 [ print_msg::msg#2 print::msg#2 print::msg#0 print::msg#1 ] FINAL ASSEMBLER -Score: 618 +Score: 612 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -705,7 +709,6 @@ Score: 618 //SEG4 @3 //SEG5 [2] call main //SEG6 [4] phi from @3 to main [phi:@3->main] - jsr main //SEG7 [3] phi from @3 to @end [phi:@3->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/inline-string-3.asm b/src/test/ref/inline-string-3.asm index 50e6fa706..6bb2846f0 100644 --- a/src/test/ref/inline-string-3.asm +++ b/src/test/ref/inline-string-3.asm @@ -1,7 +1,6 @@ .pc = $801 "Basic" :BasicUpstart(main) .pc = $80d "Program" - jsr main main: { .label PTR = $9ffe .label SCREEN = $400 diff --git a/src/test/ref/inline-string-3.log b/src/test/ref/inline-string-3.log index 08c48d2e3..d840191cc 100644 --- a/src/test/ref/inline-string-3.log +++ b/src/test/ref/inline-string-3.log @@ -121,7 +121,7 @@ Allocated zp ZP_WORD:2 [ main::$6 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -183,7 +183,7 @@ Uplifting [] best 58 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -233,14 +233,18 @@ Removing instruction jmp b1 Removing instruction jmp bend Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination -Removing instruction bbegin: Removing instruction b1_from_bbegin: +Removing instruction b1: Removing instruction bend_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b1: Removing instruction bend: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @1 @@ -261,7 +265,7 @@ zp ZP_WORD:2 [ main::$6 ] FINAL ASSEMBLER -Score: 49 +Score: 43 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -272,7 +276,6 @@ Score: 49 //SEG3 [1] phi from @begin to @1 [phi:@begin->@1] //SEG4 @1 //SEG5 [2] call main - jsr main //SEG6 [3] phi from @1 to @end [phi:@1->@end] //SEG7 @end //SEG8 main diff --git a/src/test/ref/inline-string.asm b/src/test/ref/inline-string.asm index 58abe0e0f..5166e8294 100644 --- a/src/test/ref/inline-string.asm +++ b/src/test/ref/inline-string.asm @@ -2,7 +2,6 @@ :BasicUpstart(main) .pc = $80d "Program" .label screen = 2 - jsr main main: { lda #<$400 sta screen diff --git a/src/test/ref/inline-string.log b/src/test/ref/inline-string.log index 0b43a012e..eb43b38e7 100644 --- a/src/test/ref/inline-string.log +++ b/src/test/ref/inline-string.log @@ -249,7 +249,7 @@ Allocated zp ZP_WORD:4 [ print::msg#4 print::msg#6 print::msg#3 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label screen = 2 @@ -383,7 +383,7 @@ Uplifting [main] best 706 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label screen = 2 @@ -511,8 +511,8 @@ Succesful ASM optimization Pass5NextJumpElimination Removing instruction ldy #0 Succesful ASM optimization Pass5UnnecesaryLoadElimination Replacing label b1_from_b2 with b1 -Removing instruction bbegin: Removing instruction b2_from_bbegin: +Removing instruction b2: Removing instruction main_from_b2: Removing instruction bend_from_b2: Removing instruction b1_from_main: @@ -522,7 +522,6 @@ Removing instruction print_from_b2: Removing instruction b1_from_print: Removing instruction b1_from_b2: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b2: Removing instruction bend: Removing instruction print_from_main: Removing instruction b1: @@ -530,6 +529,11 @@ Removing instruction b2: Removing instruction breturn: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @2 @@ -562,7 +566,7 @@ zp ZP_WORD:4 [ print::msg#4 print::msg#6 print::msg#3 ] FINAL ASSEMBLER -Score: 611 +Score: 605 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -575,7 +579,6 @@ Score: 611 //SEG4 @2 //SEG5 [2] call main //SEG6 [4] phi from @2 to main [phi:@2->main] - jsr main //SEG7 [3] phi from @2 to @end [phi:@2->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/inline-word.asm b/src/test/ref/inline-word.asm index 54c50d0c4..79faad31c 100644 --- a/src/test/ref/inline-word.asm +++ b/src/test/ref/inline-word.asm @@ -2,7 +2,6 @@ :BasicUpstart(main) .pc = $80d "Program" .label SCREEN = $400 - jsr main main: { .label w = 3 .label h = 2 diff --git a/src/test/ref/inline-word.log b/src/test/ref/inline-word.log index b0f77551d..0e8267baa 100644 --- a/src/test/ref/inline-word.log +++ b/src/test/ref/inline-word.log @@ -206,7 +206,7 @@ Allocated zp ZP_WORD:4 [ main::w#0 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label SCREEN = $400 @@ -314,7 +314,7 @@ Allocated (was zp ZP_WORD:4) zp ZP_WORD:3 [ main::w#0 ] ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label SCREEN = $400 @@ -402,23 +402,27 @@ Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination Replacing label b2_from_b2 with b2 Replacing label b1_from_b3 with b1 -Removing instruction bbegin: Removing instruction b1_from_bbegin: +Removing instruction b1: Removing instruction main_from_b1: Removing instruction bend_from_b1: Removing instruction b1_from_b3: Removing instruction b2_from_b1: Removing instruction b2_from_b2: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b1: Removing instruction bend: Removing instruction b1_from_main: Removing instruction b3: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Removing instruction jmp b1 Removing instruction jmp b2 Succesful ASM optimization Pass5NextJumpElimination +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @1 @@ -449,7 +453,7 @@ zp ZP_WORD:3 [ main::w#0 ] FINAL ASSEMBLER -Score: 3387 +Score: 3381 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -462,7 +466,6 @@ Score: 3387 //SEG4 @1 //SEG5 [2] call main //SEG6 [4] phi from @1 to main [phi:@1->main] - jsr main //SEG7 [3] phi from @1 to @end [phi:@1->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/inlinearrayproblem.asm b/src/test/ref/inlinearrayproblem.asm index f3cb5d3b2..29d12b3a7 100644 --- a/src/test/ref/inlinearrayproblem.asm +++ b/src/test/ref/inlinearrayproblem.asm @@ -3,7 +3,6 @@ .pc = $80d "Program" .label SCREEN = $400 .label SCREEN2 = $400+$28 - jsr main main: { ldx #0 b1: diff --git a/src/test/ref/inlinearrayproblem.log b/src/test/ref/inlinearrayproblem.log index 9932f193d..b83765299 100644 --- a/src/test/ref/inlinearrayproblem.log +++ b/src/test/ref/inlinearrayproblem.log @@ -155,7 +155,7 @@ Allocated zp ZP_BYTE:2 [ main::i#2 main::i#1 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label SCREEN = $400 @@ -232,7 +232,7 @@ Uplifting [] best 383 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label SCREEN = $400 @@ -293,19 +293,23 @@ Removing instruction jmp b1 Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination Replacing label b1_from_b1 with b1 -Removing instruction bbegin: Removing instruction b1_from_bbegin: +Removing instruction b1: Removing instruction main_from_b1: Removing instruction bend_from_b1: Removing instruction b1_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b1: Removing instruction bend: Removing instruction b1_from_main: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Removing instruction jmp b1 Succesful ASM optimization Pass5NextJumpElimination +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @1 @@ -330,7 +334,7 @@ reg byte x [ main::i#2 main::i#1 ] FINAL ASSEMBLER -Score: 287 +Score: 281 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -344,7 +348,6 @@ Score: 287 //SEG4 @1 //SEG5 [2] call main //SEG6 [4] phi from @1 to main [phi:@1->main] - jsr main //SEG7 [3] phi from @1 to @end [phi:@1->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/inmem-const-array.asm b/src/test/ref/inmem-const-array.asm index c2e7819c4..e530fe0de 100644 --- a/src/test/ref/inmem-const-array.asm +++ b/src/test/ref/inmem-const-array.asm @@ -4,7 +4,6 @@ .const WHITE = 1 .const RED = 2 .const GREEN = 5 - jsr main main: { .label screen = $400 .label cols = $d800 diff --git a/src/test/ref/inmem-const-array.log b/src/test/ref/inmem-const-array.log index 86ac89a7e..91afc5432 100644 --- a/src/test/ref/inmem-const-array.log +++ b/src/test/ref/inmem-const-array.log @@ -237,7 +237,7 @@ Allocated zp ZP_BYTE:3 [ main::j#3 main::j#4 main::j#1 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .const WHITE = 1 @@ -347,7 +347,7 @@ Uplifting [] best 553 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .const WHITE = 1 @@ -437,24 +437,27 @@ Removing instruction jmp b6 Succesful ASM optimization Pass5NextJumpElimination Replacing label b6_from_b1 with b6 Replacing label b1_from_b2 with b1 -Removing instruction bbegin: Removing instruction b1_from_bbegin: +Removing instruction b1: Removing instruction main_from_b1: Removing instruction bend_from_b1: Removing instruction b1_from_b2: Removing instruction b6_from_b1: Removing instruction b2_from_b6: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b1: Removing instruction bend: Removing instruction b1_from_main: Removing instruction b2_from_b1: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Skipping double jump to b2 in bne b6 Succesful ASM optimization Pass5DoubleJumpElimination Removing instruction jmp b1 Succesful ASM optimization Pass5NextJumpElimination +Removing instruction bbegin: Removing instruction b6: Succesful ASM optimization Pass5UnusedLabelElimination Removing unreachable instruction jmp b2 @@ -494,7 +497,7 @@ reg byte y [ main::j#3 main::j#4 main::j#1 ] FINAL ASSEMBLER -Score: 367 +Score: 361 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -509,7 +512,6 @@ Score: 367 //SEG4 @1 //SEG5 [2] call main //SEG6 [4] phi from @1 to main [phi:@1->main] - jsr main //SEG7 [3] phi from @1 to @end [phi:@1->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/inmemarray.asm b/src/test/ref/inmemarray.asm index 0bcc9c283..12ab81e67 100644 --- a/src/test/ref/inmemarray.asm +++ b/src/test/ref/inmemarray.asm @@ -2,7 +2,6 @@ :BasicUpstart(main) .pc = $80d "Program" .label SCREEN = $400 - jsr main main: { ldx #0 ldy #0 diff --git a/src/test/ref/inmemarray.log b/src/test/ref/inmemarray.log index 033236291..751ae1bc9 100644 --- a/src/test/ref/inmemarray.log +++ b/src/test/ref/inmemarray.log @@ -192,7 +192,7 @@ Allocated zp ZP_BYTE:3 [ main::i#2 main::i#1 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label SCREEN = $400 @@ -292,7 +292,7 @@ Uplifting [] best 483 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label SCREEN = $400 @@ -375,24 +375,27 @@ Removing instruction jmp b6 Succesful ASM optimization Pass5NextJumpElimination Replacing label b6_from_b1 with b6 Replacing label b1_from_b2 with b1 -Removing instruction bbegin: Removing instruction b1_from_bbegin: +Removing instruction b1: Removing instruction main_from_b1: Removing instruction bend_from_b1: Removing instruction b1_from_b2: Removing instruction b6_from_b1: Removing instruction b2_from_b6: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b1: Removing instruction bend: Removing instruction b1_from_main: Removing instruction b2_from_b1: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Skipping double jump to b2 in bne b6 Succesful ASM optimization Pass5DoubleJumpElimination Removing instruction jmp b1 Succesful ASM optimization Pass5NextJumpElimination +Removing instruction bbegin: Removing instruction b6: Succesful ASM optimization Pass5UnusedLabelElimination Removing unreachable instruction jmp b2 @@ -424,7 +427,7 @@ reg byte x [ main::i#2 main::i#1 ] FINAL ASSEMBLER -Score: 297 +Score: 291 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -437,7 +440,6 @@ Score: 297 //SEG4 @1 //SEG5 [2] call main //SEG6 [4] phi from @1 to main [phi:@1->main] - jsr main //SEG7 [3] phi from @1 to @end [phi:@1->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/inmemstring.asm b/src/test/ref/inmemstring.asm index 5f1dab107..bf1c844e9 100644 --- a/src/test/ref/inmemstring.asm +++ b/src/test/ref/inmemstring.asm @@ -2,7 +2,6 @@ :BasicUpstart(main) .pc = $80d "Program" .label SCREEN = $400 - jsr main main: { .label cursor = 2 lda #main] - jsr main //SEG7 [3] phi from @1 to @end [phi:@1->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/interrupt-volatile-reuse-problem1.asm b/src/test/ref/interrupt-volatile-reuse-problem1.asm index 9349654b8..ce59faeef 100644 --- a/src/test/ref/interrupt-volatile-reuse-problem1.asm +++ b/src/test/ref/interrupt-volatile-reuse-problem1.asm @@ -1,10 +1,11 @@ .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" .label KERNEL_IRQ = $314 .label SCREEN = $400 .label col1 = 2 .label col2 = 3 +bbegin: lda #0 sta col1 lda #8 diff --git a/src/test/ref/interrupt-volatile-reuse-problem1.log b/src/test/ref/interrupt-volatile-reuse-problem1.log index b1b39c224..9946eac3e 100644 --- a/src/test/ref/interrupt-volatile-reuse-problem1.log +++ b/src/test/ref/interrupt-volatile-reuse-problem1.log @@ -154,7 +154,7 @@ Allocated zp ZP_BYTE:5 [ col2#1 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label KERNEL_IRQ = $314 @@ -255,7 +255,7 @@ Coalescing zero page register with common assignment [ zp ZP_BYTE:3 [ col2#0 ] ] ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label KERNEL_IRQ = $314 @@ -324,7 +324,6 @@ Succesful ASM optimization Pass5NextJumpElimination Removing instruction b2_from_bbegin: Removing instruction bend_from_b2: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction bbegin: Removing instruction b2: Removing instruction bend: Removing instruction breturn: @@ -359,7 +358,7 @@ Score: 61 //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label KERNEL_IRQ = $314 @@ -367,6 +366,7 @@ Score: 61 .label col1 = 2 .label col2 = 3 //SEG2 @begin +bbegin: //SEG3 [0] (byte) col1#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1 lda #0 sta col1 diff --git a/src/test/ref/interrupt-volatile-reuse-problem2.asm b/src/test/ref/interrupt-volatile-reuse-problem2.asm index 330769f97..68bd9761b 100644 --- a/src/test/ref/interrupt-volatile-reuse-problem2.asm +++ b/src/test/ref/interrupt-volatile-reuse-problem2.asm @@ -1,10 +1,11 @@ .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" .label KERNEL_IRQ = $314 .label IRQ_STATUS = $d019 .label SCREEN = $400 .label col1 = 3 +bbegin: lda #0 sta col1 jsr main diff --git a/src/test/ref/interrupt-volatile-reuse-problem2.log b/src/test/ref/interrupt-volatile-reuse-problem2.log index efdd4024a..055bbfff5 100644 --- a/src/test/ref/interrupt-volatile-reuse-problem2.log +++ b/src/test/ref/interrupt-volatile-reuse-problem2.log @@ -296,7 +296,7 @@ Allocated zp ZP_BYTE:7 [ col1#1 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label KERNEL_IRQ = $314 @@ -478,7 +478,7 @@ Allocated (was zp ZP_BYTE:5) zp ZP_BYTE:3 [ col1#0 col1#1 ] ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label KERNEL_IRQ = $314 @@ -624,7 +624,6 @@ Removing instruction b6_from_b6: Removing instruction b13_from_b10: Removing instruction b4_from_b13: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction bbegin: Removing instruction b2: Removing instruction bend: Removing instruction b9: @@ -689,7 +688,7 @@ Score: 223698 //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label KERNEL_IRQ = $314 @@ -697,6 +696,7 @@ Score: 223698 .label SCREEN = $400 .label col1 = 3 //SEG2 @begin +bbegin: //SEG3 [0] (byte) col1#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1 lda #0 sta col1 diff --git a/src/test/ref/irq-hardware-clobber-jsr.asm b/src/test/ref/irq-hardware-clobber-jsr.asm index 378ab000b..5e7f0598e 100644 --- a/src/test/ref/irq-hardware-clobber-jsr.asm +++ b/src/test/ref/irq-hardware-clobber-jsr.asm @@ -17,7 +17,6 @@ .label HARDWARE_IRQ = $fffe .const BLACK = 0 .const WHITE = 1 - jsr main main: { sei lda #PROCPORT_DDR_MEMORY_MASK diff --git a/src/test/ref/irq-hardware-clobber-jsr.log b/src/test/ref/irq-hardware-clobber-jsr.log index d82b71641..11394a691 100644 --- a/src/test/ref/irq-hardware-clobber-jsr.log +++ b/src/test/ref/irq-hardware-clobber-jsr.log @@ -540,7 +540,7 @@ Complete equivalence classes INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label PROCPORT_DDR = 0 @@ -682,7 +682,7 @@ Removing interrupt register storage ldy #00 in SEG24 [16] return - exit interru ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label PROCPORT_DDR = 0 @@ -791,15 +791,19 @@ Removing instruction jmp b2 Removing instruction jmp breturn Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination -Removing instruction bbegin: Removing instruction b7_from_bbegin: +Removing instruction b7: Removing instruction bend_from_b7: Removing instruction breturn: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b7: Removing instruction bend: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @7 @@ -910,7 +914,7 @@ interrupt(HARDWARE_CLOBBER)(void()) irq() FINAL ASSEMBLER -Score: 230 +Score: 224 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -937,7 +941,6 @@ Score: 230 //SEG3 [1] phi from @begin to @7 [phi:@begin->@7] //SEG4 @7 //SEG5 [2] call main - jsr main //SEG6 [3] phi from @7 to @end [phi:@7->@end] //SEG7 @end //SEG8 main diff --git a/src/test/ref/irq-hardware-clobber.asm b/src/test/ref/irq-hardware-clobber.asm index a0a5bd168..cacbcfd89 100644 --- a/src/test/ref/irq-hardware-clobber.asm +++ b/src/test/ref/irq-hardware-clobber.asm @@ -17,7 +17,6 @@ .const PROCPORT_DDR_MEMORY_MASK = 7 .label PROCPORT = 1 .const PROCPORT_RAM_IO = $35 - jsr main main: { sei lda #PROCPORT_DDR_MEMORY_MASK diff --git a/src/test/ref/irq-hardware-clobber.log b/src/test/ref/irq-hardware-clobber.log index d2741e88d..cd12326eb 100644 --- a/src/test/ref/irq-hardware-clobber.log +++ b/src/test/ref/irq-hardware-clobber.log @@ -221,7 +221,7 @@ Complete equivalence classes INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label HARDWARE_IRQ = $fffe @@ -351,7 +351,7 @@ Removing interrupt register storage ldy #00 in SEG26 [17] return - exit interru ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label HARDWARE_IRQ = $fffe @@ -449,14 +449,18 @@ Removing instruction jmp bend Removing instruction jmp b2 Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination -Removing instruction bbegin: Removing instruction b2_from_bbegin: +Removing instruction b2: Removing instruction bend_from_b2: Removing instruction breturn: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b2: Removing instruction bend: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @2 @@ -506,7 +510,7 @@ interrupt(HARDWARE_CLOBBER)(void()) irq() FINAL ASSEMBLER -Score: 218 +Score: 212 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -533,7 +537,6 @@ Score: 218 //SEG3 [1] phi from @begin to @2 [phi:@begin->@2] //SEG4 @2 //SEG5 [2] call main - jsr main //SEG6 [3] phi from @2 to @end [phi:@2->@end] //SEG7 @end //SEG8 main diff --git a/src/test/ref/irq-hardware.asm b/src/test/ref/irq-hardware.asm index 323756614..df86f05ff 100644 --- a/src/test/ref/irq-hardware.asm +++ b/src/test/ref/irq-hardware.asm @@ -17,7 +17,6 @@ .const PROCPORT_DDR_MEMORY_MASK = 7 .label PROCPORT = 1 .const PROCPORT_RAM_IO = $35 - jsr main main: { sei lda #PROCPORT_DDR_MEMORY_MASK diff --git a/src/test/ref/irq-hardware.log b/src/test/ref/irq-hardware.log index aeb6ad053..ac648f92a 100644 --- a/src/test/ref/irq-hardware.log +++ b/src/test/ref/irq-hardware.log @@ -221,7 +221,7 @@ Complete equivalence classes INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label HARDWARE_IRQ = $fffe @@ -344,7 +344,7 @@ Uplifting [] best 314 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label HARDWARE_IRQ = $fffe @@ -448,14 +448,18 @@ Removing instruction jmp bend Removing instruction jmp b2 Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination -Removing instruction bbegin: Removing instruction b2_from_bbegin: +Removing instruction b2: Removing instruction bend_from_b2: Removing instruction breturn: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b2: Removing instruction bend: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @2 @@ -505,7 +509,7 @@ interrupt(HARDWARE_ALL)(void()) irq() FINAL ASSEMBLER -Score: 302 +Score: 296 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -532,7 +536,6 @@ Score: 302 //SEG3 [1] phi from @begin to @2 [phi:@begin->@2] //SEG4 @2 //SEG5 [2] call main - jsr main //SEG6 [3] phi from @2 to @end [phi:@2->@end] //SEG7 @end //SEG8 main diff --git a/src/test/ref/irq-kernel.asm b/src/test/ref/irq-kernel.asm index bc6fbb264..b23230236 100644 --- a/src/test/ref/irq-kernel.asm +++ b/src/test/ref/irq-kernel.asm @@ -12,7 +12,6 @@ .const BLACK = 0 .label CIA1_INTERRUPT = $dc0d .const CIA_INTERRUPT_CLEAR = $7f - jsr main main: { sei lda #CIA_INTERRUPT_CLEAR diff --git a/src/test/ref/irq-kernel.log b/src/test/ref/irq-kernel.log index 38a157d63..2bb4a7ad8 100644 --- a/src/test/ref/irq-kernel.log +++ b/src/test/ref/irq-kernel.log @@ -173,7 +173,7 @@ Complete equivalence classes INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label KERNEL_IRQ = $314 @@ -272,7 +272,7 @@ Uplifting [] best 89 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label KERNEL_IRQ = $314 @@ -355,15 +355,19 @@ Removing instruction jmp bend Removing instruction jmp breturn Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination -Removing instruction bbegin: Removing instruction b2_from_bbegin: +Removing instruction b2: Removing instruction bend_from_b2: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b2: Removing instruction bend: Removing instruction breturn: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @2 @@ -402,7 +406,7 @@ interrupt(KERNEL_KEYBOARD)(void()) irq() FINAL ASSEMBLER -Score: 77 +Score: 71 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -424,7 +428,6 @@ Score: 77 //SEG3 [1] phi from @begin to @2 [phi:@begin->@2] //SEG4 @2 //SEG5 [2] call main - jsr main //SEG6 [3] phi from @2 to @end [phi:@2->@end] //SEG7 @end //SEG8 main diff --git a/src/test/ref/irq-raster.asm b/src/test/ref/irq-raster.asm index 228dd630a..bbfdbc200 100644 --- a/src/test/ref/irq-raster.asm +++ b/src/test/ref/irq-raster.asm @@ -12,7 +12,6 @@ .const BLACK = 0 .label CIA1_INTERRUPT = $dc0d .const CIA_INTERRUPT_CLEAR = $7f - jsr main main: { sei lda #CIA_INTERRUPT_CLEAR diff --git a/src/test/ref/irq-raster.log b/src/test/ref/irq-raster.log index 8db9bfe12..728226b02 100644 --- a/src/test/ref/irq-raster.log +++ b/src/test/ref/irq-raster.log @@ -173,7 +173,7 @@ Complete equivalence classes INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label KERNEL_IRQ = $314 @@ -272,7 +272,7 @@ Uplifting [] best 89 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label KERNEL_IRQ = $314 @@ -355,15 +355,19 @@ Removing instruction jmp bend Removing instruction jmp breturn Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination -Removing instruction bbegin: Removing instruction b2_from_bbegin: +Removing instruction b2: Removing instruction bend_from_b2: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b2: Removing instruction bend: Removing instruction breturn: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @2 @@ -402,7 +406,7 @@ interrupt(KERNEL_MIN)(void()) irq() FINAL ASSEMBLER -Score: 77 +Score: 71 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -424,7 +428,6 @@ Score: 77 //SEG3 [1] phi from @begin to @2 [phi:@begin->@2] //SEG4 @2 //SEG5 [2] call main - jsr main //SEG6 [3] phi from @2 to @end [phi:@2->@end] //SEG7 @end //SEG8 main diff --git a/src/test/ref/iterarray.asm b/src/test/ref/iterarray.asm index 990142d63..639f579a9 100644 --- a/src/test/ref/iterarray.asm +++ b/src/test/ref/iterarray.asm @@ -1,7 +1,6 @@ .pc = $801 "Basic" :BasicUpstart(main) .pc = $80d "Program" - jsr main main: { .label buf = $1100 ldx #5 diff --git a/src/test/ref/iterarray.log b/src/test/ref/iterarray.log index 7df14d419..51560827b 100644 --- a/src/test/ref/iterarray.log +++ b/src/test/ref/iterarray.log @@ -124,7 +124,7 @@ Allocated zp ZP_BYTE:3 [ main::$1 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -199,7 +199,7 @@ Uplifting [] best 303 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -257,19 +257,23 @@ Removing instruction jmp b1 Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination Replacing label b1_from_b1 with b1 -Removing instruction bbegin: Removing instruction b1_from_bbegin: +Removing instruction b1: Removing instruction main_from_b1: Removing instruction bend_from_b1: Removing instruction b1_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b1: Removing instruction bend: Removing instruction b1_from_main: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Removing instruction jmp b1 Succesful ASM optimization Pass5NextJumpElimination +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @1 @@ -290,7 +294,7 @@ reg byte a [ main::$1 ] FINAL ASSEMBLER -Score: 207 +Score: 201 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -302,7 +306,6 @@ Score: 207 //SEG4 @1 //SEG5 [2] call main //SEG6 [4] phi from @1 to main [phi:@1->main] - jsr main //SEG7 [3] phi from @1 to @end [phi:@1->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/keyboard-glitch.asm b/src/test/ref/keyboard-glitch.asm index 5a205deff..437c2825a 100644 --- a/src/test/ref/keyboard-glitch.asm +++ b/src/test/ref/keyboard-glitch.asm @@ -12,7 +12,6 @@ .const KEY_I = $21 .const KEY_SPACE = $3c .label SCREEN = $400 - jsr main main: { lda #GREEN sta BORDERCOL diff --git a/src/test/ref/keyboard-glitch.log b/src/test/ref/keyboard-glitch.log index 703e40c69..432d9dceb 100644 --- a/src/test/ref/keyboard-glitch.log +++ b/src/test/ref/keyboard-glitch.log @@ -1334,7 +1334,7 @@ Allocated zp ZP_BYTE:17 [ pressed::$0 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label BORDERCOL = $d020 @@ -1666,7 +1666,7 @@ Uplifting [keyboard_key_pressed] best 6202 combination reg byte y [ keyboard_key ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label BORDERCOL = $d020 @@ -1918,8 +1918,8 @@ Replacing label b4_from_b16 with b4 Replacing label b5_from_b17 with b5 Replacing label b2_from_b6 with b2 Replacing label b2_from_b10 with b2 -Removing instruction bbegin: Removing instruction b14_from_bbegin: +Removing instruction b14: Removing instruction bend_from_b14: Removing instruction b2_from_main: Removing instruction b2_from_b2: @@ -1936,7 +1936,6 @@ Removing instruction b2_from_pressed: Removing instruction b2_from_b10: Removing instruction keyboard_key_pressed_from_b2: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b14: Removing instruction bend: Removing instruction b16: Removing instruction b9: @@ -1950,6 +1949,11 @@ Removing instruction breturn: Removing instruction b10: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @14 @@ -2190,7 +2194,7 @@ reg byte a [ pressed::$0 ] FINAL ASSEMBLER -Score: 2851 +Score: 2845 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -2212,7 +2216,6 @@ Score: 2851 //SEG3 [1] phi from @begin to @14 [phi:@begin->@14] //SEG4 @14 //SEG5 [2] call main - jsr main //SEG6 [3] phi from @14 to @end [phi:@14->@end] //SEG7 @end //SEG8 main diff --git a/src/test/ref/line-anim.asm b/src/test/ref/line-anim.asm index 74ce93c3c..7b7b567aa 100644 --- a/src/test/ref/line-anim.asm +++ b/src/test/ref/line-anim.asm @@ -19,7 +19,6 @@ .const DELAY = 8 .label rem16s = 3 .label rem16u = 9 - jsr main main: { .const vicSelectGfxBank1_toDd001_return = 3^(>SCREEN)>>6 .const toD0181_return = (>(SCREEN&$3fff)<<2)|(>BITMAP)>>2&$f diff --git a/src/test/ref/line-anim.log b/src/test/ref/line-anim.log index 1e4e39578..cc06d7a31 100644 --- a/src/test/ref/line-anim.log +++ b/src/test/ref/line-anim.log @@ -3107,7 +3107,7 @@ Allocated zp ZP_BYTE:97 [ bitmap_init::$7 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label PROCPORT_DDR = 0 @@ -4501,7 +4501,7 @@ Allocated (was zp ZP_WORD:53) zp ZP_WORD:14 [ point_init::$4 point_init::y_diff# ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label PROCPORT_DDR = 0 @@ -5563,8 +5563,8 @@ Replacing label b10_from_b1 with b10 Replacing label b1_from_b2 with b1 Replacing label b4_from_b3 with b4 Replacing label b3_from_b4 with b3 -Removing instruction bbegin: Removing instruction b19_from_bbegin: +Removing instruction b19: Removing instruction bend_from_b19: Removing instruction vicSelectGfxBank1_toDd001_from_vicSelectGfxBank1: Removing instruction vicSelectGfxBank1_toDd001: @@ -5604,7 +5604,6 @@ Removing instruction b4_from_b7: Removing instruction b10_from_b1: Removing instruction b2_from_b10: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b19: Removing instruction bend: Removing instruction vicSelectGfxBank1: Removing instruction vicSelectGfxBank1_b1: @@ -5648,6 +5647,9 @@ Removing instruction b3_from_b2: Removing instruction b7: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Skipping double jump to b2 in bne b10 Succesful ASM optimization Pass5DoubleJumpElimination Removing instruction jmp b1 @@ -5659,12 +5661,13 @@ Removing instruction jmp b2 Removing instruction jmp b1 Removing instruction jmp b3 Succesful ASM optimization Pass5NextJumpElimination +Removing instruction bbegin: Removing instruction b10: Succesful ASM optimization Pass5UnusedLabelElimination Removing unreachable instruction jmp b2 Succesful ASM optimization Pass5UnreachableCodeElimination -Fixing long branch [146] bmi abs16s1_b1 to bpl -Fixing long branch [155] bmi abs16s2_b1 to bpl +Fixing long branch [145] bmi abs16s1_b1 to bpl +Fixing long branch [154] bmi abs16s2_b1 to bpl FINAL SYMBOL TABLE (label) @19 @@ -6075,7 +6078,7 @@ reg byte a [ bitmap_init::$7 ] FINAL ASSEMBLER -Score: 21640 +Score: 21634 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -6104,7 +6107,6 @@ Score: 21640 //SEG3 [1] phi from @begin to @19 [phi:@begin->@19] //SEG4 @19 //SEG5 [2] call main - jsr main //SEG6 [3] phi from @19 to @end [phi:@19->@end] //SEG7 @end //SEG8 main diff --git a/src/test/ref/linegen.asm b/src/test/ref/linegen.asm index e61e8b73e..7b1a05caa 100644 --- a/src/test/ref/linegen.asm +++ b/src/test/ref/linegen.asm @@ -4,7 +4,6 @@ .label rem16u = $f .label print_char_cursor = 7 .label print_line_cursor = 3 - jsr main main: { .label i = 2 lda #main] - jsr main //SEG7 [3] phi from @29 to @end [phi:@29->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/literals.asm b/src/test/ref/literals.asm index 180e8440f..24a1e5000 100644 --- a/src/test/ref/literals.asm +++ b/src/test/ref/literals.asm @@ -4,7 +4,6 @@ .label SCREEN = $400 .const char = 'a' .const num = 1 - jsr main main: { lda #char sta SCREEN diff --git a/src/test/ref/literals.log b/src/test/ref/literals.log index 22aa2b7ab..0a0036779 100644 --- a/src/test/ref/literals.log +++ b/src/test/ref/literals.log @@ -180,7 +180,7 @@ Allocated zp ZP_BYTE:2 [ main::i#2 main::i#1 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label SCREEN = $400 @@ -266,7 +266,7 @@ Uplifting [] best 395 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label SCREEN = $400 @@ -332,18 +332,22 @@ Removing instruction jmp b1 Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination Replacing label b1_from_b1 with b1 -Removing instruction bbegin: Removing instruction b1_from_bbegin: +Removing instruction b1: Removing instruction bend_from_b1: Removing instruction b1_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b1: Removing instruction bend: Removing instruction b1_from_main: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Removing instruction jmp b1 Succesful ASM optimization Pass5NextJumpElimination +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @1 @@ -370,7 +374,7 @@ reg byte x [ main::i#2 main::i#1 ] FINAL ASSEMBLER -Score: 299 +Score: 293 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -384,7 +388,6 @@ Score: 299 //SEG3 [1] phi from @begin to @1 [phi:@begin->@1] //SEG4 @1 //SEG5 [2] call main - jsr main //SEG6 [3] phi from @1 to @end [phi:@1->@end] //SEG7 @end //SEG8 main diff --git a/src/test/ref/liverange-call-problem.asm b/src/test/ref/liverange-call-problem.asm index aec4b65fb..3b07d99de 100644 --- a/src/test/ref/liverange-call-problem.asm +++ b/src/test/ref/liverange-call-problem.asm @@ -3,7 +3,6 @@ .pc = $80d "Program" .label w1 = 4 .label w2 = 2 - jsr main main: { lda #<0 sta w1 diff --git a/src/test/ref/liverange-call-problem.log b/src/test/ref/liverange-call-problem.log index 2802f1441..26cb8064d 100644 --- a/src/test/ref/liverange-call-problem.log +++ b/src/test/ref/liverange-call-problem.log @@ -243,7 +243,7 @@ Allocated zp ZP_WORD:4 [ w1#10 w1#11 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label w1 = 4 @@ -360,7 +360,7 @@ Uplifting [incw2] best 116 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label w1 = 4 @@ -472,8 +472,8 @@ Succesful ASM optimization Pass5NextJumpElimination Removing instruction lda #>0 Removing instruction lda #>0 Succesful ASM optimization Pass5UnnecesaryLoadElimination -Removing instruction bbegin: Removing instruction b3_from_bbegin: +Removing instruction b3: Removing instruction main_from_b3: Removing instruction bend_from_b3: Removing instruction b1_from_main: @@ -483,7 +483,6 @@ Removing instruction incw1_from_b2: Removing instruction b3_from_b2: Removing instruction incw2_from_b3: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b3: Removing instruction bend: Removing instruction incw1_from_main: Removing instruction b1: @@ -493,6 +492,11 @@ Removing instruction breturn: Removing instruction breturn: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @3 @@ -519,7 +523,7 @@ zp ZP_WORD:4 [ w1#10 w1#11 ] FINAL ASSEMBLER -Score: 88 +Score: 82 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -533,7 +537,6 @@ Score: 88 //SEG4 @3 //SEG5 [2] call main //SEG6 [4] phi from @3 to main [phi:@3->main] - jsr main //SEG7 [3] phi from @3 to @end [phi:@3->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/liverange.asm b/src/test/ref/liverange.asm index 779024af9..ce832b151 100644 --- a/src/test/ref/liverange.asm +++ b/src/test/ref/liverange.asm @@ -1,7 +1,6 @@ .pc = $801 "Basic" :BasicUpstart(main) .pc = $80d "Program" - jsr main main: { .label SCREEN = $400 .label a = 2 diff --git a/src/test/ref/liverange.log b/src/test/ref/liverange.log index 19fbe46bb..9116849bf 100644 --- a/src/test/ref/liverange.log +++ b/src/test/ref/liverange.log @@ -245,7 +245,7 @@ Allocated zp ZP_BYTE:9 [ inci::return#2 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label i = 2 @@ -378,7 +378,7 @@ Allocated (was zp ZP_BYTE:5) zp ZP_BYTE:2 [ main::a#1 ] ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -468,12 +468,11 @@ Removing instruction jmp b2 Removing instruction jmp breturn Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination -Removing instruction bbegin: Removing instruction b2_from_bbegin: +Removing instruction b2: Removing instruction main_from_b2: Removing instruction bend_from_b2: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b2: Removing instruction bend: Removing instruction inci_from_main: Removing instruction b1: @@ -482,6 +481,11 @@ Removing instruction b2: Removing instruction breturn: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @2 @@ -519,7 +523,7 @@ reg byte a [ inci::return#2 ] FINAL ASSEMBLER -Score: 64 +Score: 58 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -531,7 +535,6 @@ Score: 64 //SEG4 @2 //SEG5 [2] call main //SEG6 [4] phi from @2 to main [phi:@2->main] - jsr main //SEG7 [3] phi from @2 to @end [phi:@2->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/local-string.asm b/src/test/ref/local-string.asm index 1cd1969c9..36c5664d6 100644 --- a/src/test/ref/local-string.asm +++ b/src/test/ref/local-string.asm @@ -1,7 +1,6 @@ .pc = $801 "Basic" :BasicUpstart(main) .pc = $80d "Program" - jsr main main: { .label screen = $400 ldx #0 diff --git a/src/test/ref/local-string.log b/src/test/ref/local-string.log index 222c4c46e..f8ae218c5 100644 --- a/src/test/ref/local-string.log +++ b/src/test/ref/local-string.log @@ -129,7 +129,7 @@ Allocated zp ZP_BYTE:2 [ main::i#2 main::i#1 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -203,7 +203,7 @@ Uplifting [] best 333 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -261,17 +261,21 @@ Removing instruction jmp bend Removing instruction jmp b1 Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination -Removing instruction bbegin: Removing instruction b1_from_bbegin: +Removing instruction b1: Removing instruction main_from_b1: Removing instruction bend_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b1: Removing instruction bend: Removing instruction b1_from_main: Removing instruction breturn: Removing instruction b1_from_b2: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @1 @@ -293,7 +297,7 @@ reg byte x [ main::i#2 main::i#1 ] FINAL ASSEMBLER -Score: 267 +Score: 261 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -305,7 +309,6 @@ Score: 267 //SEG4 @1 //SEG5 [2] call main //SEG6 [4] phi from @1 to main [phi:@1->main] - jsr main //SEG7 [3] phi from @1 to @end [phi:@1->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/longbranch-interrupt-problem.asm b/src/test/ref/longbranch-interrupt-problem.asm index 28336c1b6..96105807b 100644 --- a/src/test/ref/longbranch-interrupt-problem.asm +++ b/src/test/ref/longbranch-interrupt-problem.asm @@ -1,9 +1,10 @@ .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" .label KERNEL_IRQ = $314 .label BGCOL = $d020 .label col = 2 +bbegin: lda #0 sta col jsr main diff --git a/src/test/ref/longbranch-interrupt-problem.log b/src/test/ref/longbranch-interrupt-problem.log index f85aa2c59..f6feef0f0 100644 --- a/src/test/ref/longbranch-interrupt-problem.log +++ b/src/test/ref/longbranch-interrupt-problem.log @@ -208,7 +208,7 @@ Allocated zp ZP_BYTE:3 [ col#3 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label KERNEL_IRQ = $314 @@ -319,7 +319,7 @@ Coalescing zero page register with common assignment [ zp ZP_BYTE:2 [ col#12 col ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label KERNEL_IRQ = $314 @@ -415,7 +415,6 @@ Removing instruction b1_from_main: Removing instruction b1_from_b2: Removing instruction b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction bbegin: Removing instruction b2: Removing instruction bend: Removing instruction b7: @@ -432,7 +431,7 @@ Removing instruction b1: Succesful ASM optimization Pass5RedundantLabelElimination Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination -Fixing long branch [28] beq $ea81 to bne +Fixing long branch [29] beq $ea81 to bne FINAL SYMBOL TABLE (label) @2 @@ -463,13 +462,14 @@ Score: 882 //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label KERNEL_IRQ = $314 .label BGCOL = $d020 .label col = 2 //SEG2 @begin +bbegin: //SEG3 [0] (byte) col#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1 lda #0 sta col diff --git a/src/test/ref/longjump.asm b/src/test/ref/longjump.asm index 78003d259..a68d06cde 100644 --- a/src/test/ref/longjump.asm +++ b/src/test/ref/longjump.asm @@ -1,7 +1,6 @@ .pc = $801 "Basic" :BasicUpstart(main) .pc = $80d "Program" - jsr main main: { .label SCREEN = $400 ldx #0 diff --git a/src/test/ref/longjump.log b/src/test/ref/longjump.log index e18e5b5be..e7822f898 100644 --- a/src/test/ref/longjump.log +++ b/src/test/ref/longjump.log @@ -116,7 +116,7 @@ Allocated zp ZP_BYTE:2 [ main::i#2 main::i#1 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -438,7 +438,7 @@ Uplifting [] best 5383 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -750,20 +750,24 @@ Removing instruction jmp b1 Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination Replacing label b1_from_b1 with b1 -Removing instruction bbegin: Removing instruction b1_from_bbegin: +Removing instruction b1: Removing instruction main_from_b1: Removing instruction bend_from_b1: Removing instruction b1_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b1: Removing instruction bend: Removing instruction b1_from_main: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Removing instruction jmp b1 Succesful ASM optimization Pass5NextJumpElimination -Fixing long branch [268] bne b1 to beq +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination +Fixing long branch [267] bne b1 to beq FINAL SYMBOL TABLE (label) @1 @@ -782,7 +786,7 @@ reg byte x [ main::i#2 main::i#1 ] FINAL ASSEMBLER -Score: 5317 +Score: 5311 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -794,7 +798,6 @@ Score: 5317 //SEG4 @1 //SEG5 [2] call main //SEG6 [4] phi from @1 to main [phi:@1->main] - jsr main //SEG7 [3] phi from @1 to @end [phi:@1->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/longjump2.asm b/src/test/ref/longjump2.asm index 101fd80b1..0d77575b9 100644 --- a/src/test/ref/longjump2.asm +++ b/src/test/ref/longjump2.asm @@ -1,7 +1,6 @@ .pc = $801 "Basic" :BasicUpstart(main) .pc = $80d "Program" - jsr main main: { jsr long1 jsr long2 diff --git a/src/test/ref/longjump2.log b/src/test/ref/longjump2.log index e9c1b5d67..641351f6e 100644 --- a/src/test/ref/longjump2.log +++ b/src/test/ref/longjump2.log @@ -211,7 +211,7 @@ Allocated zp ZP_BYTE:3 [ long1::i#2 long1::i#1 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -848,7 +848,7 @@ Uplifting [] best 10778 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -1471,8 +1471,8 @@ Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination Replacing label b1_from_b1 with b1 Replacing label b1_from_b1 with b1 -Removing instruction bbegin: Removing instruction b3_from_bbegin: +Removing instruction b3: Removing instruction main_from_b3: Removing instruction bend_from_b3: Removing instruction b1_from_main: @@ -1480,7 +1480,6 @@ Removing instruction long2_from_b1: Removing instruction b1_from_b1: Removing instruction b1_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b3: Removing instruction bend: Removing instruction long1_from_main: Removing instruction b1: @@ -1490,11 +1489,16 @@ Removing instruction breturn: Removing instruction b1_from_long1: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Removing instruction jmp b1 Removing instruction jmp b1 Succesful ASM optimization Pass5NextJumpElimination -Fixing long branch [273] bne b1 to beq -Fixing long branch [542] bne b1 to beq +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination +Fixing long branch [272] bne b1 to beq +Fixing long branch [541] bne b1 to beq FINAL SYMBOL TABLE (label) @3 @@ -1525,7 +1529,7 @@ reg byte x [ long1::i#2 long1::i#1 ] FINAL ASSEMBLER -Score: 10646 +Score: 10640 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -1537,7 +1541,6 @@ Score: 10646 //SEG4 @3 //SEG5 [2] call main //SEG6 [4] phi from @3 to main [phi:@3->main] - jsr main //SEG7 [3] phi from @3 to @end [phi:@3->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/loop-problem.asm b/src/test/ref/loop-problem.asm index e23f67a8c..a23a3a33a 100644 --- a/src/test/ref/loop-problem.asm +++ b/src/test/ref/loop-problem.asm @@ -2,7 +2,6 @@ :BasicUpstart(main) .pc = $80d "Program" .label SCREEN = $400 - jsr main main: { lda #'0' sta SCREEN diff --git a/src/test/ref/loop-problem.log b/src/test/ref/loop-problem.log index 9970782cd..b8ada7ed7 100644 --- a/src/test/ref/loop-problem.log +++ b/src/test/ref/loop-problem.log @@ -191,7 +191,7 @@ Allocated zp ZP_BYTE:2 [ b::i#2 b::i#1 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label SCREEN = $400 @@ -292,7 +292,7 @@ Uplifting [] best 328 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label SCREEN = $400 @@ -383,14 +383,13 @@ Removing instruction jmp breturn Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination Replacing label b1_from_b3 with b1 -Removing instruction bbegin: Removing instruction b3_from_bbegin: +Removing instruction b3: Removing instruction bend_from_b3: Removing instruction b1_from_main: Removing instruction b_from_b1: Removing instruction b1_from_b3: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b3: Removing instruction bend: Removing instruction b1: Removing instruction breturn: @@ -399,8 +398,13 @@ Removing instruction b3: Removing instruction breturn: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Removing instruction jmp b1 Succesful ASM optimization Pass5NextJumpElimination +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @3 @@ -425,7 +429,7 @@ reg byte x [ b::i#2 b::i#1 ] FINAL ASSEMBLER -Score: 193 +Score: 187 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -437,7 +441,6 @@ Score: 193 //SEG3 [1] phi from @begin to @3 [phi:@begin->@3] //SEG4 @3 //SEG5 [2] call main - jsr main //SEG6 [3] phi from @3 to @end [phi:@3->@end] //SEG7 @end //SEG8 main diff --git a/src/test/ref/loop-problem2.asm b/src/test/ref/loop-problem2.asm index 0f25faba7..ad5e464b3 100644 --- a/src/test/ref/loop-problem2.asm +++ b/src/test/ref/loop-problem2.asm @@ -3,7 +3,6 @@ .pc = $80d "Program" .label BORDERCOL = $d020 .label SCREEN = $400 - jsr main main: { jsr print_cls jsr mode_ctrl diff --git a/src/test/ref/loop-problem2.log b/src/test/ref/loop-problem2.log index cf1ab3a4c..1fbdd0a1f 100644 --- a/src/test/ref/loop-problem2.log +++ b/src/test/ref/loop-problem2.log @@ -205,7 +205,7 @@ Allocated zp ZP_BYTE:4 [ mode_ctrl::before#0 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label BORDERCOL = $d020 @@ -336,7 +336,7 @@ Uplifting [] best 932 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label BORDERCOL = $d020 @@ -454,15 +454,14 @@ Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination Replacing label b1_from_b1 with b1 Replacing label b1_from_b1 with b1 -Removing instruction bbegin: Removing instruction b3_from_bbegin: +Removing instruction b3: Removing instruction main_from_b3: Removing instruction bend_from_b3: Removing instruction b1_from_main: Removing instruction mode_ctrl_from_b1: Removing instruction b1_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b3: Removing instruction bend: Removing instruction print_cls_from_main: Removing instruction b1: @@ -471,8 +470,13 @@ Removing instruction b8: Removing instruction b1_from_print_cls: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Removing instruction jmp b1 Succesful ASM optimization Pass5NextJumpElimination +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @3 @@ -503,7 +507,7 @@ reg byte a [ mode_ctrl::before#0 ] FINAL ASSEMBLER -Score: 770 +Score: 764 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -517,7 +521,6 @@ Score: 770 //SEG4 @3 //SEG5 [2] call main //SEG6 [4] phi from @3 to main [phi:@3->main] - jsr main //SEG7 [3] phi from @3 to @end [phi:@3->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/loop100.asm b/src/test/ref/loop100.asm index 33ca02a8b..f5d4befda 100644 --- a/src/test/ref/loop100.asm +++ b/src/test/ref/loop100.asm @@ -1,7 +1,6 @@ .pc = $801 "Basic" :BasicUpstart(main) .pc = $80d "Program" - jsr main main: { ldx #0 b1: diff --git a/src/test/ref/loop100.log b/src/test/ref/loop100.log index 932c61bed..c07cc0316 100644 --- a/src/test/ref/loop100.log +++ b/src/test/ref/loop100.log @@ -99,7 +99,7 @@ Allocated zp ZP_BYTE:2 [ main::i#2 main::i#1 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -159,7 +159,7 @@ Uplifting [] best 193 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -210,19 +210,23 @@ Removing instruction jmp b1 Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination Replacing label b1_from_b1 with b1 -Removing instruction bbegin: Removing instruction b1_from_bbegin: +Removing instruction b1: Removing instruction main_from_b1: Removing instruction bend_from_b1: Removing instruction b1_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b1: Removing instruction bend: Removing instruction b1_from_main: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Removing instruction jmp b1 Succesful ASM optimization Pass5NextJumpElimination +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @1 @@ -239,7 +243,7 @@ reg byte x [ main::i#2 main::i#1 ] FINAL ASSEMBLER -Score: 97 +Score: 91 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -251,7 +255,6 @@ Score: 97 //SEG4 @1 //SEG5 [2] call main //SEG6 [4] phi from @1 to main [phi:@1->main] - jsr main //SEG7 [3] phi from @1 to @end [phi:@1->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/loopmin.asm b/src/test/ref/loopmin.asm index 579092ca9..3bbc86903 100644 --- a/src/test/ref/loopmin.asm +++ b/src/test/ref/loopmin.asm @@ -1,7 +1,6 @@ .pc = $801 "Basic" :BasicUpstart(main) .pc = $80d "Program" - jsr main main: { lda #0 ldx #$a diff --git a/src/test/ref/loopmin.log b/src/test/ref/loopmin.log index b7bc45dda..fe4ef204a 100644 --- a/src/test/ref/loopmin.log +++ b/src/test/ref/loopmin.log @@ -159,7 +159,7 @@ Allocated zp ZP_BYTE:3 [ main::s#2 main::s#4 main::s#1 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -246,7 +246,7 @@ Uplifting [] best 423 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -322,22 +322,26 @@ Succesful ASM optimization Pass5NextJumpElimination Replacing label b2_from_b1 with b2 Replacing label b2_from_b1 with b2 Replacing label b1_from_b2 with b1 -Removing instruction bbegin: Removing instruction b1_from_bbegin: +Removing instruction b1: Removing instruction main_from_b1: Removing instruction bend_from_b1: Removing instruction b1_from_b2: Removing instruction b2_from_b1: Removing instruction b2_from_b3: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b1: Removing instruction bend: Removing instruction b1_from_main: Removing instruction b3: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Removing instruction jmp b1 Succesful ASM optimization Pass5NextJumpElimination +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @1 @@ -361,7 +365,7 @@ reg byte a [ main::s#2 main::s#4 main::s#1 ] FINAL ASSEMBLER -Score: 267 +Score: 261 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -373,7 +377,6 @@ Score: 267 //SEG4 @1 //SEG5 [2] call main //SEG6 [4] phi from @1 to main [phi:@1->main] - jsr main //SEG7 [3] phi from @1 to @end [phi:@1->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/loopnest.asm b/src/test/ref/loopnest.asm index db34ff209..ba6403c6f 100644 --- a/src/test/ref/loopnest.asm +++ b/src/test/ref/loopnest.asm @@ -2,7 +2,6 @@ :BasicUpstart(main) .pc = $80d "Program" .label SCREEN = $400 - jsr main main: { ldy #$64 b1: diff --git a/src/test/ref/loopnest.log b/src/test/ref/loopnest.log index 8f8584116..438832448 100644 --- a/src/test/ref/loopnest.log +++ b/src/test/ref/loopnest.log @@ -187,7 +187,7 @@ Allocated zp ZP_BYTE:3 [ nest::j#2 nest::j#1 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label SCREEN = $400 @@ -286,7 +286,7 @@ Uplifting [] best 2358 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label SCREEN = $400 @@ -375,15 +375,14 @@ Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination Replacing label b1_from_b3 with b1 Replacing label b1_from_b1 with b1 -Removing instruction bbegin: Removing instruction b2_from_bbegin: +Removing instruction b2: Removing instruction main_from_b2: Removing instruction bend_from_b2: Removing instruction b1_from_b3: Removing instruction nest_from_b1: Removing instruction b1_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b2: Removing instruction bend: Removing instruction b1_from_main: Removing instruction b3: @@ -391,9 +390,14 @@ Removing instruction breturn: Removing instruction b1_from_nest: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Removing instruction jmp b1 Removing instruction jmp b1 Succesful ASM optimization Pass5NextJumpElimination +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @2 @@ -420,7 +424,7 @@ reg byte x [ nest::j#2 nest::j#1 ] FINAL ASSEMBLER -Score: 1359 +Score: 1353 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -433,7 +437,6 @@ Score: 1359 //SEG4 @2 //SEG5 [2] call main //SEG6 [4] phi from @2 to main [phi:@2->main] - jsr main //SEG7 [3] phi from @2 to @end [phi:@2->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/loopnest2.asm b/src/test/ref/loopnest2.asm index f1c09dfc1..54680edef 100644 --- a/src/test/ref/loopnest2.asm +++ b/src/test/ref/loopnest2.asm @@ -2,7 +2,6 @@ :BasicUpstart(main) .pc = $80d "Program" .label SCREEN = $400 - jsr main main: { .label j = 3 .label i = 2 diff --git a/src/test/ref/loopnest2.log b/src/test/ref/loopnest2.log index 2d0b9c5dd..1e45a8c37 100644 --- a/src/test/ref/loopnest2.log +++ b/src/test/ref/loopnest2.log @@ -409,7 +409,7 @@ Allocated zp ZP_BYTE:7 [ nest2::j#2 nest2::j#1 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label SCREEN = $400 @@ -616,7 +616,7 @@ Uplifting [main] best 23472243 combination zp ZP_BYTE:2 [ main::i#5 main::i#1 ] ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label SCREEN = $400 @@ -813,8 +813,8 @@ Replacing label b2_from_b5 with b2 Replacing label b1_from_b3 with b1 Replacing label b2_from_b2 with b2 Replacing label b1_from_b3 with b1 -Removing instruction bbegin: Removing instruction b3_from_bbegin: +Removing instruction b3: Removing instruction main_from_b3: Removing instruction bend_from_b3: Removing instruction b1_from_b3: @@ -829,7 +829,6 @@ Removing instruction b1_from_b3: Removing instruction b2_from_b1: Removing instruction b2_from_b2: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b3: Removing instruction bend: Removing instruction b1_from_main: Removing instruction b5: @@ -843,6 +842,9 @@ Removing instruction b1_from_nest2: Removing instruction b3: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Removing instruction jmp b1 Removing instruction jmp b2 Removing instruction jmp b1 @@ -850,6 +852,8 @@ Removing instruction jmp b2 Removing instruction jmp b1 Removing instruction jmp b2 Succesful ASM optimization Pass5NextJumpElimination +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @3 @@ -902,7 +906,7 @@ reg byte y [ nest2::j#2 nest2::j#1 ] FINAL ASSEMBLER -Score: 13472241 +Score: 13472235 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -915,7 +919,6 @@ Score: 13472241 //SEG4 @3 //SEG5 [2] call main //SEG6 [4] phi from @3 to main [phi:@3->main] - jsr main //SEG7 [3] phi from @3 to @end [phi:@3->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/loopnest3.asm b/src/test/ref/loopnest3.asm index d335aa83f..5db383893 100644 --- a/src/test/ref/loopnest3.asm +++ b/src/test/ref/loopnest3.asm @@ -2,7 +2,6 @@ :BasicUpstart(main) .pc = $80d "Program" .label SCREEN = $400 - jsr main main: { ldy #0 b1: diff --git a/src/test/ref/loopnest3.log b/src/test/ref/loopnest3.log index f2d287f86..beb4e44cb 100644 --- a/src/test/ref/loopnest3.log +++ b/src/test/ref/loopnest3.log @@ -224,7 +224,7 @@ Allocated zp ZP_BYTE:5 [ c::i#0 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label SCREEN = $400 @@ -348,7 +348,7 @@ Uplifting [] best 2556 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label SCREEN = $400 @@ -452,14 +452,13 @@ Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination Replacing label b1_from_b3 with b1 Replacing label b1_from_b1 with b1 -Removing instruction bbegin: Removing instruction b3_from_bbegin: +Removing instruction b3: Removing instruction main_from_b3: Removing instruction bend_from_b3: Removing instruction b1_from_b3: Removing instruction b1_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b3: Removing instruction bend: Removing instruction b1_from_main: Removing instruction b3: @@ -469,9 +468,14 @@ Removing instruction breturn: Removing instruction b1_from_c: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Removing instruction jmp b1 Removing instruction jmp b1 Succesful ASM optimization Pass5NextJumpElimination +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @3 @@ -506,7 +510,7 @@ reg byte a [ c::i#0 ] FINAL ASSEMBLER -Score: 1527 +Score: 1521 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -519,7 +523,6 @@ Score: 1527 //SEG4 @3 //SEG5 [2] call main //SEG6 [4] phi from @3 to main [phi:@3->main] - jsr main //SEG7 [3] phi from @3 to @end [phi:@3->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/loopsplit.asm b/src/test/ref/loopsplit.asm index 6b3267e0b..bf2e168d2 100644 --- a/src/test/ref/loopsplit.asm +++ b/src/test/ref/loopsplit.asm @@ -1,7 +1,6 @@ .pc = $801 "Basic" :BasicUpstart(main) .pc = $80d "Program" - jsr main main: { ldx #0 lda #$64 diff --git a/src/test/ref/loopsplit.log b/src/test/ref/loopsplit.log index 999400871..f2cda9dcc 100644 --- a/src/test/ref/loopsplit.log +++ b/src/test/ref/loopsplit.log @@ -157,7 +157,7 @@ Allocated zp ZP_BYTE:3 [ main::s#3 main::s#1 main::s#2 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -241,7 +241,7 @@ Uplifting [] best 403 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -315,22 +315,25 @@ Removing instruction jmp breturn Removing instruction jmp b8 Succesful ASM optimization Pass5NextJumpElimination Replacing label b1_from_b4 with b1_from_b8 -Removing instruction bbegin: Removing instruction b1_from_bbegin: +Removing instruction b1: Removing instruction main_from_b1: Removing instruction bend_from_b1: Removing instruction b1_from_b4: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b1: Removing instruction bend: Removing instruction b1_from_main: Removing instruction breturn: Removing instruction b8: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Skipping double jump to b1 in jmp b1_from_b8 Succesful ASM optimization Pass5DoubleJumpElimination Relabelling long label b1_from_b8 to b3 Succesful ASM optimization Pass5RelabelLongLabels +Removing instruction bbegin: Removing instruction b3: Succesful ASM optimization Pass5UnusedLabelElimination @@ -357,7 +360,7 @@ reg byte x [ main::s#3 main::s#1 main::s#2 ] FINAL ASSEMBLER -Score: 307 +Score: 301 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -369,7 +372,6 @@ Score: 307 //SEG4 @1 //SEG5 [2] call main //SEG6 [4] phi from @1 to main [phi:@1->main] - jsr main //SEG7 [3] phi from @1 to @end [phi:@1->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/mem-alignment.asm b/src/test/ref/mem-alignment.asm index 51b968735..14ef8743c 100644 --- a/src/test/ref/mem-alignment.asm +++ b/src/test/ref/mem-alignment.asm @@ -1,7 +1,6 @@ .pc = $801 "Basic" :BasicUpstart(main) .pc = $80d "Program" - jsr main main: { ldx #0 b1: diff --git a/src/test/ref/mem-alignment.log b/src/test/ref/mem-alignment.log index e21a00eda..b4e4ead1e 100644 --- a/src/test/ref/mem-alignment.log +++ b/src/test/ref/mem-alignment.log @@ -170,7 +170,7 @@ Allocated zp ZP_BYTE:4 [ main::i#5 main::i#3 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -276,7 +276,7 @@ Uplifting [] best 543 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -360,22 +360,26 @@ Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination Replacing label b1_from_b1 with b1 Replacing label b2_from_b2 with b2 -Removing instruction bbegin: Removing instruction b1_from_bbegin: +Removing instruction b1: Removing instruction main_from_b1: Removing instruction bend_from_b1: Removing instruction b1_from_b1: Removing instruction b2_from_b2: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b1: Removing instruction bend: Removing instruction b1_from_main: Removing instruction b2_from_b1: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Removing instruction jmp b1 Removing instruction jmp b2 Succesful ASM optimization Pass5NextJumpElimination +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @1 @@ -404,7 +408,7 @@ reg byte y [ main::i#5 main::i#3 ] FINAL ASSEMBLER -Score: 387 +Score: 381 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -416,7 +420,6 @@ Score: 387 //SEG4 @1 //SEG5 [2] call main //SEG6 [4] phi from @1 to main [phi:@1->main] - jsr main //SEG7 [3] phi from @1 to @end [phi:@1->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/min-fmul-16.asm b/src/test/ref/min-fmul-16.asm index e19a5a40c..7a3306941 100644 --- a/src/test/ref/min-fmul-16.asm +++ b/src/test/ref/min-fmul-16.asm @@ -5,7 +5,6 @@ .label BORDERCOL = $d020 .label SCREEN = $400 .label print_char_cursor = 4 - jsr main main: { .label a = $4d2 .label b = $929 diff --git a/src/test/ref/min-fmul-16.log b/src/test/ref/min-fmul-16.log index 821e9c6b8..cc3298664 100644 --- a/src/test/ref/min-fmul-16.log +++ b/src/test/ref/min-fmul-16.log @@ -1336,7 +1336,7 @@ Allocated zp ZP_BYTE:42 [ mulf_init::$6 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label RASTER = $d012 @@ -2063,7 +2063,7 @@ Allocated (was zp ZP_DWORD:22) zp ZP_DWORD:9 [ mulf16u::return#0 main::r#0 mulf1 ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label RASTER = $d012 @@ -2649,8 +2649,8 @@ Replacing label b1_from_b2 with b1 Replacing label b12_from_b3 with b12 Replacing label b3_from_b4 with b3 Replacing label b3_from_b4 with b3 -Removing instruction bbegin: Removing instruction b22_from_bbegin: +Removing instruction b22: Removing instruction main_from_b22: Removing instruction bend_from_b22: Removing instruction b1: @@ -2663,7 +2663,6 @@ Removing instruction b3_from_b4: Removing instruction b12_from_b3: Removing instruction b4_from_b12: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b22: Removing instruction bend: Removing instruction mulf_init_from_main: Removing instruction b13: @@ -2694,11 +2693,15 @@ Removing instruction b4_from_b3: Removing instruction b8: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Skipping double jump to b4 in bne b12 Succesful ASM optimization Pass5DoubleJumpElimination Removing instruction jmp b1 Removing instruction jmp b3 Succesful ASM optimization Pass5NextJumpElimination +Removing instruction bbegin: Removing instruction b12: Succesful ASM optimization Pass5UnusedLabelElimination Removing unreachable instruction jmp b4 @@ -2848,7 +2851,7 @@ reg byte a [ mulf_init::$6 ] FINAL ASSEMBLER -Score: 4324 +Score: 4318 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -2864,7 +2867,6 @@ Score: 4324 //SEG4 @22 //SEG5 [2] call main //SEG6 [4] phi from @22 to main [phi:@22->main] - jsr main //SEG7 [3] phi from @22 to @end [phi:@22->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/modglobal.asm b/src/test/ref/modglobal.asm index e286ab51b..8a064bb42 100644 --- a/src/test/ref/modglobal.asm +++ b/src/test/ref/modglobal.asm @@ -3,7 +3,6 @@ .pc = $80d "Program" .label SCREEN = $400 .label cnt = 2 - jsr main main: { ldx #0 ldy #0 diff --git a/src/test/ref/modglobal.log b/src/test/ref/modglobal.log index 18aebfc0f..6586444fd 100644 --- a/src/test/ref/modglobal.log +++ b/src/test/ref/modglobal.log @@ -321,7 +321,7 @@ Allocated zp ZP_BYTE:10 [ inccnt::return#2 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label SCREEN = $400 @@ -453,7 +453,7 @@ Allocated (was zp ZP_BYTE:9) zp ZP_BYTE:2 [ cnt#12 ] ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label SCREEN = $400 @@ -551,12 +551,11 @@ Succesful ASM optimization Pass5NextJumpElimination Replacing instruction lda #0 with TXA Removing instruction lda cnt Succesful ASM optimization Pass5UnnecesaryLoadElimination -Removing instruction bbegin: Removing instruction b2_from_bbegin: +Removing instruction b2: Removing instruction main_from_b2: Removing instruction bend_from_b2: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b2: Removing instruction bend: Removing instruction inccnt_from_main: Removing instruction b1: @@ -565,6 +564,11 @@ Removing instruction b2: Removing instruction breturn: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @2 @@ -607,7 +611,7 @@ reg byte a [ inccnt::return#2 ] FINAL ASSEMBLER -Score: 62 +Score: 56 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -621,7 +625,6 @@ Score: 62 //SEG4 @2 //SEG5 [2] call main //SEG6 [4] phi from @2 to main [phi:@2->main] - jsr main //SEG7 [3] phi from @2 to @end [phi:@2->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/modglobalmin.asm b/src/test/ref/modglobalmin.asm index 918784a3c..1076512fb 100644 --- a/src/test/ref/modglobalmin.asm +++ b/src/test/ref/modglobalmin.asm @@ -2,7 +2,6 @@ :BasicUpstart(main) .pc = $80d "Program" .label SCREEN = $400 - jsr main main: { ldx #0 jsr inccnt diff --git a/src/test/ref/modglobalmin.log b/src/test/ref/modglobalmin.log index 74cd05ab3..802d813cd 100644 --- a/src/test/ref/modglobalmin.log +++ b/src/test/ref/modglobalmin.log @@ -177,7 +177,7 @@ Allocated zp ZP_BYTE:4 [ cnt#13 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label SCREEN = $400 @@ -270,7 +270,7 @@ Uplifting [inccnt] best 64 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label SCREEN = $400 @@ -342,12 +342,11 @@ Removing instruction jmp b2 Removing instruction jmp breturn Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination -Removing instruction bbegin: Removing instruction b2_from_bbegin: +Removing instruction b2: Removing instruction main_from_b2: Removing instruction bend_from_b2: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b2: Removing instruction bend: Removing instruction inccnt_from_main: Removing instruction b1: @@ -356,6 +355,11 @@ Removing instruction b2: Removing instruction breturn: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @2 @@ -381,7 +385,7 @@ reg byte x [ cnt#13 ] FINAL ASSEMBLER -Score: 46 +Score: 40 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -394,7 +398,6 @@ Score: 46 //SEG4 @2 //SEG5 [2] call main //SEG6 [4] phi from @2 to main [phi:@2->main] - jsr main //SEG7 [3] phi from @2 to @end [phi:@2->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/norom-charset.asm b/src/test/ref/norom-charset.asm index a5514eacc..b41b38c12 100644 --- a/src/test/ref/norom-charset.asm +++ b/src/test/ref/norom-charset.asm @@ -4,7 +4,6 @@ .label VIC_MEMORY = $d018 .label SCREEN = $400 .label CHARSET = $3000 - jsr main main: { .label charset = 2 .label c = 4 diff --git a/src/test/ref/norom-charset.log b/src/test/ref/norom-charset.log index 3d5302c3c..5b1d3e6ce 100644 --- a/src/test/ref/norom-charset.log +++ b/src/test/ref/norom-charset.log @@ -497,7 +497,7 @@ Allocated zp ZP_BYTE:13 [ gen_char3::$1 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label VIC_MEMORY = $d018 @@ -735,7 +735,7 @@ Coalescing zero page register with common assignment [ zp ZP_WORD:2 [ main::char ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label VIC_MEMORY = $d018 @@ -932,8 +932,8 @@ Replacing label b1_from_b3 with b1 Replacing label b3_from_b2 with b3 Replacing label b2_from_b3 with b2 Replacing label b1_from_b5 with b1 -Removing instruction bbegin: Removing instruction b2_from_bbegin: +Removing instruction b2: Removing instruction main_from_b2: Removing instruction bend_from_b2: Removing instruction b1_from_b3: @@ -943,7 +943,6 @@ Removing instruction b2_from_b3: Removing instruction b3_from_b2: Removing instruction b3_from_b4: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b2: Removing instruction bend: Removing instruction b1_from_main: Removing instruction gen_char3_from_b1: @@ -955,10 +954,15 @@ Removing instruction b4: Removing instruction b5: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Removing instruction jmp b1 Removing instruction jmp b1 Removing instruction jmp b2 Succesful ASM optimization Pass5NextJumpElimination +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @2 @@ -1022,7 +1026,7 @@ reg byte a [ gen_char3::$1 ] FINAL ASSEMBLER -Score: 45530 +Score: 45524 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -1037,7 +1041,6 @@ Score: 45530 //SEG4 @2 //SEG5 [2] call main //SEG6 [4] phi from @2 to main [phi:@2->main] - jsr main //SEG7 [3] phi from @2 to @end [phi:@2->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/operator-lohi-problem.asm b/src/test/ref/operator-lohi-problem.asm index 3a3476d8d..a52e9996a 100644 --- a/src/test/ref/operator-lohi-problem.asm +++ b/src/test/ref/operator-lohi-problem.asm @@ -3,7 +3,6 @@ .pc = $80d "Program" .const DVAL = $20000 .label SCREEN = $400 - jsr main main: { lda #DVAL/$400 sta SCREEN diff --git a/src/test/ref/operator-lohi-problem.log b/src/test/ref/operator-lohi-problem.log index 9f28c3f01..e3d23094d 100644 --- a/src/test/ref/operator-lohi-problem.log +++ b/src/test/ref/operator-lohi-problem.log @@ -109,7 +109,7 @@ Complete equivalence classes INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .const DVAL = $20000 @@ -157,7 +157,7 @@ Uplifting [] best 33 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .const DVAL = $20000 @@ -196,14 +196,18 @@ Removing instruction jmp b1 Removing instruction jmp bend Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination -Removing instruction bbegin: Removing instruction b1_from_bbegin: +Removing instruction b1: Removing instruction bend_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b1: Removing instruction bend: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @1 @@ -219,7 +223,7 @@ FINAL SYMBOL TABLE FINAL ASSEMBLER -Score: 24 +Score: 18 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -232,7 +236,6 @@ Score: 24 //SEG3 [1] phi from @begin to @1 [phi:@begin->@1] //SEG4 @1 //SEG5 [2] call main - jsr main //SEG6 [3] phi from @1 to @end [phi:@1->@end] //SEG7 @end //SEG8 main diff --git a/src/test/ref/overlap-allocation-2.asm b/src/test/ref/overlap-allocation-2.asm index 6164ca1b0..e67adbee0 100644 --- a/src/test/ref/overlap-allocation-2.asm +++ b/src/test/ref/overlap-allocation-2.asm @@ -2,7 +2,6 @@ :BasicUpstart(main) .pc = $80d "Program" .label SCREEN = $400 - jsr main main: { ldx #0 b1: diff --git a/src/test/ref/overlap-allocation-2.log b/src/test/ref/overlap-allocation-2.log index fb85f35b3..81a9137e9 100644 --- a/src/test/ref/overlap-allocation-2.log +++ b/src/test/ref/overlap-allocation-2.log @@ -286,7 +286,7 @@ Allocated zp ZP_BYTE:5 [ plot::x#2 plot::x#0 plot::x#1 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label SCREEN = $400 @@ -445,7 +445,7 @@ Uplifting [] best 406 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label SCREEN = $400 @@ -579,14 +579,13 @@ Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination Replacing label b1_from_b5 with b1 Replacing label b2_from_b6 with b2 -Removing instruction bbegin: Removing instruction b3_from_bbegin: +Removing instruction b3: Removing instruction main_from_b3: Removing instruction bend_from_b3: Removing instruction b1_from_b5: Removing instruction b2_from_b6: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b3: Removing instruction bend: Removing instruction b1_from_main: Removing instruction line_from_b1: @@ -601,9 +600,14 @@ Removing instruction plot_from_b1: Removing instruction breturn: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Removing instruction jmp b1 Removing instruction jmp b2 Succesful ASM optimization Pass5NextJumpElimination +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @3 @@ -644,7 +648,7 @@ reg byte a [ plot::x#2 plot::x#0 plot::x#1 ] FINAL ASSEMBLER -Score: 235 +Score: 229 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -657,7 +661,6 @@ Score: 235 //SEG4 @3 //SEG5 [2] call main //SEG6 [4] phi from @3 to main [phi:@3->main] - jsr main //SEG7 [3] phi from @3 to @end [phi:@3->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/overlap-allocation.asm b/src/test/ref/overlap-allocation.asm index 0d8703213..c3b0ca9ce 100644 --- a/src/test/ref/overlap-allocation.asm +++ b/src/test/ref/overlap-allocation.asm @@ -2,7 +2,6 @@ :BasicUpstart(main) .pc = $80d "Program" .label SCREEN = $400 - jsr main main: { ldx #0 b1: diff --git a/src/test/ref/overlap-allocation.log b/src/test/ref/overlap-allocation.log index 432838f08..522c13f88 100644 --- a/src/test/ref/overlap-allocation.log +++ b/src/test/ref/overlap-allocation.log @@ -289,7 +289,7 @@ Allocated zp ZP_BYTE:5 [ plot::x#3 plot::x#0 plot::x#1 plot::x#2 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label SCREEN = $400 @@ -444,7 +444,7 @@ Uplifting [] best 526 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label SCREEN = $400 @@ -577,15 +577,14 @@ Succesful ASM optimization Pass5NextJumpElimination Replacing label b1_from_b7 with b1 Replacing label b2_from_b8 with b2 Replacing label b3_from_b9 with b3 -Removing instruction bbegin: Removing instruction b2_from_bbegin: +Removing instruction b2: Removing instruction main_from_b2: Removing instruction bend_from_b2: Removing instruction b1_from_b7: Removing instruction b2_from_b8: Removing instruction b3_from_b9: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b2: Removing instruction bend: Removing instruction b1_from_main: Removing instruction plot_from_b1: @@ -599,10 +598,15 @@ Removing instruction b9: Removing instruction breturn: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Removing instruction jmp b1 Removing instruction jmp b2 Removing instruction jmp b3 Succesful ASM optimization Pass5NextJumpElimination +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @2 @@ -642,7 +646,7 @@ reg byte x [ plot::x#3 plot::x#0 plot::x#1 plot::x#2 ] FINAL ASSEMBLER -Score: 298 +Score: 292 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -655,7 +659,6 @@ Score: 298 //SEG4 @2 //SEG5 [2] call main //SEG6 [4] phi from @2 to main [phi:@2->main] - jsr main //SEG7 [3] phi from @2 to @end [phi:@2->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/print-problem.asm b/src/test/ref/print-problem.asm index b285d2a5b..422a43be0 100644 --- a/src/test/ref/print-problem.asm +++ b/src/test/ref/print-problem.asm @@ -2,7 +2,6 @@ :BasicUpstart(main) .pc = $80d "Program" .label SCREEN = $400 - jsr main main: { lda #$40 jsr ln diff --git a/src/test/ref/print-problem.log b/src/test/ref/print-problem.log index b6587676f..aabbf0fe8 100644 --- a/src/test/ref/print-problem.log +++ b/src/test/ref/print-problem.log @@ -242,7 +242,7 @@ Allocated zp ZP_BYTE:4 [ char#4 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label SCREEN = $400 @@ -341,7 +341,7 @@ Uplifting [ln] best 75 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label SCREEN = $400 @@ -423,12 +423,11 @@ Removing instruction jmp b3 Removing instruction jmp breturn Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination -Removing instruction bbegin: Removing instruction b2_from_bbegin: +Removing instruction b2: Removing instruction main_from_b2: Removing instruction bend_from_b2: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b2: Removing instruction bend: Removing instruction ln_from_main: Removing instruction b1: @@ -439,6 +438,11 @@ Removing instruction b3: Removing instruction breturn: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @2 @@ -466,7 +470,7 @@ reg byte x [ char#4 ] FINAL ASSEMBLER -Score: 54 +Score: 48 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -479,7 +483,6 @@ Score: 54 //SEG4 @2 //SEG5 [2] call main //SEG6 [4] phi from @2 to main [phi:@2->main] - jsr main //SEG7 [3] phi from @2 to @end [phi:@2->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/printmsg.asm b/src/test/ref/printmsg.asm index 87fc93ad5..b35ad3bf5 100644 --- a/src/test/ref/printmsg.asm +++ b/src/test/ref/printmsg.asm @@ -3,7 +3,6 @@ .pc = $80d "Program" .label print_char_cursor = 6 .label print_line_cursor = 2 - jsr main main: { lda #<$400 sta print_char_cursor diff --git a/src/test/ref/printmsg.log b/src/test/ref/printmsg.log index 2076856a1..62112d800 100644 --- a/src/test/ref/printmsg.log +++ b/src/test/ref/printmsg.log @@ -441,7 +441,7 @@ Allocated zp ZP_WORD:6 [ print_char_cursor#13 print_char_cursor#29 print_char_cu INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label print_char_cursor = 6 @@ -655,7 +655,7 @@ Uplifting [main] best 1203 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label print_char_cursor = 6 @@ -863,8 +863,8 @@ Succesful ASM optimization Pass5UnnecesaryLoadElimination Replacing label b1_from_b1 with b1 Replacing label b1_from_b1 with b1 Replacing label b1_from_b2 with b1 -Removing instruction bbegin: Removing instruction b20_from_bbegin: +Removing instruction b20: Removing instruction main_from_b20: Removing instruction bend_from_b20: Removing instruction b1_from_main: @@ -878,7 +878,6 @@ Removing instruction b1_from_b1: Removing instruction b1_from_print_str: Removing instruction b1_from_b2: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b20: Removing instruction bend: Removing instruction print_str_from_main: Removing instruction b1: @@ -892,6 +891,11 @@ Removing instruction breturn: Removing instruction breturn: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @20 @@ -940,7 +944,7 @@ zp ZP_WORD:6 [ print_char_cursor#13 print_char_cursor#29 print_char_cursor#32 pr FINAL ASSEMBLER -Score: 1039 +Score: 1033 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -954,7 +958,6 @@ Score: 1039 //SEG4 @20 //SEG5 [2] call main //SEG6 [4] phi from @20 to main [phi:@20->main] - jsr main //SEG7 [3] phi from @20 to @end [phi:@20->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/ptr-complex.asm b/src/test/ref/ptr-complex.asm index b60c163bf..5894f4bc2 100644 --- a/src/test/ref/ptr-complex.asm +++ b/src/test/ref/ptr-complex.asm @@ -1,7 +1,6 @@ .pc = $801 "Basic" :BasicUpstart(main) .pc = $80d "Program" - jsr main main: { .label screen = $400 .label BGCOL = $d020 diff --git a/src/test/ref/ptr-complex.log b/src/test/ref/ptr-complex.log index 4ec0be2e5..b0580344a 100644 --- a/src/test/ref/ptr-complex.log +++ b/src/test/ref/ptr-complex.log @@ -278,7 +278,7 @@ Allocated zp ZP_WORD:9 [ main::$11 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -443,7 +443,7 @@ Allocated (was zp ZP_WORD:9) zp ZP_WORD:4 [ main::$11 ] ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -573,13 +573,12 @@ Removing instruction ldy #0 Succesful ASM optimization Pass5UnnecesaryLoadElimination Replacing label b1_from_b1 with b1 Replacing label b2_from_b2 with b2 -Removing instruction bbegin: Removing instruction b1_from_bbegin: +Removing instruction b1: Removing instruction bend_from_b1: Removing instruction b1_from_b1: Removing instruction b2_from_b2: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b1: Removing instruction bend: Removing instruction b1_from_main: Removing instruction b3: @@ -587,9 +586,14 @@ Removing instruction b2_from_b3: Removing instruction b4: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Removing instruction jmp b1 Removing instruction jmp b2 Succesful ASM optimization Pass5NextJumpElimination +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @1 @@ -627,7 +631,7 @@ zp ZP_WORD:4 [ main::$11 ] FINAL ASSEMBLER -Score: 960 +Score: 954 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -638,7 +642,6 @@ Score: 960 //SEG3 [1] phi from @begin to @1 [phi:@begin->@1] //SEG4 @1 //SEG5 [2] call main - jsr main //SEG6 [3] phi from @1 to @end [phi:@1->@end] //SEG7 @end //SEG8 main diff --git a/src/test/ref/ptrtest.asm b/src/test/ref/ptrtest.asm index f2616b946..e77e0906d 100644 --- a/src/test/ref/ptrtest.asm +++ b/src/test/ref/ptrtest.asm @@ -1,7 +1,6 @@ .pc = $801 "Basic" :BasicUpstart(main) .pc = $80d "Program" - jsr main main: { jsr lvalue jsr rvalue diff --git a/src/test/ref/ptrtest.log b/src/test/ref/ptrtest.log index 9120325a8..5a4b2f3be 100644 --- a/src/test/ref/ptrtest.log +++ b/src/test/ref/ptrtest.log @@ -423,7 +423,7 @@ Allocated zp ZP_BYTE:13 [ rvalue::b#2 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -701,7 +701,7 @@ Allocated (was zp ZP_WORD:3) zp ZP_WORD:2 [ lvaluevar::screen#2 lvaluevar::scree ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -925,8 +925,8 @@ Removing instruction jmp breturn Removing instruction jmp b1 Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination -Removing instruction bbegin: Removing instruction b5_from_bbegin: +Removing instruction b5: Removing instruction main_from_b5: Removing instruction bend_from_b5: Removing instruction b1_from_main: @@ -935,7 +935,6 @@ Removing instruction rvaluevar_from_b2: Removing instruction b3_from_b2: Removing instruction lvaluevar_from_b3: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b5: Removing instruction bend: Removing instruction b1: Removing instruction b2: @@ -954,7 +953,12 @@ Removing instruction b1_from_lvalue: Removing instruction breturn: Removing instruction b1_from_b2: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Replacing instruction ldx #2 with TAX +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @5 @@ -1024,7 +1028,7 @@ reg byte a [ rvalue::b#2 ] FINAL ASSEMBLER -Score: 1280 +Score: 1274 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -1036,7 +1040,6 @@ Score: 1280 //SEG4 @5 //SEG5 [2] call main //SEG6 [4] phi from @5 to main [phi:@5->main] - jsr main //SEG7 [3] phi from @5 to @end [phi:@5->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/ptrtestmin.asm b/src/test/ref/ptrtestmin.asm index 41eb36b4d..6a471ee84 100644 --- a/src/test/ref/ptrtestmin.asm +++ b/src/test/ref/ptrtestmin.asm @@ -1,7 +1,6 @@ .pc = $801 "Basic" :BasicUpstart(main) .pc = $80d "Program" - jsr main main: { .label SCREEN = $400 ldx #2 diff --git a/src/test/ref/ptrtestmin.log b/src/test/ref/ptrtestmin.log index 79d4d32c5..7558dad12 100644 --- a/src/test/ref/ptrtestmin.log +++ b/src/test/ref/ptrtestmin.log @@ -120,7 +120,7 @@ Allocated zp ZP_BYTE:3 [ main::b#0 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -189,7 +189,7 @@ Uplifting [] best 238 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -244,17 +244,21 @@ Removing instruction jmp bend Removing instruction jmp b1 Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination -Removing instruction bbegin: Removing instruction b1_from_bbegin: +Removing instruction b1: Removing instruction main_from_b1: Removing instruction bend_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b1: Removing instruction bend: Removing instruction b1_from_main: Removing instruction breturn: Removing instruction b1_from_b2: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @1 @@ -277,7 +281,7 @@ reg byte a [ main::b#0 ] FINAL ASSEMBLER -Score: 172 +Score: 166 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -289,7 +293,6 @@ Score: 172 //SEG4 @1 //SEG5 [2] call main //SEG6 [4] phi from @1 to main [phi:@1->main] - jsr main //SEG7 [3] phi from @1 to @end [phi:@1->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/scroll-clobber.asm b/src/test/ref/scroll-clobber.asm index be67566ef..2bd236111 100644 --- a/src/test/ref/scroll-clobber.asm +++ b/src/test/ref/scroll-clobber.asm @@ -2,7 +2,6 @@ :BasicUpstart(main) .pc = $80d "Program" .label SCREEN = $400 - jsr main main: { .label nxt = 2 ldx #0 diff --git a/src/test/ref/scroll-clobber.log b/src/test/ref/scroll-clobber.log index a1c701adc..01b1d0e02 100644 --- a/src/test/ref/scroll-clobber.log +++ b/src/test/ref/scroll-clobber.log @@ -210,7 +210,7 @@ Allocated zp ZP_WORD:4 [ main::nxt#4 main::nxt#3 main::nxt#1 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label SCREEN = $400 @@ -317,7 +317,7 @@ Allocated (was zp ZP_WORD:4) zp ZP_WORD:2 [ main::nxt#4 main::nxt#3 main::nxt#1 ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label SCREEN = $400 @@ -406,21 +406,25 @@ Removing instruction jmp b3 Removing instruction jmp b2 Succesful ASM optimization Pass5NextJumpElimination Replacing label b2_from_b1 with b2 -Removing instruction bbegin: Removing instruction b1_from_bbegin: +Removing instruction b1: Removing instruction main_from_b1: Removing instruction bend_from_b1: Removing instruction b2_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b1: Removing instruction bend: Removing instruction b1_from_main: Removing instruction b3: Removing instruction b2_from_b3: Removing instruction b1_from_b2: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Removing instruction jmp b2 Succesful ASM optimization Pass5NextJumpElimination +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @1 @@ -453,7 +457,7 @@ zp ZP_WORD:2 [ main::nxt#4 main::nxt#3 main::nxt#1 ] FINAL ASSEMBLER -Score: 651 +Score: 645 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -466,7 +470,6 @@ Score: 651 //SEG4 @1 //SEG5 [2] call main //SEG6 [4] phi from @1 to main [phi:@1->main] - jsr main //SEG7 [3] phi from @1 to @end [phi:@1->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/signed-bytes.asm b/src/test/ref/signed-bytes.asm index 9d2eb42ed..08df84ab4 100644 --- a/src/test/ref/signed-bytes.asm +++ b/src/test/ref/signed-bytes.asm @@ -1,7 +1,6 @@ .pc = $801 "Basic" :BasicUpstart(main) .pc = $80d "Program" - jsr main main: { .label screen = $400 ldy #0 diff --git a/src/test/ref/signed-bytes.log b/src/test/ref/signed-bytes.log index fd83832ae..8d0739890 100644 --- a/src/test/ref/signed-bytes.log +++ b/src/test/ref/signed-bytes.log @@ -151,7 +151,7 @@ Allocated zp ZP_BYTE:3 [ main::j#2 main::j#1 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -236,7 +236,7 @@ Uplifting [] best 388 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -302,17 +302,21 @@ Removing instruction jmp bend Removing instruction jmp b1 Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination -Removing instruction bbegin: Removing instruction b1_from_bbegin: +Removing instruction b1: Removing instruction main_from_b1: Removing instruction bend_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b1: Removing instruction bend: Removing instruction b1_from_main: Removing instruction breturn: Removing instruction b1_from_b2: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @1 @@ -336,7 +340,7 @@ reg byte y [ main::j#2 main::j#1 ] FINAL ASSEMBLER -Score: 322 +Score: 316 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -348,7 +352,6 @@ Score: 322 //SEG4 @1 //SEG5 [2] call main //SEG6 [4] phi from @1 to main [phi:@1->main] - jsr main //SEG7 [3] phi from @1 to @end [phi:@1->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/signed-words.asm b/src/test/ref/signed-words.asm index c472af769..e97d5d163 100644 --- a/src/test/ref/signed-words.asm +++ b/src/test/ref/signed-words.asm @@ -23,7 +23,6 @@ .label xvel = 2 .label yvel_12 = 6 .label yvel_22 = 6 - jsr main main: { jsr init lda #<$64 diff --git a/src/test/ref/signed-words.log b/src/test/ref/signed-words.log index b57489325..355dd89ce 100644 --- a/src/test/ref/signed-words.log +++ b/src/test/ref/signed-words.log @@ -1166,7 +1166,7 @@ Allocated zp ZP_BYTE:25 [ anim::$16 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label SPRITES_XPOS = $d000 @@ -1626,7 +1626,7 @@ Allocated (was zp ZP_WORD:19) zp ZP_WORD:14 [ anim::$12 anim::sprite_y#0 ] ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label SPRITES_XPOS = $d000 @@ -2014,8 +2014,8 @@ Replacing label b5_from_b3 with b5 Replacing label b1_from_b1 with b1 Replacing label b1_from_b1 with b1 Replacing label b2_from_b2 with b2 -Removing instruction bbegin: Removing instruction b7_from_bbegin: +Removing instruction b7: Removing instruction main_from_b7: Removing instruction bend_from_b7: Removing instruction b2_from_b2: @@ -2026,7 +2026,6 @@ Removing instruction b2_from_b5: Removing instruction b1_from_b1: Removing instruction b2_from_b2: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b7: Removing instruction bend: Removing instruction b2_from_main: Removing instruction b3: @@ -2039,6 +2038,9 @@ Removing instruction b1_from_init: Removing instruction b2_from_b1: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Skipping double jump to b2 in bpl b5 Succesful ASM optimization Pass5DoubleJumpElimination Removing instruction jmp b2 @@ -2046,6 +2048,7 @@ Removing instruction jmp b1 Removing instruction jmp b1 Removing instruction jmp b2 Succesful ASM optimization Pass5NextJumpElimination +Removing instruction bbegin: Removing instruction b5: Succesful ASM optimization Pass5UnusedLabelElimination Removing unreachable instruction jmp b2 @@ -2216,7 +2219,7 @@ reg byte a [ anim::$16 ] FINAL ASSEMBLER -Score: 6623 +Score: 6617 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -2250,7 +2253,6 @@ Score: 6623 //SEG4 @7 //SEG5 [2] call main //SEG6 [4] phi from @7 to main [phi:@7->main] - jsr main //SEG7 [3] phi from @7 to @end [phi:@7->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/sinus-basic.asm b/src/test/ref/sinus-basic.asm index cc6c324ea..26647ced0 100644 --- a/src/test/ref/sinus-basic.asm +++ b/src/test/ref/sinus-basic.asm @@ -5,7 +5,6 @@ .label memHi = $ff .label print_line_cursor = 3 .label print_char_cursor = 5 - jsr main main: { .label f_2pi = $e2e5 .label i = 2 diff --git a/src/test/ref/sinus-basic.log b/src/test/ref/sinus-basic.log index 9d8e9f53a..6b8d7fa5e 100644 --- a/src/test/ref/sinus-basic.log +++ b/src/test/ref/sinus-basic.log @@ -1065,7 +1065,7 @@ Allocated zp ZP_BYTE:26 [ prepareMEM::$1 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label memLo = $fe @@ -1717,7 +1717,7 @@ Allocated (was zp ZP_WORD:9) zp ZP_WORD:7 [ prepareMEM::mem#5 prepareMEM::mem#4 ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label memLo = $fe @@ -2270,8 +2270,8 @@ Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination Replacing label b1_from_b1 with b1 Replacing label b1_from_b1 with b1 -Removing instruction bbegin: Removing instruction b47_from_bbegin: +Removing instruction b47: Removing instruction main_from_b47: Removing instruction bend_from_b47: Removing instruction b3_from_main: @@ -2296,7 +2296,6 @@ Removing instruction print_ln_from_b15: Removing instruction b1_from_print_ln: Removing instruction b1_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b47: Removing instruction bend: Removing instruction setFAC_from_main: Removing instruction b3: @@ -2346,6 +2345,11 @@ Removing instruction b1: Removing instruction breturn: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @47 @@ -2474,7 +2478,7 @@ reg byte a [ prepareMEM::$1 ] FINAL ASSEMBLER -Score: 4973 +Score: 4967 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -2490,7 +2494,6 @@ Score: 4973 //SEG4 @47 //SEG5 [2] call main //SEG6 [4] phi from @47 to main [phi:@47->main] - jsr main //SEG7 [3] phi from @47 to @end [phi:@47->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/sinusgen16.asm b/src/test/ref/sinusgen16.asm index f1ef5b5d9..5060e5c34 100644 --- a/src/test/ref/sinusgen16.asm +++ b/src/test/ref/sinusgen16.asm @@ -7,7 +7,6 @@ .label print_line_cursor = $400 .label rem16u = 2 .label print_char_cursor = 8 - jsr main main: { .label wavelength = $78 .label sw = 6 diff --git a/src/test/ref/sinusgen16.log b/src/test/ref/sinusgen16.log index 9d89c213c..f06fd2852 100644 --- a/src/test/ref/sinusgen16.log +++ b/src/test/ref/sinusgen16.log @@ -2408,7 +2408,7 @@ Allocated zp ZP_WORD:130 [ rem16u#1 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .const PI2_u4f28 = $6487ed51 @@ -3929,7 +3929,7 @@ Allocated (was zp ZP_WORD:71) zp ZP_WORD:31 [ sin16s::x1#0 ] ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .const PI2_u4f28 = $6487ed51 @@ -5082,8 +5082,8 @@ Replacing label b2_from_b1 with b2 Replacing label b3_from_b2 with b3 Replacing label b3_from_b2 with b3 Replacing label b1_from_b3 with b1 -Removing instruction bbegin: Removing instruction b40_from_bbegin: +Removing instruction b40: Removing instruction main_from_b40: Removing instruction bend_from_b40: Removing instruction b5_from_main: @@ -5116,7 +5116,6 @@ Removing instruction b2_from_b4: Removing instruction b3_from_b2: Removing instruction b3_from_b5: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b40: Removing instruction bend: Removing instruction sin16s_gen_from_main: Removing instruction b5: @@ -5176,6 +5175,9 @@ Removing instruction b5: Removing instruction b6: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Skipping double jump to b3 in beq b15 Succesful ASM optimization Pass5DoubleJumpElimination Relabelling long label b1_from_sin16s to b4 @@ -5187,6 +5189,7 @@ Removing instruction jmp b1 Succesful ASM optimization Pass5NextJumpElimination Removing instruction lda #0 Succesful ASM optimization Pass5UnnecesaryLoadElimination +Removing instruction bbegin: Removing instruction b15: Succesful ASM optimization Pass5UnusedLabelElimination Removing unreachable instruction jmp b3 @@ -5474,7 +5477,7 @@ reg byte a [ divr16u::$2 ] FINAL ASSEMBLER -Score: 20869 +Score: 20863 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -5492,7 +5495,6 @@ Score: 20869 //SEG4 @40 //SEG5 [2] call main //SEG6 [4] phi from @40 to main [phi:@40->main] - jsr main //SEG7 [3] phi from @40 to @end [phi:@40->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/sinusgen16b.asm b/src/test/ref/sinusgen16b.asm index 6694aae39..122bc4561 100644 --- a/src/test/ref/sinusgen16b.asm +++ b/src/test/ref/sinusgen16b.asm @@ -9,7 +9,6 @@ .label print_line_cursor = $400 .label rem16u = 2 .label print_char_cursor = $b - jsr main main: { .label wavelength = $78 .label sw = 8 diff --git a/src/test/ref/sinusgen16b.log b/src/test/ref/sinusgen16b.log index cae349503..e27b32f5a 100644 --- a/src/test/ref/sinusgen16b.log +++ b/src/test/ref/sinusgen16b.log @@ -3180,7 +3180,7 @@ Allocated zp ZP_WORD:186 [ sin16s::usinx#1 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .const PI2_u4f28 = $6487ed51 @@ -5324,7 +5324,7 @@ Allocated (was zp ZP_DWORD:71) zp ZP_DWORD:29 [ div32u16u::return#3 sin16s_genb: ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .const PI2_u4f28 = $6487ed51 @@ -6906,8 +6906,8 @@ Replacing label b2_from_b1 with b2 Replacing label b2_from_b1 with b2 Replacing label b2_from_b1 with b2 Replacing label b3_from_b15 with b3 -Removing instruction bbegin: Removing instruction b42_from_bbegin: +Removing instruction b42: Removing instruction main_from_b42: Removing instruction bend_from_b42: Removing instruction b5_from_main: @@ -6948,7 +6948,6 @@ Removing instruction b3_from_b15: Removing instruction b3_from_b6: Removing instruction breturn: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b42: Removing instruction bend: Removing instruction sin16s_gen_from_main: Removing instruction b5: @@ -7028,6 +7027,9 @@ Removing instruction mulu16_sel_from_b11: Removing instruction b12: Removing instruction b6: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Skipping double jump to b3 in beq b15 Skipping double jump to b3 in beq b15 Succesful ASM optimization Pass5DoubleJumpElimination @@ -7042,6 +7044,7 @@ Removing instruction jmp b1 Succesful ASM optimization Pass5NextJumpElimination Removing instruction lda #0 Succesful ASM optimization Pass5UnnecesaryLoadElimination +Removing instruction bbegin: Removing instruction b15: Removing instruction b15: Succesful ASM optimization Pass5UnusedLabelElimination @@ -7420,7 +7423,7 @@ reg byte a [ divr16u::$2 ] FINAL ASSEMBLER -Score: 23131 +Score: 23125 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -7440,7 +7443,6 @@ Score: 23131 //SEG4 @42 //SEG5 [2] call main //SEG6 [4] phi from @42 to main [phi:@42->main] - jsr main //SEG7 [3] phi from @42 to @end [phi:@42->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/sinusgen8.asm b/src/test/ref/sinusgen8.asm index 12bdf11ce..37689323b 100644 --- a/src/test/ref/sinusgen8.asm +++ b/src/test/ref/sinusgen8.asm @@ -7,7 +7,6 @@ .label print_line_cursor = $400 .label rem16u = 2 .label print_char_cursor = 5 - jsr main main: { .label wavelength = $c0 .label sb = 4 diff --git a/src/test/ref/sinusgen8.log b/src/test/ref/sinusgen8.log index e4b0d0885..b42c2c0d9 100644 --- a/src/test/ref/sinusgen8.log +++ b/src/test/ref/sinusgen8.log @@ -2287,7 +2287,7 @@ Allocated zp ZP_WORD:76 [ rem16u#1 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .const PI2_u4f12 = $6488 @@ -3531,7 +3531,7 @@ Allocated (was zp ZP_BYTE:55) zp ZP_BYTE:18 [ sin8s::usinx#0 ] ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .const PI2_u4f12 = $6488 @@ -4505,8 +4505,8 @@ Replacing label b2_from_b1 with b2 Replacing label b3_from_b2 with b3 Replacing label b3_from_b2 with b3 Replacing label b1_from_b3 with b1 -Removing instruction bbegin: Removing instruction b40_from_bbegin: +Removing instruction b40: Removing instruction main_from_b40: Removing instruction bend_from_b40: Removing instruction b5_from_main: @@ -4543,7 +4543,6 @@ Removing instruction b2_from_b4: Removing instruction b3_from_b2: Removing instruction b3_from_b5: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b40: Removing instruction bend: Removing instruction sin8s_gen_from_main: Removing instruction b5: @@ -4598,6 +4597,9 @@ Removing instruction b5: Removing instruction b6: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Relabelling long label b1_from_sin8s to b5 Succesful ASM optimization Pass5RelabelLongLabels Removing instruction jmp b1 @@ -4607,6 +4609,8 @@ Removing instruction jmp b1 Succesful ASM optimization Pass5NextJumpElimination Removing instruction lda #<0 Succesful ASM optimization Pass5UnnecesaryLoadElimination +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @40 @@ -4897,7 +4901,7 @@ reg byte a [ divr16u::$2 ] FINAL ASSEMBLER -Score: 15007 +Score: 15001 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -4915,7 +4919,6 @@ Score: 15007 //SEG4 @40 //SEG5 [2] call main //SEG6 [4] phi from @40 to main [phi:@40->main] - jsr main //SEG7 [3] phi from @40 to @end [phi:@40->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/sinusgen8b.asm b/src/test/ref/sinusgen8b.asm index 48b7eafab..f48607686 100644 --- a/src/test/ref/sinusgen8b.asm +++ b/src/test/ref/sinusgen8b.asm @@ -10,7 +10,6 @@ .label print_line_cursor = $400 .label rem16u = 2 .label print_char_cursor = 5 - jsr main main: { .label wavelength = $c0 .label _3 = 2 diff --git a/src/test/ref/sinusgen8b.log b/src/test/ref/sinusgen8b.log index 7d0360c97..b5843f96b 100644 --- a/src/test/ref/sinusgen8b.log +++ b/src/test/ref/sinusgen8b.log @@ -3500,7 +3500,7 @@ Allocated zp ZP_WORD:189 [ div16u::return#0 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .const PI2_u4f28 = $6487ed51 @@ -5762,7 +5762,7 @@ Allocated (was zp ZP_BYTE:172) zp ZP_BYTE:36 [ sin8s::usinx#0 ] ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .const PI2_u4f28 = $6487ed51 @@ -7430,8 +7430,8 @@ Replacing label b2_from_b1 with b2 Replacing label b3_from_b14 with b3 Replacing label b4_from_b18 with b4 Replacing label b4_from_b2 with b4 -Removing instruction bbegin: Removing instruction b40_from_bbegin: +Removing instruction b40: Removing instruction main_from_b40: Removing instruction bend_from_b40: Removing instruction b5_from_main: @@ -7478,7 +7478,6 @@ Removing instruction breturn: Removing instruction b4_from_b2: Removing instruction b4_from_b7: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b40: Removing instruction bend: Removing instruction sin8s_gen_from_main: Removing instruction b5: @@ -7564,6 +7563,9 @@ Removing instruction divr16u_from_div16u: Removing instruction b2: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Skipping double jump to b3 in beq b15 Succesful ASM optimization Pass5DoubleJumpElimination Relabelling long label b1_from_sin16s to b4 @@ -7578,6 +7580,7 @@ Succesful ASM optimization Pass5NextJumpElimination Removing instruction lda #0 Removing instruction lda #<0 Succesful ASM optimization Pass5UnnecesaryLoadElimination +Removing instruction bbegin: Removing instruction b15: Succesful ASM optimization Pass5UnusedLabelElimination Removing unreachable instruction jmp b3 @@ -8025,7 +8028,7 @@ reg byte a [ mul8u::$1 ] FINAL ASSEMBLER -Score: 28336 +Score: 28330 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -8046,7 +8049,6 @@ Score: 28336 //SEG4 @40 //SEG5 [2] call main //SEG6 [4] phi from @40 to main [phi:@40->main] - jsr main //SEG7 [3] phi from @40 to @end [phi:@40->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/sinusgenscale8.asm b/src/test/ref/sinusgenscale8.asm index 97974c35d..4b0ee5878 100644 --- a/src/test/ref/sinusgenscale8.asm +++ b/src/test/ref/sinusgenscale8.asm @@ -7,7 +7,6 @@ .label rem16u = 2 .label print_char_cursor = $d .label print_line_cursor = 8 - jsr main main: { .label tabsize = $14 jsr print_cls diff --git a/src/test/ref/sinusgenscale8.log b/src/test/ref/sinusgenscale8.log index a510d976b..71224760e 100644 --- a/src/test/ref/sinusgenscale8.log +++ b/src/test/ref/sinusgenscale8.log @@ -3490,7 +3490,7 @@ Allocated zp ZP_WORD:95 [ rem16u#1 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .const PI2_u4f12 = $6488 @@ -5230,7 +5230,7 @@ Allocated (was zp ZP_BYTE:76) zp ZP_BYTE:22 [ sin8s::usinx#0 ] ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .const PI2_u4f12 = $6488 @@ -6636,8 +6636,8 @@ Replacing label b3_from_b2 with b3 Replacing label b1_from_b3 with b1 Replacing label b1_from_b1 with b1 Replacing label b1_from_b1 with b1 -Removing instruction bbegin: Removing instruction b41_from_bbegin: +Removing instruction b41: Removing instruction main_from_b41: Removing instruction bend_from_b41: Removing instruction b1_from_main: @@ -6702,7 +6702,6 @@ Removing instruction b3_from_b2: Removing instruction b3_from_b5: Removing instruction b1_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b41: Removing instruction bend: Removing instruction print_cls_from_main: Removing instruction b1: @@ -6792,6 +6791,9 @@ Removing instruction breturn: Removing instruction b1_from_print_cls: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Relabelling long label b1_from_sin8s to b5 Succesful ASM optimization Pass5RelabelLongLabels Removing instruction jmp b1 @@ -6800,8 +6802,10 @@ Removing instruction jmp b1 Succesful ASM optimization Pass5NextJumpElimination Removing instruction lda #<0 Succesful ASM optimization Pass5UnnecesaryLoadElimination -Fixing long branch [164] bcc b1 to bcs -Fixing long branch [170] bcc b1 to bcs +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination +Fixing long branch [163] bcc b1 to bcs +Fixing long branch [169] bcc b1 to bcs FINAL SYMBOL TABLE (label) @41 @@ -7180,7 +7184,7 @@ reg byte a [ divr16u::$2 ] FINAL ASSEMBLER -Score: 19480 +Score: 19474 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -7198,7 +7202,6 @@ Score: 19480 //SEG4 @41 //SEG5 [2] call main //SEG6 [4] phi from @41 to main [phi:@41->main] - jsr main //SEG7 [3] phi from @41 to @end [phi:@41->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/summin.asm b/src/test/ref/summin.asm index 8582b197a..d92e19d6c 100644 --- a/src/test/ref/summin.asm +++ b/src/test/ref/summin.asm @@ -2,7 +2,6 @@ :BasicUpstart(main) .pc = $80d "Program" .label screen = $400 - jsr main main: { .label s1 = 2 .label s3 = 3 diff --git a/src/test/ref/summin.log b/src/test/ref/summin.log index 8381fcff1..bc3d89a30 100644 --- a/src/test/ref/summin.log +++ b/src/test/ref/summin.log @@ -279,7 +279,7 @@ Allocated zp ZP_BYTE:12 [ sum::return#3 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label screen = $400 @@ -450,7 +450,7 @@ Allocated (was zp ZP_BYTE:9) zp ZP_BYTE:3 [ main::s3#0 ] ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label screen = $400 @@ -556,12 +556,11 @@ Removing instruction jmp b3 Removing instruction jmp breturn Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination -Removing instruction bbegin: Removing instruction b2_from_bbegin: +Removing instruction b2: Removing instruction main_from_b2: Removing instruction bend_from_b2: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b2: Removing instruction bend: Removing instruction sum_from_main: Removing instruction b1: @@ -572,6 +571,11 @@ Removing instruction b3: Removing instruction breturn: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @2 @@ -619,7 +623,7 @@ reg byte a [ sum::return#3 ] FINAL ASSEMBLER -Score: 80 +Score: 74 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -632,7 +636,6 @@ Score: 80 //SEG4 @2 //SEG5 [2] call main //SEG6 [4] phi from @2 to main [phi:@2->main] - jsr main //SEG7 [3] phi from @2 to @end [phi:@2->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/test-address-of-param.asm b/src/test/ref/test-address-of-param.asm index 4f4029109..e357fd5d5 100644 --- a/src/test/ref/test-address-of-param.asm +++ b/src/test/ref/test-address-of-param.asm @@ -1,7 +1,6 @@ .pc = $801 "Basic" :BasicUpstart(main) .pc = $80d "Program" - jsr main main: { .label SCREEN = $400 .label b1 = 4 diff --git a/src/test/ref/test-address-of-param.log b/src/test/ref/test-address-of-param.log index f4feb43d7..5de435b1b 100644 --- a/src/test/ref/test-address-of-param.log +++ b/src/test/ref/test-address-of-param.log @@ -236,7 +236,7 @@ Allocated zp ZP_BYTE:7 [ main::b3#0 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -381,7 +381,7 @@ Allocated (was zp ZP_BYTE:7) zp ZP_BYTE:6 [ main::b3#0 ] ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -500,15 +500,14 @@ Succesful ASM optimization Pass5NextJumpElimination Removing instruction lda #0 Removing instruction lda #0 Succesful ASM optimization Pass5UnnecesaryLoadElimination -Removing instruction bbegin: Removing instruction b2_from_bbegin: +Removing instruction b2: Removing instruction bend_from_b2: Removing instruction b1_from_main: Removing instruction setByte_from_b1: Removing instruction b2_from_b1: Removing instruction setByte_from_b2: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b2: Removing instruction bend: Removing instruction setByte_from_main: Removing instruction b1: @@ -517,6 +516,11 @@ Removing instruction b3: Removing instruction breturn: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @2 @@ -550,7 +554,7 @@ zp ZP_BYTE:6 [ main::b3#0 ] FINAL ASSEMBLER -Score: 114 +Score: 108 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -561,7 +565,6 @@ Score: 114 //SEG3 [1] phi from @begin to @2 [phi:@begin->@2] //SEG4 @2 //SEG5 [2] call main - jsr main //SEG6 [3] phi from @2 to @end [phi:@2->@end] //SEG7 @end //SEG8 main diff --git a/src/test/ref/test-address-of.asm b/src/test/ref/test-address-of.asm index 9d0c7a9b1..90c2d2e41 100644 --- a/src/test/ref/test-address-of.asm +++ b/src/test/ref/test-address-of.asm @@ -1,7 +1,6 @@ .pc = $801 "Basic" :BasicUpstart(main) .pc = $80d "Program" - jsr main main: { .label SCREEN = $400 .label bp = b diff --git a/src/test/ref/test-address-of.log b/src/test/ref/test-address-of.log index d03dba144..b06e8866f 100644 --- a/src/test/ref/test-address-of.log +++ b/src/test/ref/test-address-of.log @@ -135,7 +135,7 @@ Allocated zp ZP_BYTE:3 [ main::c#0 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -211,7 +211,7 @@ Uplifting [main] best 443 combination zp ZP_BYTE:2 [ main::b#2 main::b#1 ] ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -274,19 +274,23 @@ Removing instruction jmp b1 Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination Replacing label b1_from_b1 with b1 -Removing instruction bbegin: Removing instruction b1_from_bbegin: +Removing instruction b1: Removing instruction main_from_b1: Removing instruction bend_from_b1: Removing instruction b1_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b1: Removing instruction bend: Removing instruction b1_from_main: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Removing instruction jmp b1 Succesful ASM optimization Pass5NextJumpElimination +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @1 @@ -310,7 +314,7 @@ reg byte a [ main::c#0 ] FINAL ASSEMBLER -Score: 347 +Score: 341 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -322,7 +326,6 @@ Score: 347 //SEG4 @1 //SEG5 [2] call main //SEG6 [4] phi from @1 to main [phi:@1->main] - jsr main //SEG7 [3] phi from @1 to @end [phi:@1->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/test-comparisons.asm b/src/test/ref/test-comparisons.asm index 0af990a13..edb1eb415 100644 --- a/src/test/ref/test-comparisons.asm +++ b/src/test/ref/test-comparisons.asm @@ -3,7 +3,6 @@ .pc = $80d "Program" .label print_char_cursor = 9 .label print_line_cursor = 4 - jsr main main: { .label b = $c .label a = 2 diff --git a/src/test/ref/test-comparisons.log b/src/test/ref/test-comparisons.log index bdbb42837..e31f60d92 100644 --- a/src/test/ref/test-comparisons.log +++ b/src/test/ref/test-comparisons.log @@ -3065,7 +3065,7 @@ Allocated zp ZP_BYTE:41 [ print_byte::$2 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label print_char_cursor = $20 @@ -4724,7 +4724,7 @@ Allocated (was zp ZP_BYTE:39) zp ZP_BYTE:12 [ main::b#0 ] ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label print_char_cursor = 9 @@ -6127,8 +6127,8 @@ Replacing label b1_from_b1 with b1 Replacing label b1_from_b2 with b1 Replacing label b1_from_b1 with b1 Replacing label b1_from_b1 with b1 -Removing instruction bbegin: Removing instruction b21_from_bbegin: +Removing instruction b21: Removing instruction main_from_b21: Removing instruction bend_from_b21: Removing instruction b23_from_b1: @@ -6191,7 +6191,6 @@ Removing instruction b1_from_print_str: Removing instruction b1_from_b2: Removing instruction b1_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b21: Removing instruction bend: Removing instruction print_cls_from_main: Removing instruction b1_from_main: @@ -6282,6 +6281,9 @@ Removing instruction breturn: Removing instruction b1_from_print_cls: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Relabelling long label b2_from_b1 to b23 Relabelling long label b3_from_b46 to b24 Relabelling long label b4_from_b47 to b25 @@ -6305,6 +6307,8 @@ Relabelling long label b21_from_b68 to b42 Succesful ASM optimization Pass5RelabelLongLabels Removing instruction jmp b1 Succesful ASM optimization Pass5NextJumpElimination +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @21 @@ -6590,7 +6594,7 @@ reg byte a [ print_byte::$2 ] FINAL ASSEMBLER -Score: 15772 +Score: 15766 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -6604,7 +6608,6 @@ Score: 15772 //SEG4 @21 //SEG5 [2] call main //SEG6 [4] phi from @21 to main [phi:@21->main] - jsr main //SEG7 [3] phi from @21 to @end [phi:@21->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/test-division.asm b/src/test/ref/test-division.asm index be4633bce..86eb89335 100644 --- a/src/test/ref/test-division.asm +++ b/src/test/ref/test-division.asm @@ -5,7 +5,6 @@ .label print_line_cursor = 3 .label rem16u = $a .label rem16s = $a - jsr main main: { jsr print_cls jsr test_8u diff --git a/src/test/ref/test-division.log b/src/test/ref/test-division.log index 62ba18b82..77be33a5a 100644 --- a/src/test/ref/test-division.log +++ b/src/test/ref/test-division.log @@ -4476,7 +4476,7 @@ Allocated zp ZP_BYTE:120 [ test_8u::res#0 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label print_char_cursor = $b @@ -6705,7 +6705,7 @@ Allocated (was zp ZP_BYTE:96) zp ZP_BYTE:22 [ divr8u::divisor#0 ] ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label print_char_cursor = 8 @@ -8478,8 +8478,8 @@ Replacing label b1_from_b3 with b1 Replacing label b1_from_b11 with b1 Replacing label b1_from_b1 with b1 Replacing label b1_from_b1 with b1 -Removing instruction bbegin: Removing instruction b32_from_bbegin: +Removing instruction b32: Removing instruction main_from_b32: Removing instruction bend_from_b32: Removing instruction b1_from_main: @@ -8559,7 +8559,6 @@ Removing instruction b10_from_b9: Removing instruction print_ln_from_b10: Removing instruction b1_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b32: Removing instruction bend: Removing instruction print_cls_from_main: Removing instruction b1: @@ -8683,6 +8682,9 @@ Removing instruction b1_from_b12: Removing instruction b1_from_print_cls: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Skipping double jump to breturn in beq b19 Succesful ASM optimization Pass5DoubleJumpElimination Removing instruction jmp b1 @@ -8692,6 +8694,7 @@ Removing instruction jmp b1 Removing instruction jmp b1 Removing instruction jmp b1 Succesful ASM optimization Pass5NextJumpElimination +Removing instruction bbegin: Removing instruction b19: Succesful ASM optimization Pass5UnusedLabelElimination Removing unreachable instruction jmp breturn @@ -9158,7 +9161,7 @@ reg byte a [ div8u::return#3 ] FINAL ASSEMBLER -Score: 32567 +Score: 32561 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -9174,7 +9177,6 @@ Score: 32567 //SEG4 @32 //SEG5 [2] call main //SEG6 [4] phi from @32 to main [phi:@32->main] - jsr main //SEG7 [3] phi from @32 to @end [phi:@32->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/test-interrupt-notype.asm b/src/test/ref/test-interrupt-notype.asm index 948b5dd6c..012a2ed74 100644 --- a/src/test/ref/test-interrupt-notype.asm +++ b/src/test/ref/test-interrupt-notype.asm @@ -4,7 +4,6 @@ .label KERNEL_IRQ = $314 .label BGCOL = $d020 .label FGCOL = $d021 - jsr main main: { lda #@2] //SEG4 @2 //SEG5 [2] call main - jsr main //SEG6 [3] phi from @2 to @end [phi:@2->@end] //SEG7 @end //SEG8 main diff --git a/src/test/ref/test-interrupt-volatile-write.asm b/src/test/ref/test-interrupt-volatile-write.asm index 0a2940637..c5a0b9204 100644 --- a/src/test/ref/test-interrupt-volatile-write.asm +++ b/src/test/ref/test-interrupt-volatile-write.asm @@ -1,9 +1,10 @@ .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" .label KERNEL_IRQ = $314 .label BGCOL = $d020 .label col = 2 +bbegin: lda #0 sta col jsr main diff --git a/src/test/ref/test-interrupt-volatile-write.log b/src/test/ref/test-interrupt-volatile-write.log index 166cc9ede..1b8eb6dd7 100644 --- a/src/test/ref/test-interrupt-volatile-write.log +++ b/src/test/ref/test-interrupt-volatile-write.log @@ -213,7 +213,7 @@ Allocated zp ZP_BYTE:4 [ col#3 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label KERNEL_IRQ = $314 @@ -338,7 +338,7 @@ Coalescing zero page register with common assignment [ zp ZP_BYTE:2 [ col#14 col ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label KERNEL_IRQ = $314 @@ -442,7 +442,6 @@ Removing instruction b1_from_main: Removing instruction b1_from_b2: Removing instruction b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction bbegin: Removing instruction b2: Removing instruction bend: Removing instruction b7: @@ -493,13 +492,14 @@ Score: 889 //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label KERNEL_IRQ = $314 .label BGCOL = $d020 .label col = 2 //SEG2 @begin +bbegin: //SEG3 [0] (byte) col#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1 lda #0 sta col diff --git a/src/test/ref/test-interrupt-volatile.asm b/src/test/ref/test-interrupt-volatile.asm index 1aff07695..69253b5ba 100644 --- a/src/test/ref/test-interrupt-volatile.asm +++ b/src/test/ref/test-interrupt-volatile.asm @@ -1,9 +1,10 @@ .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" .label KERNEL_IRQ = $314 .label BGCOL = $d020 .label col = 2 +bbegin: lda #0 sta col jsr main diff --git a/src/test/ref/test-interrupt-volatile.log b/src/test/ref/test-interrupt-volatile.log index ce1d31223..f2b5fb9d1 100644 --- a/src/test/ref/test-interrupt-volatile.log +++ b/src/test/ref/test-interrupt-volatile.log @@ -150,7 +150,7 @@ Allocated zp ZP_BYTE:2 [ col#2 col#0 col#1 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label KERNEL_IRQ = $314 @@ -230,7 +230,7 @@ Uplifting [] best 186 combination zp ZP_BYTE:2 [ col#2 col#0 col#1 ] ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label KERNEL_IRQ = $314 @@ -303,7 +303,6 @@ Removing instruction b1_from_main: Removing instruction b1_from_b2: Removing instruction b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction bbegin: Removing instruction b2: Removing instruction bend: Removing instruction breturn: @@ -335,13 +334,14 @@ Score: 117 //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label KERNEL_IRQ = $314 .label BGCOL = $d020 .label col = 2 //SEG2 @begin +bbegin: //SEG3 [0] (byte) col#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1 lda #0 sta col diff --git a/src/test/ref/test-interrupt.asm b/src/test/ref/test-interrupt.asm index 948b5dd6c..012a2ed74 100644 --- a/src/test/ref/test-interrupt.asm +++ b/src/test/ref/test-interrupt.asm @@ -4,7 +4,6 @@ .label KERNEL_IRQ = $314 .label BGCOL = $d020 .label FGCOL = $d021 - jsr main main: { lda #@2] //SEG4 @2 //SEG5 [2] call main - jsr main //SEG6 [3] phi from @2 to @end [phi:@2->@end] //SEG7 @end //SEG8 main diff --git a/src/test/ref/test-kasm.asm b/src/test/ref/test-kasm.asm index 31bfceb1b..5f674d28a 100644 --- a/src/test/ref/test-kasm.asm +++ b/src/test/ref/test-kasm.asm @@ -1,6 +1,7 @@ .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" +bbegin: .byte 1, 2, 3 jsr main diff --git a/src/test/ref/test-kasm.log b/src/test/ref/test-kasm.log index 1c28da71e..75a1e3f8e 100644 --- a/src/test/ref/test-kasm.log +++ b/src/test/ref/test-kasm.log @@ -82,7 +82,7 @@ Complete equivalence classes INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -125,7 +125,7 @@ Uplifting [] best 2915 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -161,10 +161,9 @@ Removing instruction jmp b1 Removing instruction jmp bend Removing instruction jmp b2 Succesful ASM optimization Pass5NextJumpElimination -Removing instruction bbegin: +Removing instruction b1: Removing instruction bend_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b1: Removing instruction main_from_b1: Removing instruction bend: Succesful ASM optimization Pass5UnusedLabelElimination @@ -183,10 +182,11 @@ Score: 2852 //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin +bbegin: //SEG3 @1 //SEG4 kickasm {{ .byte 1, 2, 3 }} .byte 1, 2, 3 diff --git a/src/test/ref/test-keyboard-space.asm b/src/test/ref/test-keyboard-space.asm index 618b4465a..f98789ea3 100644 --- a/src/test/ref/test-keyboard-space.asm +++ b/src/test/ref/test-keyboard-space.asm @@ -10,7 +10,6 @@ .const GREEN = 5 .const BLUE = 6 .const KEY_SPACE = $3c - jsr main main: { jsr keyboard_init b4: diff --git a/src/test/ref/test-keyboard-space.log b/src/test/ref/test-keyboard-space.log index 6003e7c16..9ccf83265 100644 --- a/src/test/ref/test-keyboard-space.log +++ b/src/test/ref/test-keyboard-space.log @@ -1089,7 +1089,7 @@ Allocated zp ZP_BYTE:7 [ keyboard_matrix_read::return#0 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label RASTER = $d012 @@ -1259,7 +1259,7 @@ Uplifting [] best 1258 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label RASTER = $d012 @@ -1395,14 +1395,13 @@ Removing instruction jmp breturn Removing instruction jmp breturn Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination -Removing instruction bbegin: Removing instruction b12_from_bbegin: +Removing instruction b12: Removing instruction main_from_b12: Removing instruction bend_from_b12: Removing instruction b9_from_b4: Removing instruction keyboard_key_pressed_from_b9: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b12: Removing instruction bend: Removing instruction b9: Removing instruction b14: @@ -1412,6 +1411,11 @@ Removing instruction breturn: Removing instruction breturn: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @12 @@ -1621,7 +1625,7 @@ reg byte a [ keyboard_matrix_read::return#0 ] FINAL ASSEMBLER -Score: 1147 +Score: 1141 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -1642,7 +1646,6 @@ Score: 1147 //SEG4 @12 //SEG5 [2] call main //SEG6 [4] phi from @12 to main [phi:@12->main] - jsr main //SEG7 [3] phi from @12 to @end [phi:@12->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/test-keyboard.asm b/src/test/ref/test-keyboard.asm index c2e926070..de1a2345d 100644 --- a/src/test/ref/test-keyboard.asm +++ b/src/test/ref/test-keyboard.asm @@ -56,7 +56,6 @@ .const KEY_2 = $3b .const KEY_SPACE = $3c .const KEY_Q = $3e - jsr main main: { .label sc = 2 .label screen = 2 diff --git a/src/test/ref/test-keyboard.log b/src/test/ref/test-keyboard.log index ce95606dc..7b6f039ad 100644 --- a/src/test/ref/test-keyboard.log +++ b/src/test/ref/test-keyboard.log @@ -1605,7 +1605,7 @@ Allocated zp ZP_BYTE:28 [ keyboard_get_keycode::return#0 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label RASTER = $d012 @@ -2147,7 +2147,7 @@ Allocated (was zp ZP_BYTE:22) zp ZP_BYTE:5 [ keyboard_key_pressed::colidx#0 ] ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label RASTER = $d012 @@ -2577,8 +2577,8 @@ Replacing label b11_from_b29 with b11 Replacing label b11_from_b30 with b11 Replacing label b10_from_b11 with b10 Replacing label b13_from_b13 with b13 -Removing instruction bbegin: Removing instruction b12_from_bbegin: +Removing instruction b12: Removing instruction main_from_b12: Removing instruction bend_from_b12: Removing instruction b1_from_b1: @@ -2592,7 +2592,6 @@ Removing instruction b11_from_b30: Removing instruction b13_from_b11: Removing instruction b13_from_b13: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b12: Removing instruction bend: Removing instruction b1_from_main: Removing instruction b14: @@ -2615,11 +2614,16 @@ Removing instruction breturn: Removing instruction breturn: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Removing instruction jmp b1 Removing instruction jmp b6 Removing instruction jmp b7 Removing instruction jmp b10 Succesful ASM optimization Pass5NextJumpElimination +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @12 @@ -2945,7 +2949,7 @@ reg byte a [ keyboard_get_keycode::return#0 ] FINAL ASSEMBLER -Score: 56827 +Score: 56821 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -3012,7 +3016,6 @@ Score: 56827 //SEG4 @12 //SEG5 [2] call main //SEG6 [4] phi from @12 to main [phi:@12->main] - jsr main //SEG7 [3] phi from @12 to @end [phi:@12->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/test-lohiconst.asm b/src/test/ref/test-lohiconst.asm index d101ccfcf..978c02822 100644 --- a/src/test/ref/test-lohiconst.asm +++ b/src/test/ref/test-lohiconst.asm @@ -2,7 +2,6 @@ :BasicUpstart(main) .pc = $80d "Program" .const PI_u4f28 = $3243f6a9 - jsr main main: { .label SCREEN = $400 lda #>PI_u4f28>>$10 diff --git a/src/test/ref/test-lohiconst.log b/src/test/ref/test-lohiconst.log index 6fa1644c1..f8b7ebd19 100644 --- a/src/test/ref/test-lohiconst.log +++ b/src/test/ref/test-lohiconst.log @@ -122,7 +122,7 @@ Complete equivalence classes INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .const PI_u4f28 = $3243f6a9 @@ -178,7 +178,7 @@ Uplifting [] best 45 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .const PI_u4f28 = $3243f6a9 @@ -223,14 +223,18 @@ Removing instruction jmp b1 Removing instruction jmp bend Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination -Removing instruction bbegin: Removing instruction b1_from_bbegin: +Removing instruction b1: Removing instruction bend_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b1: Removing instruction bend: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @1 @@ -246,7 +250,7 @@ FINAL SYMBOL TABLE FINAL ASSEMBLER -Score: 36 +Score: 30 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -258,7 +262,6 @@ Score: 36 //SEG3 [1] phi from @begin to @1 [phi:@begin->@1] //SEG4 @1 //SEG5 [2] call main - jsr main //SEG6 [3] phi from @1 to @end [phi:@1->@end] //SEG7 @end //SEG8 main diff --git a/src/test/ref/test-lowhigh.asm b/src/test/ref/test-lowhigh.asm index 59fd21362..81b2f132a 100644 --- a/src/test/ref/test-lowhigh.asm +++ b/src/test/ref/test-lowhigh.asm @@ -3,7 +3,6 @@ .pc = $80d "Program" .label print_line_cursor = 6 .label print_char_cursor = 8 - jsr main main: { .label _1 = 6 .label _2 = $a diff --git a/src/test/ref/test-lowhigh.log b/src/test/ref/test-lowhigh.log index 94aa7ef0f..eb1cc011f 100644 --- a/src/test/ref/test-lowhigh.log +++ b/src/test/ref/test-lowhigh.log @@ -1100,7 +1100,7 @@ Allocated zp ZP_BYTE:49 [ print_byte::$2 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label print_line_cursor = 6 @@ -1782,7 +1782,7 @@ Allocated (was zp ZP_DWORD:22) zp ZP_DWORD:12 [ main::dw2#1 main::dw2#10 print_d ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label print_line_cursor = 6 @@ -2349,8 +2349,8 @@ Replacing label b1_from_b1 with b1 Replacing label b1_from_b1 with b1 Replacing label b1_from_b1 with b1 Replacing label b1_from_b1 with b1 -Removing instruction bbegin: Removing instruction b20_from_bbegin: +Removing instruction b20: Removing instruction main_from_b20: Removing instruction bend_from_b20: Removing instruction b4_from_b1: @@ -2371,7 +2371,6 @@ Removing instruction b1_from_print_ln: Removing instruction b1_from_b1: Removing instruction b1_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b20: Removing instruction bend: Removing instruction print_cls_from_main: Removing instruction b1_from_main: @@ -2414,8 +2413,13 @@ Removing instruction breturn: Removing instruction b1_from_print_cls: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Removing instruction jmp b1 Succesful ASM optimization Pass5NextJumpElimination +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @20 @@ -2524,7 +2528,7 @@ reg byte a [ print_byte::$2 ] FINAL ASSEMBLER -Score: 7680 +Score: 7674 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -2538,7 +2542,6 @@ Score: 7680 //SEG4 @20 //SEG5 [2] call main //SEG6 [4] phi from @20 to main [phi:@20->main] - jsr main //SEG7 [3] phi from @20 to @end [phi:@20->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/test-multiply-16bit.asm b/src/test/ref/test-multiply-16bit.asm index b88970a05..fa6d6b19d 100644 --- a/src/test/ref/test-multiply-16bit.asm +++ b/src/test/ref/test-multiply-16bit.asm @@ -4,7 +4,6 @@ .label BGCOL = $d021 .label print_char_cursor = $f .label print_line_cursor = 7 - jsr main main: { lda #5 sta BGCOL diff --git a/src/test/ref/test-multiply-16bit.log b/src/test/ref/test-multiply-16bit.log index 14112b5dc..3ced4ef73 100644 --- a/src/test/ref/test-multiply-16bit.log +++ b/src/test/ref/test-multiply-16bit.log @@ -4717,7 +4717,7 @@ Allocated zp ZP_BYTE:235 [ mulf_init::$6 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label BGCOL = $d021 @@ -7735,7 +7735,7 @@ Allocated (was zp ZP_DWORD:37) zp ZP_DWORD:25 [ mul16s::m#4 mul16s::m#5 mul16s:: ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label BGCOL = $d021 @@ -10086,8 +10086,8 @@ Replacing label b3_from_b4 with b3 Replacing label b3_from_b4 with b3 Replacing label b1_from_b1 with b1 Replacing label b1_from_b1 with b1 -Removing instruction bbegin: Removing instruction b40_from_bbegin: +Removing instruction b40: Removing instruction bend_from_b40: Removing instruction b1_from_main: Removing instruction mulf_init_from_b1: @@ -10175,7 +10175,6 @@ Removing instruction b12_from_b3: Removing instruction b4_from_b12: Removing instruction b1_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b40: Removing instruction bend: Removing instruction print_cls_from_main: Removing instruction b1: @@ -10294,6 +10293,9 @@ Removing instruction breturn: Removing instruction b1_from_print_cls: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Skipping double jump to b4 in beq b22 Skipping double jump to b4 in jmp b4_from_b5 Skipping double jump to b4 in beq b22 @@ -10320,6 +10322,7 @@ Succesful ASM optimization Pass5NextJumpElimination Removing instruction lda #0 Removing instruction lda a+1 Succesful ASM optimization Pass5UnnecesaryLoadElimination +Removing instruction bbegin: Removing instruction b22: Removing instruction b1: Removing instruction b22: @@ -10329,8 +10332,8 @@ Removing unreachable instruction jmp b4 Removing unreachable instruction jmp b4 Removing unreachable instruction jmp b4 Succesful ASM optimization Pass5UnreachableCodeElimination -Fixing long branch [109] bne b1 to beq -Fixing long branch [831] bne b1 to beq +Fixing long branch [108] bne b1 to beq +Fixing long branch [830] bne b1 to beq FINAL SYMBOL TABLE (label) @40 @@ -10799,7 +10802,7 @@ reg byte a [ mulf_init::$6 ] FINAL ASSEMBLER -Score: 444973 +Score: 444967 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -10813,7 +10816,6 @@ Score: 444973 //SEG3 [1] phi from @begin to @40 [phi:@begin->@40] //SEG4 @40 //SEG5 [2] call main - jsr main //SEG6 [3] phi from @40 to @end [phi:@40->@end] //SEG7 @end //SEG8 main diff --git a/src/test/ref/test-multiply-8bit.asm b/src/test/ref/test-multiply-8bit.asm index dbec0f85a..f99c95a91 100644 --- a/src/test/ref/test-multiply-8bit.asm +++ b/src/test/ref/test-multiply-8bit.asm @@ -4,7 +4,6 @@ .label BGCOL = $d021 .label print_char_cursor = $a .label print_line_cursor = 4 - jsr main main: { lda #5 sta BGCOL diff --git a/src/test/ref/test-multiply-8bit.log b/src/test/ref/test-multiply-8bit.log index 95d28e77d..4407aff92 100644 --- a/src/test/ref/test-multiply-8bit.log +++ b/src/test/ref/test-multiply-8bit.log @@ -4951,7 +4951,7 @@ Allocated zp ZP_BYTE:142 [ mulf_init::$6 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label BGCOL = $d021 @@ -7715,7 +7715,7 @@ Allocated (was zp ZP_WORD:26) zp ZP_WORD:14 [ mulf8s_prepared::m#4 mulf8s_prepar ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label BGCOL = $d021 @@ -9941,8 +9941,8 @@ Replacing label b3_from_b4 with b3 Replacing label b3_from_b4 with b3 Replacing label b1_from_b1 with b1 Replacing label b1_from_b1 with b1 -Removing instruction bbegin: Removing instruction b42_from_bbegin: +Removing instruction b42: Removing instruction bend_from_b42: Removing instruction b1_from_main: Removing instruction mulf_init_from_b1: @@ -10040,7 +10040,6 @@ Removing instruction b12_from_b3: Removing instruction b4_from_b12: Removing instruction b1_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b42: Removing instruction bend: Removing instruction print_cls_from_main: Removing instruction b1: @@ -10176,6 +10175,9 @@ Removing instruction breturn: Removing instruction b1_from_print_cls: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Skipping double jump to b4 in beq b20 Skipping double jump to b4 in jmp b4_from_b5 Skipping double jump to b4 in beq b20 @@ -10203,6 +10205,7 @@ Succesful ASM optimization Pass5NextJumpElimination Removing instruction lda #<0 Removing instruction lda a Succesful ASM optimization Pass5UnnecesaryLoadElimination +Removing instruction bbegin: Removing instruction b20: Removing instruction b1: Removing instruction b20: @@ -10736,7 +10739,7 @@ reg byte a [ mulf_init::$6 ] FINAL ASSEMBLER -Score: 224900 +Score: 224894 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -10750,7 +10753,6 @@ Score: 224900 //SEG3 [1] phi from @begin to @42 [phi:@begin->@42] //SEG4 @42 //SEG5 [2] call main - jsr main //SEG6 [3] phi from @42 to @end [phi:@42->@end] //SEG7 @end //SEG8 main diff --git a/src/test/ref/true-inline-words.asm b/src/test/ref/true-inline-words.asm index 5d2afe7ae..1681a65d9 100644 --- a/src/test/ref/true-inline-words.asm +++ b/src/test/ref/true-inline-words.asm @@ -1,7 +1,6 @@ .pc = $801 "Basic" :BasicUpstart(main) .pc = $80d "Program" - jsr main main: { .const b = 4 .label pos = $501 diff --git a/src/test/ref/true-inline-words.log b/src/test/ref/true-inline-words.log index 3568f2a44..d612b0e8f 100644 --- a/src/test/ref/true-inline-words.log +++ b/src/test/ref/true-inline-words.log @@ -157,7 +157,7 @@ Complete equivalence classes INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -224,7 +224,7 @@ Uplifting [] best 55 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -281,14 +281,18 @@ Removing instruction jmp bend Removing instruction jmp b3 Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination -Removing instruction bbegin: Removing instruction b1_from_bbegin: +Removing instruction b1: Removing instruction bend_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b1: Removing instruction bend: Removing instruction b3: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @1 @@ -315,7 +319,7 @@ FINAL SYMBOL TABLE FINAL ASSEMBLER -Score: 43 +Score: 37 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -326,7 +330,6 @@ Score: 43 //SEG3 [1] phi from @begin to @1 [phi:@begin->@1] //SEG4 @1 //SEG5 [2] call main - jsr main //SEG6 [3] phi from @1 to @end [phi:@1->@end] //SEG7 @end //SEG8 main diff --git a/src/test/ref/typeinference-problem.asm b/src/test/ref/typeinference-problem.asm index c2d3c2a5b..cd52f4c1c 100644 --- a/src/test/ref/typeinference-problem.asm +++ b/src/test/ref/typeinference-problem.asm @@ -1,7 +1,6 @@ .pc = $801 "Basic" :BasicUpstart(main) .pc = $80d "Program" - jsr main main: { ldx #0 b1: diff --git a/src/test/ref/typeinference-problem.log b/src/test/ref/typeinference-problem.log index 5bc8a5928..66c3e448a 100644 --- a/src/test/ref/typeinference-problem.log +++ b/src/test/ref/typeinference-problem.log @@ -115,7 +115,7 @@ Allocated zp ZP_BYTE:3 [ main::$0 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -192,7 +192,7 @@ Uplifting [] best 363 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -253,19 +253,23 @@ Removing instruction jmp b1 Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination Replacing label b1_from_b1 with b1 -Removing instruction bbegin: Removing instruction b1_from_bbegin: +Removing instruction b1: Removing instruction main_from_b1: Removing instruction bend_from_b1: Removing instruction b1_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b1: Removing instruction bend: Removing instruction b1_from_main: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Removing instruction jmp b1 Succesful ASM optimization Pass5NextJumpElimination +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @1 @@ -286,7 +290,7 @@ reg byte a [ main::$0 ] FINAL ASSEMBLER -Score: 267 +Score: 261 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -298,7 +302,6 @@ Score: 267 //SEG4 @1 //SEG5 [2] call main //SEG6 [4] phi from @1 to main [phi:@1->main] - jsr main //SEG7 [3] phi from @1 to @end [phi:@1->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/unroll-loop-modifyvar.asm b/src/test/ref/unroll-loop-modifyvar.asm index 9c38449de..f0d9ddbae 100644 --- a/src/test/ref/unroll-loop-modifyvar.asm +++ b/src/test/ref/unroll-loop-modifyvar.asm @@ -1,7 +1,6 @@ .pc = $801 "Basic" :BasicUpstart(main) .pc = $80d "Program" - jsr main main: { .label SCREEN = $400 lda #3 diff --git a/src/test/ref/unroll-loop-modifyvar.log b/src/test/ref/unroll-loop-modifyvar.log index e72d34d09..3e573d99d 100644 --- a/src/test/ref/unroll-loop-modifyvar.log +++ b/src/test/ref/unroll-loop-modifyvar.log @@ -362,7 +362,7 @@ Complete equivalence classes INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -487,7 +487,7 @@ Uplifting [] best 156 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -605,12 +605,11 @@ Removing instruction jmp b1_10 Removing instruction jmp b2 Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination -Removing instruction bbegin: Removing instruction b1_from_bbegin: +Removing instruction b1: Removing instruction main_from_b1: Removing instruction bend_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b1: Removing instruction bend: Removing instruction b1: Removing instruction b1_1: @@ -626,6 +625,11 @@ Removing instruction b1_10: Removing instruction b2: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @1 @@ -652,7 +656,7 @@ FINAL SYMBOL TABLE FINAL ASSEMBLER -Score: 84 +Score: 78 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -664,7 +668,6 @@ Score: 84 //SEG4 @1 //SEG5 [2] call main //SEG6 [4] phi from @1 to main [phi:@1->main] - jsr main //SEG7 [3] phi from @1 to @end [phi:@1->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/unroll-screenfill-for-double.asm b/src/test/ref/unroll-screenfill-for-double.asm index 04bb0c00f..21a688bab 100644 --- a/src/test/ref/unroll-screenfill-for-double.asm +++ b/src/test/ref/unroll-screenfill-for-double.asm @@ -1,7 +1,6 @@ .pc = $801 "Basic" :BasicUpstart(main) .pc = $80d "Program" - jsr main main: { .label SCREEN = $400 lda #0 diff --git a/src/test/ref/unroll-screenfill-for-double.log b/src/test/ref/unroll-screenfill-for-double.log index 8edea07e8..b452f3542 100644 --- a/src/test/ref/unroll-screenfill-for-double.log +++ b/src/test/ref/unroll-screenfill-for-double.log @@ -1242,7 +1242,7 @@ Complete equivalence classes INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -2130,7 +2130,7 @@ Uplifting [] best 1137 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -3011,12 +3011,11 @@ Removing instruction jmp b2_119 Removing instruction jmp b2_120 Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination -Removing instruction bbegin: Removing instruction b1_from_bbegin: +Removing instruction b1: Removing instruction main_from_b1: Removing instruction bend_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b1: Removing instruction bend: Removing instruction b2: Removing instruction b2_1: @@ -3141,6 +3140,9 @@ Removing instruction b2_119: Removing instruction b2_120: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Removing instruction lda #0 Removing instruction lda #0 Removing instruction lda #0 @@ -3252,6 +3254,8 @@ Removing instruction lda #$a Removing instruction lda #$a Removing instruction lda #$a Succesful ASM optimization Pass5UnnecesaryLoadElimination +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @1 @@ -3388,7 +3392,7 @@ FINAL SYMBOL TABLE FINAL ASSEMBLER -Score: 518 +Score: 512 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -3400,7 +3404,6 @@ Score: 518 //SEG4 @1 //SEG5 [2] call main //SEG6 [4] phi from @1 to main [phi:@1->main] - jsr main //SEG7 [3] phi from @1 to @end [phi:@1->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/unroll-screenfill-for.asm b/src/test/ref/unroll-screenfill-for.asm index 2d0d972af..99cb380d2 100644 --- a/src/test/ref/unroll-screenfill-for.asm +++ b/src/test/ref/unroll-screenfill-for.asm @@ -1,7 +1,6 @@ .pc = $801 "Basic" :BasicUpstart(main) .pc = $80d "Program" - jsr main main: { .label SCREEN = $400 ldx #0 diff --git a/src/test/ref/unroll-screenfill-for.log b/src/test/ref/unroll-screenfill-for.log index 2c834826e..1618e446f 100644 --- a/src/test/ref/unroll-screenfill-for.log +++ b/src/test/ref/unroll-screenfill-for.log @@ -666,7 +666,7 @@ Allocated zp ZP_BYTE:2 [ main::x#4 main::x#1 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -905,7 +905,7 @@ Uplifting [] best 2723 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -1137,14 +1137,13 @@ Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination Replacing label b1 with b2 Replacing label b1_from_b3 with b2 -Removing instruction bbegin: Removing instruction b1_from_bbegin: +Removing instruction b1: Removing instruction main_from_b1: Removing instruction bend_from_b1: Removing instruction b1_from_b3: Removing instruction b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b1: Removing instruction bend: Removing instruction b1_from_main: Removing instruction b2_1: @@ -1174,8 +1173,13 @@ Removing instruction b2_24: Removing instruction b3: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Removing instruction jmp b2 Succesful ASM optimization Pass5NextJumpElimination +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @1 @@ -1221,7 +1225,7 @@ reg byte x [ main::x#4 main::x#1 ] FINAL ASSEMBLER -Score: 1847 +Score: 1841 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -1233,7 +1237,6 @@ Score: 1847 //SEG4 @1 //SEG5 [2] call main //SEG6 [4] phi from @1 to main [phi:@1->main] - jsr main //SEG7 [3] phi from @1 to @end [phi:@1->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/unroll-screenfill-while.asm b/src/test/ref/unroll-screenfill-while.asm index 3310ec53b..a1e8bfef1 100644 --- a/src/test/ref/unroll-screenfill-while.asm +++ b/src/test/ref/unroll-screenfill-while.asm @@ -1,7 +1,6 @@ .pc = $801 "Basic" :BasicUpstart(main) .pc = $80d "Program" - jsr main main: { .label SCREEN = $400 ldx #0 diff --git a/src/test/ref/unroll-screenfill-while.log b/src/test/ref/unroll-screenfill-while.log index 920c76a1c..8de45fc76 100644 --- a/src/test/ref/unroll-screenfill-while.log +++ b/src/test/ref/unroll-screenfill-while.log @@ -741,7 +741,7 @@ Allocated zp ZP_BYTE:2 [ main::x#5 main::x#1 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -980,7 +980,7 @@ Uplifting [] best 2723 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -1212,14 +1212,13 @@ Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination Replacing label b1 with b3 Replacing label b1_from_b4 with b3 -Removing instruction bbegin: Removing instruction b1_from_bbegin: +Removing instruction b1: Removing instruction main_from_b1: Removing instruction bend_from_b1: Removing instruction b1_from_b4: Removing instruction b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b1: Removing instruction bend: Removing instruction b1_from_main: Removing instruction b3_1: @@ -1249,8 +1248,13 @@ Removing instruction b3_24: Removing instruction b4: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Removing instruction jmp b3 Succesful ASM optimization Pass5NextJumpElimination +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @1 @@ -1296,7 +1300,7 @@ reg byte x [ main::x#5 main::x#1 ] FINAL ASSEMBLER -Score: 1847 +Score: 1841 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -1308,7 +1312,6 @@ Score: 1847 //SEG4 @1 //SEG5 [2] call main //SEG6 [4] phi from @1 to main [phi:@1->main] - jsr main //SEG7 [3] phi from @1 to @end [phi:@1->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/unused-method.asm b/src/test/ref/unused-method.asm index 2c86e02e5..105f81be5 100644 --- a/src/test/ref/unused-method.asm +++ b/src/test/ref/unused-method.asm @@ -1,7 +1,6 @@ .pc = $801 "Basic" :BasicUpstart(main) .pc = $80d "Program" - jsr main main: { .label screen = $400 lda #1 diff --git a/src/test/ref/unused-method.log b/src/test/ref/unused-method.log index 269087b0f..c3e892c5b 100644 --- a/src/test/ref/unused-method.log +++ b/src/test/ref/unused-method.log @@ -73,7 +73,7 @@ Complete equivalence classes INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -116,7 +116,7 @@ Uplifting [] best 27 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -151,14 +151,18 @@ Removing instruction jmp b2 Removing instruction jmp bend Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination -Removing instruction bbegin: Removing instruction b2_from_bbegin: +Removing instruction b2: Removing instruction bend_from_b2: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b2: Removing instruction bend: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @2 @@ -172,7 +176,7 @@ FINAL SYMBOL TABLE FINAL ASSEMBLER -Score: 18 +Score: 12 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -183,7 +187,6 @@ Score: 18 //SEG3 [1] phi from @begin to @2 [phi:@begin->@2] //SEG4 @2 //SEG5 [2] call main - jsr main //SEG6 [3] phi from @2 to @end [phi:@2->@end] //SEG7 @end //SEG8 main diff --git a/src/test/ref/unused-vars.asm b/src/test/ref/unused-vars.asm index acdab116b..d27d3c5fc 100644 --- a/src/test/ref/unused-vars.asm +++ b/src/test/ref/unused-vars.asm @@ -2,7 +2,6 @@ :BasicUpstart(main) .pc = $80d "Program" .label SCREEN = $400 - jsr main main: { .const col = 2 .label COLS = $d800 diff --git a/src/test/ref/unused-vars.log b/src/test/ref/unused-vars.log index e581d494a..bf59e1a7c 100644 --- a/src/test/ref/unused-vars.log +++ b/src/test/ref/unused-vars.log @@ -327,7 +327,7 @@ Allocated zp ZP_BYTE:2 [ main::i#2 main::i#1 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label SCREEN = $400 @@ -417,7 +417,7 @@ Uplifting [] best 375 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label SCREEN = $400 @@ -490,21 +490,25 @@ Removing instruction jmp breturn Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination Replacing label b1_from_b1 with b1 -Removing instruction bbegin: Removing instruction b2_from_bbegin: +Removing instruction b2: Removing instruction main_from_b2: Removing instruction bend_from_b2: Removing instruction b1_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b2: Removing instruction bend: Removing instruction s_from_main: Removing instruction b1_from_main: Removing instruction breturn: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Removing instruction jmp b1 Succesful ASM optimization Pass5NextJumpElimination +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @2 @@ -542,7 +546,7 @@ reg byte x [ main::i#2 main::i#1 ] FINAL ASSEMBLER -Score: 249 +Score: 243 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -555,7 +559,6 @@ Score: 249 //SEG4 @2 //SEG5 [2] call main //SEG6 [4] phi from @2 to main [phi:@2->main] - jsr main //SEG7 [3] phi from @2 to @end [phi:@2->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/unusedblockproblem.asm b/src/test/ref/unusedblockproblem.asm index 2eec3a2ca..fc0bdea06 100644 --- a/src/test/ref/unusedblockproblem.asm +++ b/src/test/ref/unusedblockproblem.asm @@ -1,7 +1,6 @@ .pc = $801 "Basic" :BasicUpstart(main) .pc = $80d "Program" - jsr main main: { .label SCREEN = $400 b2: diff --git a/src/test/ref/unusedblockproblem.log b/src/test/ref/unusedblockproblem.log index 45f65b2c1..d8394ba48 100644 --- a/src/test/ref/unusedblockproblem.log +++ b/src/test/ref/unusedblockproblem.log @@ -128,7 +128,7 @@ Complete equivalence classes INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -170,7 +170,7 @@ Uplifting [] best 132 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -205,14 +205,18 @@ Removing instruction jmp b1 Removing instruction jmp bend Removing instruction jmp b2 Succesful ASM optimization Pass5NextJumpElimination -Removing instruction bbegin: Removing instruction b1_from_bbegin: +Removing instruction b1: Removing instruction main_from_b1: Removing instruction bend_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b1: Removing instruction bend: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @1 @@ -227,7 +231,7 @@ FINAL SYMBOL TABLE FINAL ASSEMBLER -Score: 96 +Score: 90 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -239,7 +243,6 @@ Score: 96 //SEG4 @1 //SEG5 [2] call main //SEG6 [4] phi from @1 to main [phi:@1->main] - jsr main //SEG7 [3] phi from @1 to @end [phi:@1->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/useglobal.asm b/src/test/ref/useglobal.asm index d6ac1c173..eadb2ce4e 100644 --- a/src/test/ref/useglobal.asm +++ b/src/test/ref/useglobal.asm @@ -2,7 +2,6 @@ :BasicUpstart(main) .pc = $80d "Program" .label SCREEN = $400 - jsr main main: { lda #1 sta SCREEN diff --git a/src/test/ref/useglobal.log b/src/test/ref/useglobal.log index 56893196d..0465c50cd 100644 --- a/src/test/ref/useglobal.log +++ b/src/test/ref/useglobal.log @@ -78,7 +78,7 @@ Complete equivalence classes INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label SCREEN = $400 @@ -121,7 +121,7 @@ Uplifting [] best 27 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label SCREEN = $400 @@ -156,14 +156,18 @@ Removing instruction jmp b1 Removing instruction jmp bend Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination -Removing instruction bbegin: Removing instruction b1_from_bbegin: +Removing instruction b1: Removing instruction bend_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b1: Removing instruction bend: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @1 @@ -177,7 +181,7 @@ FINAL SYMBOL TABLE FINAL ASSEMBLER -Score: 18 +Score: 12 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -189,7 +193,6 @@ Score: 18 //SEG3 [1] phi from @begin to @1 [phi:@begin->@1] //SEG4 @1 //SEG5 [2] call main - jsr main //SEG6 [3] phi from @1 to @end [phi:@1->@end] //SEG7 @end //SEG8 main diff --git a/src/test/ref/var-forward-problem.asm b/src/test/ref/var-forward-problem.asm index 1c96447af..74ab41c70 100644 --- a/src/test/ref/var-forward-problem.asm +++ b/src/test/ref/var-forward-problem.asm @@ -3,7 +3,6 @@ .pc = $80d "Program" .label screen = $400 .const b = 'a' - jsr main main: { lda #b sta screen diff --git a/src/test/ref/var-forward-problem.log b/src/test/ref/var-forward-problem.log index 6366cc186..0a4ff17b4 100644 --- a/src/test/ref/var-forward-problem.log +++ b/src/test/ref/var-forward-problem.log @@ -77,7 +77,7 @@ Complete equivalence classes INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label screen = $400 @@ -121,7 +121,7 @@ Uplifting [] best 27 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label screen = $400 @@ -157,14 +157,18 @@ Removing instruction jmp b1 Removing instruction jmp bend Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination -Removing instruction bbegin: Removing instruction b1_from_bbegin: +Removing instruction b1: Removing instruction bend_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b1: Removing instruction bend: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @1 @@ -180,7 +184,7 @@ FINAL SYMBOL TABLE FINAL ASSEMBLER -Score: 18 +Score: 12 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -193,7 +197,6 @@ Score: 18 //SEG3 [1] phi from @begin to @1 [phi:@begin->@1] //SEG4 @1 //SEG5 [2] call main - jsr main //SEG6 [3] phi from @1 to @end [phi:@1->@end] //SEG7 @end //SEG8 main diff --git a/src/test/ref/var-register.asm b/src/test/ref/var-register.asm index 872d90e1e..d7cc57027 100644 --- a/src/test/ref/var-register.asm +++ b/src/test/ref/var-register.asm @@ -1,7 +1,6 @@ .pc = $801 "Basic" :BasicUpstart(main) .pc = $80d "Program" - jsr main main: { .label a = 2 ldy #0 diff --git a/src/test/ref/var-register.log b/src/test/ref/var-register.log index 62c3a47d8..b6f79c611 100644 --- a/src/test/ref/var-register.log +++ b/src/test/ref/var-register.log @@ -270,7 +270,7 @@ Allocated zp ZP_BYTE:4 [ print::val#0 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -413,7 +413,7 @@ Allocated (was zp ZP_BYTE:3) zp ZP_BYTE:2 [ main::a#2 main::a#1 ] ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -537,8 +537,8 @@ Succesful ASM optimization Pass5NextJumpElimination Replacing label b3_from_b7 with b3 Replacing label b2_from_b4 with b2 Replacing label b1_from_b5 with b1 -Removing instruction bbegin: Removing instruction b2_from_bbegin: +Removing instruction b2: Removing instruction main_from_b2: Removing instruction bend_from_b2: Removing instruction b1_from_b5: @@ -547,7 +547,6 @@ Removing instruction b2_from_b4: Removing instruction b3_from_b2: Removing instruction b3_from_b7: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b2: Removing instruction bend: Removing instruction b1_from_main: Removing instruction b7: @@ -556,10 +555,15 @@ Removing instruction b5: Removing instruction breturn: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Removing instruction jmp b1 Removing instruction jmp b2 Removing instruction jmp b3 Succesful ASM optimization Pass5NextJumpElimination +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @2 @@ -602,7 +606,7 @@ reg byte a [ print::val#0 ] FINAL ASSEMBLER -Score: 31458 +Score: 31452 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -614,7 +618,6 @@ Score: 31458 //SEG4 @2 //SEG5 [2] call main //SEG6 [4] phi from @2 to main [phi:@2->main] - jsr main //SEG7 [3] phi from @2 to @end [phi:@2->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/voronoi.asm b/src/test/ref/voronoi.asm index a59b4233c..3b4a9af3f 100644 --- a/src/test/ref/voronoi.asm +++ b/src/test/ref/voronoi.asm @@ -5,7 +5,6 @@ .label COLORS = $d800 .const FILL = $e6 .const numpoints = 6 - jsr main main: { jsr initscreen b1: diff --git a/src/test/ref/voronoi.log b/src/test/ref/voronoi.log index 6b5b524e0..578ebcd29 100644 --- a/src/test/ref/voronoi.log +++ b/src/test/ref/voronoi.log @@ -1200,7 +1200,7 @@ Allocated zp ZP_BYTE:27 [ findcol::$10 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label SCREEN = $400 @@ -1823,7 +1823,7 @@ Allocated (was zp ZP_BYTE:25) zp ZP_BYTE:9 [ findcol::yp#0 ] ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label SCREEN = $400 @@ -2321,8 +2321,8 @@ Replacing label b7_from_b6 with b7 Replacing label b5_from_b4 with b5 Replacing label b1_from_b1 with b1 Replacing label b1_from_b1 with b1 -Removing instruction bbegin: Removing instruction b5_from_bbegin: +Removing instruction b5: Removing instruction main_from_b5: Removing instruction bend_from_b5: Removing instruction b1_from_main: @@ -2340,7 +2340,6 @@ Removing instruction b8_from_b16: Removing instruction b8_from_b21: Removing instruction b1_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b5: Removing instruction bend: Removing instruction initscreen_from_main: Removing instruction b4: @@ -2366,6 +2365,9 @@ Removing instruction b1_from_b19: Removing instruction b1_from_initscreen: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Removing instruction jmp b1 Removing instruction jmp b2 Removing instruction jmp b1 @@ -2374,6 +2376,8 @@ Removing instruction lda XPOS+3 Removing instruction lda x Removing instruction lda y Succesful ASM optimization Pass5UnnecesaryLoadElimination +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @5 @@ -2510,7 +2514,7 @@ reg byte a [ findcol::$10 ] FINAL ASSEMBLER -Score: 1628777 +Score: 1628771 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -2526,7 +2530,6 @@ Score: 1628777 //SEG4 @5 //SEG5 [2] call main //SEG6 [4] phi from @5 to main [phi:@5->main] - jsr main //SEG7 [3] phi from @5 to @end [phi:@5->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/wordexpr.asm b/src/test/ref/wordexpr.asm index f43d9003e..d1a2cadd8 100644 --- a/src/test/ref/wordexpr.asm +++ b/src/test/ref/wordexpr.asm @@ -1,7 +1,6 @@ .pc = $801 "Basic" :BasicUpstart(main) .pc = $80d "Program" - jsr main main: { .label b = 2 ldx #0 diff --git a/src/test/ref/wordexpr.log b/src/test/ref/wordexpr.log index 82a1802db..082880d6b 100644 --- a/src/test/ref/wordexpr.log +++ b/src/test/ref/wordexpr.log @@ -128,7 +128,7 @@ Allocated zp ZP_BYTE:4 [ main::i#2 main::i#1 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -207,7 +207,7 @@ Uplifting [] best 473 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -276,19 +276,23 @@ Replacing instruction lda #<0 with TXA Removing instruction lda #>0 Succesful ASM optimization Pass5UnnecesaryLoadElimination Replacing label b1_from_b1 with b1 -Removing instruction bbegin: Removing instruction b1_from_bbegin: +Removing instruction b1: Removing instruction main_from_b1: Removing instruction bend_from_b1: Removing instruction b1_from_b1: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b1: Removing instruction bend: Removing instruction b1_from_main: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Removing instruction jmp b1 Succesful ASM optimization Pass5NextJumpElimination +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @1 @@ -309,7 +313,7 @@ reg byte x [ main::i#2 main::i#1 ] FINAL ASSEMBLER -Score: 357 +Score: 351 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -321,7 +325,6 @@ Score: 357 //SEG4 @1 //SEG5 [2] call main //SEG6 [4] phi from @1 to main [phi:@1->main] - jsr main //SEG7 [3] phi from @1 to @end [phi:@1->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/zpparammin.asm b/src/test/ref/zpparammin.asm index d1015ddad..7a03fddce 100644 --- a/src/test/ref/zpparammin.asm +++ b/src/test/ref/zpparammin.asm @@ -3,7 +3,6 @@ .pc = $80d "Program" .label SCREEN = $400 .label SCREEN2 = $400+$28 - jsr main main: { .label i = 2 lda #0 diff --git a/src/test/ref/zpparammin.log b/src/test/ref/zpparammin.log index 15e38d10b..6e589eb1c 100644 --- a/src/test/ref/zpparammin.log +++ b/src/test/ref/zpparammin.log @@ -363,7 +363,7 @@ Allocated zp ZP_BYTE:16 [ sum::return#1 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label SCREEN = $400 @@ -570,7 +570,7 @@ Uplifting [sum] best 1013 combination reg byte a [ sum::$0 ] ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels .label SCREEN = $400 @@ -709,13 +709,12 @@ Replacing instruction lda i with TYA Removing instruction ldy i Succesful ASM optimization Pass5UnnecesaryLoadElimination Replacing label b1_from_b4 with b1 -Removing instruction bbegin: Removing instruction b3_from_bbegin: +Removing instruction b3: Removing instruction main_from_b3: Removing instruction bend_from_b3: Removing instruction b1_from_b4: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b3: Removing instruction bend: Removing instruction b1_from_main: Removing instruction b3: @@ -724,8 +723,13 @@ Removing instruction breturn: Removing instruction breturn: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Removing instruction jmp b1 Succesful ASM optimization Pass5NextJumpElimination +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @3 @@ -788,7 +792,7 @@ reg byte a [ sum::return#1 ] FINAL ASSEMBLER -Score: 811 +Score: 805 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -802,7 +806,6 @@ Score: 811 //SEG4 @3 //SEG5 [2] call main //SEG6 [4] phi from @3 to main [phi:@3->main] - jsr main //SEG7 [3] phi from @3 to @end [phi:@3->@end] //SEG8 @end //SEG9 main diff --git a/src/test/ref/zpptr.asm b/src/test/ref/zpptr.asm index 09ef05a10..4cd4a843f 100644 --- a/src/test/ref/zpptr.asm +++ b/src/test/ref/zpptr.asm @@ -1,7 +1,6 @@ .pc = $801 "Basic" :BasicUpstart(main) .pc = $80d "Program" - jsr main main: { .label zpptr = $1000 .label zpptr2 = 4 diff --git a/src/test/ref/zpptr.log b/src/test/ref/zpptr.log index 5756459df..0da0a0d75 100644 --- a/src/test/ref/zpptr.log +++ b/src/test/ref/zpptr.log @@ -262,7 +262,7 @@ Allocated zp ZP_WORD:9 [ main::zpptr2#1 ] INITIAL ASM //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -421,7 +421,7 @@ Allocated (was zp ZP_WORD:7) zp ZP_WORD:6 [ main::w#0 ] ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart .pc = $801 "Basic" -:BasicUpstart(main) +:BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels //SEG2 @begin @@ -550,8 +550,8 @@ Succesful ASM optimization Pass5NextJumpElimination Replacing label b3_from_b3 with b3 Replacing label b2_from_b4 with b2 Replacing label b1_from_b5 with b1 -Removing instruction bbegin: Removing instruction b1_from_bbegin: +Removing instruction b1: Removing instruction main_from_b1: Removing instruction bend_from_b1: Removing instruction b1_from_b5: @@ -560,17 +560,21 @@ Removing instruction b2_from_b4: Removing instruction b3_from_b2: Removing instruction b3_from_b3: Succesful ASM optimization Pass5RedundantLabelElimination -Removing instruction b1: Removing instruction bend: Removing instruction b1_from_main: Removing instruction b4: Removing instruction b5: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin Removing instruction jmp b1 Removing instruction jmp b2 Removing instruction jmp b3 Succesful ASM optimization Pass5NextJumpElimination +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @1 @@ -608,7 +612,7 @@ zp ZP_WORD:6 [ main::w#0 ] FINAL ASSEMBLER -Score: 68437 +Score: 68431 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -620,7 +624,6 @@ Score: 68437 //SEG4 @1 //SEG5 [2] call main //SEG6 [4] phi from @1 to main [phi:@1->main] - jsr main //SEG7 [3] phi from @1 to @end [phi:@1->@end] //SEG8 @end //SEG9 main