diff --git a/codeGenCpu6502/src/prog8/codegen/cpu6502/BuiltinFunctionsAsmGen.kt b/codeGenCpu6502/src/prog8/codegen/cpu6502/BuiltinFunctionsAsmGen.kt index 1cab673b2..d4c5aae45 100644 --- a/codeGenCpu6502/src/prog8/codegen/cpu6502/BuiltinFunctionsAsmGen.kt +++ b/codeGenCpu6502/src/prog8/codegen/cpu6502/BuiltinFunctionsAsmGen.kt @@ -865,9 +865,9 @@ internal class BuiltinFunctionsAsmGen(private val program: Program, val mr0 = fcall.args[0] as? DirectMemoryRead val mr1 = fcall.args[1] as? DirectMemoryRead if (mr0 != null) - needAsave = mr0.addressExpression !is NumericLiteral && mr0.addressExpression !is IdentifierReference + needAsave = mr0.addressExpression !is NumericLiteral if (mr1 != null) - needAsave = needAsave or (mr1.addressExpression !is NumericLiteral && mr1.addressExpression !is IdentifierReference) + needAsave = needAsave or (mr1.addressExpression !is NumericLiteral) } when(reg) { RegisterOrPair.AX -> { diff --git a/docs/source/todo.rst b/docs/source/todo.rst index ffee1d3bf..4a605dac6 100644 --- a/docs/source/todo.rst +++ b/docs/source/todo.rst @@ -3,8 +3,6 @@ TODO For next release ^^^^^^^^^^^^^^^^ -- crc ^= mkword(@(data), 0) produces faulty asm, as opposed to crc ^= mkword(variable, 0) - ... diff --git a/examples/test.p8 b/examples/test.p8 index 8edc1dc61..60dc270d6 100644 --- a/examples/test.p8 +++ b/examples/test.p8 @@ -3,18 +3,16 @@ main { sub start() { - ubyte left = $12 - ubyte right = $34 - uword ww + ubyte[] buffer = [$11,$22,$33,$44] + uword data = &buffer - ww = mkword(left, right) - txt.print_uwhex(ww, true) - ww = mkword(left, 0) - txt.print_uwhex(ww, true) - ww = mkword(0, right) - txt.print_uwhex(ww, true) - ww = right as uword - txt.print_uwhex(ww, true) + uword crc = $ffff + crc ^= mkword(@(data), 0) + txt.print_uwhex(crc, true) + crc = $ffff + ubyte variable = @(data) + crc ^= mkword(variable, 0) + txt.print_uwhex(crc, true) } ; sub start2() {