diff --git a/hal/instructions.go b/hal/instructions.go index a2d979a..4504988 100644 --- a/hal/instructions.go +++ b/hal/instructions.go @@ -56,6 +56,8 @@ var instructions = []*Instruction{ InstructionSub, InstructionMul, InstructionDiv, + InstructionLoadInd, + InstructionStoreInd, } var InstructionStart = &Instruction{ @@ -218,3 +220,19 @@ var InstructionSub = newMathInstruction("SUB", subInstr) var InstructionMul = newMathInstruction("MUL", mulInstr) var InstructionDiv = newMathInstruction("DIV", divInstr) + +var InstructionLoadInd = &Instruction{ + Name: "LOADIND", + ExecuteWithOperand: func(module *Module, operand float64) error { + module.mmu.Read(Address(operand)) + return nil + }, +} + +var InstructionStoreInd = &Instruction{ + Name: "STOREIND", + ExecuteWithOperand: func(module *Module, operand float64) error { + module.mmu.Write(Address(operand), module.accumulator) + return nil + }, +}