From 52e25e826ea5d1cd675b07f192f384e0f4102557 Mon Sep 17 00:00:00 2001
From: Jonas Franz <info@jonasfranz.software>
Date: Sat, 20 Jun 2020 14:55:10 +0200
Subject: [PATCH] Add dump instructions

---
 hal/instructions.go | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

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
+	},
+}