mirror of
https://github.com/irmen/prog8.git
synced 2025-02-18 05:30:34 +00:00
optimize loading A from pointervar
This commit is contained in:
parent
e545ea9504
commit
397f98513b
@ -643,6 +643,13 @@ class AsmGen(private val program: Program,
|
|||||||
out(" ldy #0 | sta ($zpPointerVar),y")
|
out(" ldy #0 | sta ($zpPointerVar),y")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal fun loadAFromZpPointerVar(zpPointerVar: String) {
|
||||||
|
if (isTargetCpu(CpuType.CPU65c02))
|
||||||
|
out(" lda ($zpPointerVar)")
|
||||||
|
else
|
||||||
|
out(" ldy #0 | lda ($zpPointerVar),y")
|
||||||
|
}
|
||||||
|
|
||||||
private fun fixNameSymbols(name: String): String {
|
private fun fixNameSymbols(name: String): String {
|
||||||
val name2 = name.replace("<", "prog8_").replace(">", "") // take care of the autogenerated invalid (anon) label names
|
val name2 = name.replace("<", "prog8_").replace(">", "") // take care of the autogenerated invalid (anon) label names
|
||||||
return name2.replace("prog8_lib.P8ZP_SCRATCH_", "P8ZP_SCRATCH_") // take care of the 'hooks' to the temp vars
|
return name2.replace("prog8_lib.P8ZP_SCRATCH_", "P8ZP_SCRATCH_") // take care of the 'hooks' to the temp vars
|
||||||
@ -3237,5 +3244,4 @@ $label nop""")
|
|||||||
else -> return false
|
else -> return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -125,10 +125,7 @@ internal class AssignmentAsmGen(private val program: Program, private val asmgen
|
|||||||
SourceStorageKind.MEMORY -> {
|
SourceStorageKind.MEMORY -> {
|
||||||
fun assignViaExprEval(expression: Expression) {
|
fun assignViaExprEval(expression: Expression) {
|
||||||
assignExpressionToVariable(expression, "P8ZP_SCRATCH_W2", DataType.UWORD, assign.target.scope)
|
assignExpressionToVariable(expression, "P8ZP_SCRATCH_W2", DataType.UWORD, assign.target.scope)
|
||||||
if (asmgen.isTargetCpu(CpuType.CPU65c02))
|
asmgen.loadAFromZpPointerVar("P8ZP_SCRATCH_W2")
|
||||||
asmgen.out(" lda (P8ZP_SCRATCH_W2)")
|
|
||||||
else
|
|
||||||
asmgen.out(" ldy #0 | lda (P8ZP_SCRATCH_W2),y")
|
|
||||||
assignRegisterByte(assign.target, CpuRegister.A)
|
assignRegisterByte(assign.target, CpuRegister.A)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -341,10 +338,7 @@ internal class AssignmentAsmGen(private val program: Program, private val asmgen
|
|||||||
|
|
||||||
fun assignViaExprEval(addressExpression: Expression) {
|
fun assignViaExprEval(addressExpression: Expression) {
|
||||||
asmgen.assignExpressionToVariable(addressExpression, "P8ZP_SCRATCH_W2", DataType.UWORD, null)
|
asmgen.assignExpressionToVariable(addressExpression, "P8ZP_SCRATCH_W2", DataType.UWORD, null)
|
||||||
if (asmgen.isTargetCpu(CpuType.CPU65c02))
|
asmgen.loadAFromZpPointerVar("P8ZP_SCRATCH_W2")
|
||||||
asmgen.out(" lda (P8ZP_SCRATCH_W2)")
|
|
||||||
else
|
|
||||||
asmgen.out(" ldy #0 | lda (P8ZP_SCRATCH_W2),y")
|
|
||||||
assignRegisterByte(target, CpuRegister.A)
|
assignRegisterByte(target, CpuRegister.A)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1816,9 +1816,8 @@ internal class AugmentableAssignmentAsmGen(private val program: Program,
|
|||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
asmgen.assignExpressionToVariable(mem.addressExpression, "P8ZP_SCRATCH_W2", DataType.UWORD, target.scope)
|
asmgen.assignExpressionToVariable(mem.addressExpression, "P8ZP_SCRATCH_W2", DataType.UWORD, target.scope)
|
||||||
|
asmgen.loadAFromZpPointerVar("P8ZP_SCRATCH_W2")
|
||||||
asmgen.out("""
|
asmgen.out("""
|
||||||
ldy #0
|
|
||||||
lda (P8ZP_SCRATCH_W2),y
|
|
||||||
beq +
|
beq +
|
||||||
lda #1
|
lda #1
|
||||||
+ eor #1""")
|
+ eor #1""")
|
||||||
|
@ -3,10 +3,6 @@ TODO
|
|||||||
|
|
||||||
For next compiler release (7.5)
|
For next compiler release (7.5)
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
BUG: imageviewer.p8 iff loader: winterqueen.iff (EHB image) is not displayed correctly!
|
|
||||||
--> make_ehb_palette() is wrong with optimizations, ok without.
|
|
||||||
--> caused by splitBinaryExpressions()
|
|
||||||
|
|
||||||
...
|
...
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user