Add dump instructions

master
Jonas Franz 4 years ago committed by Jonas Franz
parent 3eaaf78c79
commit 52e25e826e
  1. 22
      hal/instructions.go

@ -56,6 +56,8 @@ var instructions = []*Instruction{
InstructionSub,
InstructionMul,
InstructionDiv,
InstructionDumpReg,
InstructionDumpProg,
}
var InstructionStart = &Instruction{
@ -218,3 +220,23 @@ var InstructionSub = newMathInstruction("SUB", subInstr)
var InstructionMul = newMathInstruction("MUL", mulInstr)
var InstructionDiv = newMathInstruction("DIV", divInstr)
var InstructionDumpReg = &Instruction{
Name: "DUMPREG",
Execute: func(module *Module) error {
for index, content := range module.register {
module.debug("%d:\t%d", index, content)
}
return nil
},
}
var InstructionDumpProg = &Instruction{
Name: "DUMPPROG",
Execute: func(module *Module) error {
for index, content := range module.programStorage {
module.debug("%d\t%s\t%d", index, content.Instruction.Name, content.Operand)
}
return nil
},
}

Loading…
Cancel
Save