Add LOADIND and STOREIND

master
kolaente 4 years ago
parent 3eaaf78c79
commit 40cb893344
Signed by: kolaente
GPG Key ID: F40E70337AB24C9B
  1. 18
      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
},
}

Loading…
Cancel
Save