mirror of
https://gitlab.com/camelot/kickc.git
synced 2024-09-08 17:54:40 +00:00
Implemented clobber assertion check for testing potential register allocations.
This commit is contained in:
parent
e34e01544b
commit
120eba90a5
@ -144,15 +144,20 @@ public class Compiler {
|
||||
log.append("\nVARIABLE REGISTER WEIGHTS");
|
||||
log.append(program.getScope().getSymbolTableContents(Variable.class));
|
||||
|
||||
//new Pass3RegisterUplifting(program, log).uplift();
|
||||
//log.append("REGISTER UPLIFTING");
|
||||
//log.append(program.getScope().getSymbolTableContents(Variable.class));
|
||||
|
||||
new Pass3ZeroPageCoalesce(program, log).allocate();
|
||||
new Pass3RegistersFinalize(program, log).allocate();
|
||||
|
||||
//new Pass4RegisterAllocationTrivial(program).allocate();
|
||||
new Pass3AssertNoCpuClobber(program, log).check();
|
||||
|
||||
new Pass3RegisterUplifting(program, log).uplift();
|
||||
log.append("REGISTER UPLIFTING");
|
||||
log.append(program.getScope().getSymbolTableContents(Variable.class));
|
||||
new Pass3AssertNoCpuClobber(program, log).check();
|
||||
|
||||
new Pass3ZeroPageCoalesce(program, log).allocate();
|
||||
new Pass3AssertNoCpuClobber(program, log).check();
|
||||
|
||||
//new Pass4CustomRegisters(program).allocate();
|
||||
//new Pass3AssertNoCpuClobber(program, log).check();
|
||||
|
||||
}
|
||||
|
||||
|
@ -323,7 +323,7 @@ public class AsmFragment {
|
||||
public String getBoundValue(String name) {
|
||||
Value boundValue = getBinding(name);
|
||||
if (boundValue == null) {
|
||||
throw new RuntimeException("Binding not found in fragment '" + name + "'");
|
||||
throw new RuntimeException("Binding '" + name + "' not found in fragment "+ signature + ".asm");
|
||||
}
|
||||
String bound;
|
||||
if (boundValue instanceof RegisterAllocation.Register) {
|
||||
@ -382,9 +382,7 @@ public class AsmFragment {
|
||||
ClassLoader classLoader = this.getClass().getClassLoader();
|
||||
final URL fragmentResource = classLoader.getResource("dk/camelot64/kickc/asm/fragment/" + signature + ".asm");
|
||||
if (fragmentResource == null) {
|
||||
System.out.println("Fragment not found " + fragmentResource);
|
||||
asm.addComment("Fragment not found: " + signature);
|
||||
return;
|
||||
throw new RuntimeException("Fragment not found " + signature+".asm");
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -1,5 +1,7 @@
|
||||
package dk.camelot64.kickc.asm;
|
||||
|
||||
import dk.camelot64.kickc.asm.parser.AsmClobber;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@ -54,4 +56,19 @@ public class AsmProgram {
|
||||
return toString(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the CPU registers clobbered by the instructions of the fragment
|
||||
* @return The clobbered registers
|
||||
*/
|
||||
public AsmClobber getClobber() {
|
||||
AsmClobber clobber = new AsmClobber();
|
||||
for (AsmLine line : lines) {
|
||||
if(line instanceof AsmInstruction) {
|
||||
AsmInstructionType instructionType = ((AsmInstruction) line).getType();
|
||||
AsmClobber lineClobber = instructionType.getClobber();
|
||||
clobber.add(lineClobber);
|
||||
}
|
||||
}
|
||||
return clobber;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,2 @@
|
||||
sec
|
||||
sbc #1
|
@ -0,0 +1,3 @@
|
||||
lda {zpby1}
|
||||
sec
|
||||
sbc #1
|
@ -0,0 +1,3 @@
|
||||
lda {zpby1}
|
||||
clc
|
||||
adc #1
|
@ -0,0 +1 @@
|
||||
asl
|
@ -0,0 +1,2 @@
|
||||
tax
|
||||
lda {cowo1},x
|
@ -0,0 +1,2 @@
|
||||
ldx {zpby1}
|
||||
lda {cowo1},x
|
@ -0,0 +1,3 @@
|
||||
lda {zpby1}
|
||||
sec
|
||||
sbc #{coby1}
|
@ -0,0 +1,3 @@
|
||||
lda {zpby1}
|
||||
clc
|
||||
adc #1
|
@ -0,0 +1,2 @@
|
||||
clc
|
||||
adc {zpby1}
|
@ -0,0 +1,2 @@
|
||||
cmp #0
|
||||
bne {la1}
|
@ -0,0 +1,4 @@
|
||||
cmp #{coby1}
|
||||
beq !+
|
||||
bcs {la1}
|
||||
!:
|
@ -0,0 +1,2 @@
|
||||
cmp #{coby1}
|
||||
bcc {la1}
|
@ -0,0 +1,2 @@
|
||||
cmp #0
|
||||
bne {la1}
|
@ -0,0 +1 @@
|
||||
sta {coptr1}
|
@ -0,0 +1 @@
|
||||
stx {coptr1}
|
@ -0,0 +1,2 @@
|
||||
tax
|
||||
sta {cowo1},x
|
@ -0,0 +1,2 @@
|
||||
ldx {zpby1}
|
||||
sta {cowo1},x
|
@ -1,3 +1,3 @@
|
||||
ldy {zpby1}
|
||||
tya
|
||||
sta {cowo1},y
|
||||
ldx {zpby1}
|
||||
txa
|
||||
sta {cowo1},x
|
@ -1,3 +1,3 @@
|
||||
lda {zpby2}
|
||||
ldy {zpby1}
|
||||
sta {cowo1},y
|
||||
ldx {zpby1}
|
||||
sta {cowo1},x
|
@ -0,0 +1,2 @@
|
||||
ldy {zpby1}
|
||||
sta ({zpptrby1}),y
|
@ -0,0 +1,2 @@
|
||||
ldy {zpby1}
|
||||
dey
|
@ -0,0 +1,2 @@
|
||||
cpy #0
|
||||
bne {la1}
|
@ -0,0 +1,2 @@
|
||||
sta {zpby1}
|
||||
dec {zpby1}
|
@ -0,0 +1,2 @@
|
||||
sta {zpby1}
|
||||
inc {zpby1}
|
@ -0,0 +1,2 @@
|
||||
asl
|
||||
sta {zpby1}
|
@ -1,3 +1,3 @@
|
||||
ldy {zpby1}
|
||||
lda {cowo1},y
|
||||
ldx {zpby1}
|
||||
lda {cowo1},x
|
||||
sta {zpby1}
|
@ -1,3 +1,3 @@
|
||||
ldy {zpby2}
|
||||
lda {cowo1},y
|
||||
ldx {zpby2}
|
||||
lda {cowo1},x
|
||||
sta {zpby1}
|
@ -0,0 +1,3 @@
|
||||
clc
|
||||
adc {zpby1}
|
||||
sta {zpby1}
|
@ -69,4 +69,32 @@ public class AsmClobber {
|
||||
public void setClobberV(boolean clobberV) {
|
||||
this.clobberV = clobberV;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds clobber.
|
||||
* Effective updates so this clobber also clobbers anything added
|
||||
* @param clobber The clobber to add
|
||||
*/
|
||||
public void add(AsmClobber clobber) {
|
||||
clobberA |= clobber.clobberA;
|
||||
clobberX |= clobber.clobberX;
|
||||
clobberY |= clobber.clobberY;
|
||||
clobberC |= clobber.clobberC;
|
||||
clobberN |= clobber.clobberN;
|
||||
clobberZ |= clobber.clobberZ;
|
||||
clobberV |= clobber.clobberV;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return
|
||||
(clobberA?"A":"") +
|
||||
(clobberX?"X":"") +
|
||||
(clobberY?"Y":"") +
|
||||
(clobberC?"C":"") +
|
||||
(clobberN?"N":"") +
|
||||
(clobberZ?"Z":"") +
|
||||
(clobberV?"V":"") ;
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,137 @@
|
||||
package dk.camelot64.kickc.passes;
|
||||
|
||||
import dk.camelot64.kickc.CompileLog;
|
||||
import dk.camelot64.kickc.asm.AsmProgram;
|
||||
import dk.camelot64.kickc.asm.parser.AsmClobber;
|
||||
import dk.camelot64.kickc.icl.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/*** Ensures that no statement clobbers a CPU register used by an alive variable - and that assigning statements clobber the CPU registers they assign to */
|
||||
public class Pass3AssertNoCpuClobber {
|
||||
|
||||
private Program program;
|
||||
private CompileLog log;
|
||||
|
||||
public Pass3AssertNoCpuClobber(Program program, CompileLog log) {
|
||||
this.program = program;
|
||||
this.log = log;
|
||||
}
|
||||
|
||||
public Program getProgram() {
|
||||
return program;
|
||||
}
|
||||
|
||||
public CompileLog getLog() {
|
||||
return log;
|
||||
}
|
||||
|
||||
/** Uplift one variable */
|
||||
public void check() {
|
||||
LiveRangeVariables liveRangeVariables = program.getScope().getLiveRangeVariables();
|
||||
RegisterAllocation allocation = program.getScope().getAllocation();
|
||||
|
||||
boolean error = false;
|
||||
|
||||
for (ControlFlowBlock block : program.getGraph().getAllBlocks()) {
|
||||
for (Statement statement : block.getStatements()) {
|
||||
|
||||
// Generate ASM and find clobber
|
||||
Collection<RegisterAllocation.Register> clobberRegisters = getClobberedRegisters(statement, block);
|
||||
|
||||
// Find alive variables
|
||||
List<VariableRef> aliveVars = new ArrayList<>(liveRangeVariables.getAlive(statement));
|
||||
|
||||
// Find vars assignedVars to
|
||||
Collection<VariableRef> assignedVars = getAssignedVars(statement);
|
||||
|
||||
for (VariableRef aliveVar : aliveVars) {
|
||||
RegisterAllocation.Register aliveVarRegister = allocation.getRegister(aliveVar);
|
||||
if(aliveVarRegister.isZp()) {
|
||||
// No need to check a zp-register - here we are only interested in CPU registers
|
||||
continue;
|
||||
}
|
||||
if(assignedVars.contains(aliveVar)) {
|
||||
// No need to register that is assigned by the statement - it will be clobbered
|
||||
continue;
|
||||
}
|
||||
// Alive and not assigned to - clobber not allowed!
|
||||
if(clobberRegisters.contains(aliveVarRegister)) {
|
||||
log.append("Error! Alive variable "+aliveVar+" register "+aliveVarRegister+" clobbered by the ASM generated by statement "+statement);
|
||||
log.append(getAsmProgram(statement, block).toString(false));
|
||||
error = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(error) {
|
||||
throw new RuntimeException("CLOBBER ERROR! See log for more info.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the variables assigned to by a specific statement
|
||||
*
|
||||
* @param statement The statement
|
||||
* @return The variables assigned by the statement
|
||||
*/
|
||||
private Collection<VariableRef> getAssignedVars(Statement statement) {
|
||||
List<VariableRef> assignedVars = new ArrayList<>();
|
||||
if(statement instanceof StatementAssignment) {
|
||||
StatementAssignment assignment = (StatementAssignment) statement;
|
||||
if(assignment.getlValue() instanceof VariableRef) {
|
||||
assignedVars.add((VariableRef) assignment.getlValue());
|
||||
}
|
||||
} else if(statement instanceof StatementPhiBlock) {
|
||||
StatementPhiBlock phi = (StatementPhiBlock) statement;
|
||||
for (StatementPhiBlock.PhiVariable phiVariable : phi.getPhiVariables()) {
|
||||
assignedVars.add(phiVariable.getVariable());
|
||||
}
|
||||
}
|
||||
return assignedVars;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all CPU registers clobbered by the ASM generated from a specific statement in the program
|
||||
*
|
||||
* @param statement The statement
|
||||
* @param block The block containing the statement
|
||||
* @return The clobbered CPU registers
|
||||
*/
|
||||
private Collection<RegisterAllocation.Register> getClobberedRegisters(Statement statement, ControlFlowBlock block) {
|
||||
AsmProgram asm = getAsmProgram(statement, block);
|
||||
AsmClobber clobber = asm.getClobber();
|
||||
List<RegisterAllocation.Register> clobberRegisters = new ArrayList<>();
|
||||
if(clobber.isClobberA()) {
|
||||
clobberRegisters.add(RegisterAllocation.getRegisterA());
|
||||
}
|
||||
if(clobber.isClobberX()) {
|
||||
clobberRegisters.add(RegisterAllocation.getRegisterX());
|
||||
}
|
||||
if(clobber.isClobberY()) {
|
||||
clobberRegisters.add(RegisterAllocation.getRegisterY());
|
||||
}
|
||||
return clobberRegisters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the ASM program generated by a specific statement in the program
|
||||
*
|
||||
* @param statement The statement
|
||||
* @param block The block containing the statement
|
||||
* @return The ASM code
|
||||
*/
|
||||
private AsmProgram getAsmProgram(Statement statement, ControlFlowBlock block) {
|
||||
Pass4CodeGeneration codegen = new Pass4CodeGeneration(program);
|
||||
AsmProgram asm = new AsmProgram();
|
||||
codegen.generateStatementAsm(asm, block, statement, new Pass4CodeGeneration.AsmCodegenAluState());
|
||||
return asm;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,6 +1,8 @@
|
||||
package dk.camelot64.kickc.passes;
|
||||
|
||||
import dk.camelot64.kickc.CompileLog;
|
||||
import dk.camelot64.kickc.asm.AsmProgram;
|
||||
import dk.camelot64.kickc.asm.parser.AsmClobber;
|
||||
import dk.camelot64.kickc.icl.*;
|
||||
|
||||
import java.util.Collection;
|
||||
@ -24,7 +26,9 @@ public class Pass3RegisterUplifting {
|
||||
return log;
|
||||
}
|
||||
|
||||
/** Uplift one variable */
|
||||
/**
|
||||
* Uplift one variable
|
||||
*/
|
||||
public void uplift() {
|
||||
|
||||
VariableRegisterWeights variableRegisterWeights = program.getScope().getVariableRegisterWeights();
|
||||
@ -33,21 +37,21 @@ public class Pass3RegisterUplifting {
|
||||
Variable maxVar = null;
|
||||
|
||||
Collection<Variable> allVars = program.getScope().getAllVariables(true);
|
||||
RegisterAllocation allocation = program.getScope().getAllocation();
|
||||
|
||||
for (Variable variable : allVars) {
|
||||
Double w = variableRegisterWeights.getWeight(variable.getRef());
|
||||
if(w!=null && w>maxWeight) {
|
||||
maxWeight = w;
|
||||
maxVar = variable;
|
||||
RegisterAllocation.Register currentRegister = allocation.getRegister(variable.getRef());
|
||||
if (currentRegister!=null && currentRegister.isZp()) {
|
||||
Double w = variableRegisterWeights.getWeight(variable.getRef());
|
||||
if (w != null && w > maxWeight) {
|
||||
maxWeight = w;
|
||||
maxVar = variable;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Found max variable!
|
||||
log.append("Attempting uplift of variable "+maxVar);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
log.append("Uplifting of variable " + maxVar + " to A");
|
||||
allocation.allocate(maxVar.getRef(), new RegisterAllocation.RegisterAByte());
|
||||
|
||||
}
|
||||
|
||||
|
@ -20,8 +20,7 @@ public class Pass4CodeGeneration {
|
||||
|
||||
public AsmProgram generate() {
|
||||
AsmProgram asm = new AsmProgram();
|
||||
for (LabelRef blockRef : graph.getSequence()) {
|
||||
ControlFlowBlock block = graph.getBlock(blockRef);
|
||||
for (ControlFlowBlock block : graph.getAllBlocks()) {
|
||||
// Generate entry points (if needed)
|
||||
genBlockEntryPoints(asm, block);
|
||||
// Generate label
|
||||
@ -52,16 +51,17 @@ public class Pass4CodeGeneration {
|
||||
/**
|
||||
* Generate ASM code for a single statement
|
||||
*
|
||||
* @param asm The ASM program to generate into
|
||||
* @param block The block containing the statement
|
||||
* @param statementsIt The iterator giving access to the next statement
|
||||
* @param statement The statement to generate ASM code for
|
||||
* @param asm The ASM program to generate into
|
||||
* @param block The block containing the statement
|
||||
* @param statement The statement to generate ASM code for
|
||||
* @param aluState State of the special ALU register. Used to generate composite fragments when two consecutive statements can be executed effectively.
|
||||
* For example ADC $1100,x combines two statements $0 = $1100 staridx X, A = A+$0 .
|
||||
*/
|
||||
public void generateStatementAsm(AsmProgram asm, ControlFlowBlock block, Statement statement, AsmCodegenAluState asmCodeAsmCodegenAluState) {
|
||||
public void generateStatementAsm(AsmProgram asm, ControlFlowBlock block, Statement statement, AsmCodegenAluState aluState) {
|
||||
|
||||
// IF the previous statement was added to the ALU register - generate the composite ASM fragment
|
||||
if (asmCodeAsmCodegenAluState.hasAluAssignment()) {
|
||||
StatementAssignment assignmentAlu = asmCodeAsmCodegenAluState.getAluAssignment();
|
||||
if (aluState.hasAluAssignment()) {
|
||||
StatementAssignment assignmentAlu = aluState.getAluAssignment();
|
||||
if (!(statement instanceof StatementAssignment)) {
|
||||
throw new RuntimeException("Error! ALU statement must be followed immediately by assignment using the ALU. " + statement);
|
||||
}
|
||||
@ -69,7 +69,7 @@ public class Pass4CodeGeneration {
|
||||
AsmFragment asmFragment = new AsmFragment(assignment, assignmentAlu, symbols);
|
||||
asm.addComment(statement.toString(symbols) + " // " + asmFragment.getSignature());
|
||||
asmFragment.generate(asm);
|
||||
asmCodeAsmCodegenAluState.clear();
|
||||
aluState.clear();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -85,7 +85,7 @@ public class Pass4CodeGeneration {
|
||||
if (lValRegister.getType().equals(RegisterAllocation.RegisterType.REG_ALU_BYTE)) {
|
||||
asm.addComment(statement + " // ALU");
|
||||
StatementAssignment assignmentAlu = assignment;
|
||||
asmCodeAsmCodegenAluState.setAluAssignment(assignmentAlu);
|
||||
aluState.setAluAssignment(assignmentAlu);
|
||||
isAlu = true;
|
||||
}
|
||||
}
|
||||
|
@ -5,28 +5,33 @@ import dk.camelot64.kickc.icl.*;
|
||||
/**
|
||||
* Register Allocation for variables
|
||||
*/
|
||||
public class Pass4RegisterAllocationTrivial {
|
||||
public class Pass4CustomRegisters {
|
||||
|
||||
private ControlFlowGraph graph;
|
||||
private ProgramScope symbols;
|
||||
int currentZp = 2;
|
||||
|
||||
public Pass4RegisterAllocationTrivial(Program program) {
|
||||
this.graph = program.getGraph();
|
||||
this.symbols = program.getScope();
|
||||
private Program program;
|
||||
|
||||
public Pass4CustomRegisters(Program program) {
|
||||
this.program = program;
|
||||
}
|
||||
|
||||
public void allocate() {
|
||||
RegisterAllocation allocation = new RegisterAllocation();
|
||||
performAllocation(symbols, allocation);
|
||||
RegisterAllocation allocation = program.getScope().getAllocation();
|
||||
|
||||
// Register allocation for loopnest.kc
|
||||
allocation.allocate(new VariableRef("nest2::j#2"), RegisterAllocation.getRegisterX());
|
||||
allocation.allocate(new VariableRef("nest2::j#1"), RegisterAllocation.getRegisterX());
|
||||
allocation.allocate(new VariableRef("nest2::i#2"), RegisterAllocation.getRegisterY());
|
||||
allocation.allocate(new VariableRef("nest2::i#1"), RegisterAllocation.getRegisterY());
|
||||
|
||||
|
||||
// Register allocation for fibmem.kc
|
||||
/*
|
||||
allocation.allocate(new VariableRef("i#1"), RegisterAllocation.getRegisterX());
|
||||
allocation.allocate(new VariableRef("i#2"), RegisterAllocation.getRegisterX());
|
||||
allocation.allocate(new VariableRef("$1"), new RegisterAllocation.RegisterAByte());
|
||||
allocation.allocate(new VariableRef("$3"), new RegisterAllocation.RegisterALUByte());
|
||||
allocation.allocate(new VariableRef("$4"), new RegisterAllocation.RegisterAByte());
|
||||
|
||||
*/
|
||||
|
||||
// Registers for postinc.kc
|
||||
/*
|
||||
@ -105,10 +110,10 @@ public class Pass4RegisterAllocationTrivial {
|
||||
allocation.allocate(new VariableRef("main::c#4"), RegisterAllocation.getRegisterX());
|
||||
*/
|
||||
|
||||
symbols.setAllocation(allocation);
|
||||
|
||||
}
|
||||
|
||||
int currentZp = 2;
|
||||
private void performAllocation(Scope scope, RegisterAllocation allocation) {
|
||||
for (Symbol symbol : scope.getAllSymbols()) {
|
||||
if (symbol instanceof Scope) {
|
@ -1,9 +1,13 @@
|
||||
byte i=100;
|
||||
byte s=0;
|
||||
while(--i>0) {
|
||||
if(i>50) {
|
||||
s++;
|
||||
} else {
|
||||
s--;
|
||||
}
|
||||
main();
|
||||
|
||||
void main() {
|
||||
byte i=100;
|
||||
byte s=0;
|
||||
while(--i>0) {
|
||||
if(i>50) {
|
||||
s++;
|
||||
} else {
|
||||
s--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -45,6 +45,6 @@ B2:
|
||||
lda 5
|
||||
sec
|
||||
sbc #39
|
||||
sta 5
|
||||
B3_from_B2:
|
||||
sta 5
|
||||
jmp B3
|
||||
|
@ -1097,6 +1097,39 @@ Re-allocated ZP register from zp ptr byte:2 to zp ptr byte:2
|
||||
Re-allocated ZP register from zp byte:4 to zp byte:4
|
||||
Re-allocated ZP register from zp byte:5 to zp byte:5
|
||||
Re-allocated ZP register from zp byte:6 to zp byte:6
|
||||
Uplifting of variable (byte) e#2 to A
|
||||
REGISTER UPLIFTING
|
||||
(byte[1000]) SCREEN
|
||||
(byte) STAR
|
||||
(byte*) cursor
|
||||
(byte*) cursor#1 zp ptr byte:2 8.25
|
||||
(byte*) cursor#2 zp ptr byte:2 11.0
|
||||
(byte*) cursor#3 zp ptr byte:2 11.0
|
||||
(byte*) cursor#5 zp ptr byte:2 16.5
|
||||
(byte) e
|
||||
(byte) e#1 zp byte:5 11.0
|
||||
(byte) e#2 reg byte a 22.0
|
||||
(byte) e#3 zp byte:5 5.5
|
||||
(byte) e#5 zp byte:5 16.5
|
||||
(byte) x
|
||||
(byte) x#1 zp byte:4 3.666666666666667
|
||||
(byte) x#2 zp byte:4 11.0
|
||||
(byte) x0
|
||||
(byte) x1
|
||||
(byte) xd
|
||||
(byte) y
|
||||
(byte) y#1 zp byte:6 7.333333333333333
|
||||
(byte) y#2 zp byte:6 5.5
|
||||
(byte) y#4 zp byte:6 16.5
|
||||
(byte) y0
|
||||
(byte) y1
|
||||
(byte) yd
|
||||
|
||||
zp ptr byte:2 [ cursor#3 cursor#5 cursor#1 cursor#2 ]
|
||||
zp byte:4 [ x#2 x#1 ]
|
||||
zp byte:5 [ e#3 e#5 e#1 e#2 ]
|
||||
zp byte:6 [ y#2 y#4 y#1 ]
|
||||
|
||||
INITIAL ASM
|
||||
BBEGIN:
|
||||
B1_from_BBEGIN:
|
||||
@ -1165,14 +1198,14 @@ B2:
|
||||
bcc !+
|
||||
inc 2+1
|
||||
!:
|
||||
// [10] (byte) e#2 ← (byte) e#1 - (byte) 39 [ x#1 cursor#2 e#2 y#1 ] // zpby1=zpby1_minus_coby1
|
||||
// [10] (byte) e#2 ← (byte) e#1 - (byte) 39 [ x#1 cursor#2 e#2 y#1 ] // aby=zpby1_minus_coby1
|
||||
lda 5
|
||||
sec
|
||||
sbc #39
|
||||
sta 5
|
||||
B3_from_B2:
|
||||
// (byte) y#4 = (byte) y#1 // register copy zp byte:6
|
||||
// (byte) e#5 = (byte) e#2 // register copy zp byte:5
|
||||
// (byte) e#5 = (byte) e#2 // zpby1=aby
|
||||
sta 5
|
||||
// (byte*) cursor#5 = (byte*) cursor#2 // register copy zp ptr byte:2
|
||||
jmp B3
|
||||
|
||||
@ -1245,14 +1278,14 @@ B2:
|
||||
bcc !+
|
||||
inc 2+1
|
||||
!:
|
||||
// [10] (byte) e#2 ← (byte) e#1 - (byte) 39 [ x#1 cursor#2 e#2 y#1 ] // zpby1=zpby1_minus_coby1
|
||||
// [10] (byte) e#2 ← (byte) e#1 - (byte) 39 [ x#1 cursor#2 e#2 y#1 ] // aby=zpby1_minus_coby1
|
||||
lda 5
|
||||
sec
|
||||
sbc #39
|
||||
sta 5
|
||||
B3_from_B2:
|
||||
// (byte) y#4 = (byte) y#1 // register copy zp byte:6
|
||||
// (byte) e#5 = (byte) e#2 // register copy zp byte:5
|
||||
// (byte) e#5 = (byte) e#2 // zpby1=aby
|
||||
sta 5
|
||||
// (byte*) cursor#5 = (byte*) cursor#2 // register copy zp ptr byte:2
|
||||
jmp B3
|
||||
|
||||
@ -1322,14 +1355,14 @@ B2:
|
||||
bcc !+
|
||||
inc 2+1
|
||||
!:
|
||||
// [10] (byte) e#2 ← (byte) e#1 - (byte) 39 [ x#1 cursor#2 e#2 y#1 ] // zpby1=zpby1_minus_coby1
|
||||
// [10] (byte) e#2 ← (byte) e#1 - (byte) 39 [ x#1 cursor#2 e#2 y#1 ] // aby=zpby1_minus_coby1
|
||||
lda 5
|
||||
sec
|
||||
sbc #39
|
||||
sta 5
|
||||
B3_from_B2:
|
||||
// (byte) y#4 = (byte) y#1 // register copy zp byte:6
|
||||
// (byte) e#5 = (byte) e#2 // register copy zp byte:5
|
||||
// (byte) e#5 = (byte) e#2 // zpby1=aby
|
||||
sta 5
|
||||
// (byte*) cursor#5 = (byte*) cursor#2 // register copy zp ptr byte:2
|
||||
jmp B3
|
||||
|
||||
@ -1348,7 +1381,7 @@ FINAL SYMBOL TABLE
|
||||
(byte*) cursor#5 zp ptr byte:2 16.5
|
||||
(byte) e
|
||||
(byte) e#1 zp byte:5 11.0
|
||||
(byte) e#2 zp byte:5 22.0
|
||||
(byte) e#2 reg byte a 22.0
|
||||
(byte) e#3 zp byte:5 5.5
|
||||
(byte) e#5 zp byte:5 16.5
|
||||
(byte) x
|
||||
@ -1434,14 +1467,14 @@ B2:
|
||||
bcc !+
|
||||
inc 2+1
|
||||
!:
|
||||
// [10] (byte) e#2 ← (byte) e#1 - (byte) 39 [ x#1 cursor#2 e#2 y#1 ] // zpby1=zpby1_minus_coby1
|
||||
// [10] (byte) e#2 ← (byte) e#1 - (byte) 39 [ x#1 cursor#2 e#2 y#1 ] // aby=zpby1_minus_coby1
|
||||
lda 5
|
||||
sec
|
||||
sbc #39
|
||||
sta 5
|
||||
B3_from_B2:
|
||||
// (byte) y#4 = (byte) y#1 // register copy zp byte:6
|
||||
// (byte) e#5 = (byte) e#2 // register copy zp byte:5
|
||||
// (byte) e#5 = (byte) e#2 // zpby1=aby
|
||||
sta 5
|
||||
// (byte*) cursor#5 = (byte*) cursor#2 // register copy zp ptr byte:2
|
||||
jmp B3
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
(byte*) cursor#5 zp ptr byte:2 16.5
|
||||
(byte) e
|
||||
(byte) e#1 zp byte:5 11.0
|
||||
(byte) e#2 zp byte:5 22.0
|
||||
(byte) e#2 reg byte a 22.0
|
||||
(byte) e#3 zp byte:5 5.5
|
||||
(byte) e#5 zp byte:5 16.5
|
||||
(byte) x
|
||||
|
@ -8,19 +8,17 @@ B1_from_BBEGIN:
|
||||
sta 2
|
||||
B1_from_B1:
|
||||
B1:
|
||||
ldy 2
|
||||
lda 4352,y
|
||||
ldx 2
|
||||
lda 4352,x
|
||||
sta 3
|
||||
ldy 2
|
||||
lda 4353,y
|
||||
sta 4
|
||||
lda 3
|
||||
ldx 2
|
||||
lda 4353,x
|
||||
clc
|
||||
adc 4
|
||||
adc 3
|
||||
sta 3
|
||||
lda 3
|
||||
ldy 2
|
||||
sta 4354,y
|
||||
ldx 2
|
||||
sta 4354,x
|
||||
inc 2
|
||||
lda 2
|
||||
cmp #15
|
||||
|
@ -446,6 +446,20 @@ zp byte:4 [ $3 ]
|
||||
Re-allocated ZP register from zp byte:2 to zp byte:2
|
||||
Re-allocated ZP register from zp byte:3 to zp byte:3
|
||||
Re-allocated ZP register from zp byte:4 to zp byte:4
|
||||
Uplifting of variable (byte~) $3 to A
|
||||
REGISTER UPLIFTING
|
||||
(byte~) $1 zp byte:3 11.0
|
||||
(byte~) $3 reg byte a 22.0
|
||||
(byte~) $4 zp byte:3 22.0
|
||||
(byte[15]) fibs
|
||||
(byte) i
|
||||
(byte) i#1 zp byte:2 16.5
|
||||
(byte) i#2 zp byte:2 11.0
|
||||
|
||||
zp byte:2 [ i#2 i#1 ]
|
||||
zp byte:3 [ $1 $4 ]
|
||||
zp byte:4 [ $3 ]
|
||||
|
||||
INITIAL ASM
|
||||
BBEGIN:
|
||||
// [0] *((word) 4352) ← (byte) 0 [ ] // coptr1=coby2
|
||||
@ -464,22 +478,20 @@ B1_from_B1:
|
||||
jmp B1
|
||||
B1:
|
||||
// [3] (byte~) $1 ← (word) 4352 *idx (byte) i#2 [ i#2 $1 ] // zpby1=cowo1_staridx_zpby2
|
||||
ldy 2
|
||||
lda 4352,y
|
||||
ldx 2
|
||||
lda 4352,x
|
||||
sta 3
|
||||
// [4] (byte~) $3 ← (word) 4353 *idx (byte) i#2 [ i#2 $1 $3 ] // zpby1=cowo1_staridx_zpby2
|
||||
ldy 2
|
||||
lda 4353,y
|
||||
sta 4
|
||||
// [5] (byte~) $4 ← (byte~) $1 + (byte~) $3 [ i#2 $4 ] // zpby1=zpby1_plus_zpby2
|
||||
lda 3
|
||||
// [4] (byte~) $3 ← (word) 4353 *idx (byte) i#2 [ i#2 $1 $3 ] // aby=cowo1_staridx_zpby1
|
||||
ldx 2
|
||||
lda 4353,x
|
||||
// [5] (byte~) $4 ← (byte~) $1 + (byte~) $3 [ i#2 $4 ] // zpby1=zpby1_plus_aby
|
||||
clc
|
||||
adc 4
|
||||
adc 3
|
||||
sta 3
|
||||
// [6] *((word) 4354 + (byte) i#2) ← (byte~) $4 [ i#2 ] // ptr_cowo1_zpby1=zpby2
|
||||
lda 3
|
||||
ldy 2
|
||||
sta 4354,y
|
||||
ldx 2
|
||||
sta 4354,x
|
||||
// [7] (byte) i#1 ← (byte) i#2 + (byte) 1 [ i#1 ] // zpby1=zpby1_plus_1
|
||||
inc 2
|
||||
// [8] if((byte) i#1<(byte) 15) goto @1 [ i#1 ] // zpby1_lt_coby1_then_la1
|
||||
@ -509,22 +521,20 @@ B1_from_B1:
|
||||
// (byte) i#2 = (byte) i#1 // register copy zp byte:2
|
||||
B1:
|
||||
// [3] (byte~) $1 ← (word) 4352 *idx (byte) i#2 [ i#2 $1 ] // zpby1=cowo1_staridx_zpby2
|
||||
ldy 2
|
||||
lda 4352,y
|
||||
ldx 2
|
||||
lda 4352,x
|
||||
sta 3
|
||||
// [4] (byte~) $3 ← (word) 4353 *idx (byte) i#2 [ i#2 $1 $3 ] // zpby1=cowo1_staridx_zpby2
|
||||
ldy 2
|
||||
lda 4353,y
|
||||
sta 4
|
||||
// [5] (byte~) $4 ← (byte~) $1 + (byte~) $3 [ i#2 $4 ] // zpby1=zpby1_plus_zpby2
|
||||
lda 3
|
||||
// [4] (byte~) $3 ← (word) 4353 *idx (byte) i#2 [ i#2 $1 $3 ] // aby=cowo1_staridx_zpby1
|
||||
ldx 2
|
||||
lda 4353,x
|
||||
// [5] (byte~) $4 ← (byte~) $1 + (byte~) $3 [ i#2 $4 ] // zpby1=zpby1_plus_aby
|
||||
clc
|
||||
adc 4
|
||||
adc 3
|
||||
sta 3
|
||||
// [6] *((word) 4354 + (byte) i#2) ← (byte~) $4 [ i#2 ] // ptr_cowo1_zpby1=zpby2
|
||||
lda 3
|
||||
ldy 2
|
||||
sta 4354,y
|
||||
ldx 2
|
||||
sta 4354,x
|
||||
// [7] (byte) i#1 ← (byte) i#2 + (byte) 1 [ i#1 ] // zpby1=zpby1_plus_1
|
||||
inc 2
|
||||
// [8] if((byte) i#1<(byte) 15) goto @1 [ i#1 ] // zpby1_lt_coby1_then_la1
|
||||
@ -551,22 +561,20 @@ B1_from_B1:
|
||||
// (byte) i#2 = (byte) i#1 // register copy zp byte:2
|
||||
B1:
|
||||
// [3] (byte~) $1 ← (word) 4352 *idx (byte) i#2 [ i#2 $1 ] // zpby1=cowo1_staridx_zpby2
|
||||
ldy 2
|
||||
lda 4352,y
|
||||
ldx 2
|
||||
lda 4352,x
|
||||
sta 3
|
||||
// [4] (byte~) $3 ← (word) 4353 *idx (byte) i#2 [ i#2 $1 $3 ] // zpby1=cowo1_staridx_zpby2
|
||||
ldy 2
|
||||
lda 4353,y
|
||||
sta 4
|
||||
// [5] (byte~) $4 ← (byte~) $1 + (byte~) $3 [ i#2 $4 ] // zpby1=zpby1_plus_zpby2
|
||||
lda 3
|
||||
// [4] (byte~) $3 ← (word) 4353 *idx (byte) i#2 [ i#2 $1 $3 ] // aby=cowo1_staridx_zpby1
|
||||
ldx 2
|
||||
lda 4353,x
|
||||
// [5] (byte~) $4 ← (byte~) $1 + (byte~) $3 [ i#2 $4 ] // zpby1=zpby1_plus_aby
|
||||
clc
|
||||
adc 4
|
||||
adc 3
|
||||
sta 3
|
||||
// [6] *((word) 4354 + (byte) i#2) ← (byte~) $4 [ i#2 ] // ptr_cowo1_zpby1=zpby2
|
||||
lda 3
|
||||
ldy 2
|
||||
sta 4354,y
|
||||
ldx 2
|
||||
sta 4354,x
|
||||
// [7] (byte) i#1 ← (byte) i#2 + (byte) 1 [ i#1 ] // zpby1=zpby1_plus_1
|
||||
inc 2
|
||||
// [8] if((byte) i#1<(byte) 15) goto @1 [ i#1 ] // zpby1_lt_coby1_then_la1
|
||||
@ -577,7 +585,7 @@ BEND:
|
||||
|
||||
FINAL SYMBOL TABLE
|
||||
(byte~) $1 zp byte:3 11.0
|
||||
(byte~) $3 zp byte:4 22.0
|
||||
(byte~) $3 reg byte a 22.0
|
||||
(byte~) $4 zp byte:3 22.0
|
||||
(label) @1
|
||||
(label) @BEGIN
|
||||
@ -607,22 +615,20 @@ B1_from_B1:
|
||||
// (byte) i#2 = (byte) i#1 // register copy zp byte:2
|
||||
B1:
|
||||
// [3] (byte~) $1 ← (word) 4352 *idx (byte) i#2 [ i#2 $1 ] // zpby1=cowo1_staridx_zpby2
|
||||
ldy 2
|
||||
lda 4352,y
|
||||
ldx 2
|
||||
lda 4352,x
|
||||
sta 3
|
||||
// [4] (byte~) $3 ← (word) 4353 *idx (byte) i#2 [ i#2 $1 $3 ] // zpby1=cowo1_staridx_zpby2
|
||||
ldy 2
|
||||
lda 4353,y
|
||||
sta 4
|
||||
// [5] (byte~) $4 ← (byte~) $1 + (byte~) $3 [ i#2 $4 ] // zpby1=zpby1_plus_zpby2
|
||||
lda 3
|
||||
// [4] (byte~) $3 ← (word) 4353 *idx (byte) i#2 [ i#2 $1 $3 ] // aby=cowo1_staridx_zpby1
|
||||
ldx 2
|
||||
lda 4353,x
|
||||
// [5] (byte~) $4 ← (byte~) $1 + (byte~) $3 [ i#2 $4 ] // zpby1=zpby1_plus_aby
|
||||
clc
|
||||
adc 4
|
||||
adc 3
|
||||
sta 3
|
||||
// [6] *((word) 4354 + (byte) i#2) ← (byte~) $4 [ i#2 ] // ptr_cowo1_zpby1=zpby2
|
||||
lda 3
|
||||
ldy 2
|
||||
sta 4354,y
|
||||
ldx 2
|
||||
sta 4354,x
|
||||
// [7] (byte) i#1 ← (byte) i#2 + (byte) 1 [ i#1 ] // zpby1=zpby1_plus_1
|
||||
inc 2
|
||||
// [8] if((byte) i#1<(byte) 15) goto @1 [ i#1 ] // zpby1_lt_coby1_then_la1
|
||||
|
@ -1,5 +1,5 @@
|
||||
(byte~) $1 zp byte:3 11.0
|
||||
(byte~) $3 zp byte:4 22.0
|
||||
(byte~) $3 reg byte a 22.0
|
||||
(byte~) $4 zp byte:3 22.0
|
||||
(label) @1
|
||||
(label) @BEGIN
|
||||
|
@ -14,14 +14,12 @@ main__B3_from_B3:
|
||||
main__B3_from_B6:
|
||||
main__B3:
|
||||
lda 53266
|
||||
sta 5
|
||||
lda 5
|
||||
cmp #254
|
||||
bne main__B3_from_B3
|
||||
main__B4:
|
||||
lda 53266
|
||||
sta 5
|
||||
lda 5
|
||||
sta 15
|
||||
lda 15
|
||||
cmp #255
|
||||
bne main__B4
|
||||
main__B6:
|
||||
@ -39,29 +37,29 @@ main__Breturn:
|
||||
plot:
|
||||
plot__B1_from_plot:
|
||||
lda #16
|
||||
sta 2
|
||||
sta 5
|
||||
lda #<1236
|
||||
sta 3
|
||||
lda #>1236
|
||||
sta 3+1
|
||||
lda #0
|
||||
sta 5
|
||||
sta 6
|
||||
plot__B1_from_B3:
|
||||
plot__B1:
|
||||
plot__B2_from_B1:
|
||||
lda #0
|
||||
sta 6
|
||||
sta 7
|
||||
plot__B2_from_B2:
|
||||
plot__B2:
|
||||
ldy 5
|
||||
lda 4096,y
|
||||
sta 7
|
||||
lda 7
|
||||
ldy 6
|
||||
ldx 6
|
||||
lda 4096,x
|
||||
sta 16
|
||||
lda 16
|
||||
ldy 7
|
||||
sta (3),y
|
||||
inc 5
|
||||
inc 6
|
||||
lda 6
|
||||
inc 7
|
||||
lda 7
|
||||
cmp #16
|
||||
bcc plot__B2_from_B2
|
||||
plot__B3:
|
||||
@ -72,72 +70,72 @@ plot__B3:
|
||||
bcc !+
|
||||
inc 3+1
|
||||
!:
|
||||
dec 2
|
||||
lda 2
|
||||
dec 5
|
||||
lda 5
|
||||
bne plot__B1_from_B3
|
||||
plot__Breturn:
|
||||
rts
|
||||
flip:
|
||||
flip__B1_from_flip:
|
||||
lda #16
|
||||
sta 2
|
||||
sta 8
|
||||
lda #15
|
||||
sta 6
|
||||
sta 10
|
||||
lda #0
|
||||
sta 5
|
||||
sta 9
|
||||
flip__B1_from_B4:
|
||||
flip__B1:
|
||||
flip__B2_from_B1:
|
||||
lda #16
|
||||
sta 7
|
||||
sta 11
|
||||
flip__B2_from_B2:
|
||||
flip__B2:
|
||||
ldy 5
|
||||
lda 4096,y
|
||||
sta 8
|
||||
lda 8
|
||||
ldy 6
|
||||
sta 4352,y
|
||||
inc 5
|
||||
lda 6
|
||||
ldx 9
|
||||
lda 4096,x
|
||||
sta 17
|
||||
lda 17
|
||||
ldx 10
|
||||
sta 4352,x
|
||||
inc 9
|
||||
lda 10
|
||||
clc
|
||||
adc #16
|
||||
sta 6
|
||||
dec 7
|
||||
lda 7
|
||||
sta 10
|
||||
dec 11
|
||||
lda 11
|
||||
bne flip__B2_from_B2
|
||||
flip__B4:
|
||||
dec 6
|
||||
dec 2
|
||||
lda 2
|
||||
dec 10
|
||||
dec 8
|
||||
lda 8
|
||||
bne flip__B1_from_B4
|
||||
flip__B3_from_B4:
|
||||
lda #0
|
||||
sta 2
|
||||
sta 12
|
||||
flip__B3_from_B3:
|
||||
flip__B3:
|
||||
ldy 2
|
||||
lda 4352,y
|
||||
sta 5
|
||||
lda 5
|
||||
ldy 2
|
||||
sta 4096,y
|
||||
inc 2
|
||||
lda 2
|
||||
ldx 12
|
||||
lda 4352,x
|
||||
sta 18
|
||||
lda 18
|
||||
ldx 12
|
||||
sta 4096,x
|
||||
inc 12
|
||||
lda 12
|
||||
bne flip__B3_from_B3
|
||||
flip__Breturn:
|
||||
rts
|
||||
prepare:
|
||||
prepare__B1_from_prepare:
|
||||
lda #0
|
||||
sta 2
|
||||
sta 13
|
||||
prepare__B1_from_B1:
|
||||
prepare__B1:
|
||||
ldy 2
|
||||
tya
|
||||
sta 4096,y
|
||||
inc 2
|
||||
lda 2
|
||||
ldx 13
|
||||
txa
|
||||
sta 4096,x
|
||||
inc 13
|
||||
lda 13
|
||||
bne prepare__B1_from_B1
|
||||
prepare__Breturn:
|
||||
rts
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -5,34 +5,34 @@
|
||||
(byte[256]) buffer1
|
||||
(byte[256]) buffer2
|
||||
(void()) flip()
|
||||
(byte~) flip::$0 zp byte:8 2002.0
|
||||
(byte~) flip::$4 zp byte:5 202.0
|
||||
(byte~) flip::$0 zp byte:17 2002.0
|
||||
(byte~) flip::$4 zp byte:18 202.0
|
||||
(label) flip::@1
|
||||
(label) flip::@2
|
||||
(label) flip::@3
|
||||
(label) flip::@4
|
||||
(label) flip::@return
|
||||
(byte) flip::c
|
||||
(byte) flip::c#1 zp byte:7 1501.5
|
||||
(byte) flip::c#2 zp byte:7 400.4
|
||||
(byte) flip::c#1 zp byte:11 1501.5
|
||||
(byte) flip::c#2 zp byte:11 400.4
|
||||
(byte) flip::dstIdx
|
||||
(byte) flip::dstIdx#1 zp byte:6 701.0
|
||||
(byte) flip::dstIdx#2 zp byte:6 67.33333333333333
|
||||
(byte) flip::dstIdx#3 zp byte:6 776.0
|
||||
(byte) flip::dstIdx#5 zp byte:6 202.0
|
||||
(byte) flip::dstIdx#1 zp byte:10 701.0
|
||||
(byte) flip::dstIdx#2 zp byte:10 67.33333333333333
|
||||
(byte) flip::dstIdx#3 zp byte:10 776.0
|
||||
(byte) flip::dstIdx#5 zp byte:10 202.0
|
||||
(byte) flip::i
|
||||
(byte) flip::i#1 zp byte:2 151.5
|
||||
(byte) flip::i#2 zp byte:2 134.66666666666666
|
||||
(byte) flip::i#1 zp byte:12 151.5
|
||||
(byte) flip::i#2 zp byte:12 134.66666666666666
|
||||
(byte) flip::r
|
||||
(byte) flip::r#1 zp byte:2 151.5
|
||||
(byte) flip::r#2 zp byte:2 22.444444444444443
|
||||
(byte) flip::r#1 zp byte:8 151.5
|
||||
(byte) flip::r#2 zp byte:8 22.444444444444443
|
||||
(byte) flip::srcIdx
|
||||
(byte) flip::srcIdx#1 zp byte:5 300.42857142857144
|
||||
(byte) flip::srcIdx#2 zp byte:5 1034.6666666666667
|
||||
(byte) flip::srcIdx#3 zp byte:5 202.0
|
||||
(byte) flip::srcIdx#1 zp byte:9 300.42857142857144
|
||||
(byte) flip::srcIdx#2 zp byte:9 1034.6666666666667
|
||||
(byte) flip::srcIdx#3 zp byte:9 202.0
|
||||
(void()) main()
|
||||
(byte~) main::$1 zp byte:5 2002.0
|
||||
(byte~) main::$3 zp byte:5 2002.0
|
||||
(byte~) main::$1 reg byte a 2002.0
|
||||
(byte~) main::$3 zp byte:15 2002.0
|
||||
(label) main::@10
|
||||
(label) main::@11
|
||||
(label) main::@3
|
||||
@ -44,30 +44,30 @@
|
||||
(byte) main::c#1 zp byte:2 151.5
|
||||
(byte) main::c#2 zp byte:2 40.4
|
||||
(void()) plot()
|
||||
(byte~) plot::$3 zp byte:7 2002.0
|
||||
(byte~) plot::$3 zp byte:16 2002.0
|
||||
(label) plot::@1
|
||||
(label) plot::@2
|
||||
(label) plot::@3
|
||||
(label) plot::@return
|
||||
(byte) plot::i
|
||||
(byte) plot::i#1 zp byte:5 350.5
|
||||
(byte) plot::i#2 zp byte:5 1034.6666666666667
|
||||
(byte) plot::i#3 zp byte:5 202.0
|
||||
(byte) plot::i#1 zp byte:6 350.5
|
||||
(byte) plot::i#2 zp byte:6 1034.6666666666667
|
||||
(byte) plot::i#3 zp byte:6 202.0
|
||||
(byte*) plot::line
|
||||
(byte*) plot::line#1 zp ptr byte:3 67.33333333333333
|
||||
(byte*) plot::line#2 zp ptr byte:3 171.85714285714283
|
||||
(byte) plot::x
|
||||
(byte) plot::x#1 zp byte:6 1501.5
|
||||
(byte) plot::x#2 zp byte:6 750.75
|
||||
(byte) plot::x#1 zp byte:7 1501.5
|
||||
(byte) plot::x#2 zp byte:7 750.75
|
||||
(byte) plot::y
|
||||
(byte) plot::y#1 zp byte:2 151.5
|
||||
(byte) plot::y#2 zp byte:2 25.25
|
||||
(byte) plot::y#1 zp byte:5 151.5
|
||||
(byte) plot::y#2 zp byte:5 25.25
|
||||
(void()) prepare()
|
||||
(label) prepare::@1
|
||||
(label) prepare::@return
|
||||
(byte) prepare::i
|
||||
(byte) prepare::i#1 zp byte:2 16.5
|
||||
(byte) prepare::i#2 zp byte:2 22.0
|
||||
(byte) prepare::i#1 zp byte:13 16.5
|
||||
(byte) prepare::i#2 zp byte:13 22.0
|
||||
|
||||
zp byte:2 [ main::c#2 main::c#1 plot::y#2 plot::y#1 flip::r#2 flip::r#1 flip::i#2 flip::i#1 prepare::i#2 prepare::i#1 ]
|
||||
zp ptr byte:3 [ plot::line#2 plot::line#1 ]
|
||||
|
@ -21,6 +21,6 @@ B2:
|
||||
lda 3
|
||||
clc
|
||||
adc 2
|
||||
sta 3
|
||||
B3_from_B2:
|
||||
sta 3
|
||||
jmp B3
|
||||
|
@ -386,6 +386,19 @@ zp byte:3 [ s#2 s#4 s#1 ]
|
||||
|
||||
Re-allocated ZP register from zp byte:2 to zp byte:2
|
||||
Re-allocated ZP register from zp byte:3 to zp byte:3
|
||||
Uplifting of variable (byte) s#1 to A
|
||||
REGISTER UPLIFTING
|
||||
(byte) i
|
||||
(byte) i#1 zp byte:2 16.5
|
||||
(byte) i#2 zp byte:2 11.0
|
||||
(byte) s
|
||||
(byte) s#1 reg byte a 22.0
|
||||
(byte) s#2 zp byte:3 16.5
|
||||
(byte) s#4 zp byte:3 11.0
|
||||
|
||||
zp byte:2 [ i#2 i#1 ]
|
||||
zp byte:3 [ s#2 s#4 s#1 ]
|
||||
|
||||
INITIAL ASM
|
||||
BBEGIN:
|
||||
B1_from_BBEGIN:
|
||||
@ -419,13 +432,13 @@ B3:
|
||||
jmp BEND
|
||||
BEND:
|
||||
B2:
|
||||
// [5] (byte) s#1 ← (byte) s#2 + (byte) i#2 [ i#2 s#1 ] // zpby1=zpby1_plus_zpby2
|
||||
// [5] (byte) s#1 ← (byte) s#2 + (byte) i#2 [ i#2 s#1 ] // aby=zpby1_plus_zpby2
|
||||
lda 3
|
||||
clc
|
||||
adc 2
|
||||
sta 3
|
||||
B3_from_B2:
|
||||
// (byte) s#4 = (byte) s#1 // register copy zp byte:3
|
||||
// (byte) s#4 = (byte) s#1 // zpby1=aby
|
||||
sta 3
|
||||
jmp B3
|
||||
|
||||
Removing instruction jmp B1
|
||||
@ -462,13 +475,13 @@ B3:
|
||||
bne B1_from_B3
|
||||
BEND:
|
||||
B2:
|
||||
// [5] (byte) s#1 ← (byte) s#2 + (byte) i#2 [ i#2 s#1 ] // zpby1=zpby1_plus_zpby2
|
||||
// [5] (byte) s#1 ← (byte) s#2 + (byte) i#2 [ i#2 s#1 ] // aby=zpby1_plus_zpby2
|
||||
lda 3
|
||||
clc
|
||||
adc 2
|
||||
sta 3
|
||||
B3_from_B2:
|
||||
// (byte) s#4 = (byte) s#1 // register copy zp byte:3
|
||||
// (byte) s#4 = (byte) s#1 // zpby1=aby
|
||||
sta 3
|
||||
jmp B3
|
||||
|
||||
Removing instruction jmp B1
|
||||
@ -502,13 +515,13 @@ B3:
|
||||
bne B1_from_B3
|
||||
BEND:
|
||||
B2:
|
||||
// [5] (byte) s#1 ← (byte) s#2 + (byte) i#2 [ i#2 s#1 ] // zpby1=zpby1_plus_zpby2
|
||||
// [5] (byte) s#1 ← (byte) s#2 + (byte) i#2 [ i#2 s#1 ] // aby=zpby1_plus_zpby2
|
||||
lda 3
|
||||
clc
|
||||
adc 2
|
||||
sta 3
|
||||
B3_from_B2:
|
||||
// (byte) s#4 = (byte) s#1 // register copy zp byte:3
|
||||
// (byte) s#4 = (byte) s#1 // zpby1=aby
|
||||
sta 3
|
||||
jmp B3
|
||||
|
||||
FINAL SYMBOL TABLE
|
||||
@ -521,7 +534,7 @@ FINAL SYMBOL TABLE
|
||||
(byte) i#1 zp byte:2 16.5
|
||||
(byte) i#2 zp byte:2 11.0
|
||||
(byte) s
|
||||
(byte) s#1 zp byte:3 22.0
|
||||
(byte) s#1 reg byte a 22.0
|
||||
(byte) s#2 zp byte:3 16.5
|
||||
(byte) s#4 zp byte:3 11.0
|
||||
|
||||
@ -557,12 +570,12 @@ B3:
|
||||
bne B1_from_B3
|
||||
BEND:
|
||||
B2:
|
||||
// [5] (byte) s#1 ← (byte) s#2 + (byte) i#2 [ i#2 s#1 ] // zpby1=zpby1_plus_zpby2
|
||||
// [5] (byte) s#1 ← (byte) s#2 + (byte) i#2 [ i#2 s#1 ] // aby=zpby1_plus_zpby2
|
||||
lda 3
|
||||
clc
|
||||
adc 2
|
||||
sta 3
|
||||
B3_from_B2:
|
||||
// (byte) s#4 = (byte) s#1 // register copy zp byte:3
|
||||
// (byte) s#4 = (byte) s#1 // zpby1=aby
|
||||
sta 3
|
||||
jmp B3
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
(byte) i#1 zp byte:2 16.5
|
||||
(byte) i#2 zp byte:2 11.0
|
||||
(byte) s
|
||||
(byte) s#1 zp byte:3 22.0
|
||||
(byte) s#1 reg byte a 22.0
|
||||
(byte) s#2 zp byte:3 16.5
|
||||
(byte) s#4 zp byte:3 11.0
|
||||
|
||||
|
@ -18,12 +18,16 @@ nest:
|
||||
nest__B1_from_nest:
|
||||
lda #100
|
||||
sta 3
|
||||
jmp nest__B1
|
||||
nest__B1_from_B1:
|
||||
sta 3
|
||||
nest__B1:
|
||||
lda 3
|
||||
sta 1024
|
||||
dec 3
|
||||
lda 3
|
||||
sec
|
||||
sbc #1
|
||||
cmp #0
|
||||
bne nest__B1_from_B1
|
||||
nest__Breturn:
|
||||
rts
|
||||
|
@ -736,6 +736,21 @@ zp byte:3 [ nest::j#2 nest::j#1 ]
|
||||
|
||||
Re-allocated ZP register from zp byte:2 to zp byte:2
|
||||
Re-allocated ZP register from zp byte:3 to zp byte:3
|
||||
Uplifting of variable (byte) nest::j#1 to A
|
||||
REGISTER UPLIFTING
|
||||
(byte*) SCREEN
|
||||
(void()) main()
|
||||
(byte) main::i
|
||||
(byte) main::i#1 zp byte:2 16.5
|
||||
(byte) main::i#2 zp byte:2 3.142857142857143
|
||||
(void()) nest()
|
||||
(byte) nest::j
|
||||
(byte) nest::j#1 reg byte a 151.5
|
||||
(byte) nest::j#2 zp byte:3 151.5
|
||||
|
||||
zp byte:2 [ main::i#2 main::i#1 ]
|
||||
zp byte:3 [ nest::j#2 nest::j#1 ]
|
||||
|
||||
INITIAL ASM
|
||||
BBEGIN:
|
||||
jsr main
|
||||
@ -769,16 +784,19 @@ nest__B1_from_nest:
|
||||
sta 3
|
||||
jmp nest__B1
|
||||
nest__B1_from_B1:
|
||||
// (byte) nest::j#2 = (byte) nest::j#1 // register copy zp byte:3
|
||||
// (byte) nest::j#2 = (byte) nest::j#1 // zpby1=aby
|
||||
sta 3
|
||||
jmp nest__B1
|
||||
nest__B1:
|
||||
// [7] *((word) 1024) ← (byte) nest::j#2 [ main::i#2 nest::j#2 ] // coptr1=zpby1
|
||||
lda 3
|
||||
sta 1024
|
||||
// [8] (byte) nest::j#1 ← -- (byte) nest::j#2 [ main::i#2 nest::j#1 ] // zpby1=_dec_zpby1
|
||||
dec 3
|
||||
// [9] if((byte) nest::j#1>(byte) 0) goto nest::@1 [ main::i#2 nest::j#1 ] // zpby1_gt_0_then_la1
|
||||
// [8] (byte) nest::j#1 ← -- (byte) nest::j#2 [ main::i#2 nest::j#1 ] // aby=_dec_zpby1
|
||||
lda 3
|
||||
sec
|
||||
sbc #1
|
||||
// [9] if((byte) nest::j#1>(byte) 0) goto nest::@1 [ main::i#2 nest::j#1 ] // aby_gt_0_then_la1
|
||||
cmp #0
|
||||
bne nest__B1_from_B1
|
||||
jmp nest__Breturn
|
||||
nest__Breturn:
|
||||
@ -820,21 +838,23 @@ nest__B1_from_nest:
|
||||
sta 3
|
||||
jmp nest__B1
|
||||
nest__B1_from_B1:
|
||||
// (byte) nest::j#2 = (byte) nest::j#1 // register copy zp byte:3
|
||||
// (byte) nest::j#2 = (byte) nest::j#1 // zpby1=aby
|
||||
sta 3
|
||||
nest__B1:
|
||||
// [7] *((word) 1024) ← (byte) nest::j#2 [ main::i#2 nest::j#2 ] // coptr1=zpby1
|
||||
lda 3
|
||||
sta 1024
|
||||
// [8] (byte) nest::j#1 ← -- (byte) nest::j#2 [ main::i#2 nest::j#1 ] // zpby1=_dec_zpby1
|
||||
dec 3
|
||||
// [9] if((byte) nest::j#1>(byte) 0) goto nest::@1 [ main::i#2 nest::j#1 ] // zpby1_gt_0_then_la1
|
||||
// [8] (byte) nest::j#1 ← -- (byte) nest::j#2 [ main::i#2 nest::j#1 ] // aby=_dec_zpby1
|
||||
lda 3
|
||||
sec
|
||||
sbc #1
|
||||
// [9] if((byte) nest::j#1>(byte) 0) goto nest::@1 [ main::i#2 nest::j#1 ] // aby_gt_0_then_la1
|
||||
cmp #0
|
||||
bne nest__B1_from_B1
|
||||
nest__Breturn:
|
||||
rts
|
||||
|
||||
Removing instruction jmp main__B1
|
||||
Removing instruction jmp nest__B1
|
||||
Succesful ASM optimization Pass5NextJumpElimination
|
||||
ASSEMBLER
|
||||
BBEGIN:
|
||||
@ -862,16 +882,20 @@ nest__B1_from_nest:
|
||||
// (byte) nest::j#2 = (byte) 100 // zpby1=coby1
|
||||
lda #100
|
||||
sta 3
|
||||
jmp nest__B1
|
||||
nest__B1_from_B1:
|
||||
// (byte) nest::j#2 = (byte) nest::j#1 // register copy zp byte:3
|
||||
// (byte) nest::j#2 = (byte) nest::j#1 // zpby1=aby
|
||||
sta 3
|
||||
nest__B1:
|
||||
// [7] *((word) 1024) ← (byte) nest::j#2 [ main::i#2 nest::j#2 ] // coptr1=zpby1
|
||||
lda 3
|
||||
sta 1024
|
||||
// [8] (byte) nest::j#1 ← -- (byte) nest::j#2 [ main::i#2 nest::j#1 ] // zpby1=_dec_zpby1
|
||||
dec 3
|
||||
// [9] if((byte) nest::j#1>(byte) 0) goto nest::@1 [ main::i#2 nest::j#1 ] // zpby1_gt_0_then_la1
|
||||
// [8] (byte) nest::j#1 ← -- (byte) nest::j#2 [ main::i#2 nest::j#1 ] // aby=_dec_zpby1
|
||||
lda 3
|
||||
sec
|
||||
sbc #1
|
||||
// [9] if((byte) nest::j#1>(byte) 0) goto nest::@1 [ main::i#2 nest::j#1 ] // aby_gt_0_then_la1
|
||||
cmp #0
|
||||
bne nest__B1_from_B1
|
||||
nest__Breturn:
|
||||
rts
|
||||
@ -891,7 +915,7 @@ FINAL SYMBOL TABLE
|
||||
(label) nest::@1
|
||||
(label) nest::@return
|
||||
(byte) nest::j
|
||||
(byte) nest::j#1 zp byte:3 151.5
|
||||
(byte) nest::j#1 reg byte a 151.5
|
||||
(byte) nest::j#2 zp byte:3 151.5
|
||||
|
||||
zp byte:2 [ main::i#2 main::i#1 ]
|
||||
@ -923,16 +947,20 @@ nest__B1_from_nest:
|
||||
// (byte) nest::j#2 = (byte) 100 // zpby1=coby1
|
||||
lda #100
|
||||
sta 3
|
||||
jmp nest__B1
|
||||
nest__B1_from_B1:
|
||||
// (byte) nest::j#2 = (byte) nest::j#1 // register copy zp byte:3
|
||||
// (byte) nest::j#2 = (byte) nest::j#1 // zpby1=aby
|
||||
sta 3
|
||||
nest__B1:
|
||||
// [7] *((word) 1024) ← (byte) nest::j#2 [ main::i#2 nest::j#2 ] // coptr1=zpby1
|
||||
lda 3
|
||||
sta 1024
|
||||
// [8] (byte) nest::j#1 ← -- (byte) nest::j#2 [ main::i#2 nest::j#1 ] // zpby1=_dec_zpby1
|
||||
dec 3
|
||||
// [9] if((byte) nest::j#1>(byte) 0) goto nest::@1 [ main::i#2 nest::j#1 ] // zpby1_gt_0_then_la1
|
||||
// [8] (byte) nest::j#1 ← -- (byte) nest::j#2 [ main::i#2 nest::j#1 ] // aby=_dec_zpby1
|
||||
lda 3
|
||||
sec
|
||||
sbc #1
|
||||
// [9] if((byte) nest::j#1>(byte) 0) goto nest::@1 [ main::i#2 nest::j#1 ] // aby_gt_0_then_la1
|
||||
cmp #0
|
||||
bne nest__B1_from_B1
|
||||
nest__Breturn:
|
||||
rts
|
||||
|
@ -12,7 +12,7 @@
|
||||
(label) nest::@1
|
||||
(label) nest::@return
|
||||
(byte) nest::j
|
||||
(byte) nest::j#1 zp byte:3 151.5
|
||||
(byte) nest::j#1 reg byte a 151.5
|
||||
(byte) nest::j#2 zp byte:3 151.5
|
||||
|
||||
zp byte:2 [ main::i#2 main::i#1 ]
|
||||
|
@ -54,12 +54,16 @@ nest2__B1:
|
||||
nest2__B2_from_B1:
|
||||
lda #100
|
||||
sta 7
|
||||
jmp nest2__B2
|
||||
nest2__B2_from_B2:
|
||||
sta 7
|
||||
nest2__B2:
|
||||
lda 7
|
||||
sta 1024
|
||||
dec 7
|
||||
lda 7
|
||||
sec
|
||||
sbc #1
|
||||
cmp #0
|
||||
bne nest2__B2_from_B2
|
||||
nest2__B3:
|
||||
dec 6
|
||||
|
@ -1855,6 +1855,38 @@ Re-allocated ZP register from zp byte:4 to zp byte:4
|
||||
Re-allocated ZP register from zp byte:5 to zp byte:5
|
||||
Re-allocated ZP register from zp byte:6 to zp byte:6
|
||||
Re-allocated ZP register from zp byte:7 to zp byte:7
|
||||
Uplifting of variable (byte) nest2::j#1 to A
|
||||
REGISTER UPLIFTING
|
||||
(byte*) SCREEN
|
||||
(void()) main()
|
||||
(byte) main::i
|
||||
(byte) main::i#1 zp byte:2 16.5
|
||||
(byte) main::i#2 zp byte:2 1.0476190476190477
|
||||
(byte) main::j
|
||||
(byte) main::j#1 zp byte:3 151.5
|
||||
(byte) main::j#2 zp byte:3 11.222222222222221
|
||||
(void()) nest1()
|
||||
(byte) nest1::i
|
||||
(byte) nest1::i#1 zp byte:4 1501.5
|
||||
(byte) nest1::i#2 zp byte:4 154.0
|
||||
(byte) nest1::j
|
||||
(byte) nest1::j#1 zp byte:5 15001.5
|
||||
(byte) nest1::j#2 zp byte:5 2000.2
|
||||
(void()) nest2()
|
||||
(byte) nest2::i
|
||||
(byte) nest2::i#1 zp byte:6 150001.5
|
||||
(byte) nest2::i#2 zp byte:6 40000.4
|
||||
(byte) nest2::j
|
||||
(byte) nest2::j#1 reg byte a 1500001.5
|
||||
(byte) nest2::j#2 zp byte:7 1500001.5
|
||||
|
||||
zp byte:2 [ main::i#2 main::i#1 ]
|
||||
zp byte:3 [ main::j#2 main::j#1 ]
|
||||
zp byte:4 [ nest1::i#2 nest1::i#1 ]
|
||||
zp byte:5 [ nest1::j#2 nest1::j#1 ]
|
||||
zp byte:6 [ nest2::i#2 nest2::i#1 ]
|
||||
zp byte:7 [ nest2::j#2 nest2::j#1 ]
|
||||
|
||||
INITIAL ASM
|
||||
BBEGIN:
|
||||
jsr main
|
||||
@ -1950,16 +1982,19 @@ nest2__B2_from_B1:
|
||||
sta 7
|
||||
jmp nest2__B2
|
||||
nest2__B2_from_B2:
|
||||
// (byte) nest2::j#2 = (byte) nest2::j#1 // register copy zp byte:7
|
||||
// (byte) nest2::j#2 = (byte) nest2::j#1 // zpby1=aby
|
||||
sta 7
|
||||
jmp nest2__B2
|
||||
nest2__B2:
|
||||
// [19] *((word) 1024) ← (byte) nest2::j#2 [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 nest2::j#2 nest2::i#2 ] // coptr1=zpby1
|
||||
lda 7
|
||||
sta 1024
|
||||
// [20] (byte) nest2::j#1 ← -- (byte) nest2::j#2 [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 nest2::j#1 nest2::i#2 ] // zpby1=_dec_zpby1
|
||||
dec 7
|
||||
// [21] if((byte) nest2::j#1>(byte) 0) goto nest2::@2 [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 nest2::j#1 nest2::i#2 ] // zpby1_gt_0_then_la1
|
||||
// [20] (byte) nest2::j#1 ← -- (byte) nest2::j#2 [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 nest2::j#1 nest2::i#2 ] // aby=_dec_zpby1
|
||||
lda 7
|
||||
sec
|
||||
sbc #1
|
||||
// [21] if((byte) nest2::j#1>(byte) 0) goto nest2::@2 [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 nest2::j#1 nest2::i#2 ] // aby_gt_0_then_la1
|
||||
cmp #0
|
||||
bne nest2__B2_from_B2
|
||||
jmp nest2__B3
|
||||
nest2__B3:
|
||||
@ -2071,15 +2106,18 @@ nest2__B2_from_B1:
|
||||
sta 7
|
||||
jmp nest2__B2
|
||||
nest2__B2_from_B2:
|
||||
// (byte) nest2::j#2 = (byte) nest2::j#1 // register copy zp byte:7
|
||||
// (byte) nest2::j#2 = (byte) nest2::j#1 // zpby1=aby
|
||||
sta 7
|
||||
nest2__B2:
|
||||
// [19] *((word) 1024) ← (byte) nest2::j#2 [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 nest2::j#2 nest2::i#2 ] // coptr1=zpby1
|
||||
lda 7
|
||||
sta 1024
|
||||
// [20] (byte) nest2::j#1 ← -- (byte) nest2::j#2 [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 nest2::j#1 nest2::i#2 ] // zpby1=_dec_zpby1
|
||||
dec 7
|
||||
// [21] if((byte) nest2::j#1>(byte) 0) goto nest2::@2 [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 nest2::j#1 nest2::i#2 ] // zpby1_gt_0_then_la1
|
||||
// [20] (byte) nest2::j#1 ← -- (byte) nest2::j#2 [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 nest2::j#1 nest2::i#2 ] // aby=_dec_zpby1
|
||||
lda 7
|
||||
sec
|
||||
sbc #1
|
||||
// [21] if((byte) nest2::j#1>(byte) 0) goto nest2::@2 [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 nest2::j#1 nest2::i#2 ] // aby_gt_0_then_la1
|
||||
cmp #0
|
||||
bne nest2__B2_from_B2
|
||||
nest2__B3:
|
||||
// [22] (byte) nest2::i#1 ← -- (byte) nest2::i#2 [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 nest2::i#1 ] // zpby1=_dec_zpby1
|
||||
@ -2095,7 +2133,6 @@ Removing instruction jmp main__B2
|
||||
Removing instruction jmp nest1__B1
|
||||
Removing instruction jmp nest1__B2
|
||||
Removing instruction jmp nest2__B1
|
||||
Removing instruction jmp nest2__B2
|
||||
Succesful ASM optimization Pass5NextJumpElimination
|
||||
ASSEMBLER
|
||||
BBEGIN:
|
||||
@ -2173,16 +2210,20 @@ nest2__B2_from_B1:
|
||||
// (byte) nest2::j#2 = (byte) 100 // zpby1=coby1
|
||||
lda #100
|
||||
sta 7
|
||||
jmp nest2__B2
|
||||
nest2__B2_from_B2:
|
||||
// (byte) nest2::j#2 = (byte) nest2::j#1 // register copy zp byte:7
|
||||
// (byte) nest2::j#2 = (byte) nest2::j#1 // zpby1=aby
|
||||
sta 7
|
||||
nest2__B2:
|
||||
// [19] *((word) 1024) ← (byte) nest2::j#2 [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 nest2::j#2 nest2::i#2 ] // coptr1=zpby1
|
||||
lda 7
|
||||
sta 1024
|
||||
// [20] (byte) nest2::j#1 ← -- (byte) nest2::j#2 [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 nest2::j#1 nest2::i#2 ] // zpby1=_dec_zpby1
|
||||
dec 7
|
||||
// [21] if((byte) nest2::j#1>(byte) 0) goto nest2::@2 [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 nest2::j#1 nest2::i#2 ] // zpby1_gt_0_then_la1
|
||||
// [20] (byte) nest2::j#1 ← -- (byte) nest2::j#2 [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 nest2::j#1 nest2::i#2 ] // aby=_dec_zpby1
|
||||
lda 7
|
||||
sec
|
||||
sbc #1
|
||||
// [21] if((byte) nest2::j#1>(byte) 0) goto nest2::@2 [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 nest2::j#1 nest2::i#2 ] // aby_gt_0_then_la1
|
||||
cmp #0
|
||||
bne nest2__B2_from_B2
|
||||
nest2__B3:
|
||||
// [22] (byte) nest2::i#1 ← -- (byte) nest2::i#2 [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 nest2::i#1 ] // zpby1=_dec_zpby1
|
||||
@ -2230,7 +2271,7 @@ FINAL SYMBOL TABLE
|
||||
(byte) nest2::i#1 zp byte:6 150001.5
|
||||
(byte) nest2::i#2 zp byte:6 40000.4
|
||||
(byte) nest2::j
|
||||
(byte) nest2::j#1 zp byte:7 1500001.5
|
||||
(byte) nest2::j#1 reg byte a 1500001.5
|
||||
(byte) nest2::j#2 zp byte:7 1500001.5
|
||||
|
||||
zp byte:2 [ main::i#2 main::i#1 ]
|
||||
@ -2316,16 +2357,20 @@ nest2__B2_from_B1:
|
||||
// (byte) nest2::j#2 = (byte) 100 // zpby1=coby1
|
||||
lda #100
|
||||
sta 7
|
||||
jmp nest2__B2
|
||||
nest2__B2_from_B2:
|
||||
// (byte) nest2::j#2 = (byte) nest2::j#1 // register copy zp byte:7
|
||||
// (byte) nest2::j#2 = (byte) nest2::j#1 // zpby1=aby
|
||||
sta 7
|
||||
nest2__B2:
|
||||
// [19] *((word) 1024) ← (byte) nest2::j#2 [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 nest2::j#2 nest2::i#2 ] // coptr1=zpby1
|
||||
lda 7
|
||||
sta 1024
|
||||
// [20] (byte) nest2::j#1 ← -- (byte) nest2::j#2 [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 nest2::j#1 nest2::i#2 ] // zpby1=_dec_zpby1
|
||||
dec 7
|
||||
// [21] if((byte) nest2::j#1>(byte) 0) goto nest2::@2 [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 nest2::j#1 nest2::i#2 ] // zpby1_gt_0_then_la1
|
||||
// [20] (byte) nest2::j#1 ← -- (byte) nest2::j#2 [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 nest2::j#1 nest2::i#2 ] // aby=_dec_zpby1
|
||||
lda 7
|
||||
sec
|
||||
sbc #1
|
||||
// [21] if((byte) nest2::j#1>(byte) 0) goto nest2::@2 [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 nest2::j#1 nest2::i#2 ] // aby_gt_0_then_la1
|
||||
cmp #0
|
||||
bne nest2__B2_from_B2
|
||||
nest2__B3:
|
||||
// [22] (byte) nest2::i#1 ← -- (byte) nest2::i#2 [ main::j#2 main::i#2 nest1::j#2 nest1::i#2 nest2::i#1 ] // zpby1=_dec_zpby1
|
||||
|
@ -34,7 +34,7 @@
|
||||
(byte) nest2::i#1 zp byte:6 150001.5
|
||||
(byte) nest2::i#2 zp byte:6 40000.4
|
||||
(byte) nest2::j
|
||||
(byte) nest2::j#1 zp byte:7 1500001.5
|
||||
(byte) nest2::j#1 reg byte a 1500001.5
|
||||
(byte) nest2::j#2 zp byte:7 1500001.5
|
||||
|
||||
zp byte:2 [ main::i#2 main::i#1 ]
|
||||
|
@ -1,24 +1,31 @@
|
||||
BBEGIN:
|
||||
B1_from_BBEGIN:
|
||||
jsr main
|
||||
BEND:
|
||||
main:
|
||||
main__B1_from_main:
|
||||
lda #0
|
||||
sta 3
|
||||
lda #100
|
||||
main__B1:
|
||||
sta 2
|
||||
B1:
|
||||
dec 2
|
||||
lda 2
|
||||
BEND:
|
||||
B2:
|
||||
bne main__B2
|
||||
main__Breturn:
|
||||
rts
|
||||
main__B2:
|
||||
lda 2
|
||||
cmp #50
|
||||
beq !+
|
||||
bcs B4
|
||||
bcs main__B4
|
||||
!:
|
||||
B5:
|
||||
main__B5:
|
||||
dec 3
|
||||
B1_from_B5:
|
||||
jmp B1
|
||||
B4:
|
||||
main__B1_from_B5:
|
||||
lda 2
|
||||
jmp main__B1
|
||||
main__B4:
|
||||
inc 3
|
||||
B1_from_B4:
|
||||
jmp B1
|
||||
main__B1_from_B4:
|
||||
lda 2
|
||||
jmp main__B1
|
||||
|
@ -1,18 +1,24 @@
|
||||
@BEGIN: from
|
||||
to:@1
|
||||
@1: from @4 @5 @BEGIN
|
||||
[0] (byte) s#3 ← phi( @4/(byte) s#1 @5/(byte) s#2 @BEGIN/(byte) 0 ) [ i#2 s#3 ]
|
||||
[0] (byte) i#2 ← phi( @4/(byte) i#1 @5/(byte) i#1 @BEGIN/(byte) 100 ) [ i#2 s#3 ]
|
||||
[1] (byte) i#1 ← -- (byte) i#2 [ i#1 s#3 ]
|
||||
[2] if((byte) i#1>(byte) 0) goto @2 [ i#1 s#3 ]
|
||||
[0] call main param-assignment [ ]
|
||||
to:@END
|
||||
@END: from @1
|
||||
@2: from @1
|
||||
[3] if((byte) i#1>(byte) 50) goto @4 [ i#1 s#3 ]
|
||||
to:@5
|
||||
@5: from @2
|
||||
[4] (byte) s#2 ← -- (byte) s#3 [ i#1 s#2 ]
|
||||
to:@1
|
||||
@4: from @2
|
||||
[5] (byte) s#1 ← ++ (byte) s#3 [ i#1 s#1 ]
|
||||
to:@1
|
||||
@END: from @BEGIN
|
||||
main: from @BEGIN
|
||||
to:main::@1
|
||||
main::@1: from main main::@4 main::@5
|
||||
[1] (byte) main::s#3 ← phi( main/(byte) 0 main::@4/(byte) main::s#1 main::@5/(byte) main::s#2 ) [ main::i#2 main::s#3 ]
|
||||
[1] (byte) main::i#2 ← phi( main/(byte) 100 main::@4/(byte) main::i#1 main::@5/(byte) main::i#1 ) [ main::i#2 main::s#3 ]
|
||||
[2] (byte) main::i#1 ← -- (byte) main::i#2 [ main::i#1 main::s#3 ]
|
||||
[3] if((byte) main::i#1>(byte) 0) goto main::@2 [ main::i#1 main::s#3 ]
|
||||
to:main::@return
|
||||
main::@return: from main::@1
|
||||
[4] return [ ]
|
||||
to:@RETURN
|
||||
main::@2: from main::@1
|
||||
[5] if((byte) main::i#1>(byte) 50) goto main::@4 [ main::i#1 main::s#3 ]
|
||||
to:main::@5
|
||||
main::@5: from main::@2
|
||||
[6] (byte) main::s#2 ← -- (byte) main::s#3 [ main::i#1 main::s#2 ]
|
||||
to:main::@1
|
||||
main::@4: from main::@2
|
||||
[7] (byte) main::s#1 ← ++ (byte) main::s#3 [ main::i#1 main::s#1 ]
|
||||
to:main::@1
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,16 +1,18 @@
|
||||
(label) @1
|
||||
(label) @2
|
||||
(label) @4
|
||||
(label) @5
|
||||
(label) @BEGIN
|
||||
(label) @END
|
||||
(byte) i
|
||||
(byte) i#1 zp byte:2 11.0
|
||||
(byte) i#2 zp byte:2 33.0
|
||||
(byte) s
|
||||
(byte) s#1 zp byte:3 22.0
|
||||
(byte) s#2 zp byte:3 22.0
|
||||
(byte) s#3 zp byte:3 11.0
|
||||
(void()) main()
|
||||
(label) main::@1
|
||||
(label) main::@2
|
||||
(label) main::@4
|
||||
(label) main::@5
|
||||
(label) main::@return
|
||||
(byte) main::i
|
||||
(byte) main::i#1 zp byte:2 11.0
|
||||
(byte) main::i#2 reg byte a 33.0
|
||||
(byte) main::s
|
||||
(byte) main::s#1 zp byte:3 22.0
|
||||
(byte) main::s#2 zp byte:3 22.0
|
||||
(byte) main::s#3 zp byte:3 11.0
|
||||
|
||||
zp byte:2 [ i#2 i#1 ]
|
||||
zp byte:3 [ s#3 s#1 s#2 ]
|
||||
zp byte:2 [ main::i#2 main::i#1 ]
|
||||
zp byte:3 [ main::s#3 main::s#1 main::s#2 ]
|
||||
|
@ -7,10 +7,8 @@ B1:
|
||||
lda 2
|
||||
clc
|
||||
adc #4
|
||||
sta 3
|
||||
lda 3
|
||||
ldy 2
|
||||
sta 4352,y
|
||||
ldx 2
|
||||
sta 4352,x
|
||||
inc 2
|
||||
lda 2
|
||||
cmp #10
|
||||
|
@ -313,6 +313,17 @@ zp byte:3 [ $1 ]
|
||||
|
||||
Re-allocated ZP register from zp byte:2 to zp byte:2
|
||||
Re-allocated ZP register from zp byte:3 to zp byte:3
|
||||
Uplifting of variable (byte~) $1 to A
|
||||
REGISTER UPLIFTING
|
||||
(byte~) $1 reg byte a 22.0
|
||||
(byte) i
|
||||
(byte) i#1 zp byte:2 16.5
|
||||
(byte) i#2 zp byte:2 14.666666666666666
|
||||
(byte[16]) p
|
||||
|
||||
zp byte:2 [ i#2 i#1 ]
|
||||
zp byte:3 [ $1 ]
|
||||
|
||||
INITIAL ASM
|
||||
BBEGIN:
|
||||
B1_from_BBEGIN:
|
||||
@ -324,15 +335,13 @@ B1_from_B1:
|
||||
// (byte) i#2 = (byte) i#1 // register copy zp byte:2
|
||||
jmp B1
|
||||
B1:
|
||||
// [1] (byte~) $1 ← (byte) i#2 + (byte) 4 [ i#2 $1 ] // zpby1=zpby2_plus_coby1
|
||||
// [1] (byte~) $1 ← (byte) i#2 + (byte) 4 [ i#2 $1 ] // aby=zpby1_plus_coby1
|
||||
lda 2
|
||||
clc
|
||||
adc #4
|
||||
sta 3
|
||||
// [2] *((word) 4352 + (byte) i#2) ← (byte~) $1 [ i#2 ] // ptr_cowo1_zpby1=zpby2
|
||||
lda 3
|
||||
ldy 2
|
||||
sta 4352,y
|
||||
// [2] *((word) 4352 + (byte) i#2) ← (byte~) $1 [ i#2 ] // ptr_cowo1_zpby1=aby
|
||||
ldx 2
|
||||
sta 4352,x
|
||||
// [3] (byte) i#1 ← (byte) i#2 + (byte) 1 [ i#1 ] // zpby1=zpby1_plus_1
|
||||
inc 2
|
||||
// [4] if((byte) i#1<(byte) 10) goto @1 [ i#1 ] // zpby1_lt_coby1_then_la1
|
||||
@ -355,15 +364,13 @@ B1_from_BBEGIN:
|
||||
B1_from_B1:
|
||||
// (byte) i#2 = (byte) i#1 // register copy zp byte:2
|
||||
B1:
|
||||
// [1] (byte~) $1 ← (byte) i#2 + (byte) 4 [ i#2 $1 ] // zpby1=zpby2_plus_coby1
|
||||
// [1] (byte~) $1 ← (byte) i#2 + (byte) 4 [ i#2 $1 ] // aby=zpby1_plus_coby1
|
||||
lda 2
|
||||
clc
|
||||
adc #4
|
||||
sta 3
|
||||
// [2] *((word) 4352 + (byte) i#2) ← (byte~) $1 [ i#2 ] // ptr_cowo1_zpby1=zpby2
|
||||
lda 3
|
||||
ldy 2
|
||||
sta 4352,y
|
||||
// [2] *((word) 4352 + (byte) i#2) ← (byte~) $1 [ i#2 ] // ptr_cowo1_zpby1=aby
|
||||
ldx 2
|
||||
sta 4352,x
|
||||
// [3] (byte) i#1 ← (byte) i#2 + (byte) 1 [ i#1 ] // zpby1=zpby1_plus_1
|
||||
inc 2
|
||||
// [4] if((byte) i#1<(byte) 10) goto @1 [ i#1 ] // zpby1_lt_coby1_then_la1
|
||||
@ -383,15 +390,13 @@ B1_from_BBEGIN:
|
||||
B1_from_B1:
|
||||
// (byte) i#2 = (byte) i#1 // register copy zp byte:2
|
||||
B1:
|
||||
// [1] (byte~) $1 ← (byte) i#2 + (byte) 4 [ i#2 $1 ] // zpby1=zpby2_plus_coby1
|
||||
// [1] (byte~) $1 ← (byte) i#2 + (byte) 4 [ i#2 $1 ] // aby=zpby1_plus_coby1
|
||||
lda 2
|
||||
clc
|
||||
adc #4
|
||||
sta 3
|
||||
// [2] *((word) 4352 + (byte) i#2) ← (byte~) $1 [ i#2 ] // ptr_cowo1_zpby1=zpby2
|
||||
lda 3
|
||||
ldy 2
|
||||
sta 4352,y
|
||||
// [2] *((word) 4352 + (byte) i#2) ← (byte~) $1 [ i#2 ] // ptr_cowo1_zpby1=aby
|
||||
ldx 2
|
||||
sta 4352,x
|
||||
// [3] (byte) i#1 ← (byte) i#2 + (byte) 1 [ i#1 ] // zpby1=zpby1_plus_1
|
||||
inc 2
|
||||
// [4] if((byte) i#1<(byte) 10) goto @1 [ i#1 ] // zpby1_lt_coby1_then_la1
|
||||
@ -401,7 +406,7 @@ B1:
|
||||
BEND:
|
||||
|
||||
FINAL SYMBOL TABLE
|
||||
(byte~) $1 zp byte:3 22.0
|
||||
(byte~) $1 reg byte a 22.0
|
||||
(label) @1
|
||||
(label) @BEGIN
|
||||
(label) @END
|
||||
@ -422,15 +427,13 @@ B1_from_BBEGIN:
|
||||
B1_from_B1:
|
||||
// (byte) i#2 = (byte) i#1 // register copy zp byte:2
|
||||
B1:
|
||||
// [1] (byte~) $1 ← (byte) i#2 + (byte) 4 [ i#2 $1 ] // zpby1=zpby2_plus_coby1
|
||||
// [1] (byte~) $1 ← (byte) i#2 + (byte) 4 [ i#2 $1 ] // aby=zpby1_plus_coby1
|
||||
lda 2
|
||||
clc
|
||||
adc #4
|
||||
sta 3
|
||||
// [2] *((word) 4352 + (byte) i#2) ← (byte~) $1 [ i#2 ] // ptr_cowo1_zpby1=zpby2
|
||||
lda 3
|
||||
ldy 2
|
||||
sta 4352,y
|
||||
// [2] *((word) 4352 + (byte) i#2) ← (byte~) $1 [ i#2 ] // ptr_cowo1_zpby1=aby
|
||||
ldx 2
|
||||
sta 4352,x
|
||||
// [3] (byte) i#1 ← (byte) i#2 + (byte) 1 [ i#1 ] // zpby1=zpby1_plus_1
|
||||
inc 2
|
||||
// [4] if((byte) i#1<(byte) 10) goto @1 [ i#1 ] // zpby1_lt_coby1_then_la1
|
||||
|
@ -1,4 +1,4 @@
|
||||
(byte~) $1 zp byte:3 22.0
|
||||
(byte~) $1 reg byte a 22.0
|
||||
(label) @1
|
||||
(label) @BEGIN
|
||||
(label) @END
|
||||
|
@ -15,10 +15,11 @@ sum_from_B2:
|
||||
sta 2
|
||||
jsr sum
|
||||
B3:
|
||||
lda 2
|
||||
sta 5
|
||||
lda 4
|
||||
clc
|
||||
adc 2
|
||||
sta 4
|
||||
adc 5
|
||||
BEND:
|
||||
sum:
|
||||
lda 2
|
||||
|
@ -390,10 +390,32 @@ zp byte:3 [ sum::b#2 ]
|
||||
zp byte:4 [ s1#0 s3#0 ]
|
||||
zp byte:5 [ s2#0 ]
|
||||
|
||||
Coalescing zero page register [ zp byte:2 [ sum::a#2 sum::return#0 ] ] with [ zp byte:5 [ s2#0 ] ]
|
||||
Re-allocated ZP register from zp byte:2 to zp byte:2
|
||||
Re-allocated ZP register from zp byte:3 to zp byte:3
|
||||
Re-allocated ZP register from zp byte:4 to zp byte:4
|
||||
Re-allocated ZP register from zp byte:5 to zp byte:5
|
||||
Uplifting of variable (byte) s3#0 to A
|
||||
REGISTER UPLIFTING
|
||||
(byte) s1
|
||||
(byte) s1#0 zp byte:4 0.5714285714285714
|
||||
(byte) s2
|
||||
(byte) s2#0 zp byte:5 4.0
|
||||
(byte) s3
|
||||
(byte) s3#0 reg byte a Infinity
|
||||
(byte()) sum((byte) sum::a , (byte) sum::b)
|
||||
(byte) sum::a
|
||||
(byte) sum::a#2 zp byte:2 2.0
|
||||
(byte) sum::b
|
||||
(byte) sum::b#2 zp byte:3 2.0
|
||||
(byte) sum::return
|
||||
(byte) sum::return#0 zp byte:2 1.2000000000000002
|
||||
|
||||
zp byte:2 [ sum::a#2 sum::return#0 ]
|
||||
zp byte:3 [ sum::b#2 ]
|
||||
zp byte:4 [ s1#0 s3#0 ]
|
||||
zp byte:5 [ s2#0 ]
|
||||
|
||||
Coalescing zero page register [ zp byte:2 [ sum::a#2 sum::return#0 ] ] with [ zp byte:5 [ s2#0 ] ]
|
||||
INITIAL ASM
|
||||
BBEGIN:
|
||||
sum_from_BBEGIN:
|
||||
@ -419,12 +441,13 @@ sum_from_B2:
|
||||
jsr sum
|
||||
jmp B3
|
||||
B3:
|
||||
// (byte) s2#0 = (byte) sum::return#0 // register copy zp byte:2
|
||||
// [4] (byte) s3#0 ← (byte) s1#0 + (byte) s2#0 [ ] // zpby1=zpby1_plus_zpby2
|
||||
// [3] (byte) s2#0 ← (byte) sum::return#0 [ s1#0 s2#0 ] // zpby1=zpby2
|
||||
lda 2
|
||||
sta 5
|
||||
// [4] (byte) s3#0 ← (byte) s1#0 + (byte) s2#0 [ ] // aby=zpby1_plus_zpby2
|
||||
lda 4
|
||||
clc
|
||||
adc 2
|
||||
sta 4
|
||||
adc 5
|
||||
jmp BEND
|
||||
BEND:
|
||||
sum:
|
||||
@ -465,12 +488,13 @@ sum_from_B2:
|
||||
sta 2
|
||||
jsr sum
|
||||
B3:
|
||||
// (byte) s2#0 = (byte) sum::return#0 // register copy zp byte:2
|
||||
// [4] (byte) s3#0 ← (byte) s1#0 + (byte) s2#0 [ ] // zpby1=zpby1_plus_zpby2
|
||||
// [3] (byte) s2#0 ← (byte) sum::return#0 [ s1#0 s2#0 ] // zpby1=zpby2
|
||||
lda 2
|
||||
sta 5
|
||||
// [4] (byte) s3#0 ← (byte) s1#0 + (byte) s2#0 [ ] // aby=zpby1_plus_zpby2
|
||||
lda 4
|
||||
clc
|
||||
adc 2
|
||||
sta 4
|
||||
adc 5
|
||||
BEND:
|
||||
sum:
|
||||
// [6] (byte) sum::return#0 ← (byte) sum::a#2 + (byte) sum::b#2 [ sum::return#0 s1#0 ] // zpby1=zpby1_plus_zpby2
|
||||
@ -489,9 +513,9 @@ FINAL SYMBOL TABLE
|
||||
(byte) s1
|
||||
(byte) s1#0 zp byte:4 0.5714285714285714
|
||||
(byte) s2
|
||||
(byte) s2#0 zp byte:2 4.0
|
||||
(byte) s2#0 zp byte:5 4.0
|
||||
(byte) s3
|
||||
(byte) s3#0 zp byte:4 Infinity
|
||||
(byte) s3#0 reg byte a Infinity
|
||||
(byte()) sum((byte) sum::a , (byte) sum::b)
|
||||
(label) sum::@return
|
||||
(byte) sum::a
|
||||
@ -528,12 +552,13 @@ sum_from_B2:
|
||||
sta 2
|
||||
jsr sum
|
||||
B3:
|
||||
// (byte) s2#0 = (byte) sum::return#0 // register copy zp byte:2
|
||||
// [4] (byte) s3#0 ← (byte) s1#0 + (byte) s2#0 [ ] // zpby1=zpby1_plus_zpby2
|
||||
// [3] (byte) s2#0 ← (byte) sum::return#0 [ s1#0 s2#0 ] // zpby1=zpby2
|
||||
lda 2
|
||||
sta 5
|
||||
// [4] (byte) s3#0 ← (byte) s1#0 + (byte) s2#0 [ ] // aby=zpby1_plus_zpby2
|
||||
lda 4
|
||||
clc
|
||||
adc 2
|
||||
sta 4
|
||||
adc 5
|
||||
BEND:
|
||||
sum:
|
||||
// [6] (byte) sum::return#0 ← (byte) sum::a#2 + (byte) sum::b#2 [ sum::return#0 s1#0 ] // zpby1=zpby1_plus_zpby2
|
||||
|
@ -5,9 +5,9 @@
|
||||
(byte) s1
|
||||
(byte) s1#0 zp byte:4 0.5714285714285714
|
||||
(byte) s2
|
||||
(byte) s2#0 zp byte:2 4.0
|
||||
(byte) s2#0 zp byte:5 4.0
|
||||
(byte) s3
|
||||
(byte) s3#0 zp byte:4 Infinity
|
||||
(byte) s3#0 reg byte a Infinity
|
||||
(byte()) sum((byte) sum::a , (byte) sum::b)
|
||||
(label) sum::@return
|
||||
(byte) sum::a
|
||||
|
Loading…
Reference in New Issue
Block a user