fixed source code output issue

This commit is contained in:
Irmen de Jong 2020-08-22 22:23:00 +02:00
parent bd9ebf4603
commit e947067dcf
2 changed files with 10 additions and 9 deletions

View File

@ -288,7 +288,9 @@ class AstToSourceCode(val output: (text: String) -> Unit, val program: Program):
override fun visit(assignment: Assignment) {
val binExpr = assignment.value as? BinaryExpression
if(binExpr!=null && binExpr.left isSameAs assignment.target) {
if(binExpr!=null && binExpr.left isSameAs assignment.target
&& binExpr.operator !in setOf("and", "or", "xor")
&& binExpr.operator !in comparisonOperators) {
// we only support the inplace assignments of the form A = A <operator> <value>
assignment.target.accept(this)
output(" ${binExpr.operator}= ")

View File

@ -7,15 +7,14 @@ main {
sub start() {
ubyte ub
uword uw = $ee44
ubyte vlsb = $11
ubyte vmsb = $ff
ubyte a = 1
ubyte b = 2
ubyte c = 20
ubyte d = 4
uw = mkword(vmsb, vlsb) ; todo flip the order of the operands , MSB first
c64scr.print_uwhex(uw, 1)
uw = mkword($ee, $22) ; todo flip the order of the operands , MSB first
c64scr.print_uwhex(uw, 1)
a = c % 6
c64scr.print_ub(a)
}
}