diff --git a/src/main/fragment/_deref_pwuc1=_deref_pwuc2.asm b/src/main/fragment/_deref_pwuc1=_deref_pwuc2.asm new file mode 100644 index 000000000..6db8608c3 --- /dev/null +++ b/src/main/fragment/_deref_pwuc1=_deref_pwuc2.asm @@ -0,0 +1,4 @@ +lda {c2} +sta {c1} +lda {c2}+1 +sta {c1}+1 \ No newline at end of file diff --git a/src/main/fragment/pbuc1_derefidx_vwuz1=pbuc2_derefidx_vwuz1.asm b/src/main/fragment/pbuc1_derefidx_vwuz1=pbuc2_derefidx_vwuz1.asm deleted file mode 100644 index 90afbd8fb..000000000 --- a/src/main/fragment/pbuc1_derefidx_vwuz1=pbuc2_derefidx_vwuz1.asm +++ /dev/null @@ -1,16 +0,0 @@ -lda #<{c1} -clc -adc {z1} -sta !a1+ +1 -lda #>{c1} -adc {z1}+1 -sta !a1+ +2 -lda #<{c2} -clc -adc {z1} -sta !a2+ +1 -lda #>{c2} -adc {z1}+1 -sta !a2+ +2 -!a2: lda {c2} -!a1: sta {c1} diff --git a/src/main/fragment/pbuc1_derefidx_vwuz1=pbuc2_derefidx_vwuz2.asm b/src/main/fragment/pbuc1_derefidx_vwuz1=pbuc2_derefidx_vwuz2.asm deleted file mode 100644 index 2b7c64c4d..000000000 --- a/src/main/fragment/pbuc1_derefidx_vwuz1=pbuc2_derefidx_vwuz2.asm +++ /dev/null @@ -1,16 +0,0 @@ -lda #<{c1} -clc -adc {z1} -sta !a1+ +1 -lda #>{c1} -adc {z1}+1 -sta !a1+ +2 -lda #<{c2} -clc -adc {z2} -sta !a2+ +1 -lda #>{c2} -adc {z2}+1 -sta !a2+ +2 -!a2: lda {c2} -!a1: sta {c1} diff --git a/src/main/fragment/pbuc1_derefidx_vwuz1=vbuaa.asm b/src/main/fragment/pbuc1_derefidx_vwuz1=vbuaa.asm deleted file mode 100644 index 6ac417147..000000000 --- a/src/main/fragment/pbuc1_derefidx_vwuz1=vbuaa.asm +++ /dev/null @@ -1,10 +0,0 @@ -sta !v+ +1 -lda #<{c1} -clc -adc {z1} -sta !a+ +1 -lda #>{c1} -adc {z1}+1 -sta !a+ +2 -!v: lda #0 -!a: sta {c1} diff --git a/src/main/fragment/pbuc1_derefidx_vwuz1=vbuc2.asm b/src/main/fragment/pbuc1_derefidx_vwuz1=vbuc2.asm deleted file mode 100644 index b021da5d1..000000000 --- a/src/main/fragment/pbuc1_derefidx_vwuz1=vbuc2.asm +++ /dev/null @@ -1,9 +0,0 @@ -lda #<{c1} -clc -adc {z1} -sta !+ +1 -lda #>{c1} -adc {z1}+1 -sta !+ +2 -lda #{c2} -!: sta {c1} diff --git a/src/main/java/dk/camelot64/kickc/Compiler.java b/src/main/java/dk/camelot64/kickc/Compiler.java index 6299356d1..c63aa0e7e 100644 --- a/src/main/java/dk/camelot64/kickc/Compiler.java +++ b/src/main/java/dk/camelot64/kickc/Compiler.java @@ -256,6 +256,7 @@ public class Compiler { optimizations.add(new Pass2MultiplyToShiftRewriting(program)); optimizations.add(new Pass2SizeOfSimplification(program)); optimizations.add(new Pass2InlineDerefIdx(program)); + optimizations.add(new Pass2DeInlineWordDerefIdx(program)); pass2Execute(optimizations); } diff --git a/src/main/java/dk/camelot64/kickc/passes/Pass2DeInlineWordDerefIdx.java b/src/main/java/dk/camelot64/kickc/passes/Pass2DeInlineWordDerefIdx.java new file mode 100644 index 000000000..ce6170e7e --- /dev/null +++ b/src/main/java/dk/camelot64/kickc/passes/Pass2DeInlineWordDerefIdx.java @@ -0,0 +1,53 @@ +package dk.camelot64.kickc.passes; + +import dk.camelot64.kickc.model.Comment; +import dk.camelot64.kickc.model.Program; +import dk.camelot64.kickc.model.iterator.ProgramValueIterator; +import dk.camelot64.kickc.model.operators.Operators; +import dk.camelot64.kickc.model.statements.StatementAssignment; +import dk.camelot64.kickc.model.symbols.Scope; +import dk.camelot64.kickc.model.symbols.VariableIntermediate; +import dk.camelot64.kickc.model.types.SymbolType; +import dk.camelot64.kickc.model.types.SymbolTypeInference; +import dk.camelot64.kickc.model.values.PointerDereferenceIndexed; +import dk.camelot64.kickc.model.values.PointerDereferenceSimple; +import dk.camelot64.kickc.model.values.RValue; +import sun.tools.jstat.Operator; + +import java.util.concurrent.atomic.AtomicBoolean; + +/** Fnds derefidx with word indices - and de-inlines them (converting to + and normal deref). */ +public class Pass2DeInlineWordDerefIdx extends Pass2SsaOptimization { + + public Pass2DeInlineWordDerefIdx(Program program) { + super(program); + } + + @Override + public boolean step() { + AtomicBoolean optimized = new AtomicBoolean(false); + ProgramValueIterator.execute(getGraph(), (programValue, currentStmt, stmtIt, currentBlock) -> { + if(programValue.get() instanceof PointerDereferenceIndexed) { + PointerDereferenceIndexed dereferenceIndexed = (PointerDereferenceIndexed) programValue.get(); + RValue indexValue = dereferenceIndexed.getIndex(); + SymbolType indexType = SymbolTypeInference.inferType(getScope(), indexValue); + if(indexType.getSizeBytes()>1) { + // Index is multiple bytes - de-inline it + getLog().append("De-inlining pointer[w] to *(pointer+w) "+currentStmt.toString(getProgram(), false)); + Scope currentScope = getScope().getScope(currentBlock.getScope()); + VariableIntermediate tmpVar = currentScope.addVariableIntermediate(); + SymbolType pointerType = SymbolTypeInference.inferType(getScope(), dereferenceIndexed.getPointer(), Operators.PLUS, indexValue); + tmpVar.setType(pointerType); + stmtIt.previous(); + stmtIt.add(new StatementAssignment(tmpVar.getRef(), dereferenceIndexed.getPointer(), Operators.PLUS, indexValue, currentStmt.getSource(), Comment.NO_COMMENTS)); + stmtIt.next(); + programValue.set(new PointerDereferenceSimple(tmpVar.getRef())); + optimized.set(true); + } + } + }); + return optimized.get(); + } + + +} diff --git a/src/test/java/dk/camelot64/kickc/test/TestPrograms.java b/src/test/java/dk/camelot64/kickc/test/TestPrograms.java index 6f40108d3..204880ac3 100644 --- a/src/test/java/dk/camelot64/kickc/test/TestPrograms.java +++ b/src/test/java/dk/camelot64/kickc/test/TestPrograms.java @@ -112,6 +112,11 @@ public class TestPrograms { compileAndCompare("word-pointer-iteration-0"); } + @Test + public void testWordArray2() throws IOException, URISyntaxException { + compileAndCompare("word-array-2"); + } + @Test public void testWordArray1() throws IOException, URISyntaxException { compileAndCompare("word-array-1"); diff --git a/src/test/kc/word-array-2.kc b/src/test/kc/word-array-2.kc new file mode 100644 index 000000000..5ad87de44 --- /dev/null +++ b/src/test/kc/word-array-2.kc @@ -0,0 +1,13 @@ +// Tests a word-array with 128+ elements + +word[256] words; + +void main() { + for(byte i: 0..0xff) { + words[(word)i] = ((word)i)*0x100+i; + } + + const word* SCREEN = $0400; + SCREEN[0] = words[(word)255]; + +} diff --git a/src/test/ref/bresenhamarr.asm b/src/test/ref/bresenhamarr.asm index 91047f4bf..7c3c586de 100644 --- a/src/test/ref/bresenhamarr.asm +++ b/src/test/ref/bresenhamarr.asm @@ -10,28 +10,31 @@ main: { .const y1 = $18 .const xd = x1-x0 .const yd = y1-y0 + .label x = 4 .label idx = 2 - .label y = 4 + .label y = 5 + .label _16 = 6 lda #y0 sta y ldx #yd/2 - ldy #x0 + lda #x0 + sta x lda #x0+y0*$28 sta idx lda #0 sta idx+1 b1: - lda #screen - adc idx+1 - sta !++2 + adc #screen + sta _16+1 lda #STAR - !: - sta screen - iny + ldy #0 + sta (_16),y + inc x inc idx bne !+ inc idx+1 @@ -52,7 +55,8 @@ main: { txa axs #xd b2: - cpy #x1+1 + lda x + cmp #x1+1 bcc b1 rts } diff --git a/src/test/ref/bresenhamarr.cfg b/src/test/ref/bresenhamarr.cfg index a7a509f9f..8b3104633 100644 --- a/src/test/ref/bresenhamarr.cfg +++ b/src/test/ref/bresenhamarr.cfg @@ -15,23 +15,24 @@ main::@1: scope:[main] from main main::@2 [5] (byte) main::e#3 ← phi( main/(const byte) main::yd#0/(byte/signed byte/word/signed word/dword/signed dword) 2 main::@2/(byte) main::e#5 ) [5] (byte) main::x#2 ← phi( main/(const byte) main::x0#0 main::@2/(byte) main::x#1 ) [5] (word) main::idx#3 ← phi( main/(const byte) main::x0#0+(const byte) main::y0#0*(byte/signed byte/word/signed word/dword/signed dword) $28 main::@2/(word) main::idx#5 ) - [6] *((const byte[$28*$19]) main::screen#0 + (word) main::idx#3) ← (const byte) main::STAR#0 - [7] (byte) main::x#1 ← (byte) main::x#2 + (byte/signed byte/word/signed word/dword/signed dword) 1 - [8] (word) main::idx#1 ← (word) main::idx#3 + (byte/signed byte/word/signed word/dword/signed dword) 1 - [9] (byte) main::e#1 ← (byte) main::e#3 + (const byte) main::yd#0 - [10] if((const byte) main::xd#0>=(byte) main::e#1) goto main::@2 + [6] (byte*) main::$16 ← (const byte[$28*$19]) main::screen#0 + (word) main::idx#3 + [7] *((byte*) main::$16) ← (const byte) main::STAR#0 + [8] (byte) main::x#1 ← (byte) main::x#2 + (byte/signed byte/word/signed word/dword/signed dword) 1 + [9] (word) main::idx#1 ← (word) main::idx#3 + (byte/signed byte/word/signed word/dword/signed dword) 1 + [10] (byte) main::e#1 ← (byte) main::e#3 + (const byte) main::yd#0 + [11] if((const byte) main::xd#0>=(byte) main::e#1) goto main::@2 to:main::@3 main::@3: scope:[main] from main::@1 - [11] (byte) main::y#1 ← (byte) main::y#2 + (byte/signed byte/word/signed word/dword/signed dword) 1 - [12] (word) main::idx#2 ← (word) main::idx#1 + (byte/signed byte/word/signed word/dword/signed dword) $28 - [13] (byte) main::e#2 ← (byte) main::e#1 - (const byte) main::xd#0 + [12] (byte) main::y#1 ← (byte) main::y#2 + (byte/signed byte/word/signed word/dword/signed dword) 1 + [13] (word) main::idx#2 ← (word) main::idx#1 + (byte/signed byte/word/signed word/dword/signed dword) $28 + [14] (byte) main::e#2 ← (byte) main::e#1 - (const byte) main::xd#0 to:main::@2 main::@2: scope:[main] from main::@1 main::@3 - [14] (byte) main::y#4 ← phi( main::@1/(byte) main::y#2 main::@3/(byte) main::y#1 ) - [14] (byte) main::e#5 ← phi( main::@1/(byte) main::e#1 main::@3/(byte) main::e#2 ) - [14] (word) main::idx#5 ← phi( main::@1/(word) main::idx#1 main::@3/(word) main::idx#2 ) - [15] if((byte) main::x#1<(const byte) main::x1#0+(byte/signed byte/word/signed word/dword/signed dword) 1) goto main::@1 + [15] (byte) main::y#4 ← phi( main::@1/(byte) main::y#2 main::@3/(byte) main::y#1 ) + [15] (byte) main::e#5 ← phi( main::@1/(byte) main::e#1 main::@3/(byte) main::e#2 ) + [15] (word) main::idx#5 ← phi( main::@1/(word) main::idx#1 main::@3/(word) main::idx#2 ) + [16] if((byte) main::x#1<(const byte) main::x1#0+(byte/signed byte/word/signed word/dword/signed dword) 1) goto main::@1 to:main::@return main::@return: scope:[main] from main::@2 - [16] return + [17] return to:@return diff --git a/src/test/ref/bresenhamarr.log b/src/test/ref/bresenhamarr.log index fad481081..6d9976a68 100644 --- a/src/test/ref/bresenhamarr.log +++ b/src/test/ref/bresenhamarr.log @@ -204,6 +204,8 @@ Successful SSA optimization Pass2ConstantIdentification Constant (const byte) main::e#0 = main::yd#0/2 Constant (const word) main::idx#0 = main::x0#0+main::$4 Successful SSA optimization Pass2ConstantIdentification +De-inlining pointer[w] to *(pointer+w) *((const byte[main::$0]) main::screen#0 + (word) main::idx#3) ← (const byte) main::STAR#0 +Successful SSA optimization Pass2DeInlineWordDerefIdx Inlining constant with var siblings (const byte) main::e#0 Inlining constant with var siblings (const word) main::idx#0 Constant inlined main::idx#0 = (const byte) main::x0#0+(const byte) main::y0#0*(byte/signed byte/word/signed word/dword/signed dword) $28 @@ -222,16 +224,16 @@ CALL GRAPH Calls in [] to main:2 Created 7 initial phi equivalence classes -Coalesced [14] main::idx#8 ← main::idx#2 -Coalesced [15] main::e#8 ← main::e#2 -Coalesced [16] main::y#7 ← main::y#1 -Coalesced [20] main::idx#6 ← main::idx#5 -Coalesced [21] main::x#5 ← main::x#1 -Coalesced [22] main::e#6 ← main::e#5 -Coalesced [23] main::y#5 ← main::y#4 -Coalesced [24] main::idx#7 ← main::idx#1 -Coalesced [25] main::e#7 ← main::e#1 -Coalesced (already) [26] main::y#6 ← main::y#2 +Coalesced [15] main::idx#8 ← main::idx#2 +Coalesced [16] main::e#8 ← main::e#2 +Coalesced [17] main::y#7 ← main::y#1 +Coalesced [21] main::idx#6 ← main::idx#5 +Coalesced [22] main::x#5 ← main::x#1 +Coalesced [23] main::e#6 ← main::e#5 +Coalesced [24] main::y#5 ← main::y#4 +Coalesced [25] main::idx#7 ← main::idx#1 +Coalesced [26] main::e#7 ← main::e#1 +Coalesced (already) [27] main::y#6 ← main::y#2 Coalesced down to 4 phi equivalence classes Culled Empty Block (label) main::@5 Culled Empty Block (label) main::@6 @@ -258,51 +260,53 @@ main::@1: scope:[main] from main main::@2 [5] (byte) main::e#3 ← phi( main/(const byte) main::yd#0/(byte/signed byte/word/signed word/dword/signed dword) 2 main::@2/(byte) main::e#5 ) [5] (byte) main::x#2 ← phi( main/(const byte) main::x0#0 main::@2/(byte) main::x#1 ) [5] (word) main::idx#3 ← phi( main/(const byte) main::x0#0+(const byte) main::y0#0*(byte/signed byte/word/signed word/dword/signed dword) $28 main::@2/(word) main::idx#5 ) - [6] *((const byte[$28*$19]) main::screen#0 + (word) main::idx#3) ← (const byte) main::STAR#0 - [7] (byte) main::x#1 ← (byte) main::x#2 + (byte/signed byte/word/signed word/dword/signed dword) 1 - [8] (word) main::idx#1 ← (word) main::idx#3 + (byte/signed byte/word/signed word/dword/signed dword) 1 - [9] (byte) main::e#1 ← (byte) main::e#3 + (const byte) main::yd#0 - [10] if((const byte) main::xd#0>=(byte) main::e#1) goto main::@2 + [6] (byte*) main::$16 ← (const byte[$28*$19]) main::screen#0 + (word) main::idx#3 + [7] *((byte*) main::$16) ← (const byte) main::STAR#0 + [8] (byte) main::x#1 ← (byte) main::x#2 + (byte/signed byte/word/signed word/dword/signed dword) 1 + [9] (word) main::idx#1 ← (word) main::idx#3 + (byte/signed byte/word/signed word/dword/signed dword) 1 + [10] (byte) main::e#1 ← (byte) main::e#3 + (const byte) main::yd#0 + [11] if((const byte) main::xd#0>=(byte) main::e#1) goto main::@2 to:main::@3 main::@3: scope:[main] from main::@1 - [11] (byte) main::y#1 ← (byte) main::y#2 + (byte/signed byte/word/signed word/dword/signed dword) 1 - [12] (word) main::idx#2 ← (word) main::idx#1 + (byte/signed byte/word/signed word/dword/signed dword) $28 - [13] (byte) main::e#2 ← (byte) main::e#1 - (const byte) main::xd#0 + [12] (byte) main::y#1 ← (byte) main::y#2 + (byte/signed byte/word/signed word/dword/signed dword) 1 + [13] (word) main::idx#2 ← (word) main::idx#1 + (byte/signed byte/word/signed word/dword/signed dword) $28 + [14] (byte) main::e#2 ← (byte) main::e#1 - (const byte) main::xd#0 to:main::@2 main::@2: scope:[main] from main::@1 main::@3 - [14] (byte) main::y#4 ← phi( main::@1/(byte) main::y#2 main::@3/(byte) main::y#1 ) - [14] (byte) main::e#5 ← phi( main::@1/(byte) main::e#1 main::@3/(byte) main::e#2 ) - [14] (word) main::idx#5 ← phi( main::@1/(word) main::idx#1 main::@3/(word) main::idx#2 ) - [15] if((byte) main::x#1<(const byte) main::x1#0+(byte/signed byte/word/signed word/dword/signed dword) 1) goto main::@1 + [15] (byte) main::y#4 ← phi( main::@1/(byte) main::y#2 main::@3/(byte) main::y#1 ) + [15] (byte) main::e#5 ← phi( main::@1/(byte) main::e#1 main::@3/(byte) main::e#2 ) + [15] (word) main::idx#5 ← phi( main::@1/(word) main::idx#1 main::@3/(word) main::idx#2 ) + [16] if((byte) main::x#1<(const byte) main::x1#0+(byte/signed byte/word/signed word/dword/signed dword) 1) goto main::@1 to:main::@return main::@return: scope:[main] from main::@2 - [16] return + [17] return to:@return VARIABLE REGISTER WEIGHTS (void()) main() +(byte*) main::$16 22.0 (byte) main::STAR (byte) main::e (byte) main::e#1 11.0 (byte) main::e#2 22.0 -(byte) main::e#3 5.5 +(byte) main::e#3 4.4 (byte) main::e#5 16.5 (word) main::idx (word) main::idx#1 8.25 (word) main::idx#2 11.0 -(word) main::idx#3 11.0 +(word) main::idx#3 8.25 (word) main::idx#5 16.5 (byte[$28*$19]) main::screen (byte) main::x (byte) main::x#1 3.666666666666667 -(byte) main::x#2 11.0 +(byte) main::x#2 7.333333333333333 (byte) main::x0 (byte) main::x1 (byte) main::xd (byte) main::y (byte) main::y#1 7.333333333333333 -(byte) main::y#2 5.5 +(byte) main::y#2 4.714285714285714 (byte) main::y#4 16.5 (byte) main::y0 (byte) main::y1 @@ -313,15 +317,18 @@ Initial phi equivalence classes [ main::x#2 main::x#1 ] [ main::e#3 main::e#5 main::e#1 main::e#2 ] [ main::y#2 main::y#4 main::y#1 ] +Added variable main::$16 to zero page equivalence class [ main::$16 ] Complete equivalence classes [ main::idx#3 main::idx#5 main::idx#1 main::idx#2 ] [ main::x#2 main::x#1 ] [ main::e#3 main::e#5 main::e#1 main::e#2 ] [ main::y#2 main::y#4 main::y#1 ] +[ main::$16 ] Allocated zp ZP_WORD:2 [ main::idx#3 main::idx#5 main::idx#1 main::idx#2 ] Allocated zp ZP_BYTE:4 [ main::x#2 main::x#1 ] Allocated zp ZP_BYTE:5 [ main::e#3 main::e#5 main::e#1 main::e#2 ] Allocated zp ZP_BYTE:6 [ main::y#2 main::y#4 main::y#1 ] +Allocated zp ZP_WORD:7 [ main::$16 ] INITIAL ASM //SEG0 File Comments @@ -360,6 +367,7 @@ main: { .label idx = 2 .label e = 5 .label y = 6 + .label _16 = 7 //SEG11 [5] phi from main to main::@1 [phi:main->main::@1] b1_from_main: //SEG12 [5] phi (byte) main::y#2 = (const byte) main::y0#0 [phi:main->main::@1#0] -- vbuz1=vbuc1 @@ -386,38 +394,39 @@ main: { jmp b1 //SEG21 main::@1 b1: - //SEG22 [6] *((const byte[$28*$19]) main::screen#0 + (word) main::idx#3) ← (const byte) main::STAR#0 -- pbuc1_derefidx_vwuz1=vbuc2 - lda #screen - adc idx+1 - sta !++2 + adc #screen + sta _16+1 + //SEG23 [7] *((byte*) main::$16) ← (const byte) main::STAR#0 -- _deref_pbuz1=vbuc1 lda #STAR - !: - sta screen - //SEG23 [7] (byte) main::x#1 ← (byte) main::x#2 + (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz1_plus_1 + ldy #0 + sta (_16),y + //SEG24 [8] (byte) main::x#1 ← (byte) main::x#2 + (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz1_plus_1 inc x - //SEG24 [8] (word) main::idx#1 ← (word) main::idx#3 + (byte/signed byte/word/signed word/dword/signed dword) 1 -- vwuz1=vwuz1_plus_1 + //SEG25 [9] (word) main::idx#1 ← (word) main::idx#3 + (byte/signed byte/word/signed word/dword/signed dword) 1 -- vwuz1=vwuz1_plus_1 inc idx bne !+ inc idx+1 !: - //SEG25 [9] (byte) main::e#1 ← (byte) main::e#3 + (const byte) main::yd#0 -- vbuz1=vbuz1_plus_vbuc1 + //SEG26 [10] (byte) main::e#1 ← (byte) main::e#3 + (const byte) main::yd#0 -- vbuz1=vbuz1_plus_vbuc1 lax e axs #-[yd] stx e - //SEG26 [10] if((const byte) main::xd#0>=(byte) main::e#1) goto main::@2 -- vbuc1_ge_vbuz1_then_la1 + //SEG27 [11] if((const byte) main::xd#0>=(byte) main::e#1) goto main::@2 -- vbuc1_ge_vbuz1_then_la1 lda #xd cmp e bcs b2_from_b1 jmp b3 - //SEG27 main::@3 + //SEG28 main::@3 b3: - //SEG28 [11] (byte) main::y#1 ← (byte) main::y#2 + (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz1_plus_1 + //SEG29 [12] (byte) main::y#1 ← (byte) main::y#2 + (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz1_plus_1 inc y - //SEG29 [12] (word) main::idx#2 ← (word) main::idx#1 + (byte/signed byte/word/signed word/dword/signed dword) $28 -- vwuz1=vwuz1_plus_vbuc1 + //SEG30 [13] (word) main::idx#2 ← (word) main::idx#1 + (byte/signed byte/word/signed word/dword/signed dword) $28 -- vwuz1=vwuz1_plus_vbuc1 lda #$28 clc adc idx @@ -425,56 +434,69 @@ main: { bcc !+ inc idx+1 !: - //SEG30 [13] (byte) main::e#2 ← (byte) main::e#1 - (const byte) main::xd#0 -- vbuz1=vbuz1_minus_vbuc1 + //SEG31 [14] (byte) main::e#2 ← (byte) main::e#1 - (const byte) main::xd#0 -- vbuz1=vbuz1_minus_vbuc1 lax e axs #xd stx e - //SEG31 [14] phi from main::@1 main::@3 to main::@2 [phi:main::@1/main::@3->main::@2] + //SEG32 [15] phi from main::@1 main::@3 to main::@2 [phi:main::@1/main::@3->main::@2] b2_from_b1: b2_from_b3: - //SEG32 [14] phi (byte) main::y#4 = (byte) main::y#2 [phi:main::@1/main::@3->main::@2#0] -- register_copy - //SEG33 [14] phi (byte) main::e#5 = (byte) main::e#1 [phi:main::@1/main::@3->main::@2#1] -- register_copy - //SEG34 [14] phi (word) main::idx#5 = (word) main::idx#1 [phi:main::@1/main::@3->main::@2#2] -- register_copy + //SEG33 [15] phi (byte) main::y#4 = (byte) main::y#2 [phi:main::@1/main::@3->main::@2#0] -- register_copy + //SEG34 [15] phi (byte) main::e#5 = (byte) main::e#1 [phi:main::@1/main::@3->main::@2#1] -- register_copy + //SEG35 [15] phi (word) main::idx#5 = (word) main::idx#1 [phi:main::@1/main::@3->main::@2#2] -- register_copy jmp b2 - //SEG35 main::@2 + //SEG36 main::@2 b2: - //SEG36 [15] if((byte) main::x#1<(const byte) main::x1#0+(byte/signed byte/word/signed word/dword/signed dword) 1) goto main::@1 -- vbuz1_lt_vbuc1_then_la1 + //SEG37 [16] if((byte) main::x#1<(const byte) main::x1#0+(byte/signed byte/word/signed word/dword/signed dword) 1) goto main::@1 -- vbuz1_lt_vbuc1_then_la1 lda x cmp #x1+1 bcc b1_from_b2 jmp breturn - //SEG37 main::@return + //SEG38 main::@return breturn: - //SEG38 [16] return + //SEG39 [17] return rts } REGISTER UPLIFT POTENTIAL REGISTERS -Statement [6] *((const byte[$28*$19]) main::screen#0 + (word) main::idx#3) ← (const byte) main::STAR#0 [ main::idx#3 main::x#2 main::e#3 main::y#2 ] ( main:2 [ main::idx#3 main::x#2 main::e#3 main::y#2 ] ) always clobbers reg byte a +Statement [6] (byte*) main::$16 ← (const byte[$28*$19]) main::screen#0 + (word) main::idx#3 [ main::idx#3 main::x#2 main::e#3 main::y#2 main::$16 ] ( main:2 [ main::idx#3 main::x#2 main::e#3 main::y#2 main::$16 ] ) always clobbers reg byte a Removing always clobbered register reg byte a as potential for zp ZP_BYTE:4 [ main::x#2 main::x#1 ] Removing always clobbered register reg byte a as potential for zp ZP_BYTE:5 [ main::e#3 main::e#5 main::e#1 main::e#2 ] Removing always clobbered register reg byte a as potential for zp ZP_BYTE:6 [ main::y#2 main::y#4 main::y#1 ] -Statement [9] (byte) main::e#1 ← (byte) main::e#3 + (const byte) main::yd#0 [ main::y#2 main::x#1 main::idx#1 main::e#1 ] ( main:2 [ main::y#2 main::x#1 main::idx#1 main::e#1 ] ) always clobbers reg byte a -Statement [12] (word) main::idx#2 ← (word) main::idx#1 + (byte/signed byte/word/signed word/dword/signed dword) $28 [ main::x#1 main::e#1 main::y#1 main::idx#2 ] ( main:2 [ main::x#1 main::e#1 main::y#1 main::idx#2 ] ) always clobbers reg byte a -Statement [13] (byte) main::e#2 ← (byte) main::e#1 - (const byte) main::xd#0 [ main::x#1 main::y#1 main::idx#2 main::e#2 ] ( main:2 [ main::x#1 main::y#1 main::idx#2 main::e#2 ] ) always clobbers reg byte a -Statement [6] *((const byte[$28*$19]) main::screen#0 + (word) main::idx#3) ← (const byte) main::STAR#0 [ main::idx#3 main::x#2 main::e#3 main::y#2 ] ( main:2 [ main::idx#3 main::x#2 main::e#3 main::y#2 ] ) always clobbers reg byte a -Statement [9] (byte) main::e#1 ← (byte) main::e#3 + (const byte) main::yd#0 [ main::y#2 main::x#1 main::idx#1 main::e#1 ] ( main:2 [ main::y#2 main::x#1 main::idx#1 main::e#1 ] ) always clobbers reg byte a -Statement [12] (word) main::idx#2 ← (word) main::idx#1 + (byte/signed byte/word/signed word/dword/signed dword) $28 [ main::x#1 main::e#1 main::y#1 main::idx#2 ] ( main:2 [ main::x#1 main::e#1 main::y#1 main::idx#2 ] ) always clobbers reg byte a -Statement [13] (byte) main::e#2 ← (byte) main::e#1 - (const byte) main::xd#0 [ main::x#1 main::y#1 main::idx#2 main::e#2 ] ( main:2 [ main::x#1 main::y#1 main::idx#2 main::e#2 ] ) always clobbers reg byte a +Statement [7] *((byte*) main::$16) ← (const byte) main::STAR#0 [ main::idx#3 main::x#2 main::e#3 main::y#2 ] ( main:2 [ main::idx#3 main::x#2 main::e#3 main::y#2 ] ) always clobbers reg byte a reg byte y +Removing always clobbered register reg byte y as potential for zp ZP_BYTE:4 [ main::x#2 main::x#1 ] +Removing always clobbered register reg byte y as potential for zp ZP_BYTE:5 [ main::e#3 main::e#5 main::e#1 main::e#2 ] +Removing always clobbered register reg byte y as potential for zp ZP_BYTE:6 [ main::y#2 main::y#4 main::y#1 ] +Statement [10] (byte) main::e#1 ← (byte) main::e#3 + (const byte) main::yd#0 [ main::y#2 main::x#1 main::idx#1 main::e#1 ] ( main:2 [ main::y#2 main::x#1 main::idx#1 main::e#1 ] ) always clobbers reg byte a reg byte x +Removing always clobbered register reg byte x as potential for zp ZP_BYTE:6 [ main::y#2 main::y#4 main::y#1 ] +Removing always clobbered register reg byte x as potential for zp ZP_BYTE:4 [ main::x#2 main::x#1 ] +Statement [13] (word) main::idx#2 ← (word) main::idx#1 + (byte/signed byte/word/signed word/dword/signed dword) $28 [ main::x#1 main::e#1 main::y#1 main::idx#2 ] ( main:2 [ main::x#1 main::e#1 main::y#1 main::idx#2 ] ) always clobbers reg byte a +Statement [14] (byte) main::e#2 ← (byte) main::e#1 - (const byte) main::xd#0 [ main::x#1 main::y#1 main::idx#2 main::e#2 ] ( main:2 [ main::x#1 main::y#1 main::idx#2 main::e#2 ] ) always clobbers reg byte a reg byte x +Statement [16] if((byte) main::x#1<(const byte) main::x1#0+(byte/signed byte/word/signed word/dword/signed dword) 1) goto main::@1 [ main::idx#5 main::x#1 main::e#5 main::y#4 ] ( main:2 [ main::idx#5 main::x#1 main::e#5 main::y#4 ] ) always clobbers reg byte a +Statement [6] (byte*) main::$16 ← (const byte[$28*$19]) main::screen#0 + (word) main::idx#3 [ main::idx#3 main::x#2 main::e#3 main::y#2 main::$16 ] ( main:2 [ main::idx#3 main::x#2 main::e#3 main::y#2 main::$16 ] ) always clobbers reg byte a +Statement [7] *((byte*) main::$16) ← (const byte) main::STAR#0 [ main::idx#3 main::x#2 main::e#3 main::y#2 ] ( main:2 [ main::idx#3 main::x#2 main::e#3 main::y#2 ] ) always clobbers reg byte a reg byte y +Statement [10] (byte) main::e#1 ← (byte) main::e#3 + (const byte) main::yd#0 [ main::y#2 main::x#1 main::idx#1 main::e#1 ] ( main:2 [ main::y#2 main::x#1 main::idx#1 main::e#1 ] ) always clobbers reg byte a reg byte x +Statement [13] (word) main::idx#2 ← (word) main::idx#1 + (byte/signed byte/word/signed word/dword/signed dword) $28 [ main::x#1 main::e#1 main::y#1 main::idx#2 ] ( main:2 [ main::x#1 main::e#1 main::y#1 main::idx#2 ] ) always clobbers reg byte a +Statement [14] (byte) main::e#2 ← (byte) main::e#1 - (const byte) main::xd#0 [ main::x#1 main::y#1 main::idx#2 main::e#2 ] ( main:2 [ main::x#1 main::y#1 main::idx#2 main::e#2 ] ) always clobbers reg byte a reg byte x +Statement [16] if((byte) main::x#1<(const byte) main::x1#0+(byte/signed byte/word/signed word/dword/signed dword) 1) goto main::@1 [ main::idx#5 main::x#1 main::e#5 main::y#4 ] ( main:2 [ main::idx#5 main::x#1 main::e#5 main::y#4 ] ) always clobbers reg byte a Potential registers zp ZP_WORD:2 [ main::idx#3 main::idx#5 main::idx#1 main::idx#2 ] : zp ZP_WORD:2 , -Potential registers zp ZP_BYTE:4 [ main::x#2 main::x#1 ] : zp ZP_BYTE:4 , reg byte x , reg byte y , -Potential registers zp ZP_BYTE:5 [ main::e#3 main::e#5 main::e#1 main::e#2 ] : zp ZP_BYTE:5 , reg byte x , reg byte y , -Potential registers zp ZP_BYTE:6 [ main::y#2 main::y#4 main::y#1 ] : zp ZP_BYTE:6 , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:4 [ main::x#2 main::x#1 ] : zp ZP_BYTE:4 , +Potential registers zp ZP_BYTE:5 [ main::e#3 main::e#5 main::e#1 main::e#2 ] : zp ZP_BYTE:5 , reg byte x , +Potential registers zp ZP_BYTE:6 [ main::y#2 main::y#4 main::y#1 ] : zp ZP_BYTE:6 , +Potential registers zp ZP_WORD:7 [ main::$16 ] : zp ZP_WORD:7 , REGISTER UPLIFT SCOPES -Uplift Scope [main] 55: zp ZP_BYTE:5 [ main::e#3 main::e#5 main::e#1 main::e#2 ] 46.75: zp ZP_WORD:2 [ main::idx#3 main::idx#5 main::idx#1 main::idx#2 ] 29.33: zp ZP_BYTE:6 [ main::y#2 main::y#4 main::y#1 ] 14.67: zp ZP_BYTE:4 [ main::x#2 main::x#1 ] +Uplift Scope [main] 53.9: zp ZP_BYTE:5 [ main::e#3 main::e#5 main::e#1 main::e#2 ] 44: zp ZP_WORD:2 [ main::idx#3 main::idx#5 main::idx#1 main::idx#2 ] 28.55: zp ZP_BYTE:6 [ main::y#2 main::y#4 main::y#1 ] 22: zp ZP_WORD:7 [ main::$16 ] 11: zp ZP_BYTE:4 [ main::x#2 main::x#1 ] Uplift Scope [] -Uplifting [main] best 1183 combination reg byte x [ main::e#3 main::e#5 main::e#1 main::e#2 ] zp ZP_WORD:2 [ main::idx#3 main::idx#5 main::idx#1 main::idx#2 ] zp ZP_BYTE:6 [ main::y#2 main::y#4 main::y#1 ] reg byte y [ main::x#2 main::x#1 ] -Uplifting [] best 1183 combination +Uplifting [main] best 1293 combination reg byte x [ main::e#3 main::e#5 main::e#1 main::e#2 ] zp ZP_WORD:2 [ main::idx#3 main::idx#5 main::idx#1 main::idx#2 ] zp ZP_BYTE:6 [ main::y#2 main::y#4 main::y#1 ] zp ZP_WORD:7 [ main::$16 ] zp ZP_BYTE:4 [ main::x#2 main::x#1 ] +Uplifting [] best 1293 combination Attempting to uplift remaining variables inzp ZP_BYTE:6 [ main::y#2 main::y#4 main::y#1 ] -Uplifting [main] best 1183 combination zp ZP_BYTE:6 [ main::y#2 main::y#4 main::y#1 ] -Allocated (was zp ZP_BYTE:6) zp ZP_BYTE:4 [ main::y#2 main::y#4 main::y#1 ] +Uplifting [main] best 1293 combination zp ZP_BYTE:6 [ main::y#2 main::y#4 main::y#1 ] +Attempting to uplift remaining variables inzp ZP_BYTE:4 [ main::x#2 main::x#1 ] +Uplifting [main] best 1293 combination zp ZP_BYTE:4 [ main::x#2 main::x#1 ] +Allocated (was zp ZP_BYTE:6) zp ZP_BYTE:5 [ main::y#2 main::y#4 main::y#1 ] +Allocated (was zp ZP_WORD:7) zp ZP_WORD:6 [ main::$16 ] ASSEMBLER BEFORE OPTIMIZATION //SEG0 File Comments @@ -509,8 +531,10 @@ main: { .const y1 = $18 .const xd = x1-x0 .const yd = y1-y0 + .label x = 4 .label idx = 2 - .label y = 4 + .label y = 5 + .label _16 = 6 //SEG11 [5] phi from main to main::@1 [phi:main->main::@1] b1_from_main: //SEG12 [5] phi (byte) main::y#2 = (const byte) main::y0#0 [phi:main->main::@1#0] -- vbuz1=vbuc1 @@ -518,8 +542,9 @@ main: { sta y //SEG13 [5] phi (byte) main::e#3 = (const byte) main::yd#0/(byte/signed byte/word/signed word/dword/signed dword) 2 [phi:main->main::@1#1] -- vbuxx=vbuc1 ldx #yd/2 - //SEG14 [5] phi (byte) main::x#2 = (const byte) main::x0#0 [phi:main->main::@1#2] -- vbuyy=vbuc1 - ldy #x0 + //SEG14 [5] phi (byte) main::x#2 = (const byte) main::x0#0 [phi:main->main::@1#2] -- vbuz1=vbuc1 + lda #x0 + sta x //SEG15 [5] phi (word) main::idx#3 = (const byte) main::x0#0+(const byte) main::y0#0*(byte/signed byte/word/signed word/dword/signed dword) $28 [phi:main->main::@1#3] -- vwuz1=vbuc1 lda #x0+y0*$28 sta idx @@ -535,37 +560,38 @@ main: { jmp b1 //SEG21 main::@1 b1: - //SEG22 [6] *((const byte[$28*$19]) main::screen#0 + (word) main::idx#3) ← (const byte) main::STAR#0 -- pbuc1_derefidx_vwuz1=vbuc2 - lda #screen - adc idx+1 - sta !++2 + adc #screen + sta _16+1 + //SEG23 [7] *((byte*) main::$16) ← (const byte) main::STAR#0 -- _deref_pbuz1=vbuc1 lda #STAR - !: - sta screen - //SEG23 [7] (byte) main::x#1 ← (byte) main::x#2 + (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuyy=vbuyy_plus_1 - iny - //SEG24 [8] (word) main::idx#1 ← (word) main::idx#3 + (byte/signed byte/word/signed word/dword/signed dword) 1 -- vwuz1=vwuz1_plus_1 + ldy #0 + sta (_16),y + //SEG24 [8] (byte) main::x#1 ← (byte) main::x#2 + (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz1_plus_1 + inc x + //SEG25 [9] (word) main::idx#1 ← (word) main::idx#3 + (byte/signed byte/word/signed word/dword/signed dword) 1 -- vwuz1=vwuz1_plus_1 inc idx bne !+ inc idx+1 !: - //SEG25 [9] (byte) main::e#1 ← (byte) main::e#3 + (const byte) main::yd#0 -- vbuxx=vbuxx_plus_vbuc1 + //SEG26 [10] (byte) main::e#1 ← (byte) main::e#3 + (const byte) main::yd#0 -- vbuxx=vbuxx_plus_vbuc1 txa axs #-[yd] - //SEG26 [10] if((const byte) main::xd#0>=(byte) main::e#1) goto main::@2 -- vbuc1_ge_vbuxx_then_la1 + //SEG27 [11] if((const byte) main::xd#0>=(byte) main::e#1) goto main::@2 -- vbuc1_ge_vbuxx_then_la1 cpx #xd bcc b2_from_b1 beq b2_from_b1 jmp b3 - //SEG27 main::@3 + //SEG28 main::@3 b3: - //SEG28 [11] (byte) main::y#1 ← (byte) main::y#2 + (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz1_plus_1 + //SEG29 [12] (byte) main::y#1 ← (byte) main::y#2 + (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz1_plus_1 inc y - //SEG29 [12] (word) main::idx#2 ← (word) main::idx#1 + (byte/signed byte/word/signed word/dword/signed dword) $28 -- vwuz1=vwuz1_plus_vbuc1 + //SEG30 [13] (word) main::idx#2 ← (word) main::idx#1 + (byte/signed byte/word/signed word/dword/signed dword) $28 -- vwuz1=vwuz1_plus_vbuc1 lda #$28 clc adc idx @@ -573,25 +599,26 @@ main: { bcc !+ inc idx+1 !: - //SEG30 [13] (byte) main::e#2 ← (byte) main::e#1 - (const byte) main::xd#0 -- vbuxx=vbuxx_minus_vbuc1 + //SEG31 [14] (byte) main::e#2 ← (byte) main::e#1 - (const byte) main::xd#0 -- vbuxx=vbuxx_minus_vbuc1 txa axs #xd - //SEG31 [14] phi from main::@1 main::@3 to main::@2 [phi:main::@1/main::@3->main::@2] + //SEG32 [15] phi from main::@1 main::@3 to main::@2 [phi:main::@1/main::@3->main::@2] b2_from_b1: b2_from_b3: - //SEG32 [14] phi (byte) main::y#4 = (byte) main::y#2 [phi:main::@1/main::@3->main::@2#0] -- register_copy - //SEG33 [14] phi (byte) main::e#5 = (byte) main::e#1 [phi:main::@1/main::@3->main::@2#1] -- register_copy - //SEG34 [14] phi (word) main::idx#5 = (word) main::idx#1 [phi:main::@1/main::@3->main::@2#2] -- register_copy + //SEG33 [15] phi (byte) main::y#4 = (byte) main::y#2 [phi:main::@1/main::@3->main::@2#0] -- register_copy + //SEG34 [15] phi (byte) main::e#5 = (byte) main::e#1 [phi:main::@1/main::@3->main::@2#1] -- register_copy + //SEG35 [15] phi (word) main::idx#5 = (word) main::idx#1 [phi:main::@1/main::@3->main::@2#2] -- register_copy jmp b2 - //SEG35 main::@2 + //SEG36 main::@2 b2: - //SEG36 [15] if((byte) main::x#1<(const byte) main::x1#0+(byte/signed byte/word/signed word/dword/signed dword) 1) goto main::@1 -- vbuyy_lt_vbuc1_then_la1 - cpy #x1+1 + //SEG37 [16] if((byte) main::x#1<(const byte) main::x1#0+(byte/signed byte/word/signed word/dword/signed dword) 1) goto main::@1 -- vbuz1_lt_vbuc1_then_la1 + lda x + cmp #x1+1 bcc b1_from_b2 jmp breturn - //SEG37 main::@return + //SEG38 main::@return breturn: - //SEG38 [16] return + //SEG39 [17] return rts } @@ -632,6 +659,7 @@ FINAL SYMBOL TABLE (label) @begin (label) @end (void()) main() +(byte*) main::$16 $16 zp ZP_WORD:6 22.0 (label) main::@1 (label) main::@2 (label) main::@3 @@ -641,18 +669,18 @@ FINAL SYMBOL TABLE (byte) main::e (byte) main::e#1 reg byte x 11.0 (byte) main::e#2 reg byte x 22.0 -(byte) main::e#3 reg byte x 5.5 +(byte) main::e#3 reg byte x 4.4 (byte) main::e#5 reg byte x 16.5 (word) main::idx (word) main::idx#1 idx zp ZP_WORD:2 8.25 (word) main::idx#2 idx zp ZP_WORD:2 11.0 -(word) main::idx#3 idx zp ZP_WORD:2 11.0 +(word) main::idx#3 idx zp ZP_WORD:2 8.25 (word) main::idx#5 idx zp ZP_WORD:2 16.5 (byte[$28*$19]) main::screen (const byte[$28*$19]) main::screen#0 screen = ((byte*))(word/signed word/dword/signed dword) $400 (byte) main::x -(byte) main::x#1 reg byte y 3.666666666666667 -(byte) main::x#2 reg byte y 11.0 +(byte) main::x#1 x zp ZP_BYTE:4 3.666666666666667 +(byte) main::x#2 x zp ZP_BYTE:4 7.333333333333333 (byte) main::x0 (const byte) main::x0#0 x0 = (byte/signed byte/word/signed word/dword/signed dword) 0 (byte) main::x1 @@ -660,9 +688,9 @@ FINAL SYMBOL TABLE (byte) main::xd (const byte) main::xd#0 xd = (const byte) main::x1#0-(const byte) main::x0#0 (byte) main::y -(byte) main::y#1 y zp ZP_BYTE:4 7.333333333333333 -(byte) main::y#2 y zp ZP_BYTE:4 5.5 -(byte) main::y#4 y zp ZP_BYTE:4 16.5 +(byte) main::y#1 y zp ZP_BYTE:5 7.333333333333333 +(byte) main::y#2 y zp ZP_BYTE:5 4.714285714285714 +(byte) main::y#4 y zp ZP_BYTE:5 16.5 (byte) main::y0 (const byte) main::y0#0 y0 = (byte/signed byte/word/signed word/dword/signed dword) 0 (byte) main::y1 @@ -671,13 +699,14 @@ FINAL SYMBOL TABLE (const byte) main::yd#0 yd = (const byte) main::y1#0-(const byte) main::y0#0 zp ZP_WORD:2 [ main::idx#3 main::idx#5 main::idx#1 main::idx#2 ] -reg byte y [ main::x#2 main::x#1 ] +zp ZP_BYTE:4 [ main::x#2 main::x#1 ] reg byte x [ main::e#3 main::e#5 main::e#1 main::e#2 ] -zp ZP_BYTE:4 [ main::y#2 main::y#4 main::y#1 ] +zp ZP_BYTE:5 [ main::y#2 main::y#4 main::y#1 ] +zp ZP_WORD:6 [ main::$16 ] FINAL ASSEMBLER -Score: 1021 +Score: 1131 //SEG0 File Comments //SEG1 Basic Upstart @@ -702,16 +731,19 @@ main: { .const y1 = $18 .const xd = x1-x0 .const yd = y1-y0 + .label x = 4 .label idx = 2 - .label y = 4 + .label y = 5 + .label _16 = 6 //SEG11 [5] phi from main to main::@1 [phi:main->main::@1] //SEG12 [5] phi (byte) main::y#2 = (const byte) main::y0#0 [phi:main->main::@1#0] -- vbuz1=vbuc1 lda #y0 sta y //SEG13 [5] phi (byte) main::e#3 = (const byte) main::yd#0/(byte/signed byte/word/signed word/dword/signed dword) 2 [phi:main->main::@1#1] -- vbuxx=vbuc1 ldx #yd/2 - //SEG14 [5] phi (byte) main::x#2 = (const byte) main::x0#0 [phi:main->main::@1#2] -- vbuyy=vbuc1 - ldy #x0 + //SEG14 [5] phi (byte) main::x#2 = (const byte) main::x0#0 [phi:main->main::@1#2] -- vbuz1=vbuc1 + lda #x0 + sta x //SEG15 [5] phi (word) main::idx#3 = (const byte) main::x0#0+(const byte) main::y0#0*(byte/signed byte/word/signed word/dword/signed dword) $28 [phi:main->main::@1#3] -- vwuz1=vbuc1 lda #x0+y0*$28 sta idx @@ -724,35 +756,36 @@ main: { //SEG20 [5] phi (word) main::idx#3 = (word) main::idx#5 [phi:main::@2->main::@1#3] -- register_copy //SEG21 main::@1 b1: - //SEG22 [6] *((const byte[$28*$19]) main::screen#0 + (word) main::idx#3) ← (const byte) main::STAR#0 -- pbuc1_derefidx_vwuz1=vbuc2 - lda #screen - adc idx+1 - sta !++2 + adc #screen + sta _16+1 + //SEG23 [7] *((byte*) main::$16) ← (const byte) main::STAR#0 -- _deref_pbuz1=vbuc1 lda #STAR - !: - sta screen - //SEG23 [7] (byte) main::x#1 ← (byte) main::x#2 + (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuyy=vbuyy_plus_1 - iny - //SEG24 [8] (word) main::idx#1 ← (word) main::idx#3 + (byte/signed byte/word/signed word/dword/signed dword) 1 -- vwuz1=vwuz1_plus_1 + ldy #0 + sta (_16),y + //SEG24 [8] (byte) main::x#1 ← (byte) main::x#2 + (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz1_plus_1 + inc x + //SEG25 [9] (word) main::idx#1 ← (word) main::idx#3 + (byte/signed byte/word/signed word/dword/signed dword) 1 -- vwuz1=vwuz1_plus_1 inc idx bne !+ inc idx+1 !: - //SEG25 [9] (byte) main::e#1 ← (byte) main::e#3 + (const byte) main::yd#0 -- vbuxx=vbuxx_plus_vbuc1 + //SEG26 [10] (byte) main::e#1 ← (byte) main::e#3 + (const byte) main::yd#0 -- vbuxx=vbuxx_plus_vbuc1 txa axs #-[yd] - //SEG26 [10] if((const byte) main::xd#0>=(byte) main::e#1) goto main::@2 -- vbuc1_ge_vbuxx_then_la1 + //SEG27 [11] if((const byte) main::xd#0>=(byte) main::e#1) goto main::@2 -- vbuc1_ge_vbuxx_then_la1 cpx #xd bcc b2 beq b2 - //SEG27 main::@3 - //SEG28 [11] (byte) main::y#1 ← (byte) main::y#2 + (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz1_plus_1 + //SEG28 main::@3 + //SEG29 [12] (byte) main::y#1 ← (byte) main::y#2 + (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz1_plus_1 inc y - //SEG29 [12] (word) main::idx#2 ← (word) main::idx#1 + (byte/signed byte/word/signed word/dword/signed dword) $28 -- vwuz1=vwuz1_plus_vbuc1 + //SEG30 [13] (word) main::idx#2 ← (word) main::idx#1 + (byte/signed byte/word/signed word/dword/signed dword) $28 -- vwuz1=vwuz1_plus_vbuc1 lda #$28 clc adc idx @@ -760,20 +793,21 @@ main: { bcc !+ inc idx+1 !: - //SEG30 [13] (byte) main::e#2 ← (byte) main::e#1 - (const byte) main::xd#0 -- vbuxx=vbuxx_minus_vbuc1 + //SEG31 [14] (byte) main::e#2 ← (byte) main::e#1 - (const byte) main::xd#0 -- vbuxx=vbuxx_minus_vbuc1 txa axs #xd - //SEG31 [14] phi from main::@1 main::@3 to main::@2 [phi:main::@1/main::@3->main::@2] - //SEG32 [14] phi (byte) main::y#4 = (byte) main::y#2 [phi:main::@1/main::@3->main::@2#0] -- register_copy - //SEG33 [14] phi (byte) main::e#5 = (byte) main::e#1 [phi:main::@1/main::@3->main::@2#1] -- register_copy - //SEG34 [14] phi (word) main::idx#5 = (word) main::idx#1 [phi:main::@1/main::@3->main::@2#2] -- register_copy - //SEG35 main::@2 + //SEG32 [15] phi from main::@1 main::@3 to main::@2 [phi:main::@1/main::@3->main::@2] + //SEG33 [15] phi (byte) main::y#4 = (byte) main::y#2 [phi:main::@1/main::@3->main::@2#0] -- register_copy + //SEG34 [15] phi (byte) main::e#5 = (byte) main::e#1 [phi:main::@1/main::@3->main::@2#1] -- register_copy + //SEG35 [15] phi (word) main::idx#5 = (word) main::idx#1 [phi:main::@1/main::@3->main::@2#2] -- register_copy + //SEG36 main::@2 b2: - //SEG36 [15] if((byte) main::x#1<(const byte) main::x1#0+(byte/signed byte/word/signed word/dword/signed dword) 1) goto main::@1 -- vbuyy_lt_vbuc1_then_la1 - cpy #x1+1 + //SEG37 [16] if((byte) main::x#1<(const byte) main::x1#0+(byte/signed byte/word/signed word/dword/signed dword) 1) goto main::@1 -- vbuz1_lt_vbuc1_then_la1 + lda x + cmp #x1+1 bcc b1 - //SEG37 main::@return - //SEG38 [16] return + //SEG38 main::@return + //SEG39 [17] return rts } diff --git a/src/test/ref/bresenhamarr.sym b/src/test/ref/bresenhamarr.sym index 46a1ec128..6fa0f2965 100644 --- a/src/test/ref/bresenhamarr.sym +++ b/src/test/ref/bresenhamarr.sym @@ -2,6 +2,7 @@ (label) @begin (label) @end (void()) main() +(byte*) main::$16 $16 zp ZP_WORD:6 22.0 (label) main::@1 (label) main::@2 (label) main::@3 @@ -11,18 +12,18 @@ (byte) main::e (byte) main::e#1 reg byte x 11.0 (byte) main::e#2 reg byte x 22.0 -(byte) main::e#3 reg byte x 5.5 +(byte) main::e#3 reg byte x 4.4 (byte) main::e#5 reg byte x 16.5 (word) main::idx (word) main::idx#1 idx zp ZP_WORD:2 8.25 (word) main::idx#2 idx zp ZP_WORD:2 11.0 -(word) main::idx#3 idx zp ZP_WORD:2 11.0 +(word) main::idx#3 idx zp ZP_WORD:2 8.25 (word) main::idx#5 idx zp ZP_WORD:2 16.5 (byte[$28*$19]) main::screen (const byte[$28*$19]) main::screen#0 screen = ((byte*))(word/signed word/dword/signed dword) $400 (byte) main::x -(byte) main::x#1 reg byte y 3.666666666666667 -(byte) main::x#2 reg byte y 11.0 +(byte) main::x#1 x zp ZP_BYTE:4 3.666666666666667 +(byte) main::x#2 x zp ZP_BYTE:4 7.333333333333333 (byte) main::x0 (const byte) main::x0#0 x0 = (byte/signed byte/word/signed word/dword/signed dword) 0 (byte) main::x1 @@ -30,9 +31,9 @@ (byte) main::xd (const byte) main::xd#0 xd = (const byte) main::x1#0-(const byte) main::x0#0 (byte) main::y -(byte) main::y#1 y zp ZP_BYTE:4 7.333333333333333 -(byte) main::y#2 y zp ZP_BYTE:4 5.5 -(byte) main::y#4 y zp ZP_BYTE:4 16.5 +(byte) main::y#1 y zp ZP_BYTE:5 7.333333333333333 +(byte) main::y#2 y zp ZP_BYTE:5 4.714285714285714 +(byte) main::y#4 y zp ZP_BYTE:5 16.5 (byte) main::y0 (const byte) main::y0#0 y0 = (byte/signed byte/word/signed word/dword/signed dword) 0 (byte) main::y1 @@ -41,6 +42,7 @@ (const byte) main::yd#0 yd = (const byte) main::y1#0-(const byte) main::y0#0 zp ZP_WORD:2 [ main::idx#3 main::idx#5 main::idx#1 main::idx#2 ] -reg byte y [ main::x#2 main::x#1 ] +zp ZP_BYTE:4 [ main::x#2 main::x#1 ] reg byte x [ main::e#3 main::e#5 main::e#1 main::e#2 ] -zp ZP_BYTE:4 [ main::y#2 main::y#4 main::y#1 ] +zp ZP_BYTE:5 [ main::y#2 main::y#4 main::y#1 ] +zp ZP_WORD:6 [ main::$16 ] diff --git a/src/test/ref/examples/fire/fire.asm b/src/test/ref/examples/fire/fire.asm index 7d188c9f9..d14cf06e3 100644 --- a/src/test/ref/examples/fire/fire.asm +++ b/src/test/ref/examples/fire/fire.asm @@ -182,6 +182,7 @@ makecharset: { .label ii = $a .label i = 9 .label c = 8 + .label _22 = 2 lda #CHARSET @@ -270,19 +271,16 @@ makecharset: { bcc !+ inc _19+1 !: - tya - sta !v++1 - lda #CHARSET+1*8 - adc _19+1 - sta !a++2 - !v: - lda #0 - !a: - sta CHARSET+1*8 + lda _22 + adc #CHARSET+1*8 + sta _22+1 + tya + ldy #0 + sta (_22),y inc i lda i cmp #8 diff --git a/src/test/ref/examples/fire/fire.cfg b/src/test/ref/examples/fire/fire.cfg index f6f9e2321..c54e55308 100644 --- a/src/test/ref/examples/fire/fire.cfg +++ b/src/test/ref/examples/fire/fire.cfg @@ -150,36 +150,37 @@ makecharset::@8: scope:[makecharset] from makecharset::@6 [77] (word~) makecharset::$17 ← ((word)) (byte) makecharset::c#7 [78] (word~) makecharset::$18 ← (word~) makecharset::$17 << (byte/signed byte/word/signed word/dword/signed dword) 3 [79] (word~) makecharset::$19 ← (word~) makecharset::$18 + (byte) makecharset::i#6 - [80] *((const byte*) CHARSET#0+(byte/signed byte/word/signed word/dword/signed dword) 1*(byte/signed byte/word/signed word/dword/signed dword) 8 + (word~) makecharset::$19) ← (byte) makecharset::b#3 - [81] (byte) makecharset::i#1 ← ++ (byte) makecharset::i#6 - [82] if((byte) makecharset::i#1<(byte/signed byte/word/signed word/dword/signed dword) 8) goto makecharset::@4 + [80] (byte*) makecharset::$22 ← (const byte*) CHARSET#0+(byte/signed byte/word/signed word/dword/signed dword) 1*(byte/signed byte/word/signed word/dword/signed dword) 8 + (word~) makecharset::$19 + [81] *((byte*) makecharset::$22) ← (byte) makecharset::b#3 + [82] (byte) makecharset::i#1 ← ++ (byte) makecharset::i#6 + [83] if((byte) makecharset::i#1<(byte/signed byte/word/signed word/dword/signed dword) 8) goto makecharset::@4 to:makecharset::@9 makecharset::@9: scope:[makecharset] from makecharset::@8 - [83] (byte) makecharset::c#1 ← ++ (byte) makecharset::c#7 - [84] if((byte) makecharset::c#1<(byte/signed byte/word/signed word/dword/signed dword) $40) goto makecharset::@3 + [84] (byte) makecharset::c#1 ← ++ (byte) makecharset::c#7 + [85] if((byte) makecharset::c#1<(byte/signed byte/word/signed word/dword/signed dword) $40) goto makecharset::@3 to:makecharset::@return makecharset::@return: scope:[makecharset] from makecharset::@9 - [85] return + [86] return to:@return sid_rnd_init: scope:[sid_rnd_init] from main::@7 - [86] *((const word*) SID_VOICE3_FREQ#0) ← (word/dword/signed dword) $ffff - [87] *((const byte*) SID_VOICE3_CONTROL#0) ← (const byte) SID_CONTROL_NOISE#0 + [87] *((const word*) SID_VOICE3_FREQ#0) ← (word/dword/signed dword) $ffff + [88] *((const byte*) SID_VOICE3_CONTROL#0) ← (const byte) SID_CONTROL_NOISE#0 to:sid_rnd_init::@return sid_rnd_init::@return: scope:[sid_rnd_init] from sid_rnd_init - [88] return + [89] return to:@return fillscreen: scope:[fillscreen] from main main::@4 main::@5 main::@6 - [89] (byte*) fillscreen::screen#6 ← phi( main/(const byte*) BUFFER#0 main::@5/(const byte*) SCREEN2#0 main::@6/(const byte*) COLS#0 main::@4/(const byte*) SCREEN1#0 ) - [89] (byte) fillscreen::fill#5 ← phi( main/(byte/signed byte/word/signed word/dword/signed dword) 0 main::@5/(byte/signed byte/word/signed word/dword/signed dword) 0 main::@6/(const byte) YELLOW#0 main::@4/(byte/signed byte/word/signed word/dword/signed dword) 0 ) + [90] (byte*) fillscreen::screen#6 ← phi( main/(const byte*) BUFFER#0 main::@5/(const byte*) SCREEN2#0 main::@6/(const byte*) COLS#0 main::@4/(const byte*) SCREEN1#0 ) + [90] (byte) fillscreen::fill#5 ← phi( main/(byte/signed byte/word/signed word/dword/signed dword) 0 main::@5/(byte/signed byte/word/signed word/dword/signed dword) 0 main::@6/(const byte) YELLOW#0 main::@4/(byte/signed byte/word/signed word/dword/signed dword) 0 ) to:fillscreen::@1 fillscreen::@1: scope:[fillscreen] from fillscreen fillscreen::@1 - [90] (word) fillscreen::i#2 ← phi( fillscreen/(byte/signed byte/word/signed word/dword/signed dword) 0 fillscreen::@1/(word) fillscreen::i#1 ) - [90] (byte*) fillscreen::screen#5 ← phi( fillscreen/(byte*) fillscreen::screen#6 fillscreen::@1/(byte*) fillscreen::screen#4 ) - [91] *((byte*) fillscreen::screen#5) ← (byte) fillscreen::fill#5 - [92] (byte*) fillscreen::screen#4 ← ++ (byte*) fillscreen::screen#5 - [93] (word) fillscreen::i#1 ← ++ (word) fillscreen::i#2 - [94] if((word) fillscreen::i#1!=(word/signed word/dword/signed dword) $3e8) goto fillscreen::@1 + [91] (word) fillscreen::i#2 ← phi( fillscreen/(byte/signed byte/word/signed word/dword/signed dword) 0 fillscreen::@1/(word) fillscreen::i#1 ) + [91] (byte*) fillscreen::screen#5 ← phi( fillscreen/(byte*) fillscreen::screen#6 fillscreen::@1/(byte*) fillscreen::screen#4 ) + [92] *((byte*) fillscreen::screen#5) ← (byte) fillscreen::fill#5 + [93] (byte*) fillscreen::screen#4 ← ++ (byte*) fillscreen::screen#5 + [94] (word) fillscreen::i#1 ← ++ (word) fillscreen::i#2 + [95] if((word) fillscreen::i#1!=(word/signed word/dword/signed dword) $3e8) goto fillscreen::@1 to:fillscreen::@return fillscreen::@return: scope:[fillscreen] from fillscreen::@1 - [95] return + [96] return to:@return diff --git a/src/test/ref/examples/fire/fire.log b/src/test/ref/examples/fire/fire.log index 95ebffa1c..7df9affea 100644 --- a/src/test/ref/examples/fire/fire.log +++ b/src/test/ref/examples/fire/fire.log @@ -834,6 +834,8 @@ Rewriting conditional comparison if((byte) makecharset::bc#1<=(byte/signed byte/ Rewriting division to use shift (byte) fire::c#0 ← (byte~) fire::$11 / (byte/signed byte/word/signed word/dword/signed dword) 4 Rewriting division to use shift (byte/signed word/word/dword/signed dword~) fire::$16 ← (byte~) fire::$15 / (byte/signed byte/word/signed word/dword/signed dword) $10 Successful SSA optimization Pass2MultiplyToShiftRewriting +De-inlining pointer[w] to *(pointer+w) *((byte*~) makecharset::$16 + (word~) makecharset::$19) ← (byte) makecharset::b#3 +Successful SSA optimization Pass2DeInlineWordDerefIdx Culled Empty Block (label) @4 Culled Empty Block (label) @6 Culled Empty Block (label) main::@1 @@ -968,19 +970,19 @@ Coalesced [59] fire::c#4 ← fire::c#0 Coalesced [73] makecharset::bc#9 ← makecharset::bc#5 Coalesced [82] makecharset::bc#12 ← makecharset::bc#2 Coalesced [83] makecharset::b#8 ← makecharset::b#1 -Coalesced [96] makecharset::c#9 ← makecharset::c#1 -Coalesced [97] makecharset::bc#8 ← makecharset::bc#6 -Coalesced [98] makecharset::i#7 ← makecharset::i#1 -Coalesced (already) [99] makecharset::bc#10 ← makecharset::bc#6 -Coalesced [100] makecharset::ii#5 ← makecharset::ii#1 -Coalesced [101] makecharset::b#6 ← makecharset::b#3 -Coalesced [102] makecharset::bc#11 ← makecharset::bc#1 -Coalesced (already) [103] makecharset::b#7 ← makecharset::b#2 -Coalesced [104] makecharset::font1#3 ← makecharset::font1#1 -Coalesced [105] makecharset::font#3 ← makecharset::font#1 -Coalesced [110] fillscreen::screen#7 ← fillscreen::screen#6 -Coalesced [117] fillscreen::screen#8 ← fillscreen::screen#4 -Coalesced [118] fillscreen::i#3 ← fillscreen::i#1 +Coalesced [97] makecharset::c#9 ← makecharset::c#1 +Coalesced [98] makecharset::bc#8 ← makecharset::bc#6 +Coalesced [99] makecharset::i#7 ← makecharset::i#1 +Coalesced (already) [100] makecharset::bc#10 ← makecharset::bc#6 +Coalesced [101] makecharset::ii#5 ← makecharset::ii#1 +Coalesced [102] makecharset::b#6 ← makecharset::b#3 +Coalesced [103] makecharset::bc#11 ← makecharset::bc#1 +Coalesced (already) [104] makecharset::b#7 ← makecharset::b#2 +Coalesced [105] makecharset::font1#3 ← makecharset::font1#1 +Coalesced [106] makecharset::font#3 ← makecharset::font#1 +Coalesced [111] fillscreen::screen#7 ← fillscreen::screen#6 +Coalesced [118] fillscreen::screen#8 ← fillscreen::screen#4 +Coalesced [119] fillscreen::i#3 ← fillscreen::i#1 Coalesced down to 16 phi equivalence classes Culled Empty Block (label) fire::@12 Culled Empty Block (label) fire::@13 @@ -1177,38 +1179,39 @@ makecharset::@8: scope:[makecharset] from makecharset::@6 [77] (word~) makecharset::$17 ← ((word)) (byte) makecharset::c#7 [78] (word~) makecharset::$18 ← (word~) makecharset::$17 << (byte/signed byte/word/signed word/dword/signed dword) 3 [79] (word~) makecharset::$19 ← (word~) makecharset::$18 + (byte) makecharset::i#6 - [80] *((const byte*) CHARSET#0+(byte/signed byte/word/signed word/dword/signed dword) 1*(byte/signed byte/word/signed word/dword/signed dword) 8 + (word~) makecharset::$19) ← (byte) makecharset::b#3 - [81] (byte) makecharset::i#1 ← ++ (byte) makecharset::i#6 - [82] if((byte) makecharset::i#1<(byte/signed byte/word/signed word/dword/signed dword) 8) goto makecharset::@4 + [80] (byte*) makecharset::$22 ← (const byte*) CHARSET#0+(byte/signed byte/word/signed word/dword/signed dword) 1*(byte/signed byte/word/signed word/dword/signed dword) 8 + (word~) makecharset::$19 + [81] *((byte*) makecharset::$22) ← (byte) makecharset::b#3 + [82] (byte) makecharset::i#1 ← ++ (byte) makecharset::i#6 + [83] if((byte) makecharset::i#1<(byte/signed byte/word/signed word/dword/signed dword) 8) goto makecharset::@4 to:makecharset::@9 makecharset::@9: scope:[makecharset] from makecharset::@8 - [83] (byte) makecharset::c#1 ← ++ (byte) makecharset::c#7 - [84] if((byte) makecharset::c#1<(byte/signed byte/word/signed word/dword/signed dword) $40) goto makecharset::@3 + [84] (byte) makecharset::c#1 ← ++ (byte) makecharset::c#7 + [85] if((byte) makecharset::c#1<(byte/signed byte/word/signed word/dword/signed dword) $40) goto makecharset::@3 to:makecharset::@return makecharset::@return: scope:[makecharset] from makecharset::@9 - [85] return + [86] return to:@return sid_rnd_init: scope:[sid_rnd_init] from main::@7 - [86] *((const word*) SID_VOICE3_FREQ#0) ← (word/dword/signed dword) $ffff - [87] *((const byte*) SID_VOICE3_CONTROL#0) ← (const byte) SID_CONTROL_NOISE#0 + [87] *((const word*) SID_VOICE3_FREQ#0) ← (word/dword/signed dword) $ffff + [88] *((const byte*) SID_VOICE3_CONTROL#0) ← (const byte) SID_CONTROL_NOISE#0 to:sid_rnd_init::@return sid_rnd_init::@return: scope:[sid_rnd_init] from sid_rnd_init - [88] return + [89] return to:@return fillscreen: scope:[fillscreen] from main main::@4 main::@5 main::@6 - [89] (byte*) fillscreen::screen#6 ← phi( main/(const byte*) BUFFER#0 main::@5/(const byte*) SCREEN2#0 main::@6/(const byte*) COLS#0 main::@4/(const byte*) SCREEN1#0 ) - [89] (byte) fillscreen::fill#5 ← phi( main/(byte/signed byte/word/signed word/dword/signed dword) 0 main::@5/(byte/signed byte/word/signed word/dword/signed dword) 0 main::@6/(const byte) YELLOW#0 main::@4/(byte/signed byte/word/signed word/dword/signed dword) 0 ) + [90] (byte*) fillscreen::screen#6 ← phi( main/(const byte*) BUFFER#0 main::@5/(const byte*) SCREEN2#0 main::@6/(const byte*) COLS#0 main::@4/(const byte*) SCREEN1#0 ) + [90] (byte) fillscreen::fill#5 ← phi( main/(byte/signed byte/word/signed word/dword/signed dword) 0 main::@5/(byte/signed byte/word/signed word/dword/signed dword) 0 main::@6/(const byte) YELLOW#0 main::@4/(byte/signed byte/word/signed word/dword/signed dword) 0 ) to:fillscreen::@1 fillscreen::@1: scope:[fillscreen] from fillscreen fillscreen::@1 - [90] (word) fillscreen::i#2 ← phi( fillscreen/(byte/signed byte/word/signed word/dword/signed dword) 0 fillscreen::@1/(word) fillscreen::i#1 ) - [90] (byte*) fillscreen::screen#5 ← phi( fillscreen/(byte*) fillscreen::screen#6 fillscreen::@1/(byte*) fillscreen::screen#4 ) - [91] *((byte*) fillscreen::screen#5) ← (byte) fillscreen::fill#5 - [92] (byte*) fillscreen::screen#4 ← ++ (byte*) fillscreen::screen#5 - [93] (word) fillscreen::i#1 ← ++ (word) fillscreen::i#2 - [94] if((word) fillscreen::i#1!=(word/signed word/dword/signed dword) $3e8) goto fillscreen::@1 + [91] (word) fillscreen::i#2 ← phi( fillscreen/(byte/signed byte/word/signed word/dword/signed dword) 0 fillscreen::@1/(word) fillscreen::i#1 ) + [91] (byte*) fillscreen::screen#5 ← phi( fillscreen/(byte*) fillscreen::screen#6 fillscreen::@1/(byte*) fillscreen::screen#4 ) + [92] *((byte*) fillscreen::screen#5) ← (byte) fillscreen::fill#5 + [93] (byte*) fillscreen::screen#4 ← ++ (byte*) fillscreen::screen#5 + [94] (word) fillscreen::i#1 ← ++ (word) fillscreen::i#2 + [95] if((word) fillscreen::i#1!=(word/signed word/dword/signed dword) $3e8) goto fillscreen::@1 to:fillscreen::@return fillscreen::@return: scope:[fillscreen] from fillscreen::@1 - [95] return + [96] return to:@return @@ -1294,20 +1297,21 @@ VARIABLE REGISTER WEIGHTS (word~) makecharset::$17 202.0 (word~) makecharset::$18 202.0 (word~) makecharset::$19 202.0 +(byte*) makecharset::$22 202.0 (byte) makecharset::b (byte) makecharset::b#1 2002.0 (byte) makecharset::b#2 429.0 -(byte) makecharset::b#3 517.3333333333334 +(byte) makecharset::b#3 443.42857142857144 (byte) makecharset::bc (byte) makecharset::bc#1 2002.0 (byte) makecharset::bc#2 400.4 (byte) makecharset::bc#3 2103.0 (byte) makecharset::bc#5 202.0 -(byte) makecharset::bc#6 344.8888888888889 +(byte) makecharset::bc#6 310.4 (byte[8]) makecharset::bittab (byte) makecharset::c (byte) makecharset::c#1 16.5 -(byte) makecharset::c#7 59.15789473684211 +(byte) makecharset::c#7 56.19999999999999 (byte*) makecharset::charset (byte*) makecharset::font (byte*) makecharset::font#1 16.5 @@ -1317,7 +1321,7 @@ VARIABLE REGISTER WEIGHTS (byte*) makecharset::font1#2 16.5 (byte) makecharset::i (byte) makecharset::i#1 151.5 -(byte) makecharset::i#6 81.5 +(byte) makecharset::i#6 76.70588235294117 (byte) makecharset::ii (byte) makecharset::ii#1 1501.5 (byte) makecharset::ii#2 333.6666666666667 @@ -1358,6 +1362,7 @@ Added variable makecharset::$13 to zero page equivalence class [ makecharset::$1 Added variable makecharset::$17 to zero page equivalence class [ makecharset::$17 ] Added variable makecharset::$18 to zero page equivalence class [ makecharset::$18 ] Added variable makecharset::$19 to zero page equivalence class [ makecharset::$19 ] +Added variable makecharset::$22 to zero page equivalence class [ makecharset::$22 ] Complete equivalence classes [ fire::screen#0 ] [ fire::buffer#4 fire::buffer#2 ] @@ -1389,6 +1394,7 @@ Complete equivalence classes [ makecharset::$17 ] [ makecharset::$18 ] [ makecharset::$19 ] +[ makecharset::$22 ] Allocated zp ZP_WORD:2 [ fire::screen#0 ] Allocated zp ZP_WORD:4 [ fire::buffer#4 fire::buffer#2 ] Allocated zp ZP_WORD:6 [ fire::screen#4 fire::screen#10 fire::screen#2 ] @@ -1419,6 +1425,7 @@ Allocated zp ZP_BYTE:37 [ makecharset::$13 ] Allocated zp ZP_WORD:38 [ makecharset::$17 ] Allocated zp ZP_WORD:40 [ makecharset::$18 ] Allocated zp ZP_WORD:42 [ makecharset::$19 ] +Allocated zp ZP_WORD:44 [ makecharset::$22 ] INITIAL ASM //SEG0 File Comments @@ -1476,14 +1483,14 @@ main: { lda #BLACK sta BGCOL //SEG13 [7] call fillscreen - //SEG14 [89] phi from main to fillscreen [phi:main->fillscreen] + //SEG14 [90] phi from main to fillscreen [phi:main->fillscreen] fillscreen_from_main: - //SEG15 [89] phi (byte*) fillscreen::screen#6 = (const byte*) BUFFER#0 [phi:main->fillscreen#0] -- pbuz1=pbuc1 + //SEG15 [90] phi (byte*) fillscreen::screen#6 = (const byte*) BUFFER#0 [phi:main->fillscreen#0] -- pbuz1=pbuc1 lda #BUFFER sta fillscreen.screen+1 - //SEG16 [89] phi (byte) fillscreen::fill#5 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->fillscreen#1] -- vbuz1=vbuc1 + //SEG16 [90] phi (byte) fillscreen::fill#5 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->fillscreen#1] -- vbuz1=vbuc1 lda #0 sta fillscreen.fill jsr fillscreen @@ -1493,14 +1500,14 @@ main: { //SEG18 main::@4 b4: //SEG19 [9] call fillscreen - //SEG20 [89] phi from main::@4 to fillscreen [phi:main::@4->fillscreen] + //SEG20 [90] phi from main::@4 to fillscreen [phi:main::@4->fillscreen] fillscreen_from_b4: - //SEG21 [89] phi (byte*) fillscreen::screen#6 = (const byte*) SCREEN1#0 [phi:main::@4->fillscreen#0] -- pbuz1=pbuc1 + //SEG21 [90] phi (byte*) fillscreen::screen#6 = (const byte*) SCREEN1#0 [phi:main::@4->fillscreen#0] -- pbuz1=pbuc1 lda #SCREEN1 sta fillscreen.screen+1 - //SEG22 [89] phi (byte) fillscreen::fill#5 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@4->fillscreen#1] -- vbuz1=vbuc1 + //SEG22 [90] phi (byte) fillscreen::fill#5 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@4->fillscreen#1] -- vbuz1=vbuc1 lda #0 sta fillscreen.fill jsr fillscreen @@ -1510,14 +1517,14 @@ main: { //SEG24 main::@5 b5: //SEG25 [11] call fillscreen - //SEG26 [89] phi from main::@5 to fillscreen [phi:main::@5->fillscreen] + //SEG26 [90] phi from main::@5 to fillscreen [phi:main::@5->fillscreen] fillscreen_from_b5: - //SEG27 [89] phi (byte*) fillscreen::screen#6 = (const byte*) SCREEN2#0 [phi:main::@5->fillscreen#0] -- pbuz1=pbuc1 + //SEG27 [90] phi (byte*) fillscreen::screen#6 = (const byte*) SCREEN2#0 [phi:main::@5->fillscreen#0] -- pbuz1=pbuc1 lda #SCREEN2 sta fillscreen.screen+1 - //SEG28 [89] phi (byte) fillscreen::fill#5 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@5->fillscreen#1] -- vbuz1=vbuc1 + //SEG28 [90] phi (byte) fillscreen::fill#5 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@5->fillscreen#1] -- vbuz1=vbuc1 lda #0 sta fillscreen.fill jsr fillscreen @@ -1527,14 +1534,14 @@ main: { //SEG30 main::@6 b6: //SEG31 [13] call fillscreen - //SEG32 [89] phi from main::@6 to fillscreen [phi:main::@6->fillscreen] + //SEG32 [90] phi from main::@6 to fillscreen [phi:main::@6->fillscreen] fillscreen_from_b6: - //SEG33 [89] phi (byte*) fillscreen::screen#6 = (const byte*) COLS#0 [phi:main::@6->fillscreen#0] -- pbuz1=pbuc1 + //SEG33 [90] phi (byte*) fillscreen::screen#6 = (const byte*) COLS#0 [phi:main::@6->fillscreen#0] -- pbuz1=pbuc1 lda #COLS sta fillscreen.screen+1 - //SEG34 [89] phi (byte) fillscreen::fill#5 = (const byte) YELLOW#0 [phi:main::@6->fillscreen#1] -- vbuz1=vbuc1 + //SEG34 [90] phi (byte) fillscreen::fill#5 = (const byte) YELLOW#0 [phi:main::@6->fillscreen#1] -- vbuz1=vbuc1 lda #YELLOW sta fillscreen.fill jsr fillscreen @@ -1825,6 +1832,7 @@ makecharset: { .label b = $15 .label i = $12 .label c = $11 + .label _22 = $2c //SEG110 [56] phi from makecharset to makecharset::@1 [phi:makecharset->makecharset::@1] b1_from_makecharset: //SEG111 [56] phi (byte*) makecharset::font#2 = (const byte*) CHARSET#0 [phi:makecharset->makecharset::@1#0] -- pbuz1=pbuc1 @@ -2007,97 +2015,95 @@ makecharset: { lda #0 adc _18+1 sta _19+1 - //SEG165 [80] *((const byte*) CHARSET#0+(byte/signed byte/word/signed word/dword/signed dword) 1*(byte/signed byte/word/signed word/dword/signed dword) 8 + (word~) makecharset::$19) ← (byte) makecharset::b#3 -- pbuc1_derefidx_vwuz1=vbuz2 - lda b - sta !v++1 - lda #CHARSET+1*8 - adc _19+1 - sta !a++2 - !v: - lda #0 - !a: - sta CHARSET+1*8 - //SEG166 [81] (byte) makecharset::i#1 ← ++ (byte) makecharset::i#6 -- vbuz1=_inc_vbuz1 + adc #CHARSET+1*8 + sta _22+1 + //SEG166 [81] *((byte*) makecharset::$22) ← (byte) makecharset::b#3 -- _deref_pbuz1=vbuz2 + lda b + ldy #0 + sta (_22),y + //SEG167 [82] (byte) makecharset::i#1 ← ++ (byte) makecharset::i#6 -- vbuz1=_inc_vbuz1 inc i - //SEG167 [82] if((byte) makecharset::i#1<(byte/signed byte/word/signed word/dword/signed dword) 8) goto makecharset::@4 -- vbuz1_lt_vbuc1_then_la1 + //SEG168 [83] if((byte) makecharset::i#1<(byte/signed byte/word/signed word/dword/signed dword) 8) goto makecharset::@4 -- vbuz1_lt_vbuc1_then_la1 lda i cmp #8 bcc b4_from_b8 jmp b9 - //SEG168 makecharset::@9 + //SEG169 makecharset::@9 b9: - //SEG169 [83] (byte) makecharset::c#1 ← ++ (byte) makecharset::c#7 -- vbuz1=_inc_vbuz1 + //SEG170 [84] (byte) makecharset::c#1 ← ++ (byte) makecharset::c#7 -- vbuz1=_inc_vbuz1 inc c - //SEG170 [84] if((byte) makecharset::c#1<(byte/signed byte/word/signed word/dword/signed dword) $40) goto makecharset::@3 -- vbuz1_lt_vbuc1_then_la1 + //SEG171 [85] if((byte) makecharset::c#1<(byte/signed byte/word/signed word/dword/signed dword) $40) goto makecharset::@3 -- vbuz1_lt_vbuc1_then_la1 lda c cmp #$40 bcc b3_from_b9 jmp breturn - //SEG171 makecharset::@return + //SEG172 makecharset::@return breturn: - //SEG172 [85] return + //SEG173 [86] return rts bittab: .byte 1, 2, 4, 8, $10, $20, $40, $80 } -//SEG173 sid_rnd_init +//SEG174 sid_rnd_init // Initialize SID voice 3 for random number generation sid_rnd_init: { - //SEG174 [86] *((const word*) SID_VOICE3_FREQ#0) ← (word/dword/signed dword) $ffff -- _deref_pwuc1=vwuc2 + //SEG175 [87] *((const word*) SID_VOICE3_FREQ#0) ← (word/dword/signed dword) $ffff -- _deref_pwuc1=vwuc2 lda #<$ffff sta SID_VOICE3_FREQ lda #>$ffff sta SID_VOICE3_FREQ+1 - //SEG175 [87] *((const byte*) SID_VOICE3_CONTROL#0) ← (const byte) SID_CONTROL_NOISE#0 -- _deref_pbuc1=vbuc2 + //SEG176 [88] *((const byte*) SID_VOICE3_CONTROL#0) ← (const byte) SID_CONTROL_NOISE#0 -- _deref_pbuc1=vbuc2 lda #SID_CONTROL_NOISE sta SID_VOICE3_CONTROL jmp breturn - //SEG176 sid_rnd_init::@return + //SEG177 sid_rnd_init::@return breturn: - //SEG177 [88] return + //SEG178 [89] return rts } -//SEG178 fillscreen +//SEG179 fillscreen // Fill a screen (1000 bytes) with a specific byte // fillscreen(byte* zeropage($17) screen, byte zeropage($16) fill) fillscreen: { .label screen = $17 .label i = $19 .label fill = $16 - //SEG179 [90] phi from fillscreen to fillscreen::@1 [phi:fillscreen->fillscreen::@1] + //SEG180 [91] phi from fillscreen to fillscreen::@1 [phi:fillscreen->fillscreen::@1] b1_from_fillscreen: - //SEG180 [90] phi (word) fillscreen::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:fillscreen->fillscreen::@1#0] -- vwuz1=vbuc1 + //SEG181 [91] phi (word) fillscreen::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:fillscreen->fillscreen::@1#0] -- vwuz1=vbuc1 lda #0 sta i lda #0 sta i+1 - //SEG181 [90] phi (byte*) fillscreen::screen#5 = (byte*) fillscreen::screen#6 [phi:fillscreen->fillscreen::@1#1] -- register_copy + //SEG182 [91] phi (byte*) fillscreen::screen#5 = (byte*) fillscreen::screen#6 [phi:fillscreen->fillscreen::@1#1] -- register_copy jmp b1 - //SEG182 [90] phi from fillscreen::@1 to fillscreen::@1 [phi:fillscreen::@1->fillscreen::@1] + //SEG183 [91] phi from fillscreen::@1 to fillscreen::@1 [phi:fillscreen::@1->fillscreen::@1] b1_from_b1: - //SEG183 [90] phi (word) fillscreen::i#2 = (word) fillscreen::i#1 [phi:fillscreen::@1->fillscreen::@1#0] -- register_copy - //SEG184 [90] phi (byte*) fillscreen::screen#5 = (byte*) fillscreen::screen#4 [phi:fillscreen::@1->fillscreen::@1#1] -- register_copy + //SEG184 [91] phi (word) fillscreen::i#2 = (word) fillscreen::i#1 [phi:fillscreen::@1->fillscreen::@1#0] -- register_copy + //SEG185 [91] phi (byte*) fillscreen::screen#5 = (byte*) fillscreen::screen#4 [phi:fillscreen::@1->fillscreen::@1#1] -- register_copy jmp b1 - //SEG185 fillscreen::@1 + //SEG186 fillscreen::@1 b1: - //SEG186 [91] *((byte*) fillscreen::screen#5) ← (byte) fillscreen::fill#5 -- _deref_pbuz1=vbuz2 + //SEG187 [92] *((byte*) fillscreen::screen#5) ← (byte) fillscreen::fill#5 -- _deref_pbuz1=vbuz2 lda fill ldy #0 sta (screen),y - //SEG187 [92] (byte*) fillscreen::screen#4 ← ++ (byte*) fillscreen::screen#5 -- pbuz1=_inc_pbuz1 + //SEG188 [93] (byte*) fillscreen::screen#4 ← ++ (byte*) fillscreen::screen#5 -- pbuz1=_inc_pbuz1 inc screen bne !+ inc screen+1 !: - //SEG188 [93] (word) fillscreen::i#1 ← ++ (word) fillscreen::i#2 -- vwuz1=_inc_vwuz1 + //SEG189 [94] (word) fillscreen::i#1 ← ++ (word) fillscreen::i#2 -- vwuz1=_inc_vwuz1 inc i bne !+ inc i+1 !: - //SEG189 [94] if((word) fillscreen::i#1!=(word/signed word/dword/signed dword) $3e8) goto fillscreen::@1 -- vwuz1_neq_vwuc1_then_la1 + //SEG190 [95] if((word) fillscreen::i#1!=(word/signed word/dword/signed dword) $3e8) goto fillscreen::@1 -- vwuz1_neq_vwuc1_then_la1 lda i+1 cmp #>$3e8 bne b1_from_b1 @@ -2105,9 +2111,9 @@ fillscreen: { cmp #<$3e8 bne b1_from_b1 jmp breturn - //SEG190 fillscreen::@return + //SEG191 fillscreen::@return breturn: - //SEG191 [95] return + //SEG192 [96] return rts } @@ -2147,12 +2153,16 @@ Statement [73] (byte) makecharset::b#1 ← (byte) makecharset::b#2 + *((const by Statement [77] (word~) makecharset::$17 ← ((word)) (byte) makecharset::c#7 [ makecharset::c#7 makecharset::i#6 makecharset::bc#6 makecharset::b#3 makecharset::$17 ] ( main:2::makecharset:17 [ makecharset::c#7 makecharset::i#6 makecharset::bc#6 makecharset::b#3 makecharset::$17 ] ) always clobbers reg byte a Statement [78] (word~) makecharset::$18 ← (word~) makecharset::$17 << (byte/signed byte/word/signed word/dword/signed dword) 3 [ makecharset::c#7 makecharset::i#6 makecharset::bc#6 makecharset::b#3 makecharset::$18 ] ( main:2::makecharset:17 [ makecharset::c#7 makecharset::i#6 makecharset::bc#6 makecharset::b#3 makecharset::$18 ] ) always clobbers reg byte a Statement [79] (word~) makecharset::$19 ← (word~) makecharset::$18 + (byte) makecharset::i#6 [ makecharset::c#7 makecharset::i#6 makecharset::bc#6 makecharset::b#3 makecharset::$19 ] ( main:2::makecharset:17 [ makecharset::c#7 makecharset::i#6 makecharset::bc#6 makecharset::b#3 makecharset::$19 ] ) always clobbers reg byte a -Statement [80] *((const byte*) CHARSET#0+(byte/signed byte/word/signed word/dword/signed dword) 1*(byte/signed byte/word/signed word/dword/signed dword) 8 + (word~) makecharset::$19) ← (byte) makecharset::b#3 [ makecharset::c#7 makecharset::i#6 makecharset::bc#6 ] ( main:2::makecharset:17 [ makecharset::c#7 makecharset::i#6 makecharset::bc#6 ] ) always clobbers reg byte a -Statement [86] *((const word*) SID_VOICE3_FREQ#0) ← (word/dword/signed dword) $ffff [ ] ( main:2::sid_rnd_init:15 [ ] ) always clobbers reg byte a -Statement [87] *((const byte*) SID_VOICE3_CONTROL#0) ← (const byte) SID_CONTROL_NOISE#0 [ ] ( main:2::sid_rnd_init:15 [ ] ) always clobbers reg byte a -Statement [91] *((byte*) fillscreen::screen#5) ← (byte) fillscreen::fill#5 [ fillscreen::fill#5 fillscreen::screen#5 fillscreen::i#2 ] ( main:2::fillscreen:7 [ fillscreen::fill#5 fillscreen::screen#5 fillscreen::i#2 ] main:2::fillscreen:9 [ fillscreen::fill#5 fillscreen::screen#5 fillscreen::i#2 ] main:2::fillscreen:11 [ fillscreen::fill#5 fillscreen::screen#5 fillscreen::i#2 ] main:2::fillscreen:13 [ fillscreen::fill#5 fillscreen::screen#5 fillscreen::i#2 ] ) always clobbers reg byte y +Statement [80] (byte*) makecharset::$22 ← (const byte*) CHARSET#0+(byte/signed byte/word/signed word/dword/signed dword) 1*(byte/signed byte/word/signed word/dword/signed dword) 8 + (word~) makecharset::$19 [ makecharset::c#7 makecharset::i#6 makecharset::bc#6 makecharset::b#3 makecharset::$22 ] ( main:2::makecharset:17 [ makecharset::c#7 makecharset::i#6 makecharset::bc#6 makecharset::b#3 makecharset::$22 ] ) always clobbers reg byte a +Statement [81] *((byte*) makecharset::$22) ← (byte) makecharset::b#3 [ makecharset::c#7 makecharset::i#6 makecharset::bc#6 ] ( main:2::makecharset:17 [ makecharset::c#7 makecharset::i#6 makecharset::bc#6 ] ) always clobbers reg byte a reg byte y +Removing always clobbered register reg byte y as potential for zp ZP_BYTE:17 [ makecharset::c#7 makecharset::c#1 ] +Removing always clobbered register reg byte y as potential for zp ZP_BYTE:18 [ makecharset::i#6 makecharset::i#1 ] +Removing always clobbered register reg byte y as potential for zp ZP_BYTE:19 [ makecharset::bc#3 makecharset::bc#5 makecharset::bc#6 makecharset::bc#1 makecharset::bc#2 ] +Statement [87] *((const word*) SID_VOICE3_FREQ#0) ← (word/dword/signed dword) $ffff [ ] ( main:2::sid_rnd_init:15 [ ] ) always clobbers reg byte a +Statement [88] *((const byte*) SID_VOICE3_CONTROL#0) ← (const byte) SID_CONTROL_NOISE#0 [ ] ( main:2::sid_rnd_init:15 [ ] ) always clobbers reg byte a +Statement [92] *((byte*) fillscreen::screen#5) ← (byte) fillscreen::fill#5 [ fillscreen::fill#5 fillscreen::screen#5 fillscreen::i#2 ] ( main:2::fillscreen:7 [ fillscreen::fill#5 fillscreen::screen#5 fillscreen::i#2 ] main:2::fillscreen:9 [ fillscreen::fill#5 fillscreen::screen#5 fillscreen::i#2 ] main:2::fillscreen:11 [ fillscreen::fill#5 fillscreen::screen#5 fillscreen::i#2 ] main:2::fillscreen:13 [ fillscreen::fill#5 fillscreen::screen#5 fillscreen::i#2 ] ) always clobbers reg byte y Removing always clobbered register reg byte y as potential for zp ZP_BYTE:22 [ fillscreen::fill#5 ] -Statement [94] if((word) fillscreen::i#1!=(word/signed word/dword/signed dword) $3e8) goto fillscreen::@1 [ fillscreen::fill#5 fillscreen::screen#4 fillscreen::i#1 ] ( main:2::fillscreen:7 [ fillscreen::fill#5 fillscreen::screen#4 fillscreen::i#1 ] main:2::fillscreen:9 [ fillscreen::fill#5 fillscreen::screen#4 fillscreen::i#1 ] main:2::fillscreen:11 [ fillscreen::fill#5 fillscreen::screen#4 fillscreen::i#1 ] main:2::fillscreen:13 [ fillscreen::fill#5 fillscreen::screen#4 fillscreen::i#1 ] ) always clobbers reg byte a +Statement [95] if((word) fillscreen::i#1!=(word/signed word/dword/signed dword) $3e8) goto fillscreen::@1 [ fillscreen::fill#5 fillscreen::screen#4 fillscreen::i#1 ] ( main:2::fillscreen:7 [ fillscreen::fill#5 fillscreen::screen#4 fillscreen::i#1 ] main:2::fillscreen:9 [ fillscreen::fill#5 fillscreen::screen#4 fillscreen::i#1 ] main:2::fillscreen:11 [ fillscreen::fill#5 fillscreen::screen#4 fillscreen::i#1 ] main:2::fillscreen:13 [ fillscreen::fill#5 fillscreen::screen#4 fillscreen::i#1 ] ) always clobbers reg byte a Removing always clobbered register reg byte a as potential for zp ZP_BYTE:22 [ fillscreen::fill#5 ] Statement [5] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 [ ] ( main:2 [ ] ) always clobbers reg byte a Statement [6] *((const byte*) BGCOL#0) ← (const byte) BLACK#0 [ ] ( main:2 [ ] ) always clobbers reg byte a @@ -2177,18 +2187,63 @@ Statement [59] if((byte*) makecharset::font#1!=(const byte*) CHARSET#0+(byte/sig Statement [61] *((byte*) makecharset::font1#2) ← (byte/word/signed word/dword/signed dword) $ff [ makecharset::font1#2 ] ( main:2::makecharset:17 [ makecharset::font1#2 ] ) always clobbers reg byte a reg byte y Statement [63] if((byte*) makecharset::font1#1!=(const byte*) CHARSET#0+(word/signed word/dword/signed dword) $100*(byte/signed byte/word/signed word/dword/signed dword) 8) goto makecharset::@2 [ makecharset::font1#1 ] ( main:2::makecharset:17 [ makecharset::font1#1 ] ) always clobbers reg byte a Statement [67] (byte) makecharset::bc#1 ← (byte) makecharset::bc#3 + (byte) makecharset::c#7 [ makecharset::c#7 makecharset::i#6 makecharset::ii#2 makecharset::b#2 makecharset::bc#1 ] ( main:2::makecharset:17 [ makecharset::c#7 makecharset::i#6 makecharset::ii#2 makecharset::b#2 makecharset::bc#1 ] ) always clobbers reg byte a -Statement [69] (byte) makecharset::bc#2 ← (byte) makecharset::bc#1 - (byte/signed byte/word/signed word/dword/signed dword) $40 [ makecharset::c#7 makecharset::i#6 makecharset::ii#2 makecharset::b#2 makecharset::bc#2 ] ( main:2::makecharset:17 [ makecharset::c#7 makecharset::i#6 makecharset::ii#2 makecharset::b#2 makecharset::bc#2 ] ) always clobbers reg byte a +Statement [69] (byte) makecharset::bc#2 ← (byte) makecharset::bc#1 - (byte/signed byte/word/signed word/dword/signed dword) $40 [ makecharset::c#7 makecharset::i#6 makecharset::ii#2 makecharset::b#2 makecharset::bc#2 ] ( main:2::makecharset:17 [ makecharset::c#7 makecharset::i#6 makecharset::ii#2 makecharset::b#2 makecharset::bc#2 ] ) always clobbers reg byte a reg byte x +Removing always clobbered register reg byte x as potential for zp ZP_BYTE:17 [ makecharset::c#7 makecharset::c#1 ] +Removing always clobbered register reg byte x as potential for zp ZP_BYTE:18 [ makecharset::i#6 makecharset::i#1 ] +Removing always clobbered register reg byte x as potential for zp ZP_BYTE:20 [ makecharset::ii#2 makecharset::ii#1 ] +Removing always clobbered register reg byte x as potential for zp ZP_BYTE:21 [ makecharset::b#2 makecharset::b#3 makecharset::b#1 ] Statement [70] (byte~) makecharset::$11 ← (byte) makecharset::i#6 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ makecharset::c#7 makecharset::i#6 makecharset::ii#2 makecharset::b#2 makecharset::bc#2 makecharset::$11 ] ( main:2::makecharset:17 [ makecharset::c#7 makecharset::i#6 makecharset::ii#2 makecharset::b#2 makecharset::bc#2 makecharset::$11 ] ) always clobbers reg byte a Statement [71] (byte~) makecharset::$12 ← (byte) makecharset::ii#2 + (byte~) makecharset::$11 [ makecharset::c#7 makecharset::i#6 makecharset::ii#2 makecharset::b#2 makecharset::bc#2 makecharset::$12 ] ( main:2::makecharset:17 [ makecharset::c#7 makecharset::i#6 makecharset::ii#2 makecharset::b#2 makecharset::bc#2 makecharset::$12 ] ) always clobbers reg byte a Statement [73] (byte) makecharset::b#1 ← (byte) makecharset::b#2 + *((const byte[8]) makecharset::bittab#0 + (byte~) makecharset::$13) [ makecharset::c#7 makecharset::i#6 makecharset::ii#2 makecharset::bc#2 makecharset::b#1 ] ( main:2::makecharset:17 [ makecharset::c#7 makecharset::i#6 makecharset::ii#2 makecharset::bc#2 makecharset::b#1 ] ) always clobbers reg byte a Statement [77] (word~) makecharset::$17 ← ((word)) (byte) makecharset::c#7 [ makecharset::c#7 makecharset::i#6 makecharset::bc#6 makecharset::b#3 makecharset::$17 ] ( main:2::makecharset:17 [ makecharset::c#7 makecharset::i#6 makecharset::bc#6 makecharset::b#3 makecharset::$17 ] ) always clobbers reg byte a Statement [78] (word~) makecharset::$18 ← (word~) makecharset::$17 << (byte/signed byte/word/signed word/dword/signed dword) 3 [ makecharset::c#7 makecharset::i#6 makecharset::bc#6 makecharset::b#3 makecharset::$18 ] ( main:2::makecharset:17 [ makecharset::c#7 makecharset::i#6 makecharset::bc#6 makecharset::b#3 makecharset::$18 ] ) always clobbers reg byte a Statement [79] (word~) makecharset::$19 ← (word~) makecharset::$18 + (byte) makecharset::i#6 [ makecharset::c#7 makecharset::i#6 makecharset::bc#6 makecharset::b#3 makecharset::$19 ] ( main:2::makecharset:17 [ makecharset::c#7 makecharset::i#6 makecharset::bc#6 makecharset::b#3 makecharset::$19 ] ) always clobbers reg byte a -Statement [80] *((const byte*) CHARSET#0+(byte/signed byte/word/signed word/dword/signed dword) 1*(byte/signed byte/word/signed word/dword/signed dword) 8 + (word~) makecharset::$19) ← (byte) makecharset::b#3 [ makecharset::c#7 makecharset::i#6 makecharset::bc#6 ] ( main:2::makecharset:17 [ makecharset::c#7 makecharset::i#6 makecharset::bc#6 ] ) always clobbers reg byte a -Statement [86] *((const word*) SID_VOICE3_FREQ#0) ← (word/dword/signed dword) $ffff [ ] ( main:2::sid_rnd_init:15 [ ] ) always clobbers reg byte a -Statement [87] *((const byte*) SID_VOICE3_CONTROL#0) ← (const byte) SID_CONTROL_NOISE#0 [ ] ( main:2::sid_rnd_init:15 [ ] ) always clobbers reg byte a -Statement [91] *((byte*) fillscreen::screen#5) ← (byte) fillscreen::fill#5 [ fillscreen::fill#5 fillscreen::screen#5 fillscreen::i#2 ] ( main:2::fillscreen:7 [ fillscreen::fill#5 fillscreen::screen#5 fillscreen::i#2 ] main:2::fillscreen:9 [ fillscreen::fill#5 fillscreen::screen#5 fillscreen::i#2 ] main:2::fillscreen:11 [ fillscreen::fill#5 fillscreen::screen#5 fillscreen::i#2 ] main:2::fillscreen:13 [ fillscreen::fill#5 fillscreen::screen#5 fillscreen::i#2 ] ) always clobbers reg byte a reg byte y -Statement [94] if((word) fillscreen::i#1!=(word/signed word/dword/signed dword) $3e8) goto fillscreen::@1 [ fillscreen::fill#5 fillscreen::screen#4 fillscreen::i#1 ] ( main:2::fillscreen:7 [ fillscreen::fill#5 fillscreen::screen#4 fillscreen::i#1 ] main:2::fillscreen:9 [ fillscreen::fill#5 fillscreen::screen#4 fillscreen::i#1 ] main:2::fillscreen:11 [ fillscreen::fill#5 fillscreen::screen#4 fillscreen::i#1 ] main:2::fillscreen:13 [ fillscreen::fill#5 fillscreen::screen#4 fillscreen::i#1 ] ) always clobbers reg byte a +Statement [80] (byte*) makecharset::$22 ← (const byte*) CHARSET#0+(byte/signed byte/word/signed word/dword/signed dword) 1*(byte/signed byte/word/signed word/dword/signed dword) 8 + (word~) makecharset::$19 [ makecharset::c#7 makecharset::i#6 makecharset::bc#6 makecharset::b#3 makecharset::$22 ] ( main:2::makecharset:17 [ makecharset::c#7 makecharset::i#6 makecharset::bc#6 makecharset::b#3 makecharset::$22 ] ) always clobbers reg byte a +Statement [81] *((byte*) makecharset::$22) ← (byte) makecharset::b#3 [ makecharset::c#7 makecharset::i#6 makecharset::bc#6 ] ( main:2::makecharset:17 [ makecharset::c#7 makecharset::i#6 makecharset::bc#6 ] ) always clobbers reg byte a reg byte y +Statement [83] if((byte) makecharset::i#1<(byte/signed byte/word/signed word/dword/signed dword) 8) goto makecharset::@4 [ makecharset::c#7 makecharset::bc#6 makecharset::i#1 ] ( main:2::makecharset:17 [ makecharset::c#7 makecharset::bc#6 makecharset::i#1 ] ) always clobbers reg byte a +Statement [85] if((byte) makecharset::c#1<(byte/signed byte/word/signed word/dword/signed dword) $40) goto makecharset::@3 [ makecharset::c#1 ] ( main:2::makecharset:17 [ makecharset::c#1 ] ) always clobbers reg byte a +Statement [87] *((const word*) SID_VOICE3_FREQ#0) ← (word/dword/signed dword) $ffff [ ] ( main:2::sid_rnd_init:15 [ ] ) always clobbers reg byte a +Statement [88] *((const byte*) SID_VOICE3_CONTROL#0) ← (const byte) SID_CONTROL_NOISE#0 [ ] ( main:2::sid_rnd_init:15 [ ] ) always clobbers reg byte a +Statement [92] *((byte*) fillscreen::screen#5) ← (byte) fillscreen::fill#5 [ fillscreen::fill#5 fillscreen::screen#5 fillscreen::i#2 ] ( main:2::fillscreen:7 [ fillscreen::fill#5 fillscreen::screen#5 fillscreen::i#2 ] main:2::fillscreen:9 [ fillscreen::fill#5 fillscreen::screen#5 fillscreen::i#2 ] main:2::fillscreen:11 [ fillscreen::fill#5 fillscreen::screen#5 fillscreen::i#2 ] main:2::fillscreen:13 [ fillscreen::fill#5 fillscreen::screen#5 fillscreen::i#2 ] ) always clobbers reg byte a reg byte y +Statement [95] if((word) fillscreen::i#1!=(word/signed word/dword/signed dword) $3e8) goto fillscreen::@1 [ fillscreen::fill#5 fillscreen::screen#4 fillscreen::i#1 ] ( main:2::fillscreen:7 [ fillscreen::fill#5 fillscreen::screen#4 fillscreen::i#1 ] main:2::fillscreen:9 [ fillscreen::fill#5 fillscreen::screen#4 fillscreen::i#1 ] main:2::fillscreen:11 [ fillscreen::fill#5 fillscreen::screen#4 fillscreen::i#1 ] main:2::fillscreen:13 [ fillscreen::fill#5 fillscreen::screen#4 fillscreen::i#1 ] ) always clobbers reg byte a +Statement [5] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 [ ] ( main:2 [ ] ) always clobbers reg byte a +Statement [6] *((const byte*) BGCOL#0) ← (const byte) BLACK#0 [ ] ( main:2 [ ] ) always clobbers reg byte a +Statement [21] *((const byte*) D018#0) ← (const byte) main::toD0181_return#0 [ ] ( main:2 [ ] ) always clobbers reg byte a +Statement [24] *((const byte*) D018#0) ← (const byte) main::toD0182_return#0 [ ] ( main:2 [ ] ) always clobbers reg byte a +Statement [26] (byte*~) fire::screen#10 ← (byte*) fire::screen#0 [ fire::screen#0 fire::screen#10 ] ( main:2::fire:19 [ fire::screen#0 fire::screen#10 ] main:2::fire:22 [ fire::screen#0 fire::screen#10 ] ) always clobbers reg byte a +Statement [28] if((byte*) fire::buffer#4!=(const byte*) BUFFER#0+(byte/signed byte/word/signed word/dword/signed dword) $18*(byte/signed byte/word/signed word/dword/signed dword) $28) goto fire::@2 [ fire::screen#0 fire::buffer#4 fire::screen#4 ] ( main:2::fire:19 [ fire::screen#0 fire::buffer#4 fire::screen#4 ] main:2::fire:22 [ fire::screen#0 fire::buffer#4 fire::screen#4 ] ) always clobbers reg byte a +Statement [29] (byte*) fire::screen#1 ← (byte*) fire::screen#0 + (byte/signed byte/word/signed word/dword/signed dword) $18*(byte/signed byte/word/signed word/dword/signed dword) $28 [ fire::screen#1 ] ( main:2::fire:19 [ fire::screen#1 ] main:2::fire:22 [ fire::screen#1 ] ) always clobbers reg byte a +Statement [34] (byte~) fire::$16 ← (byte~) fire::$15 >> (byte/signed byte/word/signed word/dword/signed dword) 4 [ fire::buffer#7 fire::screen#5 fire::$16 ] ( main:2::fire:19 [ fire::buffer#7 fire::screen#5 fire::$16 ] main:2::fire:22 [ fire::buffer#7 fire::screen#5 fire::$16 ] ) always clobbers reg byte a +Statement [36] *((byte*) fire::buffer#7) ← (byte/signed word/word/dword/signed dword~) fire::$17 [ fire::buffer#7 fire::screen#5 ] ( main:2::fire:19 [ fire::buffer#7 fire::screen#5 ] main:2::fire:22 [ fire::buffer#7 fire::screen#5 ] ) always clobbers reg byte y +Statement [37] *((byte*) fire::screen#5) ← *((byte*) fire::buffer#7) [ fire::buffer#7 fire::screen#5 ] ( main:2::fire:19 [ fire::buffer#7 fire::screen#5 ] main:2::fire:22 [ fire::buffer#7 fire::screen#5 ] ) always clobbers reg byte a reg byte y +Statement [40] if((byte*) fire::buffer#3!=(const byte*) BUFFER#0+(byte/signed byte/word/signed word/dword/signed dword) $19*(byte/signed byte/word/signed word/dword/signed dword) $28) goto fire::@6 [ fire::buffer#3 fire::screen#3 ] ( main:2::fire:19 [ fire::buffer#3 fire::screen#3 ] main:2::fire:22 [ fire::buffer#3 fire::screen#3 ] ) always clobbers reg byte a +Statement [42] (byte~) fire::$9 ← *((byte*) fire::buffer#4 + (byte/signed byte/word/signed word/dword/signed dword) $28-(byte/signed byte/word/signed word/dword/signed dword) 1) + *((byte*) fire::buffer#4 + (byte/signed byte/word/signed word/dword/signed dword) $28-(byte/signed byte/word/signed word/dword/signed dword) 1) [ fire::screen#0 fire::buffer#4 fire::screen#4 fire::$9 ] ( main:2::fire:19 [ fire::screen#0 fire::buffer#4 fire::screen#4 fire::$9 ] main:2::fire:22 [ fire::screen#0 fire::buffer#4 fire::screen#4 fire::$9 ] ) always clobbers reg byte a reg byte y +Statement [43] (byte~) fire::$10 ← (byte~) fire::$9 + *((byte*) fire::buffer#4 + (byte/signed byte/word/signed word/dword/signed dword) $28) [ fire::screen#0 fire::buffer#4 fire::screen#4 fire::$10 ] ( main:2::fire:19 [ fire::screen#0 fire::buffer#4 fire::screen#4 fire::$10 ] main:2::fire:22 [ fire::screen#0 fire::buffer#4 fire::screen#4 fire::$10 ] ) always clobbers reg byte a reg byte y +Statement [44] (byte~) fire::$11 ← (byte~) fire::$10 + *((byte*) fire::buffer#4 + (byte/signed byte/word/signed word/dword/signed dword) $29) [ fire::screen#0 fire::buffer#4 fire::screen#4 fire::$11 ] ( main:2::fire:19 [ fire::screen#0 fire::buffer#4 fire::screen#4 fire::$11 ] main:2::fire:22 [ fire::screen#0 fire::buffer#4 fire::screen#4 fire::$11 ] ) always clobbers reg byte a reg byte y +Statement [45] (byte) fire::c#0 ← (byte~) fire::$11 >> (byte/signed byte/word/signed word/dword/signed dword) 2 [ fire::screen#0 fire::buffer#4 fire::screen#4 fire::c#0 ] ( main:2::fire:19 [ fire::screen#0 fire::buffer#4 fire::screen#4 fire::c#0 ] main:2::fire:22 [ fire::screen#0 fire::buffer#4 fire::screen#4 fire::c#0 ] ) always clobbers reg byte a +Statement [47] (byte) fire::c#1 ← (byte) fire::c#0 - (byte/signed byte/word/signed word/dword/signed dword) 3 [ fire::screen#0 fire::buffer#4 fire::screen#4 fire::c#1 ] ( main:2::fire:19 [ fire::screen#0 fire::buffer#4 fire::screen#4 fire::c#1 ] main:2::fire:22 [ fire::screen#0 fire::buffer#4 fire::screen#4 fire::c#1 ] ) always clobbers reg byte a +Statement [49] *((byte*) fire::buffer#4) ← (byte) fire::c#2 [ fire::screen#0 fire::buffer#4 fire::screen#4 ] ( main:2::fire:19 [ fire::screen#0 fire::buffer#4 fire::screen#4 ] main:2::fire:22 [ fire::screen#0 fire::buffer#4 fire::screen#4 ] ) always clobbers reg byte y +Statement [50] *((byte*) fire::screen#4) ← *((byte*) fire::buffer#4) [ fire::screen#0 fire::buffer#4 fire::screen#4 ] ( main:2::fire:19 [ fire::screen#0 fire::buffer#4 fire::screen#4 ] main:2::fire:22 [ fire::screen#0 fire::buffer#4 fire::screen#4 ] ) always clobbers reg byte a reg byte y +Statement [57] *((byte*) makecharset::font#2) ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ makecharset::font#2 ] ( main:2::makecharset:17 [ makecharset::font#2 ] ) always clobbers reg byte a reg byte y +Statement [59] if((byte*) makecharset::font#1!=(const byte*) CHARSET#0+(byte/signed byte/word/signed word/dword/signed dword) 1*(byte/signed byte/word/signed word/dword/signed dword) 8) goto makecharset::@1 [ makecharset::font#1 ] ( main:2::makecharset:17 [ makecharset::font#1 ] ) always clobbers reg byte a +Statement [61] *((byte*) makecharset::font1#2) ← (byte/word/signed word/dword/signed dword) $ff [ makecharset::font1#2 ] ( main:2::makecharset:17 [ makecharset::font1#2 ] ) always clobbers reg byte a reg byte y +Statement [63] if((byte*) makecharset::font1#1!=(const byte*) CHARSET#0+(word/signed word/dword/signed dword) $100*(byte/signed byte/word/signed word/dword/signed dword) 8) goto makecharset::@2 [ makecharset::font1#1 ] ( main:2::makecharset:17 [ makecharset::font1#1 ] ) always clobbers reg byte a +Statement [67] (byte) makecharset::bc#1 ← (byte) makecharset::bc#3 + (byte) makecharset::c#7 [ makecharset::c#7 makecharset::i#6 makecharset::ii#2 makecharset::b#2 makecharset::bc#1 ] ( main:2::makecharset:17 [ makecharset::c#7 makecharset::i#6 makecharset::ii#2 makecharset::b#2 makecharset::bc#1 ] ) always clobbers reg byte a +Statement [69] (byte) makecharset::bc#2 ← (byte) makecharset::bc#1 - (byte/signed byte/word/signed word/dword/signed dword) $40 [ makecharset::c#7 makecharset::i#6 makecharset::ii#2 makecharset::b#2 makecharset::bc#2 ] ( main:2::makecharset:17 [ makecharset::c#7 makecharset::i#6 makecharset::ii#2 makecharset::b#2 makecharset::bc#2 ] ) always clobbers reg byte a reg byte x +Statement [70] (byte~) makecharset::$11 ← (byte) makecharset::i#6 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ makecharset::c#7 makecharset::i#6 makecharset::ii#2 makecharset::b#2 makecharset::bc#2 makecharset::$11 ] ( main:2::makecharset:17 [ makecharset::c#7 makecharset::i#6 makecharset::ii#2 makecharset::b#2 makecharset::bc#2 makecharset::$11 ] ) always clobbers reg byte a +Statement [71] (byte~) makecharset::$12 ← (byte) makecharset::ii#2 + (byte~) makecharset::$11 [ makecharset::c#7 makecharset::i#6 makecharset::ii#2 makecharset::b#2 makecharset::bc#2 makecharset::$12 ] ( main:2::makecharset:17 [ makecharset::c#7 makecharset::i#6 makecharset::ii#2 makecharset::b#2 makecharset::bc#2 makecharset::$12 ] ) always clobbers reg byte a +Statement [73] (byte) makecharset::b#1 ← (byte) makecharset::b#2 + *((const byte[8]) makecharset::bittab#0 + (byte~) makecharset::$13) [ makecharset::c#7 makecharset::i#6 makecharset::ii#2 makecharset::bc#2 makecharset::b#1 ] ( main:2::makecharset:17 [ makecharset::c#7 makecharset::i#6 makecharset::ii#2 makecharset::bc#2 makecharset::b#1 ] ) always clobbers reg byte a +Statement [77] (word~) makecharset::$17 ← ((word)) (byte) makecharset::c#7 [ makecharset::c#7 makecharset::i#6 makecharset::bc#6 makecharset::b#3 makecharset::$17 ] ( main:2::makecharset:17 [ makecharset::c#7 makecharset::i#6 makecharset::bc#6 makecharset::b#3 makecharset::$17 ] ) always clobbers reg byte a +Statement [78] (word~) makecharset::$18 ← (word~) makecharset::$17 << (byte/signed byte/word/signed word/dword/signed dword) 3 [ makecharset::c#7 makecharset::i#6 makecharset::bc#6 makecharset::b#3 makecharset::$18 ] ( main:2::makecharset:17 [ makecharset::c#7 makecharset::i#6 makecharset::bc#6 makecharset::b#3 makecharset::$18 ] ) always clobbers reg byte a +Statement [79] (word~) makecharset::$19 ← (word~) makecharset::$18 + (byte) makecharset::i#6 [ makecharset::c#7 makecharset::i#6 makecharset::bc#6 makecharset::b#3 makecharset::$19 ] ( main:2::makecharset:17 [ makecharset::c#7 makecharset::i#6 makecharset::bc#6 makecharset::b#3 makecharset::$19 ] ) always clobbers reg byte a +Statement [80] (byte*) makecharset::$22 ← (const byte*) CHARSET#0+(byte/signed byte/word/signed word/dword/signed dword) 1*(byte/signed byte/word/signed word/dword/signed dword) 8 + (word~) makecharset::$19 [ makecharset::c#7 makecharset::i#6 makecharset::bc#6 makecharset::b#3 makecharset::$22 ] ( main:2::makecharset:17 [ makecharset::c#7 makecharset::i#6 makecharset::bc#6 makecharset::b#3 makecharset::$22 ] ) always clobbers reg byte a +Statement [81] *((byte*) makecharset::$22) ← (byte) makecharset::b#3 [ makecharset::c#7 makecharset::i#6 makecharset::bc#6 ] ( main:2::makecharset:17 [ makecharset::c#7 makecharset::i#6 makecharset::bc#6 ] ) always clobbers reg byte a reg byte y +Statement [83] if((byte) makecharset::i#1<(byte/signed byte/word/signed word/dword/signed dword) 8) goto makecharset::@4 [ makecharset::c#7 makecharset::bc#6 makecharset::i#1 ] ( main:2::makecharset:17 [ makecharset::c#7 makecharset::bc#6 makecharset::i#1 ] ) always clobbers reg byte a +Statement [85] if((byte) makecharset::c#1<(byte/signed byte/word/signed word/dword/signed dword) $40) goto makecharset::@3 [ makecharset::c#1 ] ( main:2::makecharset:17 [ makecharset::c#1 ] ) always clobbers reg byte a +Statement [87] *((const word*) SID_VOICE3_FREQ#0) ← (word/dword/signed dword) $ffff [ ] ( main:2::sid_rnd_init:15 [ ] ) always clobbers reg byte a +Statement [88] *((const byte*) SID_VOICE3_CONTROL#0) ← (const byte) SID_CONTROL_NOISE#0 [ ] ( main:2::sid_rnd_init:15 [ ] ) always clobbers reg byte a +Statement [92] *((byte*) fillscreen::screen#5) ← (byte) fillscreen::fill#5 [ fillscreen::fill#5 fillscreen::screen#5 fillscreen::i#2 ] ( main:2::fillscreen:7 [ fillscreen::fill#5 fillscreen::screen#5 fillscreen::i#2 ] main:2::fillscreen:9 [ fillscreen::fill#5 fillscreen::screen#5 fillscreen::i#2 ] main:2::fillscreen:11 [ fillscreen::fill#5 fillscreen::screen#5 fillscreen::i#2 ] main:2::fillscreen:13 [ fillscreen::fill#5 fillscreen::screen#5 fillscreen::i#2 ] ) always clobbers reg byte a reg byte y +Statement [95] if((word) fillscreen::i#1!=(word/signed word/dword/signed dword) $3e8) goto fillscreen::@1 [ fillscreen::fill#5 fillscreen::screen#4 fillscreen::i#1 ] ( main:2::fillscreen:7 [ fillscreen::fill#5 fillscreen::screen#4 fillscreen::i#1 ] main:2::fillscreen:9 [ fillscreen::fill#5 fillscreen::screen#4 fillscreen::i#1 ] main:2::fillscreen:11 [ fillscreen::fill#5 fillscreen::screen#4 fillscreen::i#1 ] main:2::fillscreen:13 [ fillscreen::fill#5 fillscreen::screen#4 fillscreen::i#1 ] ) always clobbers reg byte a Potential registers zp ZP_WORD:2 [ fire::screen#0 ] : zp ZP_WORD:2 , Potential registers zp ZP_WORD:4 [ fire::buffer#4 fire::buffer#2 ] : zp ZP_WORD:4 , Potential registers zp ZP_WORD:6 [ fire::screen#4 fire::screen#10 fire::screen#2 ] : zp ZP_WORD:6 , @@ -2197,11 +2252,11 @@ Potential registers zp ZP_WORD:10 [ fire::screen#5 fire::screen#3 fire::screen#1 Potential registers zp ZP_BYTE:12 [ fire::c#2 fire::c#0 fire::c#1 ] : zp ZP_BYTE:12 , reg byte a , reg byte x , reg byte y , Potential registers zp ZP_WORD:13 [ makecharset::font#2 makecharset::font#1 ] : zp ZP_WORD:13 , Potential registers zp ZP_WORD:15 [ makecharset::font1#2 makecharset::font1#1 ] : zp ZP_WORD:15 , -Potential registers zp ZP_BYTE:17 [ makecharset::c#7 makecharset::c#1 ] : zp ZP_BYTE:17 , reg byte x , reg byte y , -Potential registers zp ZP_BYTE:18 [ makecharset::i#6 makecharset::i#1 ] : zp ZP_BYTE:18 , reg byte x , reg byte y , -Potential registers zp ZP_BYTE:19 [ makecharset::bc#3 makecharset::bc#5 makecharset::bc#6 makecharset::bc#1 makecharset::bc#2 ] : zp ZP_BYTE:19 , reg byte x , reg byte y , -Potential registers zp ZP_BYTE:20 [ makecharset::ii#2 makecharset::ii#1 ] : zp ZP_BYTE:20 , reg byte x , reg byte y , -Potential registers zp ZP_BYTE:21 [ makecharset::b#2 makecharset::b#3 makecharset::b#1 ] : zp ZP_BYTE:21 , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:17 [ makecharset::c#7 makecharset::c#1 ] : zp ZP_BYTE:17 , +Potential registers zp ZP_BYTE:18 [ makecharset::i#6 makecharset::i#1 ] : zp ZP_BYTE:18 , +Potential registers zp ZP_BYTE:19 [ makecharset::bc#3 makecharset::bc#5 makecharset::bc#6 makecharset::bc#1 makecharset::bc#2 ] : zp ZP_BYTE:19 , reg byte x , +Potential registers zp ZP_BYTE:20 [ makecharset::ii#2 makecharset::ii#1 ] : zp ZP_BYTE:20 , reg byte y , +Potential registers zp ZP_BYTE:21 [ makecharset::b#2 makecharset::b#3 makecharset::b#1 ] : zp ZP_BYTE:21 , reg byte y , Potential registers zp ZP_BYTE:22 [ fillscreen::fill#5 ] : zp ZP_BYTE:22 , reg byte x , Potential registers zp ZP_WORD:23 [ fillscreen::screen#5 fillscreen::screen#6 fillscreen::screen#4 ] : zp ZP_WORD:23 , Potential registers zp ZP_WORD:25 [ fillscreen::i#2 fillscreen::i#1 ] : zp ZP_WORD:25 , @@ -2219,9 +2274,10 @@ Potential registers zp ZP_BYTE:37 [ makecharset::$13 ] : zp ZP_BYTE:37 , reg byt Potential registers zp ZP_WORD:38 [ makecharset::$17 ] : zp ZP_WORD:38 , Potential registers zp ZP_WORD:40 [ makecharset::$18 ] : zp ZP_WORD:40 , Potential registers zp ZP_WORD:42 [ makecharset::$19 ] : zp ZP_WORD:42 , +Potential registers zp ZP_WORD:44 [ makecharset::$22 ] : zp ZP_WORD:44 , REGISTER UPLIFT SCOPES -Uplift Scope [makecharset] 5,052.29: zp ZP_BYTE:19 [ makecharset::bc#3 makecharset::bc#5 makecharset::bc#6 makecharset::bc#1 makecharset::bc#2 ] 2,948.33: zp ZP_BYTE:21 [ makecharset::b#2 makecharset::b#3 makecharset::b#1 ] 2,002: zp ZP_BYTE:35 [ makecharset::$11 ] 2,002: zp ZP_BYTE:36 [ makecharset::$12 ] 2,002: zp ZP_BYTE:37 [ makecharset::$13 ] 1,835.17: zp ZP_BYTE:20 [ makecharset::ii#2 makecharset::ii#1 ] 233: zp ZP_BYTE:18 [ makecharset::i#6 makecharset::i#1 ] 202: zp ZP_WORD:38 [ makecharset::$17 ] 202: zp ZP_WORD:40 [ makecharset::$18 ] 202: zp ZP_WORD:42 [ makecharset::$19 ] 75.66: zp ZP_BYTE:17 [ makecharset::c#7 makecharset::c#1 ] 33: zp ZP_WORD:13 [ makecharset::font#2 makecharset::font#1 ] 33: zp ZP_WORD:15 [ makecharset::font1#2 makecharset::font1#1 ] +Uplift Scope [makecharset] 5,017.8: zp ZP_BYTE:19 [ makecharset::bc#3 makecharset::bc#5 makecharset::bc#6 makecharset::bc#1 makecharset::bc#2 ] 2,874.43: zp ZP_BYTE:21 [ makecharset::b#2 makecharset::b#3 makecharset::b#1 ] 2,002: zp ZP_BYTE:35 [ makecharset::$11 ] 2,002: zp ZP_BYTE:36 [ makecharset::$12 ] 2,002: zp ZP_BYTE:37 [ makecharset::$13 ] 1,835.17: zp ZP_BYTE:20 [ makecharset::ii#2 makecharset::ii#1 ] 228.21: zp ZP_BYTE:18 [ makecharset::i#6 makecharset::i#1 ] 202: zp ZP_WORD:38 [ makecharset::$17 ] 202: zp ZP_WORD:40 [ makecharset::$18 ] 202: zp ZP_WORD:42 [ makecharset::$19 ] 202: zp ZP_WORD:44 [ makecharset::$22 ] 72.7: zp ZP_BYTE:17 [ makecharset::c#7 makecharset::c#1 ] 33: zp ZP_WORD:13 [ makecharset::font#2 makecharset::font#1 ] 33: zp ZP_WORD:15 [ makecharset::font1#2 makecharset::font1#1 ] Uplift Scope [fire] 707: zp ZP_BYTE:12 [ fire::c#2 fire::c#0 fire::c#1 ] 277.75: zp ZP_WORD:4 [ fire::buffer#4 fire::buffer#2 ] 202: zp ZP_BYTE:28 [ fire::$15 ] 202: zp ZP_BYTE:29 [ fire::$16 ] 202: zp ZP_BYTE:30 [ fire::$17 ] 202: zp ZP_BYTE:31 [ fire::$9 ] 202: zp ZP_BYTE:32 [ fire::$10 ] 202: zp ZP_BYTE:33 [ fire::$11 ] 196.39: zp ZP_WORD:8 [ fire::buffer#7 fire::buffer#3 ] 132.73: zp ZP_WORD:6 [ fire::screen#4 fire::screen#10 fire::screen#2 ] 109.46: zp ZP_WORD:10 [ fire::screen#5 fire::screen#3 fire::screen#1 ] 0.27: zp ZP_WORD:2 [ fire::screen#0 ] Uplift Scope [sid_rnd] 202: zp ZP_BYTE:27 [ sid_rnd::return#2 ] 34.33: zp ZP_BYTE:34 [ sid_rnd::return#0 ] Uplift Scope [fillscreen] 26.83: zp ZP_WORD:23 [ fillscreen::screen#5 fillscreen::screen#6 fillscreen::screen#4 ] 23.83: zp ZP_WORD:25 [ fillscreen::i#2 fillscreen::i#1 ] 1.83: zp ZP_BYTE:22 [ fillscreen::fill#5 ] @@ -2229,36 +2285,37 @@ Uplift Scope [sid_rnd_init] Uplift Scope [main] Uplift Scope [] -Uplifting [makecharset] best 125395 combination reg byte x [ makecharset::bc#3 makecharset::bc#5 makecharset::bc#6 makecharset::bc#1 makecharset::bc#2 ] reg byte y [ makecharset::b#2 makecharset::b#3 makecharset::b#1 ] reg byte a [ makecharset::$11 ] reg byte a [ makecharset::$12 ] zp ZP_BYTE:37 [ makecharset::$13 ] zp ZP_BYTE:20 [ makecharset::ii#2 makecharset::ii#1 ] zp ZP_BYTE:18 [ makecharset::i#6 makecharset::i#1 ] zp ZP_WORD:38 [ makecharset::$17 ] zp ZP_WORD:40 [ makecharset::$18 ] zp ZP_WORD:42 [ makecharset::$19 ] zp ZP_BYTE:17 [ makecharset::c#7 makecharset::c#1 ] zp ZP_WORD:13 [ makecharset::font#2 makecharset::font#1 ] zp ZP_WORD:15 [ makecharset::font1#2 makecharset::font1#1 ] -Limited combination testing to 100 combinations of 15552 possible. -Uplifting [fire] best 122495 combination reg byte a [ fire::c#2 fire::c#0 fire::c#1 ] zp ZP_WORD:4 [ fire::buffer#4 fire::buffer#2 ] reg byte a [ fire::$15 ] reg byte a [ fire::$16 ] reg byte a [ fire::$17 ] zp ZP_BYTE:31 [ fire::$9 ] zp ZP_BYTE:32 [ fire::$10 ] zp ZP_BYTE:33 [ fire::$11 ] zp ZP_WORD:8 [ fire::buffer#7 fire::buffer#3 ] zp ZP_WORD:6 [ fire::screen#4 fire::screen#10 fire::screen#2 ] zp ZP_WORD:10 [ fire::screen#5 fire::screen#3 fire::screen#1 ] zp ZP_WORD:2 [ fire::screen#0 ] +Uplifting [makecharset] best 124995 combination reg byte x [ makecharset::bc#3 makecharset::bc#5 makecharset::bc#6 makecharset::bc#1 makecharset::bc#2 ] reg byte y [ makecharset::b#2 makecharset::b#3 makecharset::b#1 ] reg byte a [ makecharset::$11 ] reg byte a [ makecharset::$12 ] zp ZP_BYTE:37 [ makecharset::$13 ] zp ZP_BYTE:20 [ makecharset::ii#2 makecharset::ii#1 ] zp ZP_BYTE:18 [ makecharset::i#6 makecharset::i#1 ] zp ZP_WORD:38 [ makecharset::$17 ] zp ZP_WORD:40 [ makecharset::$18 ] zp ZP_WORD:42 [ makecharset::$19 ] zp ZP_WORD:44 [ makecharset::$22 ] zp ZP_BYTE:17 [ makecharset::c#7 makecharset::c#1 ] zp ZP_WORD:13 [ makecharset::font#2 makecharset::font#1 ] zp ZP_WORD:15 [ makecharset::font1#2 makecharset::font1#1 ] +Limited combination testing to 100 combinations of 512 possible. +Uplifting [fire] best 122095 combination reg byte a [ fire::c#2 fire::c#0 fire::c#1 ] zp ZP_WORD:4 [ fire::buffer#4 fire::buffer#2 ] reg byte a [ fire::$15 ] reg byte a [ fire::$16 ] reg byte a [ fire::$17 ] zp ZP_BYTE:31 [ fire::$9 ] zp ZP_BYTE:32 [ fire::$10 ] zp ZP_BYTE:33 [ fire::$11 ] zp ZP_WORD:8 [ fire::buffer#7 fire::buffer#3 ] zp ZP_WORD:6 [ fire::screen#4 fire::screen#10 fire::screen#2 ] zp ZP_WORD:10 [ fire::screen#5 fire::screen#3 fire::screen#1 ] zp ZP_WORD:2 [ fire::screen#0 ] Limited combination testing to 100 combinations of 16384 possible. -Uplifting [sid_rnd] best 121592 combination reg byte a [ sid_rnd::return#2 ] reg byte a [ sid_rnd::return#0 ] -Uplifting [fillscreen] best 121570 combination zp ZP_WORD:23 [ fillscreen::screen#5 fillscreen::screen#6 fillscreen::screen#4 ] zp ZP_WORD:25 [ fillscreen::i#2 fillscreen::i#1 ] reg byte x [ fillscreen::fill#5 ] -Uplifting [sid_rnd_init] best 121570 combination -Uplifting [main] best 121570 combination -Uplifting [] best 121570 combination +Uplifting [sid_rnd] best 121192 combination reg byte a [ sid_rnd::return#2 ] reg byte a [ sid_rnd::return#0 ] +Uplifting [fillscreen] best 121170 combination zp ZP_WORD:23 [ fillscreen::screen#5 fillscreen::screen#6 fillscreen::screen#4 ] zp ZP_WORD:25 [ fillscreen::i#2 fillscreen::i#1 ] reg byte x [ fillscreen::fill#5 ] +Uplifting [sid_rnd_init] best 121170 combination +Uplifting [main] best 121170 combination +Uplifting [] best 121170 combination Attempting to uplift remaining variables inzp ZP_BYTE:37 [ makecharset::$13 ] -Uplifting [makecharset] best 121570 combination zp ZP_BYTE:37 [ makecharset::$13 ] +Uplifting [makecharset] best 121170 combination zp ZP_BYTE:37 [ makecharset::$13 ] Attempting to uplift remaining variables inzp ZP_BYTE:20 [ makecharset::ii#2 makecharset::ii#1 ] -Uplifting [makecharset] best 121570 combination zp ZP_BYTE:20 [ makecharset::ii#2 makecharset::ii#1 ] +Uplifting [makecharset] best 121170 combination zp ZP_BYTE:20 [ makecharset::ii#2 makecharset::ii#1 ] Attempting to uplift remaining variables inzp ZP_BYTE:18 [ makecharset::i#6 makecharset::i#1 ] -Uplifting [makecharset] best 121570 combination zp ZP_BYTE:18 [ makecharset::i#6 makecharset::i#1 ] +Uplifting [makecharset] best 121170 combination zp ZP_BYTE:18 [ makecharset::i#6 makecharset::i#1 ] Attempting to uplift remaining variables inzp ZP_BYTE:31 [ fire::$9 ] -Uplifting [fire] best 120970 combination reg byte a [ fire::$9 ] +Uplifting [fire] best 120570 combination reg byte a [ fire::$9 ] Attempting to uplift remaining variables inzp ZP_BYTE:32 [ fire::$10 ] -Uplifting [fire] best 120370 combination reg byte a [ fire::$10 ] +Uplifting [fire] best 119970 combination reg byte a [ fire::$10 ] Attempting to uplift remaining variables inzp ZP_BYTE:33 [ fire::$11 ] -Uplifting [fire] best 119770 combination reg byte a [ fire::$11 ] +Uplifting [fire] best 119370 combination reg byte a [ fire::$11 ] Attempting to uplift remaining variables inzp ZP_BYTE:17 [ makecharset::c#7 makecharset::c#1 ] -Uplifting [makecharset] best 119770 combination zp ZP_BYTE:17 [ makecharset::c#7 makecharset::c#1 ] +Uplifting [makecharset] best 119370 combination zp ZP_BYTE:17 [ makecharset::c#7 makecharset::c#1 ] Coalescing zero page register with common assignment [ zp ZP_WORD:2 [ fire::screen#0 ] ] with [ zp ZP_WORD:10 [ fire::screen#5 fire::screen#3 fire::screen#1 ] ] - score: 1 Coalescing zero page register with common assignment [ zp ZP_WORD:38 [ makecharset::$17 ] ] with [ zp ZP_WORD:40 [ makecharset::$18 ] ] - score: 1 -Coalescing zero page register with common assignment [ zp ZP_WORD:38 [ makecharset::$17 makecharset::$18 ] ] with [ zp ZP_WORD:42 [ makecharset::$19 ] ] - score: 1 +Coalescing zero page register with common assignment [ zp ZP_WORD:42 [ makecharset::$19 ] ] with [ zp ZP_WORD:44 [ makecharset::$22 ] ] - score: 1 +Coalescing zero page register with common assignment [ zp ZP_WORD:38 [ makecharset::$17 makecharset::$18 ] ] with [ zp ZP_WORD:42 [ makecharset::$19 makecharset::$22 ] ] - score: 1 Coalescing zero page register [ zp ZP_WORD:2 [ fire::screen#0 fire::screen#5 fire::screen#3 fire::screen#1 ] ] with [ zp ZP_WORD:13 [ makecharset::font#2 makecharset::font#1 ] ] Coalescing zero page register [ zp ZP_WORD:2 [ fire::screen#0 fire::screen#5 fire::screen#3 fire::screen#1 makecharset::font#2 makecharset::font#1 ] ] with [ zp ZP_WORD:15 [ makecharset::font1#2 makecharset::font1#1 ] ] Coalescing zero page register [ zp ZP_WORD:2 [ fire::screen#0 fire::screen#5 fire::screen#3 fire::screen#1 makecharset::font#2 makecharset::font#1 makecharset::font1#2 makecharset::font1#1 ] ] with [ zp ZP_WORD:23 [ fillscreen::screen#5 fillscreen::screen#6 fillscreen::screen#4 ] ] -Coalescing zero page register [ zp ZP_WORD:2 [ fire::screen#0 fire::screen#5 fire::screen#3 fire::screen#1 makecharset::font#2 makecharset::font#1 makecharset::font1#2 makecharset::font1#1 fillscreen::screen#5 fillscreen::screen#6 fillscreen::screen#4 ] ] with [ zp ZP_WORD:38 [ makecharset::$17 makecharset::$18 makecharset::$19 ] ] +Coalescing zero page register [ zp ZP_WORD:2 [ fire::screen#0 fire::screen#5 fire::screen#3 fire::screen#1 makecharset::font#2 makecharset::font#1 makecharset::font1#2 makecharset::font1#1 fillscreen::screen#5 fillscreen::screen#6 fillscreen::screen#4 ] ] with [ zp ZP_WORD:38 [ makecharset::$17 makecharset::$18 makecharset::$19 makecharset::$22 ] ] Coalescing zero page register [ zp ZP_WORD:4 [ fire::buffer#4 fire::buffer#2 ] ] with [ zp ZP_WORD:8 [ fire::buffer#7 fire::buffer#3 ] ] Coalescing zero page register [ zp ZP_WORD:4 [ fire::buffer#4 fire::buffer#2 fire::buffer#7 fire::buffer#3 ] ] with [ zp ZP_WORD:25 [ fillscreen::i#2 fillscreen::i#1 ] ] Allocated (was zp ZP_BYTE:17) zp ZP_BYTE:8 [ makecharset::c#7 makecharset::c#1 ] @@ -2322,14 +2379,14 @@ main: { lda #BLACK sta BGCOL //SEG13 [7] call fillscreen - //SEG14 [89] phi from main to fillscreen [phi:main->fillscreen] + //SEG14 [90] phi from main to fillscreen [phi:main->fillscreen] fillscreen_from_main: - //SEG15 [89] phi (byte*) fillscreen::screen#6 = (const byte*) BUFFER#0 [phi:main->fillscreen#0] -- pbuz1=pbuc1 + //SEG15 [90] phi (byte*) fillscreen::screen#6 = (const byte*) BUFFER#0 [phi:main->fillscreen#0] -- pbuz1=pbuc1 lda #BUFFER sta fillscreen.screen+1 - //SEG16 [89] phi (byte) fillscreen::fill#5 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->fillscreen#1] -- vbuxx=vbuc1 + //SEG16 [90] phi (byte) fillscreen::fill#5 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->fillscreen#1] -- vbuxx=vbuc1 ldx #0 jsr fillscreen //SEG17 [8] phi from main to main::@4 [phi:main->main::@4] @@ -2338,14 +2395,14 @@ main: { //SEG18 main::@4 b4: //SEG19 [9] call fillscreen - //SEG20 [89] phi from main::@4 to fillscreen [phi:main::@4->fillscreen] + //SEG20 [90] phi from main::@4 to fillscreen [phi:main::@4->fillscreen] fillscreen_from_b4: - //SEG21 [89] phi (byte*) fillscreen::screen#6 = (const byte*) SCREEN1#0 [phi:main::@4->fillscreen#0] -- pbuz1=pbuc1 + //SEG21 [90] phi (byte*) fillscreen::screen#6 = (const byte*) SCREEN1#0 [phi:main::@4->fillscreen#0] -- pbuz1=pbuc1 lda #SCREEN1 sta fillscreen.screen+1 - //SEG22 [89] phi (byte) fillscreen::fill#5 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@4->fillscreen#1] -- vbuxx=vbuc1 + //SEG22 [90] phi (byte) fillscreen::fill#5 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@4->fillscreen#1] -- vbuxx=vbuc1 ldx #0 jsr fillscreen //SEG23 [10] phi from main::@4 to main::@5 [phi:main::@4->main::@5] @@ -2354,14 +2411,14 @@ main: { //SEG24 main::@5 b5: //SEG25 [11] call fillscreen - //SEG26 [89] phi from main::@5 to fillscreen [phi:main::@5->fillscreen] + //SEG26 [90] phi from main::@5 to fillscreen [phi:main::@5->fillscreen] fillscreen_from_b5: - //SEG27 [89] phi (byte*) fillscreen::screen#6 = (const byte*) SCREEN2#0 [phi:main::@5->fillscreen#0] -- pbuz1=pbuc1 + //SEG27 [90] phi (byte*) fillscreen::screen#6 = (const byte*) SCREEN2#0 [phi:main::@5->fillscreen#0] -- pbuz1=pbuc1 lda #SCREEN2 sta fillscreen.screen+1 - //SEG28 [89] phi (byte) fillscreen::fill#5 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@5->fillscreen#1] -- vbuxx=vbuc1 + //SEG28 [90] phi (byte) fillscreen::fill#5 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@5->fillscreen#1] -- vbuxx=vbuc1 ldx #0 jsr fillscreen //SEG29 [12] phi from main::@5 to main::@6 [phi:main::@5->main::@6] @@ -2370,14 +2427,14 @@ main: { //SEG30 main::@6 b6: //SEG31 [13] call fillscreen - //SEG32 [89] phi from main::@6 to fillscreen [phi:main::@6->fillscreen] + //SEG32 [90] phi from main::@6 to fillscreen [phi:main::@6->fillscreen] fillscreen_from_b6: - //SEG33 [89] phi (byte*) fillscreen::screen#6 = (const byte*) COLS#0 [phi:main::@6->fillscreen#0] -- pbuz1=pbuc1 + //SEG33 [90] phi (byte*) fillscreen::screen#6 = (const byte*) COLS#0 [phi:main::@6->fillscreen#0] -- pbuz1=pbuc1 lda #COLS sta fillscreen.screen+1 - //SEG34 [89] phi (byte) fillscreen::fill#5 = (const byte) YELLOW#0 [phi:main::@6->fillscreen#1] -- vbuxx=vbuc1 + //SEG34 [90] phi (byte) fillscreen::fill#5 = (const byte) YELLOW#0 [phi:main::@6->fillscreen#1] -- vbuxx=vbuc1 ldx #YELLOW jsr fillscreen //SEG35 [14] phi from main::@6 to main::@7 [phi:main::@6->main::@7] @@ -2630,6 +2687,7 @@ makecharset: { .label ii = $a .label i = 9 .label c = 8 + .label _22 = 2 //SEG110 [56] phi from makecharset to makecharset::@1 [phi:makecharset->makecharset::@1] b1_from_makecharset: //SEG111 [56] phi (byte*) makecharset::font#2 = (const byte*) CHARSET#0 [phi:makecharset->makecharset::@1#0] -- pbuz1=pbuc1 @@ -2800,96 +2858,94 @@ makecharset: { bcc !+ inc _19+1 !: - //SEG165 [80] *((const byte*) CHARSET#0+(byte/signed byte/word/signed word/dword/signed dword) 1*(byte/signed byte/word/signed word/dword/signed dword) 8 + (word~) makecharset::$19) ← (byte) makecharset::b#3 -- pbuc1_derefidx_vwuz1=vbuyy - tya - sta !v++1 - lda #CHARSET+1*8 - adc _19+1 - sta !a++2 - !v: - lda #0 - !a: - sta CHARSET+1*8 - //SEG166 [81] (byte) makecharset::i#1 ← ++ (byte) makecharset::i#6 -- vbuz1=_inc_vbuz1 + lda _22 + adc #CHARSET+1*8 + sta _22+1 + //SEG166 [81] *((byte*) makecharset::$22) ← (byte) makecharset::b#3 -- _deref_pbuz1=vbuyy + tya + ldy #0 + sta (_22),y + //SEG167 [82] (byte) makecharset::i#1 ← ++ (byte) makecharset::i#6 -- vbuz1=_inc_vbuz1 inc i - //SEG167 [82] if((byte) makecharset::i#1<(byte/signed byte/word/signed word/dword/signed dword) 8) goto makecharset::@4 -- vbuz1_lt_vbuc1_then_la1 + //SEG168 [83] if((byte) makecharset::i#1<(byte/signed byte/word/signed word/dword/signed dword) 8) goto makecharset::@4 -- vbuz1_lt_vbuc1_then_la1 lda i cmp #8 bcc b4_from_b8 jmp b9 - //SEG168 makecharset::@9 + //SEG169 makecharset::@9 b9: - //SEG169 [83] (byte) makecharset::c#1 ← ++ (byte) makecharset::c#7 -- vbuz1=_inc_vbuz1 + //SEG170 [84] (byte) makecharset::c#1 ← ++ (byte) makecharset::c#7 -- vbuz1=_inc_vbuz1 inc c - //SEG170 [84] if((byte) makecharset::c#1<(byte/signed byte/word/signed word/dword/signed dword) $40) goto makecharset::@3 -- vbuz1_lt_vbuc1_then_la1 + //SEG171 [85] if((byte) makecharset::c#1<(byte/signed byte/word/signed word/dword/signed dword) $40) goto makecharset::@3 -- vbuz1_lt_vbuc1_then_la1 lda c cmp #$40 bcc b3_from_b9 jmp breturn - //SEG171 makecharset::@return + //SEG172 makecharset::@return breturn: - //SEG172 [85] return + //SEG173 [86] return rts bittab: .byte 1, 2, 4, 8, $10, $20, $40, $80 } -//SEG173 sid_rnd_init +//SEG174 sid_rnd_init // Initialize SID voice 3 for random number generation sid_rnd_init: { - //SEG174 [86] *((const word*) SID_VOICE3_FREQ#0) ← (word/dword/signed dword) $ffff -- _deref_pwuc1=vwuc2 + //SEG175 [87] *((const word*) SID_VOICE3_FREQ#0) ← (word/dword/signed dword) $ffff -- _deref_pwuc1=vwuc2 lda #<$ffff sta SID_VOICE3_FREQ lda #>$ffff sta SID_VOICE3_FREQ+1 - //SEG175 [87] *((const byte*) SID_VOICE3_CONTROL#0) ← (const byte) SID_CONTROL_NOISE#0 -- _deref_pbuc1=vbuc2 + //SEG176 [88] *((const byte*) SID_VOICE3_CONTROL#0) ← (const byte) SID_CONTROL_NOISE#0 -- _deref_pbuc1=vbuc2 lda #SID_CONTROL_NOISE sta SID_VOICE3_CONTROL jmp breturn - //SEG176 sid_rnd_init::@return + //SEG177 sid_rnd_init::@return breturn: - //SEG177 [88] return + //SEG178 [89] return rts } -//SEG178 fillscreen +//SEG179 fillscreen // Fill a screen (1000 bytes) with a specific byte // fillscreen(byte* zeropage(2) screen, byte register(X) fill) fillscreen: { .label screen = 2 .label i = 4 - //SEG179 [90] phi from fillscreen to fillscreen::@1 [phi:fillscreen->fillscreen::@1] + //SEG180 [91] phi from fillscreen to fillscreen::@1 [phi:fillscreen->fillscreen::@1] b1_from_fillscreen: - //SEG180 [90] phi (word) fillscreen::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:fillscreen->fillscreen::@1#0] -- vwuz1=vbuc1 + //SEG181 [91] phi (word) fillscreen::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:fillscreen->fillscreen::@1#0] -- vwuz1=vbuc1 lda #0 sta i lda #0 sta i+1 - //SEG181 [90] phi (byte*) fillscreen::screen#5 = (byte*) fillscreen::screen#6 [phi:fillscreen->fillscreen::@1#1] -- register_copy + //SEG182 [91] phi (byte*) fillscreen::screen#5 = (byte*) fillscreen::screen#6 [phi:fillscreen->fillscreen::@1#1] -- register_copy jmp b1 - //SEG182 [90] phi from fillscreen::@1 to fillscreen::@1 [phi:fillscreen::@1->fillscreen::@1] + //SEG183 [91] phi from fillscreen::@1 to fillscreen::@1 [phi:fillscreen::@1->fillscreen::@1] b1_from_b1: - //SEG183 [90] phi (word) fillscreen::i#2 = (word) fillscreen::i#1 [phi:fillscreen::@1->fillscreen::@1#0] -- register_copy - //SEG184 [90] phi (byte*) fillscreen::screen#5 = (byte*) fillscreen::screen#4 [phi:fillscreen::@1->fillscreen::@1#1] -- register_copy + //SEG184 [91] phi (word) fillscreen::i#2 = (word) fillscreen::i#1 [phi:fillscreen::@1->fillscreen::@1#0] -- register_copy + //SEG185 [91] phi (byte*) fillscreen::screen#5 = (byte*) fillscreen::screen#4 [phi:fillscreen::@1->fillscreen::@1#1] -- register_copy jmp b1 - //SEG185 fillscreen::@1 + //SEG186 fillscreen::@1 b1: - //SEG186 [91] *((byte*) fillscreen::screen#5) ← (byte) fillscreen::fill#5 -- _deref_pbuz1=vbuxx + //SEG187 [92] *((byte*) fillscreen::screen#5) ← (byte) fillscreen::fill#5 -- _deref_pbuz1=vbuxx txa ldy #0 sta (screen),y - //SEG187 [92] (byte*) fillscreen::screen#4 ← ++ (byte*) fillscreen::screen#5 -- pbuz1=_inc_pbuz1 + //SEG188 [93] (byte*) fillscreen::screen#4 ← ++ (byte*) fillscreen::screen#5 -- pbuz1=_inc_pbuz1 inc screen bne !+ inc screen+1 !: - //SEG188 [93] (word) fillscreen::i#1 ← ++ (word) fillscreen::i#2 -- vwuz1=_inc_vwuz1 + //SEG189 [94] (word) fillscreen::i#1 ← ++ (word) fillscreen::i#2 -- vwuz1=_inc_vwuz1 inc i bne !+ inc i+1 !: - //SEG189 [94] if((word) fillscreen::i#1!=(word/signed word/dword/signed dword) $3e8) goto fillscreen::@1 -- vwuz1_neq_vwuc1_then_la1 + //SEG190 [95] if((word) fillscreen::i#1!=(word/signed word/dword/signed dword) $3e8) goto fillscreen::@1 -- vwuz1_neq_vwuc1_then_la1 lda i+1 cmp #>$3e8 bne b1_from_b1 @@ -2897,9 +2953,9 @@ fillscreen: { cmp #<$3e8 bne b1_from_b1 jmp breturn - //SEG190 fillscreen::@return + //SEG191 fillscreen::@return breturn: - //SEG191 [95] return + //SEG192 [96] return rts } @@ -3160,6 +3216,7 @@ FINAL SYMBOL TABLE (word~) makecharset::$17 $17 zp ZP_WORD:2 202.0 (word~) makecharset::$18 $18 zp ZP_WORD:2 202.0 (word~) makecharset::$19 $19 zp ZP_WORD:2 202.0 +(byte*) makecharset::$22 $22 zp ZP_WORD:2 202.0 (label) makecharset::@1 (label) makecharset::@2 (label) makecharset::@3 @@ -3173,18 +3230,18 @@ FINAL SYMBOL TABLE (byte) makecharset::b (byte) makecharset::b#1 reg byte y 2002.0 (byte) makecharset::b#2 reg byte y 429.0 -(byte) makecharset::b#3 reg byte y 517.3333333333334 +(byte) makecharset::b#3 reg byte y 443.42857142857144 (byte) makecharset::bc (byte) makecharset::bc#1 reg byte x 2002.0 (byte) makecharset::bc#2 reg byte x 400.4 (byte) makecharset::bc#3 reg byte x 2103.0 (byte) makecharset::bc#5 reg byte x 202.0 -(byte) makecharset::bc#6 reg byte x 344.8888888888889 +(byte) makecharset::bc#6 reg byte x 310.4 (byte[8]) makecharset::bittab (const byte[8]) makecharset::bittab#0 bittab = { (byte/signed byte/word/signed word/dword/signed dword) 1, (byte/signed byte/word/signed word/dword/signed dword) 2, (byte/signed byte/word/signed word/dword/signed dword) 4, (byte/signed byte/word/signed word/dword/signed dword) 8, (byte/signed byte/word/signed word/dword/signed dword) $10, (byte/signed byte/word/signed word/dword/signed dword) $20, (byte/signed byte/word/signed word/dword/signed dword) $40, (byte/word/signed word/dword/signed dword) $80 } (byte) makecharset::c (byte) makecharset::c#1 c zp ZP_BYTE:8 16.5 -(byte) makecharset::c#7 c zp ZP_BYTE:8 59.15789473684211 +(byte) makecharset::c#7 c zp ZP_BYTE:8 56.19999999999999 (byte*) makecharset::charset (byte*) makecharset::font (byte*) makecharset::font#1 font zp ZP_WORD:2 16.5 @@ -3194,7 +3251,7 @@ FINAL SYMBOL TABLE (byte*) makecharset::font1#2 font1 zp ZP_WORD:2 16.5 (byte) makecharset::i (byte) makecharset::i#1 i zp ZP_BYTE:9 151.5 -(byte) makecharset::i#6 i zp ZP_BYTE:9 81.5 +(byte) makecharset::i#6 i zp ZP_BYTE:9 76.70588235294117 (byte) makecharset::ii (byte) makecharset::ii#1 ii zp ZP_BYTE:10 1501.5 (byte) makecharset::ii#2 ii zp ZP_BYTE:10 333.6666666666667 @@ -3206,7 +3263,7 @@ FINAL SYMBOL TABLE (void()) sid_rnd_init() (label) sid_rnd_init::@return -zp ZP_WORD:2 [ fire::screen#0 fire::screen#5 fire::screen#3 fire::screen#1 makecharset::font#2 makecharset::font#1 makecharset::font1#2 makecharset::font1#1 fillscreen::screen#5 fillscreen::screen#6 fillscreen::screen#4 makecharset::$17 makecharset::$18 makecharset::$19 ] +zp ZP_WORD:2 [ fire::screen#0 fire::screen#5 fire::screen#3 fire::screen#1 makecharset::font#2 makecharset::font#1 makecharset::font1#2 makecharset::font1#1 fillscreen::screen#5 fillscreen::screen#6 fillscreen::screen#4 makecharset::$17 makecharset::$18 makecharset::$19 makecharset::$22 ] zp ZP_WORD:4 [ fire::buffer#4 fire::buffer#2 fire::buffer#7 fire::buffer#3 fillscreen::i#2 fillscreen::i#1 ] zp ZP_WORD:6 [ fire::screen#4 fire::screen#10 fire::screen#2 ] reg byte a [ fire::c#2 fire::c#0 fire::c#1 ] @@ -3230,7 +3287,7 @@ zp ZP_BYTE:11 [ makecharset::$13 ] FINAL ASSEMBLER -Score: 99315 +Score: 98915 //SEG0 File Comments // A KickC version of the fire routine from the CC65 samples @@ -3278,49 +3335,49 @@ main: { //SEG12 [6] *((const byte*) BGCOL#0) ← (const byte) BLACK#0 -- _deref_pbuc1=vbuc2 sta BGCOL //SEG13 [7] call fillscreen - //SEG14 [89] phi from main to fillscreen [phi:main->fillscreen] - //SEG15 [89] phi (byte*) fillscreen::screen#6 = (const byte*) BUFFER#0 [phi:main->fillscreen#0] -- pbuz1=pbuc1 + //SEG14 [90] phi from main to fillscreen [phi:main->fillscreen] + //SEG15 [90] phi (byte*) fillscreen::screen#6 = (const byte*) BUFFER#0 [phi:main->fillscreen#0] -- pbuz1=pbuc1 lda #BUFFER sta fillscreen.screen+1 - //SEG16 [89] phi (byte) fillscreen::fill#5 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->fillscreen#1] -- vbuxx=vbuc1 + //SEG16 [90] phi (byte) fillscreen::fill#5 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->fillscreen#1] -- vbuxx=vbuc1 ldx #0 jsr fillscreen //SEG17 [8] phi from main to main::@4 [phi:main->main::@4] //SEG18 main::@4 //SEG19 [9] call fillscreen - //SEG20 [89] phi from main::@4 to fillscreen [phi:main::@4->fillscreen] - //SEG21 [89] phi (byte*) fillscreen::screen#6 = (const byte*) SCREEN1#0 [phi:main::@4->fillscreen#0] -- pbuz1=pbuc1 + //SEG20 [90] phi from main::@4 to fillscreen [phi:main::@4->fillscreen] + //SEG21 [90] phi (byte*) fillscreen::screen#6 = (const byte*) SCREEN1#0 [phi:main::@4->fillscreen#0] -- pbuz1=pbuc1 lda #SCREEN1 sta fillscreen.screen+1 - //SEG22 [89] phi (byte) fillscreen::fill#5 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@4->fillscreen#1] -- vbuxx=vbuc1 + //SEG22 [90] phi (byte) fillscreen::fill#5 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@4->fillscreen#1] -- vbuxx=vbuc1 ldx #0 jsr fillscreen //SEG23 [10] phi from main::@4 to main::@5 [phi:main::@4->main::@5] //SEG24 main::@5 //SEG25 [11] call fillscreen - //SEG26 [89] phi from main::@5 to fillscreen [phi:main::@5->fillscreen] - //SEG27 [89] phi (byte*) fillscreen::screen#6 = (const byte*) SCREEN2#0 [phi:main::@5->fillscreen#0] -- pbuz1=pbuc1 + //SEG26 [90] phi from main::@5 to fillscreen [phi:main::@5->fillscreen] + //SEG27 [90] phi (byte*) fillscreen::screen#6 = (const byte*) SCREEN2#0 [phi:main::@5->fillscreen#0] -- pbuz1=pbuc1 lda #SCREEN2 sta fillscreen.screen+1 - //SEG28 [89] phi (byte) fillscreen::fill#5 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@5->fillscreen#1] -- vbuxx=vbuc1 + //SEG28 [90] phi (byte) fillscreen::fill#5 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@5->fillscreen#1] -- vbuxx=vbuc1 ldx #0 jsr fillscreen //SEG29 [12] phi from main::@5 to main::@6 [phi:main::@5->main::@6] //SEG30 main::@6 //SEG31 [13] call fillscreen - //SEG32 [89] phi from main::@6 to fillscreen [phi:main::@6->fillscreen] - //SEG33 [89] phi (byte*) fillscreen::screen#6 = (const byte*) COLS#0 [phi:main::@6->fillscreen#0] -- pbuz1=pbuc1 + //SEG32 [90] phi from main::@6 to fillscreen [phi:main::@6->fillscreen] + //SEG33 [90] phi (byte*) fillscreen::screen#6 = (const byte*) COLS#0 [phi:main::@6->fillscreen#0] -- pbuz1=pbuc1 lda #COLS sta fillscreen.screen+1 - //SEG34 [89] phi (byte) fillscreen::fill#5 = (const byte) YELLOW#0 [phi:main::@6->fillscreen#1] -- vbuxx=vbuc1 + //SEG34 [90] phi (byte) fillscreen::fill#5 = (const byte) YELLOW#0 [phi:main::@6->fillscreen#1] -- vbuxx=vbuc1 ldx #YELLOW jsr fillscreen //SEG35 [14] phi from main::@6 to main::@7 [phi:main::@6->main::@7] @@ -3526,6 +3583,7 @@ makecharset: { .label ii = $a .label i = 9 .label c = 8 + .label _22 = 2 //SEG110 [56] phi from makecharset to makecharset::@1 [phi:makecharset->makecharset::@1] //SEG111 [56] phi (byte*) makecharset::font#2 = (const byte*) CHARSET#0 [phi:makecharset->makecharset::@1#0] -- pbuz1=pbuc1 lda #CHARSET+1*8 - adc _19+1 - sta !a++2 - !v: - lda #0 - !a: - sta CHARSET+1*8 - //SEG166 [81] (byte) makecharset::i#1 ← ++ (byte) makecharset::i#6 -- vbuz1=_inc_vbuz1 + lda _22 + adc #CHARSET+1*8 + sta _22+1 + //SEG166 [81] *((byte*) makecharset::$22) ← (byte) makecharset::b#3 -- _deref_pbuz1=vbuyy + tya + ldy #0 + sta (_22),y + //SEG167 [82] (byte) makecharset::i#1 ← ++ (byte) makecharset::i#6 -- vbuz1=_inc_vbuz1 inc i - //SEG167 [82] if((byte) makecharset::i#1<(byte/signed byte/word/signed word/dword/signed dword) 8) goto makecharset::@4 -- vbuz1_lt_vbuc1_then_la1 + //SEG168 [83] if((byte) makecharset::i#1<(byte/signed byte/word/signed word/dword/signed dword) 8) goto makecharset::@4 -- vbuz1_lt_vbuc1_then_la1 lda i cmp #8 bcc b4 - //SEG168 makecharset::@9 - //SEG169 [83] (byte) makecharset::c#1 ← ++ (byte) makecharset::c#7 -- vbuz1=_inc_vbuz1 + //SEG169 makecharset::@9 + //SEG170 [84] (byte) makecharset::c#1 ← ++ (byte) makecharset::c#7 -- vbuz1=_inc_vbuz1 inc c - //SEG170 [84] if((byte) makecharset::c#1<(byte/signed byte/word/signed word/dword/signed dword) $40) goto makecharset::@3 -- vbuz1_lt_vbuc1_then_la1 + //SEG171 [85] if((byte) makecharset::c#1<(byte/signed byte/word/signed word/dword/signed dword) $40) goto makecharset::@3 -- vbuz1_lt_vbuc1_then_la1 lda c cmp #$40 bcc b3 - //SEG171 makecharset::@return - //SEG172 [85] return + //SEG172 makecharset::@return + //SEG173 [86] return rts bittab: .byte 1, 2, 4, 8, $10, $20, $40, $80 } -//SEG173 sid_rnd_init +//SEG174 sid_rnd_init // Initialize SID voice 3 for random number generation sid_rnd_init: { - //SEG174 [86] *((const word*) SID_VOICE3_FREQ#0) ← (word/dword/signed dword) $ffff -- _deref_pwuc1=vwuc2 + //SEG175 [87] *((const word*) SID_VOICE3_FREQ#0) ← (word/dword/signed dword) $ffff -- _deref_pwuc1=vwuc2 lda #<$ffff sta SID_VOICE3_FREQ lda #>$ffff sta SID_VOICE3_FREQ+1 - //SEG175 [87] *((const byte*) SID_VOICE3_CONTROL#0) ← (const byte) SID_CONTROL_NOISE#0 -- _deref_pbuc1=vbuc2 + //SEG176 [88] *((const byte*) SID_VOICE3_CONTROL#0) ← (const byte) SID_CONTROL_NOISE#0 -- _deref_pbuc1=vbuc2 lda #SID_CONTROL_NOISE sta SID_VOICE3_CONTROL - //SEG176 sid_rnd_init::@return - //SEG177 [88] return + //SEG177 sid_rnd_init::@return + //SEG178 [89] return rts } -//SEG178 fillscreen +//SEG179 fillscreen // Fill a screen (1000 bytes) with a specific byte // fillscreen(byte* zeropage(2) screen, byte register(X) fill) fillscreen: { .label screen = 2 .label i = 4 - //SEG179 [90] phi from fillscreen to fillscreen::@1 [phi:fillscreen->fillscreen::@1] - //SEG180 [90] phi (word) fillscreen::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:fillscreen->fillscreen::@1#0] -- vwuz1=vbuc1 + //SEG180 [91] phi from fillscreen to fillscreen::@1 [phi:fillscreen->fillscreen::@1] + //SEG181 [91] phi (word) fillscreen::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:fillscreen->fillscreen::@1#0] -- vwuz1=vbuc1 lda #0 sta i sta i+1 - //SEG181 [90] phi (byte*) fillscreen::screen#5 = (byte*) fillscreen::screen#6 [phi:fillscreen->fillscreen::@1#1] -- register_copy - //SEG182 [90] phi from fillscreen::@1 to fillscreen::@1 [phi:fillscreen::@1->fillscreen::@1] - //SEG183 [90] phi (word) fillscreen::i#2 = (word) fillscreen::i#1 [phi:fillscreen::@1->fillscreen::@1#0] -- register_copy - //SEG184 [90] phi (byte*) fillscreen::screen#5 = (byte*) fillscreen::screen#4 [phi:fillscreen::@1->fillscreen::@1#1] -- register_copy - //SEG185 fillscreen::@1 + //SEG182 [91] phi (byte*) fillscreen::screen#5 = (byte*) fillscreen::screen#6 [phi:fillscreen->fillscreen::@1#1] -- register_copy + //SEG183 [91] phi from fillscreen::@1 to fillscreen::@1 [phi:fillscreen::@1->fillscreen::@1] + //SEG184 [91] phi (word) fillscreen::i#2 = (word) fillscreen::i#1 [phi:fillscreen::@1->fillscreen::@1#0] -- register_copy + //SEG185 [91] phi (byte*) fillscreen::screen#5 = (byte*) fillscreen::screen#4 [phi:fillscreen::@1->fillscreen::@1#1] -- register_copy + //SEG186 fillscreen::@1 b1: - //SEG186 [91] *((byte*) fillscreen::screen#5) ← (byte) fillscreen::fill#5 -- _deref_pbuz1=vbuxx + //SEG187 [92] *((byte*) fillscreen::screen#5) ← (byte) fillscreen::fill#5 -- _deref_pbuz1=vbuxx txa ldy #0 sta (screen),y - //SEG187 [92] (byte*) fillscreen::screen#4 ← ++ (byte*) fillscreen::screen#5 -- pbuz1=_inc_pbuz1 + //SEG188 [93] (byte*) fillscreen::screen#4 ← ++ (byte*) fillscreen::screen#5 -- pbuz1=_inc_pbuz1 inc screen bne !+ inc screen+1 !: - //SEG188 [93] (word) fillscreen::i#1 ← ++ (word) fillscreen::i#2 -- vwuz1=_inc_vwuz1 + //SEG189 [94] (word) fillscreen::i#1 ← ++ (word) fillscreen::i#2 -- vwuz1=_inc_vwuz1 inc i bne !+ inc i+1 !: - //SEG189 [94] if((word) fillscreen::i#1!=(word/signed word/dword/signed dword) $3e8) goto fillscreen::@1 -- vwuz1_neq_vwuc1_then_la1 + //SEG190 [95] if((word) fillscreen::i#1!=(word/signed word/dword/signed dword) $3e8) goto fillscreen::@1 -- vwuz1_neq_vwuc1_then_la1 lda i+1 cmp #>$3e8 bne b1 lda i cmp #<$3e8 bne b1 - //SEG190 fillscreen::@return - //SEG191 [95] return + //SEG191 fillscreen::@return + //SEG192 [96] return rts } diff --git a/src/test/ref/examples/fire/fire.sym b/src/test/ref/examples/fire/fire.sym index 4ad87f55f..639c70730 100644 --- a/src/test/ref/examples/fire/fire.sym +++ b/src/test/ref/examples/fire/fire.sym @@ -118,6 +118,7 @@ (word~) makecharset::$17 $17 zp ZP_WORD:2 202.0 (word~) makecharset::$18 $18 zp ZP_WORD:2 202.0 (word~) makecharset::$19 $19 zp ZP_WORD:2 202.0 +(byte*) makecharset::$22 $22 zp ZP_WORD:2 202.0 (label) makecharset::@1 (label) makecharset::@2 (label) makecharset::@3 @@ -131,18 +132,18 @@ (byte) makecharset::b (byte) makecharset::b#1 reg byte y 2002.0 (byte) makecharset::b#2 reg byte y 429.0 -(byte) makecharset::b#3 reg byte y 517.3333333333334 +(byte) makecharset::b#3 reg byte y 443.42857142857144 (byte) makecharset::bc (byte) makecharset::bc#1 reg byte x 2002.0 (byte) makecharset::bc#2 reg byte x 400.4 (byte) makecharset::bc#3 reg byte x 2103.0 (byte) makecharset::bc#5 reg byte x 202.0 -(byte) makecharset::bc#6 reg byte x 344.8888888888889 +(byte) makecharset::bc#6 reg byte x 310.4 (byte[8]) makecharset::bittab (const byte[8]) makecharset::bittab#0 bittab = { (byte/signed byte/word/signed word/dword/signed dword) 1, (byte/signed byte/word/signed word/dword/signed dword) 2, (byte/signed byte/word/signed word/dword/signed dword) 4, (byte/signed byte/word/signed word/dword/signed dword) 8, (byte/signed byte/word/signed word/dword/signed dword) $10, (byte/signed byte/word/signed word/dword/signed dword) $20, (byte/signed byte/word/signed word/dword/signed dword) $40, (byte/word/signed word/dword/signed dword) $80 } (byte) makecharset::c (byte) makecharset::c#1 c zp ZP_BYTE:8 16.5 -(byte) makecharset::c#7 c zp ZP_BYTE:8 59.15789473684211 +(byte) makecharset::c#7 c zp ZP_BYTE:8 56.19999999999999 (byte*) makecharset::charset (byte*) makecharset::font (byte*) makecharset::font#1 font zp ZP_WORD:2 16.5 @@ -152,7 +153,7 @@ (byte*) makecharset::font1#2 font1 zp ZP_WORD:2 16.5 (byte) makecharset::i (byte) makecharset::i#1 i zp ZP_BYTE:9 151.5 -(byte) makecharset::i#6 i zp ZP_BYTE:9 81.5 +(byte) makecharset::i#6 i zp ZP_BYTE:9 76.70588235294117 (byte) makecharset::ii (byte) makecharset::ii#1 ii zp ZP_BYTE:10 1501.5 (byte) makecharset::ii#2 ii zp ZP_BYTE:10 333.6666666666667 @@ -164,7 +165,7 @@ (void()) sid_rnd_init() (label) sid_rnd_init::@return -zp ZP_WORD:2 [ fire::screen#0 fire::screen#5 fire::screen#3 fire::screen#1 makecharset::font#2 makecharset::font#1 makecharset::font1#2 makecharset::font1#1 fillscreen::screen#5 fillscreen::screen#6 fillscreen::screen#4 makecharset::$17 makecharset::$18 makecharset::$19 ] +zp ZP_WORD:2 [ fire::screen#0 fire::screen#5 fire::screen#3 fire::screen#1 makecharset::font#2 makecharset::font#1 makecharset::font1#2 makecharset::font1#1 fillscreen::screen#5 fillscreen::screen#6 fillscreen::screen#4 makecharset::$17 makecharset::$18 makecharset::$19 makecharset::$22 ] zp ZP_WORD:4 [ fire::buffer#4 fire::buffer#2 fire::buffer#7 fire::buffer#3 fillscreen::i#2 fillscreen::i#1 ] zp ZP_WORD:6 [ fire::screen#4 fire::screen#10 fire::screen#2 ] reg byte a [ fire::c#2 fire::c#0 fire::c#1 ] diff --git a/src/test/ref/examples/plasma/plasma-unroll.asm b/src/test/ref/examples/plasma/plasma-unroll.asm index 0f05b7a92..6ac675a5a 100644 --- a/src/test/ref/examples/plasma/plasma-unroll.asm +++ b/src/test/ref/examples/plasma/plasma-unroll.asm @@ -247,6 +247,7 @@ makecharset: { .label s = 5 .label i = 4 .label c = 2 + .label _16 = $e jsr sid_rnd_init jsr print_cls lda #CHARSET - adc _9+1 - sta !a++2 - !v: - lda #0 - !a: - sta CHARSET + lda _16 + adc #CHARSET + sta _16+1 + tya + ldy #0 + sta (_16),y inc i lda i cmp #8 @@ -330,9 +328,7 @@ makecharset: { bne !+ lda c cmp #<$100 - bcs !b1+ - jmp b1 - !b1: + bcc b1 !: rts bittab: .byte 1, 2, 4, 8, $10, $20, $40, $80 diff --git a/src/test/ref/examples/plasma/plasma-unroll.cfg b/src/test/ref/examples/plasma/plasma-unroll.cfg index 8306b4c36..336acde43 100644 --- a/src/test/ref/examples/plasma/plasma-unroll.cfg +++ b/src/test/ref/examples/plasma/plasma-unroll.cfg @@ -234,55 +234,56 @@ makecharset::@4: scope:[makecharset] from makecharset::@11 makecharset::@5 makecharset::@6: scope:[makecharset] from makecharset::@4 [116] (word~) makecharset::$8 ← (word) makecharset::c#2 << (byte/signed byte/word/signed word/dword/signed dword) 3 [117] (word~) makecharset::$9 ← (word~) makecharset::$8 + (byte) makecharset::i#7 - [118] *((const byte*) CHARSET#0 + (word~) makecharset::$9) ← (byte) makecharset::b#3 - [119] (byte) makecharset::i#1 ← ++ (byte) makecharset::i#7 - [120] if((byte) makecharset::i#1<(byte/signed byte/word/signed word/dword/signed dword) 8) goto makecharset::@2 + [118] (byte*) makecharset::$16 ← (const byte*) CHARSET#0 + (word~) makecharset::$9 + [119] *((byte*) makecharset::$16) ← (byte) makecharset::b#3 + [120] (byte) makecharset::i#1 ← ++ (byte) makecharset::i#7 + [121] if((byte) makecharset::i#1<(byte/signed byte/word/signed word/dword/signed dword) 8) goto makecharset::@2 to:makecharset::@7 makecharset::@7: scope:[makecharset] from makecharset::@6 - [121] (byte/word~) makecharset::$11 ← (word) makecharset::c#2 & (byte/signed byte/word/signed word/dword/signed dword) 7 - [122] if((byte/word~) makecharset::$11!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto makecharset::@9 + [122] (byte/word~) makecharset::$11 ← (word) makecharset::c#2 & (byte/signed byte/word/signed word/dword/signed dword) 7 + [123] if((byte/word~) makecharset::$11!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto makecharset::@9 to:makecharset::@8 makecharset::@8: scope:[makecharset] from makecharset::@7 - [123] phi() - [124] call print_char + [124] phi() + [125] call print_char to:makecharset::@9 makecharset::@9: scope:[makecharset] from makecharset::@7 makecharset::@8 - [125] (byte*) print_char_cursor#18 ← phi( makecharset::@8/(byte*) print_char_cursor#1 makecharset::@7/(byte*) print_char_cursor#44 ) - [126] (word) makecharset::c#1 ← ++ (word) makecharset::c#2 - [127] if((word) makecharset::c#1<(word/signed word/dword/signed dword) $100) goto makecharset::@1 + [126] (byte*) print_char_cursor#18 ← phi( makecharset::@8/(byte*) print_char_cursor#1 makecharset::@7/(byte*) print_char_cursor#44 ) + [127] (word) makecharset::c#1 ← ++ (word) makecharset::c#2 + [128] if((word) makecharset::c#1<(word/signed word/dword/signed dword) $100) goto makecharset::@1 to:makecharset::@return makecharset::@return: scope:[makecharset] from makecharset::@9 - [128] return + [129] return to:@return print_char: scope:[print_char] from makecharset::@8 - [129] *((byte*) print_char_cursor#44) ← (const byte) print_char::ch#0 - [130] (byte*) print_char_cursor#1 ← ++ (byte*) print_char_cursor#44 + [130] *((byte*) print_char_cursor#44) ← (const byte) print_char::ch#0 + [131] (byte*) print_char_cursor#1 ← ++ (byte*) print_char_cursor#44 to:print_char::@return print_char::@return: scope:[print_char] from print_char - [131] return + [132] return to:@return sid_rnd: scope:[sid_rnd] from makecharset::@3 - [132] (byte) sid_rnd::return#0 ← *((const byte*) SID_VOICE3_OSC#0) + [133] (byte) sid_rnd::return#0 ← *((const byte*) SID_VOICE3_OSC#0) to:sid_rnd::@return sid_rnd::@return: scope:[sid_rnd] from sid_rnd - [133] return + [134] return to:@return print_cls: scope:[print_cls] from makecharset::@10 - [134] phi() + [135] phi() to:print_cls::@1 print_cls::@1: scope:[print_cls] from print_cls print_cls::@1 - [135] (byte*) print_cls::sc#2 ← phi( print_cls/(const byte*) print_line_cursor#0 print_cls::@1/(byte*) print_cls::sc#1 ) - [136] *((byte*) print_cls::sc#2) ← (byte) ' ' - [137] (byte*) print_cls::sc#1 ← ++ (byte*) print_cls::sc#2 - [138] if((byte*) print_cls::sc#1!=(const byte*) print_line_cursor#0+(word/signed word/dword/signed dword) $3e8) goto print_cls::@1 + [136] (byte*) print_cls::sc#2 ← phi( print_cls/(const byte*) print_line_cursor#0 print_cls::@1/(byte*) print_cls::sc#1 ) + [137] *((byte*) print_cls::sc#2) ← (byte) ' ' + [138] (byte*) print_cls::sc#1 ← ++ (byte*) print_cls::sc#2 + [139] if((byte*) print_cls::sc#1!=(const byte*) print_line_cursor#0+(word/signed word/dword/signed dword) $3e8) goto print_cls::@1 to:print_cls::@return print_cls::@return: scope:[print_cls] from print_cls::@1 - [139] return + [140] return to:@return sid_rnd_init: scope:[sid_rnd_init] from makecharset - [140] *((const word*) SID_VOICE3_FREQ#0) ← (word/dword/signed dword) $ffff - [141] *((const byte*) SID_VOICE3_CONTROL#0) ← (const byte) SID_CONTROL_NOISE#0 + [141] *((const word*) SID_VOICE3_FREQ#0) ← (word/dword/signed dword) $ffff + [142] *((const byte*) SID_VOICE3_CONTROL#0) ← (const byte) SID_CONTROL_NOISE#0 to:sid_rnd_init::@return sid_rnd_init::@return: scope:[sid_rnd_init] from sid_rnd_init - [142] return + [143] return to:@return diff --git a/src/test/ref/examples/plasma/plasma-unroll.log b/src/test/ref/examples/plasma/plasma-unroll.log index b12a39b0a..0e909c20b 100644 --- a/src/test/ref/examples/plasma/plasma-unroll.log +++ b/src/test/ref/examples/plasma/plasma-unroll.log @@ -1289,6 +1289,8 @@ Resolved ranged next value main::col#1 ← ++ main::col#2 to ++ Resolved ranged comparison value if(main::col#1!=rangelast(COLS#0,main::$2)) goto main::@1 to (byte*)(const byte*) main::$2+(byte/signed byte/word/signed word/dword/signed dword) 1 Rewriting multiplication to use shift (word/signed dword/dword~) makecharset::$8 ← (word) makecharset::c#12 * (byte/signed byte/word/signed word/dword/signed dword) 8 Successful SSA optimization Pass2MultiplyToShiftRewriting +De-inlining pointer[w] to *(pointer+w) *((byte*) makecharset::charset#6 + (word/signed dword/dword~) makecharset::$9) ← (byte) makecharset::b#3 +Successful SSA optimization Pass2DeInlineWordDerefIdx Culled Empty Block (label) @4 Culled Empty Block (label) print_cls::@2 Culled Empty Block (label) @23 @@ -1959,7 +1961,7 @@ Adding NOP phi() at start of print_cls CALL GRAPH Calls in [] to main:3 Calls in [main] to makecharset:13 doplasma:18 -Calls in [makecharset] to sid_rnd_init:115 print_cls:117 sid_rnd:123 print_char:141 +Calls in [makecharset] to sid_rnd_init:115 print_cls:117 sid_rnd:123 print_char:142 Created 21 initial phi equivalence classes Coalesced [19] c1A#28 ← c1A#3 @@ -1980,15 +1982,15 @@ Coalesced [111] doplasma::c1b#4 ← doplasma::c1b#1 Not coalescing [112] doplasma::yprev#3 ← doplasma::yval#0 Coalesced [113] doplasma::i#3 ← doplasma::i#1 Coalesced [129] makecharset::b#9 ← makecharset::b#1 -Coalesced [142] print_char_cursor#46 ← print_char_cursor#1 -Coalesced [147] makecharset::c#13 ← makecharset::c#1 -Coalesced [148] print_char_cursor#45 ← print_char_cursor#18 -Coalesced (already) [149] print_char_cursor#47 ← print_char_cursor#44 -Coalesced [150] makecharset::i#8 ← makecharset::i#1 -Coalesced [151] makecharset::ii#6 ← makecharset::ii#1 -Coalesced [152] makecharset::b#7 ← makecharset::b#3 -Coalesced (already) [153] makecharset::b#8 ← makecharset::b#2 -Coalesced [165] print_cls::sc#3 ← print_cls::sc#1 +Coalesced [143] print_char_cursor#46 ← print_char_cursor#1 +Coalesced [148] makecharset::c#13 ← makecharset::c#1 +Coalesced [149] print_char_cursor#45 ← print_char_cursor#18 +Coalesced (already) [150] print_char_cursor#47 ← print_char_cursor#44 +Coalesced [151] makecharset::i#8 ← makecharset::i#1 +Coalesced [152] makecharset::ii#6 ← makecharset::ii#1 +Coalesced [153] makecharset::b#7 ← makecharset::b#3 +Coalesced (already) [154] makecharset::b#8 ← makecharset::b#2 +Coalesced [166] print_cls::sc#3 ← print_cls::sc#1 Coalesced down to 20 phi equivalence classes Culled Empty Block (label) main::@12 Culled Empty Block (label) doplasma::@11 @@ -2253,57 +2255,58 @@ makecharset::@4: scope:[makecharset] from makecharset::@11 makecharset::@5 makecharset::@6: scope:[makecharset] from makecharset::@4 [116] (word~) makecharset::$8 ← (word) makecharset::c#2 << (byte/signed byte/word/signed word/dword/signed dword) 3 [117] (word~) makecharset::$9 ← (word~) makecharset::$8 + (byte) makecharset::i#7 - [118] *((const byte*) CHARSET#0 + (word~) makecharset::$9) ← (byte) makecharset::b#3 - [119] (byte) makecharset::i#1 ← ++ (byte) makecharset::i#7 - [120] if((byte) makecharset::i#1<(byte/signed byte/word/signed word/dword/signed dword) 8) goto makecharset::@2 + [118] (byte*) makecharset::$16 ← (const byte*) CHARSET#0 + (word~) makecharset::$9 + [119] *((byte*) makecharset::$16) ← (byte) makecharset::b#3 + [120] (byte) makecharset::i#1 ← ++ (byte) makecharset::i#7 + [121] if((byte) makecharset::i#1<(byte/signed byte/word/signed word/dword/signed dword) 8) goto makecharset::@2 to:makecharset::@7 makecharset::@7: scope:[makecharset] from makecharset::@6 - [121] (byte/word~) makecharset::$11 ← (word) makecharset::c#2 & (byte/signed byte/word/signed word/dword/signed dword) 7 - [122] if((byte/word~) makecharset::$11!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto makecharset::@9 + [122] (byte/word~) makecharset::$11 ← (word) makecharset::c#2 & (byte/signed byte/word/signed word/dword/signed dword) 7 + [123] if((byte/word~) makecharset::$11!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto makecharset::@9 to:makecharset::@8 makecharset::@8: scope:[makecharset] from makecharset::@7 - [123] phi() - [124] call print_char + [124] phi() + [125] call print_char to:makecharset::@9 makecharset::@9: scope:[makecharset] from makecharset::@7 makecharset::@8 - [125] (byte*) print_char_cursor#18 ← phi( makecharset::@8/(byte*) print_char_cursor#1 makecharset::@7/(byte*) print_char_cursor#44 ) - [126] (word) makecharset::c#1 ← ++ (word) makecharset::c#2 - [127] if((word) makecharset::c#1<(word/signed word/dword/signed dword) $100) goto makecharset::@1 + [126] (byte*) print_char_cursor#18 ← phi( makecharset::@8/(byte*) print_char_cursor#1 makecharset::@7/(byte*) print_char_cursor#44 ) + [127] (word) makecharset::c#1 ← ++ (word) makecharset::c#2 + [128] if((word) makecharset::c#1<(word/signed word/dword/signed dword) $100) goto makecharset::@1 to:makecharset::@return makecharset::@return: scope:[makecharset] from makecharset::@9 - [128] return + [129] return to:@return print_char: scope:[print_char] from makecharset::@8 - [129] *((byte*) print_char_cursor#44) ← (const byte) print_char::ch#0 - [130] (byte*) print_char_cursor#1 ← ++ (byte*) print_char_cursor#44 + [130] *((byte*) print_char_cursor#44) ← (const byte) print_char::ch#0 + [131] (byte*) print_char_cursor#1 ← ++ (byte*) print_char_cursor#44 to:print_char::@return print_char::@return: scope:[print_char] from print_char - [131] return + [132] return to:@return sid_rnd: scope:[sid_rnd] from makecharset::@3 - [132] (byte) sid_rnd::return#0 ← *((const byte*) SID_VOICE3_OSC#0) + [133] (byte) sid_rnd::return#0 ← *((const byte*) SID_VOICE3_OSC#0) to:sid_rnd::@return sid_rnd::@return: scope:[sid_rnd] from sid_rnd - [133] return + [134] return to:@return print_cls: scope:[print_cls] from makecharset::@10 - [134] phi() + [135] phi() to:print_cls::@1 print_cls::@1: scope:[print_cls] from print_cls print_cls::@1 - [135] (byte*) print_cls::sc#2 ← phi( print_cls/(const byte*) print_line_cursor#0 print_cls::@1/(byte*) print_cls::sc#1 ) - [136] *((byte*) print_cls::sc#2) ← (byte) ' ' - [137] (byte*) print_cls::sc#1 ← ++ (byte*) print_cls::sc#2 - [138] if((byte*) print_cls::sc#1!=(const byte*) print_line_cursor#0+(word/signed word/dword/signed dword) $3e8) goto print_cls::@1 + [136] (byte*) print_cls::sc#2 ← phi( print_cls/(const byte*) print_line_cursor#0 print_cls::@1/(byte*) print_cls::sc#1 ) + [137] *((byte*) print_cls::sc#2) ← (byte) ' ' + [138] (byte*) print_cls::sc#1 ← ++ (byte*) print_cls::sc#2 + [139] if((byte*) print_cls::sc#1!=(const byte*) print_line_cursor#0+(word/signed word/dword/signed dword) $3e8) goto print_cls::@1 to:print_cls::@return print_cls::@return: scope:[print_cls] from print_cls::@1 - [139] return + [140] return to:@return sid_rnd_init: scope:[sid_rnd_init] from makecharset - [140] *((const word*) SID_VOICE3_FREQ#0) ← (word/dword/signed dword) $ffff - [141] *((const byte*) SID_VOICE3_CONTROL#0) ← (const byte) SID_CONTROL_NOISE#0 + [141] *((const word*) SID_VOICE3_FREQ#0) ← (word/dword/signed dword) $ffff + [142] *((const byte*) SID_VOICE3_CONTROL#0) ← (const byte) SID_CONTROL_NOISE#0 to:sid_rnd_init::@return sid_rnd_init::@return: scope:[sid_rnd_init] from sid_rnd_init - [142] return + [143] return to:@return @@ -2415,6 +2418,7 @@ VARIABLE REGISTER WEIGHTS (byte*) main::toD0181_screen (void()) makecharset((byte*) makecharset::charset) (byte/word~) makecharset::$11 22.0 +(byte*) makecharset::$16 202.0 (byte~) makecharset::$2 22.0 (byte~) makecharset::$3 2002.0 (byte~) makecharset::$4 2002.0 @@ -2423,26 +2427,26 @@ VARIABLE REGISTER WEIGHTS (byte) makecharset::b (byte) makecharset::b#1 2002.0 (byte) makecharset::b#2 500.5 -(byte) makecharset::b#3 620.8 +(byte) makecharset::b#3 517.3333333333334 (byte[8]) makecharset::bittab (word) makecharset::c (word) makecharset::c#1 16.5 -(word) makecharset::c#2 6.041666666666666 +(word) makecharset::c#2 5.800000000000001 (byte*) makecharset::charset (byte) makecharset::i (byte) makecharset::i#1 151.5 -(byte) makecharset::i#7 21.642857142857142 +(byte) makecharset::i#7 20.2 (byte) makecharset::ii (byte) makecharset::ii#1 1501.5 (byte) makecharset::ii#2 375.375 (byte) makecharset::s -(byte) makecharset::s#0 59.529411764705884 +(byte) makecharset::s#0 56.22222222222223 (void()) print_char((byte) print_char::ch) (byte) print_char::ch (byte*) print_char_cursor (byte*) print_char_cursor#1 4.333333333333333 (byte*) print_char_cursor#18 11.0 -(byte*) print_char_cursor#44 1.1304347826086956 +(byte*) print_char_cursor#44 1.0833333333333333 (void()) print_cls() (byte*) print_cls::sc (byte*) print_cls::sc#1 16.5 @@ -2511,6 +2515,7 @@ Added variable makecharset::$3 to zero page equivalence class [ makecharset::$3 Added variable makecharset::$4 to zero page equivalence class [ makecharset::$4 ] Added variable makecharset::$8 to zero page equivalence class [ makecharset::$8 ] Added variable makecharset::$9 to zero page equivalence class [ makecharset::$9 ] +Added variable makecharset::$16 to zero page equivalence class [ makecharset::$16 ] Added variable makecharset::$11 to zero page equivalence class [ makecharset::$11 ] Added variable sid_rnd::return#0 to zero page equivalence class [ sid_rnd::return#0 ] Complete equivalence classes @@ -2569,6 +2574,7 @@ Complete equivalence classes [ makecharset::$4 ] [ makecharset::$8 ] [ makecharset::$9 ] +[ makecharset::$16 ] [ makecharset::$11 ] [ sid_rnd::return#0 ] Allocated zp ZP_WORD:2 [ main::col#2 main::col#1 ] @@ -2626,8 +2632,9 @@ Allocated zp ZP_BYTE:57 [ makecharset::$3 ] Allocated zp ZP_BYTE:58 [ makecharset::$4 ] Allocated zp ZP_WORD:59 [ makecharset::$8 ] Allocated zp ZP_WORD:61 [ makecharset::$9 ] -Allocated zp ZP_BYTE:63 [ makecharset::$11 ] -Allocated zp ZP_BYTE:64 [ sid_rnd::return#0 ] +Allocated zp ZP_WORD:63 [ makecharset::$16 ] +Allocated zp ZP_BYTE:65 [ makecharset::$11 ] +Allocated zp ZP_BYTE:66 [ sid_rnd::return#0 ] INITIAL ASM //SEG0 File Comments @@ -3293,12 +3300,13 @@ makecharset: { .label _4 = $3a .label _8 = $3b .label _9 = $3d - .label _11 = $3f + .label _11 = $41 .label s = $37 .label ii = $15 .label b = $16 .label i = $14 .label c = $10 + .label _16 = $3f //SEG178 [99] call sid_rnd_init jsr sid_rnd_init //SEG179 [100] phi from makecharset to makecharset::@10 [phi:makecharset->makecharset::@10] @@ -3307,7 +3315,7 @@ makecharset: { //SEG180 makecharset::@10 b10: //SEG181 [101] call print_cls - //SEG182 [134] phi from makecharset::@10 to print_cls [phi:makecharset::@10->print_cls] + //SEG182 [135] phi from makecharset::@10 to print_cls [phi:makecharset::@10->print_cls] print_cls_from_b10: jsr print_cls //SEG183 [102] phi from makecharset::@10 to makecharset::@1 [phi:makecharset::@10->makecharset::@1] @@ -3427,57 +3435,55 @@ makecharset: { lda #0 adc _8+1 sta _9+1 - //SEG220 [118] *((const byte*) CHARSET#0 + (word~) makecharset::$9) ← (byte) makecharset::b#3 -- pbuc1_derefidx_vwuz1=vbuz2 - lda b - sta !v++1 - lda #CHARSET - adc _9+1 - sta !a++2 - !v: - lda #0 - !a: - sta CHARSET - //SEG221 [119] (byte) makecharset::i#1 ← ++ (byte) makecharset::i#7 -- vbuz1=_inc_vbuz1 + adc #CHARSET + sta _16+1 + //SEG221 [119] *((byte*) makecharset::$16) ← (byte) makecharset::b#3 -- _deref_pbuz1=vbuz2 + lda b + ldy #0 + sta (_16),y + //SEG222 [120] (byte) makecharset::i#1 ← ++ (byte) makecharset::i#7 -- vbuz1=_inc_vbuz1 inc i - //SEG222 [120] if((byte) makecharset::i#1<(byte/signed byte/word/signed word/dword/signed dword) 8) goto makecharset::@2 -- vbuz1_lt_vbuc1_then_la1 + //SEG223 [121] if((byte) makecharset::i#1<(byte/signed byte/word/signed word/dword/signed dword) 8) goto makecharset::@2 -- vbuz1_lt_vbuc1_then_la1 lda i cmp #8 bcc b2_from_b6 jmp b7 - //SEG223 makecharset::@7 + //SEG224 makecharset::@7 b7: - //SEG224 [121] (byte/word~) makecharset::$11 ← (word) makecharset::c#2 & (byte/signed byte/word/signed word/dword/signed dword) 7 -- vbuz1=vwuz2_band_vbuc1 + //SEG225 [122] (byte/word~) makecharset::$11 ← (word) makecharset::c#2 & (byte/signed byte/word/signed word/dword/signed dword) 7 -- vbuz1=vwuz2_band_vbuc1 lda c and #7 sta _11 - //SEG225 [122] if((byte/word~) makecharset::$11!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto makecharset::@9 -- vbuz1_neq_0_then_la1 + //SEG226 [123] if((byte/word~) makecharset::$11!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto makecharset::@9 -- vbuz1_neq_0_then_la1 lda _11 cmp #0 bne b9_from_b7 - //SEG226 [123] phi from makecharset::@7 to makecharset::@8 [phi:makecharset::@7->makecharset::@8] + //SEG227 [124] phi from makecharset::@7 to makecharset::@8 [phi:makecharset::@7->makecharset::@8] b8_from_b7: jmp b8 - //SEG227 makecharset::@8 + //SEG228 makecharset::@8 b8: - //SEG228 [124] call print_char + //SEG229 [125] call print_char jsr print_char - //SEG229 [125] phi from makecharset::@7 makecharset::@8 to makecharset::@9 [phi:makecharset::@7/makecharset::@8->makecharset::@9] + //SEG230 [126] phi from makecharset::@7 makecharset::@8 to makecharset::@9 [phi:makecharset::@7/makecharset::@8->makecharset::@9] b9_from_b7: b9_from_b8: - //SEG230 [125] phi (byte*) print_char_cursor#18 = (byte*) print_char_cursor#44 [phi:makecharset::@7/makecharset::@8->makecharset::@9#0] -- register_copy + //SEG231 [126] phi (byte*) print_char_cursor#18 = (byte*) print_char_cursor#44 [phi:makecharset::@7/makecharset::@8->makecharset::@9#0] -- register_copy jmp b9 - //SEG231 makecharset::@9 + //SEG232 makecharset::@9 b9: - //SEG232 [126] (word) makecharset::c#1 ← ++ (word) makecharset::c#2 -- vwuz1=_inc_vwuz1 + //SEG233 [127] (word) makecharset::c#1 ← ++ (word) makecharset::c#2 -- vwuz1=_inc_vwuz1 inc c bne !+ inc c+1 !: - //SEG233 [127] if((word) makecharset::c#1<(word/signed word/dword/signed dword) $100) goto makecharset::@1 -- vwuz1_lt_vwuc1_then_la1 + //SEG234 [128] if((word) makecharset::c#1<(word/signed word/dword/signed dword) $100) goto makecharset::@1 -- vwuz1_lt_vwuc1_then_la1 lda c+1 cmp #>$100 bcc b1_from_b9 @@ -3487,74 +3493,74 @@ makecharset: { bcc b1_from_b9 !: jmp breturn - //SEG234 makecharset::@return + //SEG235 makecharset::@return breturn: - //SEG235 [128] return + //SEG236 [129] return rts bittab: .byte 1, 2, 4, 8, $10, $20, $40, $80 } -//SEG236 print_char +//SEG237 print_char // Print a single char print_char: { .const ch = '.' - //SEG237 [129] *((byte*) print_char_cursor#44) ← (const byte) print_char::ch#0 -- _deref_pbuz1=vbuc1 + //SEG238 [130] *((byte*) print_char_cursor#44) ← (const byte) print_char::ch#0 -- _deref_pbuz1=vbuc1 lda #ch ldy #0 sta (print_char_cursor),y - //SEG238 [130] (byte*) print_char_cursor#1 ← ++ (byte*) print_char_cursor#44 -- pbuz1=_inc_pbuz1 + //SEG239 [131] (byte*) print_char_cursor#1 ← ++ (byte*) print_char_cursor#44 -- pbuz1=_inc_pbuz1 inc print_char_cursor bne !+ inc print_char_cursor+1 !: jmp breturn - //SEG239 print_char::@return + //SEG240 print_char::@return breturn: - //SEG240 [131] return + //SEG241 [132] return rts } -//SEG241 sid_rnd +//SEG242 sid_rnd // Get a random number from the SID voice 3, // Must be initialized with sid_rnd_init() sid_rnd: { - .label return = $40 + .label return = $42 .label return_2 = $38 - //SEG242 [132] (byte) sid_rnd::return#0 ← *((const byte*) SID_VOICE3_OSC#0) -- vbuz1=_deref_pbuc1 + //SEG243 [133] (byte) sid_rnd::return#0 ← *((const byte*) SID_VOICE3_OSC#0) -- vbuz1=_deref_pbuc1 lda SID_VOICE3_OSC sta return jmp breturn - //SEG243 sid_rnd::@return + //SEG244 sid_rnd::@return breturn: - //SEG244 [133] return + //SEG245 [134] return rts } -//SEG245 print_cls +//SEG246 print_cls // Clear the screen. Also resets current line/char cursor. print_cls: { .label sc = $17 - //SEG246 [135] phi from print_cls to print_cls::@1 [phi:print_cls->print_cls::@1] + //SEG247 [136] phi from print_cls to print_cls::@1 [phi:print_cls->print_cls::@1] b1_from_print_cls: - //SEG247 [135] phi (byte*) print_cls::sc#2 = (const byte*) print_line_cursor#0 [phi:print_cls->print_cls::@1#0] -- pbuz1=pbuc1 + //SEG248 [136] phi (byte*) print_cls::sc#2 = (const byte*) print_line_cursor#0 [phi:print_cls->print_cls::@1#0] -- pbuz1=pbuc1 lda #print_line_cursor sta sc+1 jmp b1 - //SEG248 [135] phi from print_cls::@1 to print_cls::@1 [phi:print_cls::@1->print_cls::@1] + //SEG249 [136] phi from print_cls::@1 to print_cls::@1 [phi:print_cls::@1->print_cls::@1] b1_from_b1: - //SEG249 [135] phi (byte*) print_cls::sc#2 = (byte*) print_cls::sc#1 [phi:print_cls::@1->print_cls::@1#0] -- register_copy + //SEG250 [136] phi (byte*) print_cls::sc#2 = (byte*) print_cls::sc#1 [phi:print_cls::@1->print_cls::@1#0] -- register_copy jmp b1 - //SEG250 print_cls::@1 + //SEG251 print_cls::@1 b1: - //SEG251 [136] *((byte*) print_cls::sc#2) ← (byte) ' ' -- _deref_pbuz1=vbuc1 + //SEG252 [137] *((byte*) print_cls::sc#2) ← (byte) ' ' -- _deref_pbuz1=vbuc1 lda #' ' ldy #0 sta (sc),y - //SEG252 [137] (byte*) print_cls::sc#1 ← ++ (byte*) print_cls::sc#2 -- pbuz1=_inc_pbuz1 + //SEG253 [138] (byte*) print_cls::sc#1 ← ++ (byte*) print_cls::sc#2 -- pbuz1=_inc_pbuz1 inc sc bne !+ inc sc+1 !: - //SEG253 [138] if((byte*) print_cls::sc#1!=(const byte*) print_line_cursor#0+(word/signed word/dword/signed dword) $3e8) goto print_cls::@1 -- pbuz1_neq_pbuc1_then_la1 + //SEG254 [139] if((byte*) print_cls::sc#1!=(const byte*) print_line_cursor#0+(word/signed word/dword/signed dword) $3e8) goto print_cls::@1 -- pbuz1_neq_pbuc1_then_la1 lda sc+1 cmp #>print_line_cursor+$3e8 bne b1_from_b1 @@ -3562,26 +3568,26 @@ print_cls: { cmp #$ffff sta SID_VOICE3_FREQ+1 - //SEG258 [141] *((const byte*) SID_VOICE3_CONTROL#0) ← (const byte) SID_CONTROL_NOISE#0 -- _deref_pbuc1=vbuc2 + //SEG259 [142] *((const byte*) SID_VOICE3_CONTROL#0) ← (const byte) SID_CONTROL_NOISE#0 -- _deref_pbuc1=vbuc2 lda #SID_CONTROL_NOISE sta SID_VOICE3_CONTROL jmp breturn - //SEG259 sid_rnd_init::@return + //SEG260 sid_rnd_init::@return breturn: - //SEG260 [142] return + //SEG261 [143] return rts } .pc = SINTABLE "SINTABLE" @@ -3651,14 +3657,17 @@ Removing always clobbered register reg byte a as potential for zp ZP_BYTE:21 [ m Statement [116] (word~) makecharset::$8 ← (word) makecharset::c#2 << (byte/signed byte/word/signed word/dword/signed dword) 3 [ makecharset::c#2 print_char_cursor#44 makecharset::s#0 makecharset::i#7 makecharset::b#3 makecharset::$8 ] ( main:3::makecharset:13 [ makecharset::c#2 print_char_cursor#44 makecharset::s#0 makecharset::i#7 makecharset::b#3 makecharset::$8 ] ) always clobbers reg byte a Removing always clobbered register reg byte a as potential for zp ZP_BYTE:22 [ makecharset::b#2 makecharset::b#3 makecharset::b#1 ] Statement [117] (word~) makecharset::$9 ← (word~) makecharset::$8 + (byte) makecharset::i#7 [ makecharset::c#2 print_char_cursor#44 makecharset::s#0 makecharset::i#7 makecharset::b#3 makecharset::$9 ] ( main:3::makecharset:13 [ makecharset::c#2 print_char_cursor#44 makecharset::s#0 makecharset::i#7 makecharset::b#3 makecharset::$9 ] ) always clobbers reg byte a -Statement [118] *((const byte*) CHARSET#0 + (word~) makecharset::$9) ← (byte) makecharset::b#3 [ makecharset::c#2 print_char_cursor#44 makecharset::s#0 makecharset::i#7 ] ( main:3::makecharset:13 [ makecharset::c#2 print_char_cursor#44 makecharset::s#0 makecharset::i#7 ] ) always clobbers reg byte a -Statement [121] (byte/word~) makecharset::$11 ← (word) makecharset::c#2 & (byte/signed byte/word/signed word/dword/signed dword) 7 [ makecharset::c#2 print_char_cursor#44 makecharset::$11 ] ( main:3::makecharset:13 [ makecharset::c#2 print_char_cursor#44 makecharset::$11 ] ) always clobbers reg byte a -Statement [127] if((word) makecharset::c#1<(word/signed word/dword/signed dword) $100) goto makecharset::@1 [ makecharset::c#1 print_char_cursor#18 ] ( main:3::makecharset:13 [ makecharset::c#1 print_char_cursor#18 ] ) always clobbers reg byte a -Statement [129] *((byte*) print_char_cursor#44) ← (const byte) print_char::ch#0 [ print_char_cursor#44 ] ( main:3::makecharset:13::print_char:124 [ makecharset::c#2 print_char_cursor#44 ] ) always clobbers reg byte a reg byte y -Statement [136] *((byte*) print_cls::sc#2) ← (byte) ' ' [ print_cls::sc#2 ] ( main:3::makecharset:13::print_cls:101 [ print_cls::sc#2 ] ) always clobbers reg byte a reg byte y -Statement [138] if((byte*) print_cls::sc#1!=(const byte*) print_line_cursor#0+(word/signed word/dword/signed dword) $3e8) goto print_cls::@1 [ print_cls::sc#1 ] ( main:3::makecharset:13::print_cls:101 [ print_cls::sc#1 ] ) always clobbers reg byte a -Statement [140] *((const word*) SID_VOICE3_FREQ#0) ← (word/dword/signed dword) $ffff [ ] ( main:3::makecharset:13::sid_rnd_init:99 [ ] ) always clobbers reg byte a -Statement [141] *((const byte*) SID_VOICE3_CONTROL#0) ← (const byte) SID_CONTROL_NOISE#0 [ ] ( main:3::makecharset:13::sid_rnd_init:99 [ ] ) always clobbers reg byte a +Statement [118] (byte*) makecharset::$16 ← (const byte*) CHARSET#0 + (word~) makecharset::$9 [ makecharset::c#2 print_char_cursor#44 makecharset::s#0 makecharset::i#7 makecharset::b#3 makecharset::$16 ] ( main:3::makecharset:13 [ makecharset::c#2 print_char_cursor#44 makecharset::s#0 makecharset::i#7 makecharset::b#3 makecharset::$16 ] ) always clobbers reg byte a +Statement [119] *((byte*) makecharset::$16) ← (byte) makecharset::b#3 [ makecharset::c#2 print_char_cursor#44 makecharset::s#0 makecharset::i#7 ] ( main:3::makecharset:13 [ makecharset::c#2 print_char_cursor#44 makecharset::s#0 makecharset::i#7 ] ) always clobbers reg byte a reg byte y +Removing always clobbered register reg byte y as potential for zp ZP_BYTE:55 [ makecharset::s#0 ] +Removing always clobbered register reg byte y as potential for zp ZP_BYTE:20 [ makecharset::i#7 makecharset::i#1 ] +Statement [122] (byte/word~) makecharset::$11 ← (word) makecharset::c#2 & (byte/signed byte/word/signed word/dword/signed dword) 7 [ makecharset::c#2 print_char_cursor#44 makecharset::$11 ] ( main:3::makecharset:13 [ makecharset::c#2 print_char_cursor#44 makecharset::$11 ] ) always clobbers reg byte a +Statement [128] if((word) makecharset::c#1<(word/signed word/dword/signed dword) $100) goto makecharset::@1 [ makecharset::c#1 print_char_cursor#18 ] ( main:3::makecharset:13 [ makecharset::c#1 print_char_cursor#18 ] ) always clobbers reg byte a +Statement [130] *((byte*) print_char_cursor#44) ← (const byte) print_char::ch#0 [ print_char_cursor#44 ] ( main:3::makecharset:13::print_char:125 [ makecharset::c#2 print_char_cursor#44 ] ) always clobbers reg byte a reg byte y +Statement [137] *((byte*) print_cls::sc#2) ← (byte) ' ' [ print_cls::sc#2 ] ( main:3::makecharset:13::print_cls:101 [ print_cls::sc#2 ] ) always clobbers reg byte a reg byte y +Statement [139] if((byte*) print_cls::sc#1!=(const byte*) print_line_cursor#0+(word/signed word/dword/signed dword) $3e8) goto print_cls::@1 [ print_cls::sc#1 ] ( main:3::makecharset:13::print_cls:101 [ print_cls::sc#1 ] ) always clobbers reg byte a +Statement [141] *((const word*) SID_VOICE3_FREQ#0) ← (word/dword/signed dword) $ffff [ ] ( main:3::makecharset:13::sid_rnd_init:99 [ ] ) always clobbers reg byte a +Statement [142] *((const byte*) SID_VOICE3_CONTROL#0) ← (const byte) SID_CONTROL_NOISE#0 [ ] ( main:3::makecharset:13::sid_rnd_init:99 [ ] ) always clobbers reg byte a Statement [6] *((const byte*) BORDERCOL#0) ← (const byte) BLUE#0 [ ] ( main:3 [ ] ) always clobbers reg byte a Statement [7] *((const byte*) BGCOL#0) ← (const byte) BLUE#0 [ ] ( main:3 [ ] ) always clobbers reg byte a Statement [9] *((byte*) main::col#2) ← (const byte) BLACK#0 [ main::col#2 ] ( main:3 [ main::col#2 ] ) always clobbers reg byte a reg byte y @@ -3703,14 +3712,15 @@ Statement [103] (byte~) makecharset::$2 ← < (word) makecharset::c#2 [ makechar Statement [112] (byte) makecharset::b#1 ← (byte) makecharset::b#2 | *((const byte[8]) makecharset::bittab#0 + (byte) makecharset::ii#2) [ makecharset::c#2 print_char_cursor#44 makecharset::s#0 makecharset::i#7 makecharset::ii#2 makecharset::b#1 ] ( main:3::makecharset:13 [ makecharset::c#2 print_char_cursor#44 makecharset::s#0 makecharset::i#7 makecharset::ii#2 makecharset::b#1 ] ) always clobbers reg byte a Statement [116] (word~) makecharset::$8 ← (word) makecharset::c#2 << (byte/signed byte/word/signed word/dword/signed dword) 3 [ makecharset::c#2 print_char_cursor#44 makecharset::s#0 makecharset::i#7 makecharset::b#3 makecharset::$8 ] ( main:3::makecharset:13 [ makecharset::c#2 print_char_cursor#44 makecharset::s#0 makecharset::i#7 makecharset::b#3 makecharset::$8 ] ) always clobbers reg byte a Statement [117] (word~) makecharset::$9 ← (word~) makecharset::$8 + (byte) makecharset::i#7 [ makecharset::c#2 print_char_cursor#44 makecharset::s#0 makecharset::i#7 makecharset::b#3 makecharset::$9 ] ( main:3::makecharset:13 [ makecharset::c#2 print_char_cursor#44 makecharset::s#0 makecharset::i#7 makecharset::b#3 makecharset::$9 ] ) always clobbers reg byte a -Statement [118] *((const byte*) CHARSET#0 + (word~) makecharset::$9) ← (byte) makecharset::b#3 [ makecharset::c#2 print_char_cursor#44 makecharset::s#0 makecharset::i#7 ] ( main:3::makecharset:13 [ makecharset::c#2 print_char_cursor#44 makecharset::s#0 makecharset::i#7 ] ) always clobbers reg byte a -Statement [121] (byte/word~) makecharset::$11 ← (word) makecharset::c#2 & (byte/signed byte/word/signed word/dword/signed dword) 7 [ makecharset::c#2 print_char_cursor#44 makecharset::$11 ] ( main:3::makecharset:13 [ makecharset::c#2 print_char_cursor#44 makecharset::$11 ] ) always clobbers reg byte a -Statement [127] if((word) makecharset::c#1<(word/signed word/dword/signed dword) $100) goto makecharset::@1 [ makecharset::c#1 print_char_cursor#18 ] ( main:3::makecharset:13 [ makecharset::c#1 print_char_cursor#18 ] ) always clobbers reg byte a -Statement [129] *((byte*) print_char_cursor#44) ← (const byte) print_char::ch#0 [ print_char_cursor#44 ] ( main:3::makecharset:13::print_char:124 [ makecharset::c#2 print_char_cursor#44 ] ) always clobbers reg byte a reg byte y -Statement [136] *((byte*) print_cls::sc#2) ← (byte) ' ' [ print_cls::sc#2 ] ( main:3::makecharset:13::print_cls:101 [ print_cls::sc#2 ] ) always clobbers reg byte a reg byte y -Statement [138] if((byte*) print_cls::sc#1!=(const byte*) print_line_cursor#0+(word/signed word/dword/signed dword) $3e8) goto print_cls::@1 [ print_cls::sc#1 ] ( main:3::makecharset:13::print_cls:101 [ print_cls::sc#1 ] ) always clobbers reg byte a -Statement [140] *((const word*) SID_VOICE3_FREQ#0) ← (word/dword/signed dword) $ffff [ ] ( main:3::makecharset:13::sid_rnd_init:99 [ ] ) always clobbers reg byte a -Statement [141] *((const byte*) SID_VOICE3_CONTROL#0) ← (const byte) SID_CONTROL_NOISE#0 [ ] ( main:3::makecharset:13::sid_rnd_init:99 [ ] ) always clobbers reg byte a +Statement [118] (byte*) makecharset::$16 ← (const byte*) CHARSET#0 + (word~) makecharset::$9 [ makecharset::c#2 print_char_cursor#44 makecharset::s#0 makecharset::i#7 makecharset::b#3 makecharset::$16 ] ( main:3::makecharset:13 [ makecharset::c#2 print_char_cursor#44 makecharset::s#0 makecharset::i#7 makecharset::b#3 makecharset::$16 ] ) always clobbers reg byte a +Statement [119] *((byte*) makecharset::$16) ← (byte) makecharset::b#3 [ makecharset::c#2 print_char_cursor#44 makecharset::s#0 makecharset::i#7 ] ( main:3::makecharset:13 [ makecharset::c#2 print_char_cursor#44 makecharset::s#0 makecharset::i#7 ] ) always clobbers reg byte a reg byte y +Statement [122] (byte/word~) makecharset::$11 ← (word) makecharset::c#2 & (byte/signed byte/word/signed word/dword/signed dword) 7 [ makecharset::c#2 print_char_cursor#44 makecharset::$11 ] ( main:3::makecharset:13 [ makecharset::c#2 print_char_cursor#44 makecharset::$11 ] ) always clobbers reg byte a +Statement [128] if((word) makecharset::c#1<(word/signed word/dword/signed dword) $100) goto makecharset::@1 [ makecharset::c#1 print_char_cursor#18 ] ( main:3::makecharset:13 [ makecharset::c#1 print_char_cursor#18 ] ) always clobbers reg byte a +Statement [130] *((byte*) print_char_cursor#44) ← (const byte) print_char::ch#0 [ print_char_cursor#44 ] ( main:3::makecharset:13::print_char:125 [ makecharset::c#2 print_char_cursor#44 ] ) always clobbers reg byte a reg byte y +Statement [137] *((byte*) print_cls::sc#2) ← (byte) ' ' [ print_cls::sc#2 ] ( main:3::makecharset:13::print_cls:101 [ print_cls::sc#2 ] ) always clobbers reg byte a reg byte y +Statement [139] if((byte*) print_cls::sc#1!=(const byte*) print_line_cursor#0+(word/signed word/dword/signed dword) $3e8) goto print_cls::@1 [ print_cls::sc#1 ] ( main:3::makecharset:13::print_cls:101 [ print_cls::sc#1 ] ) always clobbers reg byte a +Statement [141] *((const word*) SID_VOICE3_FREQ#0) ← (word/dword/signed dword) $ffff [ ] ( main:3::makecharset:13::sid_rnd_init:99 [ ] ) always clobbers reg byte a +Statement [142] *((const byte*) SID_VOICE3_CONTROL#0) ← (const byte) SID_CONTROL_NOISE#0 [ ] ( main:3::makecharset:13::sid_rnd_init:99 [ ] ) always clobbers reg byte a Potential registers zp ZP_WORD:2 [ main::col#2 main::col#1 ] : zp ZP_WORD:2 , Potential registers zp ZP_BYTE:4 [ c1A#1 c1A#3 ] : zp ZP_BYTE:4 , reg byte x , reg byte y , Potential registers zp ZP_BYTE:5 [ c1B#1 c1B#3 ] : zp ZP_BYTE:5 , reg byte x , reg byte y , @@ -3726,7 +3736,7 @@ Potential registers zp ZP_BYTE:14 [ doplasma::i1#2 doplasma::i1#1 ] : zp ZP_BYTE Potential registers zp ZP_BYTE:15 [ doplasma::i2#2 doplasma::i2#1 ] : zp ZP_BYTE:15 , reg byte x , reg byte y , Potential registers zp ZP_WORD:16 [ makecharset::c#2 makecharset::c#1 ] : zp ZP_WORD:16 , Potential registers zp ZP_WORD:18 [ print_char_cursor#44 print_char_cursor#18 print_char_cursor#1 ] : zp ZP_WORD:18 , -Potential registers zp ZP_BYTE:20 [ makecharset::i#7 makecharset::i#1 ] : zp ZP_BYTE:20 , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:20 [ makecharset::i#7 makecharset::i#1 ] : zp ZP_BYTE:20 , reg byte x , Potential registers zp ZP_BYTE:21 [ makecharset::ii#2 makecharset::ii#1 ] : zp ZP_BYTE:21 , reg byte x , reg byte y , Potential registers zp ZP_BYTE:22 [ makecharset::b#2 makecharset::b#3 makecharset::b#1 ] : zp ZP_BYTE:22 , reg byte x , reg byte y , Potential registers zp ZP_WORD:23 [ print_cls::sc#2 print_cls::sc#1 ] : zp ZP_WORD:23 , @@ -3760,126 +3770,128 @@ Potential registers zp ZP_BYTE:51 [ doplasma::val#46 ] : zp ZP_BYTE:51 , reg byt Potential registers zp ZP_BYTE:52 [ doplasma::val#48 ] : zp ZP_BYTE:52 , reg byte a , reg byte x , reg byte y , Potential registers zp ZP_BYTE:53 [ doplasma::val#50 ] : zp ZP_BYTE:53 , reg byte a , reg byte x , reg byte y , Potential registers zp ZP_BYTE:54 [ makecharset::$2 ] : zp ZP_BYTE:54 , reg byte a , reg byte x , reg byte y , -Potential registers zp ZP_BYTE:55 [ makecharset::s#0 ] : zp ZP_BYTE:55 , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:55 [ makecharset::s#0 ] : zp ZP_BYTE:55 , reg byte x , Potential registers zp ZP_BYTE:56 [ sid_rnd::return#2 ] : zp ZP_BYTE:56 , reg byte a , reg byte x , reg byte y , Potential registers zp ZP_BYTE:57 [ makecharset::$3 ] : zp ZP_BYTE:57 , reg byte a , reg byte x , reg byte y , Potential registers zp ZP_BYTE:58 [ makecharset::$4 ] : zp ZP_BYTE:58 , reg byte a , reg byte x , reg byte y , Potential registers zp ZP_WORD:59 [ makecharset::$8 ] : zp ZP_WORD:59 , Potential registers zp ZP_WORD:61 [ makecharset::$9 ] : zp ZP_WORD:61 , -Potential registers zp ZP_BYTE:63 [ makecharset::$11 ] : zp ZP_BYTE:63 , reg byte a , reg byte x , reg byte y , -Potential registers zp ZP_BYTE:64 [ sid_rnd::return#0 ] : zp ZP_BYTE:64 , reg byte a , reg byte x , reg byte y , +Potential registers zp ZP_WORD:63 [ makecharset::$16 ] : zp ZP_WORD:63 , +Potential registers zp ZP_BYTE:65 [ makecharset::$11 ] : zp ZP_BYTE:65 , reg byte a , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:66 [ sid_rnd::return#0 ] : zp ZP_BYTE:66 , reg byte a , reg byte x , reg byte y , REGISTER UPLIFT SCOPES -Uplift Scope [makecharset] 3,123.3: zp ZP_BYTE:22 [ makecharset::b#2 makecharset::b#3 makecharset::b#1 ] 2,002: zp ZP_BYTE:57 [ makecharset::$3 ] 2,002: zp ZP_BYTE:58 [ makecharset::$4 ] 1,876.88: zp ZP_BYTE:21 [ makecharset::ii#2 makecharset::ii#1 ] 202: zp ZP_WORD:59 [ makecharset::$8 ] 202: zp ZP_WORD:61 [ makecharset::$9 ] 173.14: zp ZP_BYTE:20 [ makecharset::i#7 makecharset::i#1 ] 59.53: zp ZP_BYTE:55 [ makecharset::s#0 ] 22.54: zp ZP_WORD:16 [ makecharset::c#2 makecharset::c#1 ] 22: zp ZP_BYTE:54 [ makecharset::$2 ] 22: zp ZP_BYTE:63 [ makecharset::$11 ] +Uplift Scope [makecharset] 3,019.83: zp ZP_BYTE:22 [ makecharset::b#2 makecharset::b#3 makecharset::b#1 ] 2,002: zp ZP_BYTE:57 [ makecharset::$3 ] 2,002: zp ZP_BYTE:58 [ makecharset::$4 ] 1,876.88: zp ZP_BYTE:21 [ makecharset::ii#2 makecharset::ii#1 ] 202: zp ZP_WORD:59 [ makecharset::$8 ] 202: zp ZP_WORD:61 [ makecharset::$9 ] 202: zp ZP_WORD:63 [ makecharset::$16 ] 171.7: zp ZP_BYTE:20 [ makecharset::i#7 makecharset::i#1 ] 56.22: zp ZP_BYTE:55 [ makecharset::s#0 ] 22.3: zp ZP_WORD:16 [ makecharset::c#2 makecharset::c#1 ] 22: zp ZP_BYTE:54 [ makecharset::$2 ] 22: zp ZP_BYTE:65 [ makecharset::$11 ] Uplift Scope [doplasma] 303: zp ZP_BYTE:10 [ doplasma::yprev#2 doplasma::yprev#3 ] 212.1: zp ZP_BYTE:14 [ doplasma::i1#2 doplasma::i1#1 ] 205.88: zp ZP_BYTE:15 [ doplasma::i2#2 doplasma::i2#1 ] 202: zp ZP_BYTE:26 [ doplasma::$1 ] 202: zp ZP_BYTE:27 [ doplasma::$3 ] 202: zp ZP_BYTE:28 [ doplasma::val#0 ] 202: zp ZP_BYTE:53 [ doplasma::val#50 ] 154.17: zp ZP_BYTE:12 [ doplasma::c2a#2 doplasma::c2a#0 doplasma::c2a#1 ] 151.5: zp ZP_BYTE:11 [ doplasma::i#2 doplasma::i#1 ] 151.5: zp ZP_BYTE:29 [ doplasma::val#1 ] 151.5: zp ZP_BYTE:30 [ doplasma::val#4 ] 151.5: zp ZP_BYTE:31 [ doplasma::val#6 ] 151.5: zp ZP_BYTE:32 [ doplasma::val#8 ] 151.5: zp ZP_BYTE:33 [ doplasma::val#10 ] 151.5: zp ZP_BYTE:34 [ doplasma::val#12 ] 151.5: zp ZP_BYTE:35 [ doplasma::val#14 ] 151.5: zp ZP_BYTE:36 [ doplasma::val#16 ] 151.5: zp ZP_BYTE:37 [ doplasma::val#18 ] 151.5: zp ZP_BYTE:38 [ doplasma::val#20 ] 151.5: zp ZP_BYTE:39 [ doplasma::val#22 ] 151.5: zp ZP_BYTE:40 [ doplasma::val#24 ] 151.5: zp ZP_BYTE:41 [ doplasma::val#26 ] 151.5: zp ZP_BYTE:42 [ doplasma::val#28 ] 151.5: zp ZP_BYTE:43 [ doplasma::val#30 ] 151.5: zp ZP_BYTE:44 [ doplasma::val#32 ] 151.5: zp ZP_BYTE:45 [ doplasma::val#34 ] 151.5: zp ZP_BYTE:46 [ doplasma::val#36 ] 151.5: zp ZP_BYTE:47 [ doplasma::val#38 ] 151.5: zp ZP_BYTE:48 [ doplasma::val#40 ] 151.5: zp ZP_BYTE:49 [ doplasma::val#42 ] 151.5: zp ZP_BYTE:50 [ doplasma::val#44 ] 151.5: zp ZP_BYTE:51 [ doplasma::val#46 ] 151.5: zp ZP_BYTE:52 [ doplasma::val#48 ] 147.58: zp ZP_BYTE:13 [ doplasma::c2b#2 doplasma::c2b#0 doplasma::c2b#1 ] 118.65: zp ZP_BYTE:8 [ doplasma::c1a#2 doplasma::c1a#0 doplasma::c1a#1 ] 115.5: zp ZP_BYTE:9 [ doplasma::c1b#2 doplasma::c1b#0 doplasma::c1b#1 ] 43.29: zp ZP_BYTE:25 [ doplasma::yval#0 ] -Uplift Scope [sid_rnd] 2,002: zp ZP_BYTE:56 [ sid_rnd::return#2 ] 334.33: zp ZP_BYTE:64 [ sid_rnd::return#0 ] +Uplift Scope [sid_rnd] 2,002: zp ZP_BYTE:56 [ sid_rnd::return#2 ] 334.33: zp ZP_BYTE:66 [ sid_rnd::return#0 ] Uplift Scope [print_cls] 33: zp ZP_WORD:23 [ print_cls::sc#2 print_cls::sc#1 ] Uplift Scope [main] 33: zp ZP_WORD:2 [ main::col#2 main::col#1 ] -Uplift Scope [] 16.46: zp ZP_WORD:18 [ print_char_cursor#44 print_char_cursor#18 print_char_cursor#1 ] 1.34: zp ZP_BYTE:4 [ c1A#1 c1A#3 ] 1.26: zp ZP_BYTE:5 [ c1B#1 c1B#3 ] 0.85: zp ZP_BYTE:6 [ c2A#1 c2A#3 ] 0.83: zp ZP_BYTE:7 [ c2B#1 c2B#3 ] +Uplift Scope [] 16.42: zp ZP_WORD:18 [ print_char_cursor#44 print_char_cursor#18 print_char_cursor#1 ] 1.34: zp ZP_BYTE:4 [ c1A#1 c1A#3 ] 1.26: zp ZP_BYTE:5 [ c1B#1 c1B#3 ] 0.85: zp ZP_BYTE:6 [ c2A#1 c2A#3 ] 0.83: zp ZP_BYTE:7 [ c2B#1 c2B#3 ] Uplift Scope [print_char] Uplift Scope [sid_rnd_init] -Uplifting [makecharset] best 165755 combination reg byte y [ makecharset::b#2 makecharset::b#3 makecharset::b#1 ] reg byte a [ makecharset::$3 ] zp ZP_BYTE:58 [ makecharset::$4 ] reg byte x [ makecharset::ii#2 makecharset::ii#1 ] zp ZP_WORD:59 [ makecharset::$8 ] zp ZP_WORD:61 [ makecharset::$9 ] zp ZP_BYTE:20 [ makecharset::i#7 makecharset::i#1 ] zp ZP_BYTE:55 [ makecharset::s#0 ] zp ZP_WORD:16 [ makecharset::c#2 makecharset::c#1 ] zp ZP_BYTE:54 [ makecharset::$2 ] zp ZP_BYTE:63 [ makecharset::$11 ] -Limited combination testing to 100 combinations of 20736 possible. -Uplifting [sid_rnd] best 156752 combination reg byte a [ sid_rnd::return#2 ] reg byte a [ sid_rnd::return#0 ] -Uplifting [print_cls] best 156752 combination zp ZP_WORD:23 [ print_cls::sc#2 print_cls::sc#1 ] -Uplifting [main] best 156752 combination zp ZP_WORD:2 [ main::col#2 main::col#1 ] -Uplifting [] best 156752 combination zp ZP_WORD:18 [ print_char_cursor#44 print_char_cursor#18 print_char_cursor#1 ] zp ZP_BYTE:4 [ c1A#1 c1A#3 ] zp ZP_BYTE:5 [ c1B#1 c1B#3 ] zp ZP_BYTE:6 [ c2A#1 c2A#3 ] zp ZP_BYTE:7 [ c2B#1 c2B#3 ] -Uplifting [print_char] best 156752 combination -Uplifting [sid_rnd_init] best 156752 combination +Uplifting [makecharset] best 165355 combination reg byte y [ makecharset::b#2 makecharset::b#3 makecharset::b#1 ] reg byte a [ makecharset::$3 ] zp ZP_BYTE:58 [ makecharset::$4 ] reg byte x [ makecharset::ii#2 makecharset::ii#1 ] zp ZP_WORD:59 [ makecharset::$8 ] zp ZP_WORD:61 [ makecharset::$9 ] zp ZP_WORD:63 [ makecharset::$16 ] zp ZP_BYTE:20 [ makecharset::i#7 makecharset::i#1 ] zp ZP_BYTE:55 [ makecharset::s#0 ] zp ZP_WORD:16 [ makecharset::c#2 makecharset::c#1 ] zp ZP_BYTE:54 [ makecharset::$2 ] zp ZP_BYTE:65 [ makecharset::$11 ] +Limited combination testing to 100 combinations of 9216 possible. +Uplifting [sid_rnd] best 156352 combination reg byte a [ sid_rnd::return#2 ] reg byte a [ sid_rnd::return#0 ] +Uplifting [print_cls] best 156352 combination zp ZP_WORD:23 [ print_cls::sc#2 print_cls::sc#1 ] +Uplifting [main] best 156352 combination zp ZP_WORD:2 [ main::col#2 main::col#1 ] +Uplifting [] best 156352 combination zp ZP_WORD:18 [ print_char_cursor#44 print_char_cursor#18 print_char_cursor#1 ] zp ZP_BYTE:4 [ c1A#1 c1A#3 ] zp ZP_BYTE:5 [ c1B#1 c1B#3 ] zp ZP_BYTE:6 [ c2A#1 c2A#3 ] zp ZP_BYTE:7 [ c2B#1 c2B#3 ] +Uplifting [print_char] best 156352 combination +Uplifting [sid_rnd_init] best 156352 combination Attempting to uplift remaining variables inzp ZP_BYTE:58 [ makecharset::$4 ] -Uplifting [makecharset] best 156752 combination zp ZP_BYTE:58 [ makecharset::$4 ] +Uplifting [makecharset] best 156352 combination zp ZP_BYTE:58 [ makecharset::$4 ] Attempting to uplift remaining variables inzp ZP_BYTE:10 [ doplasma::yprev#2 doplasma::yprev#3 ] -Uplifting [doplasma] best 156252 combination reg byte x [ doplasma::yprev#2 doplasma::yprev#3 ] +Uplifting [doplasma] best 155852 combination reg byte x [ doplasma::yprev#2 doplasma::yprev#3 ] Attempting to uplift remaining variables inzp ZP_BYTE:14 [ doplasma::i1#2 doplasma::i1#1 ] -Uplifting [doplasma] best 156252 combination zp ZP_BYTE:14 [ doplasma::i1#2 doplasma::i1#1 ] +Uplifting [doplasma] best 155852 combination zp ZP_BYTE:14 [ doplasma::i1#2 doplasma::i1#1 ] Attempting to uplift remaining variables inzp ZP_BYTE:15 [ doplasma::i2#2 doplasma::i2#1 ] -Uplifting [doplasma] best 147552 combination reg byte x [ doplasma::i2#2 doplasma::i2#1 ] +Uplifting [doplasma] best 147152 combination reg byte x [ doplasma::i2#2 doplasma::i2#1 ] Attempting to uplift remaining variables inzp ZP_BYTE:26 [ doplasma::$1 ] -Uplifting [doplasma] best 146952 combination reg byte a [ doplasma::$1 ] +Uplifting [doplasma] best 146552 combination reg byte a [ doplasma::$1 ] Attempting to uplift remaining variables inzp ZP_BYTE:27 [ doplasma::$3 ] -Uplifting [doplasma] best 146352 combination reg byte a [ doplasma::$3 ] +Uplifting [doplasma] best 145952 combination reg byte a [ doplasma::$3 ] Attempting to uplift remaining variables inzp ZP_BYTE:28 [ doplasma::val#0 ] -Uplifting [doplasma] best 145752 combination reg byte a [ doplasma::val#0 ] +Uplifting [doplasma] best 145352 combination reg byte a [ doplasma::val#0 ] Attempting to uplift remaining variables inzp ZP_BYTE:53 [ doplasma::val#50 ] -Uplifting [doplasma] best 145152 combination reg byte a [ doplasma::val#50 ] +Uplifting [doplasma] best 144752 combination reg byte a [ doplasma::val#50 ] Attempting to uplift remaining variables inzp ZP_BYTE:20 [ makecharset::i#7 makecharset::i#1 ] -Uplifting [makecharset] best 145152 combination zp ZP_BYTE:20 [ makecharset::i#7 makecharset::i#1 ] +Uplifting [makecharset] best 144752 combination zp ZP_BYTE:20 [ makecharset::i#7 makecharset::i#1 ] Attempting to uplift remaining variables inzp ZP_BYTE:12 [ doplasma::c2a#2 doplasma::c2a#0 doplasma::c2a#1 ] -Uplifting [doplasma] best 145152 combination zp ZP_BYTE:12 [ doplasma::c2a#2 doplasma::c2a#0 doplasma::c2a#1 ] +Uplifting [doplasma] best 144752 combination zp ZP_BYTE:12 [ doplasma::c2a#2 doplasma::c2a#0 doplasma::c2a#1 ] Attempting to uplift remaining variables inzp ZP_BYTE:11 [ doplasma::i#2 doplasma::i#1 ] -Uplifting [doplasma] best 145152 combination zp ZP_BYTE:11 [ doplasma::i#2 doplasma::i#1 ] +Uplifting [doplasma] best 144752 combination zp ZP_BYTE:11 [ doplasma::i#2 doplasma::i#1 ] Attempting to uplift remaining variables inzp ZP_BYTE:29 [ doplasma::val#1 ] -Uplifting [doplasma] best 144252 combination reg byte a [ doplasma::val#1 ] +Uplifting [doplasma] best 143852 combination reg byte a [ doplasma::val#1 ] Attempting to uplift remaining variables inzp ZP_BYTE:30 [ doplasma::val#4 ] -Uplifting [doplasma] best 143352 combination reg byte a [ doplasma::val#4 ] +Uplifting [doplasma] best 142952 combination reg byte a [ doplasma::val#4 ] Attempting to uplift remaining variables inzp ZP_BYTE:31 [ doplasma::val#6 ] -Uplifting [doplasma] best 142452 combination reg byte a [ doplasma::val#6 ] +Uplifting [doplasma] best 142052 combination reg byte a [ doplasma::val#6 ] Attempting to uplift remaining variables inzp ZP_BYTE:32 [ doplasma::val#8 ] -Uplifting [doplasma] best 141552 combination reg byte a [ doplasma::val#8 ] +Uplifting [doplasma] best 141152 combination reg byte a [ doplasma::val#8 ] Attempting to uplift remaining variables inzp ZP_BYTE:33 [ doplasma::val#10 ] -Uplifting [doplasma] best 140652 combination reg byte a [ doplasma::val#10 ] +Uplifting [doplasma] best 140252 combination reg byte a [ doplasma::val#10 ] Attempting to uplift remaining variables inzp ZP_BYTE:34 [ doplasma::val#12 ] -Uplifting [doplasma] best 139752 combination reg byte a [ doplasma::val#12 ] +Uplifting [doplasma] best 139352 combination reg byte a [ doplasma::val#12 ] Attempting to uplift remaining variables inzp ZP_BYTE:35 [ doplasma::val#14 ] -Uplifting [doplasma] best 138852 combination reg byte a [ doplasma::val#14 ] +Uplifting [doplasma] best 138452 combination reg byte a [ doplasma::val#14 ] Attempting to uplift remaining variables inzp ZP_BYTE:36 [ doplasma::val#16 ] -Uplifting [doplasma] best 137952 combination reg byte a [ doplasma::val#16 ] +Uplifting [doplasma] best 137552 combination reg byte a [ doplasma::val#16 ] Attempting to uplift remaining variables inzp ZP_BYTE:37 [ doplasma::val#18 ] -Uplifting [doplasma] best 137052 combination reg byte a [ doplasma::val#18 ] +Uplifting [doplasma] best 136652 combination reg byte a [ doplasma::val#18 ] Attempting to uplift remaining variables inzp ZP_BYTE:38 [ doplasma::val#20 ] -Uplifting [doplasma] best 136152 combination reg byte a [ doplasma::val#20 ] +Uplifting [doplasma] best 135752 combination reg byte a [ doplasma::val#20 ] Attempting to uplift remaining variables inzp ZP_BYTE:39 [ doplasma::val#22 ] -Uplifting [doplasma] best 135252 combination reg byte a [ doplasma::val#22 ] +Uplifting [doplasma] best 134852 combination reg byte a [ doplasma::val#22 ] Attempting to uplift remaining variables inzp ZP_BYTE:40 [ doplasma::val#24 ] -Uplifting [doplasma] best 134352 combination reg byte a [ doplasma::val#24 ] +Uplifting [doplasma] best 133952 combination reg byte a [ doplasma::val#24 ] Attempting to uplift remaining variables inzp ZP_BYTE:41 [ doplasma::val#26 ] -Uplifting [doplasma] best 133452 combination reg byte a [ doplasma::val#26 ] +Uplifting [doplasma] best 133052 combination reg byte a [ doplasma::val#26 ] Attempting to uplift remaining variables inzp ZP_BYTE:42 [ doplasma::val#28 ] -Uplifting [doplasma] best 132552 combination reg byte a [ doplasma::val#28 ] +Uplifting [doplasma] best 132152 combination reg byte a [ doplasma::val#28 ] Attempting to uplift remaining variables inzp ZP_BYTE:43 [ doplasma::val#30 ] -Uplifting [doplasma] best 131652 combination reg byte a [ doplasma::val#30 ] +Uplifting [doplasma] best 131252 combination reg byte a [ doplasma::val#30 ] Attempting to uplift remaining variables inzp ZP_BYTE:44 [ doplasma::val#32 ] -Uplifting [doplasma] best 130752 combination reg byte a [ doplasma::val#32 ] +Uplifting [doplasma] best 130352 combination reg byte a [ doplasma::val#32 ] Attempting to uplift remaining variables inzp ZP_BYTE:45 [ doplasma::val#34 ] -Uplifting [doplasma] best 129852 combination reg byte a [ doplasma::val#34 ] +Uplifting [doplasma] best 129452 combination reg byte a [ doplasma::val#34 ] Attempting to uplift remaining variables inzp ZP_BYTE:46 [ doplasma::val#36 ] -Uplifting [doplasma] best 128952 combination reg byte a [ doplasma::val#36 ] +Uplifting [doplasma] best 128552 combination reg byte a [ doplasma::val#36 ] Attempting to uplift remaining variables inzp ZP_BYTE:47 [ doplasma::val#38 ] -Uplifting [doplasma] best 128052 combination reg byte a [ doplasma::val#38 ] +Uplifting [doplasma] best 127652 combination reg byte a [ doplasma::val#38 ] Attempting to uplift remaining variables inzp ZP_BYTE:48 [ doplasma::val#40 ] -Uplifting [doplasma] best 127152 combination reg byte a [ doplasma::val#40 ] +Uplifting [doplasma] best 126752 combination reg byte a [ doplasma::val#40 ] Attempting to uplift remaining variables inzp ZP_BYTE:49 [ doplasma::val#42 ] -Uplifting [doplasma] best 126252 combination reg byte a [ doplasma::val#42 ] +Uplifting [doplasma] best 125852 combination reg byte a [ doplasma::val#42 ] Attempting to uplift remaining variables inzp ZP_BYTE:50 [ doplasma::val#44 ] -Uplifting [doplasma] best 125352 combination reg byte a [ doplasma::val#44 ] +Uplifting [doplasma] best 124952 combination reg byte a [ doplasma::val#44 ] Attempting to uplift remaining variables inzp ZP_BYTE:51 [ doplasma::val#46 ] -Uplifting [doplasma] best 124452 combination reg byte a [ doplasma::val#46 ] +Uplifting [doplasma] best 124052 combination reg byte a [ doplasma::val#46 ] Attempting to uplift remaining variables inzp ZP_BYTE:52 [ doplasma::val#48 ] -Uplifting [doplasma] best 123552 combination reg byte a [ doplasma::val#48 ] +Uplifting [doplasma] best 123152 combination reg byte a [ doplasma::val#48 ] Attempting to uplift remaining variables inzp ZP_BYTE:13 [ doplasma::c2b#2 doplasma::c2b#0 doplasma::c2b#1 ] -Uplifting [doplasma] best 123552 combination zp ZP_BYTE:13 [ doplasma::c2b#2 doplasma::c2b#0 doplasma::c2b#1 ] +Uplifting [doplasma] best 123152 combination zp ZP_BYTE:13 [ doplasma::c2b#2 doplasma::c2b#0 doplasma::c2b#1 ] Attempting to uplift remaining variables inzp ZP_BYTE:8 [ doplasma::c1a#2 doplasma::c1a#0 doplasma::c1a#1 ] -Uplifting [doplasma] best 123552 combination zp ZP_BYTE:8 [ doplasma::c1a#2 doplasma::c1a#0 doplasma::c1a#1 ] +Uplifting [doplasma] best 123152 combination zp ZP_BYTE:8 [ doplasma::c1a#2 doplasma::c1a#0 doplasma::c1a#1 ] Attempting to uplift remaining variables inzp ZP_BYTE:9 [ doplasma::c1b#2 doplasma::c1b#0 doplasma::c1b#1 ] -Uplifting [doplasma] best 123552 combination zp ZP_BYTE:9 [ doplasma::c1b#2 doplasma::c1b#0 doplasma::c1b#1 ] +Uplifting [doplasma] best 123152 combination zp ZP_BYTE:9 [ doplasma::c1b#2 doplasma::c1b#0 doplasma::c1b#1 ] Attempting to uplift remaining variables inzp ZP_BYTE:55 [ makecharset::s#0 ] -Uplifting [makecharset] best 123552 combination zp ZP_BYTE:55 [ makecharset::s#0 ] +Uplifting [makecharset] best 123152 combination zp ZP_BYTE:55 [ makecharset::s#0 ] Attempting to uplift remaining variables inzp ZP_BYTE:25 [ doplasma::yval#0 ] -Uplifting [doplasma] best 123552 combination zp ZP_BYTE:25 [ doplasma::yval#0 ] +Uplifting [doplasma] best 123152 combination zp ZP_BYTE:25 [ doplasma::yval#0 ] Attempting to uplift remaining variables inzp ZP_BYTE:54 [ makecharset::$2 ] -Uplifting [makecharset] best 123512 combination reg byte a [ makecharset::$2 ] -Attempting to uplift remaining variables inzp ZP_BYTE:63 [ makecharset::$11 ] -Uplifting [makecharset] best 123452 combination reg byte a [ makecharset::$11 ] +Uplifting [makecharset] best 123112 combination reg byte a [ makecharset::$2 ] +Attempting to uplift remaining variables inzp ZP_BYTE:65 [ makecharset::$11 ] +Uplifting [makecharset] best 123052 combination reg byte a [ makecharset::$11 ] Attempting to uplift remaining variables inzp ZP_BYTE:4 [ c1A#1 c1A#3 ] -Uplifting [] best 123452 combination zp ZP_BYTE:4 [ c1A#1 c1A#3 ] +Uplifting [] best 123052 combination zp ZP_BYTE:4 [ c1A#1 c1A#3 ] Attempting to uplift remaining variables inzp ZP_BYTE:5 [ c1B#1 c1B#3 ] -Uplifting [] best 123452 combination zp ZP_BYTE:5 [ c1B#1 c1B#3 ] +Uplifting [] best 123052 combination zp ZP_BYTE:5 [ c1B#1 c1B#3 ] Attempting to uplift remaining variables inzp ZP_BYTE:6 [ c2A#1 c2A#3 ] -Uplifting [] best 123452 combination zp ZP_BYTE:6 [ c2A#1 c2A#3 ] +Uplifting [] best 123052 combination zp ZP_BYTE:6 [ c2A#1 c2A#3 ] Attempting to uplift remaining variables inzp ZP_BYTE:7 [ c2B#1 c2B#3 ] -Uplifting [] best 123452 combination zp ZP_BYTE:7 [ c2B#1 c2B#3 ] +Uplifting [] best 123052 combination zp ZP_BYTE:7 [ c2B#1 c2B#3 ] Coalescing zero page register with common assignment [ zp ZP_WORD:59 [ makecharset::$8 ] ] with [ zp ZP_WORD:61 [ makecharset::$9 ] ] - score: 1 +Coalescing zero page register with common assignment [ zp ZP_WORD:59 [ makecharset::$8 makecharset::$9 ] ] with [ zp ZP_WORD:63 [ makecharset::$16 ] ] - score: 1 Coalescing zero page register [ zp ZP_WORD:2 [ main::col#2 main::col#1 ] ] with [ zp ZP_WORD:16 [ makecharset::c#2 makecharset::c#1 ] ] Coalescing zero page register [ zp ZP_WORD:2 [ main::col#2 main::col#1 makecharset::c#2 makecharset::c#1 ] ] with [ zp ZP_WORD:23 [ print_cls::sc#2 print_cls::sc#1 ] ] Coalescing zero page register [ zp ZP_BYTE:4 [ c1A#1 c1A#3 ] ] with [ zp ZP_BYTE:20 [ makecharset::i#7 makecharset::i#1 ] ] @@ -3891,7 +3903,7 @@ Coalescing zero page register [ zp ZP_BYTE:11 [ doplasma::i#2 doplasma::i#1 ] ] Allocated (was zp ZP_BYTE:11) zp ZP_BYTE:10 [ doplasma::i#2 doplasma::i#1 doplasma::i1#2 doplasma::i1#1 ] Allocated (was zp ZP_WORD:18) zp ZP_WORD:11 [ print_char_cursor#44 print_char_cursor#18 print_char_cursor#1 ] Allocated (was zp ZP_BYTE:25) zp ZP_BYTE:13 [ doplasma::yval#0 ] -Allocated (was zp ZP_WORD:59) zp ZP_WORD:14 [ makecharset::$8 makecharset::$9 ] +Allocated (was zp ZP_WORD:59) zp ZP_WORD:14 [ makecharset::$8 makecharset::$9 makecharset::$16 ] ASSEMBLER BEFORE OPTIMIZATION //SEG0 File Comments @@ -4419,6 +4431,7 @@ makecharset: { .label s = 5 .label i = 4 .label c = 2 + .label _16 = $e //SEG178 [99] call sid_rnd_init jsr sid_rnd_init //SEG179 [100] phi from makecharset to makecharset::@10 [phi:makecharset->makecharset::@10] @@ -4427,7 +4440,7 @@ makecharset: { //SEG180 makecharset::@10 b10: //SEG181 [101] call print_cls - //SEG182 [134] phi from makecharset::@10 to print_cls [phi:makecharset::@10->print_cls] + //SEG182 [135] phi from makecharset::@10 to print_cls [phi:makecharset::@10->print_cls] print_cls_from_b10: jsr print_cls //SEG183 [102] phi from makecharset::@10 to makecharset::@1 [phi:makecharset::@10->makecharset::@1] @@ -4537,55 +4550,53 @@ makecharset: { bcc !+ inc _9+1 !: - //SEG220 [118] *((const byte*) CHARSET#0 + (word~) makecharset::$9) ← (byte) makecharset::b#3 -- pbuc1_derefidx_vwuz1=vbuyy - tya - sta !v++1 - lda #CHARSET - adc _9+1 - sta !a++2 - !v: - lda #0 - !a: - sta CHARSET - //SEG221 [119] (byte) makecharset::i#1 ← ++ (byte) makecharset::i#7 -- vbuz1=_inc_vbuz1 + lda _16 + adc #CHARSET + sta _16+1 + //SEG221 [119] *((byte*) makecharset::$16) ← (byte) makecharset::b#3 -- _deref_pbuz1=vbuyy + tya + ldy #0 + sta (_16),y + //SEG222 [120] (byte) makecharset::i#1 ← ++ (byte) makecharset::i#7 -- vbuz1=_inc_vbuz1 inc i - //SEG222 [120] if((byte) makecharset::i#1<(byte/signed byte/word/signed word/dword/signed dword) 8) goto makecharset::@2 -- vbuz1_lt_vbuc1_then_la1 + //SEG223 [121] if((byte) makecharset::i#1<(byte/signed byte/word/signed word/dword/signed dword) 8) goto makecharset::@2 -- vbuz1_lt_vbuc1_then_la1 lda i cmp #8 bcc b2_from_b6 jmp b7 - //SEG223 makecharset::@7 + //SEG224 makecharset::@7 b7: - //SEG224 [121] (byte/word~) makecharset::$11 ← (word) makecharset::c#2 & (byte/signed byte/word/signed word/dword/signed dword) 7 -- vbuaa=vwuz1_band_vbuc1 + //SEG225 [122] (byte/word~) makecharset::$11 ← (word) makecharset::c#2 & (byte/signed byte/word/signed word/dword/signed dword) 7 -- vbuaa=vwuz1_band_vbuc1 lda c and #7 - //SEG225 [122] if((byte/word~) makecharset::$11!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto makecharset::@9 -- vbuaa_neq_0_then_la1 + //SEG226 [123] if((byte/word~) makecharset::$11!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto makecharset::@9 -- vbuaa_neq_0_then_la1 cmp #0 bne b9_from_b7 - //SEG226 [123] phi from makecharset::@7 to makecharset::@8 [phi:makecharset::@7->makecharset::@8] + //SEG227 [124] phi from makecharset::@7 to makecharset::@8 [phi:makecharset::@7->makecharset::@8] b8_from_b7: jmp b8 - //SEG227 makecharset::@8 + //SEG228 makecharset::@8 b8: - //SEG228 [124] call print_char + //SEG229 [125] call print_char jsr print_char - //SEG229 [125] phi from makecharset::@7 makecharset::@8 to makecharset::@9 [phi:makecharset::@7/makecharset::@8->makecharset::@9] + //SEG230 [126] phi from makecharset::@7 makecharset::@8 to makecharset::@9 [phi:makecharset::@7/makecharset::@8->makecharset::@9] b9_from_b7: b9_from_b8: - //SEG230 [125] phi (byte*) print_char_cursor#18 = (byte*) print_char_cursor#44 [phi:makecharset::@7/makecharset::@8->makecharset::@9#0] -- register_copy + //SEG231 [126] phi (byte*) print_char_cursor#18 = (byte*) print_char_cursor#44 [phi:makecharset::@7/makecharset::@8->makecharset::@9#0] -- register_copy jmp b9 - //SEG231 makecharset::@9 + //SEG232 makecharset::@9 b9: - //SEG232 [126] (word) makecharset::c#1 ← ++ (word) makecharset::c#2 -- vwuz1=_inc_vwuz1 + //SEG233 [127] (word) makecharset::c#1 ← ++ (word) makecharset::c#2 -- vwuz1=_inc_vwuz1 inc c bne !+ inc c+1 !: - //SEG233 [127] if((word) makecharset::c#1<(word/signed word/dword/signed dword) $100) goto makecharset::@1 -- vwuz1_lt_vwuc1_then_la1 + //SEG234 [128] if((word) makecharset::c#1<(word/signed word/dword/signed dword) $100) goto makecharset::@1 -- vwuz1_lt_vwuc1_then_la1 lda c+1 cmp #>$100 bcc b1_from_b9 @@ -4595,71 +4606,71 @@ makecharset: { bcc b1_from_b9 !: jmp breturn - //SEG234 makecharset::@return + //SEG235 makecharset::@return breturn: - //SEG235 [128] return + //SEG236 [129] return rts bittab: .byte 1, 2, 4, 8, $10, $20, $40, $80 } -//SEG236 print_char +//SEG237 print_char // Print a single char print_char: { .const ch = '.' - //SEG237 [129] *((byte*) print_char_cursor#44) ← (const byte) print_char::ch#0 -- _deref_pbuz1=vbuc1 + //SEG238 [130] *((byte*) print_char_cursor#44) ← (const byte) print_char::ch#0 -- _deref_pbuz1=vbuc1 lda #ch ldy #0 sta (print_char_cursor),y - //SEG238 [130] (byte*) print_char_cursor#1 ← ++ (byte*) print_char_cursor#44 -- pbuz1=_inc_pbuz1 + //SEG239 [131] (byte*) print_char_cursor#1 ← ++ (byte*) print_char_cursor#44 -- pbuz1=_inc_pbuz1 inc print_char_cursor bne !+ inc print_char_cursor+1 !: jmp breturn - //SEG239 print_char::@return + //SEG240 print_char::@return breturn: - //SEG240 [131] return + //SEG241 [132] return rts } -//SEG241 sid_rnd +//SEG242 sid_rnd // Get a random number from the SID voice 3, // Must be initialized with sid_rnd_init() sid_rnd: { - //SEG242 [132] (byte) sid_rnd::return#0 ← *((const byte*) SID_VOICE3_OSC#0) -- vbuaa=_deref_pbuc1 + //SEG243 [133] (byte) sid_rnd::return#0 ← *((const byte*) SID_VOICE3_OSC#0) -- vbuaa=_deref_pbuc1 lda SID_VOICE3_OSC jmp breturn - //SEG243 sid_rnd::@return + //SEG244 sid_rnd::@return breturn: - //SEG244 [133] return + //SEG245 [134] return rts } -//SEG245 print_cls +//SEG246 print_cls // Clear the screen. Also resets current line/char cursor. print_cls: { .label sc = 2 - //SEG246 [135] phi from print_cls to print_cls::@1 [phi:print_cls->print_cls::@1] + //SEG247 [136] phi from print_cls to print_cls::@1 [phi:print_cls->print_cls::@1] b1_from_print_cls: - //SEG247 [135] phi (byte*) print_cls::sc#2 = (const byte*) print_line_cursor#0 [phi:print_cls->print_cls::@1#0] -- pbuz1=pbuc1 + //SEG248 [136] phi (byte*) print_cls::sc#2 = (const byte*) print_line_cursor#0 [phi:print_cls->print_cls::@1#0] -- pbuz1=pbuc1 lda #print_line_cursor sta sc+1 jmp b1 - //SEG248 [135] phi from print_cls::@1 to print_cls::@1 [phi:print_cls::@1->print_cls::@1] + //SEG249 [136] phi from print_cls::@1 to print_cls::@1 [phi:print_cls::@1->print_cls::@1] b1_from_b1: - //SEG249 [135] phi (byte*) print_cls::sc#2 = (byte*) print_cls::sc#1 [phi:print_cls::@1->print_cls::@1#0] -- register_copy + //SEG250 [136] phi (byte*) print_cls::sc#2 = (byte*) print_cls::sc#1 [phi:print_cls::@1->print_cls::@1#0] -- register_copy jmp b1 - //SEG250 print_cls::@1 + //SEG251 print_cls::@1 b1: - //SEG251 [136] *((byte*) print_cls::sc#2) ← (byte) ' ' -- _deref_pbuz1=vbuc1 + //SEG252 [137] *((byte*) print_cls::sc#2) ← (byte) ' ' -- _deref_pbuz1=vbuc1 lda #' ' ldy #0 sta (sc),y - //SEG252 [137] (byte*) print_cls::sc#1 ← ++ (byte*) print_cls::sc#2 -- pbuz1=_inc_pbuz1 + //SEG253 [138] (byte*) print_cls::sc#1 ← ++ (byte*) print_cls::sc#2 -- pbuz1=_inc_pbuz1 inc sc bne !+ inc sc+1 !: - //SEG253 [138] if((byte*) print_cls::sc#1!=(const byte*) print_line_cursor#0+(word/signed word/dword/signed dword) $3e8) goto print_cls::@1 -- pbuz1_neq_pbuc1_then_la1 + //SEG254 [139] if((byte*) print_cls::sc#1!=(const byte*) print_line_cursor#0+(word/signed word/dword/signed dword) $3e8) goto print_cls::@1 -- pbuz1_neq_pbuc1_then_la1 lda sc+1 cmp #>print_line_cursor+$3e8 bne b1_from_b1 @@ -4667,26 +4678,26 @@ print_cls: { cmp #$ffff sta SID_VOICE3_FREQ+1 - //SEG258 [141] *((const byte*) SID_VOICE3_CONTROL#0) ← (const byte) SID_CONTROL_NOISE#0 -- _deref_pbuc1=vbuc2 + //SEG259 [142] *((const byte*) SID_VOICE3_CONTROL#0) ← (const byte) SID_CONTROL_NOISE#0 -- _deref_pbuc1=vbuc2 lda #SID_CONTROL_NOISE sta SID_VOICE3_CONTROL jmp breturn - //SEG259 sid_rnd_init::@return + //SEG260 sid_rnd_init::@return breturn: - //SEG260 [142] return + //SEG261 [143] return rts } .pc = SINTABLE "SINTABLE" @@ -4868,7 +4879,6 @@ Succesful ASM optimization Pass5NextJumpElimination Removing instruction bbegin: Succesful ASM optimization Pass5UnusedLabelElimination Fixing long branch [229] bcc b5 to bcs -Fixing long branch [330] bcc b1 to bcs Fixing long branch [108] bcc b8 to bcs FINAL SYMBOL TABLE @@ -5038,6 +5048,7 @@ FINAL SYMBOL TABLE (byte*) main::toD0181_screen (void()) makecharset((byte*) makecharset::charset) (byte/word~) makecharset::$11 reg byte a 22.0 +(byte*) makecharset::$16 $16 zp ZP_WORD:14 202.0 (byte~) makecharset::$2 reg byte a 22.0 (byte~) makecharset::$3 reg byte a 2002.0 (byte~) makecharset::$4 $4 zp ZP_BYTE:6 2002.0 @@ -5058,21 +5069,21 @@ FINAL SYMBOL TABLE (byte) makecharset::b (byte) makecharset::b#1 reg byte y 2002.0 (byte) makecharset::b#2 reg byte y 500.5 -(byte) makecharset::b#3 reg byte y 620.8 +(byte) makecharset::b#3 reg byte y 517.3333333333334 (byte[8]) makecharset::bittab (const byte[8]) makecharset::bittab#0 bittab = { (byte/signed byte/word/signed word/dword/signed dword) 1, (byte/signed byte/word/signed word/dword/signed dword) 2, (byte/signed byte/word/signed word/dword/signed dword) 4, (byte/signed byte/word/signed word/dword/signed dword) 8, (byte/signed byte/word/signed word/dword/signed dword) $10, (byte/signed byte/word/signed word/dword/signed dword) $20, (byte/signed byte/word/signed word/dword/signed dword) $40, (byte/word/signed word/dword/signed dword) $80 } (word) makecharset::c (word) makecharset::c#1 c zp ZP_WORD:2 16.5 -(word) makecharset::c#2 c zp ZP_WORD:2 6.041666666666666 +(word) makecharset::c#2 c zp ZP_WORD:2 5.800000000000001 (byte*) makecharset::charset (byte) makecharset::i (byte) makecharset::i#1 i zp ZP_BYTE:4 151.5 -(byte) makecharset::i#7 i zp ZP_BYTE:4 21.642857142857142 +(byte) makecharset::i#7 i zp ZP_BYTE:4 20.2 (byte) makecharset::ii (byte) makecharset::ii#1 reg byte x 1501.5 (byte) makecharset::ii#2 reg byte x 375.375 (byte) makecharset::s -(byte) makecharset::s#0 s zp ZP_BYTE:5 59.529411764705884 +(byte) makecharset::s#0 s zp ZP_BYTE:5 56.22222222222223 (void()) print_char((byte) print_char::ch) (label) print_char::@return (byte) print_char::ch @@ -5080,7 +5091,7 @@ FINAL SYMBOL TABLE (byte*) print_char_cursor (byte*) print_char_cursor#1 print_char_cursor zp ZP_WORD:11 4.333333333333333 (byte*) print_char_cursor#18 print_char_cursor zp ZP_WORD:11 11.0 -(byte*) print_char_cursor#44 print_char_cursor zp ZP_WORD:11 1.1304347826086956 +(byte*) print_char_cursor#44 print_char_cursor zp ZP_WORD:11 1.0833333333333333 (void()) print_cls() (label) print_cls::@1 (label) print_cls::@return @@ -5143,13 +5154,13 @@ reg byte a [ doplasma::val#50 ] reg byte a [ makecharset::$2 ] reg byte a [ sid_rnd::return#2 ] reg byte a [ makecharset::$3 ] -zp ZP_WORD:14 [ makecharset::$8 makecharset::$9 ] +zp ZP_WORD:14 [ makecharset::$8 makecharset::$9 makecharset::$16 ] reg byte a [ makecharset::$11 ] reg byte a [ sid_rnd::return#0 ] FINAL ASSEMBLER -Score: 94400 +Score: 93970 //SEG0 File Comments // A KickC version of the plasma routine from the CC65 samples @@ -5578,12 +5589,13 @@ makecharset: { .label s = 5 .label i = 4 .label c = 2 + .label _16 = $e //SEG178 [99] call sid_rnd_init jsr sid_rnd_init //SEG179 [100] phi from makecharset to makecharset::@10 [phi:makecharset->makecharset::@10] //SEG180 makecharset::@10 //SEG181 [101] call print_cls - //SEG182 [134] phi from makecharset::@10 to print_cls [phi:makecharset::@10->print_cls] + //SEG182 [135] phi from makecharset::@10 to print_cls [phi:makecharset::@10->print_cls] jsr print_cls //SEG183 [102] phi from makecharset::@10 to makecharset::@1 [phi:makecharset::@10->makecharset::@1] //SEG184 [102] phi (byte*) print_char_cursor#44 = (const byte*) print_line_cursor#0 [phi:makecharset::@10->makecharset::@1#0] -- pbuz1=pbuc1 @@ -5670,136 +5682,132 @@ makecharset: { bcc !+ inc _9+1 !: - //SEG220 [118] *((const byte*) CHARSET#0 + (word~) makecharset::$9) ← (byte) makecharset::b#3 -- pbuc1_derefidx_vwuz1=vbuyy - tya - sta !v++1 - lda #CHARSET - adc _9+1 - sta !a++2 - !v: - lda #0 - !a: - sta CHARSET - //SEG221 [119] (byte) makecharset::i#1 ← ++ (byte) makecharset::i#7 -- vbuz1=_inc_vbuz1 + lda _16 + adc #CHARSET + sta _16+1 + //SEG221 [119] *((byte*) makecharset::$16) ← (byte) makecharset::b#3 -- _deref_pbuz1=vbuyy + tya + ldy #0 + sta (_16),y + //SEG222 [120] (byte) makecharset::i#1 ← ++ (byte) makecharset::i#7 -- vbuz1=_inc_vbuz1 inc i - //SEG222 [120] if((byte) makecharset::i#1<(byte/signed byte/word/signed word/dword/signed dword) 8) goto makecharset::@2 -- vbuz1_lt_vbuc1_then_la1 + //SEG223 [121] if((byte) makecharset::i#1<(byte/signed byte/word/signed word/dword/signed dword) 8) goto makecharset::@2 -- vbuz1_lt_vbuc1_then_la1 lda i cmp #8 bcc b2 - //SEG223 makecharset::@7 - //SEG224 [121] (byte/word~) makecharset::$11 ← (word) makecharset::c#2 & (byte/signed byte/word/signed word/dword/signed dword) 7 -- vbuaa=vwuz1_band_vbuc1 + //SEG224 makecharset::@7 + //SEG225 [122] (byte/word~) makecharset::$11 ← (word) makecharset::c#2 & (byte/signed byte/word/signed word/dword/signed dword) 7 -- vbuaa=vwuz1_band_vbuc1 lda c and #7 - //SEG225 [122] if((byte/word~) makecharset::$11!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto makecharset::@9 -- vbuaa_neq_0_then_la1 + //SEG226 [123] if((byte/word~) makecharset::$11!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto makecharset::@9 -- vbuaa_neq_0_then_la1 cmp #0 bne b9 - //SEG226 [123] phi from makecharset::@7 to makecharset::@8 [phi:makecharset::@7->makecharset::@8] - //SEG227 makecharset::@8 - //SEG228 [124] call print_char + //SEG227 [124] phi from makecharset::@7 to makecharset::@8 [phi:makecharset::@7->makecharset::@8] + //SEG228 makecharset::@8 + //SEG229 [125] call print_char jsr print_char - //SEG229 [125] phi from makecharset::@7 makecharset::@8 to makecharset::@9 [phi:makecharset::@7/makecharset::@8->makecharset::@9] - //SEG230 [125] phi (byte*) print_char_cursor#18 = (byte*) print_char_cursor#44 [phi:makecharset::@7/makecharset::@8->makecharset::@9#0] -- register_copy - //SEG231 makecharset::@9 + //SEG230 [126] phi from makecharset::@7 makecharset::@8 to makecharset::@9 [phi:makecharset::@7/makecharset::@8->makecharset::@9] + //SEG231 [126] phi (byte*) print_char_cursor#18 = (byte*) print_char_cursor#44 [phi:makecharset::@7/makecharset::@8->makecharset::@9#0] -- register_copy + //SEG232 makecharset::@9 b9: - //SEG232 [126] (word) makecharset::c#1 ← ++ (word) makecharset::c#2 -- vwuz1=_inc_vwuz1 + //SEG233 [127] (word) makecharset::c#1 ← ++ (word) makecharset::c#2 -- vwuz1=_inc_vwuz1 inc c bne !+ inc c+1 !: - //SEG233 [127] if((word) makecharset::c#1<(word/signed word/dword/signed dword) $100) goto makecharset::@1 -- vwuz1_lt_vwuc1_then_la1 + //SEG234 [128] if((word) makecharset::c#1<(word/signed word/dword/signed dword) $100) goto makecharset::@1 -- vwuz1_lt_vwuc1_then_la1 lda c+1 cmp #>$100 bcc b1 bne !+ lda c cmp #<$100 - bcs !b1+ - jmp b1 - !b1: + bcc b1 !: - //SEG234 makecharset::@return - //SEG235 [128] return + //SEG235 makecharset::@return + //SEG236 [129] return rts bittab: .byte 1, 2, 4, 8, $10, $20, $40, $80 } -//SEG236 print_char +//SEG237 print_char // Print a single char print_char: { .const ch = '.' - //SEG237 [129] *((byte*) print_char_cursor#44) ← (const byte) print_char::ch#0 -- _deref_pbuz1=vbuc1 + //SEG238 [130] *((byte*) print_char_cursor#44) ← (const byte) print_char::ch#0 -- _deref_pbuz1=vbuc1 lda #ch ldy #0 sta (print_char_cursor),y - //SEG238 [130] (byte*) print_char_cursor#1 ← ++ (byte*) print_char_cursor#44 -- pbuz1=_inc_pbuz1 + //SEG239 [131] (byte*) print_char_cursor#1 ← ++ (byte*) print_char_cursor#44 -- pbuz1=_inc_pbuz1 inc print_char_cursor bne !+ inc print_char_cursor+1 !: - //SEG239 print_char::@return - //SEG240 [131] return + //SEG240 print_char::@return + //SEG241 [132] return rts } -//SEG241 sid_rnd +//SEG242 sid_rnd // Get a random number from the SID voice 3, // Must be initialized with sid_rnd_init() sid_rnd: { - //SEG242 [132] (byte) sid_rnd::return#0 ← *((const byte*) SID_VOICE3_OSC#0) -- vbuaa=_deref_pbuc1 + //SEG243 [133] (byte) sid_rnd::return#0 ← *((const byte*) SID_VOICE3_OSC#0) -- vbuaa=_deref_pbuc1 lda SID_VOICE3_OSC - //SEG243 sid_rnd::@return - //SEG244 [133] return + //SEG244 sid_rnd::@return + //SEG245 [134] return rts } -//SEG245 print_cls +//SEG246 print_cls // Clear the screen. Also resets current line/char cursor. print_cls: { .label sc = 2 - //SEG246 [135] phi from print_cls to print_cls::@1 [phi:print_cls->print_cls::@1] - //SEG247 [135] phi (byte*) print_cls::sc#2 = (const byte*) print_line_cursor#0 [phi:print_cls->print_cls::@1#0] -- pbuz1=pbuc1 + //SEG247 [136] phi from print_cls to print_cls::@1 [phi:print_cls->print_cls::@1] + //SEG248 [136] phi (byte*) print_cls::sc#2 = (const byte*) print_line_cursor#0 [phi:print_cls->print_cls::@1#0] -- pbuz1=pbuc1 lda #print_line_cursor sta sc+1 - //SEG248 [135] phi from print_cls::@1 to print_cls::@1 [phi:print_cls::@1->print_cls::@1] - //SEG249 [135] phi (byte*) print_cls::sc#2 = (byte*) print_cls::sc#1 [phi:print_cls::@1->print_cls::@1#0] -- register_copy - //SEG250 print_cls::@1 + //SEG249 [136] phi from print_cls::@1 to print_cls::@1 [phi:print_cls::@1->print_cls::@1] + //SEG250 [136] phi (byte*) print_cls::sc#2 = (byte*) print_cls::sc#1 [phi:print_cls::@1->print_cls::@1#0] -- register_copy + //SEG251 print_cls::@1 b1: - //SEG251 [136] *((byte*) print_cls::sc#2) ← (byte) ' ' -- _deref_pbuz1=vbuc1 + //SEG252 [137] *((byte*) print_cls::sc#2) ← (byte) ' ' -- _deref_pbuz1=vbuc1 lda #' ' ldy #0 sta (sc),y - //SEG252 [137] (byte*) print_cls::sc#1 ← ++ (byte*) print_cls::sc#2 -- pbuz1=_inc_pbuz1 + //SEG253 [138] (byte*) print_cls::sc#1 ← ++ (byte*) print_cls::sc#2 -- pbuz1=_inc_pbuz1 inc sc bne !+ inc sc+1 !: - //SEG253 [138] if((byte*) print_cls::sc#1!=(const byte*) print_line_cursor#0+(word/signed word/dword/signed dword) $3e8) goto print_cls::@1 -- pbuz1_neq_pbuc1_then_la1 + //SEG254 [139] if((byte*) print_cls::sc#1!=(const byte*) print_line_cursor#0+(word/signed word/dword/signed dword) $3e8) goto print_cls::@1 -- pbuz1_neq_pbuc1_then_la1 lda sc+1 cmp #>print_line_cursor+$3e8 bne b1 lda sc cmp #$ffff sta SID_VOICE3_FREQ+1 - //SEG258 [141] *((const byte*) SID_VOICE3_CONTROL#0) ← (const byte) SID_CONTROL_NOISE#0 -- _deref_pbuc1=vbuc2 + //SEG259 [142] *((const byte*) SID_VOICE3_CONTROL#0) ← (const byte) SID_CONTROL_NOISE#0 -- _deref_pbuc1=vbuc2 lda #SID_CONTROL_NOISE sta SID_VOICE3_CONTROL - //SEG259 sid_rnd_init::@return - //SEG260 [142] return + //SEG260 sid_rnd_init::@return + //SEG261 [143] return rts } .pc = SINTABLE "SINTABLE" diff --git a/src/test/ref/examples/plasma/plasma-unroll.sym b/src/test/ref/examples/plasma/plasma-unroll.sym index 0e66cf9e9..de9a18ca4 100644 --- a/src/test/ref/examples/plasma/plasma-unroll.sym +++ b/src/test/ref/examples/plasma/plasma-unroll.sym @@ -164,6 +164,7 @@ (byte*) main::toD0181_screen (void()) makecharset((byte*) makecharset::charset) (byte/word~) makecharset::$11 reg byte a 22.0 +(byte*) makecharset::$16 $16 zp ZP_WORD:14 202.0 (byte~) makecharset::$2 reg byte a 22.0 (byte~) makecharset::$3 reg byte a 2002.0 (byte~) makecharset::$4 $4 zp ZP_BYTE:6 2002.0 @@ -184,21 +185,21 @@ (byte) makecharset::b (byte) makecharset::b#1 reg byte y 2002.0 (byte) makecharset::b#2 reg byte y 500.5 -(byte) makecharset::b#3 reg byte y 620.8 +(byte) makecharset::b#3 reg byte y 517.3333333333334 (byte[8]) makecharset::bittab (const byte[8]) makecharset::bittab#0 bittab = { (byte/signed byte/word/signed word/dword/signed dword) 1, (byte/signed byte/word/signed word/dword/signed dword) 2, (byte/signed byte/word/signed word/dword/signed dword) 4, (byte/signed byte/word/signed word/dword/signed dword) 8, (byte/signed byte/word/signed word/dword/signed dword) $10, (byte/signed byte/word/signed word/dword/signed dword) $20, (byte/signed byte/word/signed word/dword/signed dword) $40, (byte/word/signed word/dword/signed dword) $80 } (word) makecharset::c (word) makecharset::c#1 c zp ZP_WORD:2 16.5 -(word) makecharset::c#2 c zp ZP_WORD:2 6.041666666666666 +(word) makecharset::c#2 c zp ZP_WORD:2 5.800000000000001 (byte*) makecharset::charset (byte) makecharset::i (byte) makecharset::i#1 i zp ZP_BYTE:4 151.5 -(byte) makecharset::i#7 i zp ZP_BYTE:4 21.642857142857142 +(byte) makecharset::i#7 i zp ZP_BYTE:4 20.2 (byte) makecharset::ii (byte) makecharset::ii#1 reg byte x 1501.5 (byte) makecharset::ii#2 reg byte x 375.375 (byte) makecharset::s -(byte) makecharset::s#0 s zp ZP_BYTE:5 59.529411764705884 +(byte) makecharset::s#0 s zp ZP_BYTE:5 56.22222222222223 (void()) print_char((byte) print_char::ch) (label) print_char::@return (byte) print_char::ch @@ -206,7 +207,7 @@ (byte*) print_char_cursor (byte*) print_char_cursor#1 print_char_cursor zp ZP_WORD:11 4.333333333333333 (byte*) print_char_cursor#18 print_char_cursor zp ZP_WORD:11 11.0 -(byte*) print_char_cursor#44 print_char_cursor zp ZP_WORD:11 1.1304347826086956 +(byte*) print_char_cursor#44 print_char_cursor zp ZP_WORD:11 1.0833333333333333 (void()) print_cls() (label) print_cls::@1 (label) print_cls::@return @@ -269,6 +270,6 @@ reg byte a [ doplasma::val#50 ] reg byte a [ makecharset::$2 ] reg byte a [ sid_rnd::return#2 ] reg byte a [ makecharset::$3 ] -zp ZP_WORD:14 [ makecharset::$8 makecharset::$9 ] +zp ZP_WORD:14 [ makecharset::$8 makecharset::$9 makecharset::$16 ] reg byte a [ makecharset::$11 ] reg byte a [ sid_rnd::return#0 ] diff --git a/src/test/ref/examples/plasma/plasma.asm b/src/test/ref/examples/plasma/plasma.asm index caf3b038c..5bdbc6470 100644 --- a/src/test/ref/examples/plasma/plasma.asm +++ b/src/test/ref/examples/plasma/plasma.asm @@ -183,6 +183,7 @@ makecharset: { .label s = 5 .label i = 4 .label c = 2 + .label _16 = $d jsr sid_rnd_init jsr print_cls lda #CHARSET - adc _9+1 - sta !a++2 - !v: - lda #0 - !a: - sta CHARSET + lda _16 + adc #CHARSET + sta _16+1 + tya + ldy #0 + sta (_16),y inc i lda i cmp #8 @@ -266,9 +264,7 @@ makecharset: { bne !+ lda c cmp #<$100 - bcs !b1+ - jmp b1 - !b1: + bcc b1 !: rts bittab: .byte 1, 2, 4, 8, $10, $20, $40, $80 diff --git a/src/test/ref/examples/plasma/plasma.cfg b/src/test/ref/examples/plasma/plasma.cfg index 37011aaad..d7ec20d74 100644 --- a/src/test/ref/examples/plasma/plasma.cfg +++ b/src/test/ref/examples/plasma/plasma.cfg @@ -149,55 +149,56 @@ makecharset::@4: scope:[makecharset] from makecharset::@11 makecharset::@5 makecharset::@6: scope:[makecharset] from makecharset::@4 [73] (word~) makecharset::$8 ← (word) makecharset::c#2 << (byte/signed byte/word/signed word/dword/signed dword) 3 [74] (word~) makecharset::$9 ← (word~) makecharset::$8 + (byte) makecharset::i#7 - [75] *((const byte*) CHARSET#0 + (word~) makecharset::$9) ← (byte) makecharset::b#3 - [76] (byte) makecharset::i#1 ← ++ (byte) makecharset::i#7 - [77] if((byte) makecharset::i#1<(byte/signed byte/word/signed word/dword/signed dword) 8) goto makecharset::@2 + [75] (byte*) makecharset::$16 ← (const byte*) CHARSET#0 + (word~) makecharset::$9 + [76] *((byte*) makecharset::$16) ← (byte) makecharset::b#3 + [77] (byte) makecharset::i#1 ← ++ (byte) makecharset::i#7 + [78] if((byte) makecharset::i#1<(byte/signed byte/word/signed word/dword/signed dword) 8) goto makecharset::@2 to:makecharset::@7 makecharset::@7: scope:[makecharset] from makecharset::@6 - [78] (byte/word~) makecharset::$11 ← (word) makecharset::c#2 & (byte/signed byte/word/signed word/dword/signed dword) 7 - [79] if((byte/word~) makecharset::$11!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto makecharset::@9 + [79] (byte/word~) makecharset::$11 ← (word) makecharset::c#2 & (byte/signed byte/word/signed word/dword/signed dword) 7 + [80] if((byte/word~) makecharset::$11!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto makecharset::@9 to:makecharset::@8 makecharset::@8: scope:[makecharset] from makecharset::@7 - [80] phi() - [81] call print_char + [81] phi() + [82] call print_char to:makecharset::@9 makecharset::@9: scope:[makecharset] from makecharset::@7 makecharset::@8 - [82] (byte*) print_char_cursor#18 ← phi( makecharset::@8/(byte*) print_char_cursor#1 makecharset::@7/(byte*) print_char_cursor#46 ) - [83] (word) makecharset::c#1 ← ++ (word) makecharset::c#2 - [84] if((word) makecharset::c#1<(word/signed word/dword/signed dword) $100) goto makecharset::@1 + [83] (byte*) print_char_cursor#18 ← phi( makecharset::@8/(byte*) print_char_cursor#1 makecharset::@7/(byte*) print_char_cursor#46 ) + [84] (word) makecharset::c#1 ← ++ (word) makecharset::c#2 + [85] if((word) makecharset::c#1<(word/signed word/dword/signed dword) $100) goto makecharset::@1 to:makecharset::@return makecharset::@return: scope:[makecharset] from makecharset::@9 - [85] return + [86] return to:@return print_char: scope:[print_char] from makecharset::@8 - [86] *((byte*) print_char_cursor#46) ← (const byte) print_char::ch#0 - [87] (byte*) print_char_cursor#1 ← ++ (byte*) print_char_cursor#46 + [87] *((byte*) print_char_cursor#46) ← (const byte) print_char::ch#0 + [88] (byte*) print_char_cursor#1 ← ++ (byte*) print_char_cursor#46 to:print_char::@return print_char::@return: scope:[print_char] from print_char - [88] return + [89] return to:@return sid_rnd: scope:[sid_rnd] from makecharset::@3 - [89] (byte) sid_rnd::return#0 ← *((const byte*) SID_VOICE3_OSC#0) + [90] (byte) sid_rnd::return#0 ← *((const byte*) SID_VOICE3_OSC#0) to:sid_rnd::@return sid_rnd::@return: scope:[sid_rnd] from sid_rnd - [90] return + [91] return to:@return print_cls: scope:[print_cls] from makecharset::@10 - [91] phi() + [92] phi() to:print_cls::@1 print_cls::@1: scope:[print_cls] from print_cls print_cls::@1 - [92] (byte*) print_cls::sc#2 ← phi( print_cls/(const byte*) print_line_cursor#0 print_cls::@1/(byte*) print_cls::sc#1 ) - [93] *((byte*) print_cls::sc#2) ← (byte) ' ' - [94] (byte*) print_cls::sc#1 ← ++ (byte*) print_cls::sc#2 - [95] if((byte*) print_cls::sc#1!=(const byte*) print_line_cursor#0+(word/signed word/dword/signed dword) $3e8) goto print_cls::@1 + [93] (byte*) print_cls::sc#2 ← phi( print_cls/(const byte*) print_line_cursor#0 print_cls::@1/(byte*) print_cls::sc#1 ) + [94] *((byte*) print_cls::sc#2) ← (byte) ' ' + [95] (byte*) print_cls::sc#1 ← ++ (byte*) print_cls::sc#2 + [96] if((byte*) print_cls::sc#1!=(const byte*) print_line_cursor#0+(word/signed word/dword/signed dword) $3e8) goto print_cls::@1 to:print_cls::@return print_cls::@return: scope:[print_cls] from print_cls::@1 - [96] return + [97] return to:@return sid_rnd_init: scope:[sid_rnd_init] from makecharset - [97] *((const word*) SID_VOICE3_FREQ#0) ← (word/dword/signed dword) $ffff - [98] *((const byte*) SID_VOICE3_CONTROL#0) ← (const byte) SID_CONTROL_NOISE#0 + [98] *((const word*) SID_VOICE3_FREQ#0) ← (word/dword/signed dword) $ffff + [99] *((const byte*) SID_VOICE3_CONTROL#0) ← (const byte) SID_CONTROL_NOISE#0 to:sid_rnd_init::@return sid_rnd_init::@return: scope:[sid_rnd_init] from sid_rnd_init - [99] return + [100] return to:@return diff --git a/src/test/ref/examples/plasma/plasma.log b/src/test/ref/examples/plasma/plasma.log index ed893b7e2..eb85aaac3 100644 --- a/src/test/ref/examples/plasma/plasma.log +++ b/src/test/ref/examples/plasma/plasma.log @@ -1411,6 +1411,8 @@ Resolved ranged next value main::col#1 ← ++ main::col#2 to ++ Resolved ranged comparison value if(main::col#1!=rangelast(COLS#0,main::$1)) goto main::@1 to (byte*)(const byte*) main::$1+(byte/signed byte/word/signed word/dword/signed dword) 1 Rewriting multiplication to use shift (word/signed dword/dword~) makecharset::$8 ← (word) makecharset::c#12 * (byte/signed byte/word/signed word/dword/signed dword) 8 Successful SSA optimization Pass2MultiplyToShiftRewriting +De-inlining pointer[w] to *(pointer+w) *((byte*) makecharset::charset#6 + (word/signed dword/dword~) makecharset::$9) ← (byte) makecharset::b#3 +Successful SSA optimization Pass2DeInlineWordDerefIdx Culled Empty Block (label) @4 Culled Empty Block (label) print_cls::@2 Culled Empty Block (label) @23 @@ -1532,7 +1534,7 @@ Adding NOP phi() at start of print_cls CALL GRAPH Calls in [] to main:3 Calls in [main] to makecharset:13 doplasma:19 doplasma:26 -Calls in [makecharset] to sid_rnd_init:82 print_cls:84 sid_rnd:90 print_char:108 +Calls in [makecharset] to sid_rnd_init:82 print_cls:84 sid_rnd:90 print_char:109 Created 27 initial phi equivalence classes Coalesced [15] c1A#34 ← c1A#14 @@ -1563,15 +1565,15 @@ Coalesced [78] doplasma::c1a#4 ← doplasma::c1a#1 Coalesced [79] doplasma::c1b#4 ← doplasma::c1b#1 Coalesced [80] doplasma::i#3 ← doplasma::i#1 Coalesced [96] makecharset::b#9 ← makecharset::b#1 -Coalesced [109] print_char_cursor#50 ← print_char_cursor#1 -Coalesced [114] makecharset::c#13 ← makecharset::c#1 -Coalesced [115] print_char_cursor#49 ← print_char_cursor#18 -Coalesced (already) [116] print_char_cursor#51 ← print_char_cursor#46 -Coalesced [117] makecharset::i#8 ← makecharset::i#1 -Coalesced [118] makecharset::ii#6 ← makecharset::ii#1 -Coalesced [119] makecharset::b#7 ← makecharset::b#3 -Coalesced (already) [120] makecharset::b#8 ← makecharset::b#2 -Coalesced [132] print_cls::sc#3 ← print_cls::sc#1 +Coalesced [110] print_char_cursor#50 ← print_char_cursor#1 +Coalesced [115] makecharset::c#13 ← makecharset::c#1 +Coalesced [116] print_char_cursor#49 ← print_char_cursor#18 +Coalesced (already) [117] print_char_cursor#51 ← print_char_cursor#46 +Coalesced [118] makecharset::i#8 ← makecharset::i#1 +Coalesced [119] makecharset::ii#6 ← makecharset::ii#1 +Coalesced [120] makecharset::b#7 ← makecharset::b#3 +Coalesced (already) [121] makecharset::b#8 ← makecharset::b#2 +Coalesced [133] print_cls::sc#3 ← print_cls::sc#1 Coalesced down to 20 phi equivalence classes Culled Empty Block (label) main::@14 Culled Empty Block (label) doplasma::@11 @@ -1754,57 +1756,58 @@ makecharset::@4: scope:[makecharset] from makecharset::@11 makecharset::@5 makecharset::@6: scope:[makecharset] from makecharset::@4 [73] (word~) makecharset::$8 ← (word) makecharset::c#2 << (byte/signed byte/word/signed word/dword/signed dword) 3 [74] (word~) makecharset::$9 ← (word~) makecharset::$8 + (byte) makecharset::i#7 - [75] *((const byte*) CHARSET#0 + (word~) makecharset::$9) ← (byte) makecharset::b#3 - [76] (byte) makecharset::i#1 ← ++ (byte) makecharset::i#7 - [77] if((byte) makecharset::i#1<(byte/signed byte/word/signed word/dword/signed dword) 8) goto makecharset::@2 + [75] (byte*) makecharset::$16 ← (const byte*) CHARSET#0 + (word~) makecharset::$9 + [76] *((byte*) makecharset::$16) ← (byte) makecharset::b#3 + [77] (byte) makecharset::i#1 ← ++ (byte) makecharset::i#7 + [78] if((byte) makecharset::i#1<(byte/signed byte/word/signed word/dword/signed dword) 8) goto makecharset::@2 to:makecharset::@7 makecharset::@7: scope:[makecharset] from makecharset::@6 - [78] (byte/word~) makecharset::$11 ← (word) makecharset::c#2 & (byte/signed byte/word/signed word/dword/signed dword) 7 - [79] if((byte/word~) makecharset::$11!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto makecharset::@9 + [79] (byte/word~) makecharset::$11 ← (word) makecharset::c#2 & (byte/signed byte/word/signed word/dword/signed dword) 7 + [80] if((byte/word~) makecharset::$11!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto makecharset::@9 to:makecharset::@8 makecharset::@8: scope:[makecharset] from makecharset::@7 - [80] phi() - [81] call print_char + [81] phi() + [82] call print_char to:makecharset::@9 makecharset::@9: scope:[makecharset] from makecharset::@7 makecharset::@8 - [82] (byte*) print_char_cursor#18 ← phi( makecharset::@8/(byte*) print_char_cursor#1 makecharset::@7/(byte*) print_char_cursor#46 ) - [83] (word) makecharset::c#1 ← ++ (word) makecharset::c#2 - [84] if((word) makecharset::c#1<(word/signed word/dword/signed dword) $100) goto makecharset::@1 + [83] (byte*) print_char_cursor#18 ← phi( makecharset::@8/(byte*) print_char_cursor#1 makecharset::@7/(byte*) print_char_cursor#46 ) + [84] (word) makecharset::c#1 ← ++ (word) makecharset::c#2 + [85] if((word) makecharset::c#1<(word/signed word/dword/signed dword) $100) goto makecharset::@1 to:makecharset::@return makecharset::@return: scope:[makecharset] from makecharset::@9 - [85] return + [86] return to:@return print_char: scope:[print_char] from makecharset::@8 - [86] *((byte*) print_char_cursor#46) ← (const byte) print_char::ch#0 - [87] (byte*) print_char_cursor#1 ← ++ (byte*) print_char_cursor#46 + [87] *((byte*) print_char_cursor#46) ← (const byte) print_char::ch#0 + [88] (byte*) print_char_cursor#1 ← ++ (byte*) print_char_cursor#46 to:print_char::@return print_char::@return: scope:[print_char] from print_char - [88] return + [89] return to:@return sid_rnd: scope:[sid_rnd] from makecharset::@3 - [89] (byte) sid_rnd::return#0 ← *((const byte*) SID_VOICE3_OSC#0) + [90] (byte) sid_rnd::return#0 ← *((const byte*) SID_VOICE3_OSC#0) to:sid_rnd::@return sid_rnd::@return: scope:[sid_rnd] from sid_rnd - [90] return + [91] return to:@return print_cls: scope:[print_cls] from makecharset::@10 - [91] phi() + [92] phi() to:print_cls::@1 print_cls::@1: scope:[print_cls] from print_cls print_cls::@1 - [92] (byte*) print_cls::sc#2 ← phi( print_cls/(const byte*) print_line_cursor#0 print_cls::@1/(byte*) print_cls::sc#1 ) - [93] *((byte*) print_cls::sc#2) ← (byte) ' ' - [94] (byte*) print_cls::sc#1 ← ++ (byte*) print_cls::sc#2 - [95] if((byte*) print_cls::sc#1!=(const byte*) print_line_cursor#0+(word/signed word/dword/signed dword) $3e8) goto print_cls::@1 + [93] (byte*) print_cls::sc#2 ← phi( print_cls/(const byte*) print_line_cursor#0 print_cls::@1/(byte*) print_cls::sc#1 ) + [94] *((byte*) print_cls::sc#2) ← (byte) ' ' + [95] (byte*) print_cls::sc#1 ← ++ (byte*) print_cls::sc#2 + [96] if((byte*) print_cls::sc#1!=(const byte*) print_line_cursor#0+(word/signed word/dword/signed dword) $3e8) goto print_cls::@1 to:print_cls::@return print_cls::@return: scope:[print_cls] from print_cls::@1 - [96] return + [97] return to:@return sid_rnd_init: scope:[sid_rnd_init] from makecharset - [97] *((const word*) SID_VOICE3_FREQ#0) ← (word/dword/signed dword) $ffff - [98] *((const byte*) SID_VOICE3_CONTROL#0) ← (const byte) SID_CONTROL_NOISE#0 + [98] *((const word*) SID_VOICE3_FREQ#0) ← (word/dword/signed dword) $ffff + [99] *((const byte*) SID_VOICE3_CONTROL#0) ← (const byte) SID_CONTROL_NOISE#0 to:sid_rnd_init::@return sid_rnd_init::@return: scope:[sid_rnd_init] from sid_rnd_init - [99] return + [100] return to:@return @@ -1907,6 +1910,7 @@ VARIABLE REGISTER WEIGHTS (byte*) main::toD0182_screen (void()) makecharset((byte*) makecharset::charset) (byte/word~) makecharset::$11 22.0 +(byte*) makecharset::$16 202.0 (byte~) makecharset::$2 22.0 (byte~) makecharset::$3 2002.0 (byte~) makecharset::$4 2002.0 @@ -1915,26 +1919,26 @@ VARIABLE REGISTER WEIGHTS (byte) makecharset::b (byte) makecharset::b#1 2002.0 (byte) makecharset::b#2 500.5 -(byte) makecharset::b#3 620.8 +(byte) makecharset::b#3 517.3333333333334 (byte[8]) makecharset::bittab (word) makecharset::c (word) makecharset::c#1 16.5 -(word) makecharset::c#2 6.041666666666666 +(word) makecharset::c#2 5.800000000000001 (byte*) makecharset::charset (byte) makecharset::i (byte) makecharset::i#1 151.5 -(byte) makecharset::i#7 21.642857142857142 +(byte) makecharset::i#7 20.2 (byte) makecharset::ii (byte) makecharset::ii#1 1501.5 (byte) makecharset::ii#2 375.375 (byte) makecharset::s -(byte) makecharset::s#0 59.529411764705884 +(byte) makecharset::s#0 56.22222222222223 (void()) print_char((byte) print_char::ch) (byte) print_char::ch (byte*) print_char_cursor (byte*) print_char_cursor#1 4.333333333333333 (byte*) print_char_cursor#18 11.0 -(byte*) print_char_cursor#46 1.1304347826086956 +(byte*) print_char_cursor#46 1.0833333333333333 (void()) print_cls() (byte*) print_cls::sc (byte*) print_cls::sc#1 16.5 @@ -1978,6 +1982,7 @@ Added variable makecharset::$3 to zero page equivalence class [ makecharset::$3 Added variable makecharset::$4 to zero page equivalence class [ makecharset::$4 ] Added variable makecharset::$8 to zero page equivalence class [ makecharset::$8 ] Added variable makecharset::$9 to zero page equivalence class [ makecharset::$9 ] +Added variable makecharset::$16 to zero page equivalence class [ makecharset::$16 ] Added variable makecharset::$11 to zero page equivalence class [ makecharset::$11 ] Added variable sid_rnd::return#0 to zero page equivalence class [ sid_rnd::return#0 ] Complete equivalence classes @@ -2011,6 +2016,7 @@ Complete equivalence classes [ makecharset::$4 ] [ makecharset::$8 ] [ makecharset::$9 ] +[ makecharset::$16 ] [ makecharset::$11 ] [ sid_rnd::return#0 ] Allocated zp ZP_WORD:2 [ main::col#2 main::col#1 ] @@ -2043,8 +2049,9 @@ Allocated zp ZP_BYTE:33 [ makecharset::$3 ] Allocated zp ZP_BYTE:34 [ makecharset::$4 ] Allocated zp ZP_WORD:35 [ makecharset::$8 ] Allocated zp ZP_WORD:37 [ makecharset::$9 ] -Allocated zp ZP_BYTE:39 [ makecharset::$11 ] -Allocated zp ZP_BYTE:40 [ sid_rnd::return#0 ] +Allocated zp ZP_WORD:39 [ makecharset::$16 ] +Allocated zp ZP_BYTE:41 [ makecharset::$11 ] +Allocated zp ZP_BYTE:42 [ sid_rnd::return#0 ] INITIAL ASM //SEG0 File Comments @@ -2439,12 +2446,13 @@ makecharset: { .label _4 = $22 .label _8 = $23 .label _9 = $25 - .label _11 = $27 + .label _11 = $29 .label s = $1f .label ii = $17 .label b = $18 .label i = $16 .label c = $12 + .label _16 = $27 //SEG126 [56] call sid_rnd_init jsr sid_rnd_init //SEG127 [57] phi from makecharset to makecharset::@10 [phi:makecharset->makecharset::@10] @@ -2453,7 +2461,7 @@ makecharset: { //SEG128 makecharset::@10 b10: //SEG129 [58] call print_cls - //SEG130 [91] phi from makecharset::@10 to print_cls [phi:makecharset::@10->print_cls] + //SEG130 [92] phi from makecharset::@10 to print_cls [phi:makecharset::@10->print_cls] print_cls_from_b10: jsr print_cls //SEG131 [59] phi from makecharset::@10 to makecharset::@1 [phi:makecharset::@10->makecharset::@1] @@ -2573,57 +2581,55 @@ makecharset: { lda #0 adc _8+1 sta _9+1 - //SEG168 [75] *((const byte*) CHARSET#0 + (word~) makecharset::$9) ← (byte) makecharset::b#3 -- pbuc1_derefidx_vwuz1=vbuz2 - lda b - sta !v++1 - lda #CHARSET - adc _9+1 - sta !a++2 - !v: - lda #0 - !a: - sta CHARSET - //SEG169 [76] (byte) makecharset::i#1 ← ++ (byte) makecharset::i#7 -- vbuz1=_inc_vbuz1 + adc #CHARSET + sta _16+1 + //SEG169 [76] *((byte*) makecharset::$16) ← (byte) makecharset::b#3 -- _deref_pbuz1=vbuz2 + lda b + ldy #0 + sta (_16),y + //SEG170 [77] (byte) makecharset::i#1 ← ++ (byte) makecharset::i#7 -- vbuz1=_inc_vbuz1 inc i - //SEG170 [77] if((byte) makecharset::i#1<(byte/signed byte/word/signed word/dword/signed dword) 8) goto makecharset::@2 -- vbuz1_lt_vbuc1_then_la1 + //SEG171 [78] if((byte) makecharset::i#1<(byte/signed byte/word/signed word/dword/signed dword) 8) goto makecharset::@2 -- vbuz1_lt_vbuc1_then_la1 lda i cmp #8 bcc b2_from_b6 jmp b7 - //SEG171 makecharset::@7 + //SEG172 makecharset::@7 b7: - //SEG172 [78] (byte/word~) makecharset::$11 ← (word) makecharset::c#2 & (byte/signed byte/word/signed word/dword/signed dword) 7 -- vbuz1=vwuz2_band_vbuc1 + //SEG173 [79] (byte/word~) makecharset::$11 ← (word) makecharset::c#2 & (byte/signed byte/word/signed word/dword/signed dword) 7 -- vbuz1=vwuz2_band_vbuc1 lda c and #7 sta _11 - //SEG173 [79] if((byte/word~) makecharset::$11!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto makecharset::@9 -- vbuz1_neq_0_then_la1 + //SEG174 [80] if((byte/word~) makecharset::$11!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto makecharset::@9 -- vbuz1_neq_0_then_la1 lda _11 cmp #0 bne b9_from_b7 - //SEG174 [80] phi from makecharset::@7 to makecharset::@8 [phi:makecharset::@7->makecharset::@8] + //SEG175 [81] phi from makecharset::@7 to makecharset::@8 [phi:makecharset::@7->makecharset::@8] b8_from_b7: jmp b8 - //SEG175 makecharset::@8 + //SEG176 makecharset::@8 b8: - //SEG176 [81] call print_char + //SEG177 [82] call print_char jsr print_char - //SEG177 [82] phi from makecharset::@7 makecharset::@8 to makecharset::@9 [phi:makecharset::@7/makecharset::@8->makecharset::@9] + //SEG178 [83] phi from makecharset::@7 makecharset::@8 to makecharset::@9 [phi:makecharset::@7/makecharset::@8->makecharset::@9] b9_from_b7: b9_from_b8: - //SEG178 [82] phi (byte*) print_char_cursor#18 = (byte*) print_char_cursor#46 [phi:makecharset::@7/makecharset::@8->makecharset::@9#0] -- register_copy + //SEG179 [83] phi (byte*) print_char_cursor#18 = (byte*) print_char_cursor#46 [phi:makecharset::@7/makecharset::@8->makecharset::@9#0] -- register_copy jmp b9 - //SEG179 makecharset::@9 + //SEG180 makecharset::@9 b9: - //SEG180 [83] (word) makecharset::c#1 ← ++ (word) makecharset::c#2 -- vwuz1=_inc_vwuz1 + //SEG181 [84] (word) makecharset::c#1 ← ++ (word) makecharset::c#2 -- vwuz1=_inc_vwuz1 inc c bne !+ inc c+1 !: - //SEG181 [84] if((word) makecharset::c#1<(word/signed word/dword/signed dword) $100) goto makecharset::@1 -- vwuz1_lt_vwuc1_then_la1 + //SEG182 [85] if((word) makecharset::c#1<(word/signed word/dword/signed dword) $100) goto makecharset::@1 -- vwuz1_lt_vwuc1_then_la1 lda c+1 cmp #>$100 bcc b1_from_b9 @@ -2633,74 +2639,74 @@ makecharset: { bcc b1_from_b9 !: jmp breturn - //SEG182 makecharset::@return + //SEG183 makecharset::@return breturn: - //SEG183 [85] return + //SEG184 [86] return rts bittab: .byte 1, 2, 4, 8, $10, $20, $40, $80 } -//SEG184 print_char +//SEG185 print_char // Print a single char print_char: { .const ch = '.' - //SEG185 [86] *((byte*) print_char_cursor#46) ← (const byte) print_char::ch#0 -- _deref_pbuz1=vbuc1 + //SEG186 [87] *((byte*) print_char_cursor#46) ← (const byte) print_char::ch#0 -- _deref_pbuz1=vbuc1 lda #ch ldy #0 sta (print_char_cursor),y - //SEG186 [87] (byte*) print_char_cursor#1 ← ++ (byte*) print_char_cursor#46 -- pbuz1=_inc_pbuz1 + //SEG187 [88] (byte*) print_char_cursor#1 ← ++ (byte*) print_char_cursor#46 -- pbuz1=_inc_pbuz1 inc print_char_cursor bne !+ inc print_char_cursor+1 !: jmp breturn - //SEG187 print_char::@return + //SEG188 print_char::@return breturn: - //SEG188 [88] return + //SEG189 [89] return rts } -//SEG189 sid_rnd +//SEG190 sid_rnd // Get a random number from the SID voice 3, // Must be initialized with sid_rnd_init() sid_rnd: { - .label return = $28 + .label return = $2a .label return_2 = $20 - //SEG190 [89] (byte) sid_rnd::return#0 ← *((const byte*) SID_VOICE3_OSC#0) -- vbuz1=_deref_pbuc1 + //SEG191 [90] (byte) sid_rnd::return#0 ← *((const byte*) SID_VOICE3_OSC#0) -- vbuz1=_deref_pbuc1 lda SID_VOICE3_OSC sta return jmp breturn - //SEG191 sid_rnd::@return + //SEG192 sid_rnd::@return breturn: - //SEG192 [90] return + //SEG193 [91] return rts } -//SEG193 print_cls +//SEG194 print_cls // Clear the screen. Also resets current line/char cursor. print_cls: { .label sc = $19 - //SEG194 [92] phi from print_cls to print_cls::@1 [phi:print_cls->print_cls::@1] + //SEG195 [93] phi from print_cls to print_cls::@1 [phi:print_cls->print_cls::@1] b1_from_print_cls: - //SEG195 [92] phi (byte*) print_cls::sc#2 = (const byte*) print_line_cursor#0 [phi:print_cls->print_cls::@1#0] -- pbuz1=pbuc1 + //SEG196 [93] phi (byte*) print_cls::sc#2 = (const byte*) print_line_cursor#0 [phi:print_cls->print_cls::@1#0] -- pbuz1=pbuc1 lda #print_line_cursor sta sc+1 jmp b1 - //SEG196 [92] phi from print_cls::@1 to print_cls::@1 [phi:print_cls::@1->print_cls::@1] + //SEG197 [93] phi from print_cls::@1 to print_cls::@1 [phi:print_cls::@1->print_cls::@1] b1_from_b1: - //SEG197 [92] phi (byte*) print_cls::sc#2 = (byte*) print_cls::sc#1 [phi:print_cls::@1->print_cls::@1#0] -- register_copy + //SEG198 [93] phi (byte*) print_cls::sc#2 = (byte*) print_cls::sc#1 [phi:print_cls::@1->print_cls::@1#0] -- register_copy jmp b1 - //SEG198 print_cls::@1 + //SEG199 print_cls::@1 b1: - //SEG199 [93] *((byte*) print_cls::sc#2) ← (byte) ' ' -- _deref_pbuz1=vbuc1 + //SEG200 [94] *((byte*) print_cls::sc#2) ← (byte) ' ' -- _deref_pbuz1=vbuc1 lda #' ' ldy #0 sta (sc),y - //SEG200 [94] (byte*) print_cls::sc#1 ← ++ (byte*) print_cls::sc#2 -- pbuz1=_inc_pbuz1 + //SEG201 [95] (byte*) print_cls::sc#1 ← ++ (byte*) print_cls::sc#2 -- pbuz1=_inc_pbuz1 inc sc bne !+ inc sc+1 !: - //SEG201 [95] if((byte*) print_cls::sc#1!=(const byte*) print_line_cursor#0+(word/signed word/dword/signed dword) $3e8) goto print_cls::@1 -- pbuz1_neq_pbuc1_then_la1 + //SEG202 [96] if((byte*) print_cls::sc#1!=(const byte*) print_line_cursor#0+(word/signed word/dword/signed dword) $3e8) goto print_cls::@1 -- pbuz1_neq_pbuc1_then_la1 lda sc+1 cmp #>print_line_cursor+$3e8 bne b1_from_b1 @@ -2708,26 +2714,26 @@ print_cls: { cmp #$ffff sta SID_VOICE3_FREQ+1 - //SEG206 [98] *((const byte*) SID_VOICE3_CONTROL#0) ← (const byte) SID_CONTROL_NOISE#0 -- _deref_pbuc1=vbuc2 + //SEG207 [99] *((const byte*) SID_VOICE3_CONTROL#0) ← (const byte) SID_CONTROL_NOISE#0 -- _deref_pbuc1=vbuc2 lda #SID_CONTROL_NOISE sta SID_VOICE3_CONTROL jmp breturn - //SEG207 sid_rnd_init::@return + //SEG208 sid_rnd_init::@return breturn: - //SEG208 [99] return + //SEG209 [100] return rts } .pc = SINTABLE "SINTABLE" @@ -2773,14 +2779,17 @@ Removing always clobbered register reg byte a as potential for zp ZP_BYTE:23 [ m Statement [73] (word~) makecharset::$8 ← (word) makecharset::c#2 << (byte/signed byte/word/signed word/dword/signed dword) 3 [ makecharset::c#2 print_char_cursor#46 makecharset::s#0 makecharset::i#7 makecharset::b#3 makecharset::$8 ] ( main:3::makecharset:13 [ makecharset::c#2 print_char_cursor#46 makecharset::s#0 makecharset::i#7 makecharset::b#3 makecharset::$8 ] ) always clobbers reg byte a Removing always clobbered register reg byte a as potential for zp ZP_BYTE:24 [ makecharset::b#2 makecharset::b#3 makecharset::b#1 ] Statement [74] (word~) makecharset::$9 ← (word~) makecharset::$8 + (byte) makecharset::i#7 [ makecharset::c#2 print_char_cursor#46 makecharset::s#0 makecharset::i#7 makecharset::b#3 makecharset::$9 ] ( main:3::makecharset:13 [ makecharset::c#2 print_char_cursor#46 makecharset::s#0 makecharset::i#7 makecharset::b#3 makecharset::$9 ] ) always clobbers reg byte a -Statement [75] *((const byte*) CHARSET#0 + (word~) makecharset::$9) ← (byte) makecharset::b#3 [ makecharset::c#2 print_char_cursor#46 makecharset::s#0 makecharset::i#7 ] ( main:3::makecharset:13 [ makecharset::c#2 print_char_cursor#46 makecharset::s#0 makecharset::i#7 ] ) always clobbers reg byte a -Statement [78] (byte/word~) makecharset::$11 ← (word) makecharset::c#2 & (byte/signed byte/word/signed word/dword/signed dword) 7 [ makecharset::c#2 print_char_cursor#46 makecharset::$11 ] ( main:3::makecharset:13 [ makecharset::c#2 print_char_cursor#46 makecharset::$11 ] ) always clobbers reg byte a -Statement [84] if((word) makecharset::c#1<(word/signed word/dword/signed dword) $100) goto makecharset::@1 [ makecharset::c#1 print_char_cursor#18 ] ( main:3::makecharset:13 [ makecharset::c#1 print_char_cursor#18 ] ) always clobbers reg byte a -Statement [86] *((byte*) print_char_cursor#46) ← (const byte) print_char::ch#0 [ print_char_cursor#46 ] ( main:3::makecharset:13::print_char:81 [ makecharset::c#2 print_char_cursor#46 ] ) always clobbers reg byte a reg byte y -Statement [93] *((byte*) print_cls::sc#2) ← (byte) ' ' [ print_cls::sc#2 ] ( main:3::makecharset:13::print_cls:58 [ print_cls::sc#2 ] ) always clobbers reg byte a reg byte y -Statement [95] if((byte*) print_cls::sc#1!=(const byte*) print_line_cursor#0+(word/signed word/dword/signed dword) $3e8) goto print_cls::@1 [ print_cls::sc#1 ] ( main:3::makecharset:13::print_cls:58 [ print_cls::sc#1 ] ) always clobbers reg byte a -Statement [97] *((const word*) SID_VOICE3_FREQ#0) ← (word/dword/signed dword) $ffff [ ] ( main:3::makecharset:13::sid_rnd_init:56 [ ] ) always clobbers reg byte a -Statement [98] *((const byte*) SID_VOICE3_CONTROL#0) ← (const byte) SID_CONTROL_NOISE#0 [ ] ( main:3::makecharset:13::sid_rnd_init:56 [ ] ) always clobbers reg byte a +Statement [75] (byte*) makecharset::$16 ← (const byte*) CHARSET#0 + (word~) makecharset::$9 [ makecharset::c#2 print_char_cursor#46 makecharset::s#0 makecharset::i#7 makecharset::b#3 makecharset::$16 ] ( main:3::makecharset:13 [ makecharset::c#2 print_char_cursor#46 makecharset::s#0 makecharset::i#7 makecharset::b#3 makecharset::$16 ] ) always clobbers reg byte a +Statement [76] *((byte*) makecharset::$16) ← (byte) makecharset::b#3 [ makecharset::c#2 print_char_cursor#46 makecharset::s#0 makecharset::i#7 ] ( main:3::makecharset:13 [ makecharset::c#2 print_char_cursor#46 makecharset::s#0 makecharset::i#7 ] ) always clobbers reg byte a reg byte y +Removing always clobbered register reg byte y as potential for zp ZP_BYTE:31 [ makecharset::s#0 ] +Removing always clobbered register reg byte y as potential for zp ZP_BYTE:22 [ makecharset::i#7 makecharset::i#1 ] +Statement [79] (byte/word~) makecharset::$11 ← (word) makecharset::c#2 & (byte/signed byte/word/signed word/dword/signed dword) 7 [ makecharset::c#2 print_char_cursor#46 makecharset::$11 ] ( main:3::makecharset:13 [ makecharset::c#2 print_char_cursor#46 makecharset::$11 ] ) always clobbers reg byte a +Statement [85] if((word) makecharset::c#1<(word/signed word/dword/signed dword) $100) goto makecharset::@1 [ makecharset::c#1 print_char_cursor#18 ] ( main:3::makecharset:13 [ makecharset::c#1 print_char_cursor#18 ] ) always clobbers reg byte a +Statement [87] *((byte*) print_char_cursor#46) ← (const byte) print_char::ch#0 [ print_char_cursor#46 ] ( main:3::makecharset:13::print_char:82 [ makecharset::c#2 print_char_cursor#46 ] ) always clobbers reg byte a reg byte y +Statement [94] *((byte*) print_cls::sc#2) ← (byte) ' ' [ print_cls::sc#2 ] ( main:3::makecharset:13::print_cls:58 [ print_cls::sc#2 ] ) always clobbers reg byte a reg byte y +Statement [96] if((byte*) print_cls::sc#1!=(const byte*) print_line_cursor#0+(word/signed word/dword/signed dword) $3e8) goto print_cls::@1 [ print_cls::sc#1 ] ( main:3::makecharset:13::print_cls:58 [ print_cls::sc#1 ] ) always clobbers reg byte a +Statement [98] *((const word*) SID_VOICE3_FREQ#0) ← (word/dword/signed dword) $ffff [ ] ( main:3::makecharset:13::sid_rnd_init:56 [ ] ) always clobbers reg byte a +Statement [99] *((const byte*) SID_VOICE3_CONTROL#0) ← (const byte) SID_CONTROL_NOISE#0 [ ] ( main:3::makecharset:13::sid_rnd_init:56 [ ] ) always clobbers reg byte a Statement [6] *((const byte*) BORDERCOL#0) ← (const byte) BLUE#0 [ ] ( main:3 [ ] ) always clobbers reg byte a Statement [7] *((const byte*) BGCOL#0) ← (const byte) BLUE#0 [ ] ( main:3 [ ] ) always clobbers reg byte a Statement [9] *((byte*) main::col#2) ← (const byte) BLACK#0 [ main::col#2 ] ( main:3 [ main::col#2 ] ) always clobbers reg byte a reg byte y @@ -2802,14 +2811,15 @@ Statement [60] (byte~) makecharset::$2 ← < (word) makecharset::c#2 [ makechars Statement [69] (byte) makecharset::b#1 ← (byte) makecharset::b#2 | *((const byte[8]) makecharset::bittab#0 + (byte) makecharset::ii#2) [ makecharset::c#2 print_char_cursor#46 makecharset::s#0 makecharset::i#7 makecharset::ii#2 makecharset::b#1 ] ( main:3::makecharset:13 [ makecharset::c#2 print_char_cursor#46 makecharset::s#0 makecharset::i#7 makecharset::ii#2 makecharset::b#1 ] ) always clobbers reg byte a Statement [73] (word~) makecharset::$8 ← (word) makecharset::c#2 << (byte/signed byte/word/signed word/dword/signed dword) 3 [ makecharset::c#2 print_char_cursor#46 makecharset::s#0 makecharset::i#7 makecharset::b#3 makecharset::$8 ] ( main:3::makecharset:13 [ makecharset::c#2 print_char_cursor#46 makecharset::s#0 makecharset::i#7 makecharset::b#3 makecharset::$8 ] ) always clobbers reg byte a Statement [74] (word~) makecharset::$9 ← (word~) makecharset::$8 + (byte) makecharset::i#7 [ makecharset::c#2 print_char_cursor#46 makecharset::s#0 makecharset::i#7 makecharset::b#3 makecharset::$9 ] ( main:3::makecharset:13 [ makecharset::c#2 print_char_cursor#46 makecharset::s#0 makecharset::i#7 makecharset::b#3 makecharset::$9 ] ) always clobbers reg byte a -Statement [75] *((const byte*) CHARSET#0 + (word~) makecharset::$9) ← (byte) makecharset::b#3 [ makecharset::c#2 print_char_cursor#46 makecharset::s#0 makecharset::i#7 ] ( main:3::makecharset:13 [ makecharset::c#2 print_char_cursor#46 makecharset::s#0 makecharset::i#7 ] ) always clobbers reg byte a -Statement [78] (byte/word~) makecharset::$11 ← (word) makecharset::c#2 & (byte/signed byte/word/signed word/dword/signed dword) 7 [ makecharset::c#2 print_char_cursor#46 makecharset::$11 ] ( main:3::makecharset:13 [ makecharset::c#2 print_char_cursor#46 makecharset::$11 ] ) always clobbers reg byte a -Statement [84] if((word) makecharset::c#1<(word/signed word/dword/signed dword) $100) goto makecharset::@1 [ makecharset::c#1 print_char_cursor#18 ] ( main:3::makecharset:13 [ makecharset::c#1 print_char_cursor#18 ] ) always clobbers reg byte a -Statement [86] *((byte*) print_char_cursor#46) ← (const byte) print_char::ch#0 [ print_char_cursor#46 ] ( main:3::makecharset:13::print_char:81 [ makecharset::c#2 print_char_cursor#46 ] ) always clobbers reg byte a reg byte y -Statement [93] *((byte*) print_cls::sc#2) ← (byte) ' ' [ print_cls::sc#2 ] ( main:3::makecharset:13::print_cls:58 [ print_cls::sc#2 ] ) always clobbers reg byte a reg byte y -Statement [95] if((byte*) print_cls::sc#1!=(const byte*) print_line_cursor#0+(word/signed word/dword/signed dword) $3e8) goto print_cls::@1 [ print_cls::sc#1 ] ( main:3::makecharset:13::print_cls:58 [ print_cls::sc#1 ] ) always clobbers reg byte a -Statement [97] *((const word*) SID_VOICE3_FREQ#0) ← (word/dword/signed dword) $ffff [ ] ( main:3::makecharset:13::sid_rnd_init:56 [ ] ) always clobbers reg byte a -Statement [98] *((const byte*) SID_VOICE3_CONTROL#0) ← (const byte) SID_CONTROL_NOISE#0 [ ] ( main:3::makecharset:13::sid_rnd_init:56 [ ] ) always clobbers reg byte a +Statement [75] (byte*) makecharset::$16 ← (const byte*) CHARSET#0 + (word~) makecharset::$9 [ makecharset::c#2 print_char_cursor#46 makecharset::s#0 makecharset::i#7 makecharset::b#3 makecharset::$16 ] ( main:3::makecharset:13 [ makecharset::c#2 print_char_cursor#46 makecharset::s#0 makecharset::i#7 makecharset::b#3 makecharset::$16 ] ) always clobbers reg byte a +Statement [76] *((byte*) makecharset::$16) ← (byte) makecharset::b#3 [ makecharset::c#2 print_char_cursor#46 makecharset::s#0 makecharset::i#7 ] ( main:3::makecharset:13 [ makecharset::c#2 print_char_cursor#46 makecharset::s#0 makecharset::i#7 ] ) always clobbers reg byte a reg byte y +Statement [79] (byte/word~) makecharset::$11 ← (word) makecharset::c#2 & (byte/signed byte/word/signed word/dword/signed dword) 7 [ makecharset::c#2 print_char_cursor#46 makecharset::$11 ] ( main:3::makecharset:13 [ makecharset::c#2 print_char_cursor#46 makecharset::$11 ] ) always clobbers reg byte a +Statement [85] if((word) makecharset::c#1<(word/signed word/dword/signed dword) $100) goto makecharset::@1 [ makecharset::c#1 print_char_cursor#18 ] ( main:3::makecharset:13 [ makecharset::c#1 print_char_cursor#18 ] ) always clobbers reg byte a +Statement [87] *((byte*) print_char_cursor#46) ← (const byte) print_char::ch#0 [ print_char_cursor#46 ] ( main:3::makecharset:13::print_char:82 [ makecharset::c#2 print_char_cursor#46 ] ) always clobbers reg byte a reg byte y +Statement [94] *((byte*) print_cls::sc#2) ← (byte) ' ' [ print_cls::sc#2 ] ( main:3::makecharset:13::print_cls:58 [ print_cls::sc#2 ] ) always clobbers reg byte a reg byte y +Statement [96] if((byte*) print_cls::sc#1!=(const byte*) print_line_cursor#0+(word/signed word/dword/signed dword) $3e8) goto print_cls::@1 [ print_cls::sc#1 ] ( main:3::makecharset:13::print_cls:58 [ print_cls::sc#1 ] ) always clobbers reg byte a +Statement [98] *((const word*) SID_VOICE3_FREQ#0) ← (word/dword/signed dword) $ffff [ ] ( main:3::makecharset:13::sid_rnd_init:56 [ ] ) always clobbers reg byte a +Statement [99] *((const byte*) SID_VOICE3_CONTROL#0) ← (const byte) SID_CONTROL_NOISE#0 [ ] ( main:3::makecharset:13::sid_rnd_init:56 [ ] ) always clobbers reg byte a Potential registers zp ZP_WORD:2 [ main::col#2 main::col#1 ] : zp ZP_WORD:2 , Potential registers zp ZP_BYTE:4 [ c1A#10 c1A#14 c1A#4 ] : zp ZP_BYTE:4 , reg byte x , reg byte y , Potential registers zp ZP_BYTE:5 [ c1B#10 c1B#14 c1B#4 ] : zp ZP_BYTE:5 , reg byte x , reg byte y , @@ -2826,7 +2836,7 @@ Potential registers zp ZP_WORD:15 [ doplasma::screen#5 doplasma::screen#10 dopla Potential registers zp ZP_BYTE:17 [ doplasma::i2#2 doplasma::i2#1 ] : zp ZP_BYTE:17 , reg byte x , reg byte y , Potential registers zp ZP_WORD:18 [ makecharset::c#2 makecharset::c#1 ] : zp ZP_WORD:18 , Potential registers zp ZP_WORD:20 [ print_char_cursor#46 print_char_cursor#18 print_char_cursor#1 ] : zp ZP_WORD:20 , -Potential registers zp ZP_BYTE:22 [ makecharset::i#7 makecharset::i#1 ] : zp ZP_BYTE:22 , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:22 [ makecharset::i#7 makecharset::i#1 ] : zp ZP_BYTE:22 , reg byte x , Potential registers zp ZP_BYTE:23 [ makecharset::ii#2 makecharset::ii#1 ] : zp ZP_BYTE:23 , reg byte x , reg byte y , Potential registers zp ZP_BYTE:24 [ makecharset::b#2 makecharset::b#3 makecharset::b#1 ] : zp ZP_BYTE:24 , reg byte x , reg byte y , Potential registers zp ZP_WORD:25 [ print_cls::sc#2 print_cls::sc#1 ] : zp ZP_WORD:25 , @@ -2834,70 +2844,72 @@ Potential registers zp ZP_BYTE:27 [ doplasma::$0 ] : zp ZP_BYTE:27 , reg byte a Potential registers zp ZP_BYTE:28 [ doplasma::$2 ] : zp ZP_BYTE:28 , reg byte a , reg byte x , reg byte y , Potential registers zp ZP_BYTE:29 [ doplasma::$4 ] : zp ZP_BYTE:29 , reg byte a , reg byte x , reg byte y , Potential registers zp ZP_BYTE:30 [ makecharset::$2 ] : zp ZP_BYTE:30 , reg byte a , reg byte x , reg byte y , -Potential registers zp ZP_BYTE:31 [ makecharset::s#0 ] : zp ZP_BYTE:31 , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:31 [ makecharset::s#0 ] : zp ZP_BYTE:31 , reg byte x , Potential registers zp ZP_BYTE:32 [ sid_rnd::return#2 ] : zp ZP_BYTE:32 , reg byte a , reg byte x , reg byte y , Potential registers zp ZP_BYTE:33 [ makecharset::$3 ] : zp ZP_BYTE:33 , reg byte a , reg byte x , reg byte y , Potential registers zp ZP_BYTE:34 [ makecharset::$4 ] : zp ZP_BYTE:34 , reg byte a , reg byte x , reg byte y , Potential registers zp ZP_WORD:35 [ makecharset::$8 ] : zp ZP_WORD:35 , Potential registers zp ZP_WORD:37 [ makecharset::$9 ] : zp ZP_WORD:37 , -Potential registers zp ZP_BYTE:39 [ makecharset::$11 ] : zp ZP_BYTE:39 , reg byte a , reg byte x , reg byte y , -Potential registers zp ZP_BYTE:40 [ sid_rnd::return#0 ] : zp ZP_BYTE:40 , reg byte a , reg byte x , reg byte y , +Potential registers zp ZP_WORD:39 [ makecharset::$16 ] : zp ZP_WORD:39 , +Potential registers zp ZP_BYTE:41 [ makecharset::$11 ] : zp ZP_BYTE:41 , reg byte a , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:42 [ sid_rnd::return#0 ] : zp ZP_BYTE:42 , reg byte a , reg byte x , reg byte y , REGISTER UPLIFT SCOPES -Uplift Scope [makecharset] 3,123.3: zp ZP_BYTE:24 [ makecharset::b#2 makecharset::b#3 makecharset::b#1 ] 2,002: zp ZP_BYTE:33 [ makecharset::$3 ] 2,002: zp ZP_BYTE:34 [ makecharset::$4 ] 1,876.88: zp ZP_BYTE:23 [ makecharset::ii#2 makecharset::ii#1 ] 202: zp ZP_WORD:35 [ makecharset::$8 ] 202: zp ZP_WORD:37 [ makecharset::$9 ] 173.14: zp ZP_BYTE:22 [ makecharset::i#7 makecharset::i#1 ] 59.53: zp ZP_BYTE:31 [ makecharset::s#0 ] 22.54: zp ZP_WORD:18 [ makecharset::c#2 makecharset::c#1 ] 22: zp ZP_BYTE:30 [ makecharset::$2 ] 22: zp ZP_BYTE:39 [ makecharset::$11 ] +Uplift Scope [makecharset] 3,019.83: zp ZP_BYTE:24 [ makecharset::b#2 makecharset::b#3 makecharset::b#1 ] 2,002: zp ZP_BYTE:33 [ makecharset::$3 ] 2,002: zp ZP_BYTE:34 [ makecharset::$4 ] 1,876.88: zp ZP_BYTE:23 [ makecharset::ii#2 makecharset::ii#1 ] 202: zp ZP_WORD:35 [ makecharset::$8 ] 202: zp ZP_WORD:37 [ makecharset::$9 ] 202: zp ZP_WORD:39 [ makecharset::$16 ] 171.7: zp ZP_BYTE:22 [ makecharset::i#7 makecharset::i#1 ] 56.22: zp ZP_BYTE:31 [ makecharset::s#0 ] 22.3: zp ZP_WORD:18 [ makecharset::c#2 makecharset::c#1 ] 22: zp ZP_BYTE:30 [ makecharset::$2 ] 22: zp ZP_BYTE:41 [ makecharset::$11 ] Uplift Scope [doplasma] 2,836.17: zp ZP_BYTE:17 [ doplasma::i2#2 doplasma::i2#1 ] 2,002: zp ZP_BYTE:29 [ doplasma::$4 ] 323.36: zp ZP_BYTE:14 [ doplasma::ii#4 doplasma::ii#1 ] 268.25: zp ZP_WORD:15 [ doplasma::screen#5 doplasma::screen#10 doplasma::screen#2 ] 212.1: zp ZP_BYTE:10 [ doplasma::i#2 doplasma::i#1 ] 212.1: zp ZP_BYTE:13 [ doplasma::i1#2 doplasma::i1#1 ] 202: zp ZP_BYTE:27 [ doplasma::$0 ] 202: zp ZP_BYTE:28 [ doplasma::$2 ] 154.17: zp ZP_BYTE:8 [ doplasma::c1a#2 doplasma::c1a#0 doplasma::c1a#1 ] 154.17: zp ZP_BYTE:11 [ doplasma::c2a#2 doplasma::c2a#0 doplasma::c2a#1 ] 147.58: zp ZP_BYTE:9 [ doplasma::c1b#2 doplasma::c1b#0 doplasma::c1b#1 ] 147.58: zp ZP_BYTE:12 [ doplasma::c2b#2 doplasma::c2b#0 doplasma::c2b#1 ] -Uplift Scope [sid_rnd] 2,002: zp ZP_BYTE:32 [ sid_rnd::return#2 ] 334.33: zp ZP_BYTE:40 [ sid_rnd::return#0 ] -Uplift Scope [] 16.46: zp ZP_WORD:20 [ print_char_cursor#46 print_char_cursor#18 print_char_cursor#1 ] 14.43: zp ZP_BYTE:4 [ c1A#10 c1A#14 c1A#4 ] 14.22: zp ZP_BYTE:5 [ c1B#10 c1B#14 c1B#4 ] 13.59: zp ZP_BYTE:7 [ c2B#24 c2B#14 c2B#4 ] 13.57: zp ZP_BYTE:6 [ c2A#24 c2A#14 c2A#4 ] +Uplift Scope [sid_rnd] 2,002: zp ZP_BYTE:32 [ sid_rnd::return#2 ] 334.33: zp ZP_BYTE:42 [ sid_rnd::return#0 ] +Uplift Scope [] 16.42: zp ZP_WORD:20 [ print_char_cursor#46 print_char_cursor#18 print_char_cursor#1 ] 14.43: zp ZP_BYTE:4 [ c1A#10 c1A#14 c1A#4 ] 14.22: zp ZP_BYTE:5 [ c1B#10 c1B#14 c1B#4 ] 13.59: zp ZP_BYTE:7 [ c2B#24 c2B#14 c2B#4 ] 13.57: zp ZP_BYTE:6 [ c2A#24 c2A#14 c2A#4 ] Uplift Scope [print_cls] 33: zp ZP_WORD:25 [ print_cls::sc#2 print_cls::sc#1 ] Uplift Scope [main] 33: zp ZP_WORD:2 [ main::col#2 main::col#1 ] Uplift Scope [print_char] Uplift Scope [sid_rnd_init] -Uplifting [makecharset] best 157628 combination reg byte y [ makecharset::b#2 makecharset::b#3 makecharset::b#1 ] reg byte a [ makecharset::$3 ] zp ZP_BYTE:34 [ makecharset::$4 ] reg byte x [ makecharset::ii#2 makecharset::ii#1 ] zp ZP_WORD:35 [ makecharset::$8 ] zp ZP_WORD:37 [ makecharset::$9 ] zp ZP_BYTE:22 [ makecharset::i#7 makecharset::i#1 ] zp ZP_BYTE:31 [ makecharset::s#0 ] zp ZP_WORD:18 [ makecharset::c#2 makecharset::c#1 ] zp ZP_BYTE:30 [ makecharset::$2 ] zp ZP_BYTE:39 [ makecharset::$11 ] -Limited combination testing to 100 combinations of 20736 possible. -Uplifting [doplasma] best 132728 combination reg byte y [ doplasma::i2#2 doplasma::i2#1 ] reg byte a [ doplasma::$4 ] reg byte x [ doplasma::ii#4 doplasma::ii#1 ] zp ZP_WORD:15 [ doplasma::screen#5 doplasma::screen#10 doplasma::screen#2 ] zp ZP_BYTE:10 [ doplasma::i#2 doplasma::i#1 ] zp ZP_BYTE:13 [ doplasma::i1#2 doplasma::i1#1 ] zp ZP_BYTE:27 [ doplasma::$0 ] zp ZP_BYTE:28 [ doplasma::$2 ] zp ZP_BYTE:8 [ doplasma::c1a#2 doplasma::c1a#0 doplasma::c1a#1 ] zp ZP_BYTE:11 [ doplasma::c2a#2 doplasma::c2a#0 doplasma::c2a#1 ] zp ZP_BYTE:9 [ doplasma::c1b#2 doplasma::c1b#0 doplasma::c1b#1 ] zp ZP_BYTE:12 [ doplasma::c2b#2 doplasma::c2b#0 doplasma::c2b#1 ] +Uplifting [makecharset] best 157228 combination reg byte y [ makecharset::b#2 makecharset::b#3 makecharset::b#1 ] reg byte a [ makecharset::$3 ] zp ZP_BYTE:34 [ makecharset::$4 ] reg byte x [ makecharset::ii#2 makecharset::ii#1 ] zp ZP_WORD:35 [ makecharset::$8 ] zp ZP_WORD:37 [ makecharset::$9 ] zp ZP_WORD:39 [ makecharset::$16 ] zp ZP_BYTE:22 [ makecharset::i#7 makecharset::i#1 ] zp ZP_BYTE:31 [ makecharset::s#0 ] zp ZP_WORD:18 [ makecharset::c#2 makecharset::c#1 ] zp ZP_BYTE:30 [ makecharset::$2 ] zp ZP_BYTE:41 [ makecharset::$11 ] +Limited combination testing to 100 combinations of 9216 possible. +Uplifting [doplasma] best 132328 combination reg byte y [ doplasma::i2#2 doplasma::i2#1 ] reg byte a [ doplasma::$4 ] reg byte x [ doplasma::ii#4 doplasma::ii#1 ] zp ZP_WORD:15 [ doplasma::screen#5 doplasma::screen#10 doplasma::screen#2 ] zp ZP_BYTE:10 [ doplasma::i#2 doplasma::i#1 ] zp ZP_BYTE:13 [ doplasma::i1#2 doplasma::i1#1 ] zp ZP_BYTE:27 [ doplasma::$0 ] zp ZP_BYTE:28 [ doplasma::$2 ] zp ZP_BYTE:8 [ doplasma::c1a#2 doplasma::c1a#0 doplasma::c1a#1 ] zp ZP_BYTE:11 [ doplasma::c2a#2 doplasma::c2a#0 doplasma::c2a#1 ] zp ZP_BYTE:9 [ doplasma::c1b#2 doplasma::c1b#0 doplasma::c1b#1 ] zp ZP_BYTE:12 [ doplasma::c2b#2 doplasma::c2b#0 doplasma::c2b#1 ] Limited combination testing to 100 combinations of 419904 possible. -Uplifting [sid_rnd] best 123725 combination reg byte a [ sid_rnd::return#2 ] reg byte a [ sid_rnd::return#0 ] -Uplifting [] best 123725 combination zp ZP_WORD:20 [ print_char_cursor#46 print_char_cursor#18 print_char_cursor#1 ] zp ZP_BYTE:4 [ c1A#10 c1A#14 c1A#4 ] zp ZP_BYTE:5 [ c1B#10 c1B#14 c1B#4 ] zp ZP_BYTE:7 [ c2B#24 c2B#14 c2B#4 ] zp ZP_BYTE:6 [ c2A#24 c2A#14 c2A#4 ] -Uplifting [print_cls] best 123725 combination zp ZP_WORD:25 [ print_cls::sc#2 print_cls::sc#1 ] -Uplifting [main] best 123725 combination zp ZP_WORD:2 [ main::col#2 main::col#1 ] -Uplifting [print_char] best 123725 combination -Uplifting [sid_rnd_init] best 123725 combination +Uplifting [sid_rnd] best 123325 combination reg byte a [ sid_rnd::return#2 ] reg byte a [ sid_rnd::return#0 ] +Uplifting [] best 123325 combination zp ZP_WORD:20 [ print_char_cursor#46 print_char_cursor#18 print_char_cursor#1 ] zp ZP_BYTE:4 [ c1A#10 c1A#14 c1A#4 ] zp ZP_BYTE:5 [ c1B#10 c1B#14 c1B#4 ] zp ZP_BYTE:7 [ c2B#24 c2B#14 c2B#4 ] zp ZP_BYTE:6 [ c2A#24 c2A#14 c2A#4 ] +Uplifting [print_cls] best 123325 combination zp ZP_WORD:25 [ print_cls::sc#2 print_cls::sc#1 ] +Uplifting [main] best 123325 combination zp ZP_WORD:2 [ main::col#2 main::col#1 ] +Uplifting [print_char] best 123325 combination +Uplifting [sid_rnd_init] best 123325 combination Attempting to uplift remaining variables inzp ZP_BYTE:34 [ makecharset::$4 ] -Uplifting [makecharset] best 123725 combination zp ZP_BYTE:34 [ makecharset::$4 ] +Uplifting [makecharset] best 123325 combination zp ZP_BYTE:34 [ makecharset::$4 ] Attempting to uplift remaining variables inzp ZP_BYTE:10 [ doplasma::i#2 doplasma::i#1 ] -Uplifting [doplasma] best 123725 combination zp ZP_BYTE:10 [ doplasma::i#2 doplasma::i#1 ] +Uplifting [doplasma] best 123325 combination zp ZP_BYTE:10 [ doplasma::i#2 doplasma::i#1 ] Attempting to uplift remaining variables inzp ZP_BYTE:13 [ doplasma::i1#2 doplasma::i1#1 ] -Uplifting [doplasma] best 123725 combination zp ZP_BYTE:13 [ doplasma::i1#2 doplasma::i1#1 ] +Uplifting [doplasma] best 123325 combination zp ZP_BYTE:13 [ doplasma::i1#2 doplasma::i1#1 ] Attempting to uplift remaining variables inzp ZP_BYTE:27 [ doplasma::$0 ] -Uplifting [doplasma] best 123125 combination reg byte a [ doplasma::$0 ] +Uplifting [doplasma] best 122725 combination reg byte a [ doplasma::$0 ] Attempting to uplift remaining variables inzp ZP_BYTE:28 [ doplasma::$2 ] -Uplifting [doplasma] best 122525 combination reg byte a [ doplasma::$2 ] +Uplifting [doplasma] best 122125 combination reg byte a [ doplasma::$2 ] Attempting to uplift remaining variables inzp ZP_BYTE:22 [ makecharset::i#7 makecharset::i#1 ] -Uplifting [makecharset] best 122525 combination zp ZP_BYTE:22 [ makecharset::i#7 makecharset::i#1 ] +Uplifting [makecharset] best 122125 combination zp ZP_BYTE:22 [ makecharset::i#7 makecharset::i#1 ] Attempting to uplift remaining variables inzp ZP_BYTE:8 [ doplasma::c1a#2 doplasma::c1a#0 doplasma::c1a#1 ] -Uplifting [doplasma] best 122525 combination zp ZP_BYTE:8 [ doplasma::c1a#2 doplasma::c1a#0 doplasma::c1a#1 ] +Uplifting [doplasma] best 122125 combination zp ZP_BYTE:8 [ doplasma::c1a#2 doplasma::c1a#0 doplasma::c1a#1 ] Attempting to uplift remaining variables inzp ZP_BYTE:11 [ doplasma::c2a#2 doplasma::c2a#0 doplasma::c2a#1 ] -Uplifting [doplasma] best 122525 combination zp ZP_BYTE:11 [ doplasma::c2a#2 doplasma::c2a#0 doplasma::c2a#1 ] +Uplifting [doplasma] best 122125 combination zp ZP_BYTE:11 [ doplasma::c2a#2 doplasma::c2a#0 doplasma::c2a#1 ] Attempting to uplift remaining variables inzp ZP_BYTE:9 [ doplasma::c1b#2 doplasma::c1b#0 doplasma::c1b#1 ] -Uplifting [doplasma] best 122525 combination zp ZP_BYTE:9 [ doplasma::c1b#2 doplasma::c1b#0 doplasma::c1b#1 ] +Uplifting [doplasma] best 122125 combination zp ZP_BYTE:9 [ doplasma::c1b#2 doplasma::c1b#0 doplasma::c1b#1 ] Attempting to uplift remaining variables inzp ZP_BYTE:12 [ doplasma::c2b#2 doplasma::c2b#0 doplasma::c2b#1 ] -Uplifting [doplasma] best 122525 combination zp ZP_BYTE:12 [ doplasma::c2b#2 doplasma::c2b#0 doplasma::c2b#1 ] +Uplifting [doplasma] best 122125 combination zp ZP_BYTE:12 [ doplasma::c2b#2 doplasma::c2b#0 doplasma::c2b#1 ] Attempting to uplift remaining variables inzp ZP_BYTE:31 [ makecharset::s#0 ] -Uplifting [makecharset] best 122525 combination zp ZP_BYTE:31 [ makecharset::s#0 ] +Uplifting [makecharset] best 122125 combination zp ZP_BYTE:31 [ makecharset::s#0 ] Attempting to uplift remaining variables inzp ZP_BYTE:30 [ makecharset::$2 ] -Uplifting [makecharset] best 122485 combination reg byte a [ makecharset::$2 ] -Attempting to uplift remaining variables inzp ZP_BYTE:39 [ makecharset::$11 ] -Uplifting [makecharset] best 122425 combination reg byte a [ makecharset::$11 ] +Uplifting [makecharset] best 122085 combination reg byte a [ makecharset::$2 ] +Attempting to uplift remaining variables inzp ZP_BYTE:41 [ makecharset::$11 ] +Uplifting [makecharset] best 122025 combination reg byte a [ makecharset::$11 ] Attempting to uplift remaining variables inzp ZP_BYTE:4 [ c1A#10 c1A#14 c1A#4 ] -Uplifting [] best 122425 combination zp ZP_BYTE:4 [ c1A#10 c1A#14 c1A#4 ] +Uplifting [] best 122025 combination zp ZP_BYTE:4 [ c1A#10 c1A#14 c1A#4 ] Attempting to uplift remaining variables inzp ZP_BYTE:5 [ c1B#10 c1B#14 c1B#4 ] -Uplifting [] best 122425 combination zp ZP_BYTE:5 [ c1B#10 c1B#14 c1B#4 ] +Uplifting [] best 122025 combination zp ZP_BYTE:5 [ c1B#10 c1B#14 c1B#4 ] Attempting to uplift remaining variables inzp ZP_BYTE:7 [ c2B#24 c2B#14 c2B#4 ] -Uplifting [] best 122425 combination zp ZP_BYTE:7 [ c2B#24 c2B#14 c2B#4 ] +Uplifting [] best 122025 combination zp ZP_BYTE:7 [ c2B#24 c2B#14 c2B#4 ] Attempting to uplift remaining variables inzp ZP_BYTE:6 [ c2A#24 c2A#14 c2A#4 ] -Uplifting [] best 122425 combination zp ZP_BYTE:6 [ c2A#24 c2A#14 c2A#4 ] +Uplifting [] best 122025 combination zp ZP_BYTE:6 [ c2A#24 c2A#14 c2A#4 ] Coalescing zero page register with common assignment [ zp ZP_WORD:35 [ makecharset::$8 ] ] with [ zp ZP_WORD:37 [ makecharset::$9 ] ] - score: 1 +Coalescing zero page register with common assignment [ zp ZP_WORD:35 [ makecharset::$8 makecharset::$9 ] ] with [ zp ZP_WORD:39 [ makecharset::$16 ] ] - score: 1 Coalescing zero page register [ zp ZP_WORD:2 [ main::col#2 main::col#1 ] ] with [ zp ZP_WORD:15 [ doplasma::screen#5 doplasma::screen#10 doplasma::screen#2 ] ] Coalescing zero page register [ zp ZP_WORD:2 [ main::col#2 main::col#1 doplasma::screen#5 doplasma::screen#10 doplasma::screen#2 ] ] with [ zp ZP_WORD:18 [ makecharset::c#2 makecharset::c#1 ] ] Coalescing zero page register [ zp ZP_WORD:2 [ main::col#2 main::col#1 doplasma::screen#5 doplasma::screen#10 doplasma::screen#2 makecharset::c#2 makecharset::c#1 ] ] with [ zp ZP_WORD:25 [ print_cls::sc#2 print_cls::sc#1 ] ] @@ -2908,7 +2920,7 @@ Coalescing zero page register [ zp ZP_BYTE:8 [ doplasma::c1a#2 doplasma::c1a#0 d Coalescing zero page register [ zp ZP_BYTE:9 [ doplasma::c1b#2 doplasma::c1b#0 doplasma::c1b#1 ] ] with [ zp ZP_BYTE:12 [ doplasma::c2b#2 doplasma::c2b#0 doplasma::c2b#1 ] ] Coalescing zero page register [ zp ZP_BYTE:10 [ doplasma::i#2 doplasma::i#1 ] ] with [ zp ZP_BYTE:13 [ doplasma::i1#2 doplasma::i1#1 ] ] Allocated (was zp ZP_WORD:20) zp ZP_WORD:11 [ print_char_cursor#46 print_char_cursor#18 print_char_cursor#1 ] -Allocated (was zp ZP_WORD:35) zp ZP_WORD:13 [ makecharset::$8 makecharset::$9 ] +Allocated (was zp ZP_WORD:35) zp ZP_WORD:13 [ makecharset::$8 makecharset::$9 makecharset::$16 ] ASSEMBLER BEFORE OPTIMIZATION //SEG0 File Comments @@ -3286,6 +3298,7 @@ makecharset: { .label s = 5 .label i = 4 .label c = 2 + .label _16 = $d //SEG126 [56] call sid_rnd_init jsr sid_rnd_init //SEG127 [57] phi from makecharset to makecharset::@10 [phi:makecharset->makecharset::@10] @@ -3294,7 +3307,7 @@ makecharset: { //SEG128 makecharset::@10 b10: //SEG129 [58] call print_cls - //SEG130 [91] phi from makecharset::@10 to print_cls [phi:makecharset::@10->print_cls] + //SEG130 [92] phi from makecharset::@10 to print_cls [phi:makecharset::@10->print_cls] print_cls_from_b10: jsr print_cls //SEG131 [59] phi from makecharset::@10 to makecharset::@1 [phi:makecharset::@10->makecharset::@1] @@ -3404,55 +3417,53 @@ makecharset: { bcc !+ inc _9+1 !: - //SEG168 [75] *((const byte*) CHARSET#0 + (word~) makecharset::$9) ← (byte) makecharset::b#3 -- pbuc1_derefidx_vwuz1=vbuyy - tya - sta !v++1 - lda #CHARSET - adc _9+1 - sta !a++2 - !v: - lda #0 - !a: - sta CHARSET - //SEG169 [76] (byte) makecharset::i#1 ← ++ (byte) makecharset::i#7 -- vbuz1=_inc_vbuz1 + lda _16 + adc #CHARSET + sta _16+1 + //SEG169 [76] *((byte*) makecharset::$16) ← (byte) makecharset::b#3 -- _deref_pbuz1=vbuyy + tya + ldy #0 + sta (_16),y + //SEG170 [77] (byte) makecharset::i#1 ← ++ (byte) makecharset::i#7 -- vbuz1=_inc_vbuz1 inc i - //SEG170 [77] if((byte) makecharset::i#1<(byte/signed byte/word/signed word/dword/signed dword) 8) goto makecharset::@2 -- vbuz1_lt_vbuc1_then_la1 + //SEG171 [78] if((byte) makecharset::i#1<(byte/signed byte/word/signed word/dword/signed dword) 8) goto makecharset::@2 -- vbuz1_lt_vbuc1_then_la1 lda i cmp #8 bcc b2_from_b6 jmp b7 - //SEG171 makecharset::@7 + //SEG172 makecharset::@7 b7: - //SEG172 [78] (byte/word~) makecharset::$11 ← (word) makecharset::c#2 & (byte/signed byte/word/signed word/dword/signed dword) 7 -- vbuaa=vwuz1_band_vbuc1 + //SEG173 [79] (byte/word~) makecharset::$11 ← (word) makecharset::c#2 & (byte/signed byte/word/signed word/dword/signed dword) 7 -- vbuaa=vwuz1_band_vbuc1 lda c and #7 - //SEG173 [79] if((byte/word~) makecharset::$11!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto makecharset::@9 -- vbuaa_neq_0_then_la1 + //SEG174 [80] if((byte/word~) makecharset::$11!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto makecharset::@9 -- vbuaa_neq_0_then_la1 cmp #0 bne b9_from_b7 - //SEG174 [80] phi from makecharset::@7 to makecharset::@8 [phi:makecharset::@7->makecharset::@8] + //SEG175 [81] phi from makecharset::@7 to makecharset::@8 [phi:makecharset::@7->makecharset::@8] b8_from_b7: jmp b8 - //SEG175 makecharset::@8 + //SEG176 makecharset::@8 b8: - //SEG176 [81] call print_char + //SEG177 [82] call print_char jsr print_char - //SEG177 [82] phi from makecharset::@7 makecharset::@8 to makecharset::@9 [phi:makecharset::@7/makecharset::@8->makecharset::@9] + //SEG178 [83] phi from makecharset::@7 makecharset::@8 to makecharset::@9 [phi:makecharset::@7/makecharset::@8->makecharset::@9] b9_from_b7: b9_from_b8: - //SEG178 [82] phi (byte*) print_char_cursor#18 = (byte*) print_char_cursor#46 [phi:makecharset::@7/makecharset::@8->makecharset::@9#0] -- register_copy + //SEG179 [83] phi (byte*) print_char_cursor#18 = (byte*) print_char_cursor#46 [phi:makecharset::@7/makecharset::@8->makecharset::@9#0] -- register_copy jmp b9 - //SEG179 makecharset::@9 + //SEG180 makecharset::@9 b9: - //SEG180 [83] (word) makecharset::c#1 ← ++ (word) makecharset::c#2 -- vwuz1=_inc_vwuz1 + //SEG181 [84] (word) makecharset::c#1 ← ++ (word) makecharset::c#2 -- vwuz1=_inc_vwuz1 inc c bne !+ inc c+1 !: - //SEG181 [84] if((word) makecharset::c#1<(word/signed word/dword/signed dword) $100) goto makecharset::@1 -- vwuz1_lt_vwuc1_then_la1 + //SEG182 [85] if((word) makecharset::c#1<(word/signed word/dword/signed dword) $100) goto makecharset::@1 -- vwuz1_lt_vwuc1_then_la1 lda c+1 cmp #>$100 bcc b1_from_b9 @@ -3462,71 +3473,71 @@ makecharset: { bcc b1_from_b9 !: jmp breturn - //SEG182 makecharset::@return + //SEG183 makecharset::@return breturn: - //SEG183 [85] return + //SEG184 [86] return rts bittab: .byte 1, 2, 4, 8, $10, $20, $40, $80 } -//SEG184 print_char +//SEG185 print_char // Print a single char print_char: { .const ch = '.' - //SEG185 [86] *((byte*) print_char_cursor#46) ← (const byte) print_char::ch#0 -- _deref_pbuz1=vbuc1 + //SEG186 [87] *((byte*) print_char_cursor#46) ← (const byte) print_char::ch#0 -- _deref_pbuz1=vbuc1 lda #ch ldy #0 sta (print_char_cursor),y - //SEG186 [87] (byte*) print_char_cursor#1 ← ++ (byte*) print_char_cursor#46 -- pbuz1=_inc_pbuz1 + //SEG187 [88] (byte*) print_char_cursor#1 ← ++ (byte*) print_char_cursor#46 -- pbuz1=_inc_pbuz1 inc print_char_cursor bne !+ inc print_char_cursor+1 !: jmp breturn - //SEG187 print_char::@return + //SEG188 print_char::@return breturn: - //SEG188 [88] return + //SEG189 [89] return rts } -//SEG189 sid_rnd +//SEG190 sid_rnd // Get a random number from the SID voice 3, // Must be initialized with sid_rnd_init() sid_rnd: { - //SEG190 [89] (byte) sid_rnd::return#0 ← *((const byte*) SID_VOICE3_OSC#0) -- vbuaa=_deref_pbuc1 + //SEG191 [90] (byte) sid_rnd::return#0 ← *((const byte*) SID_VOICE3_OSC#0) -- vbuaa=_deref_pbuc1 lda SID_VOICE3_OSC jmp breturn - //SEG191 sid_rnd::@return + //SEG192 sid_rnd::@return breturn: - //SEG192 [90] return + //SEG193 [91] return rts } -//SEG193 print_cls +//SEG194 print_cls // Clear the screen. Also resets current line/char cursor. print_cls: { .label sc = 2 - //SEG194 [92] phi from print_cls to print_cls::@1 [phi:print_cls->print_cls::@1] + //SEG195 [93] phi from print_cls to print_cls::@1 [phi:print_cls->print_cls::@1] b1_from_print_cls: - //SEG195 [92] phi (byte*) print_cls::sc#2 = (const byte*) print_line_cursor#0 [phi:print_cls->print_cls::@1#0] -- pbuz1=pbuc1 + //SEG196 [93] phi (byte*) print_cls::sc#2 = (const byte*) print_line_cursor#0 [phi:print_cls->print_cls::@1#0] -- pbuz1=pbuc1 lda #print_line_cursor sta sc+1 jmp b1 - //SEG196 [92] phi from print_cls::@1 to print_cls::@1 [phi:print_cls::@1->print_cls::@1] + //SEG197 [93] phi from print_cls::@1 to print_cls::@1 [phi:print_cls::@1->print_cls::@1] b1_from_b1: - //SEG197 [92] phi (byte*) print_cls::sc#2 = (byte*) print_cls::sc#1 [phi:print_cls::@1->print_cls::@1#0] -- register_copy + //SEG198 [93] phi (byte*) print_cls::sc#2 = (byte*) print_cls::sc#1 [phi:print_cls::@1->print_cls::@1#0] -- register_copy jmp b1 - //SEG198 print_cls::@1 + //SEG199 print_cls::@1 b1: - //SEG199 [93] *((byte*) print_cls::sc#2) ← (byte) ' ' -- _deref_pbuz1=vbuc1 + //SEG200 [94] *((byte*) print_cls::sc#2) ← (byte) ' ' -- _deref_pbuz1=vbuc1 lda #' ' ldy #0 sta (sc),y - //SEG200 [94] (byte*) print_cls::sc#1 ← ++ (byte*) print_cls::sc#2 -- pbuz1=_inc_pbuz1 + //SEG201 [95] (byte*) print_cls::sc#1 ← ++ (byte*) print_cls::sc#2 -- pbuz1=_inc_pbuz1 inc sc bne !+ inc sc+1 !: - //SEG201 [95] if((byte*) print_cls::sc#1!=(const byte*) print_line_cursor#0+(word/signed word/dword/signed dword) $3e8) goto print_cls::@1 -- pbuz1_neq_pbuc1_then_la1 + //SEG202 [96] if((byte*) print_cls::sc#1!=(const byte*) print_line_cursor#0+(word/signed word/dword/signed dword) $3e8) goto print_cls::@1 -- pbuz1_neq_pbuc1_then_la1 lda sc+1 cmp #>print_line_cursor+$3e8 bne b1_from_b1 @@ -3534,26 +3545,26 @@ print_cls: { cmp #$ffff sta SID_VOICE3_FREQ+1 - //SEG206 [98] *((const byte*) SID_VOICE3_CONTROL#0) ← (const byte) SID_CONTROL_NOISE#0 -- _deref_pbuc1=vbuc2 + //SEG207 [99] *((const byte*) SID_VOICE3_CONTROL#0) ← (const byte) SID_CONTROL_NOISE#0 -- _deref_pbuc1=vbuc2 lda #SID_CONTROL_NOISE sta SID_VOICE3_CONTROL jmp breturn - //SEG207 sid_rnd_init::@return + //SEG208 sid_rnd_init::@return breturn: - //SEG208 [99] return + //SEG209 [100] return rts } .pc = SINTABLE "SINTABLE" @@ -3697,7 +3708,6 @@ Removing instruction jmp b1 Succesful ASM optimization Pass5NextJumpElimination Removing instruction bbegin: Succesful ASM optimization Pass5UnusedLabelElimination -Fixing long branch [268] bcc b1 to bcs FINAL SYMBOL TABLE (label) @1 @@ -3836,6 +3846,7 @@ FINAL SYMBOL TABLE (byte*) main::toD0182_screen (void()) makecharset((byte*) makecharset::charset) (byte/word~) makecharset::$11 reg byte a 22.0 +(byte*) makecharset::$16 $16 zp ZP_WORD:13 202.0 (byte~) makecharset::$2 reg byte a 22.0 (byte~) makecharset::$3 reg byte a 2002.0 (byte~) makecharset::$4 $4 zp ZP_BYTE:6 2002.0 @@ -3856,21 +3867,21 @@ FINAL SYMBOL TABLE (byte) makecharset::b (byte) makecharset::b#1 reg byte y 2002.0 (byte) makecharset::b#2 reg byte y 500.5 -(byte) makecharset::b#3 reg byte y 620.8 +(byte) makecharset::b#3 reg byte y 517.3333333333334 (byte[8]) makecharset::bittab (const byte[8]) makecharset::bittab#0 bittab = { (byte/signed byte/word/signed word/dword/signed dword) 1, (byte/signed byte/word/signed word/dword/signed dword) 2, (byte/signed byte/word/signed word/dword/signed dword) 4, (byte/signed byte/word/signed word/dword/signed dword) 8, (byte/signed byte/word/signed word/dword/signed dword) $10, (byte/signed byte/word/signed word/dword/signed dword) $20, (byte/signed byte/word/signed word/dword/signed dword) $40, (byte/word/signed word/dword/signed dword) $80 } (word) makecharset::c (word) makecharset::c#1 c zp ZP_WORD:2 16.5 -(word) makecharset::c#2 c zp ZP_WORD:2 6.041666666666666 +(word) makecharset::c#2 c zp ZP_WORD:2 5.800000000000001 (byte*) makecharset::charset (byte) makecharset::i (byte) makecharset::i#1 i zp ZP_BYTE:4 151.5 -(byte) makecharset::i#7 i zp ZP_BYTE:4 21.642857142857142 +(byte) makecharset::i#7 i zp ZP_BYTE:4 20.2 (byte) makecharset::ii (byte) makecharset::ii#1 reg byte x 1501.5 (byte) makecharset::ii#2 reg byte x 375.375 (byte) makecharset::s -(byte) makecharset::s#0 s zp ZP_BYTE:5 59.529411764705884 +(byte) makecharset::s#0 s zp ZP_BYTE:5 56.22222222222223 (void()) print_char((byte) print_char::ch) (label) print_char::@return (byte) print_char::ch @@ -3878,7 +3889,7 @@ FINAL SYMBOL TABLE (byte*) print_char_cursor (byte*) print_char_cursor#1 print_char_cursor zp ZP_WORD:11 4.333333333333333 (byte*) print_char_cursor#18 print_char_cursor zp ZP_WORD:11 11.0 -(byte*) print_char_cursor#46 print_char_cursor zp ZP_WORD:11 1.1304347826086956 +(byte*) print_char_cursor#46 print_char_cursor zp ZP_WORD:11 1.0833333333333333 (void()) print_cls() (label) print_cls::@1 (label) print_cls::@return @@ -3915,13 +3926,13 @@ reg byte a [ doplasma::$4 ] reg byte a [ makecharset::$2 ] reg byte a [ sid_rnd::return#2 ] reg byte a [ makecharset::$3 ] -zp ZP_WORD:13 [ makecharset::$8 makecharset::$9 ] +zp ZP_WORD:13 [ makecharset::$8 makecharset::$9 makecharset::$16 ] reg byte a [ makecharset::$11 ] reg byte a [ sid_rnd::return#0 ] FINAL ASSEMBLER -Score: 91186 +Score: 90756 //SEG0 File Comments // A KickC version of the plasma routine from the CC65 samples @@ -4234,12 +4245,13 @@ makecharset: { .label s = 5 .label i = 4 .label c = 2 + .label _16 = $d //SEG126 [56] call sid_rnd_init jsr sid_rnd_init //SEG127 [57] phi from makecharset to makecharset::@10 [phi:makecharset->makecharset::@10] //SEG128 makecharset::@10 //SEG129 [58] call print_cls - //SEG130 [91] phi from makecharset::@10 to print_cls [phi:makecharset::@10->print_cls] + //SEG130 [92] phi from makecharset::@10 to print_cls [phi:makecharset::@10->print_cls] jsr print_cls //SEG131 [59] phi from makecharset::@10 to makecharset::@1 [phi:makecharset::@10->makecharset::@1] //SEG132 [59] phi (byte*) print_char_cursor#46 = (const byte*) print_line_cursor#0 [phi:makecharset::@10->makecharset::@1#0] -- pbuz1=pbuc1 @@ -4326,136 +4338,132 @@ makecharset: { bcc !+ inc _9+1 !: - //SEG168 [75] *((const byte*) CHARSET#0 + (word~) makecharset::$9) ← (byte) makecharset::b#3 -- pbuc1_derefidx_vwuz1=vbuyy - tya - sta !v++1 - lda #CHARSET - adc _9+1 - sta !a++2 - !v: - lda #0 - !a: - sta CHARSET - //SEG169 [76] (byte) makecharset::i#1 ← ++ (byte) makecharset::i#7 -- vbuz1=_inc_vbuz1 + lda _16 + adc #CHARSET + sta _16+1 + //SEG169 [76] *((byte*) makecharset::$16) ← (byte) makecharset::b#3 -- _deref_pbuz1=vbuyy + tya + ldy #0 + sta (_16),y + //SEG170 [77] (byte) makecharset::i#1 ← ++ (byte) makecharset::i#7 -- vbuz1=_inc_vbuz1 inc i - //SEG170 [77] if((byte) makecharset::i#1<(byte/signed byte/word/signed word/dword/signed dword) 8) goto makecharset::@2 -- vbuz1_lt_vbuc1_then_la1 + //SEG171 [78] if((byte) makecharset::i#1<(byte/signed byte/word/signed word/dword/signed dword) 8) goto makecharset::@2 -- vbuz1_lt_vbuc1_then_la1 lda i cmp #8 bcc b2 - //SEG171 makecharset::@7 - //SEG172 [78] (byte/word~) makecharset::$11 ← (word) makecharset::c#2 & (byte/signed byte/word/signed word/dword/signed dword) 7 -- vbuaa=vwuz1_band_vbuc1 + //SEG172 makecharset::@7 + //SEG173 [79] (byte/word~) makecharset::$11 ← (word) makecharset::c#2 & (byte/signed byte/word/signed word/dword/signed dword) 7 -- vbuaa=vwuz1_band_vbuc1 lda c and #7 - //SEG173 [79] if((byte/word~) makecharset::$11!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto makecharset::@9 -- vbuaa_neq_0_then_la1 + //SEG174 [80] if((byte/word~) makecharset::$11!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto makecharset::@9 -- vbuaa_neq_0_then_la1 cmp #0 bne b9 - //SEG174 [80] phi from makecharset::@7 to makecharset::@8 [phi:makecharset::@7->makecharset::@8] - //SEG175 makecharset::@8 - //SEG176 [81] call print_char + //SEG175 [81] phi from makecharset::@7 to makecharset::@8 [phi:makecharset::@7->makecharset::@8] + //SEG176 makecharset::@8 + //SEG177 [82] call print_char jsr print_char - //SEG177 [82] phi from makecharset::@7 makecharset::@8 to makecharset::@9 [phi:makecharset::@7/makecharset::@8->makecharset::@9] - //SEG178 [82] phi (byte*) print_char_cursor#18 = (byte*) print_char_cursor#46 [phi:makecharset::@7/makecharset::@8->makecharset::@9#0] -- register_copy - //SEG179 makecharset::@9 + //SEG178 [83] phi from makecharset::@7 makecharset::@8 to makecharset::@9 [phi:makecharset::@7/makecharset::@8->makecharset::@9] + //SEG179 [83] phi (byte*) print_char_cursor#18 = (byte*) print_char_cursor#46 [phi:makecharset::@7/makecharset::@8->makecharset::@9#0] -- register_copy + //SEG180 makecharset::@9 b9: - //SEG180 [83] (word) makecharset::c#1 ← ++ (word) makecharset::c#2 -- vwuz1=_inc_vwuz1 + //SEG181 [84] (word) makecharset::c#1 ← ++ (word) makecharset::c#2 -- vwuz1=_inc_vwuz1 inc c bne !+ inc c+1 !: - //SEG181 [84] if((word) makecharset::c#1<(word/signed word/dword/signed dword) $100) goto makecharset::@1 -- vwuz1_lt_vwuc1_then_la1 + //SEG182 [85] if((word) makecharset::c#1<(word/signed word/dword/signed dword) $100) goto makecharset::@1 -- vwuz1_lt_vwuc1_then_la1 lda c+1 cmp #>$100 bcc b1 bne !+ lda c cmp #<$100 - bcs !b1+ - jmp b1 - !b1: + bcc b1 !: - //SEG182 makecharset::@return - //SEG183 [85] return + //SEG183 makecharset::@return + //SEG184 [86] return rts bittab: .byte 1, 2, 4, 8, $10, $20, $40, $80 } -//SEG184 print_char +//SEG185 print_char // Print a single char print_char: { .const ch = '.' - //SEG185 [86] *((byte*) print_char_cursor#46) ← (const byte) print_char::ch#0 -- _deref_pbuz1=vbuc1 + //SEG186 [87] *((byte*) print_char_cursor#46) ← (const byte) print_char::ch#0 -- _deref_pbuz1=vbuc1 lda #ch ldy #0 sta (print_char_cursor),y - //SEG186 [87] (byte*) print_char_cursor#1 ← ++ (byte*) print_char_cursor#46 -- pbuz1=_inc_pbuz1 + //SEG187 [88] (byte*) print_char_cursor#1 ← ++ (byte*) print_char_cursor#46 -- pbuz1=_inc_pbuz1 inc print_char_cursor bne !+ inc print_char_cursor+1 !: - //SEG187 print_char::@return - //SEG188 [88] return + //SEG188 print_char::@return + //SEG189 [89] return rts } -//SEG189 sid_rnd +//SEG190 sid_rnd // Get a random number from the SID voice 3, // Must be initialized with sid_rnd_init() sid_rnd: { - //SEG190 [89] (byte) sid_rnd::return#0 ← *((const byte*) SID_VOICE3_OSC#0) -- vbuaa=_deref_pbuc1 + //SEG191 [90] (byte) sid_rnd::return#0 ← *((const byte*) SID_VOICE3_OSC#0) -- vbuaa=_deref_pbuc1 lda SID_VOICE3_OSC - //SEG191 sid_rnd::@return - //SEG192 [90] return + //SEG192 sid_rnd::@return + //SEG193 [91] return rts } -//SEG193 print_cls +//SEG194 print_cls // Clear the screen. Also resets current line/char cursor. print_cls: { .label sc = 2 - //SEG194 [92] phi from print_cls to print_cls::@1 [phi:print_cls->print_cls::@1] - //SEG195 [92] phi (byte*) print_cls::sc#2 = (const byte*) print_line_cursor#0 [phi:print_cls->print_cls::@1#0] -- pbuz1=pbuc1 + //SEG195 [93] phi from print_cls to print_cls::@1 [phi:print_cls->print_cls::@1] + //SEG196 [93] phi (byte*) print_cls::sc#2 = (const byte*) print_line_cursor#0 [phi:print_cls->print_cls::@1#0] -- pbuz1=pbuc1 lda #print_line_cursor sta sc+1 - //SEG196 [92] phi from print_cls::@1 to print_cls::@1 [phi:print_cls::@1->print_cls::@1] - //SEG197 [92] phi (byte*) print_cls::sc#2 = (byte*) print_cls::sc#1 [phi:print_cls::@1->print_cls::@1#0] -- register_copy - //SEG198 print_cls::@1 + //SEG197 [93] phi from print_cls::@1 to print_cls::@1 [phi:print_cls::@1->print_cls::@1] + //SEG198 [93] phi (byte*) print_cls::sc#2 = (byte*) print_cls::sc#1 [phi:print_cls::@1->print_cls::@1#0] -- register_copy + //SEG199 print_cls::@1 b1: - //SEG199 [93] *((byte*) print_cls::sc#2) ← (byte) ' ' -- _deref_pbuz1=vbuc1 + //SEG200 [94] *((byte*) print_cls::sc#2) ← (byte) ' ' -- _deref_pbuz1=vbuc1 lda #' ' ldy #0 sta (sc),y - //SEG200 [94] (byte*) print_cls::sc#1 ← ++ (byte*) print_cls::sc#2 -- pbuz1=_inc_pbuz1 + //SEG201 [95] (byte*) print_cls::sc#1 ← ++ (byte*) print_cls::sc#2 -- pbuz1=_inc_pbuz1 inc sc bne !+ inc sc+1 !: - //SEG201 [95] if((byte*) print_cls::sc#1!=(const byte*) print_line_cursor#0+(word/signed word/dword/signed dword) $3e8) goto print_cls::@1 -- pbuz1_neq_pbuc1_then_la1 + //SEG202 [96] if((byte*) print_cls::sc#1!=(const byte*) print_line_cursor#0+(word/signed word/dword/signed dword) $3e8) goto print_cls::@1 -- pbuz1_neq_pbuc1_then_la1 lda sc+1 cmp #>print_line_cursor+$3e8 bne b1 lda sc cmp #$ffff sta SID_VOICE3_FREQ+1 - //SEG206 [98] *((const byte*) SID_VOICE3_CONTROL#0) ← (const byte) SID_CONTROL_NOISE#0 -- _deref_pbuc1=vbuc2 + //SEG207 [99] *((const byte*) SID_VOICE3_CONTROL#0) ← (const byte) SID_CONTROL_NOISE#0 -- _deref_pbuc1=vbuc2 lda #SID_CONTROL_NOISE sta SID_VOICE3_CONTROL - //SEG207 sid_rnd_init::@return - //SEG208 [99] return + //SEG208 sid_rnd_init::@return + //SEG209 [100] return rts } .pc = SINTABLE "SINTABLE" diff --git a/src/test/ref/examples/plasma/plasma.sym b/src/test/ref/examples/plasma/plasma.sym index 41cf7aef9..37525d75b 100644 --- a/src/test/ref/examples/plasma/plasma.sym +++ b/src/test/ref/examples/plasma/plasma.sym @@ -134,6 +134,7 @@ (byte*) main::toD0182_screen (void()) makecharset((byte*) makecharset::charset) (byte/word~) makecharset::$11 reg byte a 22.0 +(byte*) makecharset::$16 $16 zp ZP_WORD:13 202.0 (byte~) makecharset::$2 reg byte a 22.0 (byte~) makecharset::$3 reg byte a 2002.0 (byte~) makecharset::$4 $4 zp ZP_BYTE:6 2002.0 @@ -154,21 +155,21 @@ (byte) makecharset::b (byte) makecharset::b#1 reg byte y 2002.0 (byte) makecharset::b#2 reg byte y 500.5 -(byte) makecharset::b#3 reg byte y 620.8 +(byte) makecharset::b#3 reg byte y 517.3333333333334 (byte[8]) makecharset::bittab (const byte[8]) makecharset::bittab#0 bittab = { (byte/signed byte/word/signed word/dword/signed dword) 1, (byte/signed byte/word/signed word/dword/signed dword) 2, (byte/signed byte/word/signed word/dword/signed dword) 4, (byte/signed byte/word/signed word/dword/signed dword) 8, (byte/signed byte/word/signed word/dword/signed dword) $10, (byte/signed byte/word/signed word/dword/signed dword) $20, (byte/signed byte/word/signed word/dword/signed dword) $40, (byte/word/signed word/dword/signed dword) $80 } (word) makecharset::c (word) makecharset::c#1 c zp ZP_WORD:2 16.5 -(word) makecharset::c#2 c zp ZP_WORD:2 6.041666666666666 +(word) makecharset::c#2 c zp ZP_WORD:2 5.800000000000001 (byte*) makecharset::charset (byte) makecharset::i (byte) makecharset::i#1 i zp ZP_BYTE:4 151.5 -(byte) makecharset::i#7 i zp ZP_BYTE:4 21.642857142857142 +(byte) makecharset::i#7 i zp ZP_BYTE:4 20.2 (byte) makecharset::ii (byte) makecharset::ii#1 reg byte x 1501.5 (byte) makecharset::ii#2 reg byte x 375.375 (byte) makecharset::s -(byte) makecharset::s#0 s zp ZP_BYTE:5 59.529411764705884 +(byte) makecharset::s#0 s zp ZP_BYTE:5 56.22222222222223 (void()) print_char((byte) print_char::ch) (label) print_char::@return (byte) print_char::ch @@ -176,7 +177,7 @@ (byte*) print_char_cursor (byte*) print_char_cursor#1 print_char_cursor zp ZP_WORD:11 4.333333333333333 (byte*) print_char_cursor#18 print_char_cursor zp ZP_WORD:11 11.0 -(byte*) print_char_cursor#46 print_char_cursor zp ZP_WORD:11 1.1304347826086956 +(byte*) print_char_cursor#46 print_char_cursor zp ZP_WORD:11 1.0833333333333333 (void()) print_cls() (label) print_cls::@1 (label) print_cls::@return @@ -213,6 +214,6 @@ reg byte a [ doplasma::$4 ] reg byte a [ makecharset::$2 ] reg byte a [ sid_rnd::return#2 ] reg byte a [ makecharset::$3 ] -zp ZP_WORD:13 [ makecharset::$8 makecharset::$9 ] +zp ZP_WORD:13 [ makecharset::$8 makecharset::$9 makecharset::$16 ] reg byte a [ makecharset::$11 ] reg byte a [ sid_rnd::return#0 ] diff --git a/src/test/ref/irq-idx-problem.log b/src/test/ref/irq-idx-problem.log index 91b5fa32c..cd064f503 100644 --- a/src/test/ref/irq-idx-problem.log +++ b/src/test/ref/irq-idx-problem.log @@ -227,17 +227,23 @@ if() condition always true - replacing block destination [26] if(true) goto tabl Successful SSA optimization Pass2ConstantIfs Eliminating unused variable - keeping the phi block (byte) irq_idx#3 Successful SSA optimization PassNEliminateUnusedVars +De-inlining pointer[w] to *(pointer+w) *((const byte*) SCREEN#0+-(const byte) VIC_SIZE#0 + (word/signed word/dword/signed dword~) table_driven_irq::$6) ← (byte) table_driven_irq::val#0 +Successful SSA optimization Pass2DeInlineWordDerefIdx Culled Empty Block (label) @4 Culled Empty Block (label) table_driven_irq::@4 Culled Empty Block (label) table_driven_irq::@8 Successful SSA optimization Pass2CullEmptyBlocks Alias (word/signed word/dword/signed dword~) table_driven_irq::$6 = (word/signed word/dword/signed dword~) table_driven_irq::$5 Successful SSA optimization Pass2AliasElimination -Consolidated array index constant in assignment *(SCREEN#0+-VIC_SIZE#0+$3f8 + table_driven_irq::$6) +Consolidated constant in assignment table_driven_irq::$7 Successful SSA optimization Pass2ConstantAdditionElimination Inferred type updated to byte in [17] (word/signed word/dword/signed dword~) table_driven_irq::$6 ← (byte) table_driven_irq::idx#0 +Converting *(pointer+n) to pointer[n] *((byte*) table_driven_irq::$7) ← (byte) table_driven_irq::val#0 -- *(SCREEN#0+-VIC_SIZE#0+$3f8 + table_driven_irq::$6) +Successful SSA optimization Pass2InlineDerefIdx Alias (byte) table_driven_irq::idx#0 = (byte~) table_driven_irq::$6 Successful SSA optimization Pass2AliasElimination +Eliminating unused variable (byte*) table_driven_irq::$7 and assignment [17] (byte*) table_driven_irq::$7 ← (const byte*) SCREEN#0+-(const byte) VIC_SIZE#0+(word/signed word/dword/signed dword) $3f8 + (byte) table_driven_irq::idx#0 +Successful SSA optimization PassNEliminateUnusedVars Constant inlined table_driven_irq::$1 = (const byte) VIC_SIZE#0+(byte/signed byte/word/signed word/dword/signed dword) 8 Constant inlined main::$0 = &interrupt(KERNEL_MIN)(void()) table_driven_irq() Successful SSA optimization Pass2ConstantInlining diff --git a/src/test/ref/scan-desire-problem.asm b/src/test/ref/scan-desire-problem.asm index a60696316..248cffd38 100644 --- a/src/test/ref/scan-desire-problem.asm +++ b/src/test/ref/scan-desire-problem.asm @@ -61,6 +61,14 @@ draw_block: { .label x1 = 9 .label z = 4 .label z_1 = 9 + .label _11 = 4 + .label _12 = 4 + .label _13 = 4 + .label _14 = 4 + .label _15 = 4 + .label _16 = 4 + .label _17 = 4 + .label _18 = 9 asl asl sta tileno @@ -81,89 +89,80 @@ draw_block: { adc z+1 sta z_1+1 ldy tileno - lda tileset,y - sta !v++1 - lda #screen - adc z_1+1 - sta !a++2 - !v: - lda #0 - !a: - sta screen - lda #screen + sta _11+1 + txa + ldy #0 + sta (_11),y + lda z_1 clc - adc z_1 - sta !++1 - lda #>colors - adc z_1+1 - sta !++2 + adc #colors + sta _12+1 lda #YELLOW - !: - sta colors - lda #screen+1 - adc z_1+1 - sta !++2 + adc #screen+1 + sta _13+1 lda #1 - !: - sta screen+1 - lda #colors+1 - adc z_1+1 - sta !++2 + adc #colors+1 + sta _14+1 lda #YELLOW - !: - sta colors+1 - lda #screen+$28 - adc z_1+1 - sta !++2 + adc #screen+$28 + sta _15+1 lda #2 - !: - sta screen+$28 - lda #colors+$28 - adc z_1+1 - sta !++2 + adc #colors+$28 + sta _16+1 lda #YELLOW - !: - sta colors+$28 - lda #screen+$29 - adc z_1+1 - sta !++2 + adc #screen+$29 + sta _17+1 lda #3 - !: - sta screen+$29 - lda #colors+$29 - adc z_1+1 - sta !++2 + lda _18 + adc #colors+$29 + sta _18+1 lda #YELLOW - !: - sta colors+$29 + sta (_18),y rts } // Perform binary multiplication of two unsigned 8-bit bytes into a 16-bit unsigned word diff --git a/src/test/ref/scan-desire-problem.cfg b/src/test/ref/scan-desire-problem.cfg index bb3c25de7..750ad6403 100644 --- a/src/test/ref/scan-desire-problem.cfg +++ b/src/test/ref/scan-desire-problem.cfg @@ -47,91 +47,99 @@ draw_block::@1: scope:[draw_block] from draw_block [26] (word) draw_block::z#0 ← (word) mul8u::return#2 [27] (word) draw_block::z#1 ← (word) draw_block::z#0 + (word) draw_block::x1#0 [28] (byte) draw_block::drawtile#0 ← *((const byte*) tileset#0 + (byte) draw_block::tileno#1) - [29] *((const byte*) screen#0 + (word) draw_block::z#1) ← (byte) draw_block::drawtile#0 - [30] *((const byte*) colors#0 + (word) draw_block::z#1) ← (const byte) YELLOW#0 - [31] *((const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) 1 + (word) draw_block::z#1) ← (byte/signed byte/word/signed word/dword/signed dword) 1 - [32] *((const byte*) colors#0+(byte/signed byte/word/signed word/dword/signed dword) 1 + (word) draw_block::z#1) ← (const byte) YELLOW#0 - [33] *((const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) $28 + (word) draw_block::z#1) ← (byte/signed byte/word/signed word/dword/signed dword) 2 - [34] *((const byte*) colors#0+(byte/signed byte/word/signed word/dword/signed dword) $28 + (word) draw_block::z#1) ← (const byte) YELLOW#0 - [35] *((const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) $29 + (word) draw_block::z#1) ← (byte/signed byte/word/signed word/dword/signed dword) 3 - [36] *((const byte*) colors#0+(byte/signed byte/word/signed word/dword/signed dword) $29 + (word) draw_block::z#1) ← (const byte) YELLOW#0 + [29] (byte*) draw_block::$11 ← (const byte*) screen#0 + (word) draw_block::z#1 + [30] *((byte*) draw_block::$11) ← (byte) draw_block::drawtile#0 + [31] (byte*) draw_block::$12 ← (const byte*) colors#0 + (word) draw_block::z#1 + [32] *((byte*) draw_block::$12) ← (const byte) YELLOW#0 + [33] (byte*) draw_block::$13 ← (const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) 1 + (word) draw_block::z#1 + [34] *((byte*) draw_block::$13) ← (byte/signed byte/word/signed word/dword/signed dword) 1 + [35] (byte*) draw_block::$14 ← (const byte*) colors#0+(byte/signed byte/word/signed word/dword/signed dword) 1 + (word) draw_block::z#1 + [36] *((byte*) draw_block::$14) ← (const byte) YELLOW#0 + [37] (byte*) draw_block::$15 ← (const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) $28 + (word) draw_block::z#1 + [38] *((byte*) draw_block::$15) ← (byte/signed byte/word/signed word/dword/signed dword) 2 + [39] (byte*) draw_block::$16 ← (const byte*) colors#0+(byte/signed byte/word/signed word/dword/signed dword) $28 + (word) draw_block::z#1 + [40] *((byte*) draw_block::$16) ← (const byte) YELLOW#0 + [41] (byte*) draw_block::$17 ← (const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) $29 + (word) draw_block::z#1 + [42] *((byte*) draw_block::$17) ← (byte/signed byte/word/signed word/dword/signed dword) 3 + [43] (byte*) draw_block::$18 ← (const byte*) colors#0+(byte/signed byte/word/signed word/dword/signed dword) $29 + (word) draw_block::z#1 + [44] *((byte*) draw_block::$18) ← (const byte) YELLOW#0 to:draw_block::@return draw_block::@return: scope:[draw_block] from draw_block::@1 - [37] return + [45] return to:@return mul8u: scope:[mul8u] from draw_block - [38] phi() + [46] phi() to:mul8u::@1 mul8u::@1: scope:[mul8u] from mul8u mul8u::@3 - [39] (word) mul8u::mb#2 ← phi( mul8u/((word))(const byte) mul8u::b#0 mul8u::@3/(word) mul8u::mb#1 ) - [39] (word) mul8u::res#2 ← phi( mul8u/(byte/signed byte/word/signed word/dword/signed dword) 0 mul8u::@3/(word) mul8u::res#6 ) - [39] (byte) mul8u::a#2 ← phi( mul8u/(byte) mul8u::a#1 mul8u::@3/(byte) mul8u::a#0 ) - [40] if((byte) mul8u::a#2!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto mul8u::@2 + [47] (word) mul8u::mb#2 ← phi( mul8u/((word))(const byte) mul8u::b#0 mul8u::@3/(word) mul8u::mb#1 ) + [47] (word) mul8u::res#2 ← phi( mul8u/(byte/signed byte/word/signed word/dword/signed dword) 0 mul8u::@3/(word) mul8u::res#6 ) + [47] (byte) mul8u::a#2 ← phi( mul8u/(byte) mul8u::a#1 mul8u::@3/(byte) mul8u::a#0 ) + [48] if((byte) mul8u::a#2!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto mul8u::@2 to:mul8u::@return mul8u::@return: scope:[mul8u] from mul8u::@1 - [41] return + [49] return to:@return mul8u::@2: scope:[mul8u] from mul8u::@1 - [42] (byte~) mul8u::$1 ← (byte) mul8u::a#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 - [43] if((byte~) mul8u::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto mul8u::@3 + [50] (byte~) mul8u::$1 ← (byte) mul8u::a#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 + [51] if((byte~) mul8u::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto mul8u::@3 to:mul8u::@4 mul8u::@4: scope:[mul8u] from mul8u::@2 - [44] (word) mul8u::res#1 ← (word) mul8u::res#2 + (word) mul8u::mb#2 + [52] (word) mul8u::res#1 ← (word) mul8u::res#2 + (word) mul8u::mb#2 to:mul8u::@3 mul8u::@3: scope:[mul8u] from mul8u::@2 mul8u::@4 - [45] (word) mul8u::res#6 ← phi( mul8u::@2/(word) mul8u::res#2 mul8u::@4/(word) mul8u::res#1 ) - [46] (byte) mul8u::a#0 ← (byte) mul8u::a#2 >> (byte/signed byte/word/signed word/dword/signed dword) 1 - [47] (word) mul8u::mb#1 ← (word) mul8u::mb#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 + [53] (word) mul8u::res#6 ← phi( mul8u::@2/(word) mul8u::res#2 mul8u::@4/(word) mul8u::res#1 ) + [54] (byte) mul8u::a#0 ← (byte) mul8u::a#2 >> (byte/signed byte/word/signed word/dword/signed dword) 1 + [55] (word) mul8u::mb#1 ← (word) mul8u::mb#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 to:mul8u::@1 init: scope:[init] from main - [48] phi() - [49] call init_sprites + [56] phi() + [57] call init_sprites to:init::@2 init::@2: scope:[init] from init - [50] phi() - [51] call fill + [58] phi() + [59] call fill to:init::@3 init::@3: scope:[init] from init::@2 - [52] phi() - [53] call fill + [60] phi() + [61] call fill to:init::toD0181 init::toD0181: scope:[init] from init::@3 - [54] phi() + [62] phi() to:init::@1 init::@1: scope:[init] from init::toD0181 - [55] *((const byte*) D018#0) ← (const byte) init::toD0181_return#0 + [63] *((const byte*) D018#0) ← (const byte) init::toD0181_return#0 asm { lda#$5b sta$d011 } - [57] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 - [58] *((const byte*) BGCOL1#0) ← (const byte) BLACK#0 - [59] *((const byte*) BGCOL2#0) ← (const byte) RED#0 - [60] *((const byte*) BGCOL3#0) ← (const byte) BLUE#0 - [61] *((const byte*) BGCOL4#0) ← (const byte) GREEN#0 + [65] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 + [66] *((const byte*) BGCOL1#0) ← (const byte) BLACK#0 + [67] *((const byte*) BGCOL2#0) ← (const byte) RED#0 + [68] *((const byte*) BGCOL3#0) ← (const byte) BLUE#0 + [69] *((const byte*) BGCOL4#0) ← (const byte) GREEN#0 to:init::@return init::@return: scope:[init] from init::@1 - [62] return + [70] return to:@return fill: scope:[fill] from init::@2 init::@3 - [63] (byte) fill::val#3 ← phi( init::@2/(byte/signed byte/word/signed word/dword/signed dword) 0 init::@3/(const byte) BLACK#0 ) - [63] (byte*) fill::addr#0 ← phi( init::@2/(const byte*) screen#0 init::@3/(const byte*) colors#0 ) - [64] (byte*) fill::end#0 ← (byte*) fill::addr#0 + (word/signed word/dword/signed dword) $3e8 + [71] (byte) fill::val#3 ← phi( init::@2/(byte/signed byte/word/signed word/dword/signed dword) 0 init::@3/(const byte) BLACK#0 ) + [71] (byte*) fill::addr#0 ← phi( init::@2/(const byte*) screen#0 init::@3/(const byte*) colors#0 ) + [72] (byte*) fill::end#0 ← (byte*) fill::addr#0 + (word/signed word/dword/signed dword) $3e8 to:fill::@1 fill::@1: scope:[fill] from fill fill::@1 - [65] (byte*) fill::addr#2 ← phi( fill/(byte*) fill::addr#0 fill::@1/(byte*) fill::addr#1 ) - [66] *((byte*) fill::addr#2) ← (byte) fill::val#3 - [67] (byte*) fill::addr#1 ← ++ (byte*) fill::addr#2 - [68] if((byte*) fill::addr#1!=(byte*) fill::end#0) goto fill::@1 + [73] (byte*) fill::addr#2 ← phi( fill/(byte*) fill::addr#0 fill::@1/(byte*) fill::addr#1 ) + [74] *((byte*) fill::addr#2) ← (byte) fill::val#3 + [75] (byte*) fill::addr#1 ← ++ (byte*) fill::addr#2 + [76] if((byte*) fill::addr#1!=(byte*) fill::end#0) goto fill::@1 to:fill::@return fill::@return: scope:[fill] from fill::@1 - [69] return + [77] return to:@return init_sprites: scope:[init_sprites] from init - [70] *((const byte*) SPRITES_ENABLE#0) ← (byte/signed byte/word/signed word/dword/signed dword) 1 - [71] *((const byte*) SPRITES_EXPAND_X#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 - [72] *((const byte*) SPRITES_EXPAND_Y#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 - [73] *((const byte*) SPRITES_XMSB#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 - [74] *((const byte*) SPRITES_COLS#0) ← (const byte) WHITE#0 - [75] *((const byte*) SPRITES_MC#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 + [78] *((const byte*) SPRITES_ENABLE#0) ← (byte/signed byte/word/signed word/dword/signed dword) 1 + [79] *((const byte*) SPRITES_EXPAND_X#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 + [80] *((const byte*) SPRITES_EXPAND_Y#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 + [81] *((const byte*) SPRITES_XMSB#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 + [82] *((const byte*) SPRITES_COLS#0) ← (const byte) WHITE#0 + [83] *((const byte*) SPRITES_MC#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 to:init_sprites::@return init_sprites::@return: scope:[init_sprites] from init_sprites - [76] return + [84] return to:@return diff --git a/src/test/ref/scan-desire-problem.log b/src/test/ref/scan-desire-problem.log index 6b0b4f6b6..f21fa6cf0 100644 --- a/src/test/ref/scan-desire-problem.log +++ b/src/test/ref/scan-desire-problem.log @@ -594,6 +594,15 @@ Eliminating unused constant (const byte) draw_block::color#0 Successful SSA optimization PassNEliminateUnusedVars Removing unused block main::@return Successful SSA optimization Pass2EliminateUnusedBlocks +De-inlining pointer[w] to *(pointer+w) *((const byte*) screen#0 + (word) draw_block::z#1) ← (byte) draw_block::drawtile#0 +De-inlining pointer[w] to *(pointer+w) *((const byte*) colors#0 + (word) draw_block::z#1) ← (const byte) YELLOW#0 +De-inlining pointer[w] to *(pointer+w) *((const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) 1 + (word~) draw_block::$5) ← (byte/signed byte/word/signed word/dword/signed dword) 1 +De-inlining pointer[w] to *(pointer+w) *((const byte*) colors#0+(byte/signed byte/word/signed word/dword/signed dword) 1 + (word~) draw_block::$6) ← (const byte) YELLOW#0 +De-inlining pointer[w] to *(pointer+w) *((const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) $28 + (word~) draw_block::$7) ← (byte/signed byte/word/signed word/dword/signed dword) 2 +De-inlining pointer[w] to *(pointer+w) *((const byte*) colors#0+(byte/signed byte/word/signed word/dword/signed dword) $28 + (word~) draw_block::$8) ← (const byte) YELLOW#0 +De-inlining pointer[w] to *(pointer+w) *((const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) $29 + (word~) draw_block::$9) ← (byte/signed byte/word/signed word/dword/signed dword) 3 +De-inlining pointer[w] to *(pointer+w) *((const byte*) colors#0+(byte/signed byte/word/signed word/dword/signed dword) $29 + (word~) draw_block::$10) ← (const byte) YELLOW#0 +Successful SSA optimization Pass2DeInlineWordDerefIdx Culled Empty Block (label) mul8u::@3 Culled Empty Block (label) @17 Culled Empty Block (label) main::@7 @@ -650,19 +659,19 @@ CALL GRAPH Calls in [] to main:2 Calls in [main] to init:5 draw_block:13 Calls in [draw_block] to mul8u:26 -Calls in [init] to init_sprites:56 fill:58 fill:60 +Calls in [init] to init_sprites:64 fill:66 fill:68 Created 9 initial phi equivalence classes Coalesced [19] main::x#6 ← main::x#1 Coalesced [20] main::y#4 ← main::y#1 -Coalesced [40] mul8u::a#7 ← mul8u::a#1 -Coalesced [47] mul8u::res#9 ← mul8u::res#1 -Coalesced [51] mul8u::a#8 ← mul8u::a#0 -Coalesced [52] mul8u::res#7 ← mul8u::res#6 -Coalesced [53] mul8u::mb#6 ← mul8u::mb#1 -Coalesced (already) [54] mul8u::res#8 ← mul8u::res#2 -Coalesced [72] fill::addr#3 ← fill::addr#0 -Coalesced [78] fill::addr#4 ← fill::addr#1 +Coalesced [48] mul8u::a#7 ← mul8u::a#1 +Coalesced [55] mul8u::res#9 ← mul8u::res#1 +Coalesced [59] mul8u::a#8 ← mul8u::a#0 +Coalesced [60] mul8u::res#7 ← mul8u::res#6 +Coalesced [61] mul8u::mb#6 ← mul8u::mb#1 +Coalesced (already) [62] mul8u::res#8 ← mul8u::res#2 +Coalesced [80] fill::addr#3 ← fill::addr#0 +Coalesced [86] fill::addr#4 ← fill::addr#1 Coalesced down to 7 phi equivalence classes Culled Empty Block (label) main::@9 Culled Empty Block (label) main::@10 @@ -734,93 +743,101 @@ draw_block::@1: scope:[draw_block] from draw_block [26] (word) draw_block::z#0 ← (word) mul8u::return#2 [27] (word) draw_block::z#1 ← (word) draw_block::z#0 + (word) draw_block::x1#0 [28] (byte) draw_block::drawtile#0 ← *((const byte*) tileset#0 + (byte) draw_block::tileno#1) - [29] *((const byte*) screen#0 + (word) draw_block::z#1) ← (byte) draw_block::drawtile#0 - [30] *((const byte*) colors#0 + (word) draw_block::z#1) ← (const byte) YELLOW#0 - [31] *((const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) 1 + (word) draw_block::z#1) ← (byte/signed byte/word/signed word/dword/signed dword) 1 - [32] *((const byte*) colors#0+(byte/signed byte/word/signed word/dword/signed dword) 1 + (word) draw_block::z#1) ← (const byte) YELLOW#0 - [33] *((const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) $28 + (word) draw_block::z#1) ← (byte/signed byte/word/signed word/dword/signed dword) 2 - [34] *((const byte*) colors#0+(byte/signed byte/word/signed word/dword/signed dword) $28 + (word) draw_block::z#1) ← (const byte) YELLOW#0 - [35] *((const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) $29 + (word) draw_block::z#1) ← (byte/signed byte/word/signed word/dword/signed dword) 3 - [36] *((const byte*) colors#0+(byte/signed byte/word/signed word/dword/signed dword) $29 + (word) draw_block::z#1) ← (const byte) YELLOW#0 + [29] (byte*) draw_block::$11 ← (const byte*) screen#0 + (word) draw_block::z#1 + [30] *((byte*) draw_block::$11) ← (byte) draw_block::drawtile#0 + [31] (byte*) draw_block::$12 ← (const byte*) colors#0 + (word) draw_block::z#1 + [32] *((byte*) draw_block::$12) ← (const byte) YELLOW#0 + [33] (byte*) draw_block::$13 ← (const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) 1 + (word) draw_block::z#1 + [34] *((byte*) draw_block::$13) ← (byte/signed byte/word/signed word/dword/signed dword) 1 + [35] (byte*) draw_block::$14 ← (const byte*) colors#0+(byte/signed byte/word/signed word/dword/signed dword) 1 + (word) draw_block::z#1 + [36] *((byte*) draw_block::$14) ← (const byte) YELLOW#0 + [37] (byte*) draw_block::$15 ← (const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) $28 + (word) draw_block::z#1 + [38] *((byte*) draw_block::$15) ← (byte/signed byte/word/signed word/dword/signed dword) 2 + [39] (byte*) draw_block::$16 ← (const byte*) colors#0+(byte/signed byte/word/signed word/dword/signed dword) $28 + (word) draw_block::z#1 + [40] *((byte*) draw_block::$16) ← (const byte) YELLOW#0 + [41] (byte*) draw_block::$17 ← (const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) $29 + (word) draw_block::z#1 + [42] *((byte*) draw_block::$17) ← (byte/signed byte/word/signed word/dword/signed dword) 3 + [43] (byte*) draw_block::$18 ← (const byte*) colors#0+(byte/signed byte/word/signed word/dword/signed dword) $29 + (word) draw_block::z#1 + [44] *((byte*) draw_block::$18) ← (const byte) YELLOW#0 to:draw_block::@return draw_block::@return: scope:[draw_block] from draw_block::@1 - [37] return + [45] return to:@return mul8u: scope:[mul8u] from draw_block - [38] phi() + [46] phi() to:mul8u::@1 mul8u::@1: scope:[mul8u] from mul8u mul8u::@3 - [39] (word) mul8u::mb#2 ← phi( mul8u/((word))(const byte) mul8u::b#0 mul8u::@3/(word) mul8u::mb#1 ) - [39] (word) mul8u::res#2 ← phi( mul8u/(byte/signed byte/word/signed word/dword/signed dword) 0 mul8u::@3/(word) mul8u::res#6 ) - [39] (byte) mul8u::a#2 ← phi( mul8u/(byte) mul8u::a#1 mul8u::@3/(byte) mul8u::a#0 ) - [40] if((byte) mul8u::a#2!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto mul8u::@2 + [47] (word) mul8u::mb#2 ← phi( mul8u/((word))(const byte) mul8u::b#0 mul8u::@3/(word) mul8u::mb#1 ) + [47] (word) mul8u::res#2 ← phi( mul8u/(byte/signed byte/word/signed word/dword/signed dword) 0 mul8u::@3/(word) mul8u::res#6 ) + [47] (byte) mul8u::a#2 ← phi( mul8u/(byte) mul8u::a#1 mul8u::@3/(byte) mul8u::a#0 ) + [48] if((byte) mul8u::a#2!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto mul8u::@2 to:mul8u::@return mul8u::@return: scope:[mul8u] from mul8u::@1 - [41] return + [49] return to:@return mul8u::@2: scope:[mul8u] from mul8u::@1 - [42] (byte~) mul8u::$1 ← (byte) mul8u::a#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 - [43] if((byte~) mul8u::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto mul8u::@3 + [50] (byte~) mul8u::$1 ← (byte) mul8u::a#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 + [51] if((byte~) mul8u::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto mul8u::@3 to:mul8u::@4 mul8u::@4: scope:[mul8u] from mul8u::@2 - [44] (word) mul8u::res#1 ← (word) mul8u::res#2 + (word) mul8u::mb#2 + [52] (word) mul8u::res#1 ← (word) mul8u::res#2 + (word) mul8u::mb#2 to:mul8u::@3 mul8u::@3: scope:[mul8u] from mul8u::@2 mul8u::@4 - [45] (word) mul8u::res#6 ← phi( mul8u::@2/(word) mul8u::res#2 mul8u::@4/(word) mul8u::res#1 ) - [46] (byte) mul8u::a#0 ← (byte) mul8u::a#2 >> (byte/signed byte/word/signed word/dword/signed dword) 1 - [47] (word) mul8u::mb#1 ← (word) mul8u::mb#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 + [53] (word) mul8u::res#6 ← phi( mul8u::@2/(word) mul8u::res#2 mul8u::@4/(word) mul8u::res#1 ) + [54] (byte) mul8u::a#0 ← (byte) mul8u::a#2 >> (byte/signed byte/word/signed word/dword/signed dword) 1 + [55] (word) mul8u::mb#1 ← (word) mul8u::mb#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 to:mul8u::@1 init: scope:[init] from main - [48] phi() - [49] call init_sprites + [56] phi() + [57] call init_sprites to:init::@2 init::@2: scope:[init] from init - [50] phi() - [51] call fill + [58] phi() + [59] call fill to:init::@3 init::@3: scope:[init] from init::@2 - [52] phi() - [53] call fill + [60] phi() + [61] call fill to:init::toD0181 init::toD0181: scope:[init] from init::@3 - [54] phi() + [62] phi() to:init::@1 init::@1: scope:[init] from init::toD0181 - [55] *((const byte*) D018#0) ← (const byte) init::toD0181_return#0 + [63] *((const byte*) D018#0) ← (const byte) init::toD0181_return#0 asm { lda#$5b sta$d011 } - [57] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 - [58] *((const byte*) BGCOL1#0) ← (const byte) BLACK#0 - [59] *((const byte*) BGCOL2#0) ← (const byte) RED#0 - [60] *((const byte*) BGCOL3#0) ← (const byte) BLUE#0 - [61] *((const byte*) BGCOL4#0) ← (const byte) GREEN#0 + [65] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 + [66] *((const byte*) BGCOL1#0) ← (const byte) BLACK#0 + [67] *((const byte*) BGCOL2#0) ← (const byte) RED#0 + [68] *((const byte*) BGCOL3#0) ← (const byte) BLUE#0 + [69] *((const byte*) BGCOL4#0) ← (const byte) GREEN#0 to:init::@return init::@return: scope:[init] from init::@1 - [62] return + [70] return to:@return fill: scope:[fill] from init::@2 init::@3 - [63] (byte) fill::val#3 ← phi( init::@2/(byte/signed byte/word/signed word/dword/signed dword) 0 init::@3/(const byte) BLACK#0 ) - [63] (byte*) fill::addr#0 ← phi( init::@2/(const byte*) screen#0 init::@3/(const byte*) colors#0 ) - [64] (byte*) fill::end#0 ← (byte*) fill::addr#0 + (word/signed word/dword/signed dword) $3e8 + [71] (byte) fill::val#3 ← phi( init::@2/(byte/signed byte/word/signed word/dword/signed dword) 0 init::@3/(const byte) BLACK#0 ) + [71] (byte*) fill::addr#0 ← phi( init::@2/(const byte*) screen#0 init::@3/(const byte*) colors#0 ) + [72] (byte*) fill::end#0 ← (byte*) fill::addr#0 + (word/signed word/dword/signed dword) $3e8 to:fill::@1 fill::@1: scope:[fill] from fill fill::@1 - [65] (byte*) fill::addr#2 ← phi( fill/(byte*) fill::addr#0 fill::@1/(byte*) fill::addr#1 ) - [66] *((byte*) fill::addr#2) ← (byte) fill::val#3 - [67] (byte*) fill::addr#1 ← ++ (byte*) fill::addr#2 - [68] if((byte*) fill::addr#1!=(byte*) fill::end#0) goto fill::@1 + [73] (byte*) fill::addr#2 ← phi( fill/(byte*) fill::addr#0 fill::@1/(byte*) fill::addr#1 ) + [74] *((byte*) fill::addr#2) ← (byte) fill::val#3 + [75] (byte*) fill::addr#1 ← ++ (byte*) fill::addr#2 + [76] if((byte*) fill::addr#1!=(byte*) fill::end#0) goto fill::@1 to:fill::@return fill::@return: scope:[fill] from fill::@1 - [69] return + [77] return to:@return init_sprites: scope:[init_sprites] from init - [70] *((const byte*) SPRITES_ENABLE#0) ← (byte/signed byte/word/signed word/dword/signed dword) 1 - [71] *((const byte*) SPRITES_EXPAND_X#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 - [72] *((const byte*) SPRITES_EXPAND_Y#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 - [73] *((const byte*) SPRITES_XMSB#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 - [74] *((const byte*) SPRITES_COLS#0) ← (const byte) WHITE#0 - [75] *((const byte*) SPRITES_MC#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 + [78] *((const byte*) SPRITES_ENABLE#0) ← (byte/signed byte/word/signed word/dword/signed dword) 1 + [79] *((const byte*) SPRITES_EXPAND_X#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 + [80] *((const byte*) SPRITES_EXPAND_Y#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 + [81] *((const byte*) SPRITES_XMSB#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 + [82] *((const byte*) SPRITES_COLS#0) ← (const byte) WHITE#0 + [83] *((const byte*) SPRITES_MC#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 to:init_sprites::@return init_sprites::@return: scope:[init_sprites] from init_sprites - [76] return + [84] return to:@return @@ -847,9 +864,17 @@ VARIABLE REGISTER WEIGHTS (byte*) colors (void()) draw_block((byte) draw_block::tileno , (byte) draw_block::x , (byte) draw_block::y , (byte) draw_block::color) (byte~) draw_block::$1 4.0 +(byte*) draw_block::$11 4.0 +(byte*) draw_block::$12 4.0 +(byte*) draw_block::$13 4.0 +(byte*) draw_block::$14 4.0 +(byte*) draw_block::$15 4.0 +(byte*) draw_block::$16 4.0 +(byte*) draw_block::$17 4.0 +(byte*) draw_block::$18 4.0 (byte) draw_block::color (byte) draw_block::drawtile -(byte) draw_block::drawtile#0 4.0 +(byte) draw_block::drawtile#0 2.0 (byte) draw_block::tileno (byte) draw_block::tileno#0 34.33333333333333 (byte) draw_block::tileno#1 0.4444444444444444 @@ -862,7 +887,7 @@ VARIABLE REGISTER WEIGHTS (byte) draw_block::y#1 4.0 (word) draw_block::z (word) draw_block::z#0 4.0 -(word) draw_block::z#1 2.0000000000000004 +(word) draw_block::z#1 1.125 (void()) fill((byte*) fill::start , (word) fill::size , (byte) fill::val) (byte*) fill::addr (byte*) fill::addr#0 2.0 @@ -940,6 +965,14 @@ Added variable mul8u::return#2 to zero page equivalence class [ mul8u::return#2 Added variable draw_block::z#0 to zero page equivalence class [ draw_block::z#0 ] Added variable draw_block::z#1 to zero page equivalence class [ draw_block::z#1 ] Added variable draw_block::drawtile#0 to zero page equivalence class [ draw_block::drawtile#0 ] +Added variable draw_block::$11 to zero page equivalence class [ draw_block::$11 ] +Added variable draw_block::$12 to zero page equivalence class [ draw_block::$12 ] +Added variable draw_block::$13 to zero page equivalence class [ draw_block::$13 ] +Added variable draw_block::$14 to zero page equivalence class [ draw_block::$14 ] +Added variable draw_block::$15 to zero page equivalence class [ draw_block::$15 ] +Added variable draw_block::$16 to zero page equivalence class [ draw_block::$16 ] +Added variable draw_block::$17 to zero page equivalence class [ draw_block::$17 ] +Added variable draw_block::$18 to zero page equivalence class [ draw_block::$18 ] Added variable mul8u::$1 to zero page equivalence class [ mul8u::$1 ] Added variable fill::end#0 to zero page equivalence class [ fill::end#0 ] Complete equivalence classes @@ -963,6 +996,14 @@ Complete equivalence classes [ draw_block::z#0 ] [ draw_block::z#1 ] [ draw_block::drawtile#0 ] +[ draw_block::$11 ] +[ draw_block::$12 ] +[ draw_block::$13 ] +[ draw_block::$14 ] +[ draw_block::$15 ] +[ draw_block::$16 ] +[ draw_block::$17 ] +[ draw_block::$18 ] [ mul8u::$1 ] [ fill::end#0 ] Allocated zp ZP_BYTE:2 [ main::x#4 main::x#1 ] @@ -985,8 +1026,16 @@ Allocated zp ZP_WORD:22 [ mul8u::return#2 ] Allocated zp ZP_WORD:24 [ draw_block::z#0 ] Allocated zp ZP_WORD:26 [ draw_block::z#1 ] Allocated zp ZP_BYTE:28 [ draw_block::drawtile#0 ] -Allocated zp ZP_BYTE:29 [ mul8u::$1 ] -Allocated zp ZP_WORD:30 [ fill::end#0 ] +Allocated zp ZP_WORD:29 [ draw_block::$11 ] +Allocated zp ZP_WORD:31 [ draw_block::$12 ] +Allocated zp ZP_WORD:33 [ draw_block::$13 ] +Allocated zp ZP_WORD:35 [ draw_block::$14 ] +Allocated zp ZP_WORD:37 [ draw_block::$15 ] +Allocated zp ZP_WORD:39 [ draw_block::$16 ] +Allocated zp ZP_WORD:41 [ draw_block::$17 ] +Allocated zp ZP_WORD:43 [ draw_block::$18 ] +Allocated zp ZP_BYTE:45 [ mul8u::$1 ] +Allocated zp ZP_WORD:46 [ fill::end#0 ] INITIAL ASM //SEG0 File Comments @@ -1043,7 +1092,7 @@ main: { .label y = 3 .label x = 2 //SEG11 [5] call init - //SEG12 [48] phi from main to init [phi:main->init] + //SEG12 [56] phi from main to init [phi:main->init] init_from_main: jsr init //SEG13 [6] phi from main to main::@1 [phi:main->main::@1] @@ -1129,6 +1178,14 @@ draw_block: { .label z = $18 .label z_1 = $1a .label drawtile = $1c + .label _11 = $1d + .label _12 = $1f + .label _13 = $21 + .label _14 = $23 + .label _15 = $25 + .label _16 = $27 + .label _17 = $29 + .label _18 = $2b //SEG38 [19] (byte) draw_block::tileno#1 ← (byte) draw_block::tileno#0 << (byte/signed byte/word/signed word/dword/signed dword) 2 -- vbuz1=vbuz2_rol_2 lda tileno asl @@ -1151,7 +1208,7 @@ draw_block: { lda y_1 sta mul8u.a //SEG43 [24] call mul8u - //SEG44 [38] phi from draw_block to mul8u [phi:draw_block->mul8u] + //SEG44 [46] phi from draw_block to mul8u [phi:draw_block->mul8u] mul8u_from_draw_block: jsr mul8u //SEG45 [25] (word) mul8u::return#2 ← (word) mul8u::res#2 -- vwuz1=vwuz2 @@ -1179,152 +1236,157 @@ draw_block: { ldy tileno_1 lda tileset,y sta drawtile - //SEG50 [29] *((const byte*) screen#0 + (word) draw_block::z#1) ← (byte) draw_block::drawtile#0 -- pbuc1_derefidx_vwuz1=vbuz2 + //SEG50 [29] (byte*) draw_block::$11 ← (const byte*) screen#0 + (word) draw_block::z#1 -- pbuz1=pbuc1_plus_vwuz2 + lda z_1 + clc + adc #screen + sta _11+1 + //SEG51 [30] *((byte*) draw_block::$11) ← (byte) draw_block::drawtile#0 -- _deref_pbuz1=vbuz2 lda drawtile - sta !v++1 - lda #screen - adc z_1+1 - sta !a++2 - !v: - lda #0 - !a: - sta screen - //SEG51 [30] *((const byte*) colors#0 + (word) draw_block::z#1) ← (const byte) YELLOW#0 -- pbuc1_derefidx_vwuz1=vbuc2 - lda #colors - adc z_1+1 - sta !++2 + adc #colors + sta _12+1 + //SEG53 [32] *((byte*) draw_block::$12) ← (const byte) YELLOW#0 -- _deref_pbuz1=vbuc1 lda #YELLOW - !: - sta colors - //SEG52 [31] *((const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) 1 + (word) draw_block::z#1) ← (byte/signed byte/word/signed word/dword/signed dword) 1 -- pbuc1_derefidx_vwuz1=vbuc2 - lda #screen+1 - adc z_1+1 - sta !++2 + adc #screen+1 + sta _13+1 + //SEG55 [34] *((byte*) draw_block::$13) ← (byte/signed byte/word/signed word/dword/signed dword) 1 -- _deref_pbuz1=vbuc1 lda #1 - !: - sta screen+1 - //SEG53 [32] *((const byte*) colors#0+(byte/signed byte/word/signed word/dword/signed dword) 1 + (word) draw_block::z#1) ← (const byte) YELLOW#0 -- pbuc1_derefidx_vwuz1=vbuc2 - lda #colors+1 - adc z_1+1 - sta !++2 + adc #colors+1 + sta _14+1 + //SEG57 [36] *((byte*) draw_block::$14) ← (const byte) YELLOW#0 -- _deref_pbuz1=vbuc1 lda #YELLOW - !: - sta colors+1 - //SEG54 [33] *((const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) $28 + (word) draw_block::z#1) ← (byte/signed byte/word/signed word/dword/signed dword) 2 -- pbuc1_derefidx_vwuz1=vbuc2 - lda #screen+$28 - adc z_1+1 - sta !++2 + adc #screen+$28 + sta _15+1 + //SEG59 [38] *((byte*) draw_block::$15) ← (byte/signed byte/word/signed word/dword/signed dword) 2 -- _deref_pbuz1=vbuc1 lda #2 - !: - sta screen+$28 - //SEG55 [34] *((const byte*) colors#0+(byte/signed byte/word/signed word/dword/signed dword) $28 + (word) draw_block::z#1) ← (const byte) YELLOW#0 -- pbuc1_derefidx_vwuz1=vbuc2 - lda #colors+$28 - adc z_1+1 - sta !++2 + adc #colors+$28 + sta _16+1 + //SEG61 [40] *((byte*) draw_block::$16) ← (const byte) YELLOW#0 -- _deref_pbuz1=vbuc1 lda #YELLOW - !: - sta colors+$28 - //SEG56 [35] *((const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) $29 + (word) draw_block::z#1) ← (byte/signed byte/word/signed word/dword/signed dword) 3 -- pbuc1_derefidx_vwuz1=vbuc2 - lda #screen+$29 - adc z_1+1 - sta !++2 + adc #screen+$29 + sta _17+1 + //SEG63 [42] *((byte*) draw_block::$17) ← (byte/signed byte/word/signed word/dword/signed dword) 3 -- _deref_pbuz1=vbuc1 lda #3 - !: - sta screen+$29 - //SEG57 [36] *((const byte*) colors#0+(byte/signed byte/word/signed word/dword/signed dword) $29 + (word) draw_block::z#1) ← (const byte) YELLOW#0 -- pbuc1_derefidx_vwuz1=vbuc2 - lda #colors+$29 - adc z_1+1 - sta !++2 + adc #colors+$29 + sta _18+1 + //SEG65 [44] *((byte*) draw_block::$18) ← (const byte) YELLOW#0 -- _deref_pbuz1=vbuc1 lda #YELLOW - !: - sta colors+$29 + ldy #0 + sta (_18),y jmp breturn - //SEG58 draw_block::@return + //SEG66 draw_block::@return breturn: - //SEG59 [37] return + //SEG67 [45] return rts } -//SEG60 mul8u +//SEG68 mul8u // Perform binary multiplication of two unsigned 8-bit bytes into a 16-bit unsigned word // mul8u(byte zeropage(4) a) mul8u: { .const b = $28 - .label _1 = $1d + .label _1 = $2d .label a = 4 .label mb = 7 .label res = 5 .label return = $16 - //SEG61 [39] phi from mul8u to mul8u::@1 [phi:mul8u->mul8u::@1] + //SEG69 [47] phi from mul8u to mul8u::@1 [phi:mul8u->mul8u::@1] b1_from_mul8u: - //SEG62 [39] phi (word) mul8u::mb#2 = ((word))(const byte) mul8u::b#0 [phi:mul8u->mul8u::@1#0] -- vwuz1=vbuc1 + //SEG70 [47] phi (word) mul8u::mb#2 = ((word))(const byte) mul8u::b#0 [phi:mul8u->mul8u::@1#0] -- vwuz1=vbuc1 lda #b sta mb lda #0 sta mb+1 - //SEG63 [39] phi (word) mul8u::res#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:mul8u->mul8u::@1#1] -- vwuz1=vbuc1 + //SEG71 [47] phi (word) mul8u::res#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:mul8u->mul8u::@1#1] -- vwuz1=vbuc1 lda #0 sta res lda #0 sta res+1 - //SEG64 [39] phi (byte) mul8u::a#2 = (byte) mul8u::a#1 [phi:mul8u->mul8u::@1#2] -- register_copy + //SEG72 [47] phi (byte) mul8u::a#2 = (byte) mul8u::a#1 [phi:mul8u->mul8u::@1#2] -- register_copy jmp b1 - //SEG65 mul8u::@1 + //SEG73 mul8u::@1 b1: - //SEG66 [40] if((byte) mul8u::a#2!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto mul8u::@2 -- vbuz1_neq_0_then_la1 + //SEG74 [48] if((byte) mul8u::a#2!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto mul8u::@2 -- vbuz1_neq_0_then_la1 lda a cmp #0 bne b2 jmp breturn - //SEG67 mul8u::@return + //SEG75 mul8u::@return breturn: - //SEG68 [41] return + //SEG76 [49] return rts - //SEG69 mul8u::@2 + //SEG77 mul8u::@2 b2: - //SEG70 [42] (byte~) mul8u::$1 ← (byte) mul8u::a#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz2_band_vbuc1 + //SEG78 [50] (byte~) mul8u::$1 ← (byte) mul8u::a#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz2_band_vbuc1 lda #1 and a sta _1 - //SEG71 [43] if((byte~) mul8u::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto mul8u::@3 -- vbuz1_eq_0_then_la1 + //SEG79 [51] if((byte~) mul8u::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto mul8u::@3 -- vbuz1_eq_0_then_la1 lda _1 cmp #0 beq b3_from_b2 jmp b4 - //SEG72 mul8u::@4 + //SEG80 mul8u::@4 b4: - //SEG73 [44] (word) mul8u::res#1 ← (word) mul8u::res#2 + (word) mul8u::mb#2 -- vwuz1=vwuz1_plus_vwuz2 + //SEG81 [52] (word) mul8u::res#1 ← (word) mul8u::res#2 + (word) mul8u::mb#2 -- vwuz1=vwuz1_plus_vwuz2 lda res clc adc mb @@ -1332,107 +1394,107 @@ mul8u: { lda res+1 adc mb+1 sta res+1 - //SEG74 [45] phi from mul8u::@2 mul8u::@4 to mul8u::@3 [phi:mul8u::@2/mul8u::@4->mul8u::@3] + //SEG82 [53] phi from mul8u::@2 mul8u::@4 to mul8u::@3 [phi:mul8u::@2/mul8u::@4->mul8u::@3] b3_from_b2: b3_from_b4: - //SEG75 [45] phi (word) mul8u::res#6 = (word) mul8u::res#2 [phi:mul8u::@2/mul8u::@4->mul8u::@3#0] -- register_copy + //SEG83 [53] phi (word) mul8u::res#6 = (word) mul8u::res#2 [phi:mul8u::@2/mul8u::@4->mul8u::@3#0] -- register_copy jmp b3 - //SEG76 mul8u::@3 + //SEG84 mul8u::@3 b3: - //SEG77 [46] (byte) mul8u::a#0 ← (byte) mul8u::a#2 >> (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz1_ror_1 + //SEG85 [54] (byte) mul8u::a#0 ← (byte) mul8u::a#2 >> (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz1_ror_1 lsr a - //SEG78 [47] (word) mul8u::mb#1 ← (word) mul8u::mb#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 -- vwuz1=vwuz1_rol_1 + //SEG86 [55] (word) mul8u::mb#1 ← (word) mul8u::mb#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 -- vwuz1=vwuz1_rol_1 asl mb rol mb+1 - //SEG79 [39] phi from mul8u::@3 to mul8u::@1 [phi:mul8u::@3->mul8u::@1] + //SEG87 [47] phi from mul8u::@3 to mul8u::@1 [phi:mul8u::@3->mul8u::@1] b1_from_b3: - //SEG80 [39] phi (word) mul8u::mb#2 = (word) mul8u::mb#1 [phi:mul8u::@3->mul8u::@1#0] -- register_copy - //SEG81 [39] phi (word) mul8u::res#2 = (word) mul8u::res#6 [phi:mul8u::@3->mul8u::@1#1] -- register_copy - //SEG82 [39] phi (byte) mul8u::a#2 = (byte) mul8u::a#0 [phi:mul8u::@3->mul8u::@1#2] -- register_copy + //SEG88 [47] phi (word) mul8u::mb#2 = (word) mul8u::mb#1 [phi:mul8u::@3->mul8u::@1#0] -- register_copy + //SEG89 [47] phi (word) mul8u::res#2 = (word) mul8u::res#6 [phi:mul8u::@3->mul8u::@1#1] -- register_copy + //SEG90 [47] phi (byte) mul8u::a#2 = (byte) mul8u::a#0 [phi:mul8u::@3->mul8u::@1#2] -- register_copy jmp b1 } -//SEG83 init +//SEG91 init init: { .const toD0181_return = (>(screen&$3fff)*4)|(>charset)/4&$f - //SEG84 [49] call init_sprites + //SEG92 [57] call init_sprites jsr init_sprites - //SEG85 [50] phi from init to init::@2 [phi:init->init::@2] + //SEG93 [58] phi from init to init::@2 [phi:init->init::@2] b2_from_init: jmp b2 - //SEG86 init::@2 + //SEG94 init::@2 b2: - //SEG87 [51] call fill - //SEG88 [63] phi from init::@2 to fill [phi:init::@2->fill] + //SEG95 [59] call fill + //SEG96 [71] phi from init::@2 to fill [phi:init::@2->fill] fill_from_b2: - //SEG89 [63] phi (byte) fill::val#3 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:init::@2->fill#0] -- vbuz1=vbuc1 + //SEG97 [71] phi (byte) fill::val#3 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:init::@2->fill#0] -- vbuz1=vbuc1 lda #0 sta fill.val - //SEG90 [63] phi (byte*) fill::addr#0 = (const byte*) screen#0 [phi:init::@2->fill#1] -- pbuz1=pbuc1 + //SEG98 [71] phi (byte*) fill::addr#0 = (const byte*) screen#0 [phi:init::@2->fill#1] -- pbuz1=pbuc1 lda #screen sta fill.addr+1 jsr fill - //SEG91 [52] phi from init::@2 to init::@3 [phi:init::@2->init::@3] + //SEG99 [60] phi from init::@2 to init::@3 [phi:init::@2->init::@3] b3_from_b2: jmp b3 - //SEG92 init::@3 + //SEG100 init::@3 b3: - //SEG93 [53] call fill - //SEG94 [63] phi from init::@3 to fill [phi:init::@3->fill] + //SEG101 [61] call fill + //SEG102 [71] phi from init::@3 to fill [phi:init::@3->fill] fill_from_b3: - //SEG95 [63] phi (byte) fill::val#3 = (const byte) BLACK#0 [phi:init::@3->fill#0] -- vbuz1=vbuc1 + //SEG103 [71] phi (byte) fill::val#3 = (const byte) BLACK#0 [phi:init::@3->fill#0] -- vbuz1=vbuc1 lda #BLACK sta fill.val - //SEG96 [63] phi (byte*) fill::addr#0 = (const byte*) colors#0 [phi:init::@3->fill#1] -- pbuz1=pbuc1 + //SEG104 [71] phi (byte*) fill::addr#0 = (const byte*) colors#0 [phi:init::@3->fill#1] -- pbuz1=pbuc1 lda #colors sta fill.addr+1 jsr fill - //SEG97 [54] phi from init::@3 to init::toD0181 [phi:init::@3->init::toD0181] + //SEG105 [62] phi from init::@3 to init::toD0181 [phi:init::@3->init::toD0181] toD0181_from_b3: jmp toD0181 - //SEG98 init::toD0181 + //SEG106 init::toD0181 toD0181: jmp b1 - //SEG99 init::@1 + //SEG107 init::@1 b1: - //SEG100 [55] *((const byte*) D018#0) ← (const byte) init::toD0181_return#0 -- _deref_pbuc1=vbuc2 + //SEG108 [63] *((const byte*) D018#0) ← (const byte) init::toD0181_return#0 -- _deref_pbuc1=vbuc2 lda #toD0181_return sta D018 - //SEG101 asm { lda#$5b sta$d011 } + //SEG109 asm { lda#$5b sta$d011 } lda #$5b sta $d011 - //SEG102 [57] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 -- _deref_pbuc1=vbuc2 + //SEG110 [65] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 -- _deref_pbuc1=vbuc2 lda #BLACK sta BORDERCOL - //SEG103 [58] *((const byte*) BGCOL1#0) ← (const byte) BLACK#0 -- _deref_pbuc1=vbuc2 + //SEG111 [66] *((const byte*) BGCOL1#0) ← (const byte) BLACK#0 -- _deref_pbuc1=vbuc2 lda #BLACK sta BGCOL1 - //SEG104 [59] *((const byte*) BGCOL2#0) ← (const byte) RED#0 -- _deref_pbuc1=vbuc2 + //SEG112 [67] *((const byte*) BGCOL2#0) ← (const byte) RED#0 -- _deref_pbuc1=vbuc2 lda #RED sta BGCOL2 - //SEG105 [60] *((const byte*) BGCOL3#0) ← (const byte) BLUE#0 -- _deref_pbuc1=vbuc2 + //SEG113 [68] *((const byte*) BGCOL3#0) ← (const byte) BLUE#0 -- _deref_pbuc1=vbuc2 lda #BLUE sta BGCOL3 - //SEG106 [61] *((const byte*) BGCOL4#0) ← (const byte) GREEN#0 -- _deref_pbuc1=vbuc2 + //SEG114 [69] *((const byte*) BGCOL4#0) ← (const byte) GREEN#0 -- _deref_pbuc1=vbuc2 lda #GREEN sta BGCOL4 jmp breturn - //SEG107 init::@return + //SEG115 init::@return breturn: - //SEG108 [62] return + //SEG116 [70] return rts } -//SEG109 fill +//SEG117 fill // Fill some memory with a value // fill(byte zeropage(9) val) fill: { - .label end = $1e + .label end = $2e .label addr = $a .label val = 9 - //SEG110 [64] (byte*) fill::end#0 ← (byte*) fill::addr#0 + (word/signed word/dword/signed dword) $3e8 -- pbuz1=pbuz2_plus_vwuc1 + //SEG118 [72] (byte*) fill::end#0 ← (byte*) fill::addr#0 + (word/signed word/dword/signed dword) $3e8 -- pbuz1=pbuz2_plus_vwuc1 lda addr clc adc #<$3e8 @@ -1440,23 +1502,23 @@ fill: { lda addr+1 adc #>$3e8 sta end+1 - //SEG111 [65] phi from fill fill::@1 to fill::@1 [phi:fill/fill::@1->fill::@1] + //SEG119 [73] phi from fill fill::@1 to fill::@1 [phi:fill/fill::@1->fill::@1] b1_from_fill: b1_from_b1: - //SEG112 [65] phi (byte*) fill::addr#2 = (byte*) fill::addr#0 [phi:fill/fill::@1->fill::@1#0] -- register_copy + //SEG120 [73] phi (byte*) fill::addr#2 = (byte*) fill::addr#0 [phi:fill/fill::@1->fill::@1#0] -- register_copy jmp b1 - //SEG113 fill::@1 + //SEG121 fill::@1 b1: - //SEG114 [66] *((byte*) fill::addr#2) ← (byte) fill::val#3 -- _deref_pbuz1=vbuz2 + //SEG122 [74] *((byte*) fill::addr#2) ← (byte) fill::val#3 -- _deref_pbuz1=vbuz2 lda val ldy #0 sta (addr),y - //SEG115 [67] (byte*) fill::addr#1 ← ++ (byte*) fill::addr#2 -- pbuz1=_inc_pbuz1 + //SEG123 [75] (byte*) fill::addr#1 ← ++ (byte*) fill::addr#2 -- pbuz1=_inc_pbuz1 inc addr bne !+ inc addr+1 !: - //SEG116 [68] if((byte*) fill::addr#1!=(byte*) fill::end#0) goto fill::@1 -- pbuz1_neq_pbuz2_then_la1 + //SEG124 [76] if((byte*) fill::addr#1!=(byte*) fill::end#0) goto fill::@1 -- pbuz1_neq_pbuz2_then_la1 lda addr+1 cmp end+1 bne b1_from_b1 @@ -1464,36 +1526,36 @@ fill: { cmp end bne b1_from_b1 jmp breturn - //SEG117 fill::@return + //SEG125 fill::@return breturn: - //SEG118 [69] return + //SEG126 [77] return rts } -//SEG119 init_sprites +//SEG127 init_sprites init_sprites: { - //SEG120 [70] *((const byte*) SPRITES_ENABLE#0) ← (byte/signed byte/word/signed word/dword/signed dword) 1 -- _deref_pbuc1=vbuc2 + //SEG128 [78] *((const byte*) SPRITES_ENABLE#0) ← (byte/signed byte/word/signed word/dword/signed dword) 1 -- _deref_pbuc1=vbuc2 lda #1 sta SPRITES_ENABLE - //SEG121 [71] *((const byte*) SPRITES_EXPAND_X#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2 + //SEG129 [79] *((const byte*) SPRITES_EXPAND_X#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2 // one sprite enabled lda #0 sta SPRITES_EXPAND_X - //SEG122 [72] *((const byte*) SPRITES_EXPAND_Y#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2 + //SEG130 [80] *((const byte*) SPRITES_EXPAND_Y#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2 lda #0 sta SPRITES_EXPAND_Y - //SEG123 [73] *((const byte*) SPRITES_XMSB#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2 + //SEG131 [81] *((const byte*) SPRITES_XMSB#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2 lda #0 sta SPRITES_XMSB - //SEG124 [74] *((const byte*) SPRITES_COLS#0) ← (const byte) WHITE#0 -- _deref_pbuc1=vbuc2 + //SEG132 [82] *((const byte*) SPRITES_COLS#0) ← (const byte) WHITE#0 -- _deref_pbuc1=vbuc2 lda #WHITE sta SPRITES_COLS - //SEG125 [75] *((const byte*) SPRITES_MC#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2 + //SEG133 [83] *((const byte*) SPRITES_MC#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2 lda #0 sta SPRITES_MC jmp breturn - //SEG126 init_sprites::@return + //SEG134 init_sprites::@return breturn: - //SEG127 [76] return + //SEG135 [84] return rts } @@ -1511,34 +1573,45 @@ Statement [22] (byte) draw_block::y#1 ← (byte) draw_block::y#0 << (byte/signed Statement [25] (word) mul8u::return#2 ← (word) mul8u::res#2 [ draw_block::tileno#1 draw_block::x1#0 mul8u::return#2 ] ( main:2::draw_block:13 [ main::x#4 main::y#2 draw_block::tileno#1 draw_block::x1#0 mul8u::return#2 ] ) always clobbers reg byte a Statement [26] (word) draw_block::z#0 ← (word) mul8u::return#2 [ draw_block::tileno#1 draw_block::x1#0 draw_block::z#0 ] ( main:2::draw_block:13 [ main::x#4 main::y#2 draw_block::tileno#1 draw_block::x1#0 draw_block::z#0 ] ) always clobbers reg byte a Statement [27] (word) draw_block::z#1 ← (word) draw_block::z#0 + (word) draw_block::x1#0 [ draw_block::tileno#1 draw_block::z#1 ] ( main:2::draw_block:13 [ main::x#4 main::y#2 draw_block::tileno#1 draw_block::z#1 ] ) always clobbers reg byte a -Statement [29] *((const byte*) screen#0 + (word) draw_block::z#1) ← (byte) draw_block::drawtile#0 [ draw_block::z#1 ] ( main:2::draw_block:13 [ main::x#4 main::y#2 draw_block::z#1 ] ) always clobbers reg byte a -Statement [30] *((const byte*) colors#0 + (word) draw_block::z#1) ← (const byte) YELLOW#0 [ draw_block::z#1 ] ( main:2::draw_block:13 [ main::x#4 main::y#2 draw_block::z#1 ] ) always clobbers reg byte a -Statement [31] *((const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) 1 + (word) draw_block::z#1) ← (byte/signed byte/word/signed word/dword/signed dword) 1 [ draw_block::z#1 ] ( main:2::draw_block:13 [ main::x#4 main::y#2 draw_block::z#1 ] ) always clobbers reg byte a -Statement [32] *((const byte*) colors#0+(byte/signed byte/word/signed word/dword/signed dword) 1 + (word) draw_block::z#1) ← (const byte) YELLOW#0 [ draw_block::z#1 ] ( main:2::draw_block:13 [ main::x#4 main::y#2 draw_block::z#1 ] ) always clobbers reg byte a -Statement [33] *((const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) $28 + (word) draw_block::z#1) ← (byte/signed byte/word/signed word/dword/signed dword) 2 [ draw_block::z#1 ] ( main:2::draw_block:13 [ main::x#4 main::y#2 draw_block::z#1 ] ) always clobbers reg byte a -Statement [34] *((const byte*) colors#0+(byte/signed byte/word/signed word/dword/signed dword) $28 + (word) draw_block::z#1) ← (const byte) YELLOW#0 [ draw_block::z#1 ] ( main:2::draw_block:13 [ main::x#4 main::y#2 draw_block::z#1 ] ) always clobbers reg byte a -Statement [35] *((const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) $29 + (word) draw_block::z#1) ← (byte/signed byte/word/signed word/dword/signed dword) 3 [ draw_block::z#1 ] ( main:2::draw_block:13 [ main::x#4 main::y#2 draw_block::z#1 ] ) always clobbers reg byte a -Statement [36] *((const byte*) colors#0+(byte/signed byte/word/signed word/dword/signed dword) $29 + (word) draw_block::z#1) ← (const byte) YELLOW#0 [ ] ( main:2::draw_block:13 [ main::x#4 main::y#2 ] ) always clobbers reg byte a -Statement [44] (word) mul8u::res#1 ← (word) mul8u::res#2 + (word) mul8u::mb#2 [ mul8u::a#2 mul8u::mb#2 mul8u::res#1 ] ( main:2::draw_block:13::mul8u:24 [ main::x#4 main::y#2 draw_block::tileno#1 draw_block::x1#0 mul8u::a#2 mul8u::mb#2 mul8u::res#1 ] ) always clobbers reg byte a +Statement [29] (byte*) draw_block::$11 ← (const byte*) screen#0 + (word) draw_block::z#1 [ draw_block::z#1 draw_block::drawtile#0 draw_block::$11 ] ( main:2::draw_block:13 [ main::x#4 main::y#2 draw_block::z#1 draw_block::drawtile#0 draw_block::$11 ] ) always clobbers reg byte a +Removing always clobbered register reg byte a as potential for zp ZP_BYTE:28 [ draw_block::drawtile#0 ] +Statement [30] *((byte*) draw_block::$11) ← (byte) draw_block::drawtile#0 [ draw_block::z#1 ] ( main:2::draw_block:13 [ main::x#4 main::y#2 draw_block::z#1 ] ) always clobbers reg byte a reg byte y +Removing always clobbered register reg byte y as potential for zp ZP_BYTE:2 [ main::x#4 main::x#1 ] +Removing always clobbered register reg byte y as potential for zp ZP_BYTE:3 [ main::y#2 main::y#1 ] +Statement [31] (byte*) draw_block::$12 ← (const byte*) colors#0 + (word) draw_block::z#1 [ draw_block::z#1 draw_block::$12 ] ( main:2::draw_block:13 [ main::x#4 main::y#2 draw_block::z#1 draw_block::$12 ] ) always clobbers reg byte a +Statement [32] *((byte*) draw_block::$12) ← (const byte) YELLOW#0 [ draw_block::z#1 ] ( main:2::draw_block:13 [ main::x#4 main::y#2 draw_block::z#1 ] ) always clobbers reg byte a reg byte y +Statement [33] (byte*) draw_block::$13 ← (const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) 1 + (word) draw_block::z#1 [ draw_block::z#1 draw_block::$13 ] ( main:2::draw_block:13 [ main::x#4 main::y#2 draw_block::z#1 draw_block::$13 ] ) always clobbers reg byte a +Statement [34] *((byte*) draw_block::$13) ← (byte/signed byte/word/signed word/dword/signed dword) 1 [ draw_block::z#1 ] ( main:2::draw_block:13 [ main::x#4 main::y#2 draw_block::z#1 ] ) always clobbers reg byte a reg byte y +Statement [35] (byte*) draw_block::$14 ← (const byte*) colors#0+(byte/signed byte/word/signed word/dword/signed dword) 1 + (word) draw_block::z#1 [ draw_block::z#1 draw_block::$14 ] ( main:2::draw_block:13 [ main::x#4 main::y#2 draw_block::z#1 draw_block::$14 ] ) always clobbers reg byte a +Statement [36] *((byte*) draw_block::$14) ← (const byte) YELLOW#0 [ draw_block::z#1 ] ( main:2::draw_block:13 [ main::x#4 main::y#2 draw_block::z#1 ] ) always clobbers reg byte a reg byte y +Statement [37] (byte*) draw_block::$15 ← (const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) $28 + (word) draw_block::z#1 [ draw_block::z#1 draw_block::$15 ] ( main:2::draw_block:13 [ main::x#4 main::y#2 draw_block::z#1 draw_block::$15 ] ) always clobbers reg byte a +Statement [38] *((byte*) draw_block::$15) ← (byte/signed byte/word/signed word/dword/signed dword) 2 [ draw_block::z#1 ] ( main:2::draw_block:13 [ main::x#4 main::y#2 draw_block::z#1 ] ) always clobbers reg byte a reg byte y +Statement [39] (byte*) draw_block::$16 ← (const byte*) colors#0+(byte/signed byte/word/signed word/dword/signed dword) $28 + (word) draw_block::z#1 [ draw_block::z#1 draw_block::$16 ] ( main:2::draw_block:13 [ main::x#4 main::y#2 draw_block::z#1 draw_block::$16 ] ) always clobbers reg byte a +Statement [40] *((byte*) draw_block::$16) ← (const byte) YELLOW#0 [ draw_block::z#1 ] ( main:2::draw_block:13 [ main::x#4 main::y#2 draw_block::z#1 ] ) always clobbers reg byte a reg byte y +Statement [41] (byte*) draw_block::$17 ← (const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) $29 + (word) draw_block::z#1 [ draw_block::z#1 draw_block::$17 ] ( main:2::draw_block:13 [ main::x#4 main::y#2 draw_block::z#1 draw_block::$17 ] ) always clobbers reg byte a +Statement [42] *((byte*) draw_block::$17) ← (byte/signed byte/word/signed word/dword/signed dword) 3 [ draw_block::z#1 ] ( main:2::draw_block:13 [ main::x#4 main::y#2 draw_block::z#1 ] ) always clobbers reg byte a reg byte y +Statement [43] (byte*) draw_block::$18 ← (const byte*) colors#0+(byte/signed byte/word/signed word/dword/signed dword) $29 + (word) draw_block::z#1 [ draw_block::$18 ] ( main:2::draw_block:13 [ main::x#4 main::y#2 draw_block::$18 ] ) always clobbers reg byte a +Statement [44] *((byte*) draw_block::$18) ← (const byte) YELLOW#0 [ ] ( main:2::draw_block:13 [ main::x#4 main::y#2 ] ) always clobbers reg byte a reg byte y +Statement [52] (word) mul8u::res#1 ← (word) mul8u::res#2 + (word) mul8u::mb#2 [ mul8u::a#2 mul8u::mb#2 mul8u::res#1 ] ( main:2::draw_block:13::mul8u:24 [ main::x#4 main::y#2 draw_block::tileno#1 draw_block::x1#0 mul8u::a#2 mul8u::mb#2 mul8u::res#1 ] ) always clobbers reg byte a Removing always clobbered register reg byte a as potential for zp ZP_BYTE:4 [ mul8u::a#2 mul8u::a#1 mul8u::a#0 ] -Statement [55] *((const byte*) D018#0) ← (const byte) init::toD0181_return#0 [ ] ( main:2::init:5 [ ] ) always clobbers reg byte a +Statement [63] *((const byte*) D018#0) ← (const byte) init::toD0181_return#0 [ ] ( main:2::init:5 [ ] ) always clobbers reg byte a Statement asm { lda#$5b sta$d011 } always clobbers reg byte a -Statement [57] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 [ ] ( main:2::init:5 [ ] ) always clobbers reg byte a -Statement [58] *((const byte*) BGCOL1#0) ← (const byte) BLACK#0 [ ] ( main:2::init:5 [ ] ) always clobbers reg byte a -Statement [59] *((const byte*) BGCOL2#0) ← (const byte) RED#0 [ ] ( main:2::init:5 [ ] ) always clobbers reg byte a -Statement [60] *((const byte*) BGCOL3#0) ← (const byte) BLUE#0 [ ] ( main:2::init:5 [ ] ) always clobbers reg byte a -Statement [61] *((const byte*) BGCOL4#0) ← (const byte) GREEN#0 [ ] ( main:2::init:5 [ ] ) always clobbers reg byte a -Statement [64] (byte*) fill::end#0 ← (byte*) fill::addr#0 + (word/signed word/dword/signed dword) $3e8 [ fill::addr#0 fill::val#3 fill::end#0 ] ( main:2::init:5::fill:51 [ fill::addr#0 fill::val#3 fill::end#0 ] main:2::init:5::fill:53 [ fill::addr#0 fill::val#3 fill::end#0 ] ) always clobbers reg byte a +Statement [65] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 [ ] ( main:2::init:5 [ ] ) always clobbers reg byte a +Statement [66] *((const byte*) BGCOL1#0) ← (const byte) BLACK#0 [ ] ( main:2::init:5 [ ] ) always clobbers reg byte a +Statement [67] *((const byte*) BGCOL2#0) ← (const byte) RED#0 [ ] ( main:2::init:5 [ ] ) always clobbers reg byte a +Statement [68] *((const byte*) BGCOL3#0) ← (const byte) BLUE#0 [ ] ( main:2::init:5 [ ] ) always clobbers reg byte a +Statement [69] *((const byte*) BGCOL4#0) ← (const byte) GREEN#0 [ ] ( main:2::init:5 [ ] ) always clobbers reg byte a +Statement [72] (byte*) fill::end#0 ← (byte*) fill::addr#0 + (word/signed word/dword/signed dword) $3e8 [ fill::addr#0 fill::val#3 fill::end#0 ] ( main:2::init:5::fill:59 [ fill::addr#0 fill::val#3 fill::end#0 ] main:2::init:5::fill:61 [ fill::addr#0 fill::val#3 fill::end#0 ] ) always clobbers reg byte a Removing always clobbered register reg byte a as potential for zp ZP_BYTE:9 [ fill::val#3 ] -Statement [66] *((byte*) fill::addr#2) ← (byte) fill::val#3 [ fill::val#3 fill::end#0 fill::addr#2 ] ( main:2::init:5::fill:51 [ fill::val#3 fill::end#0 fill::addr#2 ] main:2::init:5::fill:53 [ fill::val#3 fill::end#0 fill::addr#2 ] ) always clobbers reg byte a reg byte y +Statement [74] *((byte*) fill::addr#2) ← (byte) fill::val#3 [ fill::val#3 fill::end#0 fill::addr#2 ] ( main:2::init:5::fill:59 [ fill::val#3 fill::end#0 fill::addr#2 ] main:2::init:5::fill:61 [ fill::val#3 fill::end#0 fill::addr#2 ] ) always clobbers reg byte a reg byte y Removing always clobbered register reg byte y as potential for zp ZP_BYTE:9 [ fill::val#3 ] -Statement [68] if((byte*) fill::addr#1!=(byte*) fill::end#0) goto fill::@1 [ fill::val#3 fill::end#0 fill::addr#1 ] ( main:2::init:5::fill:51 [ fill::val#3 fill::end#0 fill::addr#1 ] main:2::init:5::fill:53 [ fill::val#3 fill::end#0 fill::addr#1 ] ) always clobbers reg byte a -Statement [70] *((const byte*) SPRITES_ENABLE#0) ← (byte/signed byte/word/signed word/dword/signed dword) 1 [ ] ( main:2::init:5::init_sprites:49 [ ] ) always clobbers reg byte a -Statement [71] *((const byte*) SPRITES_EXPAND_X#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( main:2::init:5::init_sprites:49 [ ] ) always clobbers reg byte a -Statement [72] *((const byte*) SPRITES_EXPAND_Y#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( main:2::init:5::init_sprites:49 [ ] ) always clobbers reg byte a -Statement [73] *((const byte*) SPRITES_XMSB#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( main:2::init:5::init_sprites:49 [ ] ) always clobbers reg byte a -Statement [74] *((const byte*) SPRITES_COLS#0) ← (const byte) WHITE#0 [ ] ( main:2::init:5::init_sprites:49 [ ] ) always clobbers reg byte a -Statement [75] *((const byte*) SPRITES_MC#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( main:2::init:5::init_sprites:49 [ ] ) always clobbers reg byte a +Statement [76] if((byte*) fill::addr#1!=(byte*) fill::end#0) goto fill::@1 [ fill::val#3 fill::end#0 fill::addr#1 ] ( main:2::init:5::fill:59 [ fill::val#3 fill::end#0 fill::addr#1 ] main:2::init:5::fill:61 [ fill::val#3 fill::end#0 fill::addr#1 ] ) always clobbers reg byte a +Statement [78] *((const byte*) SPRITES_ENABLE#0) ← (byte/signed byte/word/signed word/dword/signed dword) 1 [ ] ( main:2::init:5::init_sprites:57 [ ] ) always clobbers reg byte a +Statement [79] *((const byte*) SPRITES_EXPAND_X#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( main:2::init:5::init_sprites:57 [ ] ) always clobbers reg byte a +Statement [80] *((const byte*) SPRITES_EXPAND_Y#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( main:2::init:5::init_sprites:57 [ ] ) always clobbers reg byte a +Statement [81] *((const byte*) SPRITES_XMSB#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( main:2::init:5::init_sprites:57 [ ] ) always clobbers reg byte a +Statement [82] *((const byte*) SPRITES_COLS#0) ← (const byte) WHITE#0 [ ] ( main:2::init:5::init_sprites:57 [ ] ) always clobbers reg byte a +Statement [83] *((const byte*) SPRITES_MC#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( main:2::init:5::init_sprites:57 [ ] ) always clobbers reg byte a Statement [8] (byte) main::z#0 ← (byte) main::x#4 + (byte) main::y#2 [ main::x#4 main::y#2 main::z#0 ] ( main:2 [ main::x#4 main::y#2 main::z#0 ] ) always clobbers reg byte a Statement [19] (byte) draw_block::tileno#1 ← (byte) draw_block::tileno#0 << (byte/signed byte/word/signed word/dword/signed dword) 2 [ draw_block::x#0 draw_block::y#0 draw_block::tileno#1 ] ( main:2::draw_block:13 [ main::x#4 main::y#2 draw_block::x#0 draw_block::y#0 draw_block::tileno#1 ] ) always clobbers reg byte a Statement [20] (byte~) draw_block::$1 ← (byte) draw_block::x#0 << (byte/signed byte/word/signed word/dword/signed dword) 1 [ draw_block::y#0 draw_block::tileno#1 draw_block::$1 ] ( main:2::draw_block:13 [ main::x#4 main::y#2 draw_block::y#0 draw_block::tileno#1 draw_block::$1 ] ) always clobbers reg byte a @@ -1547,34 +1620,42 @@ Statement [22] (byte) draw_block::y#1 ← (byte) draw_block::y#0 << (byte/signed Statement [25] (word) mul8u::return#2 ← (word) mul8u::res#2 [ draw_block::tileno#1 draw_block::x1#0 mul8u::return#2 ] ( main:2::draw_block:13 [ main::x#4 main::y#2 draw_block::tileno#1 draw_block::x1#0 mul8u::return#2 ] ) always clobbers reg byte a Statement [26] (word) draw_block::z#0 ← (word) mul8u::return#2 [ draw_block::tileno#1 draw_block::x1#0 draw_block::z#0 ] ( main:2::draw_block:13 [ main::x#4 main::y#2 draw_block::tileno#1 draw_block::x1#0 draw_block::z#0 ] ) always clobbers reg byte a Statement [27] (word) draw_block::z#1 ← (word) draw_block::z#0 + (word) draw_block::x1#0 [ draw_block::tileno#1 draw_block::z#1 ] ( main:2::draw_block:13 [ main::x#4 main::y#2 draw_block::tileno#1 draw_block::z#1 ] ) always clobbers reg byte a -Statement [29] *((const byte*) screen#0 + (word) draw_block::z#1) ← (byte) draw_block::drawtile#0 [ draw_block::z#1 ] ( main:2::draw_block:13 [ main::x#4 main::y#2 draw_block::z#1 ] ) always clobbers reg byte a -Statement [30] *((const byte*) colors#0 + (word) draw_block::z#1) ← (const byte) YELLOW#0 [ draw_block::z#1 ] ( main:2::draw_block:13 [ main::x#4 main::y#2 draw_block::z#1 ] ) always clobbers reg byte a -Statement [31] *((const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) 1 + (word) draw_block::z#1) ← (byte/signed byte/word/signed word/dword/signed dword) 1 [ draw_block::z#1 ] ( main:2::draw_block:13 [ main::x#4 main::y#2 draw_block::z#1 ] ) always clobbers reg byte a -Statement [32] *((const byte*) colors#0+(byte/signed byte/word/signed word/dword/signed dword) 1 + (word) draw_block::z#1) ← (const byte) YELLOW#0 [ draw_block::z#1 ] ( main:2::draw_block:13 [ main::x#4 main::y#2 draw_block::z#1 ] ) always clobbers reg byte a -Statement [33] *((const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) $28 + (word) draw_block::z#1) ← (byte/signed byte/word/signed word/dword/signed dword) 2 [ draw_block::z#1 ] ( main:2::draw_block:13 [ main::x#4 main::y#2 draw_block::z#1 ] ) always clobbers reg byte a -Statement [34] *((const byte*) colors#0+(byte/signed byte/word/signed word/dword/signed dword) $28 + (word) draw_block::z#1) ← (const byte) YELLOW#0 [ draw_block::z#1 ] ( main:2::draw_block:13 [ main::x#4 main::y#2 draw_block::z#1 ] ) always clobbers reg byte a -Statement [35] *((const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) $29 + (word) draw_block::z#1) ← (byte/signed byte/word/signed word/dword/signed dword) 3 [ draw_block::z#1 ] ( main:2::draw_block:13 [ main::x#4 main::y#2 draw_block::z#1 ] ) always clobbers reg byte a -Statement [36] *((const byte*) colors#0+(byte/signed byte/word/signed word/dword/signed dword) $29 + (word) draw_block::z#1) ← (const byte) YELLOW#0 [ ] ( main:2::draw_block:13 [ main::x#4 main::y#2 ] ) always clobbers reg byte a -Statement [42] (byte~) mul8u::$1 ← (byte) mul8u::a#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ mul8u::res#2 mul8u::a#2 mul8u::mb#2 mul8u::$1 ] ( main:2::draw_block:13::mul8u:24 [ main::x#4 main::y#2 draw_block::tileno#1 draw_block::x1#0 mul8u::res#2 mul8u::a#2 mul8u::mb#2 mul8u::$1 ] ) always clobbers reg byte a -Statement [44] (word) mul8u::res#1 ← (word) mul8u::res#2 + (word) mul8u::mb#2 [ mul8u::a#2 mul8u::mb#2 mul8u::res#1 ] ( main:2::draw_block:13::mul8u:24 [ main::x#4 main::y#2 draw_block::tileno#1 draw_block::x1#0 mul8u::a#2 mul8u::mb#2 mul8u::res#1 ] ) always clobbers reg byte a -Statement [55] *((const byte*) D018#0) ← (const byte) init::toD0181_return#0 [ ] ( main:2::init:5 [ ] ) always clobbers reg byte a +Statement [29] (byte*) draw_block::$11 ← (const byte*) screen#0 + (word) draw_block::z#1 [ draw_block::z#1 draw_block::drawtile#0 draw_block::$11 ] ( main:2::draw_block:13 [ main::x#4 main::y#2 draw_block::z#1 draw_block::drawtile#0 draw_block::$11 ] ) always clobbers reg byte a +Statement [30] *((byte*) draw_block::$11) ← (byte) draw_block::drawtile#0 [ draw_block::z#1 ] ( main:2::draw_block:13 [ main::x#4 main::y#2 draw_block::z#1 ] ) always clobbers reg byte a reg byte y +Statement [31] (byte*) draw_block::$12 ← (const byte*) colors#0 + (word) draw_block::z#1 [ draw_block::z#1 draw_block::$12 ] ( main:2::draw_block:13 [ main::x#4 main::y#2 draw_block::z#1 draw_block::$12 ] ) always clobbers reg byte a +Statement [32] *((byte*) draw_block::$12) ← (const byte) YELLOW#0 [ draw_block::z#1 ] ( main:2::draw_block:13 [ main::x#4 main::y#2 draw_block::z#1 ] ) always clobbers reg byte a reg byte y +Statement [33] (byte*) draw_block::$13 ← (const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) 1 + (word) draw_block::z#1 [ draw_block::z#1 draw_block::$13 ] ( main:2::draw_block:13 [ main::x#4 main::y#2 draw_block::z#1 draw_block::$13 ] ) always clobbers reg byte a +Statement [34] *((byte*) draw_block::$13) ← (byte/signed byte/word/signed word/dword/signed dword) 1 [ draw_block::z#1 ] ( main:2::draw_block:13 [ main::x#4 main::y#2 draw_block::z#1 ] ) always clobbers reg byte a reg byte y +Statement [35] (byte*) draw_block::$14 ← (const byte*) colors#0+(byte/signed byte/word/signed word/dword/signed dword) 1 + (word) draw_block::z#1 [ draw_block::z#1 draw_block::$14 ] ( main:2::draw_block:13 [ main::x#4 main::y#2 draw_block::z#1 draw_block::$14 ] ) always clobbers reg byte a +Statement [36] *((byte*) draw_block::$14) ← (const byte) YELLOW#0 [ draw_block::z#1 ] ( main:2::draw_block:13 [ main::x#4 main::y#2 draw_block::z#1 ] ) always clobbers reg byte a reg byte y +Statement [37] (byte*) draw_block::$15 ← (const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) $28 + (word) draw_block::z#1 [ draw_block::z#1 draw_block::$15 ] ( main:2::draw_block:13 [ main::x#4 main::y#2 draw_block::z#1 draw_block::$15 ] ) always clobbers reg byte a +Statement [38] *((byte*) draw_block::$15) ← (byte/signed byte/word/signed word/dword/signed dword) 2 [ draw_block::z#1 ] ( main:2::draw_block:13 [ main::x#4 main::y#2 draw_block::z#1 ] ) always clobbers reg byte a reg byte y +Statement [39] (byte*) draw_block::$16 ← (const byte*) colors#0+(byte/signed byte/word/signed word/dword/signed dword) $28 + (word) draw_block::z#1 [ draw_block::z#1 draw_block::$16 ] ( main:2::draw_block:13 [ main::x#4 main::y#2 draw_block::z#1 draw_block::$16 ] ) always clobbers reg byte a +Statement [40] *((byte*) draw_block::$16) ← (const byte) YELLOW#0 [ draw_block::z#1 ] ( main:2::draw_block:13 [ main::x#4 main::y#2 draw_block::z#1 ] ) always clobbers reg byte a reg byte y +Statement [41] (byte*) draw_block::$17 ← (const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) $29 + (word) draw_block::z#1 [ draw_block::z#1 draw_block::$17 ] ( main:2::draw_block:13 [ main::x#4 main::y#2 draw_block::z#1 draw_block::$17 ] ) always clobbers reg byte a +Statement [42] *((byte*) draw_block::$17) ← (byte/signed byte/word/signed word/dword/signed dword) 3 [ draw_block::z#1 ] ( main:2::draw_block:13 [ main::x#4 main::y#2 draw_block::z#1 ] ) always clobbers reg byte a reg byte y +Statement [43] (byte*) draw_block::$18 ← (const byte*) colors#0+(byte/signed byte/word/signed word/dword/signed dword) $29 + (word) draw_block::z#1 [ draw_block::$18 ] ( main:2::draw_block:13 [ main::x#4 main::y#2 draw_block::$18 ] ) always clobbers reg byte a +Statement [44] *((byte*) draw_block::$18) ← (const byte) YELLOW#0 [ ] ( main:2::draw_block:13 [ main::x#4 main::y#2 ] ) always clobbers reg byte a reg byte y +Statement [50] (byte~) mul8u::$1 ← (byte) mul8u::a#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ mul8u::res#2 mul8u::a#2 mul8u::mb#2 mul8u::$1 ] ( main:2::draw_block:13::mul8u:24 [ main::x#4 main::y#2 draw_block::tileno#1 draw_block::x1#0 mul8u::res#2 mul8u::a#2 mul8u::mb#2 mul8u::$1 ] ) always clobbers reg byte a +Statement [52] (word) mul8u::res#1 ← (word) mul8u::res#2 + (word) mul8u::mb#2 [ mul8u::a#2 mul8u::mb#2 mul8u::res#1 ] ( main:2::draw_block:13::mul8u:24 [ main::x#4 main::y#2 draw_block::tileno#1 draw_block::x1#0 mul8u::a#2 mul8u::mb#2 mul8u::res#1 ] ) always clobbers reg byte a +Statement [63] *((const byte*) D018#0) ← (const byte) init::toD0181_return#0 [ ] ( main:2::init:5 [ ] ) always clobbers reg byte a Statement asm { lda#$5b sta$d011 } always clobbers reg byte a -Statement [57] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 [ ] ( main:2::init:5 [ ] ) always clobbers reg byte a -Statement [58] *((const byte*) BGCOL1#0) ← (const byte) BLACK#0 [ ] ( main:2::init:5 [ ] ) always clobbers reg byte a -Statement [59] *((const byte*) BGCOL2#0) ← (const byte) RED#0 [ ] ( main:2::init:5 [ ] ) always clobbers reg byte a -Statement [60] *((const byte*) BGCOL3#0) ← (const byte) BLUE#0 [ ] ( main:2::init:5 [ ] ) always clobbers reg byte a -Statement [61] *((const byte*) BGCOL4#0) ← (const byte) GREEN#0 [ ] ( main:2::init:5 [ ] ) always clobbers reg byte a -Statement [64] (byte*) fill::end#0 ← (byte*) fill::addr#0 + (word/signed word/dword/signed dword) $3e8 [ fill::addr#0 fill::val#3 fill::end#0 ] ( main:2::init:5::fill:51 [ fill::addr#0 fill::val#3 fill::end#0 ] main:2::init:5::fill:53 [ fill::addr#0 fill::val#3 fill::end#0 ] ) always clobbers reg byte a -Statement [66] *((byte*) fill::addr#2) ← (byte) fill::val#3 [ fill::val#3 fill::end#0 fill::addr#2 ] ( main:2::init:5::fill:51 [ fill::val#3 fill::end#0 fill::addr#2 ] main:2::init:5::fill:53 [ fill::val#3 fill::end#0 fill::addr#2 ] ) always clobbers reg byte a reg byte y -Statement [68] if((byte*) fill::addr#1!=(byte*) fill::end#0) goto fill::@1 [ fill::val#3 fill::end#0 fill::addr#1 ] ( main:2::init:5::fill:51 [ fill::val#3 fill::end#0 fill::addr#1 ] main:2::init:5::fill:53 [ fill::val#3 fill::end#0 fill::addr#1 ] ) always clobbers reg byte a -Statement [70] *((const byte*) SPRITES_ENABLE#0) ← (byte/signed byte/word/signed word/dword/signed dword) 1 [ ] ( main:2::init:5::init_sprites:49 [ ] ) always clobbers reg byte a -Statement [71] *((const byte*) SPRITES_EXPAND_X#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( main:2::init:5::init_sprites:49 [ ] ) always clobbers reg byte a -Statement [72] *((const byte*) SPRITES_EXPAND_Y#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( main:2::init:5::init_sprites:49 [ ] ) always clobbers reg byte a -Statement [73] *((const byte*) SPRITES_XMSB#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( main:2::init:5::init_sprites:49 [ ] ) always clobbers reg byte a -Statement [74] *((const byte*) SPRITES_COLS#0) ← (const byte) WHITE#0 [ ] ( main:2::init:5::init_sprites:49 [ ] ) always clobbers reg byte a -Statement [75] *((const byte*) SPRITES_MC#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( main:2::init:5::init_sprites:49 [ ] ) always clobbers reg byte a -Potential registers zp ZP_BYTE:2 [ main::x#4 main::x#1 ] : zp ZP_BYTE:2 , reg byte x , reg byte y , -Potential registers zp ZP_BYTE:3 [ main::y#2 main::y#1 ] : zp ZP_BYTE:3 , reg byte x , reg byte y , +Statement [65] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 [ ] ( main:2::init:5 [ ] ) always clobbers reg byte a +Statement [66] *((const byte*) BGCOL1#0) ← (const byte) BLACK#0 [ ] ( main:2::init:5 [ ] ) always clobbers reg byte a +Statement [67] *((const byte*) BGCOL2#0) ← (const byte) RED#0 [ ] ( main:2::init:5 [ ] ) always clobbers reg byte a +Statement [68] *((const byte*) BGCOL3#0) ← (const byte) BLUE#0 [ ] ( main:2::init:5 [ ] ) always clobbers reg byte a +Statement [69] *((const byte*) BGCOL4#0) ← (const byte) GREEN#0 [ ] ( main:2::init:5 [ ] ) always clobbers reg byte a +Statement [72] (byte*) fill::end#0 ← (byte*) fill::addr#0 + (word/signed word/dword/signed dword) $3e8 [ fill::addr#0 fill::val#3 fill::end#0 ] ( main:2::init:5::fill:59 [ fill::addr#0 fill::val#3 fill::end#0 ] main:2::init:5::fill:61 [ fill::addr#0 fill::val#3 fill::end#0 ] ) always clobbers reg byte a +Statement [74] *((byte*) fill::addr#2) ← (byte) fill::val#3 [ fill::val#3 fill::end#0 fill::addr#2 ] ( main:2::init:5::fill:59 [ fill::val#3 fill::end#0 fill::addr#2 ] main:2::init:5::fill:61 [ fill::val#3 fill::end#0 fill::addr#2 ] ) always clobbers reg byte a reg byte y +Statement [76] if((byte*) fill::addr#1!=(byte*) fill::end#0) goto fill::@1 [ fill::val#3 fill::end#0 fill::addr#1 ] ( main:2::init:5::fill:59 [ fill::val#3 fill::end#0 fill::addr#1 ] main:2::init:5::fill:61 [ fill::val#3 fill::end#0 fill::addr#1 ] ) always clobbers reg byte a +Statement [78] *((const byte*) SPRITES_ENABLE#0) ← (byte/signed byte/word/signed word/dword/signed dword) 1 [ ] ( main:2::init:5::init_sprites:57 [ ] ) always clobbers reg byte a +Statement [79] *((const byte*) SPRITES_EXPAND_X#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( main:2::init:5::init_sprites:57 [ ] ) always clobbers reg byte a +Statement [80] *((const byte*) SPRITES_EXPAND_Y#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( main:2::init:5::init_sprites:57 [ ] ) always clobbers reg byte a +Statement [81] *((const byte*) SPRITES_XMSB#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( main:2::init:5::init_sprites:57 [ ] ) always clobbers reg byte a +Statement [82] *((const byte*) SPRITES_COLS#0) ← (const byte) WHITE#0 [ ] ( main:2::init:5::init_sprites:57 [ ] ) always clobbers reg byte a +Statement [83] *((const byte*) SPRITES_MC#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( main:2::init:5::init_sprites:57 [ ] ) always clobbers reg byte a +Potential registers zp ZP_BYTE:2 [ main::x#4 main::x#1 ] : zp ZP_BYTE:2 , reg byte x , +Potential registers zp ZP_BYTE:3 [ main::y#2 main::y#1 ] : zp ZP_BYTE:3 , reg byte x , Potential registers zp ZP_BYTE:4 [ mul8u::a#2 mul8u::a#1 mul8u::a#0 ] : zp ZP_BYTE:4 , reg byte x , reg byte y , Potential registers zp ZP_WORD:5 [ mul8u::res#2 mul8u::res#6 mul8u::res#1 ] : zp ZP_WORD:5 , Potential registers zp ZP_WORD:7 [ mul8u::mb#2 mul8u::mb#1 ] : zp ZP_WORD:7 , @@ -1592,47 +1673,62 @@ Potential registers zp ZP_BYTE:21 [ draw_block::y#1 ] : zp ZP_BYTE:21 , reg byte Potential registers zp ZP_WORD:22 [ mul8u::return#2 ] : zp ZP_WORD:22 , Potential registers zp ZP_WORD:24 [ draw_block::z#0 ] : zp ZP_WORD:24 , Potential registers zp ZP_WORD:26 [ draw_block::z#1 ] : zp ZP_WORD:26 , -Potential registers zp ZP_BYTE:28 [ draw_block::drawtile#0 ] : zp ZP_BYTE:28 , reg byte a , reg byte x , reg byte y , -Potential registers zp ZP_BYTE:29 [ mul8u::$1 ] : zp ZP_BYTE:29 , reg byte a , reg byte x , reg byte y , -Potential registers zp ZP_WORD:30 [ fill::end#0 ] : zp ZP_WORD:30 , +Potential registers zp ZP_BYTE:28 [ draw_block::drawtile#0 ] : zp ZP_BYTE:28 , reg byte x , reg byte y , +Potential registers zp ZP_WORD:29 [ draw_block::$11 ] : zp ZP_WORD:29 , +Potential registers zp ZP_WORD:31 [ draw_block::$12 ] : zp ZP_WORD:31 , +Potential registers zp ZP_WORD:33 [ draw_block::$13 ] : zp ZP_WORD:33 , +Potential registers zp ZP_WORD:35 [ draw_block::$14 ] : zp ZP_WORD:35 , +Potential registers zp ZP_WORD:37 [ draw_block::$15 ] : zp ZP_WORD:37 , +Potential registers zp ZP_WORD:39 [ draw_block::$16 ] : zp ZP_WORD:39 , +Potential registers zp ZP_WORD:41 [ draw_block::$17 ] : zp ZP_WORD:41 , +Potential registers zp ZP_WORD:43 [ draw_block::$18 ] : zp ZP_WORD:43 , +Potential registers zp ZP_BYTE:45 [ mul8u::$1 ] : zp ZP_BYTE:45 , reg byte a , reg byte x , reg byte y , +Potential registers zp ZP_WORD:46 [ fill::end#0 ] : zp ZP_WORD:46 , REGISTER UPLIFT SCOPES -Uplift Scope [mul8u] 3,503.83: zp ZP_WORD:5 [ mul8u::res#2 mul8u::res#6 mul8u::res#1 ] 2,431: zp ZP_WORD:7 [ mul8u::mb#2 mul8u::mb#1 ] 2,002: zp ZP_BYTE:29 [ mul8u::$1 ] 1,670.67: zp ZP_BYTE:4 [ mul8u::a#2 mul8u::a#1 mul8u::a#0 ] 4: zp ZP_WORD:22 [ mul8u::return#2 ] +Uplift Scope [mul8u] 3,503.83: zp ZP_WORD:5 [ mul8u::res#2 mul8u::res#6 mul8u::res#1 ] 2,431: zp ZP_WORD:7 [ mul8u::mb#2 mul8u::mb#1 ] 2,002: zp ZP_BYTE:45 [ mul8u::$1 ] 1,670.67: zp ZP_BYTE:4 [ mul8u::a#2 mul8u::a#1 mul8u::a#0 ] 4: zp ZP_WORD:22 [ mul8u::return#2 ] Uplift Scope [main] 209.21: zp ZP_BYTE:3 [ main::y#2 main::y#1 ] 202: zp ZP_BYTE:12 [ main::z#0 ] 202: zp ZP_BYTE:13 [ main::tile#0 ] 38.9: zp ZP_BYTE:2 [ main::x#4 main::x#1 ] -Uplift Scope [draw_block] 34.33: zp ZP_BYTE:14 [ draw_block::tileno#0 ] 34.33: zp ZP_BYTE:15 [ draw_block::x#0 ] 25.75: zp ZP_BYTE:16 [ draw_block::y#0 ] 4: zp ZP_BYTE:18 [ draw_block::$1 ] 4: zp ZP_BYTE:21 [ draw_block::y#1 ] 4: zp ZP_WORD:24 [ draw_block::z#0 ] 4: zp ZP_BYTE:28 [ draw_block::drawtile#0 ] 2: zp ZP_WORD:26 [ draw_block::z#1 ] 0.67: zp ZP_WORD:19 [ draw_block::x1#0 ] 0.44: zp ZP_BYTE:17 [ draw_block::tileno#1 ] -Uplift Scope [fill] 36: zp ZP_WORD:10 [ fill::addr#2 fill::addr#0 fill::addr#1 ] 2.6: zp ZP_WORD:30 [ fill::end#0 ] 1.83: zp ZP_BYTE:9 [ fill::val#3 ] +Uplift Scope [draw_block] 34.33: zp ZP_BYTE:14 [ draw_block::tileno#0 ] 34.33: zp ZP_BYTE:15 [ draw_block::x#0 ] 25.75: zp ZP_BYTE:16 [ draw_block::y#0 ] 4: zp ZP_BYTE:18 [ draw_block::$1 ] 4: zp ZP_BYTE:21 [ draw_block::y#1 ] 4: zp ZP_WORD:24 [ draw_block::z#0 ] 4: zp ZP_WORD:29 [ draw_block::$11 ] 4: zp ZP_WORD:31 [ draw_block::$12 ] 4: zp ZP_WORD:33 [ draw_block::$13 ] 4: zp ZP_WORD:35 [ draw_block::$14 ] 4: zp ZP_WORD:37 [ draw_block::$15 ] 4: zp ZP_WORD:39 [ draw_block::$16 ] 4: zp ZP_WORD:41 [ draw_block::$17 ] 4: zp ZP_WORD:43 [ draw_block::$18 ] 2: zp ZP_BYTE:28 [ draw_block::drawtile#0 ] 1.12: zp ZP_WORD:26 [ draw_block::z#1 ] 0.67: zp ZP_WORD:19 [ draw_block::x1#0 ] 0.44: zp ZP_BYTE:17 [ draw_block::tileno#1 ] +Uplift Scope [fill] 36: zp ZP_WORD:10 [ fill::addr#2 fill::addr#0 fill::addr#1 ] 2.6: zp ZP_WORD:46 [ fill::end#0 ] 1.83: zp ZP_BYTE:9 [ fill::val#3 ] Uplift Scope [init] Uplift Scope [init_sprites] Uplift Scope [] -Uplifting [mul8u] best 92818 combination zp ZP_WORD:5 [ mul8u::res#2 mul8u::res#6 mul8u::res#1 ] zp ZP_WORD:7 [ mul8u::mb#2 mul8u::mb#1 ] reg byte a [ mul8u::$1 ] reg byte x [ mul8u::a#2 mul8u::a#1 mul8u::a#0 ] zp ZP_WORD:22 [ mul8u::return#2 ] -Uplifting [main] best 91818 combination zp ZP_BYTE:3 [ main::y#2 main::y#1 ] reg byte a [ main::z#0 ] reg byte a [ main::tile#0 ] zp ZP_BYTE:2 [ main::x#4 main::x#1 ] -Limited combination testing to 100 combinations of 144 possible. -Uplifting [draw_block] best 90907 combination reg byte a [ draw_block::tileno#0 ] reg byte y [ draw_block::x#0 ] reg byte x [ draw_block::y#0 ] reg byte a [ draw_block::$1 ] zp ZP_BYTE:21 [ draw_block::y#1 ] zp ZP_WORD:24 [ draw_block::z#0 ] zp ZP_BYTE:28 [ draw_block::drawtile#0 ] zp ZP_WORD:26 [ draw_block::z#1 ] zp ZP_WORD:19 [ draw_block::x1#0 ] zp ZP_BYTE:17 [ draw_block::tileno#1 ] -Limited combination testing to 100 combinations of 6912 possible. -Uplifting [fill] best 90891 combination zp ZP_WORD:10 [ fill::addr#2 fill::addr#0 fill::addr#1 ] zp ZP_WORD:30 [ fill::end#0 ] reg byte x [ fill::val#3 ] -Uplifting [init] best 90891 combination -Uplifting [init_sprites] best 90891 combination -Uplifting [] best 90891 combination +Uplifting [mul8u] best 92828 combination zp ZP_WORD:5 [ mul8u::res#2 mul8u::res#6 mul8u::res#1 ] zp ZP_WORD:7 [ mul8u::mb#2 mul8u::mb#1 ] reg byte a [ mul8u::$1 ] reg byte x [ mul8u::a#2 mul8u::a#1 mul8u::a#0 ] zp ZP_WORD:22 [ mul8u::return#2 ] +Uplifting [main] best 91828 combination zp ZP_BYTE:3 [ main::y#2 main::y#1 ] reg byte a [ main::z#0 ] reg byte a [ main::tile#0 ] zp ZP_BYTE:2 [ main::x#4 main::x#1 ] +Uplifting [draw_block] best 90917 combination reg byte a [ draw_block::tileno#0 ] reg byte y [ draw_block::x#0 ] reg byte x [ draw_block::y#0 ] reg byte a [ draw_block::$1 ] zp ZP_BYTE:21 [ draw_block::y#1 ] zp ZP_WORD:24 [ draw_block::z#0 ] zp ZP_WORD:29 [ draw_block::$11 ] zp ZP_WORD:31 [ draw_block::$12 ] zp ZP_WORD:33 [ draw_block::$13 ] zp ZP_WORD:35 [ draw_block::$14 ] zp ZP_WORD:37 [ draw_block::$15 ] zp ZP_WORD:39 [ draw_block::$16 ] zp ZP_WORD:41 [ draw_block::$17 ] zp ZP_WORD:43 [ draw_block::$18 ] zp ZP_BYTE:28 [ draw_block::drawtile#0 ] zp ZP_WORD:26 [ draw_block::z#1 ] zp ZP_WORD:19 [ draw_block::x1#0 ] zp ZP_BYTE:17 [ draw_block::tileno#1 ] +Limited combination testing to 100 combinations of 5184 possible. +Uplifting [fill] best 90901 combination zp ZP_WORD:10 [ fill::addr#2 fill::addr#0 fill::addr#1 ] zp ZP_WORD:46 [ fill::end#0 ] reg byte x [ fill::val#3 ] +Uplifting [init] best 90901 combination +Uplifting [init_sprites] best 90901 combination +Uplifting [] best 90901 combination Attempting to uplift remaining variables inzp ZP_BYTE:3 [ main::y#2 main::y#1 ] -Uplifting [main] best 90891 combination zp ZP_BYTE:3 [ main::y#2 main::y#1 ] +Uplifting [main] best 90901 combination zp ZP_BYTE:3 [ main::y#2 main::y#1 ] Attempting to uplift remaining variables inzp ZP_BYTE:2 [ main::x#4 main::x#1 ] -Uplifting [main] best 90891 combination zp ZP_BYTE:2 [ main::x#4 main::x#1 ] +Uplifting [main] best 90901 combination zp ZP_BYTE:2 [ main::x#4 main::x#1 ] Attempting to uplift remaining variables inzp ZP_BYTE:21 [ draw_block::y#1 ] -Uplifting [draw_block] best 90887 combination reg byte a [ draw_block::y#1 ] +Uplifting [draw_block] best 90897 combination reg byte a [ draw_block::y#1 ] Attempting to uplift remaining variables inzp ZP_BYTE:28 [ draw_block::drawtile#0 ] -Uplifting [draw_block] best 90881 combination reg byte a [ draw_block::drawtile#0 ] +Uplifting [draw_block] best 90893 combination reg byte x [ draw_block::drawtile#0 ] Attempting to uplift remaining variables inzp ZP_BYTE:17 [ draw_block::tileno#1 ] -Uplifting [draw_block] best 90881 combination zp ZP_BYTE:17 [ draw_block::tileno#1 ] +Uplifting [draw_block] best 90893 combination zp ZP_BYTE:17 [ draw_block::tileno#1 ] Coalescing zero page register with common assignment [ zp ZP_WORD:5 [ mul8u::res#2 mul8u::res#6 mul8u::res#1 ] ] with [ zp ZP_WORD:22 [ mul8u::return#2 ] ] - score: 1 Coalescing zero page register with common assignment [ zp ZP_WORD:19 [ draw_block::x1#0 ] ] with [ zp ZP_WORD:26 [ draw_block::z#1 ] ] - score: 1 Coalescing zero page register with common assignment [ zp ZP_WORD:5 [ mul8u::res#2 mul8u::res#6 mul8u::res#1 mul8u::return#2 ] ] with [ zp ZP_WORD:24 [ draw_block::z#0 ] ] - score: 1 +Coalescing zero page register with common assignment [ zp ZP_WORD:19 [ draw_block::x1#0 draw_block::z#1 ] ] with [ zp ZP_WORD:43 [ draw_block::$18 ] ] - score: 1 Coalescing zero page register [ zp ZP_WORD:5 [ mul8u::res#2 mul8u::res#6 mul8u::res#1 mul8u::return#2 draw_block::z#0 ] ] with [ zp ZP_WORD:10 [ fill::addr#2 fill::addr#0 fill::addr#1 ] ] -Coalescing zero page register [ zp ZP_WORD:7 [ mul8u::mb#2 mul8u::mb#1 ] ] with [ zp ZP_WORD:30 [ fill::end#0 ] ] -Allocated (was zp ZP_WORD:5) zp ZP_WORD:4 [ mul8u::res#2 mul8u::res#6 mul8u::res#1 mul8u::return#2 draw_block::z#0 fill::addr#2 fill::addr#0 fill::addr#1 ] +Coalescing zero page register [ zp ZP_WORD:5 [ mul8u::res#2 mul8u::res#6 mul8u::res#1 mul8u::return#2 draw_block::z#0 fill::addr#2 fill::addr#0 fill::addr#1 ] ] with [ zp ZP_WORD:29 [ draw_block::$11 ] ] +Coalescing zero page register [ zp ZP_WORD:5 [ mul8u::res#2 mul8u::res#6 mul8u::res#1 mul8u::return#2 draw_block::z#0 fill::addr#2 fill::addr#0 fill::addr#1 draw_block::$11 ] ] with [ zp ZP_WORD:31 [ draw_block::$12 ] ] +Coalescing zero page register [ zp ZP_WORD:5 [ mul8u::res#2 mul8u::res#6 mul8u::res#1 mul8u::return#2 draw_block::z#0 fill::addr#2 fill::addr#0 fill::addr#1 draw_block::$11 draw_block::$12 ] ] with [ zp ZP_WORD:33 [ draw_block::$13 ] ] +Coalescing zero page register [ zp ZP_WORD:5 [ mul8u::res#2 mul8u::res#6 mul8u::res#1 mul8u::return#2 draw_block::z#0 fill::addr#2 fill::addr#0 fill::addr#1 draw_block::$11 draw_block::$12 draw_block::$13 ] ] with [ zp ZP_WORD:35 [ draw_block::$14 ] ] +Coalescing zero page register [ zp ZP_WORD:5 [ mul8u::res#2 mul8u::res#6 mul8u::res#1 mul8u::return#2 draw_block::z#0 fill::addr#2 fill::addr#0 fill::addr#1 draw_block::$11 draw_block::$12 draw_block::$13 draw_block::$14 ] ] with [ zp ZP_WORD:37 [ draw_block::$15 ] ] +Coalescing zero page register [ zp ZP_WORD:5 [ mul8u::res#2 mul8u::res#6 mul8u::res#1 mul8u::return#2 draw_block::z#0 fill::addr#2 fill::addr#0 fill::addr#1 draw_block::$11 draw_block::$12 draw_block::$13 draw_block::$14 draw_block::$15 ] ] with [ zp ZP_WORD:39 [ draw_block::$16 ] ] +Coalescing zero page register [ zp ZP_WORD:5 [ mul8u::res#2 mul8u::res#6 mul8u::res#1 mul8u::return#2 draw_block::z#0 fill::addr#2 fill::addr#0 fill::addr#1 draw_block::$11 draw_block::$12 draw_block::$13 draw_block::$14 draw_block::$15 draw_block::$16 ] ] with [ zp ZP_WORD:41 [ draw_block::$17 ] ] +Coalescing zero page register [ zp ZP_WORD:7 [ mul8u::mb#2 mul8u::mb#1 ] ] with [ zp ZP_WORD:46 [ fill::end#0 ] ] +Allocated (was zp ZP_WORD:5) zp ZP_WORD:4 [ mul8u::res#2 mul8u::res#6 mul8u::res#1 mul8u::return#2 draw_block::z#0 fill::addr#2 fill::addr#0 fill::addr#1 draw_block::$11 draw_block::$12 draw_block::$13 draw_block::$14 draw_block::$15 draw_block::$16 draw_block::$17 ] Allocated (was zp ZP_WORD:7) zp ZP_WORD:6 [ mul8u::mb#2 mul8u::mb#1 fill::end#0 ] Allocated (was zp ZP_BYTE:17) zp ZP_BYTE:8 [ draw_block::tileno#1 ] -Allocated (was zp ZP_WORD:19) zp ZP_WORD:9 [ draw_block::x1#0 draw_block::z#1 ] +Allocated (was zp ZP_WORD:19) zp ZP_WORD:9 [ draw_block::x1#0 draw_block::z#1 draw_block::$18 ] ASSEMBLER BEFORE OPTIMIZATION //SEG0 File Comments @@ -1687,7 +1783,7 @@ main: { .label y = 3 .label x = 2 //SEG11 [5] call init - //SEG12 [48] phi from main to init [phi:main->init] + //SEG12 [56] phi from main to init [phi:main->init] init_from_main: jsr init //SEG13 [6] phi from main to main::@1 [phi:main->main::@1] @@ -1761,6 +1857,14 @@ draw_block: { .label x1 = 9 .label z = 4 .label z_1 = 9 + .label _11 = 4 + .label _12 = 4 + .label _13 = 4 + .label _14 = 4 + .label _15 = 4 + .label _16 = 4 + .label _17 = 4 + .label _18 = 9 //SEG38 [19] (byte) draw_block::tileno#1 ← (byte) draw_block::tileno#0 << (byte/signed byte/word/signed word/dword/signed dword) 2 -- vbuz1=vbuaa_rol_2 asl asl @@ -1778,7 +1882,7 @@ draw_block: { //SEG42 [23] (byte) mul8u::a#1 ← (byte) draw_block::y#1 -- vbuxx=vbuaa tax //SEG43 [24] call mul8u - //SEG44 [38] phi from draw_block to mul8u [phi:draw_block->mul8u] + //SEG44 [46] phi from draw_block to mul8u [phi:draw_block->mul8u] mul8u_from_draw_block: jsr mul8u //SEG45 [25] (word) mul8u::return#2 ← (word) mul8u::res#2 @@ -1794,106 +1898,112 @@ draw_block: { lda z_1+1 adc z+1 sta z_1+1 - //SEG49 [28] (byte) draw_block::drawtile#0 ← *((const byte*) tileset#0 + (byte) draw_block::tileno#1) -- vbuaa=pbuc1_derefidx_vbuz1 + //SEG49 [28] (byte) draw_block::drawtile#0 ← *((const byte*) tileset#0 + (byte) draw_block::tileno#1) -- vbuxx=pbuc1_derefidx_vbuz1 ldy tileno - lda tileset,y - //SEG50 [29] *((const byte*) screen#0 + (word) draw_block::z#1) ← (byte) draw_block::drawtile#0 -- pbuc1_derefidx_vwuz1=vbuaa - sta !v++1 - lda #screen - adc z_1+1 - sta !a++2 - !v: - lda #0 - !a: - sta screen - //SEG51 [30] *((const byte*) colors#0 + (word) draw_block::z#1) ← (const byte) YELLOW#0 -- pbuc1_derefidx_vwuz1=vbuc2 - lda #screen + sta _11+1 + //SEG51 [30] *((byte*) draw_block::$11) ← (byte) draw_block::drawtile#0 -- _deref_pbuz1=vbuxx + txa + ldy #0 + sta (_11),y + //SEG52 [31] (byte*) draw_block::$12 ← (const byte*) colors#0 + (word) draw_block::z#1 -- pbuz1=pbuc1_plus_vwuz2 + lda z_1 clc - adc z_1 - sta !++1 - lda #>colors - adc z_1+1 - sta !++2 + adc #colors + sta _12+1 + //SEG53 [32] *((byte*) draw_block::$12) ← (const byte) YELLOW#0 -- _deref_pbuz1=vbuc1 lda #YELLOW - !: - sta colors - //SEG52 [31] *((const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) 1 + (word) draw_block::z#1) ← (byte/signed byte/word/signed word/dword/signed dword) 1 -- pbuc1_derefidx_vwuz1=vbuc2 - lda #screen+1 - adc z_1+1 - sta !++2 + adc #screen+1 + sta _13+1 + //SEG55 [34] *((byte*) draw_block::$13) ← (byte/signed byte/word/signed word/dword/signed dword) 1 -- _deref_pbuz1=vbuc1 lda #1 - !: - sta screen+1 - //SEG53 [32] *((const byte*) colors#0+(byte/signed byte/word/signed word/dword/signed dword) 1 + (word) draw_block::z#1) ← (const byte) YELLOW#0 -- pbuc1_derefidx_vwuz1=vbuc2 - lda #colors+1 - adc z_1+1 - sta !++2 + adc #colors+1 + sta _14+1 + //SEG57 [36] *((byte*) draw_block::$14) ← (const byte) YELLOW#0 -- _deref_pbuz1=vbuc1 lda #YELLOW - !: - sta colors+1 - //SEG54 [33] *((const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) $28 + (word) draw_block::z#1) ← (byte/signed byte/word/signed word/dword/signed dword) 2 -- pbuc1_derefidx_vwuz1=vbuc2 - lda #screen+$28 - adc z_1+1 - sta !++2 + adc #screen+$28 + sta _15+1 + //SEG59 [38] *((byte*) draw_block::$15) ← (byte/signed byte/word/signed word/dword/signed dword) 2 -- _deref_pbuz1=vbuc1 lda #2 - !: - sta screen+$28 - //SEG55 [34] *((const byte*) colors#0+(byte/signed byte/word/signed word/dword/signed dword) $28 + (word) draw_block::z#1) ← (const byte) YELLOW#0 -- pbuc1_derefidx_vwuz1=vbuc2 - lda #colors+$28 - adc z_1+1 - sta !++2 + adc #colors+$28 + sta _16+1 + //SEG61 [40] *((byte*) draw_block::$16) ← (const byte) YELLOW#0 -- _deref_pbuz1=vbuc1 lda #YELLOW - !: - sta colors+$28 - //SEG56 [35] *((const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) $29 + (word) draw_block::z#1) ← (byte/signed byte/word/signed word/dword/signed dword) 3 -- pbuc1_derefidx_vwuz1=vbuc2 - lda #screen+$29 - adc z_1+1 - sta !++2 + adc #screen+$29 + sta _17+1 + //SEG63 [42] *((byte*) draw_block::$17) ← (byte/signed byte/word/signed word/dword/signed dword) 3 -- _deref_pbuz1=vbuc1 lda #3 - !: - sta screen+$29 - //SEG57 [36] *((const byte*) colors#0+(byte/signed byte/word/signed word/dword/signed dword) $29 + (word) draw_block::z#1) ← (const byte) YELLOW#0 -- pbuc1_derefidx_vwuz1=vbuc2 - lda #colors+$29 - adc z_1+1 - sta !++2 + lda _18 + adc #colors+$29 + sta _18+1 + //SEG65 [44] *((byte*) draw_block::$18) ← (const byte) YELLOW#0 -- _deref_pbuz1=vbuc1 lda #YELLOW - !: - sta colors+$29 + ldy #0 + sta (_18),y jmp breturn - //SEG58 draw_block::@return + //SEG66 draw_block::@return breturn: - //SEG59 [37] return + //SEG67 [45] return rts } -//SEG60 mul8u +//SEG68 mul8u // Perform binary multiplication of two unsigned 8-bit bytes into a 16-bit unsigned word // mul8u(byte register(X) a) mul8u: { @@ -1901,42 +2011,42 @@ mul8u: { .label mb = 6 .label res = 4 .label return = 4 - //SEG61 [39] phi from mul8u to mul8u::@1 [phi:mul8u->mul8u::@1] + //SEG69 [47] phi from mul8u to mul8u::@1 [phi:mul8u->mul8u::@1] b1_from_mul8u: - //SEG62 [39] phi (word) mul8u::mb#2 = ((word))(const byte) mul8u::b#0 [phi:mul8u->mul8u::@1#0] -- vwuz1=vbuc1 + //SEG70 [47] phi (word) mul8u::mb#2 = ((word))(const byte) mul8u::b#0 [phi:mul8u->mul8u::@1#0] -- vwuz1=vbuc1 lda #b sta mb lda #0 sta mb+1 - //SEG63 [39] phi (word) mul8u::res#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:mul8u->mul8u::@1#1] -- vwuz1=vbuc1 + //SEG71 [47] phi (word) mul8u::res#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:mul8u->mul8u::@1#1] -- vwuz1=vbuc1 lda #0 sta res lda #0 sta res+1 - //SEG64 [39] phi (byte) mul8u::a#2 = (byte) mul8u::a#1 [phi:mul8u->mul8u::@1#2] -- register_copy + //SEG72 [47] phi (byte) mul8u::a#2 = (byte) mul8u::a#1 [phi:mul8u->mul8u::@1#2] -- register_copy jmp b1 - //SEG65 mul8u::@1 + //SEG73 mul8u::@1 b1: - //SEG66 [40] if((byte) mul8u::a#2!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto mul8u::@2 -- vbuxx_neq_0_then_la1 + //SEG74 [48] if((byte) mul8u::a#2!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto mul8u::@2 -- vbuxx_neq_0_then_la1 cpx #0 bne b2 jmp breturn - //SEG67 mul8u::@return + //SEG75 mul8u::@return breturn: - //SEG68 [41] return + //SEG76 [49] return rts - //SEG69 mul8u::@2 + //SEG77 mul8u::@2 b2: - //SEG70 [42] (byte~) mul8u::$1 ← (byte) mul8u::a#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuaa=vbuxx_band_vbuc1 + //SEG78 [50] (byte~) mul8u::$1 ← (byte) mul8u::a#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuaa=vbuxx_band_vbuc1 txa and #1 - //SEG71 [43] if((byte~) mul8u::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto mul8u::@3 -- vbuaa_eq_0_then_la1 + //SEG79 [51] if((byte~) mul8u::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto mul8u::@3 -- vbuaa_eq_0_then_la1 cmp #0 beq b3_from_b2 jmp b4 - //SEG72 mul8u::@4 + //SEG80 mul8u::@4 b4: - //SEG73 [44] (word) mul8u::res#1 ← (word) mul8u::res#2 + (word) mul8u::mb#2 -- vwuz1=vwuz1_plus_vwuz2 + //SEG81 [52] (word) mul8u::res#1 ← (word) mul8u::res#2 + (word) mul8u::mb#2 -- vwuz1=vwuz1_plus_vwuz2 lda res clc adc mb @@ -1944,106 +2054,106 @@ mul8u: { lda res+1 adc mb+1 sta res+1 - //SEG74 [45] phi from mul8u::@2 mul8u::@4 to mul8u::@3 [phi:mul8u::@2/mul8u::@4->mul8u::@3] + //SEG82 [53] phi from mul8u::@2 mul8u::@4 to mul8u::@3 [phi:mul8u::@2/mul8u::@4->mul8u::@3] b3_from_b2: b3_from_b4: - //SEG75 [45] phi (word) mul8u::res#6 = (word) mul8u::res#2 [phi:mul8u::@2/mul8u::@4->mul8u::@3#0] -- register_copy + //SEG83 [53] phi (word) mul8u::res#6 = (word) mul8u::res#2 [phi:mul8u::@2/mul8u::@4->mul8u::@3#0] -- register_copy jmp b3 - //SEG76 mul8u::@3 + //SEG84 mul8u::@3 b3: - //SEG77 [46] (byte) mul8u::a#0 ← (byte) mul8u::a#2 >> (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuxx=vbuxx_ror_1 + //SEG85 [54] (byte) mul8u::a#0 ← (byte) mul8u::a#2 >> (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuxx=vbuxx_ror_1 txa lsr tax - //SEG78 [47] (word) mul8u::mb#1 ← (word) mul8u::mb#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 -- vwuz1=vwuz1_rol_1 + //SEG86 [55] (word) mul8u::mb#1 ← (word) mul8u::mb#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 -- vwuz1=vwuz1_rol_1 asl mb rol mb+1 - //SEG79 [39] phi from mul8u::@3 to mul8u::@1 [phi:mul8u::@3->mul8u::@1] + //SEG87 [47] phi from mul8u::@3 to mul8u::@1 [phi:mul8u::@3->mul8u::@1] b1_from_b3: - //SEG80 [39] phi (word) mul8u::mb#2 = (word) mul8u::mb#1 [phi:mul8u::@3->mul8u::@1#0] -- register_copy - //SEG81 [39] phi (word) mul8u::res#2 = (word) mul8u::res#6 [phi:mul8u::@3->mul8u::@1#1] -- register_copy - //SEG82 [39] phi (byte) mul8u::a#2 = (byte) mul8u::a#0 [phi:mul8u::@3->mul8u::@1#2] -- register_copy + //SEG88 [47] phi (word) mul8u::mb#2 = (word) mul8u::mb#1 [phi:mul8u::@3->mul8u::@1#0] -- register_copy + //SEG89 [47] phi (word) mul8u::res#2 = (word) mul8u::res#6 [phi:mul8u::@3->mul8u::@1#1] -- register_copy + //SEG90 [47] phi (byte) mul8u::a#2 = (byte) mul8u::a#0 [phi:mul8u::@3->mul8u::@1#2] -- register_copy jmp b1 } -//SEG83 init +//SEG91 init init: { .const toD0181_return = (>(screen&$3fff)*4)|(>charset)/4&$f - //SEG84 [49] call init_sprites + //SEG92 [57] call init_sprites jsr init_sprites - //SEG85 [50] phi from init to init::@2 [phi:init->init::@2] + //SEG93 [58] phi from init to init::@2 [phi:init->init::@2] b2_from_init: jmp b2 - //SEG86 init::@2 + //SEG94 init::@2 b2: - //SEG87 [51] call fill - //SEG88 [63] phi from init::@2 to fill [phi:init::@2->fill] + //SEG95 [59] call fill + //SEG96 [71] phi from init::@2 to fill [phi:init::@2->fill] fill_from_b2: - //SEG89 [63] phi (byte) fill::val#3 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:init::@2->fill#0] -- vbuxx=vbuc1 + //SEG97 [71] phi (byte) fill::val#3 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:init::@2->fill#0] -- vbuxx=vbuc1 ldx #0 - //SEG90 [63] phi (byte*) fill::addr#0 = (const byte*) screen#0 [phi:init::@2->fill#1] -- pbuz1=pbuc1 + //SEG98 [71] phi (byte*) fill::addr#0 = (const byte*) screen#0 [phi:init::@2->fill#1] -- pbuz1=pbuc1 lda #screen sta fill.addr+1 jsr fill - //SEG91 [52] phi from init::@2 to init::@3 [phi:init::@2->init::@3] + //SEG99 [60] phi from init::@2 to init::@3 [phi:init::@2->init::@3] b3_from_b2: jmp b3 - //SEG92 init::@3 + //SEG100 init::@3 b3: - //SEG93 [53] call fill - //SEG94 [63] phi from init::@3 to fill [phi:init::@3->fill] + //SEG101 [61] call fill + //SEG102 [71] phi from init::@3 to fill [phi:init::@3->fill] fill_from_b3: - //SEG95 [63] phi (byte) fill::val#3 = (const byte) BLACK#0 [phi:init::@3->fill#0] -- vbuxx=vbuc1 + //SEG103 [71] phi (byte) fill::val#3 = (const byte) BLACK#0 [phi:init::@3->fill#0] -- vbuxx=vbuc1 ldx #BLACK - //SEG96 [63] phi (byte*) fill::addr#0 = (const byte*) colors#0 [phi:init::@3->fill#1] -- pbuz1=pbuc1 + //SEG104 [71] phi (byte*) fill::addr#0 = (const byte*) colors#0 [phi:init::@3->fill#1] -- pbuz1=pbuc1 lda #colors sta fill.addr+1 jsr fill - //SEG97 [54] phi from init::@3 to init::toD0181 [phi:init::@3->init::toD0181] + //SEG105 [62] phi from init::@3 to init::toD0181 [phi:init::@3->init::toD0181] toD0181_from_b3: jmp toD0181 - //SEG98 init::toD0181 + //SEG106 init::toD0181 toD0181: jmp b1 - //SEG99 init::@1 + //SEG107 init::@1 b1: - //SEG100 [55] *((const byte*) D018#0) ← (const byte) init::toD0181_return#0 -- _deref_pbuc1=vbuc2 + //SEG108 [63] *((const byte*) D018#0) ← (const byte) init::toD0181_return#0 -- _deref_pbuc1=vbuc2 lda #toD0181_return sta D018 - //SEG101 asm { lda#$5b sta$d011 } + //SEG109 asm { lda#$5b sta$d011 } lda #$5b sta $d011 - //SEG102 [57] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 -- _deref_pbuc1=vbuc2 + //SEG110 [65] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 -- _deref_pbuc1=vbuc2 lda #BLACK sta BORDERCOL - //SEG103 [58] *((const byte*) BGCOL1#0) ← (const byte) BLACK#0 -- _deref_pbuc1=vbuc2 + //SEG111 [66] *((const byte*) BGCOL1#0) ← (const byte) BLACK#0 -- _deref_pbuc1=vbuc2 lda #BLACK sta BGCOL1 - //SEG104 [59] *((const byte*) BGCOL2#0) ← (const byte) RED#0 -- _deref_pbuc1=vbuc2 + //SEG112 [67] *((const byte*) BGCOL2#0) ← (const byte) RED#0 -- _deref_pbuc1=vbuc2 lda #RED sta BGCOL2 - //SEG105 [60] *((const byte*) BGCOL3#0) ← (const byte) BLUE#0 -- _deref_pbuc1=vbuc2 + //SEG113 [68] *((const byte*) BGCOL3#0) ← (const byte) BLUE#0 -- _deref_pbuc1=vbuc2 lda #BLUE sta BGCOL3 - //SEG106 [61] *((const byte*) BGCOL4#0) ← (const byte) GREEN#0 -- _deref_pbuc1=vbuc2 + //SEG114 [69] *((const byte*) BGCOL4#0) ← (const byte) GREEN#0 -- _deref_pbuc1=vbuc2 lda #GREEN sta BGCOL4 jmp breturn - //SEG107 init::@return + //SEG115 init::@return breturn: - //SEG108 [62] return + //SEG116 [70] return rts } -//SEG109 fill +//SEG117 fill // Fill some memory with a value // fill(byte register(X) val) fill: { .label end = 6 .label addr = 4 - //SEG110 [64] (byte*) fill::end#0 ← (byte*) fill::addr#0 + (word/signed word/dword/signed dword) $3e8 -- pbuz1=pbuz2_plus_vwuc1 + //SEG118 [72] (byte*) fill::end#0 ← (byte*) fill::addr#0 + (word/signed word/dword/signed dword) $3e8 -- pbuz1=pbuz2_plus_vwuc1 lda addr clc adc #<$3e8 @@ -2051,23 +2161,23 @@ fill: { lda addr+1 adc #>$3e8 sta end+1 - //SEG111 [65] phi from fill fill::@1 to fill::@1 [phi:fill/fill::@1->fill::@1] + //SEG119 [73] phi from fill fill::@1 to fill::@1 [phi:fill/fill::@1->fill::@1] b1_from_fill: b1_from_b1: - //SEG112 [65] phi (byte*) fill::addr#2 = (byte*) fill::addr#0 [phi:fill/fill::@1->fill::@1#0] -- register_copy + //SEG120 [73] phi (byte*) fill::addr#2 = (byte*) fill::addr#0 [phi:fill/fill::@1->fill::@1#0] -- register_copy jmp b1 - //SEG113 fill::@1 + //SEG121 fill::@1 b1: - //SEG114 [66] *((byte*) fill::addr#2) ← (byte) fill::val#3 -- _deref_pbuz1=vbuxx + //SEG122 [74] *((byte*) fill::addr#2) ← (byte) fill::val#3 -- _deref_pbuz1=vbuxx txa ldy #0 sta (addr),y - //SEG115 [67] (byte*) fill::addr#1 ← ++ (byte*) fill::addr#2 -- pbuz1=_inc_pbuz1 + //SEG123 [75] (byte*) fill::addr#1 ← ++ (byte*) fill::addr#2 -- pbuz1=_inc_pbuz1 inc addr bne !+ inc addr+1 !: - //SEG116 [68] if((byte*) fill::addr#1!=(byte*) fill::end#0) goto fill::@1 -- pbuz1_neq_pbuz2_then_la1 + //SEG124 [76] if((byte*) fill::addr#1!=(byte*) fill::end#0) goto fill::@1 -- pbuz1_neq_pbuz2_then_la1 lda addr+1 cmp end+1 bne b1_from_b1 @@ -2075,36 +2185,36 @@ fill: { cmp end bne b1_from_b1 jmp breturn - //SEG117 fill::@return + //SEG125 fill::@return breturn: - //SEG118 [69] return + //SEG126 [77] return rts } -//SEG119 init_sprites +//SEG127 init_sprites init_sprites: { - //SEG120 [70] *((const byte*) SPRITES_ENABLE#0) ← (byte/signed byte/word/signed word/dword/signed dword) 1 -- _deref_pbuc1=vbuc2 + //SEG128 [78] *((const byte*) SPRITES_ENABLE#0) ← (byte/signed byte/word/signed word/dword/signed dword) 1 -- _deref_pbuc1=vbuc2 lda #1 sta SPRITES_ENABLE - //SEG121 [71] *((const byte*) SPRITES_EXPAND_X#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2 + //SEG129 [79] *((const byte*) SPRITES_EXPAND_X#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2 // one sprite enabled lda #0 sta SPRITES_EXPAND_X - //SEG122 [72] *((const byte*) SPRITES_EXPAND_Y#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2 + //SEG130 [80] *((const byte*) SPRITES_EXPAND_Y#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2 lda #0 sta SPRITES_EXPAND_Y - //SEG123 [73] *((const byte*) SPRITES_XMSB#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2 + //SEG131 [81] *((const byte*) SPRITES_XMSB#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2 lda #0 sta SPRITES_XMSB - //SEG124 [74] *((const byte*) SPRITES_COLS#0) ← (const byte) WHITE#0 -- _deref_pbuc1=vbuc2 + //SEG132 [82] *((const byte*) SPRITES_COLS#0) ← (const byte) WHITE#0 -- _deref_pbuc1=vbuc2 lda #WHITE sta SPRITES_COLS - //SEG125 [75] *((const byte*) SPRITES_MC#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2 + //SEG133 [83] *((const byte*) SPRITES_MC#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2 lda #0 sta SPRITES_MC jmp breturn - //SEG126 init_sprites::@return + //SEG134 init_sprites::@return breturn: - //SEG127 [76] return + //SEG135 [84] return rts } @@ -2131,6 +2241,13 @@ Removing instruction jmp b1 Removing instruction jmp breturn Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination +Removing instruction ldy #0 +Removing instruction ldy #0 +Removing instruction ldy #0 +Removing instruction ldy #0 +Removing instruction ldy #0 +Removing instruction ldy #0 +Removing instruction ldy #0 Removing instruction lda #0 Removing instruction lda #0 Removing instruction lda #BLACK @@ -2237,11 +2354,19 @@ FINAL SYMBOL TABLE (const byte*) colors#0 colors = ((byte*))(word/dword/signed dword) $d800 (void()) draw_block((byte) draw_block::tileno , (byte) draw_block::x , (byte) draw_block::y , (byte) draw_block::color) (byte~) draw_block::$1 reg byte a 4.0 +(byte*) draw_block::$11 $11 zp ZP_WORD:4 4.0 +(byte*) draw_block::$12 $12 zp ZP_WORD:4 4.0 +(byte*) draw_block::$13 $13 zp ZP_WORD:4 4.0 +(byte*) draw_block::$14 $14 zp ZP_WORD:4 4.0 +(byte*) draw_block::$15 $15 zp ZP_WORD:4 4.0 +(byte*) draw_block::$16 $16 zp ZP_WORD:4 4.0 +(byte*) draw_block::$17 $17 zp ZP_WORD:4 4.0 +(byte*) draw_block::$18 $18 zp ZP_WORD:9 4.0 (label) draw_block::@1 (label) draw_block::@return (byte) draw_block::color (byte) draw_block::drawtile -(byte) draw_block::drawtile#0 reg byte a 4.0 +(byte) draw_block::drawtile#0 reg byte x 2.0 (byte) draw_block::tileno (byte) draw_block::tileno#0 reg byte a 34.33333333333333 (byte) draw_block::tileno#1 tileno zp ZP_BYTE:8 0.4444444444444444 @@ -2254,7 +2379,7 @@ FINAL SYMBOL TABLE (byte) draw_block::y#1 reg byte a 4.0 (word) draw_block::z (word) draw_block::z#0 z zp ZP_WORD:4 4.0 -(word) draw_block::z#1 z#1 zp ZP_WORD:9 2.0000000000000004 +(word) draw_block::z#1 z#1 zp ZP_WORD:9 1.125 (void()) fill((byte*) fill::start , (word) fill::size , (byte) fill::val) (label) fill::@1 (label) fill::@return @@ -2337,7 +2462,7 @@ FINAL SYMBOL TABLE zp ZP_BYTE:2 [ main::x#4 main::x#1 ] zp ZP_BYTE:3 [ main::y#2 main::y#1 ] reg byte x [ mul8u::a#2 mul8u::a#1 mul8u::a#0 ] -zp ZP_WORD:4 [ mul8u::res#2 mul8u::res#6 mul8u::res#1 mul8u::return#2 draw_block::z#0 fill::addr#2 fill::addr#0 fill::addr#1 ] +zp ZP_WORD:4 [ mul8u::res#2 mul8u::res#6 mul8u::res#1 mul8u::return#2 draw_block::z#0 fill::addr#2 fill::addr#0 fill::addr#1 draw_block::$11 draw_block::$12 draw_block::$13 draw_block::$14 draw_block::$15 draw_block::$16 draw_block::$17 ] zp ZP_WORD:6 [ mul8u::mb#2 mul8u::mb#1 fill::end#0 ] reg byte x [ fill::val#3 ] reg byte a [ main::z#0 ] @@ -2347,14 +2472,14 @@ reg byte y [ draw_block::x#0 ] reg byte x [ draw_block::y#0 ] zp ZP_BYTE:8 [ draw_block::tileno#1 ] reg byte a [ draw_block::$1 ] -zp ZP_WORD:9 [ draw_block::x1#0 draw_block::z#1 ] +zp ZP_WORD:9 [ draw_block::x1#0 draw_block::z#1 draw_block::$18 ] reg byte a [ draw_block::y#1 ] -reg byte a [ draw_block::drawtile#0 ] +reg byte x [ draw_block::drawtile#0 ] reg byte a [ mul8u::$1 ] FINAL ASSEMBLER -Score: 73438 +Score: 73436 //SEG0 File Comments // Illustrates a problem with a missing fragment - pbuc1_derefidx_vwuz1=vbuz2 @@ -2399,7 +2524,7 @@ main: { .label y = 3 .label x = 2 //SEG11 [5] call init - //SEG12 [48] phi from main to init [phi:main->init] + //SEG12 [56] phi from main to init [phi:main->init] jsr init //SEG13 [6] phi from main to main::@1 [phi:main->main::@1] //SEG14 [6] phi (byte) main::x#4 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1 @@ -2457,6 +2582,14 @@ draw_block: { .label x1 = 9 .label z = 4 .label z_1 = 9 + .label _11 = 4 + .label _12 = 4 + .label _13 = 4 + .label _14 = 4 + .label _15 = 4 + .label _16 = 4 + .label _17 = 4 + .label _18 = 9 //SEG38 [19] (byte) draw_block::tileno#1 ← (byte) draw_block::tileno#0 << (byte/signed byte/word/signed word/dword/signed dword) 2 -- vbuz1=vbuaa_rol_2 asl asl @@ -2474,7 +2607,7 @@ draw_block: { //SEG42 [23] (byte) mul8u::a#1 ← (byte) draw_block::y#1 -- vbuxx=vbuaa tax //SEG43 [24] call mul8u - //SEG44 [38] phi from draw_block to mul8u [phi:draw_block->mul8u] + //SEG44 [46] phi from draw_block to mul8u [phi:draw_block->mul8u] jsr mul8u //SEG45 [25] (word) mul8u::return#2 ← (word) mul8u::res#2 //SEG46 draw_block::@1 @@ -2487,104 +2620,103 @@ draw_block: { lda z_1+1 adc z+1 sta z_1+1 - //SEG49 [28] (byte) draw_block::drawtile#0 ← *((const byte*) tileset#0 + (byte) draw_block::tileno#1) -- vbuaa=pbuc1_derefidx_vbuz1 + //SEG49 [28] (byte) draw_block::drawtile#0 ← *((const byte*) tileset#0 + (byte) draw_block::tileno#1) -- vbuxx=pbuc1_derefidx_vbuz1 ldy tileno - lda tileset,y - //SEG50 [29] *((const byte*) screen#0 + (word) draw_block::z#1) ← (byte) draw_block::drawtile#0 -- pbuc1_derefidx_vwuz1=vbuaa - sta !v++1 - lda #screen - adc z_1+1 - sta !a++2 - !v: - lda #0 - !a: - sta screen - //SEG51 [30] *((const byte*) colors#0 + (word) draw_block::z#1) ← (const byte) YELLOW#0 -- pbuc1_derefidx_vwuz1=vbuc2 - lda #screen + sta _11+1 + //SEG51 [30] *((byte*) draw_block::$11) ← (byte) draw_block::drawtile#0 -- _deref_pbuz1=vbuxx + txa + ldy #0 + sta (_11),y + //SEG52 [31] (byte*) draw_block::$12 ← (const byte*) colors#0 + (word) draw_block::z#1 -- pbuz1=pbuc1_plus_vwuz2 + lda z_1 clc - adc z_1 - sta !++1 - lda #>colors - adc z_1+1 - sta !++2 + adc #colors + sta _12+1 + //SEG53 [32] *((byte*) draw_block::$12) ← (const byte) YELLOW#0 -- _deref_pbuz1=vbuc1 lda #YELLOW - !: - sta colors - //SEG52 [31] *((const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) 1 + (word) draw_block::z#1) ← (byte/signed byte/word/signed word/dword/signed dword) 1 -- pbuc1_derefidx_vwuz1=vbuc2 - lda #screen+1 - adc z_1+1 - sta !++2 + adc #screen+1 + sta _13+1 + //SEG55 [34] *((byte*) draw_block::$13) ← (byte/signed byte/word/signed word/dword/signed dword) 1 -- _deref_pbuz1=vbuc1 lda #1 - !: - sta screen+1 - //SEG53 [32] *((const byte*) colors#0+(byte/signed byte/word/signed word/dword/signed dword) 1 + (word) draw_block::z#1) ← (const byte) YELLOW#0 -- pbuc1_derefidx_vwuz1=vbuc2 - lda #colors+1 - adc z_1+1 - sta !++2 + adc #colors+1 + sta _14+1 + //SEG57 [36] *((byte*) draw_block::$14) ← (const byte) YELLOW#0 -- _deref_pbuz1=vbuc1 lda #YELLOW - !: - sta colors+1 - //SEG54 [33] *((const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) $28 + (word) draw_block::z#1) ← (byte/signed byte/word/signed word/dword/signed dword) 2 -- pbuc1_derefidx_vwuz1=vbuc2 - lda #screen+$28 - adc z_1+1 - sta !++2 + adc #screen+$28 + sta _15+1 + //SEG59 [38] *((byte*) draw_block::$15) ← (byte/signed byte/word/signed word/dword/signed dword) 2 -- _deref_pbuz1=vbuc1 lda #2 - !: - sta screen+$28 - //SEG55 [34] *((const byte*) colors#0+(byte/signed byte/word/signed word/dword/signed dword) $28 + (word) draw_block::z#1) ← (const byte) YELLOW#0 -- pbuc1_derefidx_vwuz1=vbuc2 - lda #colors+$28 - adc z_1+1 - sta !++2 + adc #colors+$28 + sta _16+1 + //SEG61 [40] *((byte*) draw_block::$16) ← (const byte) YELLOW#0 -- _deref_pbuz1=vbuc1 lda #YELLOW - !: - sta colors+$28 - //SEG56 [35] *((const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) $29 + (word) draw_block::z#1) ← (byte/signed byte/word/signed word/dword/signed dword) 3 -- pbuc1_derefidx_vwuz1=vbuc2 - lda #screen+$29 - adc z_1+1 - sta !++2 + adc #screen+$29 + sta _17+1 + //SEG63 [42] *((byte*) draw_block::$17) ← (byte/signed byte/word/signed word/dword/signed dword) 3 -- _deref_pbuz1=vbuc1 lda #3 - !: - sta screen+$29 - //SEG57 [36] *((const byte*) colors#0+(byte/signed byte/word/signed word/dword/signed dword) $29 + (word) draw_block::z#1) ← (const byte) YELLOW#0 -- pbuc1_derefidx_vwuz1=vbuc2 - lda #colors+$29 - adc z_1+1 - sta !++2 + lda _18 + adc #colors+$29 + sta _18+1 + //SEG65 [44] *((byte*) draw_block::$18) ← (const byte) YELLOW#0 -- _deref_pbuz1=vbuc1 lda #YELLOW - !: - sta colors+$29 - //SEG58 draw_block::@return - //SEG59 [37] return + sta (_18),y + //SEG66 draw_block::@return + //SEG67 [45] return rts } -//SEG60 mul8u +//SEG68 mul8u // Perform binary multiplication of two unsigned 8-bit bytes into a 16-bit unsigned word // mul8u(byte register(X) a) mul8u: { @@ -2592,34 +2724,34 @@ mul8u: { .label mb = 6 .label res = 4 .label return = 4 - //SEG61 [39] phi from mul8u to mul8u::@1 [phi:mul8u->mul8u::@1] - //SEG62 [39] phi (word) mul8u::mb#2 = ((word))(const byte) mul8u::b#0 [phi:mul8u->mul8u::@1#0] -- vwuz1=vbuc1 + //SEG69 [47] phi from mul8u to mul8u::@1 [phi:mul8u->mul8u::@1] + //SEG70 [47] phi (word) mul8u::mb#2 = ((word))(const byte) mul8u::b#0 [phi:mul8u->mul8u::@1#0] -- vwuz1=vbuc1 lda #b sta mb lda #0 sta mb+1 - //SEG63 [39] phi (word) mul8u::res#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:mul8u->mul8u::@1#1] -- vwuz1=vbuc1 + //SEG71 [47] phi (word) mul8u::res#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:mul8u->mul8u::@1#1] -- vwuz1=vbuc1 sta res sta res+1 - //SEG64 [39] phi (byte) mul8u::a#2 = (byte) mul8u::a#1 [phi:mul8u->mul8u::@1#2] -- register_copy - //SEG65 mul8u::@1 + //SEG72 [47] phi (byte) mul8u::a#2 = (byte) mul8u::a#1 [phi:mul8u->mul8u::@1#2] -- register_copy + //SEG73 mul8u::@1 b1: - //SEG66 [40] if((byte) mul8u::a#2!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto mul8u::@2 -- vbuxx_neq_0_then_la1 + //SEG74 [48] if((byte) mul8u::a#2!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto mul8u::@2 -- vbuxx_neq_0_then_la1 cpx #0 bne b2 - //SEG67 mul8u::@return - //SEG68 [41] return + //SEG75 mul8u::@return + //SEG76 [49] return rts - //SEG69 mul8u::@2 + //SEG77 mul8u::@2 b2: - //SEG70 [42] (byte~) mul8u::$1 ← (byte) mul8u::a#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuaa=vbuxx_band_vbuc1 + //SEG78 [50] (byte~) mul8u::$1 ← (byte) mul8u::a#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuaa=vbuxx_band_vbuc1 txa and #1 - //SEG71 [43] if((byte~) mul8u::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto mul8u::@3 -- vbuaa_eq_0_then_la1 + //SEG79 [51] if((byte~) mul8u::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto mul8u::@3 -- vbuaa_eq_0_then_la1 cmp #0 beq b3 - //SEG72 mul8u::@4 - //SEG73 [44] (word) mul8u::res#1 ← (word) mul8u::res#2 + (word) mul8u::mb#2 -- vwuz1=vwuz1_plus_vwuz2 + //SEG80 mul8u::@4 + //SEG81 [52] (word) mul8u::res#1 ← (word) mul8u::res#2 + (word) mul8u::mb#2 -- vwuz1=vwuz1_plus_vwuz2 lda res clc adc mb @@ -2627,86 +2759,86 @@ mul8u: { lda res+1 adc mb+1 sta res+1 - //SEG74 [45] phi from mul8u::@2 mul8u::@4 to mul8u::@3 [phi:mul8u::@2/mul8u::@4->mul8u::@3] - //SEG75 [45] phi (word) mul8u::res#6 = (word) mul8u::res#2 [phi:mul8u::@2/mul8u::@4->mul8u::@3#0] -- register_copy - //SEG76 mul8u::@3 + //SEG82 [53] phi from mul8u::@2 mul8u::@4 to mul8u::@3 [phi:mul8u::@2/mul8u::@4->mul8u::@3] + //SEG83 [53] phi (word) mul8u::res#6 = (word) mul8u::res#2 [phi:mul8u::@2/mul8u::@4->mul8u::@3#0] -- register_copy + //SEG84 mul8u::@3 b3: - //SEG77 [46] (byte) mul8u::a#0 ← (byte) mul8u::a#2 >> (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuxx=vbuxx_ror_1 + //SEG85 [54] (byte) mul8u::a#0 ← (byte) mul8u::a#2 >> (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuxx=vbuxx_ror_1 txa lsr tax - //SEG78 [47] (word) mul8u::mb#1 ← (word) mul8u::mb#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 -- vwuz1=vwuz1_rol_1 + //SEG86 [55] (word) mul8u::mb#1 ← (word) mul8u::mb#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 -- vwuz1=vwuz1_rol_1 asl mb rol mb+1 - //SEG79 [39] phi from mul8u::@3 to mul8u::@1 [phi:mul8u::@3->mul8u::@1] - //SEG80 [39] phi (word) mul8u::mb#2 = (word) mul8u::mb#1 [phi:mul8u::@3->mul8u::@1#0] -- register_copy - //SEG81 [39] phi (word) mul8u::res#2 = (word) mul8u::res#6 [phi:mul8u::@3->mul8u::@1#1] -- register_copy - //SEG82 [39] phi (byte) mul8u::a#2 = (byte) mul8u::a#0 [phi:mul8u::@3->mul8u::@1#2] -- register_copy + //SEG87 [47] phi from mul8u::@3 to mul8u::@1 [phi:mul8u::@3->mul8u::@1] + //SEG88 [47] phi (word) mul8u::mb#2 = (word) mul8u::mb#1 [phi:mul8u::@3->mul8u::@1#0] -- register_copy + //SEG89 [47] phi (word) mul8u::res#2 = (word) mul8u::res#6 [phi:mul8u::@3->mul8u::@1#1] -- register_copy + //SEG90 [47] phi (byte) mul8u::a#2 = (byte) mul8u::a#0 [phi:mul8u::@3->mul8u::@1#2] -- register_copy jmp b1 } -//SEG83 init +//SEG91 init init: { .const toD0181_return = (>(screen&$3fff)*4)|(>charset)/4&$f - //SEG84 [49] call init_sprites + //SEG92 [57] call init_sprites jsr init_sprites - //SEG85 [50] phi from init to init::@2 [phi:init->init::@2] - //SEG86 init::@2 - //SEG87 [51] call fill - //SEG88 [63] phi from init::@2 to fill [phi:init::@2->fill] - //SEG89 [63] phi (byte) fill::val#3 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:init::@2->fill#0] -- vbuxx=vbuc1 + //SEG93 [58] phi from init to init::@2 [phi:init->init::@2] + //SEG94 init::@2 + //SEG95 [59] call fill + //SEG96 [71] phi from init::@2 to fill [phi:init::@2->fill] + //SEG97 [71] phi (byte) fill::val#3 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:init::@2->fill#0] -- vbuxx=vbuc1 ldx #0 - //SEG90 [63] phi (byte*) fill::addr#0 = (const byte*) screen#0 [phi:init::@2->fill#1] -- pbuz1=pbuc1 + //SEG98 [71] phi (byte*) fill::addr#0 = (const byte*) screen#0 [phi:init::@2->fill#1] -- pbuz1=pbuc1 lda #screen sta fill.addr+1 jsr fill - //SEG91 [52] phi from init::@2 to init::@3 [phi:init::@2->init::@3] - //SEG92 init::@3 - //SEG93 [53] call fill - //SEG94 [63] phi from init::@3 to fill [phi:init::@3->fill] - //SEG95 [63] phi (byte) fill::val#3 = (const byte) BLACK#0 [phi:init::@3->fill#0] -- vbuxx=vbuc1 + //SEG99 [60] phi from init::@2 to init::@3 [phi:init::@2->init::@3] + //SEG100 init::@3 + //SEG101 [61] call fill + //SEG102 [71] phi from init::@3 to fill [phi:init::@3->fill] + //SEG103 [71] phi (byte) fill::val#3 = (const byte) BLACK#0 [phi:init::@3->fill#0] -- vbuxx=vbuc1 ldx #BLACK - //SEG96 [63] phi (byte*) fill::addr#0 = (const byte*) colors#0 [phi:init::@3->fill#1] -- pbuz1=pbuc1 + //SEG104 [71] phi (byte*) fill::addr#0 = (const byte*) colors#0 [phi:init::@3->fill#1] -- pbuz1=pbuc1 lda #colors sta fill.addr+1 jsr fill - //SEG97 [54] phi from init::@3 to init::toD0181 [phi:init::@3->init::toD0181] - //SEG98 init::toD0181 - //SEG99 init::@1 - //SEG100 [55] *((const byte*) D018#0) ← (const byte) init::toD0181_return#0 -- _deref_pbuc1=vbuc2 + //SEG105 [62] phi from init::@3 to init::toD0181 [phi:init::@3->init::toD0181] + //SEG106 init::toD0181 + //SEG107 init::@1 + //SEG108 [63] *((const byte*) D018#0) ← (const byte) init::toD0181_return#0 -- _deref_pbuc1=vbuc2 lda #toD0181_return sta D018 - //SEG101 asm { lda#$5b sta$d011 } + //SEG109 asm { lda#$5b sta$d011 } lda #$5b sta $d011 - //SEG102 [57] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 -- _deref_pbuc1=vbuc2 + //SEG110 [65] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 -- _deref_pbuc1=vbuc2 lda #BLACK sta BORDERCOL - //SEG103 [58] *((const byte*) BGCOL1#0) ← (const byte) BLACK#0 -- _deref_pbuc1=vbuc2 + //SEG111 [66] *((const byte*) BGCOL1#0) ← (const byte) BLACK#0 -- _deref_pbuc1=vbuc2 sta BGCOL1 - //SEG104 [59] *((const byte*) BGCOL2#0) ← (const byte) RED#0 -- _deref_pbuc1=vbuc2 + //SEG112 [67] *((const byte*) BGCOL2#0) ← (const byte) RED#0 -- _deref_pbuc1=vbuc2 lda #RED sta BGCOL2 - //SEG105 [60] *((const byte*) BGCOL3#0) ← (const byte) BLUE#0 -- _deref_pbuc1=vbuc2 + //SEG113 [68] *((const byte*) BGCOL3#0) ← (const byte) BLUE#0 -- _deref_pbuc1=vbuc2 lda #BLUE sta BGCOL3 - //SEG106 [61] *((const byte*) BGCOL4#0) ← (const byte) GREEN#0 -- _deref_pbuc1=vbuc2 + //SEG114 [69] *((const byte*) BGCOL4#0) ← (const byte) GREEN#0 -- _deref_pbuc1=vbuc2 lda #GREEN sta BGCOL4 - //SEG107 init::@return - //SEG108 [62] return + //SEG115 init::@return + //SEG116 [70] return rts } -//SEG109 fill +//SEG117 fill // Fill some memory with a value // fill(byte register(X) val) fill: { .label end = 6 .label addr = 4 - //SEG110 [64] (byte*) fill::end#0 ← (byte*) fill::addr#0 + (word/signed word/dword/signed dword) $3e8 -- pbuz1=pbuz2_plus_vwuc1 + //SEG118 [72] (byte*) fill::end#0 ← (byte*) fill::addr#0 + (word/signed word/dword/signed dword) $3e8 -- pbuz1=pbuz2_plus_vwuc1 lda addr clc adc #<$3e8 @@ -2714,51 +2846,51 @@ fill: { lda addr+1 adc #>$3e8 sta end+1 - //SEG111 [65] phi from fill fill::@1 to fill::@1 [phi:fill/fill::@1->fill::@1] - //SEG112 [65] phi (byte*) fill::addr#2 = (byte*) fill::addr#0 [phi:fill/fill::@1->fill::@1#0] -- register_copy - //SEG113 fill::@1 + //SEG119 [73] phi from fill fill::@1 to fill::@1 [phi:fill/fill::@1->fill::@1] + //SEG120 [73] phi (byte*) fill::addr#2 = (byte*) fill::addr#0 [phi:fill/fill::@1->fill::@1#0] -- register_copy + //SEG121 fill::@1 b1: - //SEG114 [66] *((byte*) fill::addr#2) ← (byte) fill::val#3 -- _deref_pbuz1=vbuxx + //SEG122 [74] *((byte*) fill::addr#2) ← (byte) fill::val#3 -- _deref_pbuz1=vbuxx txa ldy #0 sta (addr),y - //SEG115 [67] (byte*) fill::addr#1 ← ++ (byte*) fill::addr#2 -- pbuz1=_inc_pbuz1 + //SEG123 [75] (byte*) fill::addr#1 ← ++ (byte*) fill::addr#2 -- pbuz1=_inc_pbuz1 inc addr bne !+ inc addr+1 !: - //SEG116 [68] if((byte*) fill::addr#1!=(byte*) fill::end#0) goto fill::@1 -- pbuz1_neq_pbuz2_then_la1 + //SEG124 [76] if((byte*) fill::addr#1!=(byte*) fill::end#0) goto fill::@1 -- pbuz1_neq_pbuz2_then_la1 lda addr+1 cmp end+1 bne b1 lda addr cmp end bne b1 - //SEG117 fill::@return - //SEG118 [69] return + //SEG125 fill::@return + //SEG126 [77] return rts } -//SEG119 init_sprites +//SEG127 init_sprites init_sprites: { - //SEG120 [70] *((const byte*) SPRITES_ENABLE#0) ← (byte/signed byte/word/signed word/dword/signed dword) 1 -- _deref_pbuc1=vbuc2 + //SEG128 [78] *((const byte*) SPRITES_ENABLE#0) ← (byte/signed byte/word/signed word/dword/signed dword) 1 -- _deref_pbuc1=vbuc2 lda #1 sta SPRITES_ENABLE - //SEG121 [71] *((const byte*) SPRITES_EXPAND_X#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2 + //SEG129 [79] *((const byte*) SPRITES_EXPAND_X#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2 // one sprite enabled lda #0 sta SPRITES_EXPAND_X - //SEG122 [72] *((const byte*) SPRITES_EXPAND_Y#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2 + //SEG130 [80] *((const byte*) SPRITES_EXPAND_Y#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2 sta SPRITES_EXPAND_Y - //SEG123 [73] *((const byte*) SPRITES_XMSB#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2 + //SEG131 [81] *((const byte*) SPRITES_XMSB#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2 sta SPRITES_XMSB - //SEG124 [74] *((const byte*) SPRITES_COLS#0) ← (const byte) WHITE#0 -- _deref_pbuc1=vbuc2 + //SEG132 [82] *((const byte*) SPRITES_COLS#0) ← (const byte) WHITE#0 -- _deref_pbuc1=vbuc2 lda #WHITE sta SPRITES_COLS - //SEG125 [75] *((const byte*) SPRITES_MC#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2 + //SEG133 [83] *((const byte*) SPRITES_MC#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2 lda #0 sta SPRITES_MC - //SEG126 init_sprites::@return - //SEG127 [76] return + //SEG134 init_sprites::@return + //SEG135 [84] return rts } diff --git a/src/test/ref/scan-desire-problem.sym b/src/test/ref/scan-desire-problem.sym index c3434d3af..9540ef303 100644 --- a/src/test/ref/scan-desire-problem.sym +++ b/src/test/ref/scan-desire-problem.sym @@ -43,11 +43,19 @@ (const byte*) colors#0 colors = ((byte*))(word/dword/signed dword) $d800 (void()) draw_block((byte) draw_block::tileno , (byte) draw_block::x , (byte) draw_block::y , (byte) draw_block::color) (byte~) draw_block::$1 reg byte a 4.0 +(byte*) draw_block::$11 $11 zp ZP_WORD:4 4.0 +(byte*) draw_block::$12 $12 zp ZP_WORD:4 4.0 +(byte*) draw_block::$13 $13 zp ZP_WORD:4 4.0 +(byte*) draw_block::$14 $14 zp ZP_WORD:4 4.0 +(byte*) draw_block::$15 $15 zp ZP_WORD:4 4.0 +(byte*) draw_block::$16 $16 zp ZP_WORD:4 4.0 +(byte*) draw_block::$17 $17 zp ZP_WORD:4 4.0 +(byte*) draw_block::$18 $18 zp ZP_WORD:9 4.0 (label) draw_block::@1 (label) draw_block::@return (byte) draw_block::color (byte) draw_block::drawtile -(byte) draw_block::drawtile#0 reg byte a 4.0 +(byte) draw_block::drawtile#0 reg byte x 2.0 (byte) draw_block::tileno (byte) draw_block::tileno#0 reg byte a 34.33333333333333 (byte) draw_block::tileno#1 tileno zp ZP_BYTE:8 0.4444444444444444 @@ -60,7 +68,7 @@ (byte) draw_block::y#1 reg byte a 4.0 (word) draw_block::z (word) draw_block::z#0 z zp ZP_WORD:4 4.0 -(word) draw_block::z#1 z#1 zp ZP_WORD:9 2.0000000000000004 +(word) draw_block::z#1 z#1 zp ZP_WORD:9 1.125 (void()) fill((byte*) fill::start , (word) fill::size , (byte) fill::val) (label) fill::@1 (label) fill::@return @@ -143,7 +151,7 @@ zp ZP_BYTE:2 [ main::x#4 main::x#1 ] zp ZP_BYTE:3 [ main::y#2 main::y#1 ] reg byte x [ mul8u::a#2 mul8u::a#1 mul8u::a#0 ] -zp ZP_WORD:4 [ mul8u::res#2 mul8u::res#6 mul8u::res#1 mul8u::return#2 draw_block::z#0 fill::addr#2 fill::addr#0 fill::addr#1 ] +zp ZP_WORD:4 [ mul8u::res#2 mul8u::res#6 mul8u::res#1 mul8u::return#2 draw_block::z#0 fill::addr#2 fill::addr#0 fill::addr#1 draw_block::$11 draw_block::$12 draw_block::$13 draw_block::$14 draw_block::$15 draw_block::$16 draw_block::$17 ] zp ZP_WORD:6 [ mul8u::mb#2 mul8u::mb#1 fill::end#0 ] reg byte x [ fill::val#3 ] reg byte a [ main::z#0 ] @@ -153,7 +161,7 @@ reg byte y [ draw_block::x#0 ] reg byte x [ draw_block::y#0 ] zp ZP_BYTE:8 [ draw_block::tileno#1 ] reg byte a [ draw_block::$1 ] -zp ZP_WORD:9 [ draw_block::x1#0 draw_block::z#1 ] +zp ZP_WORD:9 [ draw_block::x1#0 draw_block::z#1 draw_block::$18 ] reg byte a [ draw_block::y#1 ] -reg byte a [ draw_block::drawtile#0 ] +reg byte x [ draw_block::drawtile#0 ] reg byte a [ mul8u::$1 ] diff --git a/src/test/ref/test-scroll-up.asm b/src/test/ref/test-scroll-up.asm index f89b2f1be..15c85f776 100644 --- a/src/test/ref/test-scroll-up.asm +++ b/src/test/ref/test-scroll-up.asm @@ -14,6 +14,8 @@ scrollup3: { .label l2_1 = 4 .label line = 2 .label l2_2 = 4 + .label _4 = 7 + .label _5 = 9 .label l2_4 = 4 lda #0 sta l2 @@ -25,24 +27,23 @@ scrollup3: { sta l2_4+1 ldx #0 b2: - lda #screen - adc l2_2+1 - sta !a1++2 - lda #screen+$28 + sta _4+1 + lda l2_2 clc - adc l2_2 - sta !a2++1 - lda #>screen+$28 - adc l2_2+1 - sta !a2++2 - !a2: - lda screen+$28 - !a1: - sta screen + adc #screen + sta _5+1 + ldy #0 + lda (_4),y + sta (_5),y inc l2_1 bne !+ inc l2_1+1 @@ -108,6 +109,8 @@ scrollup1: { .label _0 = 4 .label _2 = 7 .label line = 2 + .label _6 = 7 + .label _7 = 4 lda #0 sta line sta line+1 @@ -128,24 +131,23 @@ scrollup1: { lda #0 adc line+1 sta _2+1 - lda #screen - adc _0+1 - sta !a1++2 - lda #screen+$28 + sta _6+1 clc - adc _2 - sta !a2++1 - lda #>screen+$28 - adc _2+1 - sta !a2++2 - !a2: - lda screen+$28 - !a1: - sta screen + lda _7 + adc #screen + sta _7+1 + ldy #0 + lda (_6),y + sta (_7),y inx cpx #$28 bcc b2 diff --git a/src/test/ref/test-scroll-up.cfg b/src/test/ref/test-scroll-up.cfg index 606ec6649..af7b13c49 100644 --- a/src/test/ref/test-scroll-up.cfg +++ b/src/test/ref/test-scroll-up.cfg @@ -32,61 +32,65 @@ scrollup3::@1: scope:[scrollup3] from scrollup3 scrollup3::@3 scrollup3::@2: scope:[scrollup3] from scrollup3::@1 scrollup3::@2 [14] (byte) scrollup3::c#2 ← phi( scrollup3::@1/(byte/signed byte/word/signed word/dword/signed dword) 0 scrollup3::@2/(byte) scrollup3::c#1 ) [14] (word) scrollup3::l2#2 ← phi( scrollup3::@1/(word~) scrollup3::l2#4 scrollup3::@2/(word) scrollup3::l2#1 ) - [15] *((const byte*) screen#0 + (word) scrollup3::l2#2) ← *((const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) $28 + (word) scrollup3::l2#2) - [16] (word) scrollup3::l2#1 ← ++ (word) scrollup3::l2#2 - [17] (byte) scrollup3::c#1 ← ++ (byte) scrollup3::c#2 - [18] if((byte) scrollup3::c#1<(byte/signed byte/word/signed word/dword/signed dword) $28) goto scrollup3::@2 + [15] (byte*) scrollup3::$4 ← (const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) $28 + (word) scrollup3::l2#2 + [16] (byte*) scrollup3::$5 ← (const byte*) screen#0 + (word) scrollup3::l2#2 + [17] *((byte*) scrollup3::$5) ← *((byte*) scrollup3::$4) + [18] (word) scrollup3::l2#1 ← ++ (word) scrollup3::l2#2 + [19] (byte) scrollup3::c#1 ← ++ (byte) scrollup3::c#2 + [20] if((byte) scrollup3::c#1<(byte/signed byte/word/signed word/dword/signed dword) $28) goto scrollup3::@2 to:scrollup3::@3 scrollup3::@3: scope:[scrollup3] from scrollup3::@2 - [19] (word) scrollup3::line#1 ← (word) scrollup3::l2#0 + (byte/signed byte/word/signed word/dword/signed dword) $28 - [20] if((word) scrollup3::line#1<(byte/signed byte/word/signed word/dword/signed dword) $28*(byte/signed byte/word/signed word/dword/signed dword) $18) goto scrollup3::@1 + [21] (word) scrollup3::line#1 ← (word) scrollup3::l2#0 + (byte/signed byte/word/signed word/dword/signed dword) $28 + [22] if((word) scrollup3::line#1<(byte/signed byte/word/signed word/dword/signed dword) $28*(byte/signed byte/word/signed word/dword/signed dword) $18) goto scrollup3::@1 to:scrollup3::@return scrollup3::@return: scope:[scrollup3] from scrollup3::@3 - [21] return + [23] return to:@return scrollup2: scope:[scrollup2] from main::@1 - [22] phi() + [24] phi() to:scrollup2::@1 scrollup2::@1: scope:[scrollup2] from scrollup2 scrollup2::@3 - [23] (byte) scrollup2::l#4 ← phi( scrollup2/(byte/signed byte/word/signed word/dword/signed dword) 0 scrollup2::@3/(byte) scrollup2::l#1 ) - [23] (byte*) scrollup2::line1#3 ← phi( scrollup2/(const byte*) screen#0 scrollup2::@3/(byte*) scrollup2::line1#1 ) - [23] (byte*) scrollup2::line2#3 ← phi( scrollup2/(const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) $28 scrollup2::@3/(byte*) scrollup2::line2#1 ) + [25] (byte) scrollup2::l#4 ← phi( scrollup2/(byte/signed byte/word/signed word/dword/signed dword) 0 scrollup2::@3/(byte) scrollup2::l#1 ) + [25] (byte*) scrollup2::line1#3 ← phi( scrollup2/(const byte*) screen#0 scrollup2::@3/(byte*) scrollup2::line1#1 ) + [25] (byte*) scrollup2::line2#3 ← phi( scrollup2/(const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) $28 scrollup2::@3/(byte*) scrollup2::line2#1 ) to:scrollup2::@2 scrollup2::@2: scope:[scrollup2] from scrollup2::@1 scrollup2::@2 - [24] (byte) scrollup2::c#2 ← phi( scrollup2::@1/(byte/signed byte/word/signed word/dword/signed dword) 0 scrollup2::@2/(byte) scrollup2::c#1 ) - [24] (byte*) scrollup2::line1#2 ← phi( scrollup2::@1/(byte*) scrollup2::line1#3 scrollup2::@2/(byte*) scrollup2::line1#1 ) - [24] (byte*) scrollup2::line2#2 ← phi( scrollup2::@1/(byte*) scrollup2::line2#3 scrollup2::@2/(byte*) scrollup2::line2#1 ) - [25] *((byte*) scrollup2::line1#2) ← *((byte*) scrollup2::line2#2) - [26] (byte*) scrollup2::line1#1 ← ++ (byte*) scrollup2::line1#2 - [27] (byte*) scrollup2::line2#1 ← ++ (byte*) scrollup2::line2#2 - [28] (byte) scrollup2::c#1 ← ++ (byte) scrollup2::c#2 - [29] if((byte) scrollup2::c#1!=(byte/signed byte/word/signed word/dword/signed dword) $28) goto scrollup2::@2 + [26] (byte) scrollup2::c#2 ← phi( scrollup2::@1/(byte/signed byte/word/signed word/dword/signed dword) 0 scrollup2::@2/(byte) scrollup2::c#1 ) + [26] (byte*) scrollup2::line1#2 ← phi( scrollup2::@1/(byte*) scrollup2::line1#3 scrollup2::@2/(byte*) scrollup2::line1#1 ) + [26] (byte*) scrollup2::line2#2 ← phi( scrollup2::@1/(byte*) scrollup2::line2#3 scrollup2::@2/(byte*) scrollup2::line2#1 ) + [27] *((byte*) scrollup2::line1#2) ← *((byte*) scrollup2::line2#2) + [28] (byte*) scrollup2::line1#1 ← ++ (byte*) scrollup2::line1#2 + [29] (byte*) scrollup2::line2#1 ← ++ (byte*) scrollup2::line2#2 + [30] (byte) scrollup2::c#1 ← ++ (byte) scrollup2::c#2 + [31] if((byte) scrollup2::c#1!=(byte/signed byte/word/signed word/dword/signed dword) $28) goto scrollup2::@2 to:scrollup2::@3 scrollup2::@3: scope:[scrollup2] from scrollup2::@2 - [30] (byte) scrollup2::l#1 ← ++ (byte) scrollup2::l#4 - [31] if((byte) scrollup2::l#1!=(byte/signed byte/word/signed word/dword/signed dword) $18) goto scrollup2::@1 + [32] (byte) scrollup2::l#1 ← ++ (byte) scrollup2::l#4 + [33] if((byte) scrollup2::l#1!=(byte/signed byte/word/signed word/dword/signed dword) $18) goto scrollup2::@1 to:scrollup2::@return scrollup2::@return: scope:[scrollup2] from scrollup2::@3 - [32] return + [34] return to:@return scrollup1: scope:[scrollup1] from main - [33] phi() + [35] phi() to:scrollup1::@1 scrollup1::@1: scope:[scrollup1] from scrollup1 scrollup1::@3 - [34] (word) scrollup1::line#4 ← phi( scrollup1/(byte/signed byte/word/signed word/dword/signed dword) 0 scrollup1::@3/(word) scrollup1::line#1 ) + [36] (word) scrollup1::line#4 ← phi( scrollup1/(byte/signed byte/word/signed word/dword/signed dword) 0 scrollup1::@3/(word) scrollup1::line#1 ) to:scrollup1::@2 scrollup1::@2: scope:[scrollup1] from scrollup1::@1 scrollup1::@2 - [35] (byte) scrollup1::c#2 ← phi( scrollup1::@1/(byte/signed byte/word/signed word/dword/signed dword) 0 scrollup1::@2/(byte) scrollup1::c#1 ) - [36] (word~) scrollup1::$0 ← (word) scrollup1::line#4 + (byte) scrollup1::c#2 - [37] (word~) scrollup1::$2 ← (word) scrollup1::line#4 + (byte) scrollup1::c#2 - [38] *((const byte*) screen#0 + (word~) scrollup1::$0) ← *((const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) $28 + (word~) scrollup1::$2) - [39] (byte) scrollup1::c#1 ← ++ (byte) scrollup1::c#2 - [40] if((byte) scrollup1::c#1<(byte/signed byte/word/signed word/dword/signed dword) $28) goto scrollup1::@2 + [37] (byte) scrollup1::c#2 ← phi( scrollup1::@1/(byte/signed byte/word/signed word/dword/signed dword) 0 scrollup1::@2/(byte) scrollup1::c#1 ) + [38] (word~) scrollup1::$0 ← (word) scrollup1::line#4 + (byte) scrollup1::c#2 + [39] (word~) scrollup1::$2 ← (word) scrollup1::line#4 + (byte) scrollup1::c#2 + [40] (byte*) scrollup1::$6 ← (const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) $28 + (word~) scrollup1::$2 + [41] (byte*) scrollup1::$7 ← (const byte*) screen#0 + (word~) scrollup1::$0 + [42] *((byte*) scrollup1::$7) ← *((byte*) scrollup1::$6) + [43] (byte) scrollup1::c#1 ← ++ (byte) scrollup1::c#2 + [44] if((byte) scrollup1::c#1<(byte/signed byte/word/signed word/dword/signed dword) $28) goto scrollup1::@2 to:scrollup1::@3 scrollup1::@3: scope:[scrollup1] from scrollup1::@2 - [41] (word) scrollup1::line#1 ← (word) scrollup1::line#4 + (byte/signed byte/word/signed word/dword/signed dword) $28 - [42] if((word) scrollup1::line#1<(byte/signed byte/word/signed word/dword/signed dword) $28*(byte/signed byte/word/signed word/dword/signed dword) $18) goto scrollup1::@1 + [45] (word) scrollup1::line#1 ← (word) scrollup1::line#4 + (byte/signed byte/word/signed word/dword/signed dword) $28 + [46] if((word) scrollup1::line#1<(byte/signed byte/word/signed word/dword/signed dword) $28*(byte/signed byte/word/signed word/dword/signed dword) $18) goto scrollup1::@1 to:scrollup1::@return scrollup1::@return: scope:[scrollup1] from scrollup1::@3 - [43] return + [47] return to:@return diff --git a/src/test/ref/test-scroll-up.log b/src/test/ref/test-scroll-up.log index 767060ece..0a3b6ecc0 100644 --- a/src/test/ref/test-scroll-up.log +++ b/src/test/ref/test-scroll-up.log @@ -251,6 +251,11 @@ Resolved ranged next value scrollup2::c#1 ← ++ scrollup2::c#2 to ++ Resolved ranged comparison value if(scrollup2::c#1!=rangelast(0,$27)) goto scrollup2::@2 to (byte/signed byte/word/signed word/dword/signed dword) $28 Resolved ranged next value scrollup2::l#1 ← ++ scrollup2::l#4 to ++ Resolved ranged comparison value if(scrollup2::l#1!=rangelast(0,$17)) goto scrollup2::@1 to (byte/signed byte/word/signed word/dword/signed dword) $18 +De-inlining pointer[w] to *(pointer+w) *((const byte*) screen#0 + (word~) scrollup1::$0) ← *((const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) $28 + (word~) scrollup1::$2) +De-inlining pointer[w] to *(pointer+w) *((const byte*) screen#0 + (word~) scrollup1::$0) ← *((byte*) scrollup1::$6) +De-inlining pointer[w] to *(pointer+w) *((const byte*) screen#0 + (word) scrollup3::l2#2) ← *((const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) $28 + (word~) scrollup3::$0) +De-inlining pointer[w] to *(pointer+w) *((const byte*) screen#0 + (word) scrollup3::l2#2) ← *((byte*) scrollup3::$4) +Successful SSA optimization Pass2DeInlineWordDerefIdx Alias (word~) scrollup1::$2 = (word~) scrollup1::$1 Alias (word) scrollup3::l2#2 = (word~) scrollup3::$0 Successful SSA optimization Pass2AliasElimination @@ -294,19 +299,19 @@ Calls in [main] to scrollup1:5 scrollup2:7 scrollup3:9 Created 11 initial phi equivalence classes Not coalescing [13] scrollup3::l2#4 ← scrollup3::l2#0 -Coalesced [22] scrollup3::l2#3 ← scrollup3::line#1 -Coalesced [23] scrollup3::l2#5 ← scrollup3::l2#1 -Coalesced [24] scrollup3::c#3 ← scrollup3::c#1 -Coalesced [27] scrollup2::line2#6 ← scrollup2::line2#3 -Coalesced [28] scrollup2::line1#6 ← scrollup2::line1#3 -Coalesced [38] scrollup2::line2#5 ← scrollup2::line2#1 -Coalesced [39] scrollup2::line1#5 ← scrollup2::line1#1 -Coalesced [40] scrollup2::l#5 ← scrollup2::l#1 -Coalesced (already) [41] scrollup2::line2#7 ← scrollup2::line2#1 -Coalesced (already) [42] scrollup2::line1#7 ← scrollup2::line1#1 -Coalesced [43] scrollup2::c#3 ← scrollup2::c#1 -Coalesced [55] scrollup1::line#5 ← scrollup1::line#1 -Coalesced [56] scrollup1::c#3 ← scrollup1::c#1 +Coalesced [24] scrollup3::l2#3 ← scrollup3::line#1 +Coalesced [25] scrollup3::l2#5 ← scrollup3::l2#1 +Coalesced [26] scrollup3::c#3 ← scrollup3::c#1 +Coalesced [29] scrollup2::line2#6 ← scrollup2::line2#3 +Coalesced [30] scrollup2::line1#6 ← scrollup2::line1#3 +Coalesced [40] scrollup2::line2#5 ← scrollup2::line2#1 +Coalesced [41] scrollup2::line1#5 ← scrollup2::line1#1 +Coalesced [42] scrollup2::l#5 ← scrollup2::l#1 +Coalesced (already) [43] scrollup2::line2#7 ← scrollup2::line2#1 +Coalesced (already) [44] scrollup2::line1#7 ← scrollup2::line1#1 +Coalesced [45] scrollup2::c#3 ← scrollup2::c#1 +Coalesced [59] scrollup1::line#5 ← scrollup1::line#1 +Coalesced [60] scrollup1::c#3 ← scrollup1::c#1 Coalesced down to 9 phi equivalence classes Culled Empty Block (label) scrollup3::@5 Culled Empty Block (label) scrollup3::@6 @@ -360,63 +365,67 @@ scrollup3::@1: scope:[scrollup3] from scrollup3 scrollup3::@3 scrollup3::@2: scope:[scrollup3] from scrollup3::@1 scrollup3::@2 [14] (byte) scrollup3::c#2 ← phi( scrollup3::@1/(byte/signed byte/word/signed word/dword/signed dword) 0 scrollup3::@2/(byte) scrollup3::c#1 ) [14] (word) scrollup3::l2#2 ← phi( scrollup3::@1/(word~) scrollup3::l2#4 scrollup3::@2/(word) scrollup3::l2#1 ) - [15] *((const byte*) screen#0 + (word) scrollup3::l2#2) ← *((const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) $28 + (word) scrollup3::l2#2) - [16] (word) scrollup3::l2#1 ← ++ (word) scrollup3::l2#2 - [17] (byte) scrollup3::c#1 ← ++ (byte) scrollup3::c#2 - [18] if((byte) scrollup3::c#1<(byte/signed byte/word/signed word/dword/signed dword) $28) goto scrollup3::@2 + [15] (byte*) scrollup3::$4 ← (const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) $28 + (word) scrollup3::l2#2 + [16] (byte*) scrollup3::$5 ← (const byte*) screen#0 + (word) scrollup3::l2#2 + [17] *((byte*) scrollup3::$5) ← *((byte*) scrollup3::$4) + [18] (word) scrollup3::l2#1 ← ++ (word) scrollup3::l2#2 + [19] (byte) scrollup3::c#1 ← ++ (byte) scrollup3::c#2 + [20] if((byte) scrollup3::c#1<(byte/signed byte/word/signed word/dword/signed dword) $28) goto scrollup3::@2 to:scrollup3::@3 scrollup3::@3: scope:[scrollup3] from scrollup3::@2 - [19] (word) scrollup3::line#1 ← (word) scrollup3::l2#0 + (byte/signed byte/word/signed word/dword/signed dword) $28 - [20] if((word) scrollup3::line#1<(byte/signed byte/word/signed word/dword/signed dword) $28*(byte/signed byte/word/signed word/dword/signed dword) $18) goto scrollup3::@1 + [21] (word) scrollup3::line#1 ← (word) scrollup3::l2#0 + (byte/signed byte/word/signed word/dword/signed dword) $28 + [22] if((word) scrollup3::line#1<(byte/signed byte/word/signed word/dword/signed dword) $28*(byte/signed byte/word/signed word/dword/signed dword) $18) goto scrollup3::@1 to:scrollup3::@return scrollup3::@return: scope:[scrollup3] from scrollup3::@3 - [21] return + [23] return to:@return scrollup2: scope:[scrollup2] from main::@1 - [22] phi() + [24] phi() to:scrollup2::@1 scrollup2::@1: scope:[scrollup2] from scrollup2 scrollup2::@3 - [23] (byte) scrollup2::l#4 ← phi( scrollup2/(byte/signed byte/word/signed word/dword/signed dword) 0 scrollup2::@3/(byte) scrollup2::l#1 ) - [23] (byte*) scrollup2::line1#3 ← phi( scrollup2/(const byte*) screen#0 scrollup2::@3/(byte*) scrollup2::line1#1 ) - [23] (byte*) scrollup2::line2#3 ← phi( scrollup2/(const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) $28 scrollup2::@3/(byte*) scrollup2::line2#1 ) + [25] (byte) scrollup2::l#4 ← phi( scrollup2/(byte/signed byte/word/signed word/dword/signed dword) 0 scrollup2::@3/(byte) scrollup2::l#1 ) + [25] (byte*) scrollup2::line1#3 ← phi( scrollup2/(const byte*) screen#0 scrollup2::@3/(byte*) scrollup2::line1#1 ) + [25] (byte*) scrollup2::line2#3 ← phi( scrollup2/(const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) $28 scrollup2::@3/(byte*) scrollup2::line2#1 ) to:scrollup2::@2 scrollup2::@2: scope:[scrollup2] from scrollup2::@1 scrollup2::@2 - [24] (byte) scrollup2::c#2 ← phi( scrollup2::@1/(byte/signed byte/word/signed word/dword/signed dword) 0 scrollup2::@2/(byte) scrollup2::c#1 ) - [24] (byte*) scrollup2::line1#2 ← phi( scrollup2::@1/(byte*) scrollup2::line1#3 scrollup2::@2/(byte*) scrollup2::line1#1 ) - [24] (byte*) scrollup2::line2#2 ← phi( scrollup2::@1/(byte*) scrollup2::line2#3 scrollup2::@2/(byte*) scrollup2::line2#1 ) - [25] *((byte*) scrollup2::line1#2) ← *((byte*) scrollup2::line2#2) - [26] (byte*) scrollup2::line1#1 ← ++ (byte*) scrollup2::line1#2 - [27] (byte*) scrollup2::line2#1 ← ++ (byte*) scrollup2::line2#2 - [28] (byte) scrollup2::c#1 ← ++ (byte) scrollup2::c#2 - [29] if((byte) scrollup2::c#1!=(byte/signed byte/word/signed word/dword/signed dword) $28) goto scrollup2::@2 + [26] (byte) scrollup2::c#2 ← phi( scrollup2::@1/(byte/signed byte/word/signed word/dword/signed dword) 0 scrollup2::@2/(byte) scrollup2::c#1 ) + [26] (byte*) scrollup2::line1#2 ← phi( scrollup2::@1/(byte*) scrollup2::line1#3 scrollup2::@2/(byte*) scrollup2::line1#1 ) + [26] (byte*) scrollup2::line2#2 ← phi( scrollup2::@1/(byte*) scrollup2::line2#3 scrollup2::@2/(byte*) scrollup2::line2#1 ) + [27] *((byte*) scrollup2::line1#2) ← *((byte*) scrollup2::line2#2) + [28] (byte*) scrollup2::line1#1 ← ++ (byte*) scrollup2::line1#2 + [29] (byte*) scrollup2::line2#1 ← ++ (byte*) scrollup2::line2#2 + [30] (byte) scrollup2::c#1 ← ++ (byte) scrollup2::c#2 + [31] if((byte) scrollup2::c#1!=(byte/signed byte/word/signed word/dword/signed dword) $28) goto scrollup2::@2 to:scrollup2::@3 scrollup2::@3: scope:[scrollup2] from scrollup2::@2 - [30] (byte) scrollup2::l#1 ← ++ (byte) scrollup2::l#4 - [31] if((byte) scrollup2::l#1!=(byte/signed byte/word/signed word/dword/signed dword) $18) goto scrollup2::@1 + [32] (byte) scrollup2::l#1 ← ++ (byte) scrollup2::l#4 + [33] if((byte) scrollup2::l#1!=(byte/signed byte/word/signed word/dword/signed dword) $18) goto scrollup2::@1 to:scrollup2::@return scrollup2::@return: scope:[scrollup2] from scrollup2::@3 - [32] return + [34] return to:@return scrollup1: scope:[scrollup1] from main - [33] phi() + [35] phi() to:scrollup1::@1 scrollup1::@1: scope:[scrollup1] from scrollup1 scrollup1::@3 - [34] (word) scrollup1::line#4 ← phi( scrollup1/(byte/signed byte/word/signed word/dword/signed dword) 0 scrollup1::@3/(word) scrollup1::line#1 ) + [36] (word) scrollup1::line#4 ← phi( scrollup1/(byte/signed byte/word/signed word/dword/signed dword) 0 scrollup1::@3/(word) scrollup1::line#1 ) to:scrollup1::@2 scrollup1::@2: scope:[scrollup1] from scrollup1::@1 scrollup1::@2 - [35] (byte) scrollup1::c#2 ← phi( scrollup1::@1/(byte/signed byte/word/signed word/dword/signed dword) 0 scrollup1::@2/(byte) scrollup1::c#1 ) - [36] (word~) scrollup1::$0 ← (word) scrollup1::line#4 + (byte) scrollup1::c#2 - [37] (word~) scrollup1::$2 ← (word) scrollup1::line#4 + (byte) scrollup1::c#2 - [38] *((const byte*) screen#0 + (word~) scrollup1::$0) ← *((const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) $28 + (word~) scrollup1::$2) - [39] (byte) scrollup1::c#1 ← ++ (byte) scrollup1::c#2 - [40] if((byte) scrollup1::c#1<(byte/signed byte/word/signed word/dword/signed dword) $28) goto scrollup1::@2 + [37] (byte) scrollup1::c#2 ← phi( scrollup1::@1/(byte/signed byte/word/signed word/dword/signed dword) 0 scrollup1::@2/(byte) scrollup1::c#1 ) + [38] (word~) scrollup1::$0 ← (word) scrollup1::line#4 + (byte) scrollup1::c#2 + [39] (word~) scrollup1::$2 ← (word) scrollup1::line#4 + (byte) scrollup1::c#2 + [40] (byte*) scrollup1::$6 ← (const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) $28 + (word~) scrollup1::$2 + [41] (byte*) scrollup1::$7 ← (const byte*) screen#0 + (word~) scrollup1::$0 + [42] *((byte*) scrollup1::$7) ← *((byte*) scrollup1::$6) + [43] (byte) scrollup1::c#1 ← ++ (byte) scrollup1::c#2 + [44] if((byte) scrollup1::c#1<(byte/signed byte/word/signed word/dword/signed dword) $28) goto scrollup1::@2 to:scrollup1::@3 scrollup1::@3: scope:[scrollup1] from scrollup1::@2 - [41] (word) scrollup1::line#1 ← (word) scrollup1::line#4 + (byte/signed byte/word/signed word/dword/signed dword) $28 - [42] if((word) scrollup1::line#1<(byte/signed byte/word/signed word/dword/signed dword) $28*(byte/signed byte/word/signed word/dword/signed dword) $18) goto scrollup1::@1 + [45] (word) scrollup1::line#1 ← (word) scrollup1::line#4 + (byte/signed byte/word/signed word/dword/signed dword) $28 + [46] if((word) scrollup1::line#1<(byte/signed byte/word/signed word/dword/signed dword) $28*(byte/signed byte/word/signed word/dword/signed dword) $18) goto scrollup1::@1 to:scrollup1::@return scrollup1::@return: scope:[scrollup1] from scrollup1::@3 - [43] return + [47] return to:@return @@ -424,14 +433,16 @@ VARIABLE REGISTER WEIGHTS (void()) main() (byte*) screen (void()) scrollup1() -(word~) scrollup1::$0 101.0 +(word~) scrollup1::$0 67.33333333333333 (word~) scrollup1::$2 202.0 +(byte*) scrollup1::$6 101.0 +(byte*) scrollup1::$7 202.0 (byte) scrollup1::c (byte) scrollup1::c#1 151.5 -(byte) scrollup1::c#2 101.0 +(byte) scrollup1::c#2 67.33333333333333 (word) scrollup1::line (word) scrollup1::line#1 16.5 -(word) scrollup1::line#4 32.0 +(word) scrollup1::line#4 24.888888888888886 (void()) scrollup2() (byte) scrollup2::c (byte) scrollup2::c#1 151.5 @@ -448,13 +459,15 @@ VARIABLE REGISTER WEIGHTS (byte*) scrollup2::line2#2 104.66666666666666 (byte*) scrollup2::line2#3 22.0 (void()) scrollup3() +(byte*) scrollup3::$4 101.0 +(byte*) scrollup3::$5 202.0 (byte) scrollup3::c (byte) scrollup3::c#1 151.5 -(byte) scrollup3::c#2 67.33333333333333 +(byte) scrollup3::c#2 40.4 (word) scrollup3::l2 -(word) scrollup3::l2#0 4.714285714285714 +(word) scrollup3::l2#0 3.666666666666667 (word) scrollup3::l2#1 67.33333333333333 -(word) scrollup3::l2#2 207.5 +(word) scrollup3::l2#2 103.75 (word~) scrollup3::l2#4 22.0 (word) scrollup3::line (word) scrollup3::line#1 16.5 @@ -469,8 +482,12 @@ Initial phi equivalence classes [ scrollup2::c#2 scrollup2::c#1 ] [ scrollup1::line#4 scrollup1::line#1 ] [ scrollup1::c#2 scrollup1::c#1 ] +Added variable scrollup3::$4 to zero page equivalence class [ scrollup3::$4 ] +Added variable scrollup3::$5 to zero page equivalence class [ scrollup3::$5 ] Added variable scrollup1::$0 to zero page equivalence class [ scrollup1::$0 ] Added variable scrollup1::$2 to zero page equivalence class [ scrollup1::$2 ] +Added variable scrollup1::$6 to zero page equivalence class [ scrollup1::$6 ] +Added variable scrollup1::$7 to zero page equivalence class [ scrollup1::$7 ] Complete equivalence classes [ scrollup3::l2#0 scrollup3::line#1 ] [ scrollup3::l2#2 scrollup3::l2#4 scrollup3::l2#1 ] @@ -481,8 +498,12 @@ Complete equivalence classes [ scrollup2::c#2 scrollup2::c#1 ] [ scrollup1::line#4 scrollup1::line#1 ] [ scrollup1::c#2 scrollup1::c#1 ] +[ scrollup3::$4 ] +[ scrollup3::$5 ] [ scrollup1::$0 ] [ scrollup1::$2 ] +[ scrollup1::$6 ] +[ scrollup1::$7 ] Allocated zp ZP_WORD:2 [ scrollup3::l2#0 scrollup3::line#1 ] Allocated zp ZP_WORD:4 [ scrollup3::l2#2 scrollup3::l2#4 scrollup3::l2#1 ] Allocated zp ZP_BYTE:6 [ scrollup3::c#2 scrollup3::c#1 ] @@ -492,8 +513,12 @@ Allocated zp ZP_WORD:10 [ scrollup2::line1#2 scrollup2::line1#3 scrollup2::line1 Allocated zp ZP_BYTE:12 [ scrollup2::c#2 scrollup2::c#1 ] Allocated zp ZP_WORD:13 [ scrollup1::line#4 scrollup1::line#1 ] Allocated zp ZP_BYTE:15 [ scrollup1::c#2 scrollup1::c#1 ] -Allocated zp ZP_WORD:16 [ scrollup1::$0 ] -Allocated zp ZP_WORD:18 [ scrollup1::$2 ] +Allocated zp ZP_WORD:16 [ scrollup3::$4 ] +Allocated zp ZP_WORD:18 [ scrollup3::$5 ] +Allocated zp ZP_WORD:20 [ scrollup1::$0 ] +Allocated zp ZP_WORD:22 [ scrollup1::$2 ] +Allocated zp ZP_WORD:24 [ scrollup1::$6 ] +Allocated zp ZP_WORD:26 [ scrollup1::$7 ] INITIAL ASM //SEG0 File Comments @@ -523,7 +548,7 @@ bend: //SEG10 main main: { //SEG11 [5] call scrollup1 - //SEG12 [33] phi from main to scrollup1 [phi:main->scrollup1] + //SEG12 [35] phi from main to scrollup1 [phi:main->scrollup1] scrollup1_from_main: jsr scrollup1 //SEG13 [6] phi from main to main::@1 [phi:main->main::@1] @@ -532,7 +557,7 @@ main: { //SEG14 main::@1 b1: //SEG15 [7] call scrollup2 - //SEG16 [22] phi from main::@1 to scrollup2 [phi:main::@1->scrollup2] + //SEG16 [24] phi from main::@1 to scrollup2 [phi:main::@1->scrollup2] scrollup2_from_b1: jsr scrollup2 //SEG17 [8] phi from main::@1 to main::@2 [phi:main::@1->main::@2] @@ -557,6 +582,8 @@ scrollup3: { .label c = 6 .label line = 2 .label l2_2 = 4 + .label _4 = $10 + .label _5 = $12 .label l2_4 = 4 //SEG24 [12] phi from scrollup3 to scrollup3::@1 [phi:scrollup3->scrollup3::@1] b1_from_scrollup3: @@ -591,40 +618,42 @@ scrollup3: { jmp b2 //SEG36 scrollup3::@2 b2: - //SEG37 [15] *((const byte*) screen#0 + (word) scrollup3::l2#2) ← *((const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) $28 + (word) scrollup3::l2#2) -- pbuc1_derefidx_vwuz1=pbuc2_derefidx_vwuz1 - lda #screen - adc l2_2+1 - sta !a1++2 - lda #screen+$28 + sta _4+1 + //SEG38 [16] (byte*) scrollup3::$5 ← (const byte*) screen#0 + (word) scrollup3::l2#2 -- pbuz1=pbuc1_plus_vwuz2 + lda l2_2 clc - adc l2_2 - sta !a2++1 - lda #>screen+$28 - adc l2_2+1 - sta !a2++2 - !a2: - lda screen+$28 - !a1: - sta screen - //SEG38 [16] (word) scrollup3::l2#1 ← ++ (word) scrollup3::l2#2 -- vwuz1=_inc_vwuz1 + adc #screen + sta _5+1 + //SEG39 [17] *((byte*) scrollup3::$5) ← *((byte*) scrollup3::$4) -- _deref_pbuz1=_deref_pbuz2 + ldy #0 + lda (_4),y + ldy #0 + sta (_5),y + //SEG40 [18] (word) scrollup3::l2#1 ← ++ (word) scrollup3::l2#2 -- vwuz1=_inc_vwuz1 inc l2_1 bne !+ inc l2_1+1 !: - //SEG39 [17] (byte) scrollup3::c#1 ← ++ (byte) scrollup3::c#2 -- vbuz1=_inc_vbuz1 + //SEG41 [19] (byte) scrollup3::c#1 ← ++ (byte) scrollup3::c#2 -- vbuz1=_inc_vbuz1 inc c - //SEG40 [18] if((byte) scrollup3::c#1<(byte/signed byte/word/signed word/dword/signed dword) $28) goto scrollup3::@2 -- vbuz1_lt_vbuc1_then_la1 + //SEG42 [20] if((byte) scrollup3::c#1<(byte/signed byte/word/signed word/dword/signed dword) $28) goto scrollup3::@2 -- vbuz1_lt_vbuc1_then_la1 lda c cmp #$28 bcc b2_from_b2 jmp b3 - //SEG41 scrollup3::@3 + //SEG43 scrollup3::@3 b3: - //SEG42 [19] (word) scrollup3::line#1 ← (word) scrollup3::l2#0 + (byte/signed byte/word/signed word/dword/signed dword) $28 -- vwuz1=vwuz1_plus_vbuc1 + //SEG44 [21] (word) scrollup3::line#1 ← (word) scrollup3::l2#0 + (byte/signed byte/word/signed word/dword/signed dword) $28 -- vwuz1=vwuz1_plus_vbuc1 lda #$28 clc adc line @@ -632,7 +661,7 @@ scrollup3: { bcc !+ inc line+1 !: - //SEG43 [20] if((word) scrollup3::line#1<(byte/signed byte/word/signed word/dword/signed dword) $28*(byte/signed byte/word/signed word/dword/signed dword) $18) goto scrollup3::@1 -- vwuz1_lt_vwuc1_then_la1 + //SEG45 [22] if((word) scrollup3::line#1<(byte/signed byte/word/signed word/dword/signed dword) $28*(byte/signed byte/word/signed word/dword/signed dword) $18) goto scrollup3::@1 -- vwuz1_lt_vwuc1_then_la1 lda line+1 cmp #>$28*$18 bcc b1_from_b3 @@ -642,126 +671,128 @@ scrollup3: { bcc b1_from_b3 !: jmp breturn - //SEG44 scrollup3::@return + //SEG46 scrollup3::@return breturn: - //SEG45 [21] return + //SEG47 [23] return rts } -//SEG46 scrollup2 +//SEG48 scrollup2 scrollup2: { .label line1 = $a .label line2 = 8 .label c = $c .label l = 7 - //SEG47 [23] phi from scrollup2 to scrollup2::@1 [phi:scrollup2->scrollup2::@1] + //SEG49 [25] phi from scrollup2 to scrollup2::@1 [phi:scrollup2->scrollup2::@1] b1_from_scrollup2: - //SEG48 [23] phi (byte) scrollup2::l#4 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:scrollup2->scrollup2::@1#0] -- vbuz1=vbuc1 + //SEG50 [25] phi (byte) scrollup2::l#4 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:scrollup2->scrollup2::@1#0] -- vbuz1=vbuc1 lda #0 sta l - //SEG49 [23] phi (byte*) scrollup2::line1#3 = (const byte*) screen#0 [phi:scrollup2->scrollup2::@1#1] -- pbuz1=pbuc1 + //SEG51 [25] phi (byte*) scrollup2::line1#3 = (const byte*) screen#0 [phi:scrollup2->scrollup2::@1#1] -- pbuz1=pbuc1 lda #screen sta line1+1 - //SEG50 [23] phi (byte*) scrollup2::line2#3 = (const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) $28 [phi:scrollup2->scrollup2::@1#2] -- pbuz1=pbuc1 + //SEG52 [25] phi (byte*) scrollup2::line2#3 = (const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) $28 [phi:scrollup2->scrollup2::@1#2] -- pbuz1=pbuc1 lda #screen+$28 sta line2+1 jmp b1 - //SEG51 [23] phi from scrollup2::@3 to scrollup2::@1 [phi:scrollup2::@3->scrollup2::@1] + //SEG53 [25] phi from scrollup2::@3 to scrollup2::@1 [phi:scrollup2::@3->scrollup2::@1] b1_from_b3: - //SEG52 [23] phi (byte) scrollup2::l#4 = (byte) scrollup2::l#1 [phi:scrollup2::@3->scrollup2::@1#0] -- register_copy - //SEG53 [23] phi (byte*) scrollup2::line1#3 = (byte*) scrollup2::line1#1 [phi:scrollup2::@3->scrollup2::@1#1] -- register_copy - //SEG54 [23] phi (byte*) scrollup2::line2#3 = (byte*) scrollup2::line2#1 [phi:scrollup2::@3->scrollup2::@1#2] -- register_copy + //SEG54 [25] phi (byte) scrollup2::l#4 = (byte) scrollup2::l#1 [phi:scrollup2::@3->scrollup2::@1#0] -- register_copy + //SEG55 [25] phi (byte*) scrollup2::line1#3 = (byte*) scrollup2::line1#1 [phi:scrollup2::@3->scrollup2::@1#1] -- register_copy + //SEG56 [25] phi (byte*) scrollup2::line2#3 = (byte*) scrollup2::line2#1 [phi:scrollup2::@3->scrollup2::@1#2] -- register_copy jmp b1 - //SEG55 scrollup2::@1 + //SEG57 scrollup2::@1 b1: - //SEG56 [24] phi from scrollup2::@1 to scrollup2::@2 [phi:scrollup2::@1->scrollup2::@2] + //SEG58 [26] phi from scrollup2::@1 to scrollup2::@2 [phi:scrollup2::@1->scrollup2::@2] b2_from_b1: - //SEG57 [24] phi (byte) scrollup2::c#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:scrollup2::@1->scrollup2::@2#0] -- vbuz1=vbuc1 + //SEG59 [26] phi (byte) scrollup2::c#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:scrollup2::@1->scrollup2::@2#0] -- vbuz1=vbuc1 lda #0 sta c - //SEG58 [24] phi (byte*) scrollup2::line1#2 = (byte*) scrollup2::line1#3 [phi:scrollup2::@1->scrollup2::@2#1] -- register_copy - //SEG59 [24] phi (byte*) scrollup2::line2#2 = (byte*) scrollup2::line2#3 [phi:scrollup2::@1->scrollup2::@2#2] -- register_copy + //SEG60 [26] phi (byte*) scrollup2::line1#2 = (byte*) scrollup2::line1#3 [phi:scrollup2::@1->scrollup2::@2#1] -- register_copy + //SEG61 [26] phi (byte*) scrollup2::line2#2 = (byte*) scrollup2::line2#3 [phi:scrollup2::@1->scrollup2::@2#2] -- register_copy jmp b2 - //SEG60 [24] phi from scrollup2::@2 to scrollup2::@2 [phi:scrollup2::@2->scrollup2::@2] + //SEG62 [26] phi from scrollup2::@2 to scrollup2::@2 [phi:scrollup2::@2->scrollup2::@2] b2_from_b2: - //SEG61 [24] phi (byte) scrollup2::c#2 = (byte) scrollup2::c#1 [phi:scrollup2::@2->scrollup2::@2#0] -- register_copy - //SEG62 [24] phi (byte*) scrollup2::line1#2 = (byte*) scrollup2::line1#1 [phi:scrollup2::@2->scrollup2::@2#1] -- register_copy - //SEG63 [24] phi (byte*) scrollup2::line2#2 = (byte*) scrollup2::line2#1 [phi:scrollup2::@2->scrollup2::@2#2] -- register_copy + //SEG63 [26] phi (byte) scrollup2::c#2 = (byte) scrollup2::c#1 [phi:scrollup2::@2->scrollup2::@2#0] -- register_copy + //SEG64 [26] phi (byte*) scrollup2::line1#2 = (byte*) scrollup2::line1#1 [phi:scrollup2::@2->scrollup2::@2#1] -- register_copy + //SEG65 [26] phi (byte*) scrollup2::line2#2 = (byte*) scrollup2::line2#1 [phi:scrollup2::@2->scrollup2::@2#2] -- register_copy jmp b2 - //SEG64 scrollup2::@2 + //SEG66 scrollup2::@2 b2: - //SEG65 [25] *((byte*) scrollup2::line1#2) ← *((byte*) scrollup2::line2#2) -- _deref_pbuz1=_deref_pbuz2 + //SEG67 [27] *((byte*) scrollup2::line1#2) ← *((byte*) scrollup2::line2#2) -- _deref_pbuz1=_deref_pbuz2 ldy #0 lda (line2),y ldy #0 sta (line1),y - //SEG66 [26] (byte*) scrollup2::line1#1 ← ++ (byte*) scrollup2::line1#2 -- pbuz1=_inc_pbuz1 + //SEG68 [28] (byte*) scrollup2::line1#1 ← ++ (byte*) scrollup2::line1#2 -- pbuz1=_inc_pbuz1 inc line1 bne !+ inc line1+1 !: - //SEG67 [27] (byte*) scrollup2::line2#1 ← ++ (byte*) scrollup2::line2#2 -- pbuz1=_inc_pbuz1 + //SEG69 [29] (byte*) scrollup2::line2#1 ← ++ (byte*) scrollup2::line2#2 -- pbuz1=_inc_pbuz1 inc line2 bne !+ inc line2+1 !: - //SEG68 [28] (byte) scrollup2::c#1 ← ++ (byte) scrollup2::c#2 -- vbuz1=_inc_vbuz1 + //SEG70 [30] (byte) scrollup2::c#1 ← ++ (byte) scrollup2::c#2 -- vbuz1=_inc_vbuz1 inc c - //SEG69 [29] if((byte) scrollup2::c#1!=(byte/signed byte/word/signed word/dword/signed dword) $28) goto scrollup2::@2 -- vbuz1_neq_vbuc1_then_la1 + //SEG71 [31] if((byte) scrollup2::c#1!=(byte/signed byte/word/signed word/dword/signed dword) $28) goto scrollup2::@2 -- vbuz1_neq_vbuc1_then_la1 lda #$28 cmp c bne b2_from_b2 jmp b3 - //SEG70 scrollup2::@3 + //SEG72 scrollup2::@3 b3: - //SEG71 [30] (byte) scrollup2::l#1 ← ++ (byte) scrollup2::l#4 -- vbuz1=_inc_vbuz1 + //SEG73 [32] (byte) scrollup2::l#1 ← ++ (byte) scrollup2::l#4 -- vbuz1=_inc_vbuz1 inc l - //SEG72 [31] if((byte) scrollup2::l#1!=(byte/signed byte/word/signed word/dword/signed dword) $18) goto scrollup2::@1 -- vbuz1_neq_vbuc1_then_la1 + //SEG74 [33] if((byte) scrollup2::l#1!=(byte/signed byte/word/signed word/dword/signed dword) $18) goto scrollup2::@1 -- vbuz1_neq_vbuc1_then_la1 lda #$18 cmp l bne b1_from_b3 jmp breturn - //SEG73 scrollup2::@return + //SEG75 scrollup2::@return breturn: - //SEG74 [32] return + //SEG76 [34] return rts } -//SEG75 scrollup1 +//SEG77 scrollup1 scrollup1: { - .label _0 = $10 - .label _2 = $12 + .label _0 = $14 + .label _2 = $16 .label c = $f .label line = $d - //SEG76 [34] phi from scrollup1 to scrollup1::@1 [phi:scrollup1->scrollup1::@1] + .label _6 = $18 + .label _7 = $1a + //SEG78 [36] phi from scrollup1 to scrollup1::@1 [phi:scrollup1->scrollup1::@1] b1_from_scrollup1: - //SEG77 [34] phi (word) scrollup1::line#4 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:scrollup1->scrollup1::@1#0] -- vwuz1=vbuc1 + //SEG79 [36] phi (word) scrollup1::line#4 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:scrollup1->scrollup1::@1#0] -- vwuz1=vbuc1 lda #0 sta line lda #0 sta line+1 jmp b1 - //SEG78 [34] phi from scrollup1::@3 to scrollup1::@1 [phi:scrollup1::@3->scrollup1::@1] + //SEG80 [36] phi from scrollup1::@3 to scrollup1::@1 [phi:scrollup1::@3->scrollup1::@1] b1_from_b3: - //SEG79 [34] phi (word) scrollup1::line#4 = (word) scrollup1::line#1 [phi:scrollup1::@3->scrollup1::@1#0] -- register_copy + //SEG81 [36] phi (word) scrollup1::line#4 = (word) scrollup1::line#1 [phi:scrollup1::@3->scrollup1::@1#0] -- register_copy jmp b1 - //SEG80 scrollup1::@1 + //SEG82 scrollup1::@1 b1: - //SEG81 [35] phi from scrollup1::@1 to scrollup1::@2 [phi:scrollup1::@1->scrollup1::@2] + //SEG83 [37] phi from scrollup1::@1 to scrollup1::@2 [phi:scrollup1::@1->scrollup1::@2] b2_from_b1: - //SEG82 [35] phi (byte) scrollup1::c#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:scrollup1::@1->scrollup1::@2#0] -- vbuz1=vbuc1 + //SEG84 [37] phi (byte) scrollup1::c#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:scrollup1::@1->scrollup1::@2#0] -- vbuz1=vbuc1 lda #0 sta c jmp b2 - //SEG83 [35] phi from scrollup1::@2 to scrollup1::@2 [phi:scrollup1::@2->scrollup1::@2] + //SEG85 [37] phi from scrollup1::@2 to scrollup1::@2 [phi:scrollup1::@2->scrollup1::@2] b2_from_b2: - //SEG84 [35] phi (byte) scrollup1::c#2 = (byte) scrollup1::c#1 [phi:scrollup1::@2->scrollup1::@2#0] -- register_copy + //SEG86 [37] phi (byte) scrollup1::c#2 = (byte) scrollup1::c#1 [phi:scrollup1::@2->scrollup1::@2#0] -- register_copy jmp b2 - //SEG85 scrollup1::@2 + //SEG87 scrollup1::@2 b2: - //SEG86 [36] (word~) scrollup1::$0 ← (word) scrollup1::line#4 + (byte) scrollup1::c#2 -- vwuz1=vwuz2_plus_vbuz3 + //SEG88 [38] (word~) scrollup1::$0 ← (word) scrollup1::line#4 + (byte) scrollup1::c#2 -- vwuz1=vwuz2_plus_vbuz3 lda c clc adc line @@ -769,7 +800,7 @@ scrollup1: { lda #0 adc line+1 sta _0+1 - //SEG87 [37] (word~) scrollup1::$2 ← (word) scrollup1::line#4 + (byte) scrollup1::c#2 -- vwuz1=vwuz2_plus_vbuz3 + //SEG89 [39] (word~) scrollup1::$2 ← (word) scrollup1::line#4 + (byte) scrollup1::c#2 -- vwuz1=vwuz2_plus_vbuz3 lda c clc adc line @@ -777,35 +808,37 @@ scrollup1: { lda #0 adc line+1 sta _2+1 - //SEG88 [38] *((const byte*) screen#0 + (word~) scrollup1::$0) ← *((const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) $28 + (word~) scrollup1::$2) -- pbuc1_derefidx_vwuz1=pbuc2_derefidx_vwuz2 - lda #screen - adc _0+1 - sta !a1++2 - lda #screen+$28 + sta _6+1 + //SEG91 [41] (byte*) scrollup1::$7 ← (const byte*) screen#0 + (word~) scrollup1::$0 -- pbuz1=pbuc1_plus_vwuz2 + lda _0 clc - adc _2 - sta !a2++1 - lda #>screen+$28 - adc _2+1 - sta !a2++2 - !a2: - lda screen+$28 - !a1: - sta screen - //SEG89 [39] (byte) scrollup1::c#1 ← ++ (byte) scrollup1::c#2 -- vbuz1=_inc_vbuz1 + adc #screen + sta _7+1 + //SEG92 [42] *((byte*) scrollup1::$7) ← *((byte*) scrollup1::$6) -- _deref_pbuz1=_deref_pbuz2 + ldy #0 + lda (_6),y + ldy #0 + sta (_7),y + //SEG93 [43] (byte) scrollup1::c#1 ← ++ (byte) scrollup1::c#2 -- vbuz1=_inc_vbuz1 inc c - //SEG90 [40] if((byte) scrollup1::c#1<(byte/signed byte/word/signed word/dword/signed dword) $28) goto scrollup1::@2 -- vbuz1_lt_vbuc1_then_la1 + //SEG94 [44] if((byte) scrollup1::c#1<(byte/signed byte/word/signed word/dword/signed dword) $28) goto scrollup1::@2 -- vbuz1_lt_vbuc1_then_la1 lda c cmp #$28 bcc b2_from_b2 jmp b3 - //SEG91 scrollup1::@3 + //SEG95 scrollup1::@3 b3: - //SEG92 [41] (word) scrollup1::line#1 ← (word) scrollup1::line#4 + (byte/signed byte/word/signed word/dword/signed dword) $28 -- vwuz1=vwuz1_plus_vbuc1 + //SEG96 [45] (word) scrollup1::line#1 ← (word) scrollup1::line#4 + (byte/signed byte/word/signed word/dword/signed dword) $28 -- vwuz1=vwuz1_plus_vbuc1 lda #$28 clc adc line @@ -813,7 +846,7 @@ scrollup1: { bcc !+ inc line+1 !: - //SEG93 [42] if((word) scrollup1::line#1<(byte/signed byte/word/signed word/dword/signed dword) $28*(byte/signed byte/word/signed word/dword/signed dword) $18) goto scrollup1::@1 -- vwuz1_lt_vwuc1_then_la1 + //SEG97 [46] if((word) scrollup1::line#1<(byte/signed byte/word/signed word/dword/signed dword) $28*(byte/signed byte/word/signed word/dword/signed dword) $18) goto scrollup1::@1 -- vwuz1_lt_vwuc1_then_la1 lda line+1 cmp #>$28*$18 bcc b1_from_b3 @@ -823,71 +856,89 @@ scrollup1: { bcc b1_from_b3 !: jmp breturn - //SEG94 scrollup1::@return + //SEG98 scrollup1::@return breturn: - //SEG95 [43] return + //SEG99 [47] return rts } REGISTER UPLIFT POTENTIAL REGISTERS Statement [13] (word~) scrollup3::l2#4 ← (word) scrollup3::l2#0 [ scrollup3::l2#0 scrollup3::l2#4 ] ( main:2::scrollup3:9 [ scrollup3::l2#0 scrollup3::l2#4 ] ) always clobbers reg byte a -Statement [15] *((const byte*) screen#0 + (word) scrollup3::l2#2) ← *((const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) $28 + (word) scrollup3::l2#2) [ scrollup3::l2#0 scrollup3::l2#2 scrollup3::c#2 ] ( main:2::scrollup3:9 [ scrollup3::l2#0 scrollup3::l2#2 scrollup3::c#2 ] ) always clobbers reg byte a +Statement [15] (byte*) scrollup3::$4 ← (const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) $28 + (word) scrollup3::l2#2 [ scrollup3::l2#0 scrollup3::l2#2 scrollup3::c#2 scrollup3::$4 ] ( main:2::scrollup3:9 [ scrollup3::l2#0 scrollup3::l2#2 scrollup3::c#2 scrollup3::$4 ] ) always clobbers reg byte a Removing always clobbered register reg byte a as potential for zp ZP_BYTE:6 [ scrollup3::c#2 scrollup3::c#1 ] -Statement [19] (word) scrollup3::line#1 ← (word) scrollup3::l2#0 + (byte/signed byte/word/signed word/dword/signed dword) $28 [ scrollup3::line#1 ] ( main:2::scrollup3:9 [ scrollup3::line#1 ] ) always clobbers reg byte a -Statement [20] if((word) scrollup3::line#1<(byte/signed byte/word/signed word/dword/signed dword) $28*(byte/signed byte/word/signed word/dword/signed dword) $18) goto scrollup3::@1 [ scrollup3::line#1 ] ( main:2::scrollup3:9 [ scrollup3::line#1 ] ) always clobbers reg byte a -Statement [25] *((byte*) scrollup2::line1#2) ← *((byte*) scrollup2::line2#2) [ scrollup2::l#4 scrollup2::line2#2 scrollup2::line1#2 scrollup2::c#2 ] ( main:2::scrollup2:7 [ scrollup2::l#4 scrollup2::line2#2 scrollup2::line1#2 scrollup2::c#2 ] ) always clobbers reg byte a reg byte y +Statement [16] (byte*) scrollup3::$5 ← (const byte*) screen#0 + (word) scrollup3::l2#2 [ scrollup3::l2#0 scrollup3::l2#2 scrollup3::c#2 scrollup3::$4 scrollup3::$5 ] ( main:2::scrollup3:9 [ scrollup3::l2#0 scrollup3::l2#2 scrollup3::c#2 scrollup3::$4 scrollup3::$5 ] ) always clobbers reg byte a +Statement [17] *((byte*) scrollup3::$5) ← *((byte*) scrollup3::$4) [ scrollup3::l2#0 scrollup3::l2#2 scrollup3::c#2 ] ( main:2::scrollup3:9 [ scrollup3::l2#0 scrollup3::l2#2 scrollup3::c#2 ] ) always clobbers reg byte a reg byte y +Removing always clobbered register reg byte y as potential for zp ZP_BYTE:6 [ scrollup3::c#2 scrollup3::c#1 ] +Statement [21] (word) scrollup3::line#1 ← (word) scrollup3::l2#0 + (byte/signed byte/word/signed word/dword/signed dword) $28 [ scrollup3::line#1 ] ( main:2::scrollup3:9 [ scrollup3::line#1 ] ) always clobbers reg byte a +Statement [22] if((word) scrollup3::line#1<(byte/signed byte/word/signed word/dword/signed dword) $28*(byte/signed byte/word/signed word/dword/signed dword) $18) goto scrollup3::@1 [ scrollup3::line#1 ] ( main:2::scrollup3:9 [ scrollup3::line#1 ] ) always clobbers reg byte a +Statement [27] *((byte*) scrollup2::line1#2) ← *((byte*) scrollup2::line2#2) [ scrollup2::l#4 scrollup2::line2#2 scrollup2::line1#2 scrollup2::c#2 ] ( main:2::scrollup2:7 [ scrollup2::l#4 scrollup2::line2#2 scrollup2::line1#2 scrollup2::c#2 ] ) always clobbers reg byte a reg byte y Removing always clobbered register reg byte a as potential for zp ZP_BYTE:7 [ scrollup2::l#4 scrollup2::l#1 ] Removing always clobbered register reg byte y as potential for zp ZP_BYTE:7 [ scrollup2::l#4 scrollup2::l#1 ] Removing always clobbered register reg byte a as potential for zp ZP_BYTE:12 [ scrollup2::c#2 scrollup2::c#1 ] Removing always clobbered register reg byte y as potential for zp ZP_BYTE:12 [ scrollup2::c#2 scrollup2::c#1 ] -Statement [36] (word~) scrollup1::$0 ← (word) scrollup1::line#4 + (byte) scrollup1::c#2 [ scrollup1::line#4 scrollup1::c#2 scrollup1::$0 ] ( main:2::scrollup1:5 [ scrollup1::line#4 scrollup1::c#2 scrollup1::$0 ] ) always clobbers reg byte a +Statement [38] (word~) scrollup1::$0 ← (word) scrollup1::line#4 + (byte) scrollup1::c#2 [ scrollup1::line#4 scrollup1::c#2 scrollup1::$0 ] ( main:2::scrollup1:5 [ scrollup1::line#4 scrollup1::c#2 scrollup1::$0 ] ) always clobbers reg byte a Removing always clobbered register reg byte a as potential for zp ZP_BYTE:15 [ scrollup1::c#2 scrollup1::c#1 ] -Statement [37] (word~) scrollup1::$2 ← (word) scrollup1::line#4 + (byte) scrollup1::c#2 [ scrollup1::line#4 scrollup1::c#2 scrollup1::$0 scrollup1::$2 ] ( main:2::scrollup1:5 [ scrollup1::line#4 scrollup1::c#2 scrollup1::$0 scrollup1::$2 ] ) always clobbers reg byte a -Statement [38] *((const byte*) screen#0 + (word~) scrollup1::$0) ← *((const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) $28 + (word~) scrollup1::$2) [ scrollup1::line#4 scrollup1::c#2 ] ( main:2::scrollup1:5 [ scrollup1::line#4 scrollup1::c#2 ] ) always clobbers reg byte a -Statement [41] (word) scrollup1::line#1 ← (word) scrollup1::line#4 + (byte/signed byte/word/signed word/dword/signed dword) $28 [ scrollup1::line#1 ] ( main:2::scrollup1:5 [ scrollup1::line#1 ] ) always clobbers reg byte a -Statement [42] if((word) scrollup1::line#1<(byte/signed byte/word/signed word/dword/signed dword) $28*(byte/signed byte/word/signed word/dword/signed dword) $18) goto scrollup1::@1 [ scrollup1::line#1 ] ( main:2::scrollup1:5 [ scrollup1::line#1 ] ) always clobbers reg byte a +Statement [39] (word~) scrollup1::$2 ← (word) scrollup1::line#4 + (byte) scrollup1::c#2 [ scrollup1::line#4 scrollup1::c#2 scrollup1::$0 scrollup1::$2 ] ( main:2::scrollup1:5 [ scrollup1::line#4 scrollup1::c#2 scrollup1::$0 scrollup1::$2 ] ) always clobbers reg byte a +Statement [40] (byte*) scrollup1::$6 ← (const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) $28 + (word~) scrollup1::$2 [ scrollup1::line#4 scrollup1::c#2 scrollup1::$0 scrollup1::$6 ] ( main:2::scrollup1:5 [ scrollup1::line#4 scrollup1::c#2 scrollup1::$0 scrollup1::$6 ] ) always clobbers reg byte a +Statement [41] (byte*) scrollup1::$7 ← (const byte*) screen#0 + (word~) scrollup1::$0 [ scrollup1::line#4 scrollup1::c#2 scrollup1::$6 scrollup1::$7 ] ( main:2::scrollup1:5 [ scrollup1::line#4 scrollup1::c#2 scrollup1::$6 scrollup1::$7 ] ) always clobbers reg byte a +Statement [42] *((byte*) scrollup1::$7) ← *((byte*) scrollup1::$6) [ scrollup1::line#4 scrollup1::c#2 ] ( main:2::scrollup1:5 [ scrollup1::line#4 scrollup1::c#2 ] ) always clobbers reg byte a reg byte y +Removing always clobbered register reg byte y as potential for zp ZP_BYTE:15 [ scrollup1::c#2 scrollup1::c#1 ] +Statement [45] (word) scrollup1::line#1 ← (word) scrollup1::line#4 + (byte/signed byte/word/signed word/dword/signed dword) $28 [ scrollup1::line#1 ] ( main:2::scrollup1:5 [ scrollup1::line#1 ] ) always clobbers reg byte a +Statement [46] if((word) scrollup1::line#1<(byte/signed byte/word/signed word/dword/signed dword) $28*(byte/signed byte/word/signed word/dword/signed dword) $18) goto scrollup1::@1 [ scrollup1::line#1 ] ( main:2::scrollup1:5 [ scrollup1::line#1 ] ) always clobbers reg byte a Statement [13] (word~) scrollup3::l2#4 ← (word) scrollup3::l2#0 [ scrollup3::l2#0 scrollup3::l2#4 ] ( main:2::scrollup3:9 [ scrollup3::l2#0 scrollup3::l2#4 ] ) always clobbers reg byte a -Statement [15] *((const byte*) screen#0 + (word) scrollup3::l2#2) ← *((const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) $28 + (word) scrollup3::l2#2) [ scrollup3::l2#0 scrollup3::l2#2 scrollup3::c#2 ] ( main:2::scrollup3:9 [ scrollup3::l2#0 scrollup3::l2#2 scrollup3::c#2 ] ) always clobbers reg byte a -Statement [19] (word) scrollup3::line#1 ← (word) scrollup3::l2#0 + (byte/signed byte/word/signed word/dword/signed dword) $28 [ scrollup3::line#1 ] ( main:2::scrollup3:9 [ scrollup3::line#1 ] ) always clobbers reg byte a -Statement [20] if((word) scrollup3::line#1<(byte/signed byte/word/signed word/dword/signed dword) $28*(byte/signed byte/word/signed word/dword/signed dword) $18) goto scrollup3::@1 [ scrollup3::line#1 ] ( main:2::scrollup3:9 [ scrollup3::line#1 ] ) always clobbers reg byte a -Statement [25] *((byte*) scrollup2::line1#2) ← *((byte*) scrollup2::line2#2) [ scrollup2::l#4 scrollup2::line2#2 scrollup2::line1#2 scrollup2::c#2 ] ( main:2::scrollup2:7 [ scrollup2::l#4 scrollup2::line2#2 scrollup2::line1#2 scrollup2::c#2 ] ) always clobbers reg byte a reg byte y -Statement [36] (word~) scrollup1::$0 ← (word) scrollup1::line#4 + (byte) scrollup1::c#2 [ scrollup1::line#4 scrollup1::c#2 scrollup1::$0 ] ( main:2::scrollup1:5 [ scrollup1::line#4 scrollup1::c#2 scrollup1::$0 ] ) always clobbers reg byte a -Statement [37] (word~) scrollup1::$2 ← (word) scrollup1::line#4 + (byte) scrollup1::c#2 [ scrollup1::line#4 scrollup1::c#2 scrollup1::$0 scrollup1::$2 ] ( main:2::scrollup1:5 [ scrollup1::line#4 scrollup1::c#2 scrollup1::$0 scrollup1::$2 ] ) always clobbers reg byte a -Statement [38] *((const byte*) screen#0 + (word~) scrollup1::$0) ← *((const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) $28 + (word~) scrollup1::$2) [ scrollup1::line#4 scrollup1::c#2 ] ( main:2::scrollup1:5 [ scrollup1::line#4 scrollup1::c#2 ] ) always clobbers reg byte a -Statement [41] (word) scrollup1::line#1 ← (word) scrollup1::line#4 + (byte/signed byte/word/signed word/dword/signed dword) $28 [ scrollup1::line#1 ] ( main:2::scrollup1:5 [ scrollup1::line#1 ] ) always clobbers reg byte a -Statement [42] if((word) scrollup1::line#1<(byte/signed byte/word/signed word/dword/signed dword) $28*(byte/signed byte/word/signed word/dword/signed dword) $18) goto scrollup1::@1 [ scrollup1::line#1 ] ( main:2::scrollup1:5 [ scrollup1::line#1 ] ) always clobbers reg byte a +Statement [15] (byte*) scrollup3::$4 ← (const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) $28 + (word) scrollup3::l2#2 [ scrollup3::l2#0 scrollup3::l2#2 scrollup3::c#2 scrollup3::$4 ] ( main:2::scrollup3:9 [ scrollup3::l2#0 scrollup3::l2#2 scrollup3::c#2 scrollup3::$4 ] ) always clobbers reg byte a +Statement [16] (byte*) scrollup3::$5 ← (const byte*) screen#0 + (word) scrollup3::l2#2 [ scrollup3::l2#0 scrollup3::l2#2 scrollup3::c#2 scrollup3::$4 scrollup3::$5 ] ( main:2::scrollup3:9 [ scrollup3::l2#0 scrollup3::l2#2 scrollup3::c#2 scrollup3::$4 scrollup3::$5 ] ) always clobbers reg byte a +Statement [17] *((byte*) scrollup3::$5) ← *((byte*) scrollup3::$4) [ scrollup3::l2#0 scrollup3::l2#2 scrollup3::c#2 ] ( main:2::scrollup3:9 [ scrollup3::l2#0 scrollup3::l2#2 scrollup3::c#2 ] ) always clobbers reg byte a reg byte y +Statement [21] (word) scrollup3::line#1 ← (word) scrollup3::l2#0 + (byte/signed byte/word/signed word/dword/signed dword) $28 [ scrollup3::line#1 ] ( main:2::scrollup3:9 [ scrollup3::line#1 ] ) always clobbers reg byte a +Statement [22] if((word) scrollup3::line#1<(byte/signed byte/word/signed word/dword/signed dword) $28*(byte/signed byte/word/signed word/dword/signed dword) $18) goto scrollup3::@1 [ scrollup3::line#1 ] ( main:2::scrollup3:9 [ scrollup3::line#1 ] ) always clobbers reg byte a +Statement [27] *((byte*) scrollup2::line1#2) ← *((byte*) scrollup2::line2#2) [ scrollup2::l#4 scrollup2::line2#2 scrollup2::line1#2 scrollup2::c#2 ] ( main:2::scrollup2:7 [ scrollup2::l#4 scrollup2::line2#2 scrollup2::line1#2 scrollup2::c#2 ] ) always clobbers reg byte a reg byte y +Statement [38] (word~) scrollup1::$0 ← (word) scrollup1::line#4 + (byte) scrollup1::c#2 [ scrollup1::line#4 scrollup1::c#2 scrollup1::$0 ] ( main:2::scrollup1:5 [ scrollup1::line#4 scrollup1::c#2 scrollup1::$0 ] ) always clobbers reg byte a +Statement [39] (word~) scrollup1::$2 ← (word) scrollup1::line#4 + (byte) scrollup1::c#2 [ scrollup1::line#4 scrollup1::c#2 scrollup1::$0 scrollup1::$2 ] ( main:2::scrollup1:5 [ scrollup1::line#4 scrollup1::c#2 scrollup1::$0 scrollup1::$2 ] ) always clobbers reg byte a +Statement [40] (byte*) scrollup1::$6 ← (const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) $28 + (word~) scrollup1::$2 [ scrollup1::line#4 scrollup1::c#2 scrollup1::$0 scrollup1::$6 ] ( main:2::scrollup1:5 [ scrollup1::line#4 scrollup1::c#2 scrollup1::$0 scrollup1::$6 ] ) always clobbers reg byte a +Statement [41] (byte*) scrollup1::$7 ← (const byte*) screen#0 + (word~) scrollup1::$0 [ scrollup1::line#4 scrollup1::c#2 scrollup1::$6 scrollup1::$7 ] ( main:2::scrollup1:5 [ scrollup1::line#4 scrollup1::c#2 scrollup1::$6 scrollup1::$7 ] ) always clobbers reg byte a +Statement [42] *((byte*) scrollup1::$7) ← *((byte*) scrollup1::$6) [ scrollup1::line#4 scrollup1::c#2 ] ( main:2::scrollup1:5 [ scrollup1::line#4 scrollup1::c#2 ] ) always clobbers reg byte a reg byte y +Statement [45] (word) scrollup1::line#1 ← (word) scrollup1::line#4 + (byte/signed byte/word/signed word/dword/signed dword) $28 [ scrollup1::line#1 ] ( main:2::scrollup1:5 [ scrollup1::line#1 ] ) always clobbers reg byte a +Statement [46] if((word) scrollup1::line#1<(byte/signed byte/word/signed word/dword/signed dword) $28*(byte/signed byte/word/signed word/dword/signed dword) $18) goto scrollup1::@1 [ scrollup1::line#1 ] ( main:2::scrollup1:5 [ scrollup1::line#1 ] ) always clobbers reg byte a Potential registers zp ZP_WORD:2 [ scrollup3::l2#0 scrollup3::line#1 ] : zp ZP_WORD:2 , Potential registers zp ZP_WORD:4 [ scrollup3::l2#2 scrollup3::l2#4 scrollup3::l2#1 ] : zp ZP_WORD:4 , -Potential registers zp ZP_BYTE:6 [ scrollup3::c#2 scrollup3::c#1 ] : zp ZP_BYTE:6 , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:6 [ scrollup3::c#2 scrollup3::c#1 ] : zp ZP_BYTE:6 , reg byte x , Potential registers zp ZP_BYTE:7 [ scrollup2::l#4 scrollup2::l#1 ] : zp ZP_BYTE:7 , reg byte x , Potential registers zp ZP_WORD:8 [ scrollup2::line2#2 scrollup2::line2#3 scrollup2::line2#1 ] : zp ZP_WORD:8 , Potential registers zp ZP_WORD:10 [ scrollup2::line1#2 scrollup2::line1#3 scrollup2::line1#1 ] : zp ZP_WORD:10 , Potential registers zp ZP_BYTE:12 [ scrollup2::c#2 scrollup2::c#1 ] : zp ZP_BYTE:12 , reg byte x , Potential registers zp ZP_WORD:13 [ scrollup1::line#4 scrollup1::line#1 ] : zp ZP_WORD:13 , -Potential registers zp ZP_BYTE:15 [ scrollup1::c#2 scrollup1::c#1 ] : zp ZP_BYTE:15 , reg byte x , reg byte y , -Potential registers zp ZP_WORD:16 [ scrollup1::$0 ] : zp ZP_WORD:16 , -Potential registers zp ZP_WORD:18 [ scrollup1::$2 ] : zp ZP_WORD:18 , +Potential registers zp ZP_BYTE:15 [ scrollup1::c#2 scrollup1::c#1 ] : zp ZP_BYTE:15 , reg byte x , +Potential registers zp ZP_WORD:16 [ scrollup3::$4 ] : zp ZP_WORD:16 , +Potential registers zp ZP_WORD:18 [ scrollup3::$5 ] : zp ZP_WORD:18 , +Potential registers zp ZP_WORD:20 [ scrollup1::$0 ] : zp ZP_WORD:20 , +Potential registers zp ZP_WORD:22 [ scrollup1::$2 ] : zp ZP_WORD:22 , +Potential registers zp ZP_WORD:24 [ scrollup1::$6 ] : zp ZP_WORD:24 , +Potential registers zp ZP_WORD:26 [ scrollup1::$7 ] : zp ZP_WORD:26 , REGISTER UPLIFT SCOPES +Uplift Scope [scrollup1] 218.83: zp ZP_BYTE:15 [ scrollup1::c#2 scrollup1::c#1 ] 202: zp ZP_WORD:22 [ scrollup1::$2 ] 202: zp ZP_WORD:26 [ scrollup1::$7 ] 101: zp ZP_WORD:24 [ scrollup1::$6 ] 67.33: zp ZP_WORD:20 [ scrollup1::$0 ] 41.39: zp ZP_WORD:13 [ scrollup1::line#4 scrollup1::line#1 ] +Uplift Scope [scrollup3] 202: zp ZP_WORD:18 [ scrollup3::$5 ] 193.08: zp ZP_WORD:4 [ scrollup3::l2#2 scrollup3::l2#4 scrollup3::l2#1 ] 191.9: zp ZP_BYTE:6 [ scrollup3::c#2 scrollup3::c#1 ] 101: zp ZP_WORD:16 [ scrollup3::$4 ] 20.17: zp ZP_WORD:2 [ scrollup3::l2#0 scrollup3::line#1 ] Uplift Scope [scrollup2] 214.5: zp ZP_WORD:10 [ scrollup2::line1#2 scrollup2::line1#3 scrollup2::line1#1 ] 202: zp ZP_BYTE:12 [ scrollup2::c#2 scrollup2::c#1 ] 169.27: zp ZP_WORD:8 [ scrollup2::line2#2 scrollup2::line2#3 scrollup2::line2#1 ] 19.64: zp ZP_BYTE:7 [ scrollup2::l#4 scrollup2::l#1 ] -Uplift Scope [scrollup1] 252.5: zp ZP_BYTE:15 [ scrollup1::c#2 scrollup1::c#1 ] 202: zp ZP_WORD:18 [ scrollup1::$2 ] 101: zp ZP_WORD:16 [ scrollup1::$0 ] 48.5: zp ZP_WORD:13 [ scrollup1::line#4 scrollup1::line#1 ] -Uplift Scope [scrollup3] 296.83: zp ZP_WORD:4 [ scrollup3::l2#2 scrollup3::l2#4 scrollup3::l2#1 ] 218.83: zp ZP_BYTE:6 [ scrollup3::c#2 scrollup3::c#1 ] 21.21: zp ZP_WORD:2 [ scrollup3::l2#0 scrollup3::line#1 ] Uplift Scope [main] Uplift Scope [] -Uplifting [scrollup2] best 27478 combination zp ZP_WORD:10 [ scrollup2::line1#2 scrollup2::line1#3 scrollup2::line1#1 ] reg byte x [ scrollup2::c#2 scrollup2::c#1 ] zp ZP_WORD:8 [ scrollup2::line2#2 scrollup2::line2#3 scrollup2::line2#1 ] zp ZP_BYTE:7 [ scrollup2::l#4 scrollup2::l#1 ] -Uplifting [scrollup1] best 26378 combination reg byte x [ scrollup1::c#2 scrollup1::c#1 ] zp ZP_WORD:18 [ scrollup1::$2 ] zp ZP_WORD:16 [ scrollup1::$0 ] zp ZP_WORD:13 [ scrollup1::line#4 scrollup1::line#1 ] -Uplifting [scrollup3] best 25478 combination zp ZP_WORD:4 [ scrollup3::l2#2 scrollup3::l2#4 scrollup3::l2#1 ] reg byte x [ scrollup3::c#2 scrollup3::c#1 ] zp ZP_WORD:2 [ scrollup3::l2#0 scrollup3::line#1 ] -Uplifting [main] best 25478 combination -Uplifting [] best 25478 combination +Uplifting [scrollup1] best 27978 combination reg byte x [ scrollup1::c#2 scrollup1::c#1 ] zp ZP_WORD:22 [ scrollup1::$2 ] zp ZP_WORD:26 [ scrollup1::$7 ] zp ZP_WORD:24 [ scrollup1::$6 ] zp ZP_WORD:20 [ scrollup1::$0 ] zp ZP_WORD:13 [ scrollup1::line#4 scrollup1::line#1 ] +Uplifting [scrollup3] best 27078 combination zp ZP_WORD:18 [ scrollup3::$5 ] zp ZP_WORD:4 [ scrollup3::l2#2 scrollup3::l2#4 scrollup3::l2#1 ] reg byte x [ scrollup3::c#2 scrollup3::c#1 ] zp ZP_WORD:16 [ scrollup3::$4 ] zp ZP_WORD:2 [ scrollup3::l2#0 scrollup3::line#1 ] +Uplifting [scrollup2] best 26178 combination zp ZP_WORD:10 [ scrollup2::line1#2 scrollup2::line1#3 scrollup2::line1#1 ] reg byte x [ scrollup2::c#2 scrollup2::c#1 ] zp ZP_WORD:8 [ scrollup2::line2#2 scrollup2::line2#3 scrollup2::line2#1 ] zp ZP_BYTE:7 [ scrollup2::l#4 scrollup2::l#1 ] +Uplifting [main] best 26178 combination +Uplifting [] best 26178 combination Attempting to uplift remaining variables inzp ZP_BYTE:7 [ scrollup2::l#4 scrollup2::l#1 ] -Uplifting [scrollup2] best 25478 combination zp ZP_BYTE:7 [ scrollup2::l#4 scrollup2::l#1 ] +Uplifting [scrollup2] best 26178 combination zp ZP_BYTE:7 [ scrollup2::l#4 scrollup2::l#1 ] +Coalescing zero page register with common assignment [ zp ZP_WORD:20 [ scrollup1::$0 ] ] with [ zp ZP_WORD:26 [ scrollup1::$7 ] ] - score: 1 +Coalescing zero page register with common assignment [ zp ZP_WORD:22 [ scrollup1::$2 ] ] with [ zp ZP_WORD:24 [ scrollup1::$6 ] ] - score: 1 Coalescing zero page register [ zp ZP_WORD:2 [ scrollup3::l2#0 scrollup3::line#1 ] ] with [ zp ZP_WORD:8 [ scrollup2::line2#2 scrollup2::line2#3 scrollup2::line2#1 ] ] Coalescing zero page register [ zp ZP_WORD:2 [ scrollup3::l2#0 scrollup3::line#1 scrollup2::line2#2 scrollup2::line2#3 scrollup2::line2#1 ] ] with [ zp ZP_WORD:13 [ scrollup1::line#4 scrollup1::line#1 ] ] Coalescing zero page register [ zp ZP_WORD:4 [ scrollup3::l2#2 scrollup3::l2#4 scrollup3::l2#1 ] ] with [ zp ZP_WORD:10 [ scrollup2::line1#2 scrollup2::line1#3 scrollup2::line1#1 ] ] -Coalescing zero page register [ zp ZP_WORD:4 [ scrollup3::l2#2 scrollup3::l2#4 scrollup3::l2#1 scrollup2::line1#2 scrollup2::line1#3 scrollup2::line1#1 ] ] with [ zp ZP_WORD:16 [ scrollup1::$0 ] ] +Coalescing zero page register [ zp ZP_WORD:4 [ scrollup3::l2#2 scrollup3::l2#4 scrollup3::l2#1 scrollup2::line1#2 scrollup2::line1#3 scrollup2::line1#1 ] ] with [ zp ZP_WORD:20 [ scrollup1::$0 scrollup1::$7 ] ] +Coalescing zero page register [ zp ZP_WORD:16 [ scrollup3::$4 ] ] with [ zp ZP_WORD:22 [ scrollup1::$2 scrollup1::$6 ] ] Allocated (was zp ZP_BYTE:7) zp ZP_BYTE:6 [ scrollup2::l#4 scrollup2::l#1 ] -Allocated (was zp ZP_WORD:18) zp ZP_WORD:7 [ scrollup1::$2 ] +Allocated (was zp ZP_WORD:16) zp ZP_WORD:7 [ scrollup3::$4 scrollup1::$2 scrollup1::$6 ] +Allocated (was zp ZP_WORD:18) zp ZP_WORD:9 [ scrollup3::$5 ] ASSEMBLER BEFORE OPTIMIZATION //SEG0 File Comments @@ -917,7 +968,7 @@ bend: //SEG10 main main: { //SEG11 [5] call scrollup1 - //SEG12 [33] phi from main to scrollup1 [phi:main->scrollup1] + //SEG12 [35] phi from main to scrollup1 [phi:main->scrollup1] scrollup1_from_main: jsr scrollup1 //SEG13 [6] phi from main to main::@1 [phi:main->main::@1] @@ -926,7 +977,7 @@ main: { //SEG14 main::@1 b1: //SEG15 [7] call scrollup2 - //SEG16 [22] phi from main::@1 to scrollup2 [phi:main::@1->scrollup2] + //SEG16 [24] phi from main::@1 to scrollup2 [phi:main::@1->scrollup2] scrollup2_from_b1: jsr scrollup2 //SEG17 [8] phi from main::@1 to main::@2 [phi:main::@1->main::@2] @@ -950,6 +1001,8 @@ scrollup3: { .label l2_1 = 4 .label line = 2 .label l2_2 = 4 + .label _4 = 7 + .label _5 = 9 .label l2_4 = 4 //SEG24 [12] phi from scrollup3 to scrollup3::@1 [phi:scrollup3->scrollup3::@1] b1_from_scrollup3: @@ -983,39 +1036,41 @@ scrollup3: { jmp b2 //SEG36 scrollup3::@2 b2: - //SEG37 [15] *((const byte*) screen#0 + (word) scrollup3::l2#2) ← *((const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) $28 + (word) scrollup3::l2#2) -- pbuc1_derefidx_vwuz1=pbuc2_derefidx_vwuz1 - lda #screen - adc l2_2+1 - sta !a1++2 - lda #screen+$28 + sta _4+1 + //SEG38 [16] (byte*) scrollup3::$5 ← (const byte*) screen#0 + (word) scrollup3::l2#2 -- pbuz1=pbuc1_plus_vwuz2 + lda l2_2 clc - adc l2_2 - sta !a2++1 - lda #>screen+$28 - adc l2_2+1 - sta !a2++2 - !a2: - lda screen+$28 - !a1: - sta screen - //SEG38 [16] (word) scrollup3::l2#1 ← ++ (word) scrollup3::l2#2 -- vwuz1=_inc_vwuz1 + adc #screen + sta _5+1 + //SEG39 [17] *((byte*) scrollup3::$5) ← *((byte*) scrollup3::$4) -- _deref_pbuz1=_deref_pbuz2 + ldy #0 + lda (_4),y + ldy #0 + sta (_5),y + //SEG40 [18] (word) scrollup3::l2#1 ← ++ (word) scrollup3::l2#2 -- vwuz1=_inc_vwuz1 inc l2_1 bne !+ inc l2_1+1 !: - //SEG39 [17] (byte) scrollup3::c#1 ← ++ (byte) scrollup3::c#2 -- vbuxx=_inc_vbuxx + //SEG41 [19] (byte) scrollup3::c#1 ← ++ (byte) scrollup3::c#2 -- vbuxx=_inc_vbuxx inx - //SEG40 [18] if((byte) scrollup3::c#1<(byte/signed byte/word/signed word/dword/signed dword) $28) goto scrollup3::@2 -- vbuxx_lt_vbuc1_then_la1 + //SEG42 [20] if((byte) scrollup3::c#1<(byte/signed byte/word/signed word/dword/signed dword) $28) goto scrollup3::@2 -- vbuxx_lt_vbuc1_then_la1 cpx #$28 bcc b2_from_b2 jmp b3 - //SEG41 scrollup3::@3 + //SEG43 scrollup3::@3 b3: - //SEG42 [19] (word) scrollup3::line#1 ← (word) scrollup3::l2#0 + (byte/signed byte/word/signed word/dword/signed dword) $28 -- vwuz1=vwuz1_plus_vbuc1 + //SEG44 [21] (word) scrollup3::line#1 ← (word) scrollup3::l2#0 + (byte/signed byte/word/signed word/dword/signed dword) $28 -- vwuz1=vwuz1_plus_vbuc1 lda #$28 clc adc line @@ -1023,7 +1078,7 @@ scrollup3: { bcc !+ inc line+1 !: - //SEG43 [20] if((word) scrollup3::line#1<(byte/signed byte/word/signed word/dword/signed dword) $28*(byte/signed byte/word/signed word/dword/signed dword) $18) goto scrollup3::@1 -- vwuz1_lt_vwuc1_then_la1 + //SEG45 [22] if((word) scrollup3::line#1<(byte/signed byte/word/signed word/dword/signed dword) $28*(byte/signed byte/word/signed word/dword/signed dword) $18) goto scrollup3::@1 -- vwuz1_lt_vwuc1_then_la1 lda line+1 cmp #>$28*$18 bcc b1_from_b3 @@ -1033,121 +1088,123 @@ scrollup3: { bcc b1_from_b3 !: jmp breturn - //SEG44 scrollup3::@return + //SEG46 scrollup3::@return breturn: - //SEG45 [21] return + //SEG47 [23] return rts } -//SEG46 scrollup2 +//SEG48 scrollup2 scrollup2: { .label line1 = 4 .label line2 = 2 .label l = 6 - //SEG47 [23] phi from scrollup2 to scrollup2::@1 [phi:scrollup2->scrollup2::@1] + //SEG49 [25] phi from scrollup2 to scrollup2::@1 [phi:scrollup2->scrollup2::@1] b1_from_scrollup2: - //SEG48 [23] phi (byte) scrollup2::l#4 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:scrollup2->scrollup2::@1#0] -- vbuz1=vbuc1 + //SEG50 [25] phi (byte) scrollup2::l#4 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:scrollup2->scrollup2::@1#0] -- vbuz1=vbuc1 lda #0 sta l - //SEG49 [23] phi (byte*) scrollup2::line1#3 = (const byte*) screen#0 [phi:scrollup2->scrollup2::@1#1] -- pbuz1=pbuc1 + //SEG51 [25] phi (byte*) scrollup2::line1#3 = (const byte*) screen#0 [phi:scrollup2->scrollup2::@1#1] -- pbuz1=pbuc1 lda #screen sta line1+1 - //SEG50 [23] phi (byte*) scrollup2::line2#3 = (const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) $28 [phi:scrollup2->scrollup2::@1#2] -- pbuz1=pbuc1 + //SEG52 [25] phi (byte*) scrollup2::line2#3 = (const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) $28 [phi:scrollup2->scrollup2::@1#2] -- pbuz1=pbuc1 lda #screen+$28 sta line2+1 jmp b1 - //SEG51 [23] phi from scrollup2::@3 to scrollup2::@1 [phi:scrollup2::@3->scrollup2::@1] + //SEG53 [25] phi from scrollup2::@3 to scrollup2::@1 [phi:scrollup2::@3->scrollup2::@1] b1_from_b3: - //SEG52 [23] phi (byte) scrollup2::l#4 = (byte) scrollup2::l#1 [phi:scrollup2::@3->scrollup2::@1#0] -- register_copy - //SEG53 [23] phi (byte*) scrollup2::line1#3 = (byte*) scrollup2::line1#1 [phi:scrollup2::@3->scrollup2::@1#1] -- register_copy - //SEG54 [23] phi (byte*) scrollup2::line2#3 = (byte*) scrollup2::line2#1 [phi:scrollup2::@3->scrollup2::@1#2] -- register_copy + //SEG54 [25] phi (byte) scrollup2::l#4 = (byte) scrollup2::l#1 [phi:scrollup2::@3->scrollup2::@1#0] -- register_copy + //SEG55 [25] phi (byte*) scrollup2::line1#3 = (byte*) scrollup2::line1#1 [phi:scrollup2::@3->scrollup2::@1#1] -- register_copy + //SEG56 [25] phi (byte*) scrollup2::line2#3 = (byte*) scrollup2::line2#1 [phi:scrollup2::@3->scrollup2::@1#2] -- register_copy jmp b1 - //SEG55 scrollup2::@1 + //SEG57 scrollup2::@1 b1: - //SEG56 [24] phi from scrollup2::@1 to scrollup2::@2 [phi:scrollup2::@1->scrollup2::@2] + //SEG58 [26] phi from scrollup2::@1 to scrollup2::@2 [phi:scrollup2::@1->scrollup2::@2] b2_from_b1: - //SEG57 [24] phi (byte) scrollup2::c#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:scrollup2::@1->scrollup2::@2#0] -- vbuxx=vbuc1 + //SEG59 [26] phi (byte) scrollup2::c#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:scrollup2::@1->scrollup2::@2#0] -- vbuxx=vbuc1 ldx #0 - //SEG58 [24] phi (byte*) scrollup2::line1#2 = (byte*) scrollup2::line1#3 [phi:scrollup2::@1->scrollup2::@2#1] -- register_copy - //SEG59 [24] phi (byte*) scrollup2::line2#2 = (byte*) scrollup2::line2#3 [phi:scrollup2::@1->scrollup2::@2#2] -- register_copy + //SEG60 [26] phi (byte*) scrollup2::line1#2 = (byte*) scrollup2::line1#3 [phi:scrollup2::@1->scrollup2::@2#1] -- register_copy + //SEG61 [26] phi (byte*) scrollup2::line2#2 = (byte*) scrollup2::line2#3 [phi:scrollup2::@1->scrollup2::@2#2] -- register_copy jmp b2 - //SEG60 [24] phi from scrollup2::@2 to scrollup2::@2 [phi:scrollup2::@2->scrollup2::@2] + //SEG62 [26] phi from scrollup2::@2 to scrollup2::@2 [phi:scrollup2::@2->scrollup2::@2] b2_from_b2: - //SEG61 [24] phi (byte) scrollup2::c#2 = (byte) scrollup2::c#1 [phi:scrollup2::@2->scrollup2::@2#0] -- register_copy - //SEG62 [24] phi (byte*) scrollup2::line1#2 = (byte*) scrollup2::line1#1 [phi:scrollup2::@2->scrollup2::@2#1] -- register_copy - //SEG63 [24] phi (byte*) scrollup2::line2#2 = (byte*) scrollup2::line2#1 [phi:scrollup2::@2->scrollup2::@2#2] -- register_copy + //SEG63 [26] phi (byte) scrollup2::c#2 = (byte) scrollup2::c#1 [phi:scrollup2::@2->scrollup2::@2#0] -- register_copy + //SEG64 [26] phi (byte*) scrollup2::line1#2 = (byte*) scrollup2::line1#1 [phi:scrollup2::@2->scrollup2::@2#1] -- register_copy + //SEG65 [26] phi (byte*) scrollup2::line2#2 = (byte*) scrollup2::line2#1 [phi:scrollup2::@2->scrollup2::@2#2] -- register_copy jmp b2 - //SEG64 scrollup2::@2 + //SEG66 scrollup2::@2 b2: - //SEG65 [25] *((byte*) scrollup2::line1#2) ← *((byte*) scrollup2::line2#2) -- _deref_pbuz1=_deref_pbuz2 + //SEG67 [27] *((byte*) scrollup2::line1#2) ← *((byte*) scrollup2::line2#2) -- _deref_pbuz1=_deref_pbuz2 ldy #0 lda (line2),y ldy #0 sta (line1),y - //SEG66 [26] (byte*) scrollup2::line1#1 ← ++ (byte*) scrollup2::line1#2 -- pbuz1=_inc_pbuz1 + //SEG68 [28] (byte*) scrollup2::line1#1 ← ++ (byte*) scrollup2::line1#2 -- pbuz1=_inc_pbuz1 inc line1 bne !+ inc line1+1 !: - //SEG67 [27] (byte*) scrollup2::line2#1 ← ++ (byte*) scrollup2::line2#2 -- pbuz1=_inc_pbuz1 + //SEG69 [29] (byte*) scrollup2::line2#1 ← ++ (byte*) scrollup2::line2#2 -- pbuz1=_inc_pbuz1 inc line2 bne !+ inc line2+1 !: - //SEG68 [28] (byte) scrollup2::c#1 ← ++ (byte) scrollup2::c#2 -- vbuxx=_inc_vbuxx + //SEG70 [30] (byte) scrollup2::c#1 ← ++ (byte) scrollup2::c#2 -- vbuxx=_inc_vbuxx inx - //SEG69 [29] if((byte) scrollup2::c#1!=(byte/signed byte/word/signed word/dword/signed dword) $28) goto scrollup2::@2 -- vbuxx_neq_vbuc1_then_la1 + //SEG71 [31] if((byte) scrollup2::c#1!=(byte/signed byte/word/signed word/dword/signed dword) $28) goto scrollup2::@2 -- vbuxx_neq_vbuc1_then_la1 cpx #$28 bne b2_from_b2 jmp b3 - //SEG70 scrollup2::@3 + //SEG72 scrollup2::@3 b3: - //SEG71 [30] (byte) scrollup2::l#1 ← ++ (byte) scrollup2::l#4 -- vbuz1=_inc_vbuz1 + //SEG73 [32] (byte) scrollup2::l#1 ← ++ (byte) scrollup2::l#4 -- vbuz1=_inc_vbuz1 inc l - //SEG72 [31] if((byte) scrollup2::l#1!=(byte/signed byte/word/signed word/dword/signed dword) $18) goto scrollup2::@1 -- vbuz1_neq_vbuc1_then_la1 + //SEG74 [33] if((byte) scrollup2::l#1!=(byte/signed byte/word/signed word/dword/signed dword) $18) goto scrollup2::@1 -- vbuz1_neq_vbuc1_then_la1 lda #$18 cmp l bne b1_from_b3 jmp breturn - //SEG73 scrollup2::@return + //SEG75 scrollup2::@return breturn: - //SEG74 [32] return + //SEG76 [34] return rts } -//SEG75 scrollup1 +//SEG77 scrollup1 scrollup1: { .label _0 = 4 .label _2 = 7 .label line = 2 - //SEG76 [34] phi from scrollup1 to scrollup1::@1 [phi:scrollup1->scrollup1::@1] + .label _6 = 7 + .label _7 = 4 + //SEG78 [36] phi from scrollup1 to scrollup1::@1 [phi:scrollup1->scrollup1::@1] b1_from_scrollup1: - //SEG77 [34] phi (word) scrollup1::line#4 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:scrollup1->scrollup1::@1#0] -- vwuz1=vbuc1 + //SEG79 [36] phi (word) scrollup1::line#4 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:scrollup1->scrollup1::@1#0] -- vwuz1=vbuc1 lda #0 sta line lda #0 sta line+1 jmp b1 - //SEG78 [34] phi from scrollup1::@3 to scrollup1::@1 [phi:scrollup1::@3->scrollup1::@1] + //SEG80 [36] phi from scrollup1::@3 to scrollup1::@1 [phi:scrollup1::@3->scrollup1::@1] b1_from_b3: - //SEG79 [34] phi (word) scrollup1::line#4 = (word) scrollup1::line#1 [phi:scrollup1::@3->scrollup1::@1#0] -- register_copy + //SEG81 [36] phi (word) scrollup1::line#4 = (word) scrollup1::line#1 [phi:scrollup1::@3->scrollup1::@1#0] -- register_copy jmp b1 - //SEG80 scrollup1::@1 + //SEG82 scrollup1::@1 b1: - //SEG81 [35] phi from scrollup1::@1 to scrollup1::@2 [phi:scrollup1::@1->scrollup1::@2] + //SEG83 [37] phi from scrollup1::@1 to scrollup1::@2 [phi:scrollup1::@1->scrollup1::@2] b2_from_b1: - //SEG82 [35] phi (byte) scrollup1::c#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:scrollup1::@1->scrollup1::@2#0] -- vbuxx=vbuc1 + //SEG84 [37] phi (byte) scrollup1::c#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:scrollup1::@1->scrollup1::@2#0] -- vbuxx=vbuc1 ldx #0 jmp b2 - //SEG83 [35] phi from scrollup1::@2 to scrollup1::@2 [phi:scrollup1::@2->scrollup1::@2] + //SEG85 [37] phi from scrollup1::@2 to scrollup1::@2 [phi:scrollup1::@2->scrollup1::@2] b2_from_b2: - //SEG84 [35] phi (byte) scrollup1::c#2 = (byte) scrollup1::c#1 [phi:scrollup1::@2->scrollup1::@2#0] -- register_copy + //SEG86 [37] phi (byte) scrollup1::c#2 = (byte) scrollup1::c#1 [phi:scrollup1::@2->scrollup1::@2#0] -- register_copy jmp b2 - //SEG85 scrollup1::@2 + //SEG87 scrollup1::@2 b2: - //SEG86 [36] (word~) scrollup1::$0 ← (word) scrollup1::line#4 + (byte) scrollup1::c#2 -- vwuz1=vwuz2_plus_vbuxx + //SEG88 [38] (word~) scrollup1::$0 ← (word) scrollup1::line#4 + (byte) scrollup1::c#2 -- vwuz1=vwuz2_plus_vbuxx txa clc adc line @@ -1155,7 +1212,7 @@ scrollup1: { lda #0 adc line+1 sta _0+1 - //SEG87 [37] (word~) scrollup1::$2 ← (word) scrollup1::line#4 + (byte) scrollup1::c#2 -- vwuz1=vwuz2_plus_vbuxx + //SEG89 [39] (word~) scrollup1::$2 ← (word) scrollup1::line#4 + (byte) scrollup1::c#2 -- vwuz1=vwuz2_plus_vbuxx txa clc adc line @@ -1163,34 +1220,36 @@ scrollup1: { lda #0 adc line+1 sta _2+1 - //SEG88 [38] *((const byte*) screen#0 + (word~) scrollup1::$0) ← *((const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) $28 + (word~) scrollup1::$2) -- pbuc1_derefidx_vwuz1=pbuc2_derefidx_vwuz2 - lda #screen - adc _0+1 - sta !a1++2 - lda #screen+$28 + sta _6+1 + //SEG91 [41] (byte*) scrollup1::$7 ← (const byte*) screen#0 + (word~) scrollup1::$0 -- pbuz1=pbuc1_plus_vwuz1 clc - adc _2 - sta !a2++1 - lda #>screen+$28 - adc _2+1 - sta !a2++2 - !a2: - lda screen+$28 - !a1: - sta screen - //SEG89 [39] (byte) scrollup1::c#1 ← ++ (byte) scrollup1::c#2 -- vbuxx=_inc_vbuxx + lda _7 + adc #screen + sta _7+1 + //SEG92 [42] *((byte*) scrollup1::$7) ← *((byte*) scrollup1::$6) -- _deref_pbuz1=_deref_pbuz2 + ldy #0 + lda (_6),y + ldy #0 + sta (_7),y + //SEG93 [43] (byte) scrollup1::c#1 ← ++ (byte) scrollup1::c#2 -- vbuxx=_inc_vbuxx inx - //SEG90 [40] if((byte) scrollup1::c#1<(byte/signed byte/word/signed word/dword/signed dword) $28) goto scrollup1::@2 -- vbuxx_lt_vbuc1_then_la1 + //SEG94 [44] if((byte) scrollup1::c#1<(byte/signed byte/word/signed word/dword/signed dword) $28) goto scrollup1::@2 -- vbuxx_lt_vbuc1_then_la1 cpx #$28 bcc b2_from_b2 jmp b3 - //SEG91 scrollup1::@3 + //SEG95 scrollup1::@3 b3: - //SEG92 [41] (word) scrollup1::line#1 ← (word) scrollup1::line#4 + (byte/signed byte/word/signed word/dword/signed dword) $28 -- vwuz1=vwuz1_plus_vbuc1 + //SEG96 [45] (word) scrollup1::line#1 ← (word) scrollup1::line#4 + (byte/signed byte/word/signed word/dword/signed dword) $28 -- vwuz1=vwuz1_plus_vbuc1 lda #$28 clc adc line @@ -1198,7 +1257,7 @@ scrollup1: { bcc !+ inc line+1 !: - //SEG93 [42] if((word) scrollup1::line#1<(byte/signed byte/word/signed word/dword/signed dword) $28*(byte/signed byte/word/signed word/dword/signed dword) $18) goto scrollup1::@1 -- vwuz1_lt_vwuc1_then_la1 + //SEG97 [46] if((word) scrollup1::line#1<(byte/signed byte/word/signed word/dword/signed dword) $28*(byte/signed byte/word/signed word/dword/signed dword) $18) goto scrollup1::@1 -- vwuz1_lt_vwuc1_then_la1 lda line+1 cmp #>$28*$18 bcc b1_from_b3 @@ -1208,9 +1267,9 @@ scrollup1: { bcc b1_from_b3 !: jmp breturn - //SEG94 scrollup1::@return + //SEG98 scrollup1::@return breturn: - //SEG95 [43] return + //SEG99 [47] return rts } @@ -1235,7 +1294,9 @@ Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination Removing instruction lda #0 Removing instruction ldy #0 +Removing instruction ldy #0 Removing instruction lda #0 +Removing instruction ldy #0 Succesful ASM optimization Pass5UnnecesaryLoadElimination Replacing label b2_from_b2 with b2 Replacing label b1_from_b3 with b1 @@ -1302,18 +1363,20 @@ FINAL SYMBOL TABLE (byte*) screen (const byte*) screen#0 screen = ((byte*))(word/signed word/dword/signed dword) $400 (void()) scrollup1() -(word~) scrollup1::$0 $0 zp ZP_WORD:4 101.0 +(word~) scrollup1::$0 $0 zp ZP_WORD:4 67.33333333333333 (word~) scrollup1::$2 $2 zp ZP_WORD:7 202.0 +(byte*) scrollup1::$6 $6 zp ZP_WORD:7 101.0 +(byte*) scrollup1::$7 $7 zp ZP_WORD:4 202.0 (label) scrollup1::@1 (label) scrollup1::@2 (label) scrollup1::@3 (label) scrollup1::@return (byte) scrollup1::c (byte) scrollup1::c#1 reg byte x 151.5 -(byte) scrollup1::c#2 reg byte x 101.0 +(byte) scrollup1::c#2 reg byte x 67.33333333333333 (word) scrollup1::line (word) scrollup1::line#1 line zp ZP_WORD:2 16.5 -(word) scrollup1::line#4 line zp ZP_WORD:2 32.0 +(word) scrollup1::line#4 line zp ZP_WORD:2 24.888888888888886 (void()) scrollup2() (label) scrollup2::@1 (label) scrollup2::@2 @@ -1334,32 +1397,35 @@ FINAL SYMBOL TABLE (byte*) scrollup2::line2#2 line2 zp ZP_WORD:2 104.66666666666666 (byte*) scrollup2::line2#3 line2 zp ZP_WORD:2 22.0 (void()) scrollup3() +(byte*) scrollup3::$4 $4 zp ZP_WORD:7 101.0 +(byte*) scrollup3::$5 $5 zp ZP_WORD:9 202.0 (label) scrollup3::@1 (label) scrollup3::@2 (label) scrollup3::@3 (label) scrollup3::@return (byte) scrollup3::c (byte) scrollup3::c#1 reg byte x 151.5 -(byte) scrollup3::c#2 reg byte x 67.33333333333333 +(byte) scrollup3::c#2 reg byte x 40.4 (word) scrollup3::l2 -(word) scrollup3::l2#0 l2 zp ZP_WORD:2 4.714285714285714 +(word) scrollup3::l2#0 l2 zp ZP_WORD:2 3.666666666666667 (word) scrollup3::l2#1 l2#1 zp ZP_WORD:4 67.33333333333333 -(word) scrollup3::l2#2 l2#2 zp ZP_WORD:4 207.5 +(word) scrollup3::l2#2 l2#2 zp ZP_WORD:4 103.75 (word~) scrollup3::l2#4 l2#4 zp ZP_WORD:4 22.0 (word) scrollup3::line (word) scrollup3::line#1 line zp ZP_WORD:2 16.5 zp ZP_WORD:2 [ scrollup3::l2#0 scrollup3::line#1 scrollup2::line2#2 scrollup2::line2#3 scrollup2::line2#1 scrollup1::line#4 scrollup1::line#1 ] -zp ZP_WORD:4 [ scrollup3::l2#2 scrollup3::l2#4 scrollup3::l2#1 scrollup2::line1#2 scrollup2::line1#3 scrollup2::line1#1 scrollup1::$0 ] +zp ZP_WORD:4 [ scrollup3::l2#2 scrollup3::l2#4 scrollup3::l2#1 scrollup2::line1#2 scrollup2::line1#3 scrollup2::line1#1 scrollup1::$0 scrollup1::$7 ] reg byte x [ scrollup3::c#2 scrollup3::c#1 ] zp ZP_BYTE:6 [ scrollup2::l#4 scrollup2::l#1 ] reg byte x [ scrollup2::c#2 scrollup2::c#1 ] reg byte x [ scrollup1::c#2 scrollup1::c#1 ] -zp ZP_WORD:7 [ scrollup1::$2 ] +zp ZP_WORD:7 [ scrollup3::$4 scrollup1::$2 scrollup1::$6 ] +zp ZP_WORD:9 [ scrollup3::$5 ] FINAL ASSEMBLER -Score: 22247 +Score: 22547 //SEG0 File Comments // Tests different ways of scrolling up the screen @@ -1379,12 +1445,12 @@ Score: 22247 //SEG10 main main: { //SEG11 [5] call scrollup1 - //SEG12 [33] phi from main to scrollup1 [phi:main->scrollup1] + //SEG12 [35] phi from main to scrollup1 [phi:main->scrollup1] jsr scrollup1 //SEG13 [6] phi from main to main::@1 [phi:main->main::@1] //SEG14 main::@1 //SEG15 [7] call scrollup2 - //SEG16 [22] phi from main::@1 to scrollup2 [phi:main::@1->scrollup2] + //SEG16 [24] phi from main::@1 to scrollup2 [phi:main::@1->scrollup2] jsr scrollup2 //SEG17 [8] phi from main::@1 to main::@2 [phi:main::@1->main::@2] //SEG18 main::@2 @@ -1401,6 +1467,8 @@ scrollup3: { .label l2_1 = 4 .label line = 2 .label l2_2 = 4 + .label _4 = 7 + .label _5 = 9 .label l2_4 = 4 //SEG24 [12] phi from scrollup3 to scrollup3::@1 [phi:scrollup3->scrollup3::@1] //SEG25 [12] phi (word) scrollup3::l2#0 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:scrollup3->scrollup3::@1#0] -- vwuz1=vbuc1 @@ -1425,37 +1493,38 @@ scrollup3: { //SEG35 [14] phi (word) scrollup3::l2#2 = (word) scrollup3::l2#1 [phi:scrollup3::@2->scrollup3::@2#1] -- register_copy //SEG36 scrollup3::@2 b2: - //SEG37 [15] *((const byte*) screen#0 + (word) scrollup3::l2#2) ← *((const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) $28 + (word) scrollup3::l2#2) -- pbuc1_derefidx_vwuz1=pbuc2_derefidx_vwuz1 - lda #screen - adc l2_2+1 - sta !a1++2 - lda #screen+$28 + sta _4+1 + //SEG38 [16] (byte*) scrollup3::$5 ← (const byte*) screen#0 + (word) scrollup3::l2#2 -- pbuz1=pbuc1_plus_vwuz2 + lda l2_2 clc - adc l2_2 - sta !a2++1 - lda #>screen+$28 - adc l2_2+1 - sta !a2++2 - !a2: - lda screen+$28 - !a1: - sta screen - //SEG38 [16] (word) scrollup3::l2#1 ← ++ (word) scrollup3::l2#2 -- vwuz1=_inc_vwuz1 + adc #screen + sta _5+1 + //SEG39 [17] *((byte*) scrollup3::$5) ← *((byte*) scrollup3::$4) -- _deref_pbuz1=_deref_pbuz2 + ldy #0 + lda (_4),y + sta (_5),y + //SEG40 [18] (word) scrollup3::l2#1 ← ++ (word) scrollup3::l2#2 -- vwuz1=_inc_vwuz1 inc l2_1 bne !+ inc l2_1+1 !: - //SEG39 [17] (byte) scrollup3::c#1 ← ++ (byte) scrollup3::c#2 -- vbuxx=_inc_vbuxx + //SEG41 [19] (byte) scrollup3::c#1 ← ++ (byte) scrollup3::c#2 -- vbuxx=_inc_vbuxx inx - //SEG40 [18] if((byte) scrollup3::c#1<(byte/signed byte/word/signed word/dword/signed dword) $28) goto scrollup3::@2 -- vbuxx_lt_vbuc1_then_la1 + //SEG42 [20] if((byte) scrollup3::c#1<(byte/signed byte/word/signed word/dword/signed dword) $28) goto scrollup3::@2 -- vbuxx_lt_vbuc1_then_la1 cpx #$28 bcc b2 - //SEG41 scrollup3::@3 - //SEG42 [19] (word) scrollup3::line#1 ← (word) scrollup3::l2#0 + (byte/signed byte/word/signed word/dword/signed dword) $28 -- vwuz1=vwuz1_plus_vbuc1 + //SEG43 scrollup3::@3 + //SEG44 [21] (word) scrollup3::line#1 ← (word) scrollup3::l2#0 + (byte/signed byte/word/signed word/dword/signed dword) $28 -- vwuz1=vwuz1_plus_vbuc1 lda #$28 clc adc line @@ -1463,7 +1532,7 @@ scrollup3: { bcc !+ inc line+1 !: - //SEG43 [20] if((word) scrollup3::line#1<(byte/signed byte/word/signed word/dword/signed dword) $28*(byte/signed byte/word/signed word/dword/signed dword) $18) goto scrollup3::@1 -- vwuz1_lt_vwuc1_then_la1 + //SEG45 [22] if((word) scrollup3::line#1<(byte/signed byte/word/signed word/dword/signed dword) $28*(byte/signed byte/word/signed word/dword/signed dword) $18) goto scrollup3::@1 -- vwuz1_lt_vwuc1_then_la1 lda line+1 cmp #>$28*$18 bcc b1 @@ -1472,98 +1541,100 @@ scrollup3: { cmp #<$28*$18 bcc b1 !: - //SEG44 scrollup3::@return - //SEG45 [21] return + //SEG46 scrollup3::@return + //SEG47 [23] return rts } -//SEG46 scrollup2 +//SEG48 scrollup2 scrollup2: { .label line1 = 4 .label line2 = 2 .label l = 6 - //SEG47 [23] phi from scrollup2 to scrollup2::@1 [phi:scrollup2->scrollup2::@1] - //SEG48 [23] phi (byte) scrollup2::l#4 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:scrollup2->scrollup2::@1#0] -- vbuz1=vbuc1 + //SEG49 [25] phi from scrollup2 to scrollup2::@1 [phi:scrollup2->scrollup2::@1] + //SEG50 [25] phi (byte) scrollup2::l#4 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:scrollup2->scrollup2::@1#0] -- vbuz1=vbuc1 lda #0 sta l - //SEG49 [23] phi (byte*) scrollup2::line1#3 = (const byte*) screen#0 [phi:scrollup2->scrollup2::@1#1] -- pbuz1=pbuc1 + //SEG51 [25] phi (byte*) scrollup2::line1#3 = (const byte*) screen#0 [phi:scrollup2->scrollup2::@1#1] -- pbuz1=pbuc1 lda #screen sta line1+1 - //SEG50 [23] phi (byte*) scrollup2::line2#3 = (const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) $28 [phi:scrollup2->scrollup2::@1#2] -- pbuz1=pbuc1 + //SEG52 [25] phi (byte*) scrollup2::line2#3 = (const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) $28 [phi:scrollup2->scrollup2::@1#2] -- pbuz1=pbuc1 lda #screen+$28 sta line2+1 - //SEG51 [23] phi from scrollup2::@3 to scrollup2::@1 [phi:scrollup2::@3->scrollup2::@1] - //SEG52 [23] phi (byte) scrollup2::l#4 = (byte) scrollup2::l#1 [phi:scrollup2::@3->scrollup2::@1#0] -- register_copy - //SEG53 [23] phi (byte*) scrollup2::line1#3 = (byte*) scrollup2::line1#1 [phi:scrollup2::@3->scrollup2::@1#1] -- register_copy - //SEG54 [23] phi (byte*) scrollup2::line2#3 = (byte*) scrollup2::line2#1 [phi:scrollup2::@3->scrollup2::@1#2] -- register_copy - //SEG55 scrollup2::@1 + //SEG53 [25] phi from scrollup2::@3 to scrollup2::@1 [phi:scrollup2::@3->scrollup2::@1] + //SEG54 [25] phi (byte) scrollup2::l#4 = (byte) scrollup2::l#1 [phi:scrollup2::@3->scrollup2::@1#0] -- register_copy + //SEG55 [25] phi (byte*) scrollup2::line1#3 = (byte*) scrollup2::line1#1 [phi:scrollup2::@3->scrollup2::@1#1] -- register_copy + //SEG56 [25] phi (byte*) scrollup2::line2#3 = (byte*) scrollup2::line2#1 [phi:scrollup2::@3->scrollup2::@1#2] -- register_copy + //SEG57 scrollup2::@1 b1: - //SEG56 [24] phi from scrollup2::@1 to scrollup2::@2 [phi:scrollup2::@1->scrollup2::@2] - //SEG57 [24] phi (byte) scrollup2::c#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:scrollup2::@1->scrollup2::@2#0] -- vbuxx=vbuc1 + //SEG58 [26] phi from scrollup2::@1 to scrollup2::@2 [phi:scrollup2::@1->scrollup2::@2] + //SEG59 [26] phi (byte) scrollup2::c#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:scrollup2::@1->scrollup2::@2#0] -- vbuxx=vbuc1 ldx #0 - //SEG58 [24] phi (byte*) scrollup2::line1#2 = (byte*) scrollup2::line1#3 [phi:scrollup2::@1->scrollup2::@2#1] -- register_copy - //SEG59 [24] phi (byte*) scrollup2::line2#2 = (byte*) scrollup2::line2#3 [phi:scrollup2::@1->scrollup2::@2#2] -- register_copy - //SEG60 [24] phi from scrollup2::@2 to scrollup2::@2 [phi:scrollup2::@2->scrollup2::@2] - //SEG61 [24] phi (byte) scrollup2::c#2 = (byte) scrollup2::c#1 [phi:scrollup2::@2->scrollup2::@2#0] -- register_copy - //SEG62 [24] phi (byte*) scrollup2::line1#2 = (byte*) scrollup2::line1#1 [phi:scrollup2::@2->scrollup2::@2#1] -- register_copy - //SEG63 [24] phi (byte*) scrollup2::line2#2 = (byte*) scrollup2::line2#1 [phi:scrollup2::@2->scrollup2::@2#2] -- register_copy - //SEG64 scrollup2::@2 + //SEG60 [26] phi (byte*) scrollup2::line1#2 = (byte*) scrollup2::line1#3 [phi:scrollup2::@1->scrollup2::@2#1] -- register_copy + //SEG61 [26] phi (byte*) scrollup2::line2#2 = (byte*) scrollup2::line2#3 [phi:scrollup2::@1->scrollup2::@2#2] -- register_copy + //SEG62 [26] phi from scrollup2::@2 to scrollup2::@2 [phi:scrollup2::@2->scrollup2::@2] + //SEG63 [26] phi (byte) scrollup2::c#2 = (byte) scrollup2::c#1 [phi:scrollup2::@2->scrollup2::@2#0] -- register_copy + //SEG64 [26] phi (byte*) scrollup2::line1#2 = (byte*) scrollup2::line1#1 [phi:scrollup2::@2->scrollup2::@2#1] -- register_copy + //SEG65 [26] phi (byte*) scrollup2::line2#2 = (byte*) scrollup2::line2#1 [phi:scrollup2::@2->scrollup2::@2#2] -- register_copy + //SEG66 scrollup2::@2 b2: - //SEG65 [25] *((byte*) scrollup2::line1#2) ← *((byte*) scrollup2::line2#2) -- _deref_pbuz1=_deref_pbuz2 + //SEG67 [27] *((byte*) scrollup2::line1#2) ← *((byte*) scrollup2::line2#2) -- _deref_pbuz1=_deref_pbuz2 ldy #0 lda (line2),y sta (line1),y - //SEG66 [26] (byte*) scrollup2::line1#1 ← ++ (byte*) scrollup2::line1#2 -- pbuz1=_inc_pbuz1 + //SEG68 [28] (byte*) scrollup2::line1#1 ← ++ (byte*) scrollup2::line1#2 -- pbuz1=_inc_pbuz1 inc line1 bne !+ inc line1+1 !: - //SEG67 [27] (byte*) scrollup2::line2#1 ← ++ (byte*) scrollup2::line2#2 -- pbuz1=_inc_pbuz1 + //SEG69 [29] (byte*) scrollup2::line2#1 ← ++ (byte*) scrollup2::line2#2 -- pbuz1=_inc_pbuz1 inc line2 bne !+ inc line2+1 !: - //SEG68 [28] (byte) scrollup2::c#1 ← ++ (byte) scrollup2::c#2 -- vbuxx=_inc_vbuxx + //SEG70 [30] (byte) scrollup2::c#1 ← ++ (byte) scrollup2::c#2 -- vbuxx=_inc_vbuxx inx - //SEG69 [29] if((byte) scrollup2::c#1!=(byte/signed byte/word/signed word/dword/signed dword) $28) goto scrollup2::@2 -- vbuxx_neq_vbuc1_then_la1 + //SEG71 [31] if((byte) scrollup2::c#1!=(byte/signed byte/word/signed word/dword/signed dword) $28) goto scrollup2::@2 -- vbuxx_neq_vbuc1_then_la1 cpx #$28 bne b2 - //SEG70 scrollup2::@3 - //SEG71 [30] (byte) scrollup2::l#1 ← ++ (byte) scrollup2::l#4 -- vbuz1=_inc_vbuz1 + //SEG72 scrollup2::@3 + //SEG73 [32] (byte) scrollup2::l#1 ← ++ (byte) scrollup2::l#4 -- vbuz1=_inc_vbuz1 inc l - //SEG72 [31] if((byte) scrollup2::l#1!=(byte/signed byte/word/signed word/dword/signed dword) $18) goto scrollup2::@1 -- vbuz1_neq_vbuc1_then_la1 + //SEG74 [33] if((byte) scrollup2::l#1!=(byte/signed byte/word/signed word/dword/signed dword) $18) goto scrollup2::@1 -- vbuz1_neq_vbuc1_then_la1 lda #$18 cmp l bne b1 - //SEG73 scrollup2::@return - //SEG74 [32] return + //SEG75 scrollup2::@return + //SEG76 [34] return rts } -//SEG75 scrollup1 +//SEG77 scrollup1 scrollup1: { .label _0 = 4 .label _2 = 7 .label line = 2 - //SEG76 [34] phi from scrollup1 to scrollup1::@1 [phi:scrollup1->scrollup1::@1] - //SEG77 [34] phi (word) scrollup1::line#4 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:scrollup1->scrollup1::@1#0] -- vwuz1=vbuc1 + .label _6 = 7 + .label _7 = 4 + //SEG78 [36] phi from scrollup1 to scrollup1::@1 [phi:scrollup1->scrollup1::@1] + //SEG79 [36] phi (word) scrollup1::line#4 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:scrollup1->scrollup1::@1#0] -- vwuz1=vbuc1 lda #0 sta line sta line+1 - //SEG78 [34] phi from scrollup1::@3 to scrollup1::@1 [phi:scrollup1::@3->scrollup1::@1] - //SEG79 [34] phi (word) scrollup1::line#4 = (word) scrollup1::line#1 [phi:scrollup1::@3->scrollup1::@1#0] -- register_copy - //SEG80 scrollup1::@1 + //SEG80 [36] phi from scrollup1::@3 to scrollup1::@1 [phi:scrollup1::@3->scrollup1::@1] + //SEG81 [36] phi (word) scrollup1::line#4 = (word) scrollup1::line#1 [phi:scrollup1::@3->scrollup1::@1#0] -- register_copy + //SEG82 scrollup1::@1 b1: - //SEG81 [35] phi from scrollup1::@1 to scrollup1::@2 [phi:scrollup1::@1->scrollup1::@2] - //SEG82 [35] phi (byte) scrollup1::c#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:scrollup1::@1->scrollup1::@2#0] -- vbuxx=vbuc1 + //SEG83 [37] phi from scrollup1::@1 to scrollup1::@2 [phi:scrollup1::@1->scrollup1::@2] + //SEG84 [37] phi (byte) scrollup1::c#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:scrollup1::@1->scrollup1::@2#0] -- vbuxx=vbuc1 ldx #0 - //SEG83 [35] phi from scrollup1::@2 to scrollup1::@2 [phi:scrollup1::@2->scrollup1::@2] - //SEG84 [35] phi (byte) scrollup1::c#2 = (byte) scrollup1::c#1 [phi:scrollup1::@2->scrollup1::@2#0] -- register_copy - //SEG85 scrollup1::@2 + //SEG85 [37] phi from scrollup1::@2 to scrollup1::@2 [phi:scrollup1::@2->scrollup1::@2] + //SEG86 [37] phi (byte) scrollup1::c#2 = (byte) scrollup1::c#1 [phi:scrollup1::@2->scrollup1::@2#0] -- register_copy + //SEG87 scrollup1::@2 b2: - //SEG86 [36] (word~) scrollup1::$0 ← (word) scrollup1::line#4 + (byte) scrollup1::c#2 -- vwuz1=vwuz2_plus_vbuxx + //SEG88 [38] (word~) scrollup1::$0 ← (word) scrollup1::line#4 + (byte) scrollup1::c#2 -- vwuz1=vwuz2_plus_vbuxx txa clc adc line @@ -1571,7 +1642,7 @@ scrollup1: { lda #0 adc line+1 sta _0+1 - //SEG87 [37] (word~) scrollup1::$2 ← (word) scrollup1::line#4 + (byte) scrollup1::c#2 -- vwuz1=vwuz2_plus_vbuxx + //SEG89 [39] (word~) scrollup1::$2 ← (word) scrollup1::line#4 + (byte) scrollup1::c#2 -- vwuz1=vwuz2_plus_vbuxx txa clc adc line @@ -1579,32 +1650,33 @@ scrollup1: { lda #0 adc line+1 sta _2+1 - //SEG88 [38] *((const byte*) screen#0 + (word~) scrollup1::$0) ← *((const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) $28 + (word~) scrollup1::$2) -- pbuc1_derefidx_vwuz1=pbuc2_derefidx_vwuz2 - lda #screen - adc _0+1 - sta !a1++2 - lda #screen+$28 + sta _6+1 + //SEG91 [41] (byte*) scrollup1::$7 ← (const byte*) screen#0 + (word~) scrollup1::$0 -- pbuz1=pbuc1_plus_vwuz1 clc - adc _2 - sta !a2++1 - lda #>screen+$28 - adc _2+1 - sta !a2++2 - !a2: - lda screen+$28 - !a1: - sta screen - //SEG89 [39] (byte) scrollup1::c#1 ← ++ (byte) scrollup1::c#2 -- vbuxx=_inc_vbuxx + lda _7 + adc #screen + sta _7+1 + //SEG92 [42] *((byte*) scrollup1::$7) ← *((byte*) scrollup1::$6) -- _deref_pbuz1=_deref_pbuz2 + ldy #0 + lda (_6),y + sta (_7),y + //SEG93 [43] (byte) scrollup1::c#1 ← ++ (byte) scrollup1::c#2 -- vbuxx=_inc_vbuxx inx - //SEG90 [40] if((byte) scrollup1::c#1<(byte/signed byte/word/signed word/dword/signed dword) $28) goto scrollup1::@2 -- vbuxx_lt_vbuc1_then_la1 + //SEG94 [44] if((byte) scrollup1::c#1<(byte/signed byte/word/signed word/dword/signed dword) $28) goto scrollup1::@2 -- vbuxx_lt_vbuc1_then_la1 cpx #$28 bcc b2 - //SEG91 scrollup1::@3 - //SEG92 [41] (word) scrollup1::line#1 ← (word) scrollup1::line#4 + (byte/signed byte/word/signed word/dword/signed dword) $28 -- vwuz1=vwuz1_plus_vbuc1 + //SEG95 scrollup1::@3 + //SEG96 [45] (word) scrollup1::line#1 ← (word) scrollup1::line#4 + (byte/signed byte/word/signed word/dword/signed dword) $28 -- vwuz1=vwuz1_plus_vbuc1 lda #$28 clc adc line @@ -1612,7 +1684,7 @@ scrollup1: { bcc !+ inc line+1 !: - //SEG93 [42] if((word) scrollup1::line#1<(byte/signed byte/word/signed word/dword/signed dword) $28*(byte/signed byte/word/signed word/dword/signed dword) $18) goto scrollup1::@1 -- vwuz1_lt_vwuc1_then_la1 + //SEG97 [46] if((word) scrollup1::line#1<(byte/signed byte/word/signed word/dword/signed dword) $28*(byte/signed byte/word/signed word/dword/signed dword) $18) goto scrollup1::@1 -- vwuz1_lt_vwuc1_then_la1 lda line+1 cmp #>$28*$18 bcc b1 @@ -1621,8 +1693,8 @@ scrollup1: { cmp #<$28*$18 bcc b1 !: - //SEG94 scrollup1::@return - //SEG95 [43] return + //SEG98 scrollup1::@return + //SEG99 [47] return rts } diff --git a/src/test/ref/test-scroll-up.sym b/src/test/ref/test-scroll-up.sym index 5a0c85229..c370deca2 100644 --- a/src/test/ref/test-scroll-up.sym +++ b/src/test/ref/test-scroll-up.sym @@ -8,18 +8,20 @@ (byte*) screen (const byte*) screen#0 screen = ((byte*))(word/signed word/dword/signed dword) $400 (void()) scrollup1() -(word~) scrollup1::$0 $0 zp ZP_WORD:4 101.0 +(word~) scrollup1::$0 $0 zp ZP_WORD:4 67.33333333333333 (word~) scrollup1::$2 $2 zp ZP_WORD:7 202.0 +(byte*) scrollup1::$6 $6 zp ZP_WORD:7 101.0 +(byte*) scrollup1::$7 $7 zp ZP_WORD:4 202.0 (label) scrollup1::@1 (label) scrollup1::@2 (label) scrollup1::@3 (label) scrollup1::@return (byte) scrollup1::c (byte) scrollup1::c#1 reg byte x 151.5 -(byte) scrollup1::c#2 reg byte x 101.0 +(byte) scrollup1::c#2 reg byte x 67.33333333333333 (word) scrollup1::line (word) scrollup1::line#1 line zp ZP_WORD:2 16.5 -(word) scrollup1::line#4 line zp ZP_WORD:2 32.0 +(word) scrollup1::line#4 line zp ZP_WORD:2 24.888888888888886 (void()) scrollup2() (label) scrollup2::@1 (label) scrollup2::@2 @@ -40,25 +42,28 @@ (byte*) scrollup2::line2#2 line2 zp ZP_WORD:2 104.66666666666666 (byte*) scrollup2::line2#3 line2 zp ZP_WORD:2 22.0 (void()) scrollup3() +(byte*) scrollup3::$4 $4 zp ZP_WORD:7 101.0 +(byte*) scrollup3::$5 $5 zp ZP_WORD:9 202.0 (label) scrollup3::@1 (label) scrollup3::@2 (label) scrollup3::@3 (label) scrollup3::@return (byte) scrollup3::c (byte) scrollup3::c#1 reg byte x 151.5 -(byte) scrollup3::c#2 reg byte x 67.33333333333333 +(byte) scrollup3::c#2 reg byte x 40.4 (word) scrollup3::l2 -(word) scrollup3::l2#0 l2 zp ZP_WORD:2 4.714285714285714 +(word) scrollup3::l2#0 l2 zp ZP_WORD:2 3.666666666666667 (word) scrollup3::l2#1 l2#1 zp ZP_WORD:4 67.33333333333333 -(word) scrollup3::l2#2 l2#2 zp ZP_WORD:4 207.5 +(word) scrollup3::l2#2 l2#2 zp ZP_WORD:4 103.75 (word~) scrollup3::l2#4 l2#4 zp ZP_WORD:4 22.0 (word) scrollup3::line (word) scrollup3::line#1 line zp ZP_WORD:2 16.5 zp ZP_WORD:2 [ scrollup3::l2#0 scrollup3::line#1 scrollup2::line2#2 scrollup2::line2#3 scrollup2::line2#1 scrollup1::line#4 scrollup1::line#1 ] -zp ZP_WORD:4 [ scrollup3::l2#2 scrollup3::l2#4 scrollup3::l2#1 scrollup2::line1#2 scrollup2::line1#3 scrollup2::line1#1 scrollup1::$0 ] +zp ZP_WORD:4 [ scrollup3::l2#2 scrollup3::l2#4 scrollup3::l2#1 scrollup2::line1#2 scrollup2::line1#3 scrollup2::line1#1 scrollup1::$0 scrollup1::$7 ] reg byte x [ scrollup3::c#2 scrollup3::c#1 ] zp ZP_BYTE:6 [ scrollup2::l#4 scrollup2::l#1 ] reg byte x [ scrollup2::c#2 scrollup2::c#1 ] reg byte x [ scrollup1::c#2 scrollup1::c#1 ] -zp ZP_WORD:7 [ scrollup1::$2 ] +zp ZP_WORD:7 [ scrollup3::$4 scrollup1::$2 scrollup1::$6 ] +zp ZP_WORD:9 [ scrollup3::$5 ] diff --git a/src/test/ref/test-word-size-arrays.asm b/src/test/ref/test-word-size-arrays.asm index 7e8b83320..34f29fa59 100644 --- a/src/test/ref/test-word-size-arrays.asm +++ b/src/test/ref/test-word-size-arrays.asm @@ -7,6 +7,9 @@ main: { .label _2 = 6 .label _6 = 4 .label line = 2 + .label _8 = 6 + .label _9 = 4 + .label _10 = 4 lda #0 sta line sta line+1 @@ -27,24 +30,23 @@ main: { lda #0 adc line+1 sta _2+1 - lda #screen - adc _0+1 - sta !a1++2 - lda #screen+$28 + sta _8+1 clc - adc _2 - sta !a2++1 - lda #>screen+$28 - adc _2+1 - sta !a2++2 - !a2: - lda screen+$28 - !a1: - sta screen + lda _9 + adc #screen + sta _9+1 + ldy #0 + lda (_8),y + sta (_9),y inx cpx #$28 bcc b2 @@ -73,16 +75,16 @@ main: { lda #0 adc line+1 sta _6+1 - lda #screen - adc _6+1 - sta !++2 + lda _10 + adc #screen + sta _10+1 lda #' ' - !: - sta screen + ldy #0 + sta (_10),y inx cpx #$28 bcc b4 diff --git a/src/test/ref/test-word-size-arrays.cfg b/src/test/ref/test-word-size-arrays.cfg index 5582f3716..aa1cb2777 100644 --- a/src/test/ref/test-word-size-arrays.cfg +++ b/src/test/ref/test-word-size-arrays.cfg @@ -17,21 +17,24 @@ main::@2: scope:[main] from main::@1 main::@2 [6] (byte) main::c#2 ← phi( main::@1/(byte/signed byte/word/signed word/dword/signed dword) 0 main::@2/(byte) main::c#1 ) [7] (word~) main::$0 ← (word) main::line#6 + (byte) main::c#2 [8] (word~) main::$2 ← (word) main::line#6 + (byte) main::c#2 - [9] *((const byte*) main::screen#0 + (word~) main::$0) ← *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) $28 + (word~) main::$2) - [10] (byte) main::c#1 ← ++ (byte) main::c#2 - [11] if((byte) main::c#1<(byte/signed byte/word/signed word/dword/signed dword) $28) goto main::@2 + [9] (byte*) main::$8 ← (const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) $28 + (word~) main::$2 + [10] (byte*) main::$9 ← (const byte*) main::screen#0 + (word~) main::$0 + [11] *((byte*) main::$9) ← *((byte*) main::$8) + [12] (byte) main::c#1 ← ++ (byte) main::c#2 + [13] if((byte) main::c#1<(byte/signed byte/word/signed word/dword/signed dword) $28) goto main::@2 to:main::@3 main::@3: scope:[main] from main::@2 - [12] (word) main::line#2 ← (word) main::line#6 + (byte/signed byte/word/signed word/dword/signed dword) $28 - [13] if((word) main::line#2<(byte/signed byte/word/signed word/dword/signed dword) $28*(byte/signed byte/word/signed word/dword/signed dword) $18) goto main::@1 + [14] (word) main::line#2 ← (word) main::line#6 + (byte/signed byte/word/signed word/dword/signed dword) $28 + [15] if((word) main::line#2<(byte/signed byte/word/signed word/dword/signed dword) $28*(byte/signed byte/word/signed word/dword/signed dword) $18) goto main::@1 to:main::@4 main::@4: scope:[main] from main::@3 main::@4 - [14] (byte) main::c1#2 ← phi( main::@3/(byte/signed byte/word/signed word/dword/signed dword) 0 main::@4/(byte) main::c1#1 ) - [15] (word~) main::$6 ← (word) main::line#2 + (byte) main::c1#2 - [16] *((const byte*) main::screen#0 + (word~) main::$6) ← (byte) ' ' - [17] (byte) main::c1#1 ← ++ (byte) main::c1#2 - [18] if((byte) main::c1#1<(byte/signed byte/word/signed word/dword/signed dword) $28) goto main::@4 + [16] (byte) main::c1#2 ← phi( main::@3/(byte/signed byte/word/signed word/dword/signed dword) 0 main::@4/(byte) main::c1#1 ) + [17] (word~) main::$6 ← (word) main::line#2 + (byte) main::c1#2 + [18] (byte*) main::$10 ← (const byte*) main::screen#0 + (word~) main::$6 + [19] *((byte*) main::$10) ← (byte) ' ' + [20] (byte) main::c1#1 ← ++ (byte) main::c1#2 + [21] if((byte) main::c1#1<(byte/signed byte/word/signed word/dword/signed dword) $28) goto main::@4 to:main::@return main::@return: scope:[main] from main::@4 - [19] return + [22] return to:@return diff --git a/src/test/ref/test-word-size-arrays.log b/src/test/ref/test-word-size-arrays.log index 9e2f4ad23..5f62d2c62 100644 --- a/src/test/ref/test-word-size-arrays.log +++ b/src/test/ref/test-word-size-arrays.log @@ -120,6 +120,10 @@ Successful SSA optimization Pass2ConstantAdditionElimination Inferred type updated to word in [4] (word/signed dword/dword~) main::$2 ← (word~) main::$1 Eliminating unused constant (const word) main::line#0 Successful SSA optimization PassNEliminateUnusedVars +De-inlining pointer[w] to *(pointer+w) *((const byte*) main::screen#0 + (word~) main::$0) ← *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) $28 + (word~) main::$2) +De-inlining pointer[w] to *(pointer+w) *((const byte*) main::screen#0 + (word~) main::$0) ← *((byte*) main::$8) +De-inlining pointer[w] to *(pointer+w) *((const byte*) main::screen#0 + (word~) main::$6) ← (byte) ' ' +Successful SSA optimization Pass2DeInlineWordDerefIdx Culled Empty Block (label) main::@4 Successful SSA optimization Pass2CullEmptyBlocks Alias (word~) main::$2 = (word~) main::$1 @@ -143,9 +147,9 @@ CALL GRAPH Calls in [] to main:2 Created 3 initial phi equivalence classes -Coalesced [20] main::c1#3 ← main::c1#1 -Coalesced [21] main::line#8 ← main::line#2 -Coalesced [22] main::c#3 ← main::c#1 +Coalesced [23] main::c1#3 ← main::c1#1 +Coalesced [24] main::line#8 ← main::line#2 +Coalesced [25] main::c#3 ← main::c#1 Coalesced down to 3 phi equivalence classes Culled Empty Block (label) main::@9 Culled Empty Block (label) main::@7 @@ -176,40 +180,46 @@ main::@2: scope:[main] from main::@1 main::@2 [6] (byte) main::c#2 ← phi( main::@1/(byte/signed byte/word/signed word/dword/signed dword) 0 main::@2/(byte) main::c#1 ) [7] (word~) main::$0 ← (word) main::line#6 + (byte) main::c#2 [8] (word~) main::$2 ← (word) main::line#6 + (byte) main::c#2 - [9] *((const byte*) main::screen#0 + (word~) main::$0) ← *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) $28 + (word~) main::$2) - [10] (byte) main::c#1 ← ++ (byte) main::c#2 - [11] if((byte) main::c#1<(byte/signed byte/word/signed word/dword/signed dword) $28) goto main::@2 + [9] (byte*) main::$8 ← (const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) $28 + (word~) main::$2 + [10] (byte*) main::$9 ← (const byte*) main::screen#0 + (word~) main::$0 + [11] *((byte*) main::$9) ← *((byte*) main::$8) + [12] (byte) main::c#1 ← ++ (byte) main::c#2 + [13] if((byte) main::c#1<(byte/signed byte/word/signed word/dword/signed dword) $28) goto main::@2 to:main::@3 main::@3: scope:[main] from main::@2 - [12] (word) main::line#2 ← (word) main::line#6 + (byte/signed byte/word/signed word/dword/signed dword) $28 - [13] if((word) main::line#2<(byte/signed byte/word/signed word/dword/signed dword) $28*(byte/signed byte/word/signed word/dword/signed dword) $18) goto main::@1 + [14] (word) main::line#2 ← (word) main::line#6 + (byte/signed byte/word/signed word/dword/signed dword) $28 + [15] if((word) main::line#2<(byte/signed byte/word/signed word/dword/signed dword) $28*(byte/signed byte/word/signed word/dword/signed dword) $18) goto main::@1 to:main::@4 main::@4: scope:[main] from main::@3 main::@4 - [14] (byte) main::c1#2 ← phi( main::@3/(byte/signed byte/word/signed word/dword/signed dword) 0 main::@4/(byte) main::c1#1 ) - [15] (word~) main::$6 ← (word) main::line#2 + (byte) main::c1#2 - [16] *((const byte*) main::screen#0 + (word~) main::$6) ← (byte) ' ' - [17] (byte) main::c1#1 ← ++ (byte) main::c1#2 - [18] if((byte) main::c1#1<(byte/signed byte/word/signed word/dword/signed dword) $28) goto main::@4 + [16] (byte) main::c1#2 ← phi( main::@3/(byte/signed byte/word/signed word/dword/signed dword) 0 main::@4/(byte) main::c1#1 ) + [17] (word~) main::$6 ← (word) main::line#2 + (byte) main::c1#2 + [18] (byte*) main::$10 ← (const byte*) main::screen#0 + (word~) main::$6 + [19] *((byte*) main::$10) ← (byte) ' ' + [20] (byte) main::c1#1 ← ++ (byte) main::c1#2 + [21] if((byte) main::c1#1<(byte/signed byte/word/signed word/dword/signed dword) $28) goto main::@4 to:main::@return main::@return: scope:[main] from main::@4 - [19] return + [22] return to:@return VARIABLE REGISTER WEIGHTS (void()) main() -(word~) main::$0 101.0 +(word~) main::$0 67.33333333333333 +(byte*) main::$10 22.0 (word~) main::$2 202.0 (word~) main::$6 22.0 +(byte*) main::$8 101.0 +(byte*) main::$9 202.0 (byte) main::c (byte) main::c#1 151.5 -(byte) main::c#2 101.0 +(byte) main::c#2 67.33333333333333 (byte) main::c1 (byte) main::c1#1 16.5 -(byte) main::c1#2 11.0 +(byte) main::c1#2 8.25 (word) main::line -(word) main::line#2 6.285714285714286 -(word) main::line#6 32.0 +(word) main::line#2 5.5 +(word) main::line#6 24.888888888888886 (byte*) main::screen Initial phi equivalence classes @@ -218,20 +228,29 @@ Initial phi equivalence classes [ main::c1#2 main::c1#1 ] Added variable main::$0 to zero page equivalence class [ main::$0 ] Added variable main::$2 to zero page equivalence class [ main::$2 ] +Added variable main::$8 to zero page equivalence class [ main::$8 ] +Added variable main::$9 to zero page equivalence class [ main::$9 ] Added variable main::$6 to zero page equivalence class [ main::$6 ] +Added variable main::$10 to zero page equivalence class [ main::$10 ] Complete equivalence classes [ main::line#6 main::line#2 ] [ main::c#2 main::c#1 ] [ main::c1#2 main::c1#1 ] [ main::$0 ] [ main::$2 ] +[ main::$8 ] +[ main::$9 ] [ main::$6 ] +[ main::$10 ] Allocated zp ZP_WORD:2 [ main::line#6 main::line#2 ] Allocated zp ZP_BYTE:4 [ main::c#2 main::c#1 ] Allocated zp ZP_BYTE:5 [ main::c1#2 main::c1#1 ] Allocated zp ZP_WORD:6 [ main::$0 ] Allocated zp ZP_WORD:8 [ main::$2 ] -Allocated zp ZP_WORD:10 [ main::$6 ] +Allocated zp ZP_WORD:10 [ main::$8 ] +Allocated zp ZP_WORD:12 [ main::$9 ] +Allocated zp ZP_WORD:14 [ main::$6 ] +Allocated zp ZP_WORD:16 [ main::$10 ] INITIAL ASM //SEG0 File Comments @@ -261,10 +280,13 @@ main: { .label screen = $400 .label _0 = 6 .label _2 = 8 - .label _6 = $a + .label _6 = $e .label c = 4 .label line = 2 .label c1 = 5 + .label _8 = $a + .label _9 = $c + .label _10 = $10 //SEG11 [5] phi from main to main::@1 [phi:main->main::@1] b1_from_main: //SEG12 [5] phi (word) main::line#6 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vwuz1=vbuc1 @@ -307,35 +329,37 @@ main: { lda #0 adc line+1 sta _2+1 - //SEG23 [9] *((const byte*) main::screen#0 + (word~) main::$0) ← *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) $28 + (word~) main::$2) -- pbuc1_derefidx_vwuz1=pbuc2_derefidx_vwuz2 - lda #screen - adc _0+1 - sta !a1++2 - lda #screen+$28 + sta _8+1 + //SEG24 [10] (byte*) main::$9 ← (const byte*) main::screen#0 + (word~) main::$0 -- pbuz1=pbuc1_plus_vwuz2 + lda _0 clc - adc _2 - sta !a2++1 - lda #>screen+$28 - adc _2+1 - sta !a2++2 - !a2: - lda screen+$28 - !a1: - sta screen - //SEG24 [10] (byte) main::c#1 ← ++ (byte) main::c#2 -- vbuz1=_inc_vbuz1 + adc #screen + sta _9+1 + //SEG25 [11] *((byte*) main::$9) ← *((byte*) main::$8) -- _deref_pbuz1=_deref_pbuz2 + ldy #0 + lda (_8),y + ldy #0 + sta (_9),y + //SEG26 [12] (byte) main::c#1 ← ++ (byte) main::c#2 -- vbuz1=_inc_vbuz1 inc c - //SEG25 [11] if((byte) main::c#1<(byte/signed byte/word/signed word/dword/signed dword) $28) goto main::@2 -- vbuz1_lt_vbuc1_then_la1 + //SEG27 [13] if((byte) main::c#1<(byte/signed byte/word/signed word/dword/signed dword) $28) goto main::@2 -- vbuz1_lt_vbuc1_then_la1 lda c cmp #$28 bcc b2_from_b2 jmp b3 - //SEG26 main::@3 + //SEG28 main::@3 b3: - //SEG27 [12] (word) main::line#2 ← (word) main::line#6 + (byte/signed byte/word/signed word/dword/signed dword) $28 -- vwuz1=vwuz1_plus_vbuc1 + //SEG29 [14] (word) main::line#2 ← (word) main::line#6 + (byte/signed byte/word/signed word/dword/signed dword) $28 -- vwuz1=vwuz1_plus_vbuc1 lda #$28 clc adc line @@ -343,7 +367,7 @@ main: { bcc !+ inc line+1 !: - //SEG28 [13] if((word) main::line#2<(byte/signed byte/word/signed word/dword/signed dword) $28*(byte/signed byte/word/signed word/dword/signed dword) $18) goto main::@1 -- vwuz1_lt_vwuc1_then_la1 + //SEG30 [15] if((word) main::line#2<(byte/signed byte/word/signed word/dword/signed dword) $28*(byte/signed byte/word/signed word/dword/signed dword) $18) goto main::@1 -- vwuz1_lt_vwuc1_then_la1 lda line+1 cmp #>$28*$18 bcc b1_from_b3 @@ -352,20 +376,20 @@ main: { cmp #<$28*$18 bcc b1_from_b3 !: - //SEG29 [14] phi from main::@3 to main::@4 [phi:main::@3->main::@4] + //SEG31 [16] phi from main::@3 to main::@4 [phi:main::@3->main::@4] b4_from_b3: - //SEG30 [14] phi (byte) main::c1#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@3->main::@4#0] -- vbuz1=vbuc1 + //SEG32 [16] phi (byte) main::c1#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@3->main::@4#0] -- vbuz1=vbuc1 lda #0 sta c1 jmp b4 // Cleare the bottom line - //SEG31 [14] phi from main::@4 to main::@4 [phi:main::@4->main::@4] + //SEG33 [16] phi from main::@4 to main::@4 [phi:main::@4->main::@4] b4_from_b4: - //SEG32 [14] phi (byte) main::c1#2 = (byte) main::c1#1 [phi:main::@4->main::@4#0] -- register_copy + //SEG34 [16] phi (byte) main::c1#2 = (byte) main::c1#1 [phi:main::@4->main::@4#0] -- register_copy jmp b4 - //SEG33 main::@4 + //SEG35 main::@4 b4: - //SEG34 [15] (word~) main::$6 ← (word) main::line#2 + (byte) main::c1#2 -- vwuz1=vwuz2_plus_vbuz3 + //SEG36 [17] (word~) main::$6 ← (word) main::line#2 + (byte) main::c1#2 -- vwuz1=vwuz2_plus_vbuz3 lda c1 clc adc line @@ -373,27 +397,28 @@ main: { lda #0 adc line+1 sta _6+1 - //SEG35 [16] *((const byte*) main::screen#0 + (word~) main::$6) ← (byte) ' ' -- pbuc1_derefidx_vwuz1=vbuc2 - lda #screen - adc _6+1 - sta !++2 + adc #screen + sta _10+1 + //SEG38 [19] *((byte*) main::$10) ← (byte) ' ' -- _deref_pbuz1=vbuc1 lda #' ' - !: - sta screen - //SEG36 [17] (byte) main::c1#1 ← ++ (byte) main::c1#2 -- vbuz1=_inc_vbuz1 + ldy #0 + sta (_10),y + //SEG39 [20] (byte) main::c1#1 ← ++ (byte) main::c1#2 -- vbuz1=_inc_vbuz1 inc c1 - //SEG37 [18] if((byte) main::c1#1<(byte/signed byte/word/signed word/dword/signed dword) $28) goto main::@4 -- vbuz1_lt_vbuc1_then_la1 + //SEG40 [21] if((byte) main::c1#1<(byte/signed byte/word/signed word/dword/signed dword) $28) goto main::@4 -- vbuz1_lt_vbuc1_then_la1 lda c1 cmp #$28 bcc b4_from_b4 jmp breturn - //SEG38 main::@return + //SEG41 main::@return breturn: - //SEG39 [19] return + //SEG42 [22] return rts } @@ -401,35 +426,49 @@ REGISTER UPLIFT POTENTIAL REGISTERS Statement [7] (word~) main::$0 ← (word) main::line#6 + (byte) main::c#2 [ main::line#6 main::c#2 main::$0 ] ( main:2 [ main::line#6 main::c#2 main::$0 ] ) always clobbers reg byte a Removing always clobbered register reg byte a as potential for zp ZP_BYTE:4 [ main::c#2 main::c#1 ] Statement [8] (word~) main::$2 ← (word) main::line#6 + (byte) main::c#2 [ main::line#6 main::c#2 main::$0 main::$2 ] ( main:2 [ main::line#6 main::c#2 main::$0 main::$2 ] ) always clobbers reg byte a -Statement [9] *((const byte*) main::screen#0 + (word~) main::$0) ← *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) $28 + (word~) main::$2) [ main::line#6 main::c#2 ] ( main:2 [ main::line#6 main::c#2 ] ) always clobbers reg byte a -Statement [12] (word) main::line#2 ← (word) main::line#6 + (byte/signed byte/word/signed word/dword/signed dword) $28 [ main::line#2 ] ( main:2 [ main::line#2 ] ) always clobbers reg byte a -Statement [13] if((word) main::line#2<(byte/signed byte/word/signed word/dword/signed dword) $28*(byte/signed byte/word/signed word/dword/signed dword) $18) goto main::@1 [ main::line#2 ] ( main:2 [ main::line#2 ] ) always clobbers reg byte a -Statement [15] (word~) main::$6 ← (word) main::line#2 + (byte) main::c1#2 [ main::line#2 main::c1#2 main::$6 ] ( main:2 [ main::line#2 main::c1#2 main::$6 ] ) always clobbers reg byte a +Statement [9] (byte*) main::$8 ← (const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) $28 + (word~) main::$2 [ main::line#6 main::c#2 main::$0 main::$8 ] ( main:2 [ main::line#6 main::c#2 main::$0 main::$8 ] ) always clobbers reg byte a +Statement [10] (byte*) main::$9 ← (const byte*) main::screen#0 + (word~) main::$0 [ main::line#6 main::c#2 main::$8 main::$9 ] ( main:2 [ main::line#6 main::c#2 main::$8 main::$9 ] ) always clobbers reg byte a +Statement [11] *((byte*) main::$9) ← *((byte*) main::$8) [ main::line#6 main::c#2 ] ( main:2 [ main::line#6 main::c#2 ] ) always clobbers reg byte a reg byte y +Removing always clobbered register reg byte y as potential for zp ZP_BYTE:4 [ main::c#2 main::c#1 ] +Statement [14] (word) main::line#2 ← (word) main::line#6 + (byte/signed byte/word/signed word/dword/signed dword) $28 [ main::line#2 ] ( main:2 [ main::line#2 ] ) always clobbers reg byte a +Statement [15] if((word) main::line#2<(byte/signed byte/word/signed word/dword/signed dword) $28*(byte/signed byte/word/signed word/dword/signed dword) $18) goto main::@1 [ main::line#2 ] ( main:2 [ main::line#2 ] ) always clobbers reg byte a +Statement [17] (word~) main::$6 ← (word) main::line#2 + (byte) main::c1#2 [ main::line#2 main::c1#2 main::$6 ] ( main:2 [ main::line#2 main::c1#2 main::$6 ] ) always clobbers reg byte a Removing always clobbered register reg byte a as potential for zp ZP_BYTE:5 [ main::c1#2 main::c1#1 ] -Statement [16] *((const byte*) main::screen#0 + (word~) main::$6) ← (byte) ' ' [ main::line#2 main::c1#2 ] ( main:2 [ main::line#2 main::c1#2 ] ) always clobbers reg byte a +Statement [18] (byte*) main::$10 ← (const byte*) main::screen#0 + (word~) main::$6 [ main::line#2 main::c1#2 main::$10 ] ( main:2 [ main::line#2 main::c1#2 main::$10 ] ) always clobbers reg byte a +Statement [19] *((byte*) main::$10) ← (byte) ' ' [ main::line#2 main::c1#2 ] ( main:2 [ main::line#2 main::c1#2 ] ) always clobbers reg byte a reg byte y +Removing always clobbered register reg byte y as potential for zp ZP_BYTE:5 [ main::c1#2 main::c1#1 ] Statement [7] (word~) main::$0 ← (word) main::line#6 + (byte) main::c#2 [ main::line#6 main::c#2 main::$0 ] ( main:2 [ main::line#6 main::c#2 main::$0 ] ) always clobbers reg byte a Statement [8] (word~) main::$2 ← (word) main::line#6 + (byte) main::c#2 [ main::line#6 main::c#2 main::$0 main::$2 ] ( main:2 [ main::line#6 main::c#2 main::$0 main::$2 ] ) always clobbers reg byte a -Statement [9] *((const byte*) main::screen#0 + (word~) main::$0) ← *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) $28 + (word~) main::$2) [ main::line#6 main::c#2 ] ( main:2 [ main::line#6 main::c#2 ] ) always clobbers reg byte a -Statement [12] (word) main::line#2 ← (word) main::line#6 + (byte/signed byte/word/signed word/dword/signed dword) $28 [ main::line#2 ] ( main:2 [ main::line#2 ] ) always clobbers reg byte a -Statement [13] if((word) main::line#2<(byte/signed byte/word/signed word/dword/signed dword) $28*(byte/signed byte/word/signed word/dword/signed dword) $18) goto main::@1 [ main::line#2 ] ( main:2 [ main::line#2 ] ) always clobbers reg byte a -Statement [15] (word~) main::$6 ← (word) main::line#2 + (byte) main::c1#2 [ main::line#2 main::c1#2 main::$6 ] ( main:2 [ main::line#2 main::c1#2 main::$6 ] ) always clobbers reg byte a -Statement [16] *((const byte*) main::screen#0 + (word~) main::$6) ← (byte) ' ' [ main::line#2 main::c1#2 ] ( main:2 [ main::line#2 main::c1#2 ] ) always clobbers reg byte a +Statement [9] (byte*) main::$8 ← (const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) $28 + (word~) main::$2 [ main::line#6 main::c#2 main::$0 main::$8 ] ( main:2 [ main::line#6 main::c#2 main::$0 main::$8 ] ) always clobbers reg byte a +Statement [10] (byte*) main::$9 ← (const byte*) main::screen#0 + (word~) main::$0 [ main::line#6 main::c#2 main::$8 main::$9 ] ( main:2 [ main::line#6 main::c#2 main::$8 main::$9 ] ) always clobbers reg byte a +Statement [11] *((byte*) main::$9) ← *((byte*) main::$8) [ main::line#6 main::c#2 ] ( main:2 [ main::line#6 main::c#2 ] ) always clobbers reg byte a reg byte y +Statement [14] (word) main::line#2 ← (word) main::line#6 + (byte/signed byte/word/signed word/dword/signed dword) $28 [ main::line#2 ] ( main:2 [ main::line#2 ] ) always clobbers reg byte a +Statement [15] if((word) main::line#2<(byte/signed byte/word/signed word/dword/signed dword) $28*(byte/signed byte/word/signed word/dword/signed dword) $18) goto main::@1 [ main::line#2 ] ( main:2 [ main::line#2 ] ) always clobbers reg byte a +Statement [17] (word~) main::$6 ← (word) main::line#2 + (byte) main::c1#2 [ main::line#2 main::c1#2 main::$6 ] ( main:2 [ main::line#2 main::c1#2 main::$6 ] ) always clobbers reg byte a +Statement [18] (byte*) main::$10 ← (const byte*) main::screen#0 + (word~) main::$6 [ main::line#2 main::c1#2 main::$10 ] ( main:2 [ main::line#2 main::c1#2 main::$10 ] ) always clobbers reg byte a +Statement [19] *((byte*) main::$10) ← (byte) ' ' [ main::line#2 main::c1#2 ] ( main:2 [ main::line#2 main::c1#2 ] ) always clobbers reg byte a reg byte y Potential registers zp ZP_WORD:2 [ main::line#6 main::line#2 ] : zp ZP_WORD:2 , -Potential registers zp ZP_BYTE:4 [ main::c#2 main::c#1 ] : zp ZP_BYTE:4 , reg byte x , reg byte y , -Potential registers zp ZP_BYTE:5 [ main::c1#2 main::c1#1 ] : zp ZP_BYTE:5 , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:4 [ main::c#2 main::c#1 ] : zp ZP_BYTE:4 , reg byte x , +Potential registers zp ZP_BYTE:5 [ main::c1#2 main::c1#1 ] : zp ZP_BYTE:5 , reg byte x , Potential registers zp ZP_WORD:6 [ main::$0 ] : zp ZP_WORD:6 , Potential registers zp ZP_WORD:8 [ main::$2 ] : zp ZP_WORD:8 , -Potential registers zp ZP_WORD:10 [ main::$6 ] : zp ZP_WORD:10 , +Potential registers zp ZP_WORD:10 [ main::$8 ] : zp ZP_WORD:10 , +Potential registers zp ZP_WORD:12 [ main::$9 ] : zp ZP_WORD:12 , +Potential registers zp ZP_WORD:14 [ main::$6 ] : zp ZP_WORD:14 , +Potential registers zp ZP_WORD:16 [ main::$10 ] : zp ZP_WORD:16 , REGISTER UPLIFT SCOPES -Uplift Scope [main] 252.5: zp ZP_BYTE:4 [ main::c#2 main::c#1 ] 202: zp ZP_WORD:8 [ main::$2 ] 101: zp ZP_WORD:6 [ main::$0 ] 38.29: zp ZP_WORD:2 [ main::line#6 main::line#2 ] 27.5: zp ZP_BYTE:5 [ main::c1#2 main::c1#1 ] 22: zp ZP_WORD:10 [ main::$6 ] +Uplift Scope [main] 218.83: zp ZP_BYTE:4 [ main::c#2 main::c#1 ] 202: zp ZP_WORD:8 [ main::$2 ] 202: zp ZP_WORD:12 [ main::$9 ] 101: zp ZP_WORD:10 [ main::$8 ] 67.33: zp ZP_WORD:6 [ main::$0 ] 30.39: zp ZP_WORD:2 [ main::line#6 main::line#2 ] 24.75: zp ZP_BYTE:5 [ main::c1#2 main::c1#1 ] 22: zp ZP_WORD:14 [ main::$6 ] 22: zp ZP_WORD:16 [ main::$10 ] Uplift Scope [] -Uplifting [main] best 11293 combination reg byte x [ main::c#2 main::c#1 ] zp ZP_WORD:8 [ main::$2 ] zp ZP_WORD:6 [ main::$0 ] zp ZP_WORD:2 [ main::line#6 main::line#2 ] reg byte x [ main::c1#2 main::c1#1 ] zp ZP_WORD:10 [ main::$6 ] -Uplifting [] best 11293 combination -Coalescing zero page register [ zp ZP_WORD:6 [ main::$0 ] ] with [ zp ZP_WORD:10 [ main::$6 ] ] -Allocated (was zp ZP_WORD:6) zp ZP_WORD:4 [ main::$0 main::$6 ] -Allocated (was zp ZP_WORD:8) zp ZP_WORD:6 [ main::$2 ] +Uplifting [main] best 11663 combination reg byte x [ main::c#2 main::c#1 ] zp ZP_WORD:8 [ main::$2 ] zp ZP_WORD:12 [ main::$9 ] zp ZP_WORD:10 [ main::$8 ] zp ZP_WORD:6 [ main::$0 ] zp ZP_WORD:2 [ main::line#6 main::line#2 ] reg byte x [ main::c1#2 main::c1#1 ] zp ZP_WORD:14 [ main::$6 ] zp ZP_WORD:16 [ main::$10 ] +Uplifting [] best 11663 combination +Coalescing zero page register with common assignment [ zp ZP_WORD:6 [ main::$0 ] ] with [ zp ZP_WORD:12 [ main::$9 ] ] - score: 1 +Coalescing zero page register with common assignment [ zp ZP_WORD:8 [ main::$2 ] ] with [ zp ZP_WORD:10 [ main::$8 ] ] - score: 1 +Coalescing zero page register with common assignment [ zp ZP_WORD:14 [ main::$6 ] ] with [ zp ZP_WORD:16 [ main::$10 ] ] - score: 1 +Coalescing zero page register [ zp ZP_WORD:6 [ main::$0 main::$9 ] ] with [ zp ZP_WORD:14 [ main::$6 main::$10 ] ] +Allocated (was zp ZP_WORD:6) zp ZP_WORD:4 [ main::$0 main::$9 main::$6 main::$10 ] +Allocated (was zp ZP_WORD:8) zp ZP_WORD:6 [ main::$2 main::$8 ] ASSEMBLER BEFORE OPTIMIZATION //SEG0 File Comments @@ -461,6 +500,9 @@ main: { .label _2 = 6 .label _6 = 4 .label line = 2 + .label _8 = 6 + .label _9 = 4 + .label _10 = 4 //SEG11 [5] phi from main to main::@1 [phi:main->main::@1] b1_from_main: //SEG12 [5] phi (word) main::line#6 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vwuz1=vbuc1 @@ -502,34 +544,36 @@ main: { lda #0 adc line+1 sta _2+1 - //SEG23 [9] *((const byte*) main::screen#0 + (word~) main::$0) ← *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) $28 + (word~) main::$2) -- pbuc1_derefidx_vwuz1=pbuc2_derefidx_vwuz2 - lda #screen - adc _0+1 - sta !a1++2 - lda #screen+$28 + sta _8+1 + //SEG24 [10] (byte*) main::$9 ← (const byte*) main::screen#0 + (word~) main::$0 -- pbuz1=pbuc1_plus_vwuz1 clc - adc _2 - sta !a2++1 - lda #>screen+$28 - adc _2+1 - sta !a2++2 - !a2: - lda screen+$28 - !a1: - sta screen - //SEG24 [10] (byte) main::c#1 ← ++ (byte) main::c#2 -- vbuxx=_inc_vbuxx + lda _9 + adc #screen + sta _9+1 + //SEG25 [11] *((byte*) main::$9) ← *((byte*) main::$8) -- _deref_pbuz1=_deref_pbuz2 + ldy #0 + lda (_8),y + ldy #0 + sta (_9),y + //SEG26 [12] (byte) main::c#1 ← ++ (byte) main::c#2 -- vbuxx=_inc_vbuxx inx - //SEG25 [11] if((byte) main::c#1<(byte/signed byte/word/signed word/dword/signed dword) $28) goto main::@2 -- vbuxx_lt_vbuc1_then_la1 + //SEG27 [13] if((byte) main::c#1<(byte/signed byte/word/signed word/dword/signed dword) $28) goto main::@2 -- vbuxx_lt_vbuc1_then_la1 cpx #$28 bcc b2_from_b2 jmp b3 - //SEG26 main::@3 + //SEG28 main::@3 b3: - //SEG27 [12] (word) main::line#2 ← (word) main::line#6 + (byte/signed byte/word/signed word/dword/signed dword) $28 -- vwuz1=vwuz1_plus_vbuc1 + //SEG29 [14] (word) main::line#2 ← (word) main::line#6 + (byte/signed byte/word/signed word/dword/signed dword) $28 -- vwuz1=vwuz1_plus_vbuc1 lda #$28 clc adc line @@ -537,7 +581,7 @@ main: { bcc !+ inc line+1 !: - //SEG28 [13] if((word) main::line#2<(byte/signed byte/word/signed word/dword/signed dword) $28*(byte/signed byte/word/signed word/dword/signed dword) $18) goto main::@1 -- vwuz1_lt_vwuc1_then_la1 + //SEG30 [15] if((word) main::line#2<(byte/signed byte/word/signed word/dword/signed dword) $28*(byte/signed byte/word/signed word/dword/signed dword) $18) goto main::@1 -- vwuz1_lt_vwuc1_then_la1 lda line+1 cmp #>$28*$18 bcc b1_from_b3 @@ -546,19 +590,19 @@ main: { cmp #<$28*$18 bcc b1_from_b3 !: - //SEG29 [14] phi from main::@3 to main::@4 [phi:main::@3->main::@4] + //SEG31 [16] phi from main::@3 to main::@4 [phi:main::@3->main::@4] b4_from_b3: - //SEG30 [14] phi (byte) main::c1#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@3->main::@4#0] -- vbuxx=vbuc1 + //SEG32 [16] phi (byte) main::c1#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@3->main::@4#0] -- vbuxx=vbuc1 ldx #0 jmp b4 // Cleare the bottom line - //SEG31 [14] phi from main::@4 to main::@4 [phi:main::@4->main::@4] + //SEG33 [16] phi from main::@4 to main::@4 [phi:main::@4->main::@4] b4_from_b4: - //SEG32 [14] phi (byte) main::c1#2 = (byte) main::c1#1 [phi:main::@4->main::@4#0] -- register_copy + //SEG34 [16] phi (byte) main::c1#2 = (byte) main::c1#1 [phi:main::@4->main::@4#0] -- register_copy jmp b4 - //SEG33 main::@4 + //SEG35 main::@4 b4: - //SEG34 [15] (word~) main::$6 ← (word) main::line#2 + (byte) main::c1#2 -- vwuz1=vwuz2_plus_vbuxx + //SEG36 [17] (word~) main::$6 ← (word) main::line#2 + (byte) main::c1#2 -- vwuz1=vwuz2_plus_vbuxx txa clc adc line @@ -566,26 +610,27 @@ main: { lda #0 adc line+1 sta _6+1 - //SEG35 [16] *((const byte*) main::screen#0 + (word~) main::$6) ← (byte) ' ' -- pbuc1_derefidx_vwuz1=vbuc2 - lda #screen - adc _6+1 - sta !++2 + lda _10 + adc #screen + sta _10+1 + //SEG38 [19] *((byte*) main::$10) ← (byte) ' ' -- _deref_pbuz1=vbuc1 lda #' ' - !: - sta screen - //SEG36 [17] (byte) main::c1#1 ← ++ (byte) main::c1#2 -- vbuxx=_inc_vbuxx + ldy #0 + sta (_10),y + //SEG39 [20] (byte) main::c1#1 ← ++ (byte) main::c1#2 -- vbuxx=_inc_vbuxx inx - //SEG37 [18] if((byte) main::c1#1<(byte/signed byte/word/signed word/dword/signed dword) $28) goto main::@4 -- vbuxx_lt_vbuc1_then_la1 + //SEG40 [21] if((byte) main::c1#1<(byte/signed byte/word/signed word/dword/signed dword) $28) goto main::@4 -- vbuxx_lt_vbuc1_then_la1 cpx #$28 bcc b4_from_b4 jmp breturn - //SEG38 main::@return + //SEG41 main::@return breturn: - //SEG39 [19] return + //SEG42 [22] return rts } @@ -599,6 +644,7 @@ Removing instruction jmp b4 Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination Removing instruction lda #0 +Removing instruction ldy #0 Succesful ASM optimization Pass5UnnecesaryLoadElimination Replacing label b2_from_b2 with b2 Replacing label b1_from_b3 with b1 @@ -634,9 +680,12 @@ FINAL SYMBOL TABLE (label) @begin (label) @end (void()) main() -(word~) main::$0 $0 zp ZP_WORD:4 101.0 +(word~) main::$0 $0 zp ZP_WORD:4 67.33333333333333 +(byte*) main::$10 $10 zp ZP_WORD:4 22.0 (word~) main::$2 $2 zp ZP_WORD:6 202.0 (word~) main::$6 $6 zp ZP_WORD:4 22.0 +(byte*) main::$8 $8 zp ZP_WORD:6 101.0 +(byte*) main::$9 $9 zp ZP_WORD:4 202.0 (label) main::@1 (label) main::@2 (label) main::@3 @@ -644,25 +693,25 @@ FINAL SYMBOL TABLE (label) main::@return (byte) main::c (byte) main::c#1 reg byte x 151.5 -(byte) main::c#2 reg byte x 101.0 +(byte) main::c#2 reg byte x 67.33333333333333 (byte) main::c1 (byte) main::c1#1 reg byte x 16.5 -(byte) main::c1#2 reg byte x 11.0 +(byte) main::c1#2 reg byte x 8.25 (word) main::line -(word) main::line#2 line zp ZP_WORD:2 6.285714285714286 -(word) main::line#6 line zp ZP_WORD:2 32.0 +(word) main::line#2 line zp ZP_WORD:2 5.5 +(word) main::line#6 line zp ZP_WORD:2 24.888888888888886 (byte*) main::screen (const byte*) main::screen#0 screen = ((byte*))(word/signed word/dword/signed dword) $400 zp ZP_WORD:2 [ main::line#6 main::line#2 ] reg byte x [ main::c#2 main::c#1 ] reg byte x [ main::c1#2 main::c1#1 ] -zp ZP_WORD:4 [ main::$0 main::$6 ] -zp ZP_WORD:6 [ main::$2 ] +zp ZP_WORD:4 [ main::$0 main::$9 main::$6 main::$10 ] +zp ZP_WORD:6 [ main::$2 main::$8 ] FINAL ASSEMBLER -Score: 10211 +Score: 10381 //SEG0 File Comments //SEG1 Basic Upstart @@ -684,6 +733,9 @@ main: { .label _2 = 6 .label _6 = 4 .label line = 2 + .label _8 = 6 + .label _9 = 4 + .label _10 = 4 //SEG11 [5] phi from main to main::@1 [phi:main->main::@1] //SEG12 [5] phi (word) main::line#6 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vwuz1=vbuc1 lda #0 @@ -716,32 +768,33 @@ main: { lda #0 adc line+1 sta _2+1 - //SEG23 [9] *((const byte*) main::screen#0 + (word~) main::$0) ← *((const byte*) main::screen#0+(byte/signed byte/word/signed word/dword/signed dword) $28 + (word~) main::$2) -- pbuc1_derefidx_vwuz1=pbuc2_derefidx_vwuz2 - lda #screen - adc _0+1 - sta !a1++2 - lda #screen+$28 + sta _8+1 + //SEG24 [10] (byte*) main::$9 ← (const byte*) main::screen#0 + (word~) main::$0 -- pbuz1=pbuc1_plus_vwuz1 clc - adc _2 - sta !a2++1 - lda #>screen+$28 - adc _2+1 - sta !a2++2 - !a2: - lda screen+$28 - !a1: - sta screen - //SEG24 [10] (byte) main::c#1 ← ++ (byte) main::c#2 -- vbuxx=_inc_vbuxx + lda _9 + adc #screen + sta _9+1 + //SEG25 [11] *((byte*) main::$9) ← *((byte*) main::$8) -- _deref_pbuz1=_deref_pbuz2 + ldy #0 + lda (_8),y + sta (_9),y + //SEG26 [12] (byte) main::c#1 ← ++ (byte) main::c#2 -- vbuxx=_inc_vbuxx inx - //SEG25 [11] if((byte) main::c#1<(byte/signed byte/word/signed word/dword/signed dword) $28) goto main::@2 -- vbuxx_lt_vbuc1_then_la1 + //SEG27 [13] if((byte) main::c#1<(byte/signed byte/word/signed word/dword/signed dword) $28) goto main::@2 -- vbuxx_lt_vbuc1_then_la1 cpx #$28 bcc b2 - //SEG26 main::@3 - //SEG27 [12] (word) main::line#2 ← (word) main::line#6 + (byte/signed byte/word/signed word/dword/signed dword) $28 -- vwuz1=vwuz1_plus_vbuc1 + //SEG28 main::@3 + //SEG29 [14] (word) main::line#2 ← (word) main::line#6 + (byte/signed byte/word/signed word/dword/signed dword) $28 -- vwuz1=vwuz1_plus_vbuc1 lda #$28 clc adc line @@ -749,7 +802,7 @@ main: { bcc !+ inc line+1 !: - //SEG28 [13] if((word) main::line#2<(byte/signed byte/word/signed word/dword/signed dword) $28*(byte/signed byte/word/signed word/dword/signed dword) $18) goto main::@1 -- vwuz1_lt_vwuc1_then_la1 + //SEG30 [15] if((word) main::line#2<(byte/signed byte/word/signed word/dword/signed dword) $28*(byte/signed byte/word/signed word/dword/signed dword) $18) goto main::@1 -- vwuz1_lt_vwuc1_then_la1 lda line+1 cmp #>$28*$18 bcc b1 @@ -758,15 +811,15 @@ main: { cmp #<$28*$18 bcc b1 !: - //SEG29 [14] phi from main::@3 to main::@4 [phi:main::@3->main::@4] - //SEG30 [14] phi (byte) main::c1#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@3->main::@4#0] -- vbuxx=vbuc1 + //SEG31 [16] phi from main::@3 to main::@4 [phi:main::@3->main::@4] + //SEG32 [16] phi (byte) main::c1#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@3->main::@4#0] -- vbuxx=vbuc1 ldx #0 // Cleare the bottom line - //SEG31 [14] phi from main::@4 to main::@4 [phi:main::@4->main::@4] - //SEG32 [14] phi (byte) main::c1#2 = (byte) main::c1#1 [phi:main::@4->main::@4#0] -- register_copy - //SEG33 main::@4 + //SEG33 [16] phi from main::@4 to main::@4 [phi:main::@4->main::@4] + //SEG34 [16] phi (byte) main::c1#2 = (byte) main::c1#1 [phi:main::@4->main::@4#0] -- register_copy + //SEG35 main::@4 b4: - //SEG34 [15] (word~) main::$6 ← (word) main::line#2 + (byte) main::c1#2 -- vwuz1=vwuz2_plus_vbuxx + //SEG36 [17] (word~) main::$6 ← (word) main::line#2 + (byte) main::c1#2 -- vwuz1=vwuz2_plus_vbuxx txa clc adc line @@ -774,24 +827,25 @@ main: { lda #0 adc line+1 sta _6+1 - //SEG35 [16] *((const byte*) main::screen#0 + (word~) main::$6) ← (byte) ' ' -- pbuc1_derefidx_vwuz1=vbuc2 - lda #screen - adc _6+1 - sta !++2 + lda _10 + adc #screen + sta _10+1 + //SEG38 [19] *((byte*) main::$10) ← (byte) ' ' -- _deref_pbuz1=vbuc1 lda #' ' - !: - sta screen - //SEG36 [17] (byte) main::c1#1 ← ++ (byte) main::c1#2 -- vbuxx=_inc_vbuxx + ldy #0 + sta (_10),y + //SEG39 [20] (byte) main::c1#1 ← ++ (byte) main::c1#2 -- vbuxx=_inc_vbuxx inx - //SEG37 [18] if((byte) main::c1#1<(byte/signed byte/word/signed word/dword/signed dword) $28) goto main::@4 -- vbuxx_lt_vbuc1_then_la1 + //SEG40 [21] if((byte) main::c1#1<(byte/signed byte/word/signed word/dword/signed dword) $28) goto main::@4 -- vbuxx_lt_vbuc1_then_la1 cpx #$28 bcc b4 - //SEG38 main::@return - //SEG39 [19] return + //SEG41 main::@return + //SEG42 [22] return rts } diff --git a/src/test/ref/test-word-size-arrays.sym b/src/test/ref/test-word-size-arrays.sym index 5fe9e9bee..128884e33 100644 --- a/src/test/ref/test-word-size-arrays.sym +++ b/src/test/ref/test-word-size-arrays.sym @@ -2,9 +2,12 @@ (label) @begin (label) @end (void()) main() -(word~) main::$0 $0 zp ZP_WORD:4 101.0 +(word~) main::$0 $0 zp ZP_WORD:4 67.33333333333333 +(byte*) main::$10 $10 zp ZP_WORD:4 22.0 (word~) main::$2 $2 zp ZP_WORD:6 202.0 (word~) main::$6 $6 zp ZP_WORD:4 22.0 +(byte*) main::$8 $8 zp ZP_WORD:6 101.0 +(byte*) main::$9 $9 zp ZP_WORD:4 202.0 (label) main::@1 (label) main::@2 (label) main::@3 @@ -12,18 +15,18 @@ (label) main::@return (byte) main::c (byte) main::c#1 reg byte x 151.5 -(byte) main::c#2 reg byte x 101.0 +(byte) main::c#2 reg byte x 67.33333333333333 (byte) main::c1 (byte) main::c1#1 reg byte x 16.5 -(byte) main::c1#2 reg byte x 11.0 +(byte) main::c1#2 reg byte x 8.25 (word) main::line -(word) main::line#2 line zp ZP_WORD:2 6.285714285714286 -(word) main::line#6 line zp ZP_WORD:2 32.0 +(word) main::line#2 line zp ZP_WORD:2 5.5 +(word) main::line#6 line zp ZP_WORD:2 24.888888888888886 (byte*) main::screen (const byte*) main::screen#0 screen = ((byte*))(word/signed word/dword/signed dword) $400 zp ZP_WORD:2 [ main::line#6 main::line#2 ] reg byte x [ main::c#2 main::c#1 ] reg byte x [ main::c1#2 main::c1#1 ] -zp ZP_WORD:4 [ main::$0 main::$6 ] -zp ZP_WORD:6 [ main::$2 ] +zp ZP_WORD:4 [ main::$0 main::$9 main::$6 main::$10 ] +zp ZP_WORD:6 [ main::$2 main::$8 ] diff --git a/src/test/ref/word-array-2.asm b/src/test/ref/word-array-2.asm new file mode 100644 index 000000000..deb208085 --- /dev/null +++ b/src/test/ref/word-array-2.asm @@ -0,0 +1,64 @@ +// Tests a word-array with 128+ elements +.pc = $801 "Basic" +:BasicUpstart(main) +.pc = $80d "Program" + .const SIZEOF_WORD = 2 +main: { + .label SCREEN = $400 + .label _1 = 2 + .label _2 = 4 + .label _3 = 4 + .label _4 = 4 + .label _6 = 2 + .label _9 = 2 + ldx #0 + b1: + txa + sta _1 + lda #0 + sta _1+1 + txa + sta _2 + lda #0 + sta _2+1 + ldy #8 + cpy #0 + beq !e+ + !: + asl _3 + rol _3+1 + dey + bne !- + !e: + txa + clc + adc _4 + sta _4 + bcc !+ + inc _4+1 + !: + asl _6 + rol _6+1 + clc + lda _9 + adc #words + sta _9+1 + ldy #0 + lda _4 + sta (_9),y + iny + lda _4+1 + sta (_9),y + inx + cpx #0 + bne b1 + lda words+$ff*SIZEOF_WORD + sta SCREEN + lda words+$ff*SIZEOF_WORD+1 + sta SCREEN+1 + rts +} + words: .fill 2*$100, 0 diff --git a/src/test/ref/word-array-2.cfg b/src/test/ref/word-array-2.cfg new file mode 100644 index 000000000..3a481f167 --- /dev/null +++ b/src/test/ref/word-array-2.cfg @@ -0,0 +1,30 @@ +@begin: scope:[] from + [0] phi() + to:@1 +@1: scope:[] from @begin + [1] phi() + [2] call main + to:@end +@end: scope:[] from @1 + [3] phi() +main: scope:[main] from @1 + [4] phi() + to:main::@1 +main::@1: scope:[main] from main main::@1 + [5] (byte) main::i#2 ← phi( main/(byte/signed byte/word/signed word/dword/signed dword) 0 main::@1/(byte) main::i#1 ) + [6] (word~) main::$1 ← ((word)) (byte) main::i#2 + [7] (word~) main::$2 ← ((word)) (byte) main::i#2 + [8] (word~) main::$3 ← (word~) main::$2 << (byte/signed byte/word/signed word/dword/signed dword) 8 + [9] (word~) main::$4 ← (word~) main::$3 + (byte) main::i#2 + [10] (word) main::$6 ← (word~) main::$1 << (byte/signed byte/word/signed word/dword/signed dword) 1 + [11] (word*) main::$9 ← (const word[$100]) words#0 + (word) main::$6 + [12] *((word*) main::$9) ← (word~) main::$4 + [13] (byte) main::i#1 ← ++ (byte) main::i#2 + [14] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto main::@1 + to:main::@2 +main::@2: scope:[main] from main::@1 + [15] *((const word*) main::SCREEN#0) ← *((const word[$100]) words#0+((word))(byte/word/signed word/dword/signed dword) $ff*(const byte) SIZEOF_WORD) + to:main::@return +main::@return: scope:[main] from main::@2 + [16] return + to:@return diff --git a/src/test/ref/word-array-2.log b/src/test/ref/word-array-2.log new file mode 100644 index 000000000..a7f1c2c94 --- /dev/null +++ b/src/test/ref/word-array-2.log @@ -0,0 +1,615 @@ +Fixing pointer array-indexing *((word[$100]) words + (word~) main::$1) +Fixing pointer array-indexing *((word[$100]) words + (byte/word/signed word/dword/signed dword~) main::$0) +Fixing pointer array-indexing *((word*) main::SCREEN + (byte/signed byte/word/signed word/dword/signed dword) 0) + +CONTROL FLOW GRAPH SSA +@begin: scope:[] from + (word[$100]) words#0 ← { fill( $100, 0) } + to:@1 +main: scope:[main] from @1 + (byte) main::i#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 + to:main::@1 +main::@1: scope:[main] from main main::@1 + (byte) main::i#2 ← phi( main/(byte) main::i#0 main::@1/(byte) main::i#1 ) + (word~) main::$1 ← ((word)) (byte) main::i#2 + (word~) main::$2 ← ((word)) (byte) main::i#2 + (word/signed dword/dword~) main::$3 ← (word~) main::$2 * (word/signed word/dword/signed dword) $100 + (word/signed dword/dword~) main::$4 ← (word/signed dword/dword~) main::$3 + (byte) main::i#2 + (word) main::$6 ← (word~) main::$1 * (const byte) SIZEOF_WORD + *((word[$100]) words#0 + (word) main::$6) ← (word/signed dword/dword~) main::$4 + (byte) main::i#1 ← (byte) main::i#2 + rangenext(0,$ff) + (bool~) main::$5 ← (byte) main::i#1 != rangelast(0,$ff) + if((bool~) main::$5) goto main::@1 + to:main::@2 +main::@2: scope:[main] from main::@1 + (word*) main::SCREEN#0 ← ((word*)) (word/signed word/dword/signed dword) $400 + (byte/word/signed word/dword/signed dword~) main::$0 ← ((word)) (byte/word/signed word/dword/signed dword) $ff + (byte/word/signed word/dword/signed dword) main::$7 ← (byte/word/signed word/dword/signed dword~) main::$0 * (const byte) SIZEOF_WORD + (byte/signed byte/word/signed word/dword/signed dword) main::$8 ← (byte/signed byte/word/signed word/dword/signed dword) 0 * (const byte) SIZEOF_WORD + *((word*) main::SCREEN#0 + (byte/signed byte/word/signed word/dword/signed dword) main::$8) ← *((word[$100]) words#0 + (byte/word/signed word/dword/signed dword) main::$7) + to:main::@return +main::@return: scope:[main] from main::@2 + return + to:@return +@1: scope:[] from @begin + call main + to:@2 +@2: scope:[] from @1 + to:@end +@end: scope:[] from @2 + +SYMBOL TABLE SSA +(label) @1 +(label) @2 +(label) @begin +(label) @end +(const byte) SIZEOF_WORD = (byte/signed byte/word/signed word/dword/signed dword) 2 +(void()) main() +(byte/word/signed word/dword/signed dword~) main::$0 +(word~) main::$1 +(word~) main::$2 +(word/signed dword/dword~) main::$3 +(word/signed dword/dword~) main::$4 +(bool~) main::$5 +(word) main::$6 +(byte/word/signed word/dword/signed dword) main::$7 +(byte/signed byte/word/signed word/dword/signed dword) main::$8 +(label) main::@1 +(label) main::@2 +(label) main::@return +(word*) main::SCREEN +(word*) main::SCREEN#0 +(byte) main::i +(byte) main::i#0 +(byte) main::i#1 +(byte) main::i#2 +(word[$100]) words +(word[$100]) words#0 + +Culled Empty Block (label) @2 +Successful SSA optimization Pass2CullEmptyBlocks +Simple Condition (bool~) main::$5 [11] if((byte) main::i#1!=rangelast(0,$ff)) goto main::@1 +Successful SSA optimization Pass2ConditionalJumpSimplification +Constant (const word[$100]) words#0 = { fill( $100, 0) } +Constant (const byte) main::i#0 = 0 +Constant (const word*) main::SCREEN#0 = ((word*))$400 +Constant (const byte/word/signed word/dword/signed dword) main::$0 = ((word))$ff +Constant (const byte/signed byte/word/signed word/dword/signed dword) main::$8 = 0*SIZEOF_WORD +Successful SSA optimization Pass2ConstantIdentification +Constant (const word/signed word/dword/signed dword) main::$7 = main::$0*SIZEOF_WORD +Successful SSA optimization Pass2ConstantIdentification +Consolidated array index constant in *(words#0+main::$7) +Consolidated array index constant in *(main::SCREEN#0+main::$8) +Successful SSA optimization Pass2ConstantAdditionElimination +Resolved ranged next value main::i#1 ← ++ main::i#2 to ++ +Resolved ranged comparison value if(main::i#1!=rangelast(0,$ff)) goto main::@1 to (byte/signed byte/word/signed word/dword/signed dword) 0 +Rewriting multiplication to use shift (word/signed dword/dword~) main::$3 ← (word~) main::$2 * (word/signed word/dword/signed dword) $100 +Rewriting multiplication to use shift (word) main::$6 ← (word~) main::$1 * (const byte) SIZEOF_WORD +Successful SSA optimization Pass2MultiplyToShiftRewriting +De-inlining pointer[w] to *(pointer+w) *((const word[$100]) words#0 + (word) main::$6) ← (word/signed dword/dword~) main::$4 +Successful SSA optimization Pass2DeInlineWordDerefIdx +Inferred type updated to word in [3] (word/signed dword/dword~) main::$3 ← (word~) main::$2 << (byte/signed byte/word/signed word/dword/signed dword) 8 +Inferred type updated to word in [4] (word/signed dword/dword~) main::$4 ← (word~) main::$3 + (byte) main::i#2 +Inlining constant with var siblings (const byte) main::i#0 +Constant inlined main::i#0 = (byte/signed byte/word/signed word/dword/signed dword) 0 +Constant inlined main::$7 = ((word))(byte/word/signed word/dword/signed dword) $ff*(const byte) SIZEOF_WORD +Constant inlined main::$0 = ((word))(byte/word/signed word/dword/signed dword) $ff +Constant inlined main::$8 = (byte/signed byte/word/signed word/dword/signed dword) 0*(const byte) SIZEOF_WORD +Successful SSA optimization Pass2ConstantInlining +Simplifying constant multiply by zero 0*SIZEOF_WORD +Simplifying constant plus zero main::SCREEN#0+0 +Added new block during phi lifting main::@3(between main::@1 and main::@1) +Adding NOP phi() at start of @begin +Adding NOP phi() at start of @1 +Adding NOP phi() at start of @end +Adding NOP phi() at start of main +CALL GRAPH +Calls in [] to main:2 + +Created 1 initial phi equivalence classes +Coalesced [17] main::i#3 ← main::i#1 +Coalesced down to 1 phi equivalence classes +Culled Empty Block (label) main::@3 +Adding NOP phi() at start of @begin +Adding NOP phi() at start of @1 +Adding NOP phi() at start of @end +Adding NOP phi() at start of main + +FINAL CONTROL FLOW GRAPH +@begin: scope:[] from + [0] phi() + to:@1 +@1: scope:[] from @begin + [1] phi() + [2] call main + to:@end +@end: scope:[] from @1 + [3] phi() +main: scope:[main] from @1 + [4] phi() + to:main::@1 +main::@1: scope:[main] from main main::@1 + [5] (byte) main::i#2 ← phi( main/(byte/signed byte/word/signed word/dword/signed dword) 0 main::@1/(byte) main::i#1 ) + [6] (word~) main::$1 ← ((word)) (byte) main::i#2 + [7] (word~) main::$2 ← ((word)) (byte) main::i#2 + [8] (word~) main::$3 ← (word~) main::$2 << (byte/signed byte/word/signed word/dword/signed dword) 8 + [9] (word~) main::$4 ← (word~) main::$3 + (byte) main::i#2 + [10] (word) main::$6 ← (word~) main::$1 << (byte/signed byte/word/signed word/dword/signed dword) 1 + [11] (word*) main::$9 ← (const word[$100]) words#0 + (word) main::$6 + [12] *((word*) main::$9) ← (word~) main::$4 + [13] (byte) main::i#1 ← ++ (byte) main::i#2 + [14] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto main::@1 + to:main::@2 +main::@2: scope:[main] from main::@1 + [15] *((const word*) main::SCREEN#0) ← *((const word[$100]) words#0+((word))(byte/word/signed word/dword/signed dword) $ff*(const byte) SIZEOF_WORD) + to:main::@return +main::@return: scope:[main] from main::@2 + [16] return + to:@return + + +VARIABLE REGISTER WEIGHTS +(void()) main() +(word~) main::$1 5.5 +(word~) main::$2 22.0 +(word~) main::$3 22.0 +(word~) main::$4 7.333333333333333 +(word) main::$6 22.0 +(word*) main::$9 22.0 +(word*) main::SCREEN +(byte) main::i +(byte) main::i#1 16.5 +(byte) main::i#2 6.875 +(word[$100]) words + +Initial phi equivalence classes +[ main::i#2 main::i#1 ] +Added variable main::$1 to zero page equivalence class [ main::$1 ] +Added variable main::$2 to zero page equivalence class [ main::$2 ] +Added variable main::$3 to zero page equivalence class [ main::$3 ] +Added variable main::$4 to zero page equivalence class [ main::$4 ] +Added variable main::$6 to zero page equivalence class [ main::$6 ] +Added variable main::$9 to zero page equivalence class [ main::$9 ] +Complete equivalence classes +[ main::i#2 main::i#1 ] +[ main::$1 ] +[ main::$2 ] +[ main::$3 ] +[ main::$4 ] +[ main::$6 ] +[ main::$9 ] +Allocated zp ZP_BYTE:2 [ main::i#2 main::i#1 ] +Allocated zp ZP_WORD:3 [ main::$1 ] +Allocated zp ZP_WORD:5 [ main::$2 ] +Allocated zp ZP_WORD:7 [ main::$3 ] +Allocated zp ZP_WORD:9 [ main::$4 ] +Allocated zp ZP_WORD:11 [ main::$6 ] +Allocated zp ZP_WORD:13 [ main::$9 ] + +INITIAL ASM +//SEG0 File Comments +// Tests a word-array with 128+ elements +//SEG1 Basic Upstart +.pc = $801 "Basic" +:BasicUpstart(bbegin) +.pc = $80d "Program" +//SEG2 Global Constants & labels + .const SIZEOF_WORD = 2 +//SEG3 @begin +bbegin: +//SEG4 [1] phi from @begin to @1 [phi:@begin->@1] +b1_from_bbegin: + jmp b1 +//SEG5 @1 +b1: +//SEG6 [2] call main +//SEG7 [4] phi from @1 to main [phi:@1->main] +main_from_b1: + jsr main +//SEG8 [3] phi from @1 to @end [phi:@1->@end] +bend_from_b1: + jmp bend +//SEG9 @end +bend: +//SEG10 main +main: { + .label SCREEN = $400 + .label _1 = 3 + .label _2 = 5 + .label _3 = 7 + .label _4 = 9 + .label _6 = $b + .label i = 2 + .label _9 = $d + //SEG11 [5] phi from main to main::@1 [phi:main->main::@1] + b1_from_main: + //SEG12 [5] phi (byte) main::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1 + lda #0 + sta i + jmp b1 + //SEG13 [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1] + b1_from_b1: + //SEG14 [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@1->main::@1#0] -- register_copy + jmp b1 + //SEG15 main::@1 + b1: + //SEG16 [6] (word~) main::$1 ← ((word)) (byte) main::i#2 -- vwuz1=_word_vbuz2 + lda i + sta _1 + lda #0 + sta _1+1 + //SEG17 [7] (word~) main::$2 ← ((word)) (byte) main::i#2 -- vwuz1=_word_vbuz2 + lda i + sta _2 + lda #0 + sta _2+1 + //SEG18 [8] (word~) main::$3 ← (word~) main::$2 << (byte/signed byte/word/signed word/dword/signed dword) 8 -- vwuz1=vwuz2_rol_vbuc1 + ldy #8 + lda _2 + sta _3 + lda _2+1 + sta _3+1 + cpy #0 + beq !e+ + !: + asl _3 + rol _3+1 + dey + bne !- + !e: + //SEG19 [9] (word~) main::$4 ← (word~) main::$3 + (byte) main::i#2 -- vwuz1=vwuz2_plus_vbuz3 + lda i + clc + adc _3 + sta _4 + lda #0 + adc _3+1 + sta _4+1 + //SEG20 [10] (word) main::$6 ← (word~) main::$1 << (byte/signed byte/word/signed word/dword/signed dword) 1 -- vwuz1=vwuz2_rol_1 + lda _1 + asl + sta _6 + lda _1+1 + rol + sta _6+1 + //SEG21 [11] (word*) main::$9 ← (const word[$100]) words#0 + (word) main::$6 -- pwuz1=pwuc1_plus_vwuz2 + lda _6 + clc + adc #words + sta _9+1 + //SEG22 [12] *((word*) main::$9) ← (word~) main::$4 -- _deref_pwuz1=vwuz2 + ldy #0 + lda _4 + sta (_9),y + iny + lda _4+1 + sta (_9),y + //SEG23 [13] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuz1=_inc_vbuz1 + inc i + //SEG24 [14] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto main::@1 -- vbuz1_neq_0_then_la1 + lda i + cmp #0 + bne b1_from_b1 + jmp b2 + //SEG25 main::@2 + b2: + //SEG26 [15] *((const word*) main::SCREEN#0) ← *((const word[$100]) words#0+((word))(byte/word/signed word/dword/signed dword) $ff*(const byte) SIZEOF_WORD) -- _deref_pwuc1=_deref_pwuc2 + lda words+$ff*SIZEOF_WORD + sta SCREEN + lda words+$ff*SIZEOF_WORD+1 + sta SCREEN+1 + jmp breturn + //SEG27 main::@return + breturn: + //SEG28 [16] return + rts +} + words: .fill 2*$100, 0 + +REGISTER UPLIFT POTENTIAL REGISTERS +Statement [6] (word~) main::$1 ← ((word)) (byte) main::i#2 [ main::i#2 main::$1 ] ( main:2 [ main::i#2 main::$1 ] ) always clobbers reg byte a +Removing always clobbered register reg byte a as potential for zp ZP_BYTE:2 [ main::i#2 main::i#1 ] +Statement [7] (word~) main::$2 ← ((word)) (byte) main::i#2 [ main::i#2 main::$1 main::$2 ] ( main:2 [ main::i#2 main::$1 main::$2 ] ) always clobbers reg byte a +Statement [8] (word~) main::$3 ← (word~) main::$2 << (byte/signed byte/word/signed word/dword/signed dword) 8 [ main::i#2 main::$1 main::$3 ] ( main:2 [ main::i#2 main::$1 main::$3 ] ) always clobbers reg byte a reg byte y +Removing always clobbered register reg byte y as potential for zp ZP_BYTE:2 [ main::i#2 main::i#1 ] +Statement [9] (word~) main::$4 ← (word~) main::$3 + (byte) main::i#2 [ main::i#2 main::$1 main::$4 ] ( main:2 [ main::i#2 main::$1 main::$4 ] ) always clobbers reg byte a +Statement [10] (word) main::$6 ← (word~) main::$1 << (byte/signed byte/word/signed word/dword/signed dword) 1 [ main::i#2 main::$4 main::$6 ] ( main:2 [ main::i#2 main::$4 main::$6 ] ) always clobbers reg byte a +Statement [11] (word*) main::$9 ← (const word[$100]) words#0 + (word) main::$6 [ main::i#2 main::$4 main::$9 ] ( main:2 [ main::i#2 main::$4 main::$9 ] ) always clobbers reg byte a +Statement [12] *((word*) main::$9) ← (word~) main::$4 [ main::i#2 ] ( main:2 [ main::i#2 ] ) always clobbers reg byte a reg byte y +Statement [15] *((const word*) main::SCREEN#0) ← *((const word[$100]) words#0+((word))(byte/word/signed word/dword/signed dword) $ff*(const byte) SIZEOF_WORD) [ ] ( main:2 [ ] ) always clobbers reg byte a +Statement [6] (word~) main::$1 ← ((word)) (byte) main::i#2 [ main::i#2 main::$1 ] ( main:2 [ main::i#2 main::$1 ] ) always clobbers reg byte a +Statement [7] (word~) main::$2 ← ((word)) (byte) main::i#2 [ main::i#2 main::$1 main::$2 ] ( main:2 [ main::i#2 main::$1 main::$2 ] ) always clobbers reg byte a +Statement [8] (word~) main::$3 ← (word~) main::$2 << (byte/signed byte/word/signed word/dword/signed dword) 8 [ main::i#2 main::$1 main::$3 ] ( main:2 [ main::i#2 main::$1 main::$3 ] ) always clobbers reg byte a reg byte y +Statement [9] (word~) main::$4 ← (word~) main::$3 + (byte) main::i#2 [ main::i#2 main::$1 main::$4 ] ( main:2 [ main::i#2 main::$1 main::$4 ] ) always clobbers reg byte a +Statement [10] (word) main::$6 ← (word~) main::$1 << (byte/signed byte/word/signed word/dword/signed dword) 1 [ main::i#2 main::$4 main::$6 ] ( main:2 [ main::i#2 main::$4 main::$6 ] ) always clobbers reg byte a +Statement [11] (word*) main::$9 ← (const word[$100]) words#0 + (word) main::$6 [ main::i#2 main::$4 main::$9 ] ( main:2 [ main::i#2 main::$4 main::$9 ] ) always clobbers reg byte a +Statement [12] *((word*) main::$9) ← (word~) main::$4 [ main::i#2 ] ( main:2 [ main::i#2 ] ) always clobbers reg byte a reg byte y +Statement [15] *((const word*) main::SCREEN#0) ← *((const word[$100]) words#0+((word))(byte/word/signed word/dword/signed dword) $ff*(const byte) SIZEOF_WORD) [ ] ( main:2 [ ] ) always clobbers reg byte a +Potential registers zp ZP_BYTE:2 [ main::i#2 main::i#1 ] : zp ZP_BYTE:2 , reg byte x , +Potential registers zp ZP_WORD:3 [ main::$1 ] : zp ZP_WORD:3 , +Potential registers zp ZP_WORD:5 [ main::$2 ] : zp ZP_WORD:5 , +Potential registers zp ZP_WORD:7 [ main::$3 ] : zp ZP_WORD:7 , +Potential registers zp ZP_WORD:9 [ main::$4 ] : zp ZP_WORD:9 , +Potential registers zp ZP_WORD:11 [ main::$6 ] : zp ZP_WORD:11 , +Potential registers zp ZP_WORD:13 [ main::$9 ] : zp ZP_WORD:13 , + +REGISTER UPLIFT SCOPES +Uplift Scope [main] 23.38: zp ZP_BYTE:2 [ main::i#2 main::i#1 ] 22: zp ZP_WORD:5 [ main::$2 ] 22: zp ZP_WORD:7 [ main::$3 ] 22: zp ZP_WORD:11 [ main::$6 ] 22: zp ZP_WORD:13 [ main::$9 ] 7.33: zp ZP_WORD:9 [ main::$4 ] 5.5: zp ZP_WORD:3 [ main::$1 ] +Uplift Scope [] + +Uplifting [main] best 1482 combination reg byte x [ main::i#2 main::i#1 ] zp ZP_WORD:5 [ main::$2 ] zp ZP_WORD:7 [ main::$3 ] zp ZP_WORD:11 [ main::$6 ] zp ZP_WORD:13 [ main::$9 ] zp ZP_WORD:9 [ main::$4 ] zp ZP_WORD:3 [ main::$1 ] +Uplifting [] best 1482 combination +Coalescing zero page register with common assignment [ zp ZP_WORD:3 [ main::$1 ] ] with [ zp ZP_WORD:11 [ main::$6 ] ] - score: 1 +Coalescing zero page register with common assignment [ zp ZP_WORD:5 [ main::$2 ] ] with [ zp ZP_WORD:7 [ main::$3 ] ] - score: 1 +Coalescing zero page register with common assignment [ zp ZP_WORD:3 [ main::$1 main::$6 ] ] with [ zp ZP_WORD:13 [ main::$9 ] ] - score: 1 +Coalescing zero page register with common assignment [ zp ZP_WORD:5 [ main::$2 main::$3 ] ] with [ zp ZP_WORD:9 [ main::$4 ] ] - score: 1 +Allocated (was zp ZP_WORD:3) zp ZP_WORD:2 [ main::$1 main::$6 main::$9 ] +Allocated (was zp ZP_WORD:5) zp ZP_WORD:4 [ main::$2 main::$3 main::$4 ] + +ASSEMBLER BEFORE OPTIMIZATION +//SEG0 File Comments +// Tests a word-array with 128+ elements +//SEG1 Basic Upstart +.pc = $801 "Basic" +:BasicUpstart(bbegin) +.pc = $80d "Program" +//SEG2 Global Constants & labels + .const SIZEOF_WORD = 2 +//SEG3 @begin +bbegin: +//SEG4 [1] phi from @begin to @1 [phi:@begin->@1] +b1_from_bbegin: + jmp b1 +//SEG5 @1 +b1: +//SEG6 [2] call main +//SEG7 [4] phi from @1 to main [phi:@1->main] +main_from_b1: + jsr main +//SEG8 [3] phi from @1 to @end [phi:@1->@end] +bend_from_b1: + jmp bend +//SEG9 @end +bend: +//SEG10 main +main: { + .label SCREEN = $400 + .label _1 = 2 + .label _2 = 4 + .label _3 = 4 + .label _4 = 4 + .label _6 = 2 + .label _9 = 2 + //SEG11 [5] phi from main to main::@1 [phi:main->main::@1] + b1_from_main: + //SEG12 [5] phi (byte) main::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuxx=vbuc1 + ldx #0 + jmp b1 + //SEG13 [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1] + b1_from_b1: + //SEG14 [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@1->main::@1#0] -- register_copy + jmp b1 + //SEG15 main::@1 + b1: + //SEG16 [6] (word~) main::$1 ← ((word)) (byte) main::i#2 -- vwuz1=_word_vbuxx + txa + sta _1 + lda #0 + sta _1+1 + //SEG17 [7] (word~) main::$2 ← ((word)) (byte) main::i#2 -- vwuz1=_word_vbuxx + txa + sta _2 + lda #0 + sta _2+1 + //SEG18 [8] (word~) main::$3 ← (word~) main::$2 << (byte/signed byte/word/signed word/dword/signed dword) 8 -- vwuz1=vwuz1_rol_vbuc1 + ldy #8 + cpy #0 + beq !e+ + !: + asl _3 + rol _3+1 + dey + bne !- + !e: + //SEG19 [9] (word~) main::$4 ← (word~) main::$3 + (byte) main::i#2 -- vwuz1=vwuz1_plus_vbuxx + txa + clc + adc _4 + sta _4 + bcc !+ + inc _4+1 + !: + //SEG20 [10] (word) main::$6 ← (word~) main::$1 << (byte/signed byte/word/signed word/dword/signed dword) 1 -- vwuz1=vwuz1_rol_1 + asl _6 + rol _6+1 + //SEG21 [11] (word*) main::$9 ← (const word[$100]) words#0 + (word) main::$6 -- pwuz1=pwuc1_plus_vwuz1 + clc + lda _9 + adc #words + sta _9+1 + //SEG22 [12] *((word*) main::$9) ← (word~) main::$4 -- _deref_pwuz1=vwuz2 + ldy #0 + lda _4 + sta (_9),y + iny + lda _4+1 + sta (_9),y + //SEG23 [13] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx + inx + //SEG24 [14] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto main::@1 -- vbuxx_neq_0_then_la1 + cpx #0 + bne b1_from_b1 + jmp b2 + //SEG25 main::@2 + b2: + //SEG26 [15] *((const word*) main::SCREEN#0) ← *((const word[$100]) words#0+((word))(byte/word/signed word/dword/signed dword) $ff*(const byte) SIZEOF_WORD) -- _deref_pwuc1=_deref_pwuc2 + lda words+$ff*SIZEOF_WORD + sta SCREEN + lda words+$ff*SIZEOF_WORD+1 + sta SCREEN+1 + jmp breturn + //SEG27 main::@return + breturn: + //SEG28 [16] return + rts +} + words: .fill 2*$100, 0 + +ASSEMBLER OPTIMIZATIONS +Removing instruction jmp b1 +Removing instruction jmp bend +Removing instruction jmp b1 +Removing instruction jmp b2 +Removing instruction jmp breturn +Succesful ASM optimization Pass5NextJumpElimination +Replacing label b1_from_b1 with b1 +Removing instruction b1_from_bbegin: +Removing instruction b1: +Removing instruction main_from_b1: +Removing instruction bend_from_b1: +Removing instruction b1_from_b1: +Succesful ASM optimization Pass5RedundantLabelElimination +Removing instruction bend: +Removing instruction b1_from_main: +Removing instruction b2: +Removing instruction breturn: +Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin +Removing instruction jmp b1 +Succesful ASM optimization Pass5NextJumpElimination +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination + +FINAL SYMBOL TABLE +(label) @1 +(label) @begin +(label) @end +(const byte) SIZEOF_WORD SIZEOF_WORD = (byte/signed byte/word/signed word/dword/signed dword) 2 +(void()) main() +(word~) main::$1 $1 zp ZP_WORD:2 5.5 +(word~) main::$2 $2 zp ZP_WORD:4 22.0 +(word~) main::$3 $3 zp ZP_WORD:4 22.0 +(word~) main::$4 $4 zp ZP_WORD:4 7.333333333333333 +(word) main::$6 $6 zp ZP_WORD:2 22.0 +(word*) main::$9 $9 zp ZP_WORD:2 22.0 +(label) main::@1 +(label) main::@2 +(label) main::@return +(word*) main::SCREEN +(const word*) main::SCREEN#0 SCREEN = ((word*))(word/signed word/dword/signed dword) $400 +(byte) main::i +(byte) main::i#1 reg byte x 16.5 +(byte) main::i#2 reg byte x 6.875 +(word[$100]) words +(const word[$100]) words#0 words = { fill( $100, 0) } + +reg byte x [ main::i#2 main::i#1 ] +zp ZP_WORD:2 [ main::$1 main::$6 main::$9 ] +zp ZP_WORD:4 [ main::$2 main::$3 main::$4 ] + + +FINAL ASSEMBLER +Score: 1192 + +//SEG0 File Comments +// Tests a word-array with 128+ elements +//SEG1 Basic Upstart +.pc = $801 "Basic" +:BasicUpstart(main) +.pc = $80d "Program" +//SEG2 Global Constants & labels + .const SIZEOF_WORD = 2 +//SEG3 @begin +//SEG4 [1] phi from @begin to @1 [phi:@begin->@1] +//SEG5 @1 +//SEG6 [2] call main +//SEG7 [4] phi from @1 to main [phi:@1->main] +//SEG8 [3] phi from @1 to @end [phi:@1->@end] +//SEG9 @end +//SEG10 main +main: { + .label SCREEN = $400 + .label _1 = 2 + .label _2 = 4 + .label _3 = 4 + .label _4 = 4 + .label _6 = 2 + .label _9 = 2 + //SEG11 [5] phi from main to main::@1 [phi:main->main::@1] + //SEG12 [5] phi (byte) main::i#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuxx=vbuc1 + ldx #0 + //SEG13 [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1] + //SEG14 [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@1->main::@1#0] -- register_copy + //SEG15 main::@1 + b1: + //SEG16 [6] (word~) main::$1 ← ((word)) (byte) main::i#2 -- vwuz1=_word_vbuxx + txa + sta _1 + lda #0 + sta _1+1 + //SEG17 [7] (word~) main::$2 ← ((word)) (byte) main::i#2 -- vwuz1=_word_vbuxx + txa + sta _2 + lda #0 + sta _2+1 + //SEG18 [8] (word~) main::$3 ← (word~) main::$2 << (byte/signed byte/word/signed word/dword/signed dword) 8 -- vwuz1=vwuz1_rol_vbuc1 + ldy #8 + cpy #0 + beq !e+ + !: + asl _3 + rol _3+1 + dey + bne !- + !e: + //SEG19 [9] (word~) main::$4 ← (word~) main::$3 + (byte) main::i#2 -- vwuz1=vwuz1_plus_vbuxx + txa + clc + adc _4 + sta _4 + bcc !+ + inc _4+1 + !: + //SEG20 [10] (word) main::$6 ← (word~) main::$1 << (byte/signed byte/word/signed word/dword/signed dword) 1 -- vwuz1=vwuz1_rol_1 + asl _6 + rol _6+1 + //SEG21 [11] (word*) main::$9 ← (const word[$100]) words#0 + (word) main::$6 -- pwuz1=pwuc1_plus_vwuz1 + clc + lda _9 + adc #words + sta _9+1 + //SEG22 [12] *((word*) main::$9) ← (word~) main::$4 -- _deref_pwuz1=vwuz2 + ldy #0 + lda _4 + sta (_9),y + iny + lda _4+1 + sta (_9),y + //SEG23 [13] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx + inx + //SEG24 [14] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto main::@1 -- vbuxx_neq_0_then_la1 + cpx #0 + bne b1 + //SEG25 main::@2 + //SEG26 [15] *((const word*) main::SCREEN#0) ← *((const word[$100]) words#0+((word))(byte/word/signed word/dword/signed dword) $ff*(const byte) SIZEOF_WORD) -- _deref_pwuc1=_deref_pwuc2 + lda words+$ff*SIZEOF_WORD + sta SCREEN + lda words+$ff*SIZEOF_WORD+1 + sta SCREEN+1 + //SEG27 main::@return + //SEG28 [16] return + rts +} + words: .fill 2*$100, 0 + diff --git a/src/test/ref/word-array-2.sym b/src/test/ref/word-array-2.sym new file mode 100644 index 000000000..944b88271 --- /dev/null +++ b/src/test/ref/word-array-2.sym @@ -0,0 +1,25 @@ +(label) @1 +(label) @begin +(label) @end +(const byte) SIZEOF_WORD SIZEOF_WORD = (byte/signed byte/word/signed word/dword/signed dword) 2 +(void()) main() +(word~) main::$1 $1 zp ZP_WORD:2 5.5 +(word~) main::$2 $2 zp ZP_WORD:4 22.0 +(word~) main::$3 $3 zp ZP_WORD:4 22.0 +(word~) main::$4 $4 zp ZP_WORD:4 7.333333333333333 +(word) main::$6 $6 zp ZP_WORD:2 22.0 +(word*) main::$9 $9 zp ZP_WORD:2 22.0 +(label) main::@1 +(label) main::@2 +(label) main::@return +(word*) main::SCREEN +(const word*) main::SCREEN#0 SCREEN = ((word*))(word/signed word/dword/signed dword) $400 +(byte) main::i +(byte) main::i#1 reg byte x 16.5 +(byte) main::i#2 reg byte x 6.875 +(word[$100]) words +(const word[$100]) words#0 words = { fill( $100, 0) } + +reg byte x [ main::i#2 main::i#1 ] +zp ZP_WORD:2 [ main::$1 main::$6 main::$9 ] +zp ZP_WORD:4 [ main::$2 main::$3 main::$4 ]