From f29bcbb2ae89f2af029a5bde7aaac4c50537b2f4 Mon Sep 17 00:00:00 2001 From: kolaente <k@knt.li> Date: Mon, 22 Jun 2020 16:51:19 +0200 Subject: [PATCH] Fix LOADIND and STOREIND --- hal/instructions.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hal/instructions.go b/hal/instructions.go index b1d4900..71ad01e 100644 --- a/hal/instructions.go +++ b/hal/instructions.go @@ -226,7 +226,7 @@ var InstructionDiv = newMathInstruction("DIV", divInstr) var InstructionLoadInd = &Instruction{ Name: "LOADIND", ExecuteWithOperand: func(module *Module, operand float64) error { - module.mmu.Read(Address(operand)) + module.mmu.Read(Address(module.register[int(operand)])) return nil }, } @@ -234,7 +234,7 @@ var InstructionLoadInd = &Instruction{ var InstructionStoreInd = &Instruction{ Name: "STOREIND", ExecuteWithOperand: func(module *Module, operand float64) error { - module.mmu.Write(Address(operand), module.accumulator) + module.mmu.Write(Address(module.register[int(operand)]), module.accumulator) return nil }, }