From 0da2977036648a574d041c5a6c1d1dbcac0d934a Mon Sep 17 00:00:00 2001 From: Sasha Koshka Date: Wed, 26 Oct 2022 21:33:03 -0400 Subject: [PATCH] Removed reset function (we don't need it) --- marcie.go | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) 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