fix invalid addressing mode on 6502 cpu for bytevalue +/- bytearray[i]

This commit is contained in:
Irmen de Jong 2023-09-07 21:35:54 +02:00
parent 3caf9108ad
commit 23a8bebd9e
2 changed files with 3 additions and 3 deletions

View File

@ -740,8 +740,8 @@ internal class AssignmentAsmGen(private val program: PtProgram,
}
else -> {
val rightArrayIndexer = expr.right as? PtArrayIndexer
if(rightArrayIndexer!=null && rightArrayIndexer.type in ByteDatatypes && left.type in ByteDatatypes) {
// special optimization for bytevalue +/- bytearr[y] : no need to use a tempvar, just use adc array,y or sbc array,y
if(asmgen.isTargetCpu(CpuType.CPU65c02) && rightArrayIndexer!=null && rightArrayIndexer.type in ByteDatatypes && left.type in ByteDatatypes) {
// special optimization (available on 65c02) for bytevalue +/- bytearr[y] : no need to use a tempvar, just use adc array,y or sbc array,y
assignExpressionToRegister(left, RegisterOrPair.A, left.type==DataType.BYTE)
asmgen.out(" pha")
asmgen.assignExpressionToRegister(rightArrayIndexer.index, RegisterOrPair.Y, false)

View File

@ -5,4 +5,4 @@ org.gradle.daemon=true
kotlin.code.style=official
javaVersion=11
kotlinVersion=1.9.10
version=9.4.1
version=9.4.2