1
0
mirror of https://github.com/KarolS/millfork.git synced 2025-01-06 09:33:22 +00:00

(part 2) 6502: Do not optimize away register restoration in interrupt routines (fixes #19)

This commit is contained in:
Karol Stasiak 2019-11-13 19:08:50 +01:00
parent b10d8d7eeb
commit 7b040c280b

View File

@ -136,7 +136,7 @@ object MosStatementCompiler extends AbstractStatementCompiler[AssemblyLine] {
val lastByte = if (zpRegisterSize % 2 != 0) {
List(
AssemblyLine.implied(PLA),
AssemblyLine.zeropage(STA, reg, zpRegisterSize - 1),
AssemblyLine.zeropage(STA, reg, zpRegisterSize - 1).copy(elidability = Elidability.Volatile),
AssemblyLine.accu16)
} else {
List(AssemblyLine.accu16)
@ -144,7 +144,7 @@ object MosStatementCompiler extends AbstractStatementCompiler[AssemblyLine] {
val remainingBytes = (zpRegisterSize.&(0xfe).-(2) to 0 by (-2)).flatMap { i =>
List(
AssemblyLine.implied(PLA_W),
AssemblyLine.zeropage(STA_W, reg, i),
AssemblyLine.zeropage(STA_W, reg, i).copy(elidability = Elidability.Volatile),
AssemblyLine.accu8)
}
lastByte ++ remainingBytes