From 29975e1ce839098e7e55b0cd25d788f0c96555ba Mon Sep 17 00:00:00 2001 From: Benoit Giannangeli Date: Fri, 3 Feb 2017 11:51:39 +0100 Subject: MOVE --- src/lvm.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/lvm.js b/src/lvm.js index 7a65d74..964abe7 100644 --- a/src/lvm.js +++ b/src/lvm.js @@ -42,11 +42,10 @@ class LuaVM { let i = ci.savedpc[ci.pcOff++]; let ra = this.RA(base, i.A); - - console.log(OC.OpCodes[i.opcode]); + switch (OC.OpCodes[i.opcode]) { case "OP_MOVE": - L.stack[ra] = RB(base, i.opcode, i.B); + L.stack[ra] = L.stack[this.RB(base, i.opcode, i.B)]; break; case "OP_LOADK": L.stack[ra] = k[i.Bx]; @@ -131,6 +130,8 @@ class LuaVM { } L.ci = ci.previous; + // TODO what to return when end of program ? + console.log(L.stack); if (L.ci === null) return; if (i.B !== 0) L.top = ci.top; -- cgit v1.2.3-70-g09d2