|
|
@ -56,6 +56,8 @@ var instructions = []*Instruction{ |
|
|
|
InstructionSub, |
|
|
|
InstructionSub, |
|
|
|
InstructionMul, |
|
|
|
InstructionMul, |
|
|
|
InstructionDiv, |
|
|
|
InstructionDiv, |
|
|
|
|
|
|
|
InstructionDumpReg, |
|
|
|
|
|
|
|
InstructionDumpProg, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var InstructionStart = &Instruction{ |
|
|
|
var InstructionStart = &Instruction{ |
|
|
@ -218,3 +220,23 @@ var InstructionSub = newMathInstruction("SUB", subInstr) |
|
|
|
var InstructionMul = newMathInstruction("MUL", mulInstr) |
|
|
|
var InstructionMul = newMathInstruction("MUL", mulInstr) |
|
|
|
|
|
|
|
|
|
|
|
var InstructionDiv = newMathInstruction("DIV", divInstr) |
|
|
|
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 |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
} |
|
|
|