Changed order of divide and subtract
This commit is contained in:
parent
efc263fe72
commit
a1ea9f30da
17
creature.go
17
creature.go
@ -44,10 +44,9 @@ func (machine *Machine) Execute (offset int) {
|
||||
|
||||
case 0x5:
|
||||
// SUB
|
||||
// subtracts the last two words on the stack
|
||||
right := machine.Pop()
|
||||
left := machine.Pop()
|
||||
machine.Push(left - right)
|
||||
// subtracts the second to last word on the stack from
|
||||
// the last word on the stack
|
||||
machine.Push(machine.Pop() - machine.Pop())
|
||||
|
||||
case 0x6:
|
||||
// MUL
|
||||
@ -56,12 +55,14 @@ func (machine *Machine) Execute (offset int) {
|
||||
|
||||
case 0x7:
|
||||
// DIV
|
||||
// divides the last two words on the stack
|
||||
right := machine.Pop()
|
||||
left := machine.Pop()
|
||||
machine.Push(left / right)
|
||||
// divides the last word on the stack by the second to
|
||||
// last word on the stack
|
||||
machine.Push(machine.Pop() / machine.Pop())
|
||||
|
||||
case 0x8:
|
||||
// EQU
|
||||
// checks if the last two words on the stack are equal
|
||||
|
||||
case 0x9:
|
||||
case 0xa:
|
||||
case 0xb:
|
||||
|
Loading…
Reference in New Issue
Block a user