summaryrefslogtreecommitdiff
path: root/src/vm/instruction.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/vm/instruction.js')
-rw-r--r--src/vm/instruction.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/vm/instruction.js b/src/vm/instruction.js
index ac4cd83..c991643 100644
--- a/src/vm/instruction.js
+++ b/src/vm/instruction.js
@@ -7,3 +7,18 @@ exports.DAT = function(core, pc, ins) {
// do nothing and die
return [];
}
+
+
+exports.MOV = function(core, pc, ins) {
+ if (ins.a.mode === AddrMode.Immediate) {
+ const dst = core.getValue(pc, ins.b);
+ dst.b.value = ins.a.value;
+ } else {
+ const src = core.getValue(pc, ins.a);
+ const dstLocation = core.getLocation(pc, ins.b);
+ // hacky deep copy
+ core.data[dstLocation] = JSON.parse(JSON.stringify(src));
+ }
+
+ return [pc + 1];
+}