diff --git a/marcie.go b/marcie.go index 7d4371e..4a177a8 100644 --- a/marcie.go +++ b/marcie.go @@ -59,18 +59,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 accumulator. -func (machine *Machine) Reset () { - machine.counter = 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. If an unknown instruction is encountered, the machine halts and // returns an error. func (machine *Machine) Execute (offset int16) (err error) { - machine.counter = offset + machine.counter = offset + machine.accumulator = 0 for int(machine.counter) < len(machine.memory) { word := machine.memory[machine.counter] opcode := Opcode(word >> 12) & 0x000F