complex memory assignment also tries to avoid estack evaluation (but not done yet)

This commit is contained in:
Irmen de Jong 2021-11-06 00:03:19 +01:00
parent 1d2d217b94
commit 37a46aa2cf
3 changed files with 7 additions and 4 deletions

View File

@ -876,6 +876,7 @@ internal class BuiltinFunctionsAsmGen(private val program: Program, private val
}
DataType.FLOAT -> {
// via evaluation stack
// TODO use 2 temporary variables instead
asmgen.translateExpression(first)
asmgen.translateExpression(second)
val assignFirst = AsmAssignment(

View File

@ -181,8 +181,8 @@ internal class AugmentableAssignmentAsmGen(private val program: Program,
}
}
else -> {
// TODO OTHER EVALUATION HERE
asmgen.translateExpression(memory.addressExpression)
// TODO OTHER EVALUATION HERE, don't use the estack
asmgen.assignExpressionTo(memory.addressExpression, AsmAssignTarget(TargetStorageKind.STACK, program, asmgen, DataType.UWORD, memory.definingSubroutine))
asmgen.out(" jsr prog8_lib.read_byte_from_address_on_stack | sta P8ZP_SCRATCH_B1") // TODO don't use estack to transfer the address to read from
when {
valueLv != null -> inplaceModification_byte_litval_to_variable("P8ZP_SCRATCH_B1", DataType.UBYTE, operator, valueLv.toInt())

View File

@ -4,10 +4,12 @@
main {
sub start() {
uword xx=$2000
ubyte yy=30
ubyte yy=$30
ubyte zz=9
; sys.memset(xx+200, yy*2, zz+yy)
@($d020) = (xx+(yy*zz)) as ubyte
@($c030) = 10
@($c000+yy) *= 2
txt.print_ub(@($c030))
}
}