Load/store constant offset utility

This commit is contained in:
dcodeIO
2018-01-21 16:34:50 +01:00
parent b77646df6e
commit a257b6e529
11 changed files with 327 additions and 27 deletions

View File

@ -29,11 +29,15 @@ function move_memory(dest, src, n) {
};
globalScope["store"] =
function store(ptr, val) {
function store(ptr, val, off) {
if (typeof off === "number")
ptr += off;
HEAP[ptr] = val;
};
globalScope["load"] =
function load(ptr) {
if (typeof off === "number")
ptr += off;
return HEAP[ptr];
};