diff --git a/creature.go b/creature.go index 1a338e3..af82112 100644 --- a/creature.go +++ b/creature.go @@ -24,8 +24,8 @@ type MachineFunction func(machine *Machine) (stop bool) const ( PUSH = 0x0 POP = 0x1 - LOAD = 0x2 - STOR = 0x3 + PEEK = 0x2 + POKE = 0x3 ADD = 0x4 SUB = 0x5 MUL = 0x6 @@ -91,11 +91,11 @@ func (machine *Machine) Execute(offset int) (err error) { // pop the top word off of the stack, and discard it machine.Pop() - case LOAD: + case PEEK: // push the word at an address onto the stack machine.Push(machine.Peek(machine.Pop())) - case STOR: + case POKE: // store a word at an address machine.Poke(machine.Pop(), machine.Pop()) diff --git a/creature_test.go b/creature_test.go index 6db50e9..ad1db3f 100644 --- a/creature_test.go +++ b/creature_test.go @@ -16,6 +16,8 @@ func runMachineTest(program []int, test *testing.T) (machine *Machine) { func TestPush(test *testing.T) { machine := runMachineTest ([]int { + PUSH, 3, + POP, PUSH, 654, }, test)