mirror of
https://github.com/irmen/prog8.git
synced 2024-11-18 19:12:44 +00:00
optimized in-place float var modification, not using translateExpression()
This commit is contained in:
parent
a7f56fe0fc
commit
ab1232d742
@ -737,7 +737,10 @@ internal class AssignmentAsmGen(private val program: Program, private val asmgen
|
||||
asmgen.out(" jsr floats.set_array_float_from_fac1")
|
||||
}
|
||||
TargetStorageKind.MEMORY -> throw AssemblyError("can't assign float to mem byte")
|
||||
TargetStorageKind.REGISTER -> throw AssemblyError("can't assign Fac1 float to another fac register")
|
||||
TargetStorageKind.REGISTER -> {
|
||||
if (target.register!! != RegisterOrPair.FAC1)
|
||||
throw AssemblyError("can't assign Fac1 float to another fac register")
|
||||
}
|
||||
TargetStorageKind.STACK -> asmgen.out(" jsr floats.push_fac1")
|
||||
}
|
||||
}
|
||||
|
@ -1381,12 +1381,7 @@ internal class AugmentableAssignmentAsmGen(private val program: Program,
|
||||
}
|
||||
|
||||
private fun inplaceModification_float_value_to_variable(name: String, operator: String, value: Expression, scope: Subroutine) {
|
||||
// this should be the last resort for code generation for this,
|
||||
// because the value is evaluated onto the eval stack (=slow).
|
||||
if(asmgen.options.slowCodegenWarnings)
|
||||
println("warning: slow stack evaluation used (2): $name $operator= ${value::class.simpleName} at ${value.position}") // TODO
|
||||
asmgen.translateExpression(value)
|
||||
asmgen.out(" jsr floats.pop_float_fac1")
|
||||
asmgen.assignExpressionToRegister(value, RegisterOrPair.FAC1)
|
||||
asmgen.saveRegister(CpuRegister.X, false, scope)
|
||||
when (operator) {
|
||||
"**" -> {
|
||||
|
@ -49,7 +49,7 @@ turtle {
|
||||
uword xx = xpos as uword
|
||||
c64.SPXY[0] = lsb(xx) + 12
|
||||
c64.MSIGX = msb(xx) > 0
|
||||
c64.SPXY[1] = ypos as ubyte + 37
|
||||
c64.SPXY[1] = ypos as ubyte + 40
|
||||
}
|
||||
|
||||
sub pos(float x, float y) {
|
||||
|
Loading…
Reference in New Issue
Block a user