diff options
Diffstat (limited to 'vm.d')
| -rw-r--r-- | vm.d | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -311,7 +311,7 @@ class VM { // pop the next n-1 values Value[] inner; - for (int i = 0; i < n - 1; i++) { + for (int i = 0; i < (n - 1); i++) { inner ~= this.popA(); } @@ -319,7 +319,7 @@ class VM { this.pushA(top); // push the other values (preserve order) - for (int i = n - 1; i >= 0; i--) { + for (int i = (n - 2); i >= 0; i--) { this.pushA(inner[i]); } break; @@ -568,13 +568,16 @@ class VM { this.popA(); // throw this one away this.pushA(val); break; - + case OpCode.OP_JUMP_TO: + uint addr = this.readShort(); + //this.current.ip -= offset; + this.current.ip = to!ubyte(addr); + break; case OpCode.OP_JUMP: uint offset = this.readShort(); //ip += offset; this.current.ip += offset; break; - case OpCode.OP_JUMP_IF_FALSE: uint offset = this.readShort(); if (!isBoolean(this.peekA(0))) { |
