mirror of
https://github.com/KarolS/millfork.git
synced 2024-07-10 10:28:55 +00:00
6502: Fix fatal failure when considering undocumented optimizations (fixes #38)
This commit is contained in:
parent
6774c283ae
commit
f247516187
@ -134,7 +134,7 @@ object UndocumentedOptimizations {
|
|||||||
(Elidable & HasOpcode(INX) & DoesntMatterWhatItDoesWith(State.A)).+.captureLength(0) ~
|
(Elidable & HasOpcode(INX) & DoesntMatterWhatItDoesWith(State.A)).+.captureLength(0) ~
|
||||||
Where(_.get[Int](0) > 2) ~~> ((_, ctx) => List(
|
Where(_.get[Int](0) > 2) ~~> ((_, ctx) => List(
|
||||||
AssemblyLine.implied(TXA),
|
AssemblyLine.implied(TXA),
|
||||||
AssemblyLine.immediate(SBX, Constant.Zero - ctx.get[Constant](0)),
|
AssemblyLine.immediate(SBX, Constant.Zero - ctx.get[Int](0)),
|
||||||
)),
|
)),
|
||||||
HasOpcode(TXA) ~
|
HasOpcode(TXA) ~
|
||||||
(Elidable & HasOpcode(CLC)).? ~
|
(Elidable & HasOpcode(CLC)).? ~
|
||||||
|
@ -261,4 +261,27 @@ class IllegalSuite extends FunSuite with Matchers {
|
|||||||
""".stripMargin)
|
""".stripMargin)
|
||||||
m.readLong(0xc000) should equal(1)
|
m.readLong(0xc000) should equal(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
test("Test issue #38") {
|
||||||
|
val m = EmuUndocumentedRun(
|
||||||
|
"""
|
||||||
|
|array(byte) input [16] @ $c300
|
||||||
|
|const byte COUNT = 16
|
||||||
|
|byte output @$c000
|
||||||
|
|void main() {
|
||||||
|
| inner()
|
||||||
|
|}
|
||||||
|
|
|
||||||
|
|void inner() {
|
||||||
|
| byte j
|
||||||
|
| for j,0,until,COUNT {
|
||||||
|
| if input[j] == 0 {
|
||||||
|
| continue
|
||||||
|
| }
|
||||||
|
| //output += 1
|
||||||
|
| }
|
||||||
|
|}
|
||||||
|
|
|
||||||
|
|""".stripMargin)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,10 @@ object EmuUndocumentedRun extends EmuRun(
|
|||||||
UndocumentedOptimizations.All ++
|
UndocumentedOptimizations.All ++
|
||||||
OptimizationPresets.Good ++ LaterOptimizations.Nmos ++
|
OptimizationPresets.Good ++ LaterOptimizations.Nmos ++
|
||||||
UndocumentedOptimizations.All ++
|
UndocumentedOptimizations.All ++
|
||||||
|
OptimizationPresets.AssOpt ++ LaterOptimizations.Nmos ++
|
||||||
|
UndocumentedOptimizations.All ++
|
||||||
|
OptimizationPresets.AssOpt ++ LaterOptimizations.Nmos ++
|
||||||
|
UndocumentedOptimizations.All ++
|
||||||
OptimizationPresets.Good) {
|
OptimizationPresets.Good) {
|
||||||
|
|
||||||
override def emitIllegals = true
|
override def emitIllegals = true
|
||||||
|
Loading…
Reference in New Issue
Block a user