inplace not and invert for memory now without translateExpression()

This commit is contained in:
Irmen de Jong 2020-11-18 23:13:07 +01:00
parent 4278f64682
commit 2da28864e9
2 changed files with 14 additions and 20 deletions

View File

@ -1696,16 +1696,14 @@ internal class AugmentableAssignmentAsmGen(private val program: Program,
asmgen.out(" sta (P8ZP_SCRATCH_W1),y")
}
else -> {
if(asmgen.options.slowCodegenWarnings)
println("warning: slow stack evaluation used (6): ${mem.addressExpression::class.simpleName} at ${mem.addressExpression.position}") // TODO
asmgen.translateExpression(mem.addressExpression) // TODO directly into P8ZP_SCRATCH_W2
asmgen.assignExpressionToVariable(mem.addressExpression, asmgen.asmVariableName("P8ZP_SCRATCH_W2"), DataType.UWORD, target.scope)
asmgen.out("""
jsr prog8_lib.read_byte_from_address_on_stack
ldy #0
lda (P8ZP_SCRATCH_W2),y
beq +
lda #1
+ eor #1
jsr prog8_lib.write_byte_to_address_on_stack
inx""")
sta (P8ZP_SCRATCH_W2),y""")
}
}
}
@ -1766,14 +1764,12 @@ internal class AugmentableAssignmentAsmGen(private val program: Program,
asmgen.out(" sta (P8ZP_SCRATCH_W1),y")
}
else -> {
if(asmgen.options.slowCodegenWarnings)
println("warning: slow stack evaluation used (7): ${memory.addressExpression::class.simpleName} at ${memory.addressExpression.position}") // TODO
asmgen.translateExpression(memory.addressExpression) // TODO directly into P8ZP_SCRATCH_W2
asmgen.assignExpressionToVariable(memory.addressExpression, asmgen.asmVariableName("P8ZP_SCRATCH_W2"), DataType.UWORD, target.scope)
asmgen.out("""
jsr prog8_lib.read_byte_from_address_on_stack
ldy #0
lda (P8ZP_SCRATCH_W2),y
eor #255
jsr prog8_lib.write_byte_to_address_on_stack
inx""")
sta (P8ZP_SCRATCH_W2),y""")
}
}
}

View File

@ -6,16 +6,14 @@ main {
sub start() {
ubyte ub = 2
ubyte ub2 = 8
uword uw = 5
ubyte ub = 1
ubyte ub2 = %11000011
ub2 <<= (ub-1)
txt.print_ub(ub2)
txt.chrout('\n')
@($c001) = %1
ub2 >>= (ub-1)
txt.print_ub(ub2)
@($c000+ub) += @($c000+ub)
ub2 = @($c000+ub)
txt.print_ubbin(ub2, 1)
txt.chrout('\n')
testX()