|
|
@ -28,7 +28,7 @@ func (h *Module) debug(format string, args ...interface{}) { |
|
|
|
if !h.debugEnabled { |
|
|
|
if !h.debugEnabled { |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
fmt.Printf("[DEBUG] "+format, args...) |
|
|
|
fmt.Printf("[DEBUG] "+format+"\n", args...) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func (h *Module) Step() { |
|
|
|
func (h *Module) Step() { |
|
|
@ -38,9 +38,9 @@ func (h *Module) Step() { |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
h.debug("Instruction: %s", instruction.Instruction.Name) |
|
|
|
h.debug("Instruction: %s", instruction.Instruction.Name) |
|
|
|
h.debug("Accumulator before: %d", h.accumulator) |
|
|
|
h.debug("Accumulator before: %f", h.accumulator) |
|
|
|
instruction.Execute(h) |
|
|
|
instruction.Execute(h) |
|
|
|
h.debug("Accumulator after: %d", h.accumulator) |
|
|
|
h.debug("Accumulator after: %f", h.accumulator) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func (h *Module) Run() error { |
|
|
|
func (h *Module) Run() error { |
|
|
|