mirror of
https://github.com/irmen/prog8.git
synced 2024-11-27 03:50:27 +00:00
fix rest of possible temp variable conflicts
This commit is contained in:
parent
c0cb2438d5
commit
c9ef777e0f
@ -1080,12 +1080,12 @@ internal class AugmentableAssignmentAsmGen(private val program: PtProgram,
|
|||||||
}
|
}
|
||||||
"-" -> {
|
"-" -> {
|
||||||
asmgen.translateDirectMemReadExpressionToRegAorStack(memread, false)
|
asmgen.translateDirectMemReadExpressionToRegAorStack(memread, false)
|
||||||
// TODO fix temp var name
|
val tmpByte = if(name!="P8ZP_SCRATCH_B1") "P8ZP_SCRATCH_B1" else "P8ZP_SCRATCH_REG"
|
||||||
asmgen.out("""
|
asmgen.out("""
|
||||||
sta P8ZP_SCRATCH_B1
|
sta $tmpByte
|
||||||
lda $name
|
lda $name
|
||||||
sec
|
sec
|
||||||
sbc P8ZP_SCRATCH_B1
|
sbc $tmpByte
|
||||||
sta $name""")
|
sta $name""")
|
||||||
}
|
}
|
||||||
"|" -> {
|
"|" -> {
|
||||||
@ -1120,12 +1120,12 @@ internal class AugmentableAssignmentAsmGen(private val program: PtProgram,
|
|||||||
}
|
}
|
||||||
"-" -> {
|
"-" -> {
|
||||||
asmgen.translateDirectMemReadExpressionToRegAorStack(memread, false)
|
asmgen.translateDirectMemReadExpressionToRegAorStack(memread, false)
|
||||||
// TODO fix temp var name
|
val tmpByte = if(name!="P8ZP_SCRATCH_B1") "P8ZP_SCRATCH_B1" else "P8ZP_SCRATCH_REG"
|
||||||
asmgen.out("""
|
asmgen.out("""
|
||||||
sta P8ZP_SCRATCH_B1
|
sta $tmpByte
|
||||||
lda $name
|
lda $name
|
||||||
sec
|
sec
|
||||||
sbc P8ZP_SCRATCH_B1
|
sbc $tmpByte
|
||||||
sta $name
|
sta $name
|
||||||
bcc +
|
bcc +
|
||||||
dec $name+1
|
dec $name+1
|
||||||
@ -1214,7 +1214,6 @@ internal class AugmentableAssignmentAsmGen(private val program: PtProgram,
|
|||||||
if(value in asmgen.optimizedWordMultiplications) {
|
if(value in asmgen.optimizedWordMultiplications) {
|
||||||
asmgen.out(" lda $name | ldy $name+1 | jsr math.mul_word_$value | sta $name | sty $name+1")
|
asmgen.out(" lda $name | ldy $name+1 | jsr math.mul_word_$value | sta $name | sty $name+1")
|
||||||
} else {
|
} else {
|
||||||
// TODO fix temp var name
|
|
||||||
asmgen.out("""
|
asmgen.out("""
|
||||||
lda $name
|
lda $name
|
||||||
sta P8ZP_SCRATCH_W1
|
sta P8ZP_SCRATCH_W1
|
||||||
@ -1669,7 +1668,6 @@ internal class AugmentableAssignmentAsmGen(private val program: PtProgram,
|
|||||||
sta $name+1""")
|
sta $name+1""")
|
||||||
}
|
}
|
||||||
"*" -> {
|
"*" -> {
|
||||||
// TODO fix temp var name
|
|
||||||
if(valueDt==DataType.UBYTE) {
|
if(valueDt==DataType.UBYTE) {
|
||||||
asmgen.out(" lda $otherName | sta P8ZP_SCRATCH_W1")
|
asmgen.out(" lda $otherName | sta P8ZP_SCRATCH_W1")
|
||||||
if(asmgen.isTargetCpu(CpuType.CPU65c02))
|
if(asmgen.isTargetCpu(CpuType.CPU65c02))
|
||||||
@ -2012,9 +2010,6 @@ internal class AugmentableAssignmentAsmGen(private val program: PtProgram,
|
|||||||
private fun inplaceModification_word_value_to_variable(name: String, dt: DataType, operator: String, value: PtExpression) {
|
private fun inplaceModification_word_value_to_variable(name: String, dt: DataType, operator: String, value: PtExpression) {
|
||||||
// this should be the last resort for code generation for this,
|
// this should be the last resort for code generation for this,
|
||||||
// because the value is evaluated onto the eval stack (=slow).
|
// because the value is evaluated onto the eval stack (=slow).
|
||||||
|
|
||||||
// TODO fix temp var names
|
|
||||||
|
|
||||||
fun multiplyVarByWordInAY() {
|
fun multiplyVarByWordInAY() {
|
||||||
asmgen.out("""
|
asmgen.out("""
|
||||||
sta P8ZP_SCRATCH_W1
|
sta P8ZP_SCRATCH_W1
|
||||||
|
Loading…
Reference in New Issue
Block a user