|
|
@ -37,7 +37,7 @@ func (h *Module) setProgramCounter(counter int64) error { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func (h *Module) increaseProgramCounter() { |
|
|
|
func (h *Module) increaseProgramCounter() { |
|
|
|
h.register[0]++ |
|
|
|
h.pCounter++ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func (h *Module) debug(format string, args ...interface{}) { |
|
|
|
func (h *Module) debug(format string, args ...interface{}) { |
|
|
@ -52,7 +52,7 @@ func (h *Module) Step() error { |
|
|
|
instruction := h.programStorage[h.programCounter()] |
|
|
|
instruction := h.programStorage[h.programCounter()] |
|
|
|
h.increaseProgramCounter() |
|
|
|
h.increaseProgramCounter() |
|
|
|
if instruction == nil { |
|
|
|
if instruction == nil { |
|
|
|
h.debug("Skip undefined instruction %d", h.programCounter()) |
|
|
|
//h.debug("Skip undefined instruction %d", h.programCounter())
|
|
|
|
return nil |
|
|
|
return nil |
|
|
|
} |
|
|
|
} |
|
|
|
h.debug("Instruction: %s", instruction.Instruction.Name) |
|
|
|
h.debug("Instruction: %s", instruction.Instruction.Name) |
|
|
@ -93,6 +93,7 @@ func NewNamedHALModule(program Program, registerSize uint64, ioSize int64, debug |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
module := &Module{ |
|
|
|
module := &Module{ |
|
|
|
|
|
|
|
pCounter: 1, |
|
|
|
programStorage: program, |
|
|
|
programStorage: program, |
|
|
|
register: make([]float64, registerSize), |
|
|
|
register: make([]float64, registerSize), |
|
|
|
IO: ios, |
|
|
|
IO: ios, |
|
|
|