diff --git a/src/main/java/dk/camelot64/kickc/passes/Pass3LiveRangesEffectiveAnalysis.java b/src/main/java/dk/camelot64/kickc/passes/Pass3LiveRangesEffectiveAnalysis.java index 0b4b2bba8..81ad08830 100644 --- a/src/main/java/dk/camelot64/kickc/passes/Pass3LiveRangesEffectiveAnalysis.java +++ b/src/main/java/dk/camelot64/kickc/passes/Pass3LiveRangesEffectiveAnalysis.java @@ -60,6 +60,17 @@ public class Pass3LiveRangesEffectiveAnalysis extends Pass2Base { LiveRangeVariablesEffective.CallPaths callPaths = procedureCallPaths.get(procedureRef); if(callPaths == null) { callPaths = new LiveRangeVariablesEffective.CallPaths(procedureRef); + + if(procedure.getInterruptType()!=null) { + // Interrupt is called outside procedure scope - create initial call-path. + ArrayList rootPath = new ArrayList<>(); + ArrayList rootAlive = new ArrayList<>(); + // Initialize with global cross-scope aliases (assumed empty) + Pass2AliasElimination.Aliases rootAliases = new Pass2AliasElimination.Aliases(); + LiveRangeVariablesEffective.CallPath rootCallPath = new LiveRangeVariablesEffective.CallPath(rootPath, rootAlive, rootAliases, rootAliases); + callPaths.add(rootCallPath); + } + Collection callers = getProgram().getCallGraph().getCallers(procedure.getLabel().getRef()); for(CallGraph.CallBlock.Call caller : callers) { diff --git a/src/main/java/dk/camelot64/kickc/passes/Pass4RegisterUpliftCombinations.java b/src/main/java/dk/camelot64/kickc/passes/Pass4RegisterUpliftCombinations.java index 7cbf9379a..e9752fe68 100644 --- a/src/main/java/dk/camelot64/kickc/passes/Pass4RegisterUpliftCombinations.java +++ b/src/main/java/dk/camelot64/kickc/passes/Pass4RegisterUpliftCombinations.java @@ -96,7 +96,7 @@ public class Pass4RegisterUpliftCombinations extends Pass2Base { new Pass4RegistersFinalize(program).allocate(false); // Apply the uplift combination combination.allocate(program); - // Check the register allocation for whether a is register being allocated to two variables with overlapping live ranges + // Check the register allocation for whether any register is being allocated to two variables with overlapping live ranges if(isAllocationOverlapping(program)) { if(program.getLog().isVerboseUplift()) { StringBuilder msg = new StringBuilder(); @@ -198,7 +198,6 @@ public class Pass4RegisterUpliftCombinations extends Pass2Base { * @return true if there is an overlapping register allocation */ private static boolean isStatementAllocationOverlapping(Program program, Statement statement) { - ProgramScope programScope = program.getScope(); LiveRangeVariablesEffective.AliveCombinations aliveCombinations = program.getLiveRangeVariablesEffective().getAliveCombinations(statement); for(LiveRangeVariablesEffective.CallPath callPath : aliveCombinations.getCallPaths().getCallPaths()) { LinkedHashMap usedRegisters = new LinkedHashMap<>(); diff --git a/src/test/java/dk/camelot64/kickc/test/TestPrograms.java b/src/test/java/dk/camelot64/kickc/test/TestPrograms.java index a47d4a43e..caaaccb80 100644 --- a/src/test/java/dk/camelot64/kickc/test/TestPrograms.java +++ b/src/test/java/dk/camelot64/kickc/test/TestPrograms.java @@ -44,6 +44,11 @@ public class TestPrograms { AsmFragmentTemplateUsages.logUsages(log, false, false, false, false, false, false); } + @Test + public void testClobberAProblem() throws IOException, URISyntaxException { + compileAndCompare("clobber-a-problem"); + } + @Test public void testInterruptVolatileReuseProblem2() throws IOException, URISyntaxException { compileAndCompare("interrupt-volatile-reuse-problem2"); diff --git a/src/test/kc/clobber-a-problem.kc b/src/test/kc/clobber-a-problem.kc new file mode 100644 index 000000000..407074098 --- /dev/null +++ b/src/test/kc/clobber-a-problem.kc @@ -0,0 +1,25 @@ + +byte* BORDERCOL = $d020; +byte* RASTER = $d012; +byte DARK_GREY = $b; +byte BLACK = 0; +const void()** KERNEL_IRQ = $0314; + + +void main() { + *KERNEL_IRQ = &irq; +} + +volatile byte irq_raster_next = 0; + +interrupt(hardware_clobber) void irq() { + *BORDERCOL = DARK_GREY; + irq_raster_next += 21; + // Setup next interrupt + byte raster_next = irq_raster_next; + if((raster_next&7)==0) { + raster_next -=1; + } + *RASTER = raster_next; + *BORDERCOL = BLACK; +} \ No newline at end of file diff --git a/src/test/kc/examples/tetris/test-sprites.kc b/src/test/kc/examples/tetris/test-sprites.kc index cc714ef5a..e5e5264da 100644 --- a/src/test/kc/examples/tetris/test-sprites.kc +++ b/src/test/kc/examples/tetris/test-sprites.kc @@ -34,12 +34,12 @@ void init_sprites() { } // The line of the first IRQ - 48 is 2 lines before the start of the screen -const byte IRQ_RASTER_FIRST = 48; +const byte IRQ_RASTER_FIRST = 49; // The raster line of the next IRQ volatile byte irq_raster_next = IRQ_RASTER_FIRST; // Y-pos of the sprites on the next IRQ volatile byte irq_sprite_ypos = 50; -// Y-pos of the sprites on the next IRQ +// Index of the sprites to show on the next IRQ volatile byte irq_sprite_ptr = toSpritePtr(PLAYFIELD_SPRITES); // Counting the 10 IRQs volatile byte irq_cnt = 0; @@ -47,6 +47,13 @@ volatile byte irq_cnt = 0; // Setup the IRQ void init_irq() { asm { sei } + // Acknowledge any IRQ and setup the next one + *IRQ_STATUS = IRQ_RASTER; + asm { lda CIA1_INTERRUPT } + + // Disable kernal & basic + *PROCPORT_DDR = PROCPORT_DDR_MEMORY_MASK; + *PROCPORT = PROCPORT_RAM_IO; // Disable CIA 1 Timer IRQ *CIA1_INTERRUPT = CIA_INTERRUPT_CLEAR; // Set raster line @@ -55,17 +62,16 @@ void init_irq() { // Enable Raster Interrupt *IRQ_ENABLE = IRQ_RASTER; // Set the IRQ routine - *KERNEL_IRQ = &irq; + *HARDWARE_IRQ = &irq; asm { cli } } // Raster Interrupt Routine - sets up the sprites covering the playfield // Repeats 10 timers every 21 lines from line IRQ_RASTER_FIRST -interrupt(kernel_min) void irq() { +interrupt(hardware_clobber) void irq() { *BORDERCOL = DARK_GREY; - // Place the sprites SPRITES_YPOS[0] = irq_sprite_ypos; SPRITES_YPOS[2] = irq_sprite_ypos; @@ -88,15 +94,19 @@ interrupt(kernel_min) void irq() { irq_raster_next = IRQ_RASTER_FIRST; irq_sprite_ypos = 50; irq_sprite_ptr = toSpritePtr(PLAYFIELD_SPRITES); - } else { irq_raster_next += 21; irq_sprite_ypos += 21; irq_sprite_ptr += 3; } + // Setup next interrupt + byte raster_next = irq_raster_next; + if((raster_next&7)==3) { + raster_next -=1; + } + *RASTER = raster_next; // Acknowledge the IRQ and setup the next one - *RASTER = irq_raster_next; *IRQ_STATUS = IRQ_RASTER; *BORDERCOL = BLACK; diff --git a/src/test/ref/clobber-a-problem.asm b/src/test/ref/clobber-a-problem.asm new file mode 100644 index 000000000..ff96ee398 --- /dev/null +++ b/src/test/ref/clobber-a-problem.asm @@ -0,0 +1,45 @@ +.pc = $801 "Basic" +:BasicUpstart(bbegin) +.pc = $80d "Program" + .label BORDERCOL = $d020 + .label RASTER = $d012 + .const DARK_GREY = $b + .const BLACK = 0 + .label KERNEL_IRQ = $314 + .label irq_raster_next = 2 +bbegin: + lda #0 + sta irq_raster_next + jsr main +main: { + lda #irq + sta KERNEL_IRQ+1 + rts +} +irq: { + sta rega+1 + stx regx+1 + lda #DARK_GREY + sta BORDERCOL + lda #$15 + clc + adc irq_raster_next + sta irq_raster_next + tax + txa + and #7 + cmp #0 + bne b1 + dex + b1: + stx RASTER + lda #BLACK + sta BORDERCOL + rega: + lda #00 + regx: + ldx #00 + rti +} diff --git a/src/test/ref/clobber-a-problem.cfg b/src/test/ref/clobber-a-problem.cfg new file mode 100644 index 000000000..fe5bfd77d --- /dev/null +++ b/src/test/ref/clobber-a-problem.cfg @@ -0,0 +1,36 @@ +@begin: scope:[] from + [0] phi() + to:@1 +@1: scope:[] from @begin + [1] (byte) irq_raster_next#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 + to:@2 +@2: scope:[] from @1 + [2] phi() + [3] call main + to:@end +@end: scope:[] from @2 + [4] phi() +main: scope:[main] from @2 + [5] *((const void()**) KERNEL_IRQ#0) ← &interrupt(HARDWARE_CLOBBER)(void()) irq() + to:main::@return +main::@return: scope:[main] from main + [6] return + to:@return +irq: scope:[irq] from + [7] *((const byte*) BORDERCOL#0) ← (const byte) DARK_GREY#0 + [8] (byte) irq_raster_next#1 ← (byte) irq_raster_next#0 + (byte/signed byte/word/signed word/dword/signed dword) 21 + [9] (byte) irq::raster_next#0 ← (byte) irq_raster_next#1 + [10] (byte~) irq::$0 ← (byte) irq::raster_next#0 & (byte/signed byte/word/signed word/dword/signed dword) 7 + [11] if((byte~) irq::$0!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto irq::@1 + to:irq::@2 +irq::@2: scope:[irq] from irq + [12] (byte) irq::raster_next#1 ← (byte) irq::raster_next#0 - (byte/signed byte/word/signed word/dword/signed dword) 1 + to:irq::@1 +irq::@1: scope:[irq] from irq irq::@2 + [13] (byte) irq::raster_next#2 ← phi( irq/(byte) irq::raster_next#0 irq::@2/(byte) irq::raster_next#1 ) + [14] *((const byte*) RASTER#0) ← (byte) irq::raster_next#2 + [15] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 + to:irq::@return +irq::@return: scope:[irq] from irq::@1 + [16] return + to:@return diff --git a/src/test/ref/clobber-a-problem.log b/src/test/ref/clobber-a-problem.log new file mode 100644 index 000000000..2871ac171 --- /dev/null +++ b/src/test/ref/clobber-a-problem.log @@ -0,0 +1,632 @@ +Resolved forward reference irq to interrupt(HARDWARE_CLOBBER)(void()) irq() + +CONTROL FLOW GRAPH SSA +@begin: scope:[] from + (byte*) BORDERCOL#0 ← ((byte*)) (word/dword/signed dword) 53280 + (byte*) RASTER#0 ← ((byte*)) (word/dword/signed dword) 53266 + (byte) DARK_GREY#0 ← (byte/signed byte/word/signed word/dword/signed dword) 11 + (byte) BLACK#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 + (void()**) KERNEL_IRQ#0 ← ((void()**)) (word/signed word/dword/signed dword) 788 + to:@1 +main: scope:[main] from @2 + (void()*~) main::$0 ← & interrupt(HARDWARE_CLOBBER)(void()) irq() + *((void()**) KERNEL_IRQ#0) ← (void()*~) main::$0 + to:main::@return +main::@return: scope:[main] from main + return + to:@return +@1: scope:[] from @begin + (byte) BLACK#5 ← phi( @begin/(byte) BLACK#0 ) + (byte*) RASTER#5 ← phi( @begin/(byte*) RASTER#0 ) + (byte*) BORDERCOL#5 ← phi( @begin/(byte*) BORDERCOL#0 ) + (byte) DARK_GREY#3 ← phi( @begin/(byte) DARK_GREY#0 ) + (byte) irq_raster_next#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 + to:@2 +irq: scope:[irq] from + (byte) BLACK#2 ← phi( @2/(byte) BLACK#4 ) + (byte*) RASTER#2 ← phi( @2/(byte*) RASTER#4 ) + (byte) irq_raster_next#3 ← phi( @2/(byte) irq_raster_next#5 ) + (byte*) BORDERCOL#1 ← phi( @2/(byte*) BORDERCOL#3 ) + (byte) DARK_GREY#1 ← phi( @2/(byte) DARK_GREY#2 ) + *((byte*) BORDERCOL#1) ← (byte) DARK_GREY#1 + (byte) irq_raster_next#1 ← (byte) irq_raster_next#3 + (byte/signed byte/word/signed word/dword/signed dword) 21 + (byte) irq::raster_next#0 ← (byte) irq_raster_next#1 + (byte~) irq::$0 ← (byte) irq::raster_next#0 & (byte/signed byte/word/signed word/dword/signed dword) 7 + (bool~) irq::$1 ← (byte~) irq::$0 == (byte/signed byte/word/signed word/dword/signed dword) 0 + (bool~) irq::$2 ← ! (bool~) irq::$1 + if((bool~) irq::$2) goto irq::@1 + to:irq::@2 +irq::@1: scope:[irq] from irq irq::@2 + (byte) irq_raster_next#6 ← phi( irq/(byte) irq_raster_next#1 irq::@2/(byte) irq_raster_next#7 ) + (byte*) BORDERCOL#2 ← phi( irq/(byte*) BORDERCOL#1 irq::@2/(byte*) BORDERCOL#4 ) + (byte) BLACK#1 ← phi( irq/(byte) BLACK#2 irq::@2/(byte) BLACK#3 ) + (byte*) RASTER#1 ← phi( irq/(byte*) RASTER#2 irq::@2/(byte*) RASTER#3 ) + (byte) irq::raster_next#2 ← phi( irq/(byte) irq::raster_next#0 irq::@2/(byte) irq::raster_next#1 ) + *((byte*) RASTER#1) ← (byte) irq::raster_next#2 + *((byte*) BORDERCOL#2) ← (byte) BLACK#1 + to:irq::@return +irq::@2: scope:[irq] from irq + (byte) irq_raster_next#7 ← phi( irq/(byte) irq_raster_next#1 ) + (byte*) BORDERCOL#4 ← phi( irq/(byte*) BORDERCOL#1 ) + (byte) BLACK#3 ← phi( irq/(byte) BLACK#2 ) + (byte*) RASTER#3 ← phi( irq/(byte*) RASTER#2 ) + (byte) irq::raster_next#3 ← phi( irq/(byte) irq::raster_next#0 ) + (byte) irq::raster_next#1 ← (byte) irq::raster_next#3 - (byte/signed byte/word/signed word/dword/signed dword) 1 + to:irq::@1 +irq::@return: scope:[irq] from irq::@1 + (byte) irq_raster_next#4 ← phi( irq::@1/(byte) irq_raster_next#6 ) + (byte) irq_raster_next#2 ← (byte) irq_raster_next#4 + return + to:@return +@2: scope:[] from @1 + (byte) BLACK#4 ← phi( @1/(byte) BLACK#5 ) + (byte*) RASTER#4 ← phi( @1/(byte*) RASTER#5 ) + (byte) irq_raster_next#5 ← phi( @1/(byte) irq_raster_next#0 ) + (byte*) BORDERCOL#3 ← phi( @1/(byte*) BORDERCOL#5 ) + (byte) DARK_GREY#2 ← phi( @1/(byte) DARK_GREY#3 ) + call main + to:@3 +@3: scope:[] from @2 + to:@end +@end: scope:[] from @3 + +SYMBOL TABLE SSA +(label) @1 +(label) @2 +(label) @3 +(label) @begin +(label) @end +(byte) BLACK +(byte) BLACK#0 +(byte) BLACK#1 +(byte) BLACK#2 +(byte) BLACK#3 +(byte) BLACK#4 +(byte) BLACK#5 +(byte*) BORDERCOL +(byte*) BORDERCOL#0 +(byte*) BORDERCOL#1 +(byte*) BORDERCOL#2 +(byte*) BORDERCOL#3 +(byte*) BORDERCOL#4 +(byte*) BORDERCOL#5 +(byte) DARK_GREY +(byte) DARK_GREY#0 +(byte) DARK_GREY#1 +(byte) DARK_GREY#2 +(byte) DARK_GREY#3 +(void()**) KERNEL_IRQ +(void()**) KERNEL_IRQ#0 +(byte*) RASTER +(byte*) RASTER#0 +(byte*) RASTER#1 +(byte*) RASTER#2 +(byte*) RASTER#3 +(byte*) RASTER#4 +(byte*) RASTER#5 +interrupt(HARDWARE_CLOBBER)(void()) irq() +(byte~) irq::$0 +(bool~) irq::$1 +(bool~) irq::$2 +(label) irq::@1 +(label) irq::@2 +(label) irq::@return +(byte) irq::raster_next +(byte) irq::raster_next#0 +(byte) irq::raster_next#1 +(byte) irq::raster_next#2 +(byte) irq::raster_next#3 +(byte) irq_raster_next +(byte) irq_raster_next#0 +(byte) irq_raster_next#1 +(byte) irq_raster_next#2 +(byte) irq_raster_next#3 +(byte) irq_raster_next#4 +(byte) irq_raster_next#5 +(byte) irq_raster_next#6 +(byte) irq_raster_next#7 +(void()) main() +(void()*~) main::$0 +(label) main::@return + +Culled Empty Block (label) @3 +Successful SSA optimization Pass2CullEmptyBlocks +Inversing boolean not (bool~) irq::$2 ← (byte~) irq::$0 != (byte/signed byte/word/signed word/dword/signed dword) 0 from (bool~) irq::$1 ← (byte~) irq::$0 == (byte/signed byte/word/signed word/dword/signed dword) 0 +Successful SSA optimization Pass2UnaryNotSimplification +Alias (byte) DARK_GREY#0 = (byte) DARK_GREY#3 (byte) DARK_GREY#2 +Alias (byte*) BORDERCOL#0 = (byte*) BORDERCOL#5 (byte*) BORDERCOL#3 +Alias (byte*) RASTER#0 = (byte*) RASTER#5 (byte*) RASTER#4 +Alias (byte) BLACK#0 = (byte) BLACK#5 (byte) BLACK#4 +Alias (byte) irq::raster_next#0 = (byte) irq::raster_next#3 +Alias (byte*) RASTER#2 = (byte*) RASTER#3 +Alias (byte) BLACK#2 = (byte) BLACK#3 +Alias (byte*) BORDERCOL#1 = (byte*) BORDERCOL#4 +Alias (byte) irq_raster_next#1 = (byte) irq_raster_next#7 +Alias (byte) irq_raster_next#2 = (byte) irq_raster_next#4 (byte) irq_raster_next#6 +Alias (byte) irq_raster_next#0 = (byte) irq_raster_next#5 +Successful SSA optimization Pass2AliasElimination +Alias (byte*) RASTER#1 = (byte*) RASTER#2 +Alias (byte) BLACK#1 = (byte) BLACK#2 +Alias (byte*) BORDERCOL#1 = (byte*) BORDERCOL#2 +Alias (byte) irq_raster_next#1 = (byte) irq_raster_next#2 +Successful SSA optimization Pass2AliasElimination +Redundant Phi (byte) DARK_GREY#1 (byte) DARK_GREY#0 +Redundant Phi (byte*) BORDERCOL#1 (byte*) BORDERCOL#0 +Redundant Phi (byte) irq_raster_next#3 (byte) irq_raster_next#0 +Redundant Phi (byte*) RASTER#1 (byte*) RASTER#0 +Redundant Phi (byte) BLACK#1 (byte) BLACK#0 +Successful SSA optimization Pass2RedundantPhiElimination +Simple Condition (bool~) irq::$2 if((byte~) irq::$0!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto irq::@1 +Successful SSA optimization Pass2ConditionalJumpSimplification +Constant (const byte*) BORDERCOL#0 = ((byte*))53280 +Constant (const byte*) RASTER#0 = ((byte*))53266 +Constant (const byte) DARK_GREY#0 = 11 +Constant (const byte) BLACK#0 = 0 +Constant (const void()**) KERNEL_IRQ#0 = ((void()**))788 +Constant (const void()*) main::$0 = &irq +Successful SSA optimization Pass2ConstantIdentification +Constant inlined main::$0 = &interrupt(HARDWARE_CLOBBER)(void()) irq() +Successful SSA optimization Pass2ConstantInlining +Added new block during phi lifting irq::@3(between irq and irq::@1) +Adding NOP phi() at start of @begin +Adding NOP phi() at start of @2 +Adding NOP phi() at start of @end +CALL GRAPH +Calls in [] to main:3 + +Created 1 initial phi equivalence classes +Coalesced [13] irq::raster_next#5 ← irq::raster_next#1 +Coalesced [18] irq::raster_next#4 ← irq::raster_next#0 +Coalesced down to 1 phi equivalence classes +Culled Empty Block (label) irq::@3 +Adding NOP phi() at start of @begin +Adding NOP phi() at start of @2 +Adding NOP phi() at start of @end + +FINAL CONTROL FLOW GRAPH +@begin: scope:[] from + [0] phi() + to:@1 +@1: scope:[] from @begin + [1] (byte) irq_raster_next#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 + to:@2 +@2: scope:[] from @1 + [2] phi() + [3] call main + to:@end +@end: scope:[] from @2 + [4] phi() +main: scope:[main] from @2 + [5] *((const void()**) KERNEL_IRQ#0) ← &interrupt(HARDWARE_CLOBBER)(void()) irq() + to:main::@return +main::@return: scope:[main] from main + [6] return + to:@return +irq: scope:[irq] from + [7] *((const byte*) BORDERCOL#0) ← (const byte) DARK_GREY#0 + [8] (byte) irq_raster_next#1 ← (byte) irq_raster_next#0 + (byte/signed byte/word/signed word/dword/signed dword) 21 + [9] (byte) irq::raster_next#0 ← (byte) irq_raster_next#1 + [10] (byte~) irq::$0 ← (byte) irq::raster_next#0 & (byte/signed byte/word/signed word/dword/signed dword) 7 + [11] if((byte~) irq::$0!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto irq::@1 + to:irq::@2 +irq::@2: scope:[irq] from irq + [12] (byte) irq::raster_next#1 ← (byte) irq::raster_next#0 - (byte/signed byte/word/signed word/dword/signed dword) 1 + to:irq::@1 +irq::@1: scope:[irq] from irq irq::@2 + [13] (byte) irq::raster_next#2 ← phi( irq/(byte) irq::raster_next#0 irq::@2/(byte) irq::raster_next#1 ) + [14] *((const byte*) RASTER#0) ← (byte) irq::raster_next#2 + [15] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 + to:irq::@return +irq::@return: scope:[irq] from irq::@1 + [16] return + to:@return + + +VARIABLE REGISTER WEIGHTS +(byte) BLACK +(byte*) BORDERCOL +(byte) DARK_GREY +(void()**) KERNEL_IRQ +(byte*) RASTER +interrupt(HARDWARE_CLOBBER)(void()) irq() +(byte~) irq::$0 4.0 +(byte) irq::raster_next +(byte) irq::raster_next#0 2.6666666666666665 +(byte) irq::raster_next#1 4.0 +(byte) irq::raster_next#2 6.0 +(byte) irq_raster_next +(byte) irq_raster_next#0 4.0 +(byte) irq_raster_next#1 4.0 +(void()) main() + +Initial phi equivalence classes +[ irq::raster_next#2 irq::raster_next#0 irq::raster_next#1 ] +Added variable irq_raster_next#0 to zero page equivalence class [ irq_raster_next#0 ] +Added variable irq_raster_next#1 to zero page equivalence class [ irq_raster_next#1 ] +Added variable irq::$0 to zero page equivalence class [ irq::$0 ] +Complete equivalence classes +[ irq::raster_next#2 irq::raster_next#0 irq::raster_next#1 ] +[ irq_raster_next#0 ] +[ irq_raster_next#1 ] +[ irq::$0 ] +Allocated zp ZP_BYTE:2 [ irq::raster_next#2 irq::raster_next#0 irq::raster_next#1 ] +Allocated zp ZP_BYTE:3 [ irq_raster_next#0 ] +Allocated zp ZP_BYTE:4 [ irq_raster_next#1 ] +Allocated zp ZP_BYTE:5 [ irq::$0 ] + +INITIAL ASM +//SEG0 Basic Upstart +.pc = $801 "Basic" +:BasicUpstart(bbegin) +.pc = $80d "Program" +//SEG1 Global Constants & labels + .label BORDERCOL = $d020 + .label RASTER = $d012 + .const DARK_GREY = $b + .const BLACK = 0 + .label KERNEL_IRQ = $314 + .label irq_raster_next = 3 + .label irq_raster_next_1 = 4 +//SEG2 @begin +bbegin: + jmp b1 +//SEG3 @1 +b1: +//SEG4 [1] (byte) irq_raster_next#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1 + lda #0 + sta irq_raster_next +//SEG5 [2] phi from @1 to @2 [phi:@1->@2] +b2_from_b1: + jmp b2 +//SEG6 @2 +b2: +//SEG7 [3] call main + jsr main +//SEG8 [4] phi from @2 to @end [phi:@2->@end] +bend_from_b2: + jmp bend +//SEG9 @end +bend: +//SEG10 main +main: { + //SEG11 [5] *((const void()**) KERNEL_IRQ#0) ← &interrupt(HARDWARE_CLOBBER)(void()) irq() -- _deref_pptc1=pprc2 + lda #irq + sta KERNEL_IRQ+1 + jmp breturn + //SEG12 main::@return + breturn: + //SEG13 [6] return + rts +} +//SEG14 irq +irq: { + .label _0 = 5 + .label raster_next = 2 + //SEG15 entry interrupt(HARDWARE_CLOBBER) + sta rega+1 + stx regx+1 + sty regy+1 + //SEG16 [7] *((const byte*) BORDERCOL#0) ← (const byte) DARK_GREY#0 -- _deref_pbuc1=vbuc2 + lda #DARK_GREY + sta BORDERCOL + //SEG17 [8] (byte) irq_raster_next#1 ← (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_1 + //SEG18 [9] (byte) irq::raster_next#0 ← (byte) irq_raster_next#1 -- vbuz1=vbuz2 + lda irq_raster_next_1 + sta raster_next + //SEG19 [10] (byte~) irq::$0 ← (byte) irq::raster_next#0 & (byte/signed byte/word/signed word/dword/signed dword) 7 -- vbuz1=vbuz2_band_vbuc1 + lda #7 + and raster_next + sta _0 + //SEG20 [11] if((byte~) irq::$0!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto irq::@1 -- vbuz1_neq_0_then_la1 + lda _0 + cmp #0 + bne b1_from_irq + jmp b2 + //SEG21 irq::@2 + b2: + //SEG22 [12] (byte) irq::raster_next#1 ← (byte) irq::raster_next#0 - (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz1_minus_1 + dec raster_next + //SEG23 [13] phi from irq irq::@2 to irq::@1 [phi:irq/irq::@2->irq::@1] + b1_from_irq: + b1_from_b2: + //SEG24 [13] phi (byte) irq::raster_next#2 = (byte) irq::raster_next#0 [phi:irq/irq::@2->irq::@1#0] -- register_copy + jmp b1 + //SEG25 irq::@1 + b1: + //SEG26 [14] *((const byte*) RASTER#0) ← (byte) irq::raster_next#2 -- _deref_pbuc1=vbuz1 + lda raster_next + sta RASTER + //SEG27 [15] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 -- _deref_pbuc1=vbuc2 + lda #BLACK + sta BORDERCOL + jmp breturn + //SEG28 irq::@return + breturn: + //SEG29 [16] return - exit interrupt(HARDWARE_CLOBBER) + rega: + lda #00 + regx: + ldx #00 + regy: + ldy #00 + rti +} + +REGISTER UPLIFT POTENTIAL REGISTERS +Statement [1] (byte) irq_raster_next#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( ) always clobbers reg byte a +Statement [5] *((const void()**) KERNEL_IRQ#0) ← &interrupt(HARDWARE_CLOBBER)(void()) irq() [ ] ( main:3 [ ] ) always clobbers reg byte a +Statement [7] *((const byte*) BORDERCOL#0) ← (const byte) DARK_GREY#0 [ irq_raster_next#0 ] ( [ irq_raster_next#0 ] ) always clobbers reg byte a +Statement [8] (byte) irq_raster_next#1 ← (byte) irq_raster_next#0 + (byte/signed byte/word/signed word/dword/signed dword) 21 [ irq_raster_next#1 ] ( [ irq_raster_next#1 ] ) always clobbers reg byte a +Statement [10] (byte~) irq::$0 ← (byte) irq::raster_next#0 & (byte/signed byte/word/signed word/dword/signed dword) 7 [ irq::raster_next#0 irq::$0 ] ( [ irq::raster_next#0 irq::$0 ] ) always clobbers reg byte a +Removing always clobbered register reg byte a as potential for zp ZP_BYTE:2 [ irq::raster_next#2 irq::raster_next#0 irq::raster_next#1 ] +Statement [15] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 [ ] ( [ ] ) always clobbers reg byte a +Statement [16] return [ ] ( [ ] ) always clobbers reg byte a reg byte x reg byte y +Statement [1] (byte) irq_raster_next#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( ) always clobbers reg byte a +Statement [5] *((const void()**) KERNEL_IRQ#0) ← &interrupt(HARDWARE_CLOBBER)(void()) irq() [ ] ( main:3 [ ] ) always clobbers reg byte a +Statement [7] *((const byte*) BORDERCOL#0) ← (const byte) DARK_GREY#0 [ irq_raster_next#0 ] ( [ irq_raster_next#0 ] ) always clobbers reg byte a +Statement [8] (byte) irq_raster_next#1 ← (byte) irq_raster_next#0 + (byte/signed byte/word/signed word/dword/signed dword) 21 [ irq_raster_next#1 ] ( [ irq_raster_next#1 ] ) always clobbers reg byte a +Statement [10] (byte~) irq::$0 ← (byte) irq::raster_next#0 & (byte/signed byte/word/signed word/dword/signed dword) 7 [ irq::raster_next#0 irq::$0 ] ( [ irq::raster_next#0 irq::$0 ] ) always clobbers reg byte a +Statement [15] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 [ ] ( [ ] ) always clobbers reg byte a +Statement [16] return [ ] ( [ ] ) always clobbers reg byte a reg byte x reg byte y +Potential registers zp ZP_BYTE:2 [ irq::raster_next#2 irq::raster_next#0 irq::raster_next#1 ] : zp ZP_BYTE:2 , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:3 [ irq_raster_next#0 ] : zp ZP_BYTE:3 , +Potential registers zp ZP_BYTE:4 [ irq_raster_next#1 ] : zp ZP_BYTE:4 , +Potential registers zp ZP_BYTE:5 [ irq::$0 ] : zp ZP_BYTE:5 , reg byte a , reg byte x , reg byte y , + +REGISTER UPLIFT SCOPES +Uplift Scope [irq] 12.67: zp ZP_BYTE:2 [ irq::raster_next#2 irq::raster_next#0 irq::raster_next#1 ] 4: zp ZP_BYTE:5 [ irq::$0 ] +Uplift Scope [] 4: zp ZP_BYTE:3 [ irq_raster_next#0 ] 4: zp ZP_BYTE:4 [ irq_raster_next#1 ] +Uplift Scope [main] + +Uplifting [irq] best 248 combination reg byte x [ irq::raster_next#2 irq::raster_next#0 irq::raster_next#1 ] reg byte a [ irq::$0 ] +Uplifting [] best 248 combination zp ZP_BYTE:3 [ irq_raster_next#0 ] zp ZP_BYTE:4 [ irq_raster_next#1 ] +Uplifting [main] best 248 combination +Attempting to uplift remaining variables inzp ZP_BYTE:3 [ irq_raster_next#0 ] +Uplifting [] best 248 combination zp ZP_BYTE:3 [ irq_raster_next#0 ] +Attempting to uplift remaining variables inzp ZP_BYTE:4 [ irq_raster_next#1 ] +Uplifting [] best 248 combination zp ZP_BYTE:4 [ irq_raster_next#1 ] +Coalescing zero page register with common assignment [ zp ZP_BYTE:3 [ irq_raster_next#0 ] ] with [ zp ZP_BYTE:4 [ irq_raster_next#1 ] ] - score: 1 +Allocated (was zp ZP_BYTE:3) zp ZP_BYTE:2 [ irq_raster_next#0 irq_raster_next#1 ] +Interrupt procedure irq clobbers AXCNZV +Removing interrupt register storage sty regy+1 in SEG15 entry interrupt(HARDWARE_CLOBBER) +Removing interrupt register storage regy: in SEG29 [16] return - exit interrupt(HARDWARE_CLOBBER) +Removing interrupt register storage ldy #00 in SEG29 [16] return - exit interrupt(HARDWARE_CLOBBER) + +ASSEMBLER BEFORE OPTIMIZATION +//SEG0 Basic Upstart +.pc = $801 "Basic" +:BasicUpstart(bbegin) +.pc = $80d "Program" +//SEG1 Global Constants & labels + .label BORDERCOL = $d020 + .label RASTER = $d012 + .const DARK_GREY = $b + .const BLACK = 0 + .label KERNEL_IRQ = $314 + .label irq_raster_next = 2 +//SEG2 @begin +bbegin: + jmp b1 +//SEG3 @1 +b1: +//SEG4 [1] (byte) irq_raster_next#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1 + lda #0 + sta irq_raster_next +//SEG5 [2] phi from @1 to @2 [phi:@1->@2] +b2_from_b1: + jmp b2 +//SEG6 @2 +b2: +//SEG7 [3] call main + jsr main +//SEG8 [4] phi from @2 to @end [phi:@2->@end] +bend_from_b2: + jmp bend +//SEG9 @end +bend: +//SEG10 main +main: { + //SEG11 [5] *((const void()**) KERNEL_IRQ#0) ← &interrupt(HARDWARE_CLOBBER)(void()) irq() -- _deref_pptc1=pprc2 + lda #irq + sta KERNEL_IRQ+1 + jmp breturn + //SEG12 main::@return + breturn: + //SEG13 [6] return + rts +} +//SEG14 irq +irq: { + //SEG15 entry interrupt(HARDWARE_CLOBBER) + sta rega+1 + stx regx+1 + //SEG16 [7] *((const byte*) BORDERCOL#0) ← (const byte) DARK_GREY#0 -- _deref_pbuc1=vbuc2 + lda #DARK_GREY + sta BORDERCOL + //SEG17 [8] (byte) irq_raster_next#1 ← (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 + //SEG18 [9] (byte) irq::raster_next#0 ← (byte) irq_raster_next#1 -- vbuxx=vbuz1 + ldx irq_raster_next + //SEG19 [10] (byte~) irq::$0 ← (byte) irq::raster_next#0 & (byte/signed byte/word/signed word/dword/signed dword) 7 -- vbuaa=vbuxx_band_vbuc1 + txa + and #7 + //SEG20 [11] if((byte~) irq::$0!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto irq::@1 -- vbuaa_neq_0_then_la1 + cmp #0 + bne b1_from_irq + jmp b2 + //SEG21 irq::@2 + b2: + //SEG22 [12] (byte) irq::raster_next#1 ← (byte) irq::raster_next#0 - (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuxx=vbuxx_minus_1 + dex + //SEG23 [13] phi from irq irq::@2 to irq::@1 [phi:irq/irq::@2->irq::@1] + b1_from_irq: + b1_from_b2: + //SEG24 [13] phi (byte) irq::raster_next#2 = (byte) irq::raster_next#0 [phi:irq/irq::@2->irq::@1#0] -- register_copy + jmp b1 + //SEG25 irq::@1 + b1: + //SEG26 [14] *((const byte*) RASTER#0) ← (byte) irq::raster_next#2 -- _deref_pbuc1=vbuxx + stx RASTER + //SEG27 [15] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 -- _deref_pbuc1=vbuc2 + lda #BLACK + sta BORDERCOL + jmp breturn + //SEG28 irq::@return + breturn: + //SEG29 [16] return - exit interrupt(HARDWARE_CLOBBER) + rega: + lda #00 + regx: + ldx #00 + rti +} + +ASSEMBLER OPTIMIZATIONS +Removing instruction jmp b1 +Removing instruction jmp b2 +Removing instruction jmp bend +Removing instruction jmp breturn +Removing instruction jmp b2 +Removing instruction jmp b1 +Removing instruction jmp breturn +Succesful ASM optimization Pass5NextJumpElimination +Replacing instruction ldx irq_raster_next with TAX +Replacing label b1_from_irq with b1 +Removing instruction b1: +Removing instruction b2_from_b1: +Removing instruction bend_from_b2: +Removing instruction b1_from_irq: +Removing instruction b1_from_b2: +Removing instruction breturn: +Succesful ASM optimization Pass5RedundantLabelElimination +Removing instruction b2: +Removing instruction bend: +Removing instruction breturn: +Removing instruction b2: +Succesful ASM optimization Pass5UnusedLabelElimination + +FINAL SYMBOL TABLE +(label) @1 +(label) @2 +(label) @begin +(label) @end +(byte) BLACK +(const byte) BLACK#0 BLACK = (byte/signed byte/word/signed word/dword/signed dword) 0 +(byte*) BORDERCOL +(const byte*) BORDERCOL#0 BORDERCOL = ((byte*))(word/dword/signed dword) 53280 +(byte) DARK_GREY +(const byte) DARK_GREY#0 DARK_GREY = (byte/signed byte/word/signed word/dword/signed dword) 11 +(void()**) KERNEL_IRQ +(const void()**) KERNEL_IRQ#0 KERNEL_IRQ = ((void()**))(word/signed word/dword/signed dword) 788 +(byte*) RASTER +(const byte*) RASTER#0 RASTER = ((byte*))(word/dword/signed dword) 53266 +interrupt(HARDWARE_CLOBBER)(void()) irq() +(byte~) irq::$0 reg byte a 4.0 +(label) irq::@1 +(label) irq::@2 +(label) irq::@return +(byte) irq::raster_next +(byte) irq::raster_next#0 reg byte x 2.6666666666666665 +(byte) irq::raster_next#1 reg byte x 4.0 +(byte) irq::raster_next#2 reg byte x 6.0 +(byte) irq_raster_next +(byte) irq_raster_next#0 irq_raster_next zp ZP_BYTE:2 4.0 +(byte) irq_raster_next#1 irq_raster_next zp ZP_BYTE:2 4.0 +(void()) main() +(label) main::@return + +reg byte x [ irq::raster_next#2 irq::raster_next#0 irq::raster_next#1 ] +zp ZP_BYTE:2 [ irq_raster_next#0 irq_raster_next#1 ] +reg byte a [ irq::$0 ] + + +FINAL ASSEMBLER +Score: 157 + +//SEG0 Basic Upstart +.pc = $801 "Basic" +:BasicUpstart(bbegin) +.pc = $80d "Program" +//SEG1 Global Constants & labels + .label BORDERCOL = $d020 + .label RASTER = $d012 + .const DARK_GREY = $b + .const BLACK = 0 + .label KERNEL_IRQ = $314 + .label irq_raster_next = 2 +//SEG2 @begin +bbegin: +//SEG3 @1 +//SEG4 [1] (byte) irq_raster_next#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1 + lda #0 + sta irq_raster_next +//SEG5 [2] phi from @1 to @2 [phi:@1->@2] +//SEG6 @2 +//SEG7 [3] call main + jsr main +//SEG8 [4] phi from @2 to @end [phi:@2->@end] +//SEG9 @end +//SEG10 main +main: { + //SEG11 [5] *((const void()**) KERNEL_IRQ#0) ← &interrupt(HARDWARE_CLOBBER)(void()) irq() -- _deref_pptc1=pprc2 + lda #irq + sta KERNEL_IRQ+1 + //SEG12 main::@return + //SEG13 [6] return + rts +} +//SEG14 irq +irq: { + //SEG15 entry interrupt(HARDWARE_CLOBBER) + sta rega+1 + stx regx+1 + //SEG16 [7] *((const byte*) BORDERCOL#0) ← (const byte) DARK_GREY#0 -- _deref_pbuc1=vbuc2 + lda #DARK_GREY + sta BORDERCOL + //SEG17 [8] (byte) irq_raster_next#1 ← (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 + //SEG18 [9] (byte) irq::raster_next#0 ← (byte) irq_raster_next#1 -- vbuxx=vbuz1 + tax + //SEG19 [10] (byte~) irq::$0 ← (byte) irq::raster_next#0 & (byte/signed byte/word/signed word/dword/signed dword) 7 -- vbuaa=vbuxx_band_vbuc1 + txa + and #7 + //SEG20 [11] if((byte~) irq::$0!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto irq::@1 -- vbuaa_neq_0_then_la1 + cmp #0 + bne b1 + //SEG21 irq::@2 + //SEG22 [12] (byte) irq::raster_next#1 ← (byte) irq::raster_next#0 - (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuxx=vbuxx_minus_1 + dex + //SEG23 [13] phi from irq irq::@2 to irq::@1 [phi:irq/irq::@2->irq::@1] + //SEG24 [13] phi (byte) irq::raster_next#2 = (byte) irq::raster_next#0 [phi:irq/irq::@2->irq::@1#0] -- register_copy + //SEG25 irq::@1 + b1: + //SEG26 [14] *((const byte*) RASTER#0) ← (byte) irq::raster_next#2 -- _deref_pbuc1=vbuxx + stx RASTER + //SEG27 [15] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 -- _deref_pbuc1=vbuc2 + lda #BLACK + sta BORDERCOL + //SEG28 irq::@return + //SEG29 [16] return - exit interrupt(HARDWARE_CLOBBER) + rega: + lda #00 + regx: + ldx #00 + rti +} + diff --git a/src/test/ref/clobber-a-problem.prg b/src/test/ref/clobber-a-problem.prg new file mode 100644 index 000000000..68dfac930 Binary files /dev/null and b/src/test/ref/clobber-a-problem.prg differ diff --git a/src/test/ref/clobber-a-problem.sym b/src/test/ref/clobber-a-problem.sym new file mode 100644 index 000000000..bfc7c4ec4 --- /dev/null +++ b/src/test/ref/clobber-a-problem.sym @@ -0,0 +1,32 @@ +(label) @1 +(label) @2 +(label) @begin +(label) @end +(byte) BLACK +(const byte) BLACK#0 BLACK = (byte/signed byte/word/signed word/dword/signed dword) 0 +(byte*) BORDERCOL +(const byte*) BORDERCOL#0 BORDERCOL = ((byte*))(word/dword/signed dword) 53280 +(byte) DARK_GREY +(const byte) DARK_GREY#0 DARK_GREY = (byte/signed byte/word/signed word/dword/signed dword) 11 +(void()**) KERNEL_IRQ +(const void()**) KERNEL_IRQ#0 KERNEL_IRQ = ((void()**))(word/signed word/dword/signed dword) 788 +(byte*) RASTER +(const byte*) RASTER#0 RASTER = ((byte*))(word/dword/signed dword) 53266 +interrupt(HARDWARE_CLOBBER)(void()) irq() +(byte~) irq::$0 reg byte a 4.0 +(label) irq::@1 +(label) irq::@2 +(label) irq::@return +(byte) irq::raster_next +(byte) irq::raster_next#0 reg byte x 2.6666666666666665 +(byte) irq::raster_next#1 reg byte x 4.0 +(byte) irq::raster_next#2 reg byte x 6.0 +(byte) irq_raster_next +(byte) irq_raster_next#0 irq_raster_next zp ZP_BYTE:2 4.0 +(byte) irq_raster_next#1 irq_raster_next zp ZP_BYTE:2 4.0 +(void()) main() +(label) main::@return + +reg byte x [ irq::raster_next#2 irq::raster_next#0 irq::raster_next#1 ] +zp ZP_BYTE:2 [ irq_raster_next#0 irq_raster_next#1 ] +reg byte a [ irq::$0 ] diff --git a/src/test/ref/clobber-a-problem.vs b/src/test/ref/clobber-a-problem.vs new file mode 100644 index 000000000..228a4cdfe --- /dev/null +++ b/src/test/ref/clobber-a-problem.vs @@ -0,0 +1,11 @@ +al C:314 .KERNEL_IRQ +al C:844 .regx +al C:d012 .RASTER +al C:d020 .BORDERCOL +al C:80d .bbegin +al C:842 .rega +al C:81f .irq +al C:80b .upstartEnd +al C:814 .main +al C:2 .irq_raster_next +al C:83a .b1 diff --git a/src/test/ref/examples/tetris/test-sprites.asm b/src/test/ref/examples/tetris/test-sprites.asm index 0456f04c3..f4575b442 100644 --- a/src/test/ref/examples/tetris/test-sprites.asm +++ b/src/test/ref/examples/tetris/test-sprites.asm @@ -1,6 +1,10 @@ .pc = $801 "Basic" :BasicUpstart(bbegin) .pc = $80d "Program" + .label PROCPORT_DDR = 0 + .const PROCPORT_DDR_MEMORY_MASK = 7 + .label PROCPORT = 1 + .const PROCPORT_RAM_IO = $35 .const SPRITE_PTRS = $3f8 .label SPRITES_XPOS = $d000 .label SPRITES_YPOS = $d001 @@ -20,13 +24,13 @@ .const CIA_INTERRUPT_CLEAR = $7f .label CIA2_PORT_A = $dd00 .label CIA2_PORT_A_DDR = $dd02 - .label KERNEL_IRQ = $314 + .label HARDWARE_IRQ = $fffe .const BLACK = 0 .const DARK_GREY = $b .label PLAYFIELD_SPRITES = $2000 .label PLAYFIELD_CHARSET = $1000 .label PLAYFIELD_SCREEN = $400 - .const IRQ_RASTER_FIRST = $30 + .const IRQ_RASTER_FIRST = $31 .label PLAYFIELD_SPRITE_PTRS = PLAYFIELD_SCREEN+SPRITE_PTRS .const toSpritePtr1_return = PLAYFIELD_SPRITES>>6 .label irq_raster_next = 3 @@ -52,6 +56,13 @@ main: { } init_irq: { sei + lda #IRQ_RASTER + sta IRQ_STATUS + lda CIA1_INTERRUPT + lda #PROCPORT_DDR_MEMORY_MASK + sta PROCPORT_DDR + lda #PROCPORT_RAM_IO + sta PROCPORT lda #CIA_INTERRUPT_CLEAR sta CIA1_INTERRUPT lda VIC_CONTROL @@ -62,9 +73,9 @@ init_irq: { lda #IRQ_RASTER sta IRQ_ENABLE lda #irq - sta KERNEL_IRQ+1 + sta HARDWARE_IRQ+1 cli rts } @@ -106,6 +117,8 @@ init_sprites: { } irq: { .const toSpritePtr2_return = PLAYFIELD_SPRITES>>6 + sta rega+1 + stx regx+1 lda #DARK_GREY sta BORDERCOL lda irq_sprite_ypos @@ -120,8 +133,9 @@ irq: { lda RASTER cmp irq_sprite_ypos bne b1 - ldx irq_sprite_ptr - stx PLAYFIELD_SPRITE_PTRS + lda irq_sprite_ptr + sta PLAYFIELD_SPRITE_PTRS + tax inx stx PLAYFIELD_SPRITE_PTRS+1 stx PLAYFIELD_SPRITE_PTRS+2 @@ -144,13 +158,23 @@ irq: { adc irq_sprite_ptr sta irq_sprite_ptr b3: - lda irq_raster_next - sta RASTER + ldx irq_raster_next + txa + and #7 + cmp #3 + bne b4 + dex + b4: + stx RASTER lda #IRQ_RASTER sta IRQ_STATUS lda #BLACK sta BORDERCOL - jmp $ea81 + rega: + lda #00 + regx: + ldx #00 + rti b2: lda #0 sta irq_cnt diff --git a/src/test/ref/examples/tetris/test-sprites.cfg b/src/test/ref/examples/tetris/test-sprites.cfg index bb20da2ca..9d23b4832 100644 --- a/src/test/ref/examples/tetris/test-sprites.cfg +++ b/src/test/ref/examples/tetris/test-sprites.cfg @@ -42,94 +42,107 @@ main::@2: scope:[main] from main::@2 main::@7 to:main::@2 init_irq: scope:[init_irq] from main::@7 asm { sei } - [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() + [15] *((const byte*) IRQ_STATUS#0) ← (const byte) IRQ_RASTER#0 + asm { ldaCIA1_INTERRUPT } + [17] *((const byte*) PROCPORT_DDR#0) ← (const byte) PROCPORT_DDR_MEMORY_MASK#0 + [18] *((const byte*) PROCPORT#0) ← (const byte) PROCPORT_RAM_IO#0 + [19] *((const byte*) CIA1_INTERRUPT#0) ← (const byte) CIA_INTERRUPT_CLEAR#0 + [20] *((const byte*) VIC_CONTROL#0) ← *((const byte*) VIC_CONTROL#0) & (byte/signed byte/word/signed word/dword/signed dword) 127 + [21] *((const byte*) RASTER#0) ← (const byte) IRQ_RASTER_FIRST#0 + [22] *((const byte*) IRQ_ENABLE#0) ← (const byte) IRQ_RASTER#0 + [23] *((const void()**) HARDWARE_IRQ#0) ← &interrupt(HARDWARE_CLOBBER)(void()) irq() asm { cli } to:init_irq::@return init_irq::@return: scope:[init_irq] from init_irq - [21] return + [25] return to:@return init_sprites: scope:[init_sprites] from main - [22] phi() + [26] phi() to:init_sprites::vicSelectGfxBank1 init_sprites::vicSelectGfxBank1: scope:[init_sprites] from init_sprites - [23] *((const byte*) CIA2_PORT_A_DDR#0) ← (byte/signed byte/word/signed word/dword/signed dword) 3 + [27] *((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 - [24] phi() + [28] phi() to:init_sprites::vicSelectGfxBank1_@1 init_sprites::vicSelectGfxBank1_@1: scope:[init_sprites] from init_sprites::vicSelectGfxBank1_toDd001 - [25] *((const byte*) CIA2_PORT_A#0) ← (const byte) init_sprites::vicSelectGfxBank1_toDd001_return#0 + [29] *((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 - [26] phi() + [30] phi() to:init_sprites::@4 init_sprites::@4: scope:[init_sprites] from init_sprites::toD0181 - [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) + [31] *((const byte*) D018#0) ← (const byte) init_sprites::toD0181_return#0 + [32] *((const byte*) SPRITES_ENABLE#0) ← (byte/signed byte/word/signed word/dword/signed dword) 15 + [33] *((const byte*) SPRITES_MC#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 + [34] *((const byte*) SPRITES_EXPAND_Y#0) ← *((const byte*) SPRITES_MC#0) + [35] *((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 - [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 + [36] (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 ) + [36] (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 ) + [37] (byte) init_sprites::s2#0 ← (byte) init_sprites::s#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 + [38] *((const byte*) SPRITES_XPOS#0 + (byte) init_sprites::s2#0) ← (byte) init_sprites::xpos#2 + [39] *((const byte*) SPRITES_COLS#0 + (byte) init_sprites::s#2) ← (const byte) BLACK#0 + [40] (byte) init_sprites::xpos#1 ← (byte) init_sprites::xpos#2 + (byte/signed byte/word/signed word/dword/signed dword) 24 + [41] (byte) init_sprites::s#1 ← ++ (byte) init_sprites::s#2 + [42] 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 - [39] return + [43] return to:@return irq: scope:[irq] from - [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 + [44] *((const byte*) BORDERCOL#0) ← (const byte) DARK_GREY#0 + [45] *((const byte*) SPRITES_YPOS#0) ← (byte) irq_sprite_ypos#0 + [46] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte) irq_sprite_ypos#0 + [47] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 4) ← (byte) irq_sprite_ypos#0 + [48] *((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 - [45] if(*((const byte*) RASTER#0)!=(byte) irq_sprite_ypos#0) goto irq::@1 - to:irq::@4 -irq::@4: scope:[irq] from irq::@1 - [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 + [49] if(*((const byte*) RASTER#0)!=(byte) irq_sprite_ypos#0) goto irq::@1 to:irq::@5 -irq::@5: scope:[irq] from irq::@4 - [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 +irq::@5: scope:[irq] from irq::@1 + [50] (byte) irq::ptr#0 ← (byte) irq_sprite_ptr#0 + [51] *((const byte*) PLAYFIELD_SPRITE_PTRS#0) ← (byte) irq::ptr#0 + [52] (byte) irq::ptr#1 ← ++ (byte) irq::ptr#0 + [53] *((const byte*) PLAYFIELD_SPRITE_PTRS#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte) irq::ptr#1 + [54] *((const byte*) PLAYFIELD_SPRITE_PTRS#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte) irq::ptr#1 + [55] (byte) irq::ptr#2 ← ++ (byte) irq::ptr#1 + [56] *((const byte*) PLAYFIELD_SPRITE_PTRS#0+(byte/signed byte/word/signed word/dword/signed dword) 3) ← (byte) irq::ptr#2 + [57] (byte) irq_cnt#1 ← ++ (byte) irq_cnt#0 + [58] if((byte) irq_cnt#1==(byte/signed byte/word/signed word/dword/signed dword) 10) goto irq::@2 + to:irq::@6 +irq::@6: scope:[irq] from irq::@5 + [59] (byte) irq_raster_next#2 ← (byte) irq_raster_next#0 + (byte/signed byte/word/signed word/dword/signed dword) 21 + [60] (byte) irq_sprite_ypos#2 ← (byte) irq_sprite_ypos#0 + (byte/signed byte/word/signed word/dword/signed dword) 21 + [61] (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 - [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 +irq::@3: scope:[irq] from irq::@6 irq::@9 + [62] (byte) irq_raster_next#12 ← phi( irq::@6/(byte) irq_raster_next#2 irq::@9/(byte) irq_raster_next#1 ) + [63] (byte) irq::raster_next#0 ← (byte) irq_raster_next#12 + [64] (byte~) irq::$3 ← (byte) irq::raster_next#0 & (byte/signed byte/word/signed word/dword/signed dword) 7 + [65] if((byte~) irq::$3!=(byte/signed byte/word/signed word/dword/signed dword) 3) goto irq::@4 + to:irq::@8 +irq::@8: scope:[irq] from irq::@3 + [66] (byte) irq::raster_next#1 ← (byte) irq::raster_next#0 - (byte/signed byte/word/signed word/dword/signed dword) 1 + to:irq::@4 +irq::@4: scope:[irq] from irq::@3 irq::@8 + [67] (byte) irq::raster_next#2 ← phi( irq::@3/(byte) irq::raster_next#0 irq::@8/(byte) irq::raster_next#1 ) + [68] *((const byte*) RASTER#0) ← (byte) irq::raster_next#2 + [69] *((const byte*) IRQ_STATUS#0) ← (const byte) IRQ_RASTER#0 + [70] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 to:irq::@return -irq::@return: scope:[irq] from irq::@3 - [62] return +irq::@return: scope:[irq] from irq::@4 + [71] return to:@return -irq::@2: scope:[irq] from irq::@4 - [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 +irq::@2: scope:[irq] from irq::@5 + [72] (byte) irq_cnt#13 ← (byte/signed byte/word/signed word/dword/signed dword) 0 + [73] (byte) irq_raster_next#1 ← (const byte) IRQ_RASTER_FIRST#0 + [74] (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 - [66] phi() - to:irq::@7 -irq::@7: scope:[irq] from irq::toSpritePtr2 - [67] (byte) irq_sprite_ptr#1 ← (const byte) irq::toSpritePtr2_return#0 + [75] phi() + to:irq::@9 +irq::@9: scope:[irq] from irq::toSpritePtr2 + [76] (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 f7ae86c1f..cc9a3faf8 100644 --- a/src/test/ref/examples/tetris/test-sprites.log +++ b/src/test/ref/examples/tetris/test-sprites.log @@ -1,4 +1,4 @@ -Resolved forward reference irq to interrupt(KERNEL_MIN)(void()) irq() +Resolved forward reference irq to interrupt(HARDWARE_CLOBBER)(void()) irq() Inlined call (byte~) vicSelectGfxBank::$0 ← call toDd00 (byte*) vicSelectGfxBank::gfx Inlined call call vicSelectGfxBank (byte*) PLAYFIELD_SCREEN Inlined call (byte~) init_sprites::$1 ← call toD018 (byte*) PLAYFIELD_SCREEN (byte*) PLAYFIELD_CHARSET @@ -188,14 +188,14 @@ init_sprites::@return: scope:[init_sprites] from init_sprites::@1 return to:@return @6: scope:[] from @4 - (byte) IRQ_RASTER_FIRST#0 ← (byte/signed byte/word/signed word/dword/signed dword) 48 + (byte) IRQ_RASTER_FIRST#0 ← (byte/signed byte/word/signed word/dword/signed dword) 49 (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#16 ← phi( @6/(byte) irq_raster_next#0 ) - (byte) irq_sprite_ypos#15 ← phi( @6/(byte) irq_sprite_ypos#0 ) + (byte) irq_raster_next#18 ← phi( @6/(byte) irq_raster_next#0 ) + (byte) irq_sprite_ypos#16 ← 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 @@ -203,14 +203,14 @@ toSpritePtr1: scope:[] from @6 (byte) toSpritePtr1_return#0 ← (byte) toSpritePtr1_$2#0 to:toSpritePtr1_@return toSpritePtr1_@return: scope:[] from toSpritePtr1 - (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) irq_raster_next#17 ← phi( toSpritePtr1/(byte) irq_raster_next#18 ) + (byte) irq_sprite_ypos#14 ← phi( toSpritePtr1/(byte) irq_sprite_ypos#16 ) (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#14 ← phi( toSpritePtr1_@return/(byte) irq_raster_next#15 ) - (byte) irq_sprite_ypos#12 ← phi( toSpritePtr1_@return/(byte) irq_sprite_ypos#13 ) + (byte) irq_raster_next#16 ← phi( toSpritePtr1_@return/(byte) irq_raster_next#17 ) + (byte) irq_sprite_ypos#13 ← phi( toSpritePtr1_@return/(byte) irq_sprite_ypos#14 ) (byte) toSpritePtr1_return#3 ← phi( toSpritePtr1_@return/(byte) toSpritePtr1_return#1 ) (byte~) $1 ← (byte) toSpritePtr1_return#3 (byte) irq_sprite_ptr#0 ← (byte~) $1 @@ -218,21 +218,25 @@ toSpritePtr1_@return: scope:[] from toSpritePtr1 to:@8 init_irq: scope:[init_irq] from main::@7 asm { sei } + *((byte*) IRQ_STATUS#0) ← (byte) IRQ_RASTER#0 + asm { ldaCIA1_INTERRUPT } + *((byte*) PROCPORT_DDR#0) ← (byte) PROCPORT_DDR_MEMORY_MASK#0 + *((byte*) PROCPORT#0) ← (byte) PROCPORT_RAM_IO#0 *((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::$0 ← & interrupt(KERNEL_MIN)(void()) irq() - *((void()**) KERNEL_IRQ#0) ← (void()*~) init_irq::$0 + (void()*~) init_irq::$0 ← & interrupt(HARDWARE_CLOBBER)(void()) irq() + *((void()**) HARDWARE_IRQ#0) ← (void()*~) init_irq::$0 asm { cli } to:init_irq::@return init_irq::@return: scope:[init_irq] from init_irq return to:@return irq: scope:[irq] from - (byte) irq_raster_next#11 ← phi( @8/(byte) irq_raster_next#13 ) + (byte) irq_raster_next#13 ← phi( @8/(byte) irq_raster_next#15 ) (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_ptr#9 ← phi( @8/(byte) irq_sprite_ptr#12 ) (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#4 @@ -241,16 +245,16 @@ irq: scope:[irq] from *((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#9 ← phi( irq/(byte) irq_raster_next#11 irq::@1/(byte) irq_raster_next#9 ) + (byte) irq_raster_next#10 ← phi( irq/(byte) irq_raster_next#13 irq::@1/(byte) irq_raster_next#10 ) (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 + to:irq::@5 +irq::@5: scope:[irq] from irq::@1 (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_raster_next#7 ← phi( irq::@1/(byte) irq_raster_next#10 ) (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 @@ -263,17 +267,17 @@ irq::@4: scope:[irq] from irq::@1 (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 + to:irq::@6 +irq::@2: scope:[irq] from irq::@5 (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#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_sprite_ypos#18 ← phi( irq::@2/(byte) irq_sprite_ypos#1 ) + (byte) irq_cnt#15 ← phi( irq::@2/(byte) irq_cnt#2 ) + (byte) irq_raster_next#14 ← 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 @@ -281,43 +285,63 @@ 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#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_sprite_ypos#17 ← phi( irq::toSpritePtr2/(byte) irq_sprite_ypos#18 ) + (byte) irq_cnt#14 ← phi( irq::toSpritePtr2/(byte) irq_cnt#15 ) + (byte) irq_raster_next#11 ← phi( irq::toSpritePtr2/(byte) irq_raster_next#14 ) (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#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 ) + to:irq::@9 +irq::@9: scope:[irq] from irq::toSpritePtr2_@return + (byte) irq_sprite_ypos#15 ← phi( irq::toSpritePtr2_@return/(byte) irq_sprite_ypos#17 ) + (byte) irq_cnt#13 ← phi( irq::toSpritePtr2_@return/(byte) irq_cnt#14 ) + (byte) irq_raster_next#8 ← phi( irq::toSpritePtr2_@return/(byte) irq_raster_next#11 ) (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#1 ← (byte~) irq::$2 to:irq::@3 -irq::@5: scope:[irq] from irq::@4 - (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 ) +irq::@6: scope:[irq] from irq::@5 + (byte) irq_cnt#12 ← phi( irq::@5/(byte) irq_cnt#1 ) + (byte) irq_sprite_ptr#5 ← phi( irq::@5/(byte) irq_sprite_ptr#4 ) + (byte) irq_sprite_ypos#6 ← phi( irq::@5/(byte) irq_sprite_ypos#9 ) + (byte) irq_raster_next#4 ← phi( irq::@5/(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#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 +irq::@3: scope:[irq] from irq::@6 irq::@9 + (byte) irq_sprite_ptr#10 ← phi( irq::@6/(byte) irq_sprite_ptr#2 irq::@9/(byte) irq_sprite_ptr#1 ) + (byte) irq_sprite_ypos#11 ← phi( irq::@6/(byte) irq_sprite_ypos#2 irq::@9/(byte) irq_sprite_ypos#15 ) + (byte) irq_cnt#9 ← phi( irq::@6/(byte) irq_cnt#12 irq::@9/(byte) irq_cnt#13 ) + (byte) irq_raster_next#5 ← phi( irq::@6/(byte) irq_raster_next#2 irq::@9/(byte) irq_raster_next#8 ) + (byte) irq::raster_next#0 ← (byte) irq_raster_next#5 + (byte~) irq::$3 ← (byte) irq::raster_next#0 & (byte/signed byte/word/signed word/dword/signed dword) 7 + (bool~) irq::$4 ← (byte~) irq::$3 == (byte/signed byte/word/signed word/dword/signed dword) 3 + (bool~) irq::$5 ← ! (bool~) irq::$4 + if((bool~) irq::$5) goto irq::@4 + to:irq::@8 +irq::@4: scope:[irq] from irq::@3 irq::@8 + (byte) irq_sprite_ptr#8 ← phi( irq::@3/(byte) irq_sprite_ptr#10 irq::@8/(byte) irq_sprite_ptr#11 ) + (byte) irq_sprite_ypos#10 ← phi( irq::@3/(byte) irq_sprite_ypos#11 irq::@8/(byte) irq_sprite_ypos#12 ) + (byte) irq_raster_next#9 ← phi( irq::@3/(byte) irq_raster_next#5 irq::@8/(byte) irq_raster_next#12 ) + (byte) irq_cnt#7 ← phi( irq::@3/(byte) irq_cnt#9 irq::@8/(byte) irq_cnt#10 ) + (byte) irq::raster_next#2 ← phi( irq::@3/(byte) irq::raster_next#0 irq::@8/(byte) irq::raster_next#1 ) + *((byte*) RASTER#0) ← (byte) irq::raster_next#2 *((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#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 ) +irq::@8: scope:[irq] from irq::@3 + (byte) irq_sprite_ptr#11 ← phi( irq::@3/(byte) irq_sprite_ptr#10 ) + (byte) irq_sprite_ypos#12 ← phi( irq::@3/(byte) irq_sprite_ypos#11 ) + (byte) irq_raster_next#12 ← phi( irq::@3/(byte) irq_raster_next#5 ) + (byte) irq_cnt#10 ← phi( irq::@3/(byte) irq_cnt#9 ) + (byte) irq::raster_next#3 ← phi( irq::@3/(byte) irq::raster_next#0 ) + (byte) irq::raster_next#1 ← (byte) irq::raster_next#3 - (byte/signed byte/word/signed word/dword/signed dword) 1 + to:irq::@4 +irq::@return: scope:[irq] from irq::@4 + (byte) irq_sprite_ptr#6 ← phi( irq::@4/(byte) irq_sprite_ptr#8 ) + (byte) irq_sprite_ypos#7 ← phi( irq::@4/(byte) irq_sprite_ypos#10 ) + (byte) irq_raster_next#6 ← phi( irq::@4/(byte) irq_raster_next#9 ) + (byte) irq_cnt#5 ← phi( irq::@4/(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 @@ -325,10 +349,10 @@ irq::@return: scope:[irq] from irq::@3 return to:@return @8: scope:[] from @9 - (byte) irq_raster_next#13 ← phi( @9/(byte) irq_raster_next#14 ) + (byte) irq_raster_next#15 ← phi( @9/(byte) irq_raster_next#16 ) (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 ) + (byte) irq_sprite_ptr#12 ← phi( @9/(byte) irq_sprite_ptr#0 ) + (byte) irq_sprite_ypos#8 ← phi( @9/(byte) irq_sprite_ypos#13 ) 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++) { @@ -605,21 +629,31 @@ SYMBOL TABLE SSA (byte) init_sprites::xpos#0 (byte) init_sprites::xpos#1 (byte) init_sprites::xpos#2 -interrupt(KERNEL_MIN)(void()) irq() +interrupt(HARDWARE_CLOBBER)(void()) irq() (bool~) irq::$0 (bool~) irq::$1 (byte~) irq::$2 +(byte~) irq::$3 +(bool~) irq::$4 +(bool~) irq::$5 (label) irq::@1 (label) irq::@2 (label) irq::@3 (label) irq::@4 (label) irq::@5 -(label) irq::@7 +(label) irq::@6 +(label) irq::@8 +(label) irq::@9 (label) irq::@return (byte) irq::ptr (byte) irq::ptr#0 (byte) irq::ptr#1 (byte) irq::ptr#2 +(byte) irq::raster_next +(byte) irq::raster_next#0 +(byte) irq::raster_next#1 +(byte) irq::raster_next#2 +(byte) irq::raster_next#3 (label) irq::toSpritePtr2 (word~) irq::toSpritePtr2_$0 (word) irq::toSpritePtr2_$0#0 @@ -643,6 +677,8 @@ 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#2 (byte) irq_cnt#3 (byte) irq_cnt#4 @@ -661,6 +697,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#2 (byte) irq_raster_next#3 (byte) irq_raster_next#4 @@ -673,6 +711,8 @@ 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#2 (byte) irq_sprite_ptr#3 (byte) irq_sprite_ptr#4 @@ -691,6 +731,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#2 (byte) irq_sprite_ypos#3 (byte) irq_sprite_ypos#4 @@ -725,8 +767,10 @@ interrupt(KERNEL_MIN)(void()) irq() 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 +Inversing boolean not (bool~) irq::$5 ← (byte~) irq::$3 != (byte/signed byte/word/signed word/dword/signed dword) 3 from (bool~) irq::$4 ← (byte~) irq::$3 == (byte/signed byte/word/signed word/dword/signed dword) 3 +Successful SSA optimization Pass2UnaryNotSimplification +Alias candidate removed (volatile)(byte) IRQ_RASTER_FIRST#0 = (byte) irq_raster_next#0 (byte) irq_raster_next#18 (byte) irq_raster_next#17 (byte) irq_raster_next#16 (byte) irq_raster_next#15 +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#12 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*) 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 @@ -738,51 +782,65 @@ 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#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_ypos#0 = (byte) irq_sprite_ypos#16 (byte) irq_sprite_ypos#14 (byte) irq_sprite_ypos#13 (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_raster_next#10 = (byte) irq_raster_next#7 (byte) irq_raster_next#4 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#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_raster_next#1 = (byte) irq_raster_next#14 (byte) irq_raster_next#11 (byte) irq_raster_next#8 +Alias (byte) irq_cnt#13 = (byte) irq_cnt#15 (byte) irq_cnt#2 (byte) irq_cnt#14 +Alias (byte) irq_sprite_ypos#1 = (byte) irq_sprite_ypos#18 (byte) irq_sprite_ypos#17 (byte) irq_sprite_ypos#15 +Alias (byte) irq_cnt#1 = (byte) irq_cnt#12 +Alias (byte) irq::raster_next#0 = (byte) irq::raster_next#3 +Alias (byte) irq_cnt#10 = (byte) irq_cnt#9 +Alias (byte) irq_raster_next#12 = (byte) irq_raster_next#5 +Alias (byte) irq_sprite_ypos#11 = (byte) irq_sprite_ypos#12 +Alias (byte) irq_sprite_ptr#10 = (byte) irq_sprite_ptr#11 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_raster_next#3 = (byte) irq_raster_next#6 (byte) irq_raster_next#9 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#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_RASTER_FIRST#0 = (byte) irq_raster_next#0 (byte) irq_raster_next#18 (byte) irq_raster_next#17 (byte) irq_raster_next#16 (byte) irq_raster_next#15 +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#12 +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) irq_cnt#10 = (byte) irq_cnt#3 +Alias (byte) irq_raster_next#12 = (byte) irq_raster_next#3 +Alias (byte) irq_sprite_ypos#10 = (byte) irq_sprite_ypos#11 +Alias (byte) irq_sprite_ptr#10 = (byte) irq_sprite_ptr#3 +Successful SSA optimization Pass2AliasElimination +Alias candidate removed (volatile)(byte) IRQ_RASTER_FIRST#0 = (byte) irq_raster_next#0 (byte) irq_raster_next#18 (byte) irq_raster_next#17 (byte) irq_raster_next#16 (byte) irq_raster_next#15 +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#12 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 +Self Phi Eliminated (byte) irq_raster_next#10 Successful SSA optimization Pass2SelfPhiElimination -Redundant Phi (byte) irq_raster_next#16 (byte) irq_raster_next#0 +Redundant Phi (byte) irq_raster_next#18 (byte) irq_raster_next#0 Redundant Phi (byte) toSpritePtr1_return#2 (byte) toSpritePtr1_return#0 -Redundant Phi (byte) irq_raster_next#15 (byte) irq_raster_next#16 +Redundant Phi (byte) irq_raster_next#17 (byte) irq_raster_next#18 Redundant Phi (byte) toSpritePtr1_return#3 (byte) toSpritePtr1_return#1 -Redundant Phi (byte) irq_raster_next#14 (byte) irq_raster_next#15 +Redundant Phi (byte) irq_raster_next#16 (byte) irq_raster_next#17 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_sprite_ptr#9 (byte) irq_sprite_ptr#12 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_raster_next#13 (byte) irq_raster_next#15 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_raster_next#10 (byte) irq_raster_next#13 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_sprite_ptr#10 (byte) irq_sprite_ptr#0 -Redundant Phi (byte) irq_raster_next#13 (byte) irq_raster_next#14 +Redundant Phi (byte) irq_sprite_ptr#12 (byte) irq_sprite_ptr#0 +Redundant Phi (byte) irq_raster_next#15 (byte) irq_raster_next#16 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#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 +Simple Condition (bool~) irq::$5 if((byte~) irq::$3!=(byte/signed byte/word/signed word/dword/signed dword) 3) goto irq::@4 Successful SSA optimization Pass2ConditionalJumpSimplification Constant (const byte*) PROCPORT_DDR#0 = ((byte*))0 Constant (const byte) PROCPORT_DDR_MEMORY_MASK#0 = 7 @@ -868,7 +926,7 @@ Constant (const byte*) PLAYFIELD_CHARSET#0 = ((byte*))4096 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 byte) IRQ_RASTER_FIRST#0 = 49 Constant (const void()*) init_irq::$0 = &irq Successful SSA optimization Pass2ConstantIdentification Constant (const byte*) PLAYFIELD_SPRITE_PTRS#0 = PLAYFIELD_SCREEN#0+SPRITE_PTRS#0 @@ -948,7 +1006,7 @@ Constant inlined init_sprites::toD0181_$0#0 = ((word))(const byte*) PLAYFIELD_SC 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_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 = &interrupt(KERNEL_MIN)(void()) irq() +Constant inlined init_irq::$0 = &interrupt(HARDWARE_CLOBBER)(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_sprites::vicSelectGfxBank1_gfx#0 = (const byte*) PLAYFIELD_SCREEN#0 @@ -970,6 +1028,7 @@ Successful SSA optimization Pass2ConstantInlining Simplifying constant plus zero SPRITES_YPOS#0+0 Simplifying constant plus zero PLAYFIELD_SPRITE_PTRS#0+0 Added new block during phi lifting init_sprites::@5(between init_sprites::@1 and init_sprites::@1) +Added new block during phi lifting irq::@10(between irq::@3 and irq::@4) Adding NOP phi() at start of @begin Adding NOP phi() at start of toSpritePtr1 Adding NOP phi() at start of @end @@ -983,13 +1042,16 @@ CALL GRAPH Calls in [] to main:7 Calls in [main] to init_sprites:10 init_irq:12 -Created 3 initial phi equivalence classes -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 +Created 4 initial phi equivalence classes +Coalesced [44] init_sprites::s#3 ← init_sprites::s#1 +Coalesced [45] init_sprites::xpos#3 ← init_sprites::xpos#1 +Coalesced [64] irq_raster_next#19 ← irq_raster_next#2 +Coalesced [70] irq::raster_next#5 ← irq::raster_next#1 +Coalesced [76] irq::raster_next#4 ← irq::raster_next#0 +Coalesced [82] irq_raster_next#20 ← irq_raster_next#1 +Coalesced down to 4 phi equivalence classes Culled Empty Block (label) init_sprites::@5 +Culled Empty Block (label) irq::@10 Adding NOP phi() at start of @begin Adding NOP phi() at start of toSpritePtr1 Adding NOP phi() at start of @end @@ -1045,96 +1107,109 @@ main::@2: scope:[main] from main::@2 main::@7 to:main::@2 init_irq: scope:[init_irq] from main::@7 asm { sei } - [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() + [15] *((const byte*) IRQ_STATUS#0) ← (const byte) IRQ_RASTER#0 + asm { ldaCIA1_INTERRUPT } + [17] *((const byte*) PROCPORT_DDR#0) ← (const byte) PROCPORT_DDR_MEMORY_MASK#0 + [18] *((const byte*) PROCPORT#0) ← (const byte) PROCPORT_RAM_IO#0 + [19] *((const byte*) CIA1_INTERRUPT#0) ← (const byte) CIA_INTERRUPT_CLEAR#0 + [20] *((const byte*) VIC_CONTROL#0) ← *((const byte*) VIC_CONTROL#0) & (byte/signed byte/word/signed word/dword/signed dword) 127 + [21] *((const byte*) RASTER#0) ← (const byte) IRQ_RASTER_FIRST#0 + [22] *((const byte*) IRQ_ENABLE#0) ← (const byte) IRQ_RASTER#0 + [23] *((const void()**) HARDWARE_IRQ#0) ← &interrupt(HARDWARE_CLOBBER)(void()) irq() asm { cli } to:init_irq::@return init_irq::@return: scope:[init_irq] from init_irq - [21] return + [25] return to:@return init_sprites: scope:[init_sprites] from main - [22] phi() + [26] phi() to:init_sprites::vicSelectGfxBank1 init_sprites::vicSelectGfxBank1: scope:[init_sprites] from init_sprites - [23] *((const byte*) CIA2_PORT_A_DDR#0) ← (byte/signed byte/word/signed word/dword/signed dword) 3 + [27] *((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 - [24] phi() + [28] phi() to:init_sprites::vicSelectGfxBank1_@1 init_sprites::vicSelectGfxBank1_@1: scope:[init_sprites] from init_sprites::vicSelectGfxBank1_toDd001 - [25] *((const byte*) CIA2_PORT_A#0) ← (const byte) init_sprites::vicSelectGfxBank1_toDd001_return#0 + [29] *((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 - [26] phi() + [30] phi() to:init_sprites::@4 init_sprites::@4: scope:[init_sprites] from init_sprites::toD0181 - [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) + [31] *((const byte*) D018#0) ← (const byte) init_sprites::toD0181_return#0 + [32] *((const byte*) SPRITES_ENABLE#0) ← (byte/signed byte/word/signed word/dword/signed dword) 15 + [33] *((const byte*) SPRITES_MC#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 + [34] *((const byte*) SPRITES_EXPAND_Y#0) ← *((const byte*) SPRITES_MC#0) + [35] *((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 - [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 + [36] (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 ) + [36] (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 ) + [37] (byte) init_sprites::s2#0 ← (byte) init_sprites::s#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 + [38] *((const byte*) SPRITES_XPOS#0 + (byte) init_sprites::s2#0) ← (byte) init_sprites::xpos#2 + [39] *((const byte*) SPRITES_COLS#0 + (byte) init_sprites::s#2) ← (const byte) BLACK#0 + [40] (byte) init_sprites::xpos#1 ← (byte) init_sprites::xpos#2 + (byte/signed byte/word/signed word/dword/signed dword) 24 + [41] (byte) init_sprites::s#1 ← ++ (byte) init_sprites::s#2 + [42] 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 - [39] return + [43] return to:@return irq: scope:[irq] from - [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 + [44] *((const byte*) BORDERCOL#0) ← (const byte) DARK_GREY#0 + [45] *((const byte*) SPRITES_YPOS#0) ← (byte) irq_sprite_ypos#0 + [46] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte) irq_sprite_ypos#0 + [47] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 4) ← (byte) irq_sprite_ypos#0 + [48] *((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 - [45] if(*((const byte*) RASTER#0)!=(byte) irq_sprite_ypos#0) goto irq::@1 - to:irq::@4 -irq::@4: scope:[irq] from irq::@1 - [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 + [49] if(*((const byte*) RASTER#0)!=(byte) irq_sprite_ypos#0) goto irq::@1 to:irq::@5 -irq::@5: scope:[irq] from irq::@4 - [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 +irq::@5: scope:[irq] from irq::@1 + [50] (byte) irq::ptr#0 ← (byte) irq_sprite_ptr#0 + [51] *((const byte*) PLAYFIELD_SPRITE_PTRS#0) ← (byte) irq::ptr#0 + [52] (byte) irq::ptr#1 ← ++ (byte) irq::ptr#0 + [53] *((const byte*) PLAYFIELD_SPRITE_PTRS#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte) irq::ptr#1 + [54] *((const byte*) PLAYFIELD_SPRITE_PTRS#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte) irq::ptr#1 + [55] (byte) irq::ptr#2 ← ++ (byte) irq::ptr#1 + [56] *((const byte*) PLAYFIELD_SPRITE_PTRS#0+(byte/signed byte/word/signed word/dword/signed dword) 3) ← (byte) irq::ptr#2 + [57] (byte) irq_cnt#1 ← ++ (byte) irq_cnt#0 + [58] if((byte) irq_cnt#1==(byte/signed byte/word/signed word/dword/signed dword) 10) goto irq::@2 + to:irq::@6 +irq::@6: scope:[irq] from irq::@5 + [59] (byte) irq_raster_next#2 ← (byte) irq_raster_next#0 + (byte/signed byte/word/signed word/dword/signed dword) 21 + [60] (byte) irq_sprite_ypos#2 ← (byte) irq_sprite_ypos#0 + (byte/signed byte/word/signed word/dword/signed dword) 21 + [61] (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 - [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 +irq::@3: scope:[irq] from irq::@6 irq::@9 + [62] (byte) irq_raster_next#12 ← phi( irq::@6/(byte) irq_raster_next#2 irq::@9/(byte) irq_raster_next#1 ) + [63] (byte) irq::raster_next#0 ← (byte) irq_raster_next#12 + [64] (byte~) irq::$3 ← (byte) irq::raster_next#0 & (byte/signed byte/word/signed word/dword/signed dword) 7 + [65] if((byte~) irq::$3!=(byte/signed byte/word/signed word/dword/signed dword) 3) goto irq::@4 + to:irq::@8 +irq::@8: scope:[irq] from irq::@3 + [66] (byte) irq::raster_next#1 ← (byte) irq::raster_next#0 - (byte/signed byte/word/signed word/dword/signed dword) 1 + to:irq::@4 +irq::@4: scope:[irq] from irq::@3 irq::@8 + [67] (byte) irq::raster_next#2 ← phi( irq::@3/(byte) irq::raster_next#0 irq::@8/(byte) irq::raster_next#1 ) + [68] *((const byte*) RASTER#0) ← (byte) irq::raster_next#2 + [69] *((const byte*) IRQ_STATUS#0) ← (const byte) IRQ_RASTER#0 + [70] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 to:irq::@return -irq::@return: scope:[irq] from irq::@3 - [62] return +irq::@return: scope:[irq] from irq::@4 + [71] return to:@return -irq::@2: scope:[irq] from irq::@4 - [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 +irq::@2: scope:[irq] from irq::@5 + [72] (byte) irq_cnt#13 ← (byte/signed byte/word/signed word/dword/signed dword) 0 + [73] (byte) irq_raster_next#1 ← (const byte) IRQ_RASTER_FIRST#0 + [74] (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 - [66] phi() - to:irq::@7 -irq::@7: scope:[irq] from irq::toSpritePtr2 - [67] (byte) irq_sprite_ptr#1 ← (const byte) irq::toSpritePtr2_return#0 + [75] phi() + to:irq::@9 +irq::@9: scope:[irq] from irq::toSpritePtr2 + [76] (byte) irq_sprite_ptr#1 ← (const byte) irq::toSpritePtr2_return#0 to:irq::@3 @@ -1253,11 +1328,16 @@ VARIABLE REGISTER WEIGHTS (byte) init_sprites::xpos (byte) init_sprites::xpos#1 7.333333333333333 (byte) init_sprites::xpos#2 8.25 -interrupt(KERNEL_MIN)(void()) irq() +interrupt(HARDWARE_CLOBBER)(void()) irq() +(byte~) irq::$3 4.0 (byte) irq::ptr (byte) irq::ptr#0 3.0 (byte) irq::ptr#1 2.6666666666666665 (byte) irq::ptr#2 4.0 +(byte) irq::raster_next +(byte) irq::raster_next#0 2.6666666666666665 +(byte) irq::raster_next#1 4.0 +(byte) irq::raster_next#2 6.0 (word~) irq::toSpritePtr2_$0 (word~) irq::toSpritePtr2_$1 (byte~) irq::toSpritePtr2_$2 @@ -1266,12 +1346,12 @@ interrupt(KERNEL_MIN)(void()) irq() (byte) irq_cnt (byte) irq_cnt#0 0.3076923076923077 (byte) irq_cnt#1 4.0 -(byte) irq_cnt#10 20.0 +(byte) irq_cnt#13 20.0 (byte) irq_raster_next (byte) irq_raster_next#0 0.26666666666666666 (byte) irq_raster_next#1 1.0 +(byte) irq_raster_next#12 6.0 (byte) irq_raster_next#2 1.3333333333333333 -(byte) irq_raster_next#3 6.0 (byte) irq_sprite_ptr (byte) irq_sprite_ptr#0 0.3529411764705882 (byte) irq_sprite_ptr#1 20.0 @@ -1290,7 +1370,8 @@ 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#3 irq_raster_next#2 irq_raster_next#1 ] +[ irq_raster_next#12 irq_raster_next#2 irq_raster_next#1 ] +[ irq::raster_next#2 irq::raster_next#0 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 ] @@ -1302,13 +1383,15 @@ Added variable irq::ptr#2 to zero page equivalence class [ irq::ptr#2 ] 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::$3 to zero page equivalence class [ irq::$3 ] +Added variable irq_cnt#13 to zero page equivalence class [ irq_cnt#13 ] 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#3 irq_raster_next#2 irq_raster_next#1 ] +[ irq_raster_next#12 irq_raster_next#2 irq_raster_next#1 ] +[ irq::raster_next#2 irq::raster_next#0 irq::raster_next#1 ] [ irq_raster_next#0 ] [ irq_sprite_ypos#0 ] [ irq_sprite_ptr#0 ] @@ -1320,26 +1403,29 @@ Complete equivalence classes [ irq_cnt#1 ] [ irq_sprite_ypos#2 ] [ irq_sprite_ptr#2 ] -[ irq_cnt#10 ] +[ irq::$3 ] +[ irq_cnt#13 ] [ 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#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 ] +Allocated zp ZP_BYTE:4 [ irq_raster_next#12 irq_raster_next#2 irq_raster_next#1 ] +Allocated zp ZP_BYTE:5 [ irq::raster_next#2 irq::raster_next#0 irq::raster_next#1 ] +Allocated zp ZP_BYTE:6 [ irq_raster_next#0 ] +Allocated zp ZP_BYTE:7 [ irq_sprite_ypos#0 ] +Allocated zp ZP_BYTE:8 [ irq_sprite_ptr#0 ] +Allocated zp ZP_BYTE:9 [ irq_cnt#0 ] +Allocated zp ZP_BYTE:10 [ init_sprites::s2#0 ] +Allocated zp ZP_BYTE:11 [ irq::ptr#0 ] +Allocated zp ZP_BYTE:12 [ irq::ptr#1 ] +Allocated zp ZP_BYTE:13 [ irq::ptr#2 ] +Allocated zp ZP_BYTE:14 [ irq_cnt#1 ] +Allocated zp ZP_BYTE:15 [ irq_sprite_ypos#2 ] +Allocated zp ZP_BYTE:16 [ irq_sprite_ptr#2 ] +Allocated zp ZP_BYTE:17 [ irq::$3 ] +Allocated zp ZP_BYTE:18 [ irq_cnt#13 ] +Allocated zp ZP_BYTE:19 [ irq_sprite_ypos#1 ] +Allocated zp ZP_BYTE:20 [ irq_sprite_ptr#1 ] INITIAL ASM //SEG0 Basic Upstart @@ -1347,6 +1433,10 @@ INITIAL ASM :BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels + .label PROCPORT_DDR = 0 + .const PROCPORT_DDR_MEMORY_MASK = 7 + .label PROCPORT = 1 + .const PROCPORT_RAM_IO = $35 .const SPRITE_PTRS = $3f8 .label SPRITES_XPOS = $d000 .label SPRITES_YPOS = $d001 @@ -1366,28 +1456,28 @@ INITIAL ASM .const CIA_INTERRUPT_CLEAR = $7f .label CIA2_PORT_A = $dd00 .label CIA2_PORT_A_DDR = $dd02 - .label KERNEL_IRQ = $314 + .label HARDWARE_IRQ = $fffe .const BLACK = 0 .const DARK_GREY = $b .label PLAYFIELD_SPRITES = $2000 .label PLAYFIELD_CHARSET = $1000 .label PLAYFIELD_SCREEN = $400 - .const IRQ_RASTER_FIRST = $30 + .const IRQ_RASTER_FIRST = $31 .label PLAYFIELD_SPRITE_PTRS = PLAYFIELD_SCREEN+SPRITE_PTRS .const toSpritePtr1_return = PLAYFIELD_SPRITES>>6 - .label irq_raster_next = 5 - .label irq_sprite_ypos = 6 - .label irq_sprite_ptr = 7 - .label irq_cnt = 8 - .label irq_cnt_1 = $d + .label irq_raster_next = 6 + .label irq_sprite_ypos = 7 + .label irq_sprite_ptr = 8 + .label irq_cnt = 9 + .label irq_cnt_1 = $e .label irq_raster_next_1 = 4 - .label irq_sprite_ypos_1 = $11 - .label irq_sprite_ptr_1 = $12 + .label irq_sprite_ypos_1 = $13 + .label irq_sprite_ptr_1 = $14 .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 + .label irq_sprite_ypos_2 = $f + .label irq_sprite_ptr_2 = $10 + .label irq_raster_next_12 = 4 + .label irq_cnt_13 = $12 //SEG2 @begin bbegin: jmp b6 @@ -1429,7 +1519,7 @@ bend: //SEG17 main main: { //SEG18 [10] call init_sprites - //SEG19 [22] phi from main to init_sprites [phi:main->init_sprites] + //SEG19 [26] 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] @@ -1450,249 +1540,294 @@ main: { init_irq: { //SEG26 asm { sei } sei - //SEG27 [15] *((const byte*) CIA1_INTERRUPT#0) ← (const byte) CIA_INTERRUPT_CLEAR#0 -- _deref_pbuc1=vbuc2 + //SEG27 [15] *((const byte*) IRQ_STATUS#0) ← (const byte) IRQ_RASTER#0 -- _deref_pbuc1=vbuc2 + lda #IRQ_RASTER + sta IRQ_STATUS + //SEG28 asm { ldaCIA1_INTERRUPT } + lda CIA1_INTERRUPT + //SEG29 [17] *((const byte*) PROCPORT_DDR#0) ← (const byte) PROCPORT_DDR_MEMORY_MASK#0 -- _deref_pbuc1=vbuc2 + lda #PROCPORT_DDR_MEMORY_MASK + sta PROCPORT_DDR + //SEG30 [18] *((const byte*) PROCPORT#0) ← (const byte) PROCPORT_RAM_IO#0 -- _deref_pbuc1=vbuc2 + lda #PROCPORT_RAM_IO + sta PROCPORT + //SEG31 [19] *((const byte*) CIA1_INTERRUPT#0) ← (const byte) CIA_INTERRUPT_CLEAR#0 -- _deref_pbuc1=vbuc2 lda #CIA_INTERRUPT_CLEAR sta CIA1_INTERRUPT - //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 + //SEG32 [20] *((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 - //SEG29 [17] *((const byte*) RASTER#0) ← (const byte) IRQ_RASTER_FIRST#0 -- _deref_pbuc1=vbuc2 + //SEG33 [21] *((const byte*) RASTER#0) ← (const byte) IRQ_RASTER_FIRST#0 -- _deref_pbuc1=vbuc2 lda #IRQ_RASTER_FIRST sta RASTER - //SEG30 [18] *((const byte*) IRQ_ENABLE#0) ← (const byte) IRQ_RASTER#0 -- _deref_pbuc1=vbuc2 + //SEG34 [22] *((const byte*) IRQ_ENABLE#0) ← (const byte) IRQ_RASTER#0 -- _deref_pbuc1=vbuc2 lda #IRQ_RASTER sta IRQ_ENABLE - //SEG31 [19] *((const void()**) KERNEL_IRQ#0) ← &interrupt(KERNEL_MIN)(void()) irq() -- _deref_pptc1=pprc2 + //SEG35 [23] *((const void()**) HARDWARE_IRQ#0) ← &interrupt(HARDWARE_CLOBBER)(void()) irq() -- _deref_pptc1=pprc2 lda #irq - sta KERNEL_IRQ+1 - //SEG32 asm { cli } + sta HARDWARE_IRQ+1 + //SEG36 asm { cli } cli jmp breturn - //SEG33 init_irq::@return + //SEG37 init_irq::@return breturn: - //SEG34 [21] return + //SEG38 [25] return rts } -//SEG35 init_sprites +//SEG39 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 = 9 + .label s2 = $a .label xpos = 3 .label s = 2 jmp vicSelectGfxBank1 - //SEG36 init_sprites::vicSelectGfxBank1 + //SEG40 init_sprites::vicSelectGfxBank1 vicSelectGfxBank1: - //SEG37 [23] *((const byte*) CIA2_PORT_A_DDR#0) ← (byte/signed byte/word/signed word/dword/signed dword) 3 -- _deref_pbuc1=vbuc2 + //SEG41 [27] *((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 - //SEG38 [24] phi from init_sprites::vicSelectGfxBank1 to init_sprites::vicSelectGfxBank1_toDd001 [phi:init_sprites::vicSelectGfxBank1->init_sprites::vicSelectGfxBank1_toDd001] + //SEG42 [28] 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 - //SEG39 init_sprites::vicSelectGfxBank1_toDd001 + //SEG43 init_sprites::vicSelectGfxBank1_toDd001 vicSelectGfxBank1_toDd001: jmp vicSelectGfxBank1_b1 - //SEG40 init_sprites::vicSelectGfxBank1_@1 + //SEG44 init_sprites::vicSelectGfxBank1_@1 vicSelectGfxBank1_b1: - //SEG41 [25] *((const byte*) CIA2_PORT_A#0) ← (const byte) init_sprites::vicSelectGfxBank1_toDd001_return#0 -- _deref_pbuc1=vbuc2 + //SEG45 [29] *((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 - //SEG42 [26] phi from init_sprites::vicSelectGfxBank1_@1 to init_sprites::toD0181 [phi:init_sprites::vicSelectGfxBank1_@1->init_sprites::toD0181] + //SEG46 [30] phi from init_sprites::vicSelectGfxBank1_@1 to init_sprites::toD0181 [phi:init_sprites::vicSelectGfxBank1_@1->init_sprites::toD0181] toD0181_from_vicSelectGfxBank1_b1: jmp toD0181 - //SEG43 init_sprites::toD0181 + //SEG47 init_sprites::toD0181 toD0181: jmp b4 - //SEG44 init_sprites::@4 + //SEG48 init_sprites::@4 b4: - //SEG45 [27] *((const byte*) D018#0) ← (const byte) init_sprites::toD0181_return#0 -- _deref_pbuc1=vbuc2 + //SEG49 [31] *((const byte*) D018#0) ← (const byte) init_sprites::toD0181_return#0 -- _deref_pbuc1=vbuc2 lda #toD0181_return sta D018 - //SEG46 [28] *((const byte*) SPRITES_ENABLE#0) ← (byte/signed byte/word/signed word/dword/signed dword) 15 -- _deref_pbuc1=vbuc2 + //SEG50 [32] *((const byte*) SPRITES_ENABLE#0) ← (byte/signed byte/word/signed word/dword/signed dword) 15 -- _deref_pbuc1=vbuc2 lda #$f sta SPRITES_ENABLE - //SEG47 [29] *((const byte*) SPRITES_MC#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2 + //SEG51 [33] *((const byte*) SPRITES_MC#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2 lda #0 sta SPRITES_MC - //SEG48 [30] *((const byte*) SPRITES_EXPAND_Y#0) ← *((const byte*) SPRITES_MC#0) -- _deref_pbuc1=_deref_pbuc2 + //SEG52 [34] *((const byte*) SPRITES_EXPAND_Y#0) ← *((const byte*) SPRITES_MC#0) -- _deref_pbuc1=_deref_pbuc2 lda SPRITES_MC sta SPRITES_EXPAND_Y - //SEG49 [31] *((const byte*) SPRITES_EXPAND_X#0) ← *((const byte*) SPRITES_EXPAND_Y#0) -- _deref_pbuc1=_deref_pbuc2 + //SEG53 [35] *((const byte*) SPRITES_EXPAND_X#0) ← *((const byte*) SPRITES_EXPAND_Y#0) -- _deref_pbuc1=_deref_pbuc2 lda SPRITES_EXPAND_Y sta SPRITES_EXPAND_X - //SEG50 [32] phi from init_sprites::@4 to init_sprites::@1 [phi:init_sprites::@4->init_sprites::@1] + //SEG54 [36] phi from init_sprites::@4 to init_sprites::@1 [phi:init_sprites::@4->init_sprites::@1] b1_from_b4: - //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 + //SEG55 [36] 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 - //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 + //SEG56 [36] 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 - //SEG53 [32] phi from init_sprites::@1 to init_sprites::@1 [phi:init_sprites::@1->init_sprites::@1] + //SEG57 [36] phi from init_sprites::@1 to init_sprites::@1 [phi:init_sprites::@1->init_sprites::@1] b1_from_b1: - //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 + //SEG58 [36] phi (byte) init_sprites::xpos#2 = (byte) init_sprites::xpos#1 [phi:init_sprites::@1->init_sprites::@1#0] -- register_copy + //SEG59 [36] phi (byte) init_sprites::s#2 = (byte) init_sprites::s#1 [phi:init_sprites::@1->init_sprites::@1#1] -- register_copy jmp b1 - //SEG56 init_sprites::@1 + //SEG60 init_sprites::@1 b1: - //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 + //SEG61 [37] (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 - //SEG58 [34] *((const byte*) SPRITES_XPOS#0 + (byte) init_sprites::s2#0) ← (byte) init_sprites::xpos#2 -- pbuc1_derefidx_vbuz1=vbuz2 + //SEG62 [38] *((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 - //SEG59 [35] *((const byte*) SPRITES_COLS#0 + (byte) init_sprites::s#2) ← (const byte) BLACK#0 -- pbuc1_derefidx_vbuz1=vbuc2 + //SEG63 [39] *((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 - //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 + //SEG64 [40] (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 - //SEG61 [37] (byte) init_sprites::s#1 ← ++ (byte) init_sprites::s#2 -- vbuz1=_inc_vbuz1 + //SEG65 [41] (byte) init_sprites::s#1 ← ++ (byte) init_sprites::s#2 -- vbuz1=_inc_vbuz1 inc s - //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 + //SEG66 [42] 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 - //SEG63 init_sprites::@return + //SEG67 init_sprites::@return breturn: - //SEG64 [39] return + //SEG68 [43] return rts } -//SEG65 irq +//SEG69 irq irq: { .const toSpritePtr2_return = PLAYFIELD_SPRITES>>6 - .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 + .label _3 = $11 + .label ptr = $b + .label ptr_1 = $c + .label ptr_2 = $d + .label raster_next = 5 + //SEG70 entry interrupt(HARDWARE_CLOBBER) + sta rega+1 + stx regx+1 + sty regy+1 + //SEG71 [44] *((const byte*) BORDERCOL#0) ← (const byte) DARK_GREY#0 -- _deref_pbuc1=vbuc2 lda #DARK_GREY sta BORDERCOL - //SEG68 [41] *((const byte*) SPRITES_YPOS#0) ← (byte) irq_sprite_ypos#0 -- _deref_pbuc1=vbuz1 + //SEG72 [45] *((const byte*) SPRITES_YPOS#0) ← (byte) irq_sprite_ypos#0 -- _deref_pbuc1=vbuz1 lda irq_sprite_ypos sta SPRITES_YPOS - //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 + //SEG73 [46] *((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 - //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 + //SEG74 [47] *((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 - //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 + //SEG75 [48] *((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 - //SEG72 irq::@1 + //SEG76 irq::@1 b1: - //SEG73 [45] if(*((const byte*) RASTER#0)!=(byte) irq_sprite_ypos#0) goto irq::@1 -- _deref_pbuc1_neq_vbuz1_then_la1 + //SEG77 [49] 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 - //SEG74 irq::@4 - b4: - //SEG75 [46] (byte) irq::ptr#0 ← (byte) irq_sprite_ptr#0 -- vbuz1=vbuz2 + jmp b5 + //SEG78 irq::@5 + b5: + //SEG79 [50] (byte) irq::ptr#0 ← (byte) irq_sprite_ptr#0 -- vbuz1=vbuz2 lda irq_sprite_ptr sta ptr - //SEG76 [47] *((const byte*) PLAYFIELD_SPRITE_PTRS#0) ← (byte) irq::ptr#0 -- _deref_pbuc1=vbuz1 + //SEG80 [51] *((const byte*) PLAYFIELD_SPRITE_PTRS#0) ← (byte) irq::ptr#0 -- _deref_pbuc1=vbuz1 lda ptr sta PLAYFIELD_SPRITE_PTRS - //SEG77 [48] (byte) irq::ptr#1 ← ++ (byte) irq::ptr#0 -- vbuz1=_inc_vbuz2 + //SEG81 [52] (byte) irq::ptr#1 ← ++ (byte) irq::ptr#0 -- vbuz1=_inc_vbuz2 ldy ptr iny sty ptr_1 - //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 + //SEG82 [53] *((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 - //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 + //SEG83 [54] *((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 - //SEG80 [51] (byte) irq::ptr#2 ← ++ (byte) irq::ptr#1 -- vbuz1=_inc_vbuz2 + //SEG84 [55] (byte) irq::ptr#2 ← ++ (byte) irq::ptr#1 -- vbuz1=_inc_vbuz2 ldy ptr_1 iny sty ptr_2 - //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 + //SEG85 [56] *((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 - //SEG82 [53] (byte) irq_cnt#1 ← ++ (byte) irq_cnt#0 -- vbuz1=_inc_vbuz2 + //SEG86 [57] (byte) irq_cnt#1 ← ++ (byte) irq_cnt#0 -- vbuz1=_inc_vbuz2 ldy irq_cnt iny 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 + //SEG87 [58] 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 - //SEG84 irq::@5 - b5: - //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 + jmp b6 + //SEG88 irq::@6 + b6: + //SEG89 [59] (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_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 + //SEG90 [60] (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_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 + //SEG91 [61] (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_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: - //SEG89 [58] phi (byte) irq_raster_next#3 = (byte) irq_raster_next#2 [phi:irq::@5/irq::@7->irq::@3#0] -- register_copy + //SEG92 [62] phi from irq::@6 irq::@9 to irq::@3 [phi:irq::@6/irq::@9->irq::@3] + b3_from_b6: + b3_from_b9: + //SEG93 [62] phi (byte) irq_raster_next#12 = (byte) irq_raster_next#2 [phi:irq::@6/irq::@9->irq::@3#0] -- register_copy jmp b3 - //SEG90 irq::@3 + //SEG94 irq::@3 b3: - //SEG91 [59] *((const byte*) RASTER#0) ← (byte) irq_raster_next#3 -- _deref_pbuc1=vbuz1 - lda irq_raster_next_3 + //SEG95 [63] (byte) irq::raster_next#0 ← (byte) irq_raster_next#12 -- vbuz1=vbuz2 + lda irq_raster_next_12 + sta raster_next + //SEG96 [64] (byte~) irq::$3 ← (byte) irq::raster_next#0 & (byte/signed byte/word/signed word/dword/signed dword) 7 -- vbuz1=vbuz2_band_vbuc1 + lda #7 + and raster_next + sta _3 + //SEG97 [65] if((byte~) irq::$3!=(byte/signed byte/word/signed word/dword/signed dword) 3) goto irq::@4 -- vbuz1_neq_vbuc1_then_la1 + lda _3 + cmp #3 + bne b4_from_b3 + jmp b8 + //SEG98 irq::@8 + b8: + //SEG99 [66] (byte) irq::raster_next#1 ← (byte) irq::raster_next#0 - (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz1_minus_1 + dec raster_next + //SEG100 [67] phi from irq::@3 irq::@8 to irq::@4 [phi:irq::@3/irq::@8->irq::@4] + b4_from_b3: + b4_from_b8: + //SEG101 [67] phi (byte) irq::raster_next#2 = (byte) irq::raster_next#0 [phi:irq::@3/irq::@8->irq::@4#0] -- register_copy + jmp b4 + //SEG102 irq::@4 + b4: + //SEG103 [68] *((const byte*) RASTER#0) ← (byte) irq::raster_next#2 -- _deref_pbuc1=vbuz1 + lda raster_next sta RASTER - //SEG92 [60] *((const byte*) IRQ_STATUS#0) ← (const byte) IRQ_RASTER#0 -- _deref_pbuc1=vbuc2 + //SEG104 [69] *((const byte*) IRQ_STATUS#0) ← (const byte) IRQ_RASTER#0 -- _deref_pbuc1=vbuc2 lda #IRQ_RASTER sta IRQ_STATUS - //SEG93 [61] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 -- _deref_pbuc1=vbuc2 + //SEG105 [70] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 -- _deref_pbuc1=vbuc2 lda #BLACK sta BORDERCOL jmp breturn - //SEG94 irq::@return + //SEG106 irq::@return breturn: - //SEG95 [62] return - exit interrupt(KERNEL_MIN) - jmp $ea81 - //SEG96 irq::@2 + //SEG107 [71] return - exit interrupt(HARDWARE_CLOBBER) + rega: + lda #00 + regx: + ldx #00 + regy: + ldy #00 + rti + //SEG108 irq::@2 b2: - //SEG97 [63] (byte) irq_cnt#10 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1 + //SEG109 [72] (byte) irq_cnt#13 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1 lda #0 - sta irq_cnt_10 - //SEG98 [64] (byte) irq_raster_next#1 ← (const byte) IRQ_RASTER_FIRST#0 -- vbuz1=vbuc1 + sta irq_cnt_13 + //SEG110 [73] (byte) irq_raster_next#1 ← (const byte) IRQ_RASTER_FIRST#0 -- vbuz1=vbuc1 lda #IRQ_RASTER_FIRST sta irq_raster_next_1 - //SEG99 [65] (byte) irq_sprite_ypos#1 ← (byte/signed byte/word/signed word/dword/signed dword) 50 -- vbuz1=vbuc1 + //SEG111 [74] (byte) irq_sprite_ypos#1 ← (byte/signed byte/word/signed word/dword/signed dword) 50 -- vbuz1=vbuc1 lda #$32 sta irq_sprite_ypos_1 - //SEG100 [66] phi from irq::@2 to irq::toSpritePtr2 [phi:irq::@2->irq::toSpritePtr2] + //SEG112 [75] phi from irq::@2 to irq::toSpritePtr2 [phi:irq::@2->irq::toSpritePtr2] toSpritePtr2_from_b2: jmp toSpritePtr2 - //SEG101 irq::toSpritePtr2 + //SEG113 irq::toSpritePtr2 toSpritePtr2: - jmp b7 - //SEG102 irq::@7 - b7: - //SEG103 [67] (byte) irq_sprite_ptr#1 ← (const byte) irq::toSpritePtr2_return#0 -- vbuz1=vbuc1 + jmp b9 + //SEG114 irq::@9 + b9: + //SEG115 [76] (byte) irq_sprite_ptr#1 ← (const byte) irq::toSpritePtr2_return#0 -- vbuz1=vbuc1 lda #toSpritePtr2_return sta irq_sprite_ptr_1 - jmp b3_from_b7 + jmp b3_from_b9 } .pc = PLAYFIELD_SPRITES "Inline" .var sprites = LoadPicture("nes-playfield.png", List().add($010101, $000000)) @@ -1713,146 +1848,166 @@ Statement [1] (byte) irq_raster_next#0 ← (const byte) IRQ_RASTER_FIRST#0 [ ] ( 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 [15] *((const byte*) IRQ_STATUS#0) ← (const byte) IRQ_RASTER#0 [ ] ( main:7::init_irq:12 [ ] ) always clobbers reg byte a +Statement asm { ldaCIA1_INTERRUPT } always clobbers reg byte a +Statement [17] *((const byte*) PROCPORT_DDR#0) ← (const byte) PROCPORT_DDR_MEMORY_MASK#0 [ ] ( main:7::init_irq:12 [ ] ) always clobbers reg byte a +Statement [18] *((const byte*) PROCPORT#0) ← (const byte) PROCPORT_RAM_IO#0 [ ] ( main:7::init_irq:12 [ ] ) always clobbers reg byte a +Statement [19] *((const byte*) CIA1_INTERRUPT#0) ← (const byte) CIA_INTERRUPT_CLEAR#0 [ ] ( main:7::init_irq:12 [ ] ) always clobbers reg byte a +Statement [20] *((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 [21] *((const byte*) RASTER#0) ← (const byte) IRQ_RASTER_FIRST#0 [ ] ( main:7::init_irq:12 [ ] ) always clobbers reg byte a +Statement [22] *((const byte*) IRQ_ENABLE#0) ← (const byte) IRQ_RASTER#0 [ ] ( main:7::init_irq:12 [ ] ) always clobbers reg byte a +Statement [23] *((const void()**) HARDWARE_IRQ#0) ← &interrupt(HARDWARE_CLOBBER)(void()) irq() [ ] ( main:7::init_irq:12 [ ] ) always clobbers reg byte a +Statement [27] *((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 [29] *((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 [31] *((const byte*) D018#0) ← (const byte) init_sprites::toD0181_return#0 [ ] ( main:7::init_sprites:10 [ ] ) always clobbers reg byte a +Statement [32] *((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 [33] *((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 [34] *((const byte*) SPRITES_EXPAND_Y#0) ← *((const byte*) SPRITES_MC#0) [ ] ( main:7::init_sprites:10 [ ] ) always clobbers reg byte a +Statement [35] *((const byte*) SPRITES_EXPAND_X#0) ← *((const byte*) SPRITES_EXPAND_Y#0) [ ] ( main:7::init_sprites:10 [ ] ) always clobbers reg byte a +Statement [37] (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 [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 [38] *((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 [39] *((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 [40] (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 [44] *((const byte*) BORDERCOL#0) ← (const byte) DARK_GREY#0 [ irq_raster_next#0 irq_sprite_ypos#0 irq_sprite_ptr#0 irq_cnt#0 ] ( [ irq_raster_next#0 irq_sprite_ypos#0 irq_sprite_ptr#0 irq_cnt#0 ] ) always clobbers reg byte a +Statement [45] *((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 ] ( [ irq_raster_next#0 irq_sprite_ypos#0 irq_sprite_ptr#0 irq_cnt#0 ] ) always clobbers reg byte a +Statement [46] *((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 ] ( [ irq_raster_next#0 irq_sprite_ypos#0 irq_sprite_ptr#0 irq_cnt#0 ] ) always clobbers reg byte a +Statement [47] *((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 ] ( [ irq_raster_next#0 irq_sprite_ypos#0 irq_sprite_ptr#0 irq_cnt#0 ] ) always clobbers reg byte a +Statement [48] *((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 ] ( [ irq_raster_next#0 irq_sprite_ypos#0 irq_sprite_ptr#0 irq_cnt#0 ] ) always clobbers reg byte a +Statement [49] 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 ] ( [ irq_raster_next#0 irq_sprite_ypos#0 irq_sprite_ptr#0 irq_cnt#0 ] ) always clobbers reg byte a +Statement [57] (byte) irq_cnt#1 ← ++ (byte) irq_cnt#0 [ irq_raster_next#0 irq_sprite_ypos#0 irq_sprite_ptr#0 irq_cnt#1 ] ( [ irq_raster_next#0 irq_sprite_ypos#0 irq_sprite_ptr#0 irq_cnt#1 ] ) always clobbers reg byte y +Statement [58] 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 ] ( [ irq_raster_next#0 irq_sprite_ypos#0 irq_sprite_ptr#0 ] ) always clobbers reg byte a +Statement [59] (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 ] ( [ irq_sprite_ypos#0 irq_sprite_ptr#0 irq_raster_next#2 ] ) always clobbers reg byte a +Statement [60] (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 ] ( [ irq_sprite_ptr#0 irq_raster_next#2 ] ) always clobbers reg byte a +Statement [61] (byte) irq_sprite_ptr#2 ← (byte) irq_sprite_ptr#0 + (byte/signed byte/word/signed word/dword/signed dword) 3 [ irq_raster_next#2 ] ( [ irq_raster_next#2 ] ) always clobbers reg byte a +Statement [64] (byte~) irq::$3 ← (byte) irq::raster_next#0 & (byte/signed byte/word/signed word/dword/signed dword) 7 [ irq::raster_next#0 irq::$3 ] ( [ irq::raster_next#0 irq::$3 ] ) always clobbers reg byte a +Removing always clobbered register reg byte a as potential for zp ZP_BYTE:5 [ irq::raster_next#2 irq::raster_next#0 irq::raster_next#1 ] +Statement [69] *((const byte*) IRQ_STATUS#0) ← (const byte) IRQ_RASTER#0 [ ] ( [ ] ) always clobbers reg byte a +Statement [70] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 [ ] ( [ ] ) always clobbers reg byte a +Statement [71] return [ ] ( [ ] ) always clobbers reg byte a reg byte x reg byte y +Statement [72] (byte) irq_cnt#13 ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( [ ] ) always clobbers reg byte a +Statement [73] (byte) irq_raster_next#1 ← (const byte) IRQ_RASTER_FIRST#0 [ irq_raster_next#1 ] ( [ irq_raster_next#1 ] ) always clobbers reg byte a +Statement [74] (byte) irq_sprite_ypos#1 ← (byte/signed byte/word/signed word/dword/signed dword) 50 [ irq_raster_next#1 ] ( [ irq_raster_next#1 ] ) always clobbers reg byte a +Statement [76] (byte) irq_sprite_ptr#1 ← (const byte) irq::toSpritePtr2_return#0 [ irq_raster_next#1 ] ( [ 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 +Statement [15] *((const byte*) IRQ_STATUS#0) ← (const byte) IRQ_RASTER#0 [ ] ( main:7::init_irq:12 [ ] ) always clobbers reg byte a +Statement asm { ldaCIA1_INTERRUPT } always clobbers reg byte a +Statement [17] *((const byte*) PROCPORT_DDR#0) ← (const byte) PROCPORT_DDR_MEMORY_MASK#0 [ ] ( main:7::init_irq:12 [ ] ) always clobbers reg byte a +Statement [18] *((const byte*) PROCPORT#0) ← (const byte) PROCPORT_RAM_IO#0 [ ] ( main:7::init_irq:12 [ ] ) always clobbers reg byte a +Statement [19] *((const byte*) CIA1_INTERRUPT#0) ← (const byte) CIA_INTERRUPT_CLEAR#0 [ ] ( main:7::init_irq:12 [ ] ) always clobbers reg byte a +Statement [20] *((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 [21] *((const byte*) RASTER#0) ← (const byte) IRQ_RASTER_FIRST#0 [ ] ( main:7::init_irq:12 [ ] ) always clobbers reg byte a +Statement [22] *((const byte*) IRQ_ENABLE#0) ← (const byte) IRQ_RASTER#0 [ ] ( main:7::init_irq:12 [ ] ) always clobbers reg byte a +Statement [23] *((const void()**) HARDWARE_IRQ#0) ← &interrupt(HARDWARE_CLOBBER)(void()) irq() [ ] ( main:7::init_irq:12 [ ] ) always clobbers reg byte a +Statement [27] *((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 [29] *((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 [31] *((const byte*) D018#0) ← (const byte) init_sprites::toD0181_return#0 [ ] ( main:7::init_sprites:10 [ ] ) always clobbers reg byte a +Statement [32] *((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 [33] *((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 [34] *((const byte*) SPRITES_EXPAND_Y#0) ← *((const byte*) SPRITES_MC#0) [ ] ( main:7::init_sprites:10 [ ] ) always clobbers reg byte a +Statement [35] *((const byte*) SPRITES_EXPAND_X#0) ← *((const byte*) SPRITES_EXPAND_Y#0) [ ] ( main:7::init_sprites:10 [ ] ) always clobbers reg byte a +Statement [37] (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 [38] *((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 [39] *((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 [40] (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 [44] *((const byte*) BORDERCOL#0) ← (const byte) DARK_GREY#0 [ irq_raster_next#0 irq_sprite_ypos#0 irq_sprite_ptr#0 irq_cnt#0 ] ( [ irq_raster_next#0 irq_sprite_ypos#0 irq_sprite_ptr#0 irq_cnt#0 ] ) always clobbers reg byte a +Statement [45] *((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 ] ( [ irq_raster_next#0 irq_sprite_ypos#0 irq_sprite_ptr#0 irq_cnt#0 ] ) always clobbers reg byte a +Statement [46] *((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 ] ( [ irq_raster_next#0 irq_sprite_ypos#0 irq_sprite_ptr#0 irq_cnt#0 ] ) always clobbers reg byte a +Statement [47] *((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 ] ( [ irq_raster_next#0 irq_sprite_ypos#0 irq_sprite_ptr#0 irq_cnt#0 ] ) always clobbers reg byte a +Statement [48] *((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 ] ( [ irq_raster_next#0 irq_sprite_ypos#0 irq_sprite_ptr#0 irq_cnt#0 ] ) always clobbers reg byte a +Statement [49] 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 ] ( [ irq_raster_next#0 irq_sprite_ypos#0 irq_sprite_ptr#0 irq_cnt#0 ] ) always clobbers reg byte a +Statement [57] (byte) irq_cnt#1 ← ++ (byte) irq_cnt#0 [ irq_raster_next#0 irq_sprite_ypos#0 irq_sprite_ptr#0 irq_cnt#1 ] ( [ irq_raster_next#0 irq_sprite_ypos#0 irq_sprite_ptr#0 irq_cnt#1 ] ) always clobbers reg byte y +Statement [58] 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 ] ( [ irq_raster_next#0 irq_sprite_ypos#0 irq_sprite_ptr#0 ] ) always clobbers reg byte a +Statement [59] (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 ] ( [ irq_sprite_ypos#0 irq_sprite_ptr#0 irq_raster_next#2 ] ) always clobbers reg byte a +Statement [60] (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 ] ( [ irq_sprite_ptr#0 irq_raster_next#2 ] ) always clobbers reg byte a +Statement [61] (byte) irq_sprite_ptr#2 ← (byte) irq_sprite_ptr#0 + (byte/signed byte/word/signed word/dword/signed dword) 3 [ irq_raster_next#2 ] ( [ irq_raster_next#2 ] ) always clobbers reg byte a +Statement [64] (byte~) irq::$3 ← (byte) irq::raster_next#0 & (byte/signed byte/word/signed word/dword/signed dword) 7 [ irq::raster_next#0 irq::$3 ] ( [ irq::raster_next#0 irq::$3 ] ) always clobbers reg byte a +Statement [69] *((const byte*) IRQ_STATUS#0) ← (const byte) IRQ_RASTER#0 [ ] ( [ ] ) always clobbers reg byte a +Statement [70] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 [ ] ( [ ] ) always clobbers reg byte a +Statement [71] return [ ] ( [ ] ) always clobbers reg byte a reg byte x reg byte y +Statement [72] (byte) irq_cnt#13 ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( [ ] ) always clobbers reg byte a +Statement [73] (byte) irq_raster_next#1 ← (const byte) IRQ_RASTER_FIRST#0 [ irq_raster_next#1 ] ( [ irq_raster_next#1 ] ) always clobbers reg byte a +Statement [74] (byte) irq_sprite_ypos#1 ← (byte/signed byte/word/signed word/dword/signed dword) 50 [ irq_raster_next#1 ] ( [ irq_raster_next#1 ] ) always clobbers reg byte a +Statement [76] (byte) irq_sprite_ptr#1 ← (const byte) irq::toSpritePtr2_return#0 [ irq_raster_next#1 ] ( [ 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#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 , +Potential registers zp ZP_BYTE:4 [ irq_raster_next#12 irq_raster_next#2 irq_raster_next#1 ] : zp ZP_BYTE:4 , +Potential registers zp ZP_BYTE:5 [ irq::raster_next#2 irq::raster_next#0 irq::raster_next#1 ] : zp ZP_BYTE:5 , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:6 [ irq_raster_next#0 ] : zp ZP_BYTE:6 , +Potential registers zp ZP_BYTE:7 [ irq_sprite_ypos#0 ] : zp ZP_BYTE:7 , +Potential registers zp ZP_BYTE:8 [ irq_sprite_ptr#0 ] : zp ZP_BYTE:8 , +Potential registers zp ZP_BYTE:9 [ irq_cnt#0 ] : zp ZP_BYTE:9 , +Potential registers zp ZP_BYTE:10 [ init_sprites::s2#0 ] : zp ZP_BYTE:10 , reg byte a , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:11 [ irq::ptr#0 ] : zp ZP_BYTE:11 , reg byte a , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:12 [ irq::ptr#1 ] : zp ZP_BYTE:12 , reg byte a , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:13 [ irq::ptr#2 ] : zp ZP_BYTE:13 , reg byte a , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:14 [ irq_cnt#1 ] : zp ZP_BYTE:14 , +Potential registers zp ZP_BYTE:15 [ irq_sprite_ypos#2 ] : zp ZP_BYTE:15 , +Potential registers zp ZP_BYTE:16 [ irq_sprite_ptr#2 ] : zp ZP_BYTE:16 , +Potential registers zp ZP_BYTE:17 [ irq::$3 ] : zp ZP_BYTE:17 , reg byte a , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:18 [ irq_cnt#13 ] : zp ZP_BYTE:18 , +Potential registers zp ZP_BYTE:19 [ irq_sprite_ypos#1 ] : zp ZP_BYTE:19 , +Potential registers zp ZP_BYTE:20 [ irq_sprite_ptr#1 ] : zp ZP_BYTE:20 , REGISTER UPLIFT SCOPES -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 [] 20: zp ZP_BYTE:15 [ irq_sprite_ypos#2 ] 20: zp ZP_BYTE:16 [ irq_sprite_ptr#2 ] 20: zp ZP_BYTE:18 [ irq_cnt#13 ] 20: zp ZP_BYTE:19 [ irq_sprite_ypos#1 ] 20: zp ZP_BYTE:20 [ irq_sprite_ptr#1 ] 8.33: zp ZP_BYTE:4 [ irq_raster_next#12 irq_raster_next#2 irq_raster_next#1 ] 4: zp ZP_BYTE:14 [ irq_cnt#1 ] 1.44: zp ZP_BYTE:7 [ irq_sprite_ypos#0 ] 0.35: zp ZP_BYTE:8 [ irq_sprite_ptr#0 ] 0.31: zp ZP_BYTE:9 [ irq_cnt#0 ] 0.27: zp ZP_BYTE:6 [ 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:10 [ init_sprites::s2#0 ] 15.58: zp ZP_BYTE:3 [ init_sprites::xpos#2 init_sprites::xpos#1 ] +Uplift Scope [irq] 12.67: zp ZP_BYTE:5 [ irq::raster_next#2 irq::raster_next#0 irq::raster_next#1 ] 4: zp ZP_BYTE:13 [ irq::ptr#2 ] 4: zp ZP_BYTE:17 [ irq::$3 ] 3: zp ZP_BYTE:11 [ irq::ptr#0 ] 2.67: zp ZP_BYTE:12 [ irq::ptr#1 ] Uplift Scope [main] Uplift Scope [init_irq] -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 ] +Uplifting [] best 1892 combination zp ZP_BYTE:15 [ irq_sprite_ypos#2 ] zp ZP_BYTE:16 [ irq_sprite_ptr#2 ] zp ZP_BYTE:18 [ irq_cnt#13 ] zp ZP_BYTE:19 [ irq_sprite_ypos#1 ] zp ZP_BYTE:20 [ irq_sprite_ptr#1 ] zp ZP_BYTE:4 [ irq_raster_next#12 irq_raster_next#2 irq_raster_next#1 ] zp ZP_BYTE:14 [ irq_cnt#1 ] zp ZP_BYTE:7 [ irq_sprite_ypos#0 ] zp ZP_BYTE:8 [ irq_sprite_ptr#0 ] zp ZP_BYTE:9 [ irq_cnt#0 ] zp ZP_BYTE:6 [ irq_raster_next#0 ] +Uplifting [init_sprites] best 1722 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 1693 combination reg byte x [ irq::raster_next#2 irq::raster_next#0 irq::raster_next#1 ] reg byte x [ irq::ptr#2 ] reg byte a [ irq::$3 ] reg byte a [ irq::ptr#0 ] zp ZP_BYTE:12 [ irq::ptr#1 ] +Limited combination testing to 100 combinations of 768 possible. +Uplifting [main] best 1693 combination +Uplifting [init_irq] best 1693 combination +Attempting to uplift remaining variables inzp ZP_BYTE:15 [ irq_sprite_ypos#2 ] +Uplifting [] best 1693 combination zp ZP_BYTE:15 [ irq_sprite_ypos#2 ] +Attempting to uplift remaining variables inzp ZP_BYTE:16 [ irq_sprite_ptr#2 ] +Uplifting [] best 1693 combination zp ZP_BYTE:16 [ irq_sprite_ptr#2 ] +Attempting to uplift remaining variables inzp ZP_BYTE:18 [ irq_cnt#13 ] +Uplifting [] best 1693 combination zp ZP_BYTE:18 [ irq_cnt#13 ] +Attempting to uplift remaining variables inzp ZP_BYTE:19 [ irq_sprite_ypos#1 ] +Uplifting [] best 1693 combination zp ZP_BYTE:19 [ irq_sprite_ypos#1 ] +Attempting to uplift remaining variables inzp ZP_BYTE:20 [ irq_sprite_ptr#1 ] +Uplifting [] best 1693 combination zp ZP_BYTE:20 [ 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 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 ] ] +Uplifting [init_sprites] best 1693 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#12 irq_raster_next#2 irq_raster_next#1 ] +Uplifting [] best 1693 combination zp ZP_BYTE:4 [ irq_raster_next#12 irq_raster_next#2 irq_raster_next#1 ] +Attempting to uplift remaining variables inzp ZP_BYTE:14 [ irq_cnt#1 ] +Uplifting [] best 1693 combination zp ZP_BYTE:14 [ irq_cnt#1 ] +Attempting to uplift remaining variables inzp ZP_BYTE:12 [ irq::ptr#1 ] +Uplifting [irq] best 1681 combination reg byte x [ irq::ptr#1 ] +Attempting to uplift remaining variables inzp ZP_BYTE:7 [ irq_sprite_ypos#0 ] +Uplifting [] best 1681 combination zp ZP_BYTE:7 [ irq_sprite_ypos#0 ] +Attempting to uplift remaining variables inzp ZP_BYTE:8 [ irq_sprite_ptr#0 ] +Uplifting [] best 1681 combination zp ZP_BYTE:8 [ irq_sprite_ptr#0 ] +Attempting to uplift remaining variables inzp ZP_BYTE:9 [ irq_cnt#0 ] +Uplifting [] best 1681 combination zp ZP_BYTE:9 [ irq_cnt#0 ] +Attempting to uplift remaining variables inzp ZP_BYTE:6 [ irq_raster_next#0 ] +Uplifting [] best 1681 combination zp ZP_BYTE:6 [ irq_raster_next#0 ] +Coalescing zero page register with common assignment [ zp ZP_BYTE:4 [ irq_raster_next#12 irq_raster_next#2 irq_raster_next#1 ] ] with [ zp ZP_BYTE:6 [ irq_raster_next#0 ] ] - score: 1 +Coalescing zero page register with common assignment [ zp ZP_BYTE:7 [ irq_sprite_ypos#0 ] ] with [ zp ZP_BYTE:15 [ irq_sprite_ypos#2 ] ] - score: 1 +Coalescing zero page register with common assignment [ zp ZP_BYTE:8 [ irq_sprite_ptr#0 ] ] with [ zp ZP_BYTE:16 [ irq_sprite_ptr#2 ] ] - score: 1 +Coalescing zero page register with common assignment [ zp ZP_BYTE:9 [ irq_cnt#0 ] ] with [ zp ZP_BYTE:14 [ irq_cnt#1 ] ] - score: 1 +Coalescing zero page register [ zp ZP_BYTE:7 [ irq_sprite_ypos#0 irq_sprite_ypos#2 ] ] with [ zp ZP_BYTE:19 [ irq_sprite_ypos#1 ] ] +Coalescing zero page register [ zp ZP_BYTE:8 [ irq_sprite_ptr#0 irq_sprite_ptr#2 ] ] with [ zp ZP_BYTE:20 [ irq_sprite_ptr#1 ] ] +Coalescing zero page register [ zp ZP_BYTE:9 [ irq_cnt#0 irq_cnt#1 ] ] with [ zp ZP_BYTE:18 [ irq_cnt#13 ] ] 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#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 ] +Allocated (was zp ZP_BYTE:4) zp ZP_BYTE:3 [ irq_raster_next#12 irq_raster_next#2 irq_raster_next#1 irq_raster_next#0 ] +Allocated (was zp ZP_BYTE:7) zp ZP_BYTE:4 [ irq_sprite_ypos#0 irq_sprite_ypos#2 irq_sprite_ypos#1 ] +Allocated (was zp ZP_BYTE:8) zp ZP_BYTE:5 [ irq_sprite_ptr#0 irq_sprite_ptr#2 irq_sprite_ptr#1 ] +Allocated (was zp ZP_BYTE:9) zp ZP_BYTE:6 [ irq_cnt#0 irq_cnt#1 irq_cnt#13 ] +Interrupt procedure irq clobbers AXCNZV +Removing interrupt register storage sty regy+1 in SEG70 entry interrupt(HARDWARE_CLOBBER) +Removing interrupt register storage regy: in SEG107 [71] return - exit interrupt(HARDWARE_CLOBBER) +Removing interrupt register storage ldy #00 in SEG107 [71] return - exit interrupt(HARDWARE_CLOBBER) ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart @@ -1860,6 +2015,10 @@ ASSEMBLER BEFORE OPTIMIZATION :BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels + .label PROCPORT_DDR = 0 + .const PROCPORT_DDR_MEMORY_MASK = 7 + .label PROCPORT = 1 + .const PROCPORT_RAM_IO = $35 .const SPRITE_PTRS = $3f8 .label SPRITES_XPOS = $d000 .label SPRITES_YPOS = $d001 @@ -1879,13 +2038,13 @@ ASSEMBLER BEFORE OPTIMIZATION .const CIA_INTERRUPT_CLEAR = $7f .label CIA2_PORT_A = $dd00 .label CIA2_PORT_A_DDR = $dd02 - .label KERNEL_IRQ = $314 + .label HARDWARE_IRQ = $fffe .const BLACK = 0 .const DARK_GREY = $b .label PLAYFIELD_SPRITES = $2000 .label PLAYFIELD_CHARSET = $1000 .label PLAYFIELD_SCREEN = $400 - .const IRQ_RASTER_FIRST = $30 + .const IRQ_RASTER_FIRST = $31 .label PLAYFIELD_SPRITE_PTRS = PLAYFIELD_SCREEN+SPRITE_PTRS .const toSpritePtr1_return = PLAYFIELD_SPRITES>>6 .label irq_raster_next = 3 @@ -1933,7 +2092,7 @@ bend: //SEG17 main main: { //SEG18 [10] call init_sprites - //SEG19 [22] phi from main to init_sprites [phi:main->init_sprites] + //SEG19 [26] 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] @@ -1954,229 +2113,266 @@ main: { init_irq: { //SEG26 asm { sei } sei - //SEG27 [15] *((const byte*) CIA1_INTERRUPT#0) ← (const byte) CIA_INTERRUPT_CLEAR#0 -- _deref_pbuc1=vbuc2 + //SEG27 [15] *((const byte*) IRQ_STATUS#0) ← (const byte) IRQ_RASTER#0 -- _deref_pbuc1=vbuc2 + lda #IRQ_RASTER + sta IRQ_STATUS + //SEG28 asm { ldaCIA1_INTERRUPT } + lda CIA1_INTERRUPT + //SEG29 [17] *((const byte*) PROCPORT_DDR#0) ← (const byte) PROCPORT_DDR_MEMORY_MASK#0 -- _deref_pbuc1=vbuc2 + lda #PROCPORT_DDR_MEMORY_MASK + sta PROCPORT_DDR + //SEG30 [18] *((const byte*) PROCPORT#0) ← (const byte) PROCPORT_RAM_IO#0 -- _deref_pbuc1=vbuc2 + lda #PROCPORT_RAM_IO + sta PROCPORT + //SEG31 [19] *((const byte*) CIA1_INTERRUPT#0) ← (const byte) CIA_INTERRUPT_CLEAR#0 -- _deref_pbuc1=vbuc2 lda #CIA_INTERRUPT_CLEAR sta CIA1_INTERRUPT - //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 + //SEG32 [20] *((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 - //SEG29 [17] *((const byte*) RASTER#0) ← (const byte) IRQ_RASTER_FIRST#0 -- _deref_pbuc1=vbuc2 + //SEG33 [21] *((const byte*) RASTER#0) ← (const byte) IRQ_RASTER_FIRST#0 -- _deref_pbuc1=vbuc2 lda #IRQ_RASTER_FIRST sta RASTER - //SEG30 [18] *((const byte*) IRQ_ENABLE#0) ← (const byte) IRQ_RASTER#0 -- _deref_pbuc1=vbuc2 + //SEG34 [22] *((const byte*) IRQ_ENABLE#0) ← (const byte) IRQ_RASTER#0 -- _deref_pbuc1=vbuc2 lda #IRQ_RASTER sta IRQ_ENABLE - //SEG31 [19] *((const void()**) KERNEL_IRQ#0) ← &interrupt(KERNEL_MIN)(void()) irq() -- _deref_pptc1=pprc2 + //SEG35 [23] *((const void()**) HARDWARE_IRQ#0) ← &interrupt(HARDWARE_CLOBBER)(void()) irq() -- _deref_pptc1=pprc2 lda #irq - sta KERNEL_IRQ+1 - //SEG32 asm { cli } + sta HARDWARE_IRQ+1 + //SEG36 asm { cli } cli jmp breturn - //SEG33 init_irq::@return + //SEG37 init_irq::@return breturn: - //SEG34 [21] return + //SEG38 [25] return rts } -//SEG35 init_sprites +//SEG39 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 - //SEG36 init_sprites::vicSelectGfxBank1 + //SEG40 init_sprites::vicSelectGfxBank1 vicSelectGfxBank1: - //SEG37 [23] *((const byte*) CIA2_PORT_A_DDR#0) ← (byte/signed byte/word/signed word/dword/signed dword) 3 -- _deref_pbuc1=vbuc2 + //SEG41 [27] *((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 - //SEG38 [24] phi from init_sprites::vicSelectGfxBank1 to init_sprites::vicSelectGfxBank1_toDd001 [phi:init_sprites::vicSelectGfxBank1->init_sprites::vicSelectGfxBank1_toDd001] + //SEG42 [28] 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 - //SEG39 init_sprites::vicSelectGfxBank1_toDd001 + //SEG43 init_sprites::vicSelectGfxBank1_toDd001 vicSelectGfxBank1_toDd001: jmp vicSelectGfxBank1_b1 - //SEG40 init_sprites::vicSelectGfxBank1_@1 + //SEG44 init_sprites::vicSelectGfxBank1_@1 vicSelectGfxBank1_b1: - //SEG41 [25] *((const byte*) CIA2_PORT_A#0) ← (const byte) init_sprites::vicSelectGfxBank1_toDd001_return#0 -- _deref_pbuc1=vbuc2 + //SEG45 [29] *((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 - //SEG42 [26] phi from init_sprites::vicSelectGfxBank1_@1 to init_sprites::toD0181 [phi:init_sprites::vicSelectGfxBank1_@1->init_sprites::toD0181] + //SEG46 [30] phi from init_sprites::vicSelectGfxBank1_@1 to init_sprites::toD0181 [phi:init_sprites::vicSelectGfxBank1_@1->init_sprites::toD0181] toD0181_from_vicSelectGfxBank1_b1: jmp toD0181 - //SEG43 init_sprites::toD0181 + //SEG47 init_sprites::toD0181 toD0181: jmp b4 - //SEG44 init_sprites::@4 + //SEG48 init_sprites::@4 b4: - //SEG45 [27] *((const byte*) D018#0) ← (const byte) init_sprites::toD0181_return#0 -- _deref_pbuc1=vbuc2 + //SEG49 [31] *((const byte*) D018#0) ← (const byte) init_sprites::toD0181_return#0 -- _deref_pbuc1=vbuc2 lda #toD0181_return sta D018 - //SEG46 [28] *((const byte*) SPRITES_ENABLE#0) ← (byte/signed byte/word/signed word/dword/signed dword) 15 -- _deref_pbuc1=vbuc2 + //SEG50 [32] *((const byte*) SPRITES_ENABLE#0) ← (byte/signed byte/word/signed word/dword/signed dword) 15 -- _deref_pbuc1=vbuc2 lda #$f sta SPRITES_ENABLE - //SEG47 [29] *((const byte*) SPRITES_MC#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2 + //SEG51 [33] *((const byte*) SPRITES_MC#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2 lda #0 sta SPRITES_MC - //SEG48 [30] *((const byte*) SPRITES_EXPAND_Y#0) ← *((const byte*) SPRITES_MC#0) -- _deref_pbuc1=_deref_pbuc2 + //SEG52 [34] *((const byte*) SPRITES_EXPAND_Y#0) ← *((const byte*) SPRITES_MC#0) -- _deref_pbuc1=_deref_pbuc2 lda SPRITES_MC sta SPRITES_EXPAND_Y - //SEG49 [31] *((const byte*) SPRITES_EXPAND_X#0) ← *((const byte*) SPRITES_EXPAND_Y#0) -- _deref_pbuc1=_deref_pbuc2 + //SEG53 [35] *((const byte*) SPRITES_EXPAND_X#0) ← *((const byte*) SPRITES_EXPAND_Y#0) -- _deref_pbuc1=_deref_pbuc2 lda SPRITES_EXPAND_Y sta SPRITES_EXPAND_X - //SEG50 [32] phi from init_sprites::@4 to init_sprites::@1 [phi:init_sprites::@4->init_sprites::@1] + //SEG54 [36] phi from init_sprites::@4 to init_sprites::@1 [phi:init_sprites::@4->init_sprites::@1] b1_from_b4: - //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 + //SEG55 [36] 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 - //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 + //SEG56 [36] 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 - //SEG53 [32] phi from init_sprites::@1 to init_sprites::@1 [phi:init_sprites::@1->init_sprites::@1] + //SEG57 [36] phi from init_sprites::@1 to init_sprites::@1 [phi:init_sprites::@1->init_sprites::@1] b1_from_b1: - //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 + //SEG58 [36] phi (byte) init_sprites::xpos#2 = (byte) init_sprites::xpos#1 [phi:init_sprites::@1->init_sprites::@1#0] -- register_copy + //SEG59 [36] phi (byte) init_sprites::s#2 = (byte) init_sprites::s#1 [phi:init_sprites::@1->init_sprites::@1#1] -- register_copy jmp b1 - //SEG56 init_sprites::@1 + //SEG60 init_sprites::@1 b1: - //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 + //SEG61 [37] (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 - //SEG58 [34] *((const byte*) SPRITES_XPOS#0 + (byte) init_sprites::s2#0) ← (byte) init_sprites::xpos#2 -- pbuc1_derefidx_vbuaa=vbuz1 + //SEG62 [38] *((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 - //SEG59 [35] *((const byte*) SPRITES_COLS#0 + (byte) init_sprites::s#2) ← (const byte) BLACK#0 -- pbuc1_derefidx_vbuxx=vbuc2 + //SEG63 [39] *((const byte*) SPRITES_COLS#0 + (byte) init_sprites::s#2) ← (const byte) BLACK#0 -- pbuc1_derefidx_vbuxx=vbuc2 lda #BLACK sta SPRITES_COLS,x - //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 + //SEG64 [40] (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 - //SEG61 [37] (byte) init_sprites::s#1 ← ++ (byte) init_sprites::s#2 -- vbuxx=_inc_vbuxx + //SEG65 [41] (byte) init_sprites::s#1 ← ++ (byte) init_sprites::s#2 -- vbuxx=_inc_vbuxx inx - //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 + //SEG66 [42] 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 - //SEG63 init_sprites::@return + //SEG67 init_sprites::@return breturn: - //SEG64 [39] return + //SEG68 [43] return rts } -//SEG65 irq +//SEG69 irq irq: { .const toSpritePtr2_return = PLAYFIELD_SPRITES>>6 - //SEG66 entry interrupt(KERNEL_MIN) - //SEG67 [40] *((const byte*) BORDERCOL#0) ← (const byte) DARK_GREY#0 -- _deref_pbuc1=vbuc2 + //SEG70 entry interrupt(HARDWARE_CLOBBER) + sta rega+1 + stx regx+1 + //SEG71 [44] *((const byte*) BORDERCOL#0) ← (const byte) DARK_GREY#0 -- _deref_pbuc1=vbuc2 lda #DARK_GREY sta BORDERCOL - //SEG68 [41] *((const byte*) SPRITES_YPOS#0) ← (byte) irq_sprite_ypos#0 -- _deref_pbuc1=vbuz1 + //SEG72 [45] *((const byte*) SPRITES_YPOS#0) ← (byte) irq_sprite_ypos#0 -- _deref_pbuc1=vbuz1 lda irq_sprite_ypos sta SPRITES_YPOS - //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 + //SEG73 [46] *((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 - //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 + //SEG74 [47] *((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 - //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 + //SEG75 [48] *((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 - //SEG72 irq::@1 + //SEG76 irq::@1 b1: - //SEG73 [45] if(*((const byte*) RASTER#0)!=(byte) irq_sprite_ypos#0) goto irq::@1 -- _deref_pbuc1_neq_vbuz1_then_la1 + //SEG77 [49] 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 - //SEG74 irq::@4 - b4: - //SEG75 [46] (byte) irq::ptr#0 ← (byte) irq_sprite_ptr#0 -- vbuxx=vbuz1 - ldx irq_sprite_ptr - //SEG76 [47] *((const byte*) PLAYFIELD_SPRITE_PTRS#0) ← (byte) irq::ptr#0 -- _deref_pbuc1=vbuxx - stx PLAYFIELD_SPRITE_PTRS - //SEG77 [48] (byte) irq::ptr#1 ← ++ (byte) irq::ptr#0 -- vbuxx=_inc_vbuxx + jmp b5 + //SEG78 irq::@5 + b5: + //SEG79 [50] (byte) irq::ptr#0 ← (byte) irq_sprite_ptr#0 -- vbuaa=vbuz1 + lda irq_sprite_ptr + //SEG80 [51] *((const byte*) PLAYFIELD_SPRITE_PTRS#0) ← (byte) irq::ptr#0 -- _deref_pbuc1=vbuaa + sta PLAYFIELD_SPRITE_PTRS + //SEG81 [52] (byte) irq::ptr#1 ← ++ (byte) irq::ptr#0 -- vbuxx=_inc_vbuaa + tax inx - //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 + //SEG82 [53] *((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 - //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 + //SEG83 [54] *((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 - //SEG80 [51] (byte) irq::ptr#2 ← ++ (byte) irq::ptr#1 -- vbuxx=_inc_vbuxx + //SEG84 [55] (byte) irq::ptr#2 ← ++ (byte) irq::ptr#1 -- vbuxx=_inc_vbuxx inx - //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 + //SEG85 [56] *((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 - //SEG82 [53] (byte) irq_cnt#1 ← ++ (byte) irq_cnt#0 -- vbuz1=_inc_vbuz1 + //SEG86 [57] (byte) irq_cnt#1 ← ++ (byte) irq_cnt#0 -- vbuz1=_inc_vbuz1 inc irq_cnt - //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 + //SEG87 [58] 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 - //SEG84 irq::@5 - b5: - //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 + jmp b6 + //SEG88 irq::@6 + b6: + //SEG89 [59] (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 - //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 + //SEG90 [60] (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 - //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 + //SEG91 [61] (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 - //SEG88 [58] phi from irq::@5 irq::@7 to irq::@3 [phi:irq::@5/irq::@7->irq::@3] - b3_from_b5: - b3_from_b7: - //SEG89 [58] phi (byte) irq_raster_next#3 = (byte) irq_raster_next#2 [phi:irq::@5/irq::@7->irq::@3#0] -- register_copy + //SEG92 [62] phi from irq::@6 irq::@9 to irq::@3 [phi:irq::@6/irq::@9->irq::@3] + b3_from_b6: + b3_from_b9: + //SEG93 [62] phi (byte) irq_raster_next#12 = (byte) irq_raster_next#2 [phi:irq::@6/irq::@9->irq::@3#0] -- register_copy jmp b3 - //SEG90 irq::@3 + //SEG94 irq::@3 b3: - //SEG91 [59] *((const byte*) RASTER#0) ← (byte) irq_raster_next#3 -- _deref_pbuc1=vbuz1 - lda irq_raster_next - sta RASTER - //SEG92 [60] *((const byte*) IRQ_STATUS#0) ← (const byte) IRQ_RASTER#0 -- _deref_pbuc1=vbuc2 + //SEG95 [63] (byte) irq::raster_next#0 ← (byte) irq_raster_next#12 -- vbuxx=vbuz1 + ldx irq_raster_next + //SEG96 [64] (byte~) irq::$3 ← (byte) irq::raster_next#0 & (byte/signed byte/word/signed word/dword/signed dword) 7 -- vbuaa=vbuxx_band_vbuc1 + txa + and #7 + //SEG97 [65] if((byte~) irq::$3!=(byte/signed byte/word/signed word/dword/signed dword) 3) goto irq::@4 -- vbuaa_neq_vbuc1_then_la1 + cmp #3 + bne b4_from_b3 + jmp b8 + //SEG98 irq::@8 + b8: + //SEG99 [66] (byte) irq::raster_next#1 ← (byte) irq::raster_next#0 - (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuxx=vbuxx_minus_1 + dex + //SEG100 [67] phi from irq::@3 irq::@8 to irq::@4 [phi:irq::@3/irq::@8->irq::@4] + b4_from_b3: + b4_from_b8: + //SEG101 [67] phi (byte) irq::raster_next#2 = (byte) irq::raster_next#0 [phi:irq::@3/irq::@8->irq::@4#0] -- register_copy + jmp b4 + //SEG102 irq::@4 + b4: + //SEG103 [68] *((const byte*) RASTER#0) ← (byte) irq::raster_next#2 -- _deref_pbuc1=vbuxx + stx RASTER + //SEG104 [69] *((const byte*) IRQ_STATUS#0) ← (const byte) IRQ_RASTER#0 -- _deref_pbuc1=vbuc2 lda #IRQ_RASTER sta IRQ_STATUS - //SEG93 [61] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 -- _deref_pbuc1=vbuc2 + //SEG105 [70] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 -- _deref_pbuc1=vbuc2 lda #BLACK sta BORDERCOL jmp breturn - //SEG94 irq::@return + //SEG106 irq::@return breturn: - //SEG95 [62] return - exit interrupt(KERNEL_MIN) - jmp $ea81 - //SEG96 irq::@2 + //SEG107 [71] return - exit interrupt(HARDWARE_CLOBBER) + rega: + lda #00 + regx: + ldx #00 + rti + //SEG108 irq::@2 b2: - //SEG97 [63] (byte) irq_cnt#10 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1 + //SEG109 [72] (byte) irq_cnt#13 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1 lda #0 sta irq_cnt - //SEG98 [64] (byte) irq_raster_next#1 ← (const byte) IRQ_RASTER_FIRST#0 -- vbuz1=vbuc1 + //SEG110 [73] (byte) irq_raster_next#1 ← (const byte) IRQ_RASTER_FIRST#0 -- vbuz1=vbuc1 lda #IRQ_RASTER_FIRST sta irq_raster_next - //SEG99 [65] (byte) irq_sprite_ypos#1 ← (byte/signed byte/word/signed word/dword/signed dword) 50 -- vbuz1=vbuc1 + //SEG111 [74] (byte) irq_sprite_ypos#1 ← (byte/signed byte/word/signed word/dword/signed dword) 50 -- vbuz1=vbuc1 lda #$32 sta irq_sprite_ypos - //SEG100 [66] phi from irq::@2 to irq::toSpritePtr2 [phi:irq::@2->irq::toSpritePtr2] + //SEG112 [75] phi from irq::@2 to irq::toSpritePtr2 [phi:irq::@2->irq::toSpritePtr2] toSpritePtr2_from_b2: jmp toSpritePtr2 - //SEG101 irq::toSpritePtr2 + //SEG113 irq::toSpritePtr2 toSpritePtr2: - jmp b7 - //SEG102 irq::@7 - b7: - //SEG103 [67] (byte) irq_sprite_ptr#1 ← (const byte) irq::toSpritePtr2_return#0 -- vbuz1=vbuc1 + jmp b9 + //SEG114 irq::@9 + b9: + //SEG115 [76] (byte) irq_sprite_ptr#1 ← (const byte) irq::toSpritePtr2_return#0 -- vbuz1=vbuc1 lda #toSpritePtr2_return sta irq_sprite_ptr - jmp b3_from_b7 + jmp b3_from_b9 } .pc = PLAYFIELD_SPRITES "Inline" .var sprites = LoadPicture("nes-playfield.png", List().add($010101, $000000)) @@ -2209,18 +2405,21 @@ Removing instruction jmp b4 Removing instruction jmp b1 Removing instruction jmp breturn Removing instruction jmp b1 -Removing instruction jmp b4 Removing instruction jmp b5 +Removing instruction jmp b6 Removing instruction jmp b3 +Removing instruction jmp b8 +Removing instruction jmp b4 Removing instruction jmp breturn Removing instruction jmp toSpritePtr2 -Removing instruction jmp b7 +Removing instruction jmp b9 Succesful ASM optimization Pass5NextJumpElimination Removing instruction lda SPRITES_MC Removing instruction lda SPRITES_EXPAND_Y Succesful ASM optimization Pass5UnnecesaryLoadElimination Replacing label b1_from_b1 with b1 -Replacing label b3_from_b7 with b3 +Replacing label b4_from_b3 with b4 +Replacing label b3_from_b9 with b3 Removing instruction b6: Removing instruction toSpritePtr1_from_b6: Removing instruction toSpritePtr1: @@ -2232,8 +2431,11 @@ Removing instruction vicSelectGfxBank1_toDd001: Removing instruction toD0181_from_vicSelectGfxBank1_b1: Removing instruction toD0181: Removing instruction b1_from_b1: -Removing instruction b3_from_b5: -Removing instruction b3_from_b7: +Removing instruction b3_from_b6: +Removing instruction b3_from_b9: +Removing instruction b4_from_b3: +Removing instruction b4_from_b8: +Removing instruction breturn: Removing instruction toSpritePtr2_from_b2: Removing instruction toSpritePtr2: Succesful ASM optimization Pass5RedundantLabelElimination @@ -2248,10 +2450,10 @@ Removing instruction vicSelectGfxBank1_b1: Removing instruction b4: Removing instruction b1_from_b4: Removing instruction breturn: -Removing instruction b4: Removing instruction b5: -Removing instruction breturn: -Removing instruction b7: +Removing instruction b6: +Removing instruction b8: +Removing instruction b9: Succesful ASM optimization Pass5UnusedLabelElimination Removing instruction jmp b1 Succesful ASM optimization Pass5NextJumpElimination @@ -2300,6 +2502,7 @@ FINAL SYMBOL TABLE (byte) GREEN (byte) GREY (void()**) HARDWARE_IRQ +(const void()**) HARDWARE_IRQ#0 HARDWARE_IRQ = ((void()**))(word/dword/signed dword) 65534 (byte) IRQ_COLLISION_BG (byte) IRQ_COLLISION_SPRITE (byte*) IRQ_ENABLE @@ -2308,11 +2511,10 @@ FINAL SYMBOL TABLE (byte) IRQ_RASTER (const byte) IRQ_RASTER#0 IRQ_RASTER = (byte/signed byte/word/signed word/dword/signed dword) 1 (byte) IRQ_RASTER_FIRST -(const byte) IRQ_RASTER_FIRST#0 IRQ_RASTER_FIRST = (byte/signed byte/word/signed word/dword/signed dword) 48 +(const byte) IRQ_RASTER_FIRST#0 IRQ_RASTER_FIRST = (byte/signed byte/word/signed word/dword/signed dword) 49 (byte*) IRQ_STATUS (const byte*) IRQ_STATUS#0 IRQ_STATUS = ((byte*))(word/dword/signed dword) 53273 (void()**) KERNEL_IRQ -(const void()**) KERNEL_IRQ#0 KERNEL_IRQ = ((void()**))(word/signed word/dword/signed dword) 788 (byte*) LIGHTPEN_X (byte*) LIGHTPEN_Y (byte) LIGHT_BLUE @@ -2329,13 +2531,17 @@ FINAL SYMBOL TABLE (byte*) PLAYFIELD_SPRITE_PTRS (const byte*) PLAYFIELD_SPRITE_PTRS#0 PLAYFIELD_SPRITE_PTRS = (const byte*) PLAYFIELD_SCREEN#0+(const word) SPRITE_PTRS#0 (byte*) PROCPORT +(const byte*) PROCPORT#0 PROCPORT = ((byte*))(byte/signed byte/word/signed word/dword/signed dword) 1 (byte) PROCPORT_BASIC_KERNEL_IO (byte*) PROCPORT_DDR +(const byte*) PROCPORT_DDR#0 PROCPORT_DDR = ((byte*))(byte/signed byte/word/signed word/dword/signed dword) 0 (byte) PROCPORT_DDR_MEMORY_MASK +(const byte) PROCPORT_DDR_MEMORY_MASK#0 PROCPORT_DDR_MEMORY_MASK = (byte/signed byte/word/signed word/dword/signed dword) 7 (byte) PROCPORT_KERNEL_IO (byte) PROCPORT_RAM_ALL (byte) PROCPORT_RAM_CHARROM (byte) PROCPORT_RAM_IO +(const byte) PROCPORT_RAM_IO#0 PROCPORT_RAM_IO = (byte/signed byte/word/signed word/dword/signed dword) 53 (byte) PURPLE (byte*) RASTER (const byte*) RASTER#0 RASTER = ((byte*))(word/dword/signed dword) 53266 @@ -2413,18 +2619,25 @@ FINAL SYMBOL TABLE (byte) init_sprites::xpos (byte) init_sprites::xpos#1 xpos zp ZP_BYTE:2 7.333333333333333 (byte) init_sprites::xpos#2 xpos zp ZP_BYTE:2 8.25 -interrupt(KERNEL_MIN)(void()) irq() +interrupt(HARDWARE_CLOBBER)(void()) irq() +(byte~) irq::$3 reg byte a 4.0 (label) irq::@1 (label) irq::@2 (label) irq::@3 (label) irq::@4 (label) irq::@5 -(label) irq::@7 +(label) irq::@6 +(label) irq::@8 +(label) irq::@9 (label) irq::@return (byte) irq::ptr -(byte) irq::ptr#0 reg byte x 3.0 +(byte) irq::ptr#0 reg byte a 3.0 (byte) irq::ptr#1 reg byte x 2.6666666666666665 (byte) irq::ptr#2 reg byte x 4.0 +(byte) irq::raster_next +(byte) irq::raster_next#0 reg byte x 2.6666666666666665 +(byte) irq::raster_next#1 reg byte x 4.0 +(byte) irq::raster_next#2 reg byte x 6.0 (label) irq::toSpritePtr2 (word~) irq::toSpritePtr2_$0 (word~) irq::toSpritePtr2_$1 @@ -2435,12 +2648,12 @@ interrupt(KERNEL_MIN)(void()) irq() (byte) irq_cnt (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_cnt#13 irq_cnt zp ZP_BYTE:6 20.0 (byte) irq_raster_next (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#12 irq_raster_next zp ZP_BYTE:3 6.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#0 irq_sprite_ptr zp ZP_BYTE:5 0.3529411764705882 (byte) irq_sprite_ptr#1 irq_sprite_ptr zp ZP_BYTE:5 20.0 @@ -2462,24 +2675,30 @@ 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#3 irq_raster_next#2 irq_raster_next#1 irq_raster_next#0 ] +zp ZP_BYTE:3 [ irq_raster_next#12 irq_raster_next#2 irq_raster_next#1 irq_raster_next#0 ] +reg byte x [ irq::raster_next#2 irq::raster_next#0 irq::raster_next#1 ] 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 ] +zp ZP_BYTE:6 [ irq_cnt#0 irq_cnt#1 irq_cnt#13 ] reg byte a [ init_sprites::s2#0 ] -reg byte x [ irq::ptr#0 ] +reg byte a [ irq::ptr#0 ] reg byte x [ irq::ptr#1 ] reg byte x [ irq::ptr#2 ] +reg byte a [ irq::$3 ] FINAL ASSEMBLER -Score: 1162 +Score: 1283 //SEG0 Basic Upstart .pc = $801 "Basic" :BasicUpstart(bbegin) .pc = $80d "Program" //SEG1 Global Constants & labels + .label PROCPORT_DDR = 0 + .const PROCPORT_DDR_MEMORY_MASK = 7 + .label PROCPORT = 1 + .const PROCPORT_RAM_IO = $35 .const SPRITE_PTRS = $3f8 .label SPRITES_XPOS = $d000 .label SPRITES_YPOS = $d001 @@ -2499,13 +2718,13 @@ Score: 1162 .const CIA_INTERRUPT_CLEAR = $7f .label CIA2_PORT_A = $dd00 .label CIA2_PORT_A_DDR = $dd02 - .label KERNEL_IRQ = $314 + .label HARDWARE_IRQ = $fffe .const BLACK = 0 .const DARK_GREY = $b .label PLAYFIELD_SPRITES = $2000 .label PLAYFIELD_CHARSET = $1000 .label PLAYFIELD_SCREEN = $400 - .const IRQ_RASTER_FIRST = $30 + .const IRQ_RASTER_FIRST = $31 .label PLAYFIELD_SPRITE_PTRS = PLAYFIELD_SCREEN+SPRITE_PTRS .const toSpritePtr1_return = PLAYFIELD_SPRITES>>6 .label irq_raster_next = 3 @@ -2540,7 +2759,7 @@ bbegin: //SEG17 main main: { //SEG18 [10] call init_sprites - //SEG19 [22] phi from main to init_sprites [phi:main->init_sprites] + //SEG19 [26] 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 @@ -2556,189 +2775,221 @@ main: { init_irq: { //SEG26 asm { sei } sei - //SEG27 [15] *((const byte*) CIA1_INTERRUPT#0) ← (const byte) CIA_INTERRUPT_CLEAR#0 -- _deref_pbuc1=vbuc2 + //SEG27 [15] *((const byte*) IRQ_STATUS#0) ← (const byte) IRQ_RASTER#0 -- _deref_pbuc1=vbuc2 + lda #IRQ_RASTER + sta IRQ_STATUS + //SEG28 asm { ldaCIA1_INTERRUPT } + lda CIA1_INTERRUPT + //SEG29 [17] *((const byte*) PROCPORT_DDR#0) ← (const byte) PROCPORT_DDR_MEMORY_MASK#0 -- _deref_pbuc1=vbuc2 + lda #PROCPORT_DDR_MEMORY_MASK + sta PROCPORT_DDR + //SEG30 [18] *((const byte*) PROCPORT#0) ← (const byte) PROCPORT_RAM_IO#0 -- _deref_pbuc1=vbuc2 + lda #PROCPORT_RAM_IO + sta PROCPORT + //SEG31 [19] *((const byte*) CIA1_INTERRUPT#0) ← (const byte) CIA_INTERRUPT_CLEAR#0 -- _deref_pbuc1=vbuc2 lda #CIA_INTERRUPT_CLEAR sta CIA1_INTERRUPT - //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 + //SEG32 [20] *((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 - //SEG29 [17] *((const byte*) RASTER#0) ← (const byte) IRQ_RASTER_FIRST#0 -- _deref_pbuc1=vbuc2 + //SEG33 [21] *((const byte*) RASTER#0) ← (const byte) IRQ_RASTER_FIRST#0 -- _deref_pbuc1=vbuc2 lda #IRQ_RASTER_FIRST sta RASTER - //SEG30 [18] *((const byte*) IRQ_ENABLE#0) ← (const byte) IRQ_RASTER#0 -- _deref_pbuc1=vbuc2 + //SEG34 [22] *((const byte*) IRQ_ENABLE#0) ← (const byte) IRQ_RASTER#0 -- _deref_pbuc1=vbuc2 lda #IRQ_RASTER sta IRQ_ENABLE - //SEG31 [19] *((const void()**) KERNEL_IRQ#0) ← &interrupt(KERNEL_MIN)(void()) irq() -- _deref_pptc1=pprc2 + //SEG35 [23] *((const void()**) HARDWARE_IRQ#0) ← &interrupt(HARDWARE_CLOBBER)(void()) irq() -- _deref_pptc1=pprc2 lda #irq - sta KERNEL_IRQ+1 - //SEG32 asm { cli } + sta HARDWARE_IRQ+1 + //SEG36 asm { cli } cli - //SEG33 init_irq::@return - //SEG34 [21] return + //SEG37 init_irq::@return + //SEG38 [25] return rts } -//SEG35 init_sprites +//SEG39 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 - //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 + //SEG40 init_sprites::vicSelectGfxBank1 + //SEG41 [27] *((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 - //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 + //SEG42 [28] phi from init_sprites::vicSelectGfxBank1 to init_sprites::vicSelectGfxBank1_toDd001 [phi:init_sprites::vicSelectGfxBank1->init_sprites::vicSelectGfxBank1_toDd001] + //SEG43 init_sprites::vicSelectGfxBank1_toDd001 + //SEG44 init_sprites::vicSelectGfxBank1_@1 + //SEG45 [29] *((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 - //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 + //SEG46 [30] phi from init_sprites::vicSelectGfxBank1_@1 to init_sprites::toD0181 [phi:init_sprites::vicSelectGfxBank1_@1->init_sprites::toD0181] + //SEG47 init_sprites::toD0181 + //SEG48 init_sprites::@4 + //SEG49 [31] *((const byte*) D018#0) ← (const byte) init_sprites::toD0181_return#0 -- _deref_pbuc1=vbuc2 lda #toD0181_return sta D018 - //SEG46 [28] *((const byte*) SPRITES_ENABLE#0) ← (byte/signed byte/word/signed word/dword/signed dword) 15 -- _deref_pbuc1=vbuc2 + //SEG50 [32] *((const byte*) SPRITES_ENABLE#0) ← (byte/signed byte/word/signed word/dword/signed dword) 15 -- _deref_pbuc1=vbuc2 lda #$f sta SPRITES_ENABLE - //SEG47 [29] *((const byte*) SPRITES_MC#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2 + //SEG51 [33] *((const byte*) SPRITES_MC#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2 lda #0 sta SPRITES_MC - //SEG48 [30] *((const byte*) SPRITES_EXPAND_Y#0) ← *((const byte*) SPRITES_MC#0) -- _deref_pbuc1=_deref_pbuc2 + //SEG52 [34] *((const byte*) SPRITES_EXPAND_Y#0) ← *((const byte*) SPRITES_MC#0) -- _deref_pbuc1=_deref_pbuc2 sta SPRITES_EXPAND_Y - //SEG49 [31] *((const byte*) SPRITES_EXPAND_X#0) ← *((const byte*) SPRITES_EXPAND_Y#0) -- _deref_pbuc1=_deref_pbuc2 + //SEG53 [35] *((const byte*) SPRITES_EXPAND_X#0) ← *((const byte*) SPRITES_EXPAND_Y#0) -- _deref_pbuc1=_deref_pbuc2 sta SPRITES_EXPAND_X - //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 + //SEG54 [36] phi from init_sprites::@4 to init_sprites::@1 [phi:init_sprites::@4->init_sprites::@1] + //SEG55 [36] 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 - //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 + //SEG56 [36] 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 - //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 + //SEG57 [36] phi from init_sprites::@1 to init_sprites::@1 [phi:init_sprites::@1->init_sprites::@1] + //SEG58 [36] phi (byte) init_sprites::xpos#2 = (byte) init_sprites::xpos#1 [phi:init_sprites::@1->init_sprites::@1#0] -- register_copy + //SEG59 [36] phi (byte) init_sprites::s#2 = (byte) init_sprites::s#1 [phi:init_sprites::@1->init_sprites::@1#1] -- register_copy + //SEG60 init_sprites::@1 b1: - //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 + //SEG61 [37] (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 - //SEG58 [34] *((const byte*) SPRITES_XPOS#0 + (byte) init_sprites::s2#0) ← (byte) init_sprites::xpos#2 -- pbuc1_derefidx_vbuaa=vbuz1 + //SEG62 [38] *((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 - //SEG59 [35] *((const byte*) SPRITES_COLS#0 + (byte) init_sprites::s#2) ← (const byte) BLACK#0 -- pbuc1_derefidx_vbuxx=vbuc2 + //SEG63 [39] *((const byte*) SPRITES_COLS#0 + (byte) init_sprites::s#2) ← (const byte) BLACK#0 -- pbuc1_derefidx_vbuxx=vbuc2 lda #BLACK sta SPRITES_COLS,x - //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 + //SEG64 [40] (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 - //SEG61 [37] (byte) init_sprites::s#1 ← ++ (byte) init_sprites::s#2 -- vbuxx=_inc_vbuxx + //SEG65 [41] (byte) init_sprites::s#1 ← ++ (byte) init_sprites::s#2 -- vbuxx=_inc_vbuxx inx - //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 + //SEG66 [42] 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 - //SEG63 init_sprites::@return - //SEG64 [39] return + //SEG67 init_sprites::@return + //SEG68 [43] return rts } -//SEG65 irq +//SEG69 irq irq: { .const toSpritePtr2_return = PLAYFIELD_SPRITES>>6 - //SEG66 entry interrupt(KERNEL_MIN) - //SEG67 [40] *((const byte*) BORDERCOL#0) ← (const byte) DARK_GREY#0 -- _deref_pbuc1=vbuc2 + //SEG70 entry interrupt(HARDWARE_CLOBBER) + sta rega+1 + stx regx+1 + //SEG71 [44] *((const byte*) BORDERCOL#0) ← (const byte) DARK_GREY#0 -- _deref_pbuc1=vbuc2 lda #DARK_GREY sta BORDERCOL - //SEG68 [41] *((const byte*) SPRITES_YPOS#0) ← (byte) irq_sprite_ypos#0 -- _deref_pbuc1=vbuz1 + //SEG72 [45] *((const byte*) SPRITES_YPOS#0) ← (byte) irq_sprite_ypos#0 -- _deref_pbuc1=vbuz1 lda irq_sprite_ypos sta SPRITES_YPOS - //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 + //SEG73 [46] *((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 - //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 + //SEG74 [47] *((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 - //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 + //SEG75 [48] *((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 - //SEG72 irq::@1 + //SEG76 irq::@1 b1: - //SEG73 [45] if(*((const byte*) RASTER#0)!=(byte) irq_sprite_ypos#0) goto irq::@1 -- _deref_pbuc1_neq_vbuz1_then_la1 + //SEG77 [49] 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 - //SEG74 irq::@4 - //SEG75 [46] (byte) irq::ptr#0 ← (byte) irq_sprite_ptr#0 -- vbuxx=vbuz1 - ldx irq_sprite_ptr - //SEG76 [47] *((const byte*) PLAYFIELD_SPRITE_PTRS#0) ← (byte) irq::ptr#0 -- _deref_pbuc1=vbuxx - stx PLAYFIELD_SPRITE_PTRS - //SEG77 [48] (byte) irq::ptr#1 ← ++ (byte) irq::ptr#0 -- vbuxx=_inc_vbuxx + //SEG78 irq::@5 + //SEG79 [50] (byte) irq::ptr#0 ← (byte) irq_sprite_ptr#0 -- vbuaa=vbuz1 + lda irq_sprite_ptr + //SEG80 [51] *((const byte*) PLAYFIELD_SPRITE_PTRS#0) ← (byte) irq::ptr#0 -- _deref_pbuc1=vbuaa + sta PLAYFIELD_SPRITE_PTRS + //SEG81 [52] (byte) irq::ptr#1 ← ++ (byte) irq::ptr#0 -- vbuxx=_inc_vbuaa + tax inx - //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 + //SEG82 [53] *((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 - //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 + //SEG83 [54] *((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 - //SEG80 [51] (byte) irq::ptr#2 ← ++ (byte) irq::ptr#1 -- vbuxx=_inc_vbuxx + //SEG84 [55] (byte) irq::ptr#2 ← ++ (byte) irq::ptr#1 -- vbuxx=_inc_vbuxx inx - //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 + //SEG85 [56] *((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 - //SEG82 [53] (byte) irq_cnt#1 ← ++ (byte) irq_cnt#0 -- vbuz1=_inc_vbuz1 + //SEG86 [57] (byte) irq_cnt#1 ← ++ (byte) irq_cnt#0 -- vbuz1=_inc_vbuz1 inc irq_cnt - //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 + //SEG87 [58] 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 - //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 + //SEG88 irq::@6 + //SEG89 [59] (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 - //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 + //SEG90 [60] (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 - //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 + //SEG91 [61] (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 - //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 + //SEG92 [62] phi from irq::@6 irq::@9 to irq::@3 [phi:irq::@6/irq::@9->irq::@3] + //SEG93 [62] phi (byte) irq_raster_next#12 = (byte) irq_raster_next#2 [phi:irq::@6/irq::@9->irq::@3#0] -- register_copy + //SEG94 irq::@3 b3: - //SEG91 [59] *((const byte*) RASTER#0) ← (byte) irq_raster_next#3 -- _deref_pbuc1=vbuz1 - lda irq_raster_next - sta RASTER - //SEG92 [60] *((const byte*) IRQ_STATUS#0) ← (const byte) IRQ_RASTER#0 -- _deref_pbuc1=vbuc2 + //SEG95 [63] (byte) irq::raster_next#0 ← (byte) irq_raster_next#12 -- vbuxx=vbuz1 + ldx irq_raster_next + //SEG96 [64] (byte~) irq::$3 ← (byte) irq::raster_next#0 & (byte/signed byte/word/signed word/dword/signed dword) 7 -- vbuaa=vbuxx_band_vbuc1 + txa + and #7 + //SEG97 [65] if((byte~) irq::$3!=(byte/signed byte/word/signed word/dword/signed dword) 3) goto irq::@4 -- vbuaa_neq_vbuc1_then_la1 + cmp #3 + bne b4 + //SEG98 irq::@8 + //SEG99 [66] (byte) irq::raster_next#1 ← (byte) irq::raster_next#0 - (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuxx=vbuxx_minus_1 + dex + //SEG100 [67] phi from irq::@3 irq::@8 to irq::@4 [phi:irq::@3/irq::@8->irq::@4] + //SEG101 [67] phi (byte) irq::raster_next#2 = (byte) irq::raster_next#0 [phi:irq::@3/irq::@8->irq::@4#0] -- register_copy + //SEG102 irq::@4 + b4: + //SEG103 [68] *((const byte*) RASTER#0) ← (byte) irq::raster_next#2 -- _deref_pbuc1=vbuxx + stx RASTER + //SEG104 [69] *((const byte*) IRQ_STATUS#0) ← (const byte) IRQ_RASTER#0 -- _deref_pbuc1=vbuc2 lda #IRQ_RASTER sta IRQ_STATUS - //SEG93 [61] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 -- _deref_pbuc1=vbuc2 + //SEG105 [70] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 -- _deref_pbuc1=vbuc2 lda #BLACK sta BORDERCOL - //SEG94 irq::@return - //SEG95 [62] return - exit interrupt(KERNEL_MIN) - jmp $ea81 - //SEG96 irq::@2 + //SEG106 irq::@return + //SEG107 [71] return - exit interrupt(HARDWARE_CLOBBER) + rega: + lda #00 + regx: + ldx #00 + rti + //SEG108 irq::@2 b2: - //SEG97 [63] (byte) irq_cnt#10 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1 + //SEG109 [72] (byte) irq_cnt#13 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1 lda #0 sta irq_cnt - //SEG98 [64] (byte) irq_raster_next#1 ← (const byte) IRQ_RASTER_FIRST#0 -- vbuz1=vbuc1 + //SEG110 [73] (byte) irq_raster_next#1 ← (const byte) IRQ_RASTER_FIRST#0 -- vbuz1=vbuc1 lda #IRQ_RASTER_FIRST sta irq_raster_next - //SEG99 [65] (byte) irq_sprite_ypos#1 ← (byte/signed byte/word/signed word/dword/signed dword) 50 -- vbuz1=vbuc1 + //SEG111 [74] (byte) irq_sprite_ypos#1 ← (byte/signed byte/word/signed word/dword/signed dword) 50 -- vbuz1=vbuc1 lda #$32 sta irq_sprite_ypos - //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 + //SEG112 [75] phi from irq::@2 to irq::toSpritePtr2 [phi:irq::@2->irq::toSpritePtr2] + //SEG113 irq::toSpritePtr2 + //SEG114 irq::@9 + //SEG115 [76] (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 e8c234540..506bcb66b 100644 --- a/src/test/ref/examples/tetris/test-sprites.sym +++ b/src/test/ref/examples/tetris/test-sprites.sym @@ -41,6 +41,7 @@ (byte) GREEN (byte) GREY (void()**) HARDWARE_IRQ +(const void()**) HARDWARE_IRQ#0 HARDWARE_IRQ = ((void()**))(word/dword/signed dword) 65534 (byte) IRQ_COLLISION_BG (byte) IRQ_COLLISION_SPRITE (byte*) IRQ_ENABLE @@ -49,11 +50,10 @@ (byte) IRQ_RASTER (const byte) IRQ_RASTER#0 IRQ_RASTER = (byte/signed byte/word/signed word/dword/signed dword) 1 (byte) IRQ_RASTER_FIRST -(const byte) IRQ_RASTER_FIRST#0 IRQ_RASTER_FIRST = (byte/signed byte/word/signed word/dword/signed dword) 48 +(const byte) IRQ_RASTER_FIRST#0 IRQ_RASTER_FIRST = (byte/signed byte/word/signed word/dword/signed dword) 49 (byte*) IRQ_STATUS (const byte*) IRQ_STATUS#0 IRQ_STATUS = ((byte*))(word/dword/signed dword) 53273 (void()**) KERNEL_IRQ -(const void()**) KERNEL_IRQ#0 KERNEL_IRQ = ((void()**))(word/signed word/dword/signed dword) 788 (byte*) LIGHTPEN_X (byte*) LIGHTPEN_Y (byte) LIGHT_BLUE @@ -70,13 +70,17 @@ (byte*) PLAYFIELD_SPRITE_PTRS (const byte*) PLAYFIELD_SPRITE_PTRS#0 PLAYFIELD_SPRITE_PTRS = (const byte*) PLAYFIELD_SCREEN#0+(const word) SPRITE_PTRS#0 (byte*) PROCPORT +(const byte*) PROCPORT#0 PROCPORT = ((byte*))(byte/signed byte/word/signed word/dword/signed dword) 1 (byte) PROCPORT_BASIC_KERNEL_IO (byte*) PROCPORT_DDR +(const byte*) PROCPORT_DDR#0 PROCPORT_DDR = ((byte*))(byte/signed byte/word/signed word/dword/signed dword) 0 (byte) PROCPORT_DDR_MEMORY_MASK +(const byte) PROCPORT_DDR_MEMORY_MASK#0 PROCPORT_DDR_MEMORY_MASK = (byte/signed byte/word/signed word/dword/signed dword) 7 (byte) PROCPORT_KERNEL_IO (byte) PROCPORT_RAM_ALL (byte) PROCPORT_RAM_CHARROM (byte) PROCPORT_RAM_IO +(const byte) PROCPORT_RAM_IO#0 PROCPORT_RAM_IO = (byte/signed byte/word/signed word/dword/signed dword) 53 (byte) PURPLE (byte*) RASTER (const byte*) RASTER#0 RASTER = ((byte*))(word/dword/signed dword) 53266 @@ -154,18 +158,25 @@ (byte) init_sprites::xpos (byte) init_sprites::xpos#1 xpos zp ZP_BYTE:2 7.333333333333333 (byte) init_sprites::xpos#2 xpos zp ZP_BYTE:2 8.25 -interrupt(KERNEL_MIN)(void()) irq() +interrupt(HARDWARE_CLOBBER)(void()) irq() +(byte~) irq::$3 reg byte a 4.0 (label) irq::@1 (label) irq::@2 (label) irq::@3 (label) irq::@4 (label) irq::@5 -(label) irq::@7 +(label) irq::@6 +(label) irq::@8 +(label) irq::@9 (label) irq::@return (byte) irq::ptr -(byte) irq::ptr#0 reg byte x 3.0 +(byte) irq::ptr#0 reg byte a 3.0 (byte) irq::ptr#1 reg byte x 2.6666666666666665 (byte) irq::ptr#2 reg byte x 4.0 +(byte) irq::raster_next +(byte) irq::raster_next#0 reg byte x 2.6666666666666665 +(byte) irq::raster_next#1 reg byte x 4.0 +(byte) irq::raster_next#2 reg byte x 6.0 (label) irq::toSpritePtr2 (word~) irq::toSpritePtr2_$0 (word~) irq::toSpritePtr2_$1 @@ -176,12 +187,12 @@ interrupt(KERNEL_MIN)(void()) irq() (byte) irq_cnt (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_cnt#13 irq_cnt zp ZP_BYTE:6 20.0 (byte) irq_raster_next (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#12 irq_raster_next zp ZP_BYTE:3 6.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#0 irq_sprite_ptr zp ZP_BYTE:5 0.3529411764705882 (byte) irq_sprite_ptr#1 irq_sprite_ptr zp ZP_BYTE:5 20.0 @@ -203,11 +214,13 @@ 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#3 irq_raster_next#2 irq_raster_next#1 irq_raster_next#0 ] +zp ZP_BYTE:3 [ irq_raster_next#12 irq_raster_next#2 irq_raster_next#1 irq_raster_next#0 ] +reg byte x [ irq::raster_next#2 irq::raster_next#0 irq::raster_next#1 ] 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 ] +zp ZP_BYTE:6 [ irq_cnt#0 irq_cnt#1 irq_cnt#13 ] reg byte a [ init_sprites::s2#0 ] -reg byte x [ irq::ptr#0 ] +reg byte a [ irq::ptr#0 ] reg byte x [ irq::ptr#1 ] reg byte x [ irq::ptr#2 ] +reg byte a [ irq::$3 ]