mirror of
https://github.com/KarolS/millfork.git
synced 2025-01-11 12:29:46 +00:00
6502: Fix word multiplication by 0
This commit is contained in:
parent
1a87929ad3
commit
127cd1b901
@ -47,6 +47,8 @@ This matches both the CC65 behaviour and the return values from `readkey()`.
|
||||
* 6502: miscompilation when using the zeropage pseudoregister;
|
||||
|
||||
* 6502: stack overflow when inlining local variables into registers;
|
||||
|
||||
* 6502: not setting the high byte to 0 when optimizing word multiplication by 0
|
||||
|
||||
* 8080/Z80: compiler crash when compiling conditions;
|
||||
|
||||
|
@ -107,7 +107,7 @@ object ZeropageRegisterOptimizations {
|
||||
(Elidable & HasOpcode(JSR) & RefersTo("__mul_u16u8u16", 0)) ~~> { (code, ctx) =>
|
||||
val constant = ctx.get[Int](4)
|
||||
if (constant == 0) {
|
||||
code.init :+ AssemblyLine.immediate(LDA, 0)
|
||||
code.init ++ List(AssemblyLine.immediate(LDA, 0), AssemblyLine.immediate(LDX, 0))
|
||||
} else {
|
||||
val loAsl = code.head.copy(opcode = ASL, parameter = (code.head.parameter - 2).quickSimplify)
|
||||
val hiRol = code.head.copy(opcode = ROL, parameter = (code.head.parameter - 1).quickSimplify)
|
||||
|
Loading…
x
Reference in New Issue
Block a user