Add a Reset method to the machine
This commit is contained in:
parent
ebf58c9427
commit
d48181b832
@ -40,6 +40,13 @@ func (err Error) Error () (description string) {
|
||||
return
|
||||
}
|
||||
|
||||
// Reset resets the stack of the machine. This should be called before Execute,
|
||||
// since Execute does not reset the stack.
|
||||
func (machine *Machine) Reset () {
|
||||
machine.stack = nil
|
||||
machine.pointer = 0
|
||||
}
|
||||
|
||||
// Execute starts execution at the address specified by offset. The machine will
|
||||
// run until a HALT instruction is encountered, or the end of program memory is
|
||||
// reached.
|
||||
|
Loading…
Reference in New Issue
Block a user