Fix instructions

master
Jonas Franz 4 years ago
parent 5bb892d1dd
commit d0cb1b0013
Signed by: JonasFranzDEV
GPG Key ID: 7293A220B7C38080
  1. 6
      hal/instructions.go

@ -214,7 +214,8 @@ var InstructionDiv = newMathInstruction("DIV", divInstr)
var InstructionLoadInd = &Instruction{
Name: "LOADIND",
ExecuteWithOperand: func(module *Module, operand float64) error {
module.mmu.Read(Address(module.register[int(operand)]))
targetAddr := module.mmu.Read(Address(operand))
module.mmu.Read(Address(targetAddr))
return nil
},
}
@ -222,7 +223,8 @@ var InstructionLoadInd = &Instruction{
var InstructionStoreInd = &Instruction{
Name: "STOREIND",
ExecuteWithOperand: func(module *Module, operand float64) error {
module.mmu.Write(Address(module.register[int(operand)]), module.accumulator)
targetAddr := module.mmu.Read(Address(operand))
module.mmu.Write(Address(targetAddr), module.accumulator)
return nil
},
}

Loading…
Cancel
Save