Skip to content

Commit

Permalink
fix invalid addressing mode on 6502 cpu for bytevalue +/- bytearray[i]
Browse files Browse the repository at this point in the history
  • Loading branch information
irmen committed Sep 7, 2023
1 parent 3caf910 commit 23a8beb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 23a8beb

Please sign in to comment.