From fa6932b65a14f2c74ab61541b8f5cd3b5d44e535 Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Mon, 12 Feb 2018 05:41:05 +0100 Subject: ... --- core.go | 12 ++++++------ core_test.go | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/core.go b/core.go index 72aab2c..624d4b3 100644 --- a/core.go +++ b/core.go @@ -99,21 +99,21 @@ func (c *Core) readAt(addr uint16) uint16 { // Run evaluates content of memory func (c *Core) Run() { for { - ins := c.Decode() - err := c.Evaluate(ins) + ins := c.Fetch() + err := c.Execute(ins) if err == ErrStop { return } } } -// Decode instruction at current program counter position -func (c *Core) Decode() Instruction { +// Fetch instruction at current program counter position +func (c *Core) Fetch() Instruction { return Decode(c.memory[c.pc]) } -// Evaluate instruction -func (c *Core) Evaluate(ins Instruction) error { +// Execute instruction +func (c *Core) Execute(ins Instruction) error { c.pc++ switch v := ins.(type) { case Literal: diff --git a/core_test.go b/core_test.go index 22c4fdb..24972eb 100644 --- a/core_test.go +++ b/core_test.go @@ -120,7 +120,7 @@ func TestEval(t *testing.T) { t.Run(fmt.Sprint(tc.ins), func(t *testing.T) { state := New(&mocConsole{}) for _, ins := range tc.ins { - state.Evaluate(ins) + state.Execute(ins) } cmp(t, *state, tc.end) }) -- cgit v1.2.3