From 60cbb028224f3c0e1b5e832d78a3add0cf3e19c4 Mon Sep 17 00:00:00 2001 From: Irmen de Jong Date: Sat, 8 Jul 2023 23:05:03 +0200 Subject: [PATCH] vm: actually fix EXT(S) in vm too --- virtualmachine/src/prog8/vm/VirtualMachine.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/virtualmachine/src/prog8/vm/VirtualMachine.kt b/virtualmachine/src/prog8/vm/VirtualMachine.kt index 00c4c8af2..218d2aacd 100644 --- a/virtualmachine/src/prog8/vm/VirtualMachine.kt +++ b/virtualmachine/src/prog8/vm/VirtualMachine.kt @@ -1589,7 +1589,7 @@ class VirtualMachine(irProgram: IRProgram) { private fun InsEXT(i: IRInstruction) { when(i.type!!){ - IRDataType.BYTE -> registers.setUW(i.reg1!!, registers.getUB(i.reg1!!).toUShort()) + IRDataType.BYTE -> registers.setUW(i.reg1!!, registers.getUB(i.reg2!!).toUShort()) IRDataType.WORD -> throw IllegalArgumentException("ext.w not yet supported, requires 32 bits registers") IRDataType.FLOAT -> throw IllegalArgumentException("invalid float type for this instruction $i") } @@ -1598,7 +1598,7 @@ class VirtualMachine(irProgram: IRProgram) { private fun InsEXTS(i: IRInstruction) { when(i.type!!){ - IRDataType.BYTE -> registers.setSW(i.reg1!!, registers.getSB(i.reg1!!).toShort()) + IRDataType.BYTE -> registers.setSW(i.reg1!!, registers.getSB(i.reg2!!).toShort()) IRDataType.WORD -> throw IllegalArgumentException("exts.w not yet supported, requires 32 bits registers") IRDataType.FLOAT -> throw IllegalArgumentException("invalid float type for this instruction $i") }