diff options
Diffstat (limited to 'vm.d')
| -rw-r--r-- | vm.d | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -93,8 +93,9 @@ class VM { if (offset >= this.bTop) { writefln("peekB() offset of %d greater than stack size %d", offset, this.bTop); } - return this.bStack[this.bTop - offset]; - //return this.bStack[this.bTop - offset - 1]; + //return this.bStack[this.bTop]; + //return this.bStack[this.bTop - offset]; + return this.bStack[this.bTop - offset - 1]; } Value popB() { @@ -275,6 +276,7 @@ class VM { } while (true) { if (DEBUG) { + writefln(" atop: %d, btop: %d", this.aTop, this.bTop); writeln(" Stacks:"); write(" A> "); for (int i = 0; i < this.aTop; i++) { @@ -385,7 +387,7 @@ class VM { //pushA(current.slots[current.frameStart + slot + 1]); //pushA(this.current.slots[this.current.frameStart + slot]); - pushA(this.peekB(this.bTop - (this.current.frameStart + slot))); + pushA(this.peekB(this.bTop - (this.current.frameStart + slot) - 1)); break; case OpCode.OP_SET_LOCAL: ubyte slot = this.readByte(); |
