mirror of
https://gitlab.com/camelot/kickc.git
synced 2024-09-08 17:54:40 +00:00
Added operator precedence to constant printing - avoiding unnecesary perenthesis
This commit is contained in:
parent
7b9e80aaac
commit
46ffa81633
@ -394,7 +394,9 @@ public class AsmFragment {
|
||||
}
|
||||
} else if (boundValue instanceof Constant) {
|
||||
Constant boundConst = (Constant) boundValue;
|
||||
return new AsmParameter(Pass4CodeGeneration.getConstantValueAsm(program, boundConst, false), SymbolTypeBasic.BYTE.equals(boundConst.getType(program.getScope())));
|
||||
String constantValueAsm = Pass4CodeGeneration.getConstantValueAsm(program, boundConst, 99);
|
||||
boolean constantValueZp = SymbolTypeBasic.BYTE.equals(boundConst.getType(program.getScope()));
|
||||
return new AsmParameter(constantValueAsm, constantValueZp);
|
||||
} else if (boundValue instanceof Label) {
|
||||
String param = ((Label) boundValue).getLocalName().replace('@', 'b').replace(':', '_').replace("$", "_");
|
||||
return new AsmParameter(param, false);
|
||||
|
@ -8,25 +8,106 @@ public class Operator {
|
||||
|
||||
private String operator;
|
||||
|
||||
@JsonCreator
|
||||
public Operator(
|
||||
@JsonProperty("operator") String operator) {
|
||||
private int precedence;
|
||||
|
||||
private Type type;
|
||||
|
||||
public Operator(String operator, Type type, int precedence) {
|
||||
this.operator = operator;
|
||||
this.precedence = precedence;
|
||||
}
|
||||
|
||||
public static Operator getBinary(String op) {
|
||||
switch (op) {
|
||||
case "+":
|
||||
return PLUS;
|
||||
case "-":
|
||||
return MINUS;
|
||||
case "*":
|
||||
return MULTIPLY;
|
||||
case "/":
|
||||
return DIVIDE;
|
||||
case "==":
|
||||
return EQ;
|
||||
case "!=":
|
||||
return NEQ;
|
||||
case "<":
|
||||
return LT;
|
||||
case "<=":
|
||||
return LE;
|
||||
case ">":
|
||||
return GT;
|
||||
case ">=":
|
||||
return GE;
|
||||
case "*idx":
|
||||
return STAR_IDX;
|
||||
default:
|
||||
throw new RuntimeException("Unknown operator " + op);
|
||||
}
|
||||
}
|
||||
|
||||
public static Operator getUnary(String op) {
|
||||
switch (op) {
|
||||
case "+":
|
||||
return UNARY_PLUS;
|
||||
case "-":
|
||||
return UNARY_MINUS;
|
||||
case "++":
|
||||
return INCREMENT;
|
||||
case "--":
|
||||
return DECREMENT;
|
||||
case "!":
|
||||
return NOT;
|
||||
case "*":
|
||||
return STAR;
|
||||
default:
|
||||
throw new RuntimeException("Unknown operator " + op);
|
||||
}
|
||||
}
|
||||
|
||||
public static enum Type {
|
||||
UNARY, BINARY
|
||||
}
|
||||
|
||||
public static Operator INCREMENT = new Operator("++", Type.UNARY, 1);
|
||||
public static Operator DECREMENT = new Operator("--", Type.UNARY, 1);
|
||||
public static Operator UNARY_PLUS = new Operator("+", Type.UNARY, 2);
|
||||
public static Operator UNARY_MINUS = new Operator("-", Type.UNARY, 2);
|
||||
public static Operator NOT = new Operator("!", Type.UNARY, 2);
|
||||
public static Operator STAR = new Operator("*", Type.UNARY, 2);
|
||||
public static Operator STAR_IDX = new Operator("*idx", Type.BINARY, 2);
|
||||
public static Operator MULTIPLY = new Operator("*", Type.BINARY, 3);
|
||||
public static Operator DIVIDE = new Operator("/", Type.BINARY, 3);
|
||||
public static Operator PLUS = new Operator("+", Type.BINARY, 4);
|
||||
public static Operator MINUS = new Operator("-", Type.BINARY, 4);
|
||||
public static Operator LT = new Operator("<", Type.BINARY, 6);
|
||||
public static Operator LE = new Operator("<=", Type.BINARY, 6);
|
||||
public static Operator GT = new Operator(">", Type.BINARY, 6);
|
||||
public static Operator GE = new Operator(">=", Type.BINARY, 6);
|
||||
public static Operator EQ = new Operator("==", Type.BINARY, 7);
|
||||
public static Operator NEQ = new Operator("!=", Type.BINARY, 7);
|
||||
|
||||
public String getOperator() {
|
||||
return operator;
|
||||
}
|
||||
|
||||
public int getPrecedence() {
|
||||
return precedence;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return operator ;
|
||||
return operator;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
Operator operator1 = (Operator) o;
|
||||
return operator != null ? operator.equals(operator1.operator) : operator1.operator == null;
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ public class ParseTreeConstantEvaluator extends KickCBaseVisitor<Constant> {
|
||||
public Constant visitExprUnary(KickCParser.ExprUnaryContext ctx) {
|
||||
Constant sub = visit(ctx.expr());
|
||||
String op = ((TerminalNode)ctx.getChild(0)).getSymbol().getText();
|
||||
Operator operator = new Operator(op);
|
||||
Operator operator = Operator.getUnary(op);
|
||||
return calculateUnary(operator, sub);
|
||||
}
|
||||
|
||||
@ -87,7 +87,7 @@ public class ParseTreeConstantEvaluator extends KickCBaseVisitor<Constant> {
|
||||
Constant left = this.visit(ctx.expr(0));
|
||||
Constant right = this.visit(ctx.expr(1));
|
||||
String op = ((TerminalNode)ctx.getChild(1)).getSymbol().getText();
|
||||
Operator operator = new Operator(op);
|
||||
Operator operator = Operator.getBinary(op);
|
||||
return calculateBinary(operator, left, right);
|
||||
}
|
||||
|
||||
|
@ -84,7 +84,7 @@ public class Pass1GenerateStatementSequence extends KickCBaseVisitor<Object> {
|
||||
PrePostModifierHandler.addPreModifiers(this, ctx.expr());
|
||||
RValue rValue = (RValue) this.visit(ctx.expr());
|
||||
VariableRef notExprVar = getCurrentSymbols().addVariableIntermediate().getRef();
|
||||
sequence.addStatement(new StatementAssignment(notExprVar, null, new Operator("!"), rValue));
|
||||
sequence.addStatement(new StatementAssignment(notExprVar, null, Operator.NOT, rValue));
|
||||
PrePostModifierHandler.addPostModifiers(this, ctx.expr());
|
||||
|
||||
Label elseJumpLabel = getCurrentSymbols().addLabelIntermediate();
|
||||
@ -234,7 +234,7 @@ public class Pass1GenerateStatementSequence extends KickCBaseVisitor<Object> {
|
||||
// Add increment
|
||||
ConstantInteger beyondLastVal;
|
||||
if(rangeFirst.getNumber()>rangeLast.getNumber()) {
|
||||
Statement stmtInc = new StatementAssignment(lValue.getRef(), new Operator("--"), lValue.getRef());
|
||||
Statement stmtInc = new StatementAssignment(lValue.getRef(), Operator.DECREMENT, lValue.getRef());
|
||||
sequence.addStatement(stmtInc);
|
||||
if(rangeLast.getNumber()==0) {
|
||||
beyondLastVal = new ConstantInteger(255);
|
||||
@ -242,7 +242,7 @@ public class Pass1GenerateStatementSequence extends KickCBaseVisitor<Object> {
|
||||
beyondLastVal = new ConstantInteger(rangeLast.getNumber()-1);
|
||||
}
|
||||
} else {
|
||||
Statement stmtInc = new StatementAssignment(lValue.getRef(), new Operator("++"), lValue.getRef());
|
||||
Statement stmtInc = new StatementAssignment(lValue.getRef(), Operator.INCREMENT, lValue.getRef());
|
||||
sequence.addStatement(stmtInc);
|
||||
if(rangeLast.getNumber()==255) {
|
||||
beyondLastVal = new ConstantInteger(0);
|
||||
@ -254,7 +254,7 @@ public class Pass1GenerateStatementSequence extends KickCBaseVisitor<Object> {
|
||||
// Add condition i<last+1 or i<last-1
|
||||
VariableIntermediate tmpVar = getCurrentSymbols().addVariableIntermediate();
|
||||
VariableRef tmpVarRef = tmpVar.getRef();
|
||||
Statement stmtTmpVar = new StatementAssignment(tmpVarRef, lValue.getRef(), new Operator("!="), beyondLastVal);
|
||||
Statement stmtTmpVar = new StatementAssignment(tmpVarRef, lValue.getRef(), Operator.NEQ, beyondLastVal);
|
||||
sequence.addStatement(stmtTmpVar);
|
||||
// Add jump if condition was met
|
||||
Statement doJmpStmt = new StatementConditionalJump(tmpVarRef, repeatLabel.getRef());
|
||||
@ -461,7 +461,7 @@ public class Pass1GenerateStatementSequence extends KickCBaseVisitor<Object> {
|
||||
public RValue visitExprArray(KickCParser.ExprArrayContext ctx) {
|
||||
RValue array = (LValue) visit(ctx.expr(0));
|
||||
RValue index = (RValue) visit(ctx.expr(1));
|
||||
Operator operator = new Operator("*idx");
|
||||
Operator operator = Operator.STAR_IDX;
|
||||
VariableIntermediate tmpVar = getCurrentSymbols().addVariableIntermediate();
|
||||
VariableRef tmpVarRef = tmpVar.getRef();
|
||||
Statement stmt = new StatementAssignment(tmpVarRef, array, operator, index);
|
||||
@ -495,7 +495,7 @@ public class Pass1GenerateStatementSequence extends KickCBaseVisitor<Object> {
|
||||
RValue left = (RValue) this.visit(ctx.expr(0));
|
||||
RValue right = (RValue) this.visit(ctx.expr(1));
|
||||
String op = ((TerminalNode) ctx.getChild(1)).getSymbol().getText();
|
||||
Operator operator = new Operator(op);
|
||||
Operator operator = Operator.getBinary(op);
|
||||
VariableIntermediate tmpVar = getCurrentSymbols().addVariableIntermediate();
|
||||
VariableRef tmpVarRef = tmpVar.getRef();
|
||||
Statement stmt = new StatementAssignment(tmpVarRef, left, operator, right);
|
||||
@ -507,7 +507,7 @@ public class Pass1GenerateStatementSequence extends KickCBaseVisitor<Object> {
|
||||
public RValue visitExprUnary(KickCParser.ExprUnaryContext ctx) {
|
||||
RValue child = (RValue) this.visit(ctx.expr());
|
||||
String op = ((TerminalNode) ctx.getChild(0)).getSymbol().getText();
|
||||
Operator operator = new Operator(op);
|
||||
Operator operator = Operator.getUnary(op);
|
||||
VariableIntermediate tmpVar = getCurrentSymbols().addVariableIntermediate();
|
||||
VariableRef tmpVarRef = tmpVar.getRef();
|
||||
Statement stmt = new StatementAssignment(tmpVarRef, operator, child);
|
||||
@ -594,7 +594,7 @@ public class Pass1GenerateStatementSequence extends KickCBaseVisitor<Object> {
|
||||
public Void visitExprPostMod(KickCParser.ExprPostModContext ctx) {
|
||||
RValue child = (RValue) mainParser.visit(ctx.expr());
|
||||
String op = ((TerminalNode) ctx.getChild(1)).getSymbol().getText();
|
||||
Operator operator = new Operator(op);
|
||||
Operator operator = Operator.getUnary(op);
|
||||
PrePostModifier modifier = new PrePostModifier(child, operator);
|
||||
postMods.add(modifier);
|
||||
return null;
|
||||
@ -604,7 +604,7 @@ public class Pass1GenerateStatementSequence extends KickCBaseVisitor<Object> {
|
||||
public Void visitExprPreMod(KickCParser.ExprPreModContext ctx) {
|
||||
RValue child = (RValue) mainParser.visit(ctx.expr());
|
||||
String op = ((TerminalNode) ctx.getChild(0)).getSymbol().getText();
|
||||
Operator operator = new Operator(op);
|
||||
Operator operator = Operator.getUnary(op);
|
||||
PrePostModifier modifier = new PrePostModifier(child, operator);
|
||||
preMods.add(modifier);
|
||||
return null;
|
||||
|
@ -64,7 +64,7 @@ public class Pass2ConstantAdditionElimination extends Pass2SsaOptimization {
|
||||
if(pointerDereferenceIndexed.getPointer() instanceof Constant && pointerDereferenceIndexed.getIndex() instanceof Constant) {
|
||||
Constant ptrConstant = (Constant) pointerDereferenceIndexed.getPointer();
|
||||
Constant idxConstant = (Constant) pointerDereferenceIndexed.getIndex();
|
||||
Constant newPtr = new ConstantBinary(ptrConstant, new Operator("+"), idxConstant);
|
||||
Constant newPtr = new ConstantBinary(ptrConstant, Operator.PLUS, idxConstant);
|
||||
assignment.setlValue(new PointerDereferenceSimple(newPtr));
|
||||
getLog().append("Consolidated assigned array index constant in assignment " + assignment.getlValue());
|
||||
return true;
|
||||
@ -74,7 +74,7 @@ public class Pass2ConstantAdditionElimination extends Pass2SsaOptimization {
|
||||
Constant consolidated = consolidateSubConstants(variable);
|
||||
if (consolidated != null) {
|
||||
Constant ptrConstant = (Constant) pointerDereferenceIndexed.getPointer();
|
||||
Constant newPtr = new ConstantBinary(ptrConstant, new Operator("+"), consolidated);
|
||||
Constant newPtr = new ConstantBinary(ptrConstant, Operator.PLUS, consolidated);
|
||||
pointerDereferenceIndexed.setPointer(newPtr);
|
||||
getLog().append("Consolidated assigned array index constant in assignment " + assignment.getlValue());
|
||||
return true;
|
||||
@ -87,9 +87,9 @@ public class Pass2ConstantAdditionElimination extends Pass2SsaOptimization {
|
||||
if (assignment.getrValue1() instanceof Constant && assignment.getrValue2() instanceof Constant) {
|
||||
Constant ptrConstant = (Constant) assignment.getrValue1();
|
||||
Constant idxConstant = (Constant) assignment.getrValue2();
|
||||
Constant newPtr = new ConstantBinary(ptrConstant, new Operator("+"), idxConstant);
|
||||
Constant newPtr = new ConstantBinary(ptrConstant, Operator.PLUS, idxConstant);
|
||||
assignment.setrValue1(null);
|
||||
assignment.setOperator(new Operator("*"));
|
||||
assignment.setOperator(Operator.STAR);
|
||||
assignment.setrValue2(newPtr);
|
||||
getLog().append("Consolidated referenced array index constant in assignment " + assignment.getlValue());
|
||||
return true;
|
||||
@ -99,7 +99,7 @@ public class Pass2ConstantAdditionElimination extends Pass2SsaOptimization {
|
||||
Constant consolidated = consolidateSubConstants(variable);
|
||||
if (consolidated != null) {
|
||||
Constant ptrConstant = (Constant) assignment.getrValue1();
|
||||
Constant newPtr = new ConstantBinary(ptrConstant, new Operator("+"), consolidated);
|
||||
Constant newPtr = new ConstantBinary(ptrConstant, Operator.PLUS, consolidated);
|
||||
assignment.setrValue1(newPtr);
|
||||
getLog().append("Consolidated referenced array index constant in assignment " + assignment.getlValue());
|
||||
return true;
|
||||
@ -114,7 +114,7 @@ public class Pass2ConstantAdditionElimination extends Pass2SsaOptimization {
|
||||
Constant consolidated = consolidateSubConstants(variable);
|
||||
if (consolidated != null) {
|
||||
Constant const1 = (Constant) assignment.getrValue1();
|
||||
assignment.setrValue1(new ConstantBinary(const1, new Operator("+"), consolidated));
|
||||
assignment.setrValue1(new ConstantBinary(const1, Operator.PLUS, consolidated));
|
||||
getLog().append("Consolidated constant in assignment " + assignment.getlValue());
|
||||
return true;
|
||||
}
|
||||
@ -123,7 +123,7 @@ public class Pass2ConstantAdditionElimination extends Pass2SsaOptimization {
|
||||
Constant consolidated = consolidateSubConstants(variable);
|
||||
if (consolidated != null) {
|
||||
Constant const2 = (Constant) assignment.getrValue2();
|
||||
Constant newNumber = new ConstantBinary(consolidated, new Operator("+"), const2);
|
||||
Constant newNumber = new ConstantBinary(consolidated, Operator.PLUS, const2);
|
||||
assignment.setrValue2(newNumber);
|
||||
// Handling of negative consolidated numbers?
|
||||
getLog().append("Consolidated constant in assignment " + assignment.getlValue());
|
||||
@ -170,7 +170,7 @@ public class Pass2ConstantAdditionElimination extends Pass2SsaOptimization {
|
||||
if (const1 != null) {
|
||||
result = const1;
|
||||
if (const2 != null) {
|
||||
result = new ConstantBinary(const1, new Operator("+"), const2);
|
||||
result = new ConstantBinary(const1, Operator.PLUS, const2);
|
||||
}
|
||||
} else if (const2 != null) {
|
||||
result = const2;
|
||||
@ -188,7 +188,7 @@ public class Pass2ConstantAdditionElimination extends Pass2SsaOptimization {
|
||||
assignment.setrValue2(assignment.getrValue1());
|
||||
assignment.setOperator(null);
|
||||
assignment.setrValue1(null);
|
||||
return new ConstantUnary(new Operator("-"), constant);
|
||||
return new ConstantUnary(Operator.MINUS, constant);
|
||||
} else {
|
||||
Constant const1 = null;
|
||||
if (assignment.getrValue1() instanceof VariableRef) {
|
||||
@ -202,7 +202,7 @@ public class Pass2ConstantAdditionElimination extends Pass2SsaOptimization {
|
||||
if (const1 != null) {
|
||||
result = const1;
|
||||
if (const2 != null) {
|
||||
result = new ConstantBinary(const1, new Operator("-"),const2);
|
||||
result = new ConstantBinary(const1, Operator.MINUS,const2);
|
||||
}
|
||||
} else if (const2 != null) {
|
||||
result = const2;
|
||||
|
@ -96,7 +96,7 @@ public class Pass2UnaryNotSimplification extends Pass2SsaOptimization {
|
||||
*/
|
||||
private void createInverse(String newOperator, StatementAssignment assignment, StatementAssignment tempAssignment) {
|
||||
assignment.setrValue1(tempAssignment.getrValue1());
|
||||
assignment.setOperator(newOperator==null?null:new Operator(newOperator));
|
||||
assignment.setOperator(newOperator==null?null:Operator.getBinary(newOperator));
|
||||
assignment.setrValue2(tempAssignment.getrValue2());
|
||||
getLog().append("Inversing boolean not "+assignment.toString(getProgram()) +" from "+tempAssignment.toString(getProgram()));
|
||||
}
|
||||
|
@ -91,7 +91,7 @@ public class Pass4CodeGeneration {
|
||||
for (ConstantVar constantVar : scopeConstants) {
|
||||
String asmName = constantVar.getAsmName() == null ? constantVar.getLocalName() : constantVar.getAsmName();
|
||||
if (asmName != null && !added.contains(asmName)) {
|
||||
asm.addConstant(asmName.replace("#", "_").replace("$", "_"), getConstantValueAsm(program, constantVar.getValue(), false));
|
||||
asm.addConstant(asmName.replace("#", "_").replace("$", "_"), getConstantValueAsm(program, constantVar.getValue(), 99));
|
||||
added.add(asmName);
|
||||
}
|
||||
}
|
||||
@ -101,11 +101,11 @@ public class Pass4CodeGeneration {
|
||||
* Get ASM code for a constant value
|
||||
*
|
||||
* @param value The constant value
|
||||
* @param subOperator is this generated inside another operator (needing a parenthesis)
|
||||
* @param precedence The precedence of the outer expression operator. Used to generate perenthesis when needed.
|
||||
*
|
||||
* @return The ASM string representing the constant value
|
||||
*/
|
||||
public static String getConstantValueAsm(Program program, Constant value, boolean subOperator) {
|
||||
public static String getConstantValueAsm(Program program, Constant value, int precedence) {
|
||||
if (value instanceof ConstantRef) {
|
||||
value = program.getScope().getConstant((ConstantRef) value);
|
||||
}
|
||||
@ -117,19 +117,23 @@ public class Pass4CodeGeneration {
|
||||
return String.format("$%x", ((ConstantInteger) value).getNumber());
|
||||
} else if (value instanceof ConstantUnary) {
|
||||
ConstantUnary unary = (ConstantUnary) value;
|
||||
Operator operator = unary.getOperator();
|
||||
boolean parenthesis = operator.getPrecedence()>precedence;
|
||||
return
|
||||
(subOperator ? "(" : "") +
|
||||
unary.getOperator().getOperator() +
|
||||
getConstantValueAsm(program, unary.getOperand(), true) +
|
||||
(subOperator ? ")" : "");
|
||||
(parenthesis ? "(" : "") +
|
||||
operator.getOperator() +
|
||||
getConstantValueAsm(program, unary.getOperand(), operator.getPrecedence()) +
|
||||
(parenthesis? ")" : "");
|
||||
} else if (value instanceof ConstantBinary) {
|
||||
ConstantBinary binary = (ConstantBinary) value;
|
||||
Operator operator = binary.getOperator();
|
||||
boolean parenthesis = operator.getPrecedence()>precedence;
|
||||
return
|
||||
(subOperator ? "(" : "") +
|
||||
getConstantValueAsm(program, binary.getLeft(), true) +
|
||||
binary.getOperator().getOperator() +
|
||||
getConstantValueAsm(program, binary.getRight(), true) +
|
||||
(subOperator ? ")" : "");
|
||||
(parenthesis? "(" : "") +
|
||||
getConstantValueAsm(program, binary.getLeft(), operator.getPrecedence()) +
|
||||
operator.getOperator() +
|
||||
getConstantValueAsm(program, binary.getRight(), operator.getPrecedence()) +
|
||||
(parenthesis? ")" : "");
|
||||
} else {
|
||||
throw new RuntimeException("Constant type not supported " + value);
|
||||
}
|
||||
|
File diff suppressed because one or more lines are too long
@ -14,9 +14,9 @@ main: {
|
||||
ldx #yd/$2
|
||||
lda #$0
|
||||
sta x
|
||||
lda #<(SCREEN+($0*$28))+$0
|
||||
lda #<SCREEN+$0*$28+$0
|
||||
sta cursor
|
||||
lda #>(SCREEN+($0*$28))+$0
|
||||
lda #>SCREEN+$0*$28+$0
|
||||
sta cursor+$1
|
||||
b1:
|
||||
ldy #$0
|
||||
|
@ -1462,9 +1462,9 @@ main: {
|
||||
lda #$0
|
||||
sta x
|
||||
//SEG10 [2] phi (byte*) main::cursor#3 = (const byte[1000]) SCREEN#0+(byte) 0*(byte) 40+(byte) 0 -- zpptrby1=cowo1
|
||||
lda #<(SCREEN+($0*$28))+$0
|
||||
lda #<SCREEN+$0*$28+$0
|
||||
sta cursor
|
||||
lda #>(SCREEN+($0*$28))+$0
|
||||
lda #>SCREEN+$0*$28+$0
|
||||
sta cursor+$1
|
||||
jmp b1
|
||||
//SEG11 [2] phi from main::@2 to main::@1
|
||||
@ -1603,9 +1603,9 @@ main: {
|
||||
lda #$0
|
||||
sta x
|
||||
//SEG10 [2] phi (byte*) main::cursor#3 = (const byte[1000]) SCREEN#0+(byte) 0*(byte) 40+(byte) 0 -- zpptrby1=cowo1
|
||||
lda #<(SCREEN+($0*$28))+$0
|
||||
lda #<SCREEN+$0*$28+$0
|
||||
sta cursor
|
||||
lda #>(SCREEN+($0*$28))+$0
|
||||
lda #>SCREEN+$0*$28+$0
|
||||
sta cursor+$1
|
||||
jmp b1
|
||||
//SEG11 [2] phi from main::@2 to main::@1
|
||||
@ -1708,9 +1708,9 @@ main: {
|
||||
lda #$0
|
||||
sta x
|
||||
//SEG10 [2] phi (byte*) main::cursor#3 = (const byte[1000]) SCREEN#0+(byte) 0*(byte) 40+(byte) 0 -- zpptrby1=cowo1
|
||||
lda #<(SCREEN+($0*$28))+$0
|
||||
lda #<SCREEN+$0*$28+$0
|
||||
sta cursor
|
||||
lda #>(SCREEN+($0*$28))+$0
|
||||
lda #>SCREEN+$0*$28+$0
|
||||
sta cursor+$1
|
||||
jmp b1
|
||||
//SEG11 [2] phi from main::@2 to main::@1
|
||||
@ -1806,9 +1806,9 @@ main: {
|
||||
lda #$0
|
||||
sta x
|
||||
//SEG10 [2] phi (byte*) main::cursor#3 = (const byte[1000]) SCREEN#0+(byte) 0*(byte) 40+(byte) 0 -- zpptrby1=cowo1
|
||||
lda #<(SCREEN+($0*$28))+$0
|
||||
lda #<SCREEN+$0*$28+$0
|
||||
sta cursor
|
||||
lda #>(SCREEN+($0*$28))+$0
|
||||
lda #>SCREEN+$0*$28+$0
|
||||
sta cursor+$1
|
||||
jmp b1
|
||||
//SEG11 [2] phi from main::@2 to main::@1
|
||||
@ -1898,9 +1898,9 @@ main: {
|
||||
lda #$0
|
||||
sta x
|
||||
//SEG10 [2] phi (byte*) main::cursor#3 = (const byte[1000]) SCREEN#0+(byte) 0*(byte) 40+(byte) 0 -- zpptrby1=cowo1
|
||||
lda #<(SCREEN+($0*$28))+$0
|
||||
lda #<SCREEN+$0*$28+$0
|
||||
sta cursor
|
||||
lda #>(SCREEN+($0*$28))+$0
|
||||
lda #>SCREEN+$0*$28+$0
|
||||
sta cursor+$1
|
||||
//SEG11 [2] phi from main::@2 to main::@1
|
||||
//SEG12 [2] phi (byte) main::y#2 = (byte) main::y#4 -- register_copy
|
||||
@ -2032,9 +2032,9 @@ main: {
|
||||
lda #$0
|
||||
sta x
|
||||
//SEG10 [2] phi (byte*) main::cursor#3 = (const byte[1000]) SCREEN#0+(byte) 0*(byte) 40+(byte) 0 -- zpptrby1=cowo1
|
||||
lda #<(SCREEN+($0*$28))+$0
|
||||
lda #<SCREEN+$0*$28+$0
|
||||
sta cursor
|
||||
lda #>(SCREEN+($0*$28))+$0
|
||||
lda #>SCREEN+$0*$28+$0
|
||||
sta cursor+$1
|
||||
//SEG11 [2] phi from main::@2 to main::@1
|
||||
//SEG12 [2] phi (byte) main::y#2 = (byte) main::y#4 -- register_copy
|
||||
|
@ -10,7 +10,7 @@
|
||||
sta y
|
||||
ldy #yd/$2
|
||||
ldx #$0
|
||||
lda #$0+($0*$28)
|
||||
lda #$0+$0*$28
|
||||
sta idx
|
||||
lda #$0
|
||||
sta idx+$1
|
||||
|
@ -1195,7 +1195,7 @@ b1_from_bbegin:
|
||||
lda #$0
|
||||
sta x
|
||||
//SEG6 [0] phi (word) idx#3 = (byte) 0+(byte) 0*(byte) 40 -- zpwo1=coby1
|
||||
lda #$0+($0*$28)
|
||||
lda #$0+$0*$28
|
||||
sta idx
|
||||
lda #$0
|
||||
sta idx+$1
|
||||
@ -1322,7 +1322,7 @@ b1_from_bbegin:
|
||||
//SEG5 [0] phi (byte) x#2 = (byte) 0 -- xby=coby1
|
||||
ldx #$0
|
||||
//SEG6 [0] phi (word) idx#3 = (byte) 0+(byte) 0*(byte) 40 -- zpwo1=coby1
|
||||
lda #$0+($0*$28)
|
||||
lda #$0+$0*$28
|
||||
sta idx
|
||||
lda #$0
|
||||
sta idx+$1
|
||||
@ -1420,7 +1420,7 @@ bbegin:
|
||||
//SEG5 [0] phi (byte) x#2 = (byte) 0 -- xby=coby1
|
||||
ldx #$0
|
||||
//SEG6 [0] phi (word) idx#3 = (byte) 0+(byte) 0*(byte) 40 -- zpwo1=coby1
|
||||
lda #$0+($0*$28)
|
||||
lda #$0+$0*$28
|
||||
sta idx
|
||||
lda #$0
|
||||
sta idx+$1
|
||||
@ -1511,7 +1511,7 @@ ASSEMBLER
|
||||
//SEG5 [0] phi (byte) x#2 = (byte) 0 -- xby=coby1
|
||||
ldx #$0
|
||||
//SEG6 [0] phi (word) idx#3 = (byte) 0+(byte) 0*(byte) 40 -- zpwo1=coby1
|
||||
lda #$0+($0*$28)
|
||||
lda #$0+$0*$28
|
||||
sta idx
|
||||
lda #$0
|
||||
sta idx+$1
|
||||
@ -1598,7 +1598,7 @@ ASSEMBLER
|
||||
//SEG5 [0] phi (byte) x#2 = (byte) 0 -- xby=coby1
|
||||
ldx #$0
|
||||
//SEG6 [0] phi (word) idx#3 = (byte) 0+(byte) 0*(byte) 40 -- zpwo1=coby1
|
||||
lda #$0+($0*$28)
|
||||
lda #$0+$0*$28
|
||||
sta idx
|
||||
lda #$0
|
||||
sta idx+$1
|
||||
@ -1725,7 +1725,7 @@ FINAL CODE
|
||||
//SEG5 [0] phi (byte) x#2 = (byte) 0 -- xby=coby1
|
||||
ldx #$0
|
||||
//SEG6 [0] phi (word) idx#3 = (byte) 0+(byte) 0*(byte) 40 -- zpwo1=coby1
|
||||
lda #$0+($0*$28)
|
||||
lda #$0+$0*$28
|
||||
sta idx
|
||||
lda #$0
|
||||
sta idx+$1
|
||||
|
@ -2,7 +2,7 @@
|
||||
.const STAR = $51
|
||||
.const VIC = $d000
|
||||
.const RED = $2
|
||||
.const BGCOL = (VIC+($10*$2))+$1
|
||||
.const BGCOL = VIC+$10*$2+$1
|
||||
jsr main
|
||||
main: {
|
||||
lda #STAR
|
||||
|
@ -645,7 +645,7 @@ INITIAL ASM
|
||||
.const STAR = $51
|
||||
.const VIC = $d000
|
||||
.const RED = $2
|
||||
.const BGCOL = (VIC+($10*$2))+$1
|
||||
.const BGCOL = VIC+$10*$2+$1
|
||||
//SEG1 @begin
|
||||
bbegin:
|
||||
//SEG2 [0] call main param-assignment [ ]
|
||||
@ -717,7 +717,7 @@ ASSEMBLER
|
||||
.const STAR = $51
|
||||
.const VIC = $d000
|
||||
.const RED = $2
|
||||
.const BGCOL = (VIC+($10*$2))+$1
|
||||
.const BGCOL = VIC+$10*$2+$1
|
||||
//SEG1 @begin
|
||||
bbegin:
|
||||
//SEG2 [0] call main param-assignment [ ]
|
||||
@ -765,7 +765,7 @@ ASSEMBLER
|
||||
.const STAR = $51
|
||||
.const VIC = $d000
|
||||
.const RED = $2
|
||||
.const BGCOL = (VIC+($10*$2))+$1
|
||||
.const BGCOL = VIC+$10*$2+$1
|
||||
//SEG1 @begin
|
||||
bbegin:
|
||||
//SEG2 [0] call main param-assignment [ ]
|
||||
@ -814,7 +814,7 @@ ASSEMBLER
|
||||
.const STAR = $51
|
||||
.const VIC = $d000
|
||||
.const RED = $2
|
||||
.const BGCOL = (VIC+($10*$2))+$1
|
||||
.const BGCOL = VIC+$10*$2+$1
|
||||
//SEG1 @begin
|
||||
//SEG2 [0] call main param-assignment [ ]
|
||||
jsr main
|
||||
@ -856,7 +856,7 @@ ASSEMBLER
|
||||
.const STAR = $51
|
||||
.const VIC = $d000
|
||||
.const RED = $2
|
||||
.const BGCOL = (VIC+($10*$2))+$1
|
||||
.const BGCOL = VIC+$10*$2+$1
|
||||
//SEG1 @begin
|
||||
//SEG2 [0] call main param-assignment [ ]
|
||||
jsr main
|
||||
@ -917,7 +917,7 @@ FINAL CODE
|
||||
.const STAR = $51
|
||||
.const VIC = $d000
|
||||
.const RED = $2
|
||||
.const BGCOL = (VIC+($10*$2))+$1
|
||||
.const BGCOL = VIC+$10*$2+$1
|
||||
//SEG1 @begin
|
||||
//SEG2 [0] call main param-assignment [ ]
|
||||
jsr main
|
||||
|
@ -28,9 +28,9 @@ plot: {
|
||||
.label y = 4
|
||||
lda #$10
|
||||
sta y
|
||||
lda #<SCREEN+(($5*$28)+$c)
|
||||
lda #<SCREEN+$5*$28+$c
|
||||
sta line
|
||||
lda #>SCREEN+(($5*$28)+$c)
|
||||
lda #>SCREEN+$5*$28+$c
|
||||
sta line+$1
|
||||
ldx #$0
|
||||
b1:
|
||||
|
@ -4380,9 +4380,9 @@ plot: {
|
||||
lda #$10
|
||||
sta y
|
||||
//SEG35 [15] phi (byte*) plot::line#2 = (const byte[1000]) SCREEN#0+(byte) 5*(byte) 40+(byte) 12 -- zpptrby1=cowo1
|
||||
lda #<SCREEN+(($5*$28)+$c)
|
||||
lda #<SCREEN+$5*$28+$c
|
||||
sta line
|
||||
lda #>SCREEN+(($5*$28)+$c)
|
||||
lda #>SCREEN+$5*$28+$c
|
||||
sta line+$1
|
||||
//SEG36 [15] phi (byte) plot::i#3 = (byte) 0 -- zpby1=coby1
|
||||
lda #$0
|
||||
@ -4738,9 +4738,9 @@ plot: {
|
||||
lda #$10
|
||||
sta y
|
||||
//SEG35 [15] phi (byte*) plot::line#2 = (const byte[1000]) SCREEN#0+(byte) 5*(byte) 40+(byte) 12 -- zpptrby1=cowo1
|
||||
lda #<SCREEN+(($5*$28)+$c)
|
||||
lda #<SCREEN+$5*$28+$c
|
||||
sta line
|
||||
lda #>SCREEN+(($5*$28)+$c)
|
||||
lda #>SCREEN+$5*$28+$c
|
||||
sta line+$1
|
||||
//SEG36 [15] phi (byte) plot::i#3 = (byte) 0 -- xby=coby1
|
||||
ldx #$0
|
||||
@ -5006,9 +5006,9 @@ plot: {
|
||||
lda #$10
|
||||
sta y
|
||||
//SEG35 [15] phi (byte*) plot::line#2 = (const byte[1000]) SCREEN#0+(byte) 5*(byte) 40+(byte) 12 -- zpptrby1=cowo1
|
||||
lda #<SCREEN+(($5*$28)+$c)
|
||||
lda #<SCREEN+$5*$28+$c
|
||||
sta line
|
||||
lda #>SCREEN+(($5*$28)+$c)
|
||||
lda #>SCREEN+$5*$28+$c
|
||||
sta line+$1
|
||||
//SEG36 [15] phi (byte) plot::i#3 = (byte) 0 -- xby=coby1
|
||||
ldx #$0
|
||||
@ -5254,9 +5254,9 @@ plot: {
|
||||
lda #$10
|
||||
sta y
|
||||
//SEG35 [15] phi (byte*) plot::line#2 = (const byte[1000]) SCREEN#0+(byte) 5*(byte) 40+(byte) 12 -- zpptrby1=cowo1
|
||||
lda #<SCREEN+(($5*$28)+$c)
|
||||
lda #<SCREEN+$5*$28+$c
|
||||
sta line
|
||||
lda #>SCREEN+(($5*$28)+$c)
|
||||
lda #>SCREEN+$5*$28+$c
|
||||
sta line+$1
|
||||
//SEG36 [15] phi (byte) plot::i#3 = (byte) 0 -- xby=coby1
|
||||
ldx #$0
|
||||
@ -5483,9 +5483,9 @@ plot: {
|
||||
lda #$10
|
||||
sta y
|
||||
//SEG35 [15] phi (byte*) plot::line#2 = (const byte[1000]) SCREEN#0+(byte) 5*(byte) 40+(byte) 12 -- zpptrby1=cowo1
|
||||
lda #<SCREEN+(($5*$28)+$c)
|
||||
lda #<SCREEN+$5*$28+$c
|
||||
sta line
|
||||
lda #>SCREEN+(($5*$28)+$c)
|
||||
lda #>SCREEN+$5*$28+$c
|
||||
sta line+$1
|
||||
//SEG36 [15] phi (byte) plot::i#3 = (byte) 0 -- xby=coby1
|
||||
ldx #$0
|
||||
@ -5700,9 +5700,9 @@ plot: {
|
||||
lda #$10
|
||||
sta y
|
||||
//SEG35 [15] phi (byte*) plot::line#2 = (const byte[1000]) SCREEN#0+(byte) 5*(byte) 40+(byte) 12 -- zpptrby1=cowo1
|
||||
lda #<SCREEN+(($5*$28)+$c)
|
||||
lda #<SCREEN+$5*$28+$c
|
||||
sta line
|
||||
lda #>SCREEN+(($5*$28)+$c)
|
||||
lda #>SCREEN+$5*$28+$c
|
||||
sta line+$1
|
||||
//SEG36 [15] phi (byte) plot::i#3 = (byte) 0 -- xby=coby1
|
||||
ldx #$0
|
||||
@ -5915,9 +5915,9 @@ plot: {
|
||||
lda #$10
|
||||
sta y
|
||||
//SEG35 [15] phi (byte*) plot::line#2 = (const byte[1000]) SCREEN#0+(byte) 5*(byte) 40+(byte) 12 -- zpptrby1=cowo1
|
||||
lda #<SCREEN+(($5*$28)+$c)
|
||||
lda #<SCREEN+$5*$28+$c
|
||||
sta line
|
||||
lda #>SCREEN+(($5*$28)+$c)
|
||||
lda #>SCREEN+$5*$28+$c
|
||||
sta line+$1
|
||||
//SEG36 [15] phi (byte) plot::i#3 = (byte) 0 -- xby=coby1
|
||||
ldx #$0
|
||||
@ -6220,9 +6220,9 @@ plot: {
|
||||
lda #$10
|
||||
sta y
|
||||
//SEG35 [15] phi (byte*) plot::line#2 = (const byte[1000]) SCREEN#0+(byte) 5*(byte) 40+(byte) 12 -- zpptrby1=cowo1
|
||||
lda #<SCREEN+(($5*$28)+$c)
|
||||
lda #<SCREEN+$5*$28+$c
|
||||
sta line
|
||||
lda #>SCREEN+(($5*$28)+$c)
|
||||
lda #>SCREEN+$5*$28+$c
|
||||
sta line+$1
|
||||
//SEG36 [15] phi (byte) plot::i#3 = (byte) 0 -- xby=coby1
|
||||
ldx #$0
|
||||
|
Loading…
Reference in New Issue
Block a user