From c21428215e57016c16f3a5d6fa0f34ea6cc768aa Mon Sep 17 00:00:00 2001 From: Irmen de Jong Date: Sat, 29 Apr 2023 14:39:14 +0200 Subject: [PATCH] fix possible mkword() error --- .../src/prog8/codegen/cpu6502/BuiltinFunctionsAsmGen.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/codeGenCpu6502/src/prog8/codegen/cpu6502/BuiltinFunctionsAsmGen.kt b/codeGenCpu6502/src/prog8/codegen/cpu6502/BuiltinFunctionsAsmGen.kt index 3bb4551fe..7cd611e0d 100644 --- a/codeGenCpu6502/src/prog8/codegen/cpu6502/BuiltinFunctionsAsmGen.kt +++ b/codeGenCpu6502/src/prog8/codegen/cpu6502/BuiltinFunctionsAsmGen.kt @@ -828,9 +828,10 @@ internal class BuiltinFunctionsAsmGen(private val program: PtProgram, private fun funcMkword(fcall: PtBuiltinFunctionCall, resultToStack: Boolean, resultRegister: RegisterOrPair?) { if(resultToStack) { - asmgen.assignExpressionToRegister(fcall.args[0], RegisterOrPair.Y) // msb + asmgen.assignExpressionToRegister(fcall.args[0], RegisterOrPair.A) // msb + asmgen.out(" pha") asmgen.assignExpressionToRegister(fcall.args[1], RegisterOrPair.A) // lsb - asmgen.out(" sta P8ESTACK_LO,x | tya | sta P8ESTACK_HI,x | dex") + asmgen.out(" sta P8ESTACK_LO,x | pla | sta P8ESTACK_HI,x | dex") } else { val reg = resultRegister ?: RegisterOrPair.AY var needAsave = asmgen.needAsaveForExpr(fcall.args[0])