aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2018-02-12 05:41:05 +0100
committerDimitri Sokolyuk <demon@dim13.org>2018-02-12 05:41:05 +0100
commitfa6932b65a14f2c74ab61541b8f5cd3b5d44e535 (patch)
tree1c37e3ed36dc6b2a2fcb6f1089bc052d0e37ceb2
parentfc3d8ccb1f808cab660750fe4a136e7dd384d36b (diff)
...
-rw-r--r--core.go12
-rw-r--r--core_test.go2
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)
})