Removed reset function (we don't need it)

This commit is contained in:
Sasha Koshka 2022-10-26 21:33:03 -04:00
parent 229c414512
commit 0da2977036
1 changed files with 2 additions and 7 deletions

View File

@ -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