blob: c991643e992e56f414da18f79f923c5f00f477aa (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
'use strict';
const { AddrMode } = require('./enum.js');
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];
}
|