diff --git a/hal/instructions.go b/hal/instructions.go index a2d979a..b81e58e 100644 --- a/hal/instructions.go +++ b/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 + }, +}