diff options
author | Dimitri Sokolyuk <demon@dim13.org> | 2018-02-12 05:41:05 +0100 |
---|---|---|
committer | Dimitri Sokolyuk <demon@dim13.org> | 2018-02-12 05:41:05 +0100 |
commit | fa6932b65a14f2c74ab61541b8f5cd3b5d44e535 (patch) | |
tree | 1c37e3ed36dc6b2a2fcb6f1089bc052d0e37ceb2 /core.go | |
parent | fc3d8ccb1f808cab660750fe4a136e7dd384d36b (diff) |
...
Diffstat (limited to 'core.go')
-rw-r--r-- | core.go | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -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: |