Removed reset function (we don't need it)
This commit is contained in:
parent
229c414512
commit
0da2977036
@ -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.accumulator = 0
|
||||
for int(machine.counter) < len(machine.memory) {
|
||||
word := machine.memory[machine.counter]
|
||||
opcode := Opcode(word >> 12) & 0x000F
|
||||
|
Loading…
Reference in New Issue
Block a user