summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2017-05-09 13:49:44 +1000
committerdaurnimator <quae@daurnimator.com>2017-05-09 14:25:55 +1000
commit347242c091e24955f7c81667bd5f340a0d0f0d1e (patch)
treea5f37c7af0feb113bccf31bb10dc42964f0bfddb
parent9c52b8b86210afc2fdf896030c434ed503a2b188 (diff)
downloadfengari-347242c091e24955f7c81667bd5f340a0d0f0d1e.tar.gz
fengari-347242c091e24955f7c81667bd5f340a0d0f0d1e.tar.bz2
fengari-347242c091e24955f7c81667bd5f340a0d0f0d1e.zip
src/lopcodes.js: Add GET* macros
-rw-r--r--src/lopcodes.js35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/lopcodes.js b/src/lopcodes.js
index 932878d..ba33f12 100644
--- a/src/lopcodes.js
+++ b/src/lopcodes.js
@@ -245,6 +245,10 @@ const MASK0 = function(n, p) {
return (~MASK1(n, p));
};
+const GET_OPCODE = function(i) {
+ return i.opcode;
+};
+
const SET_OPCODE = function(i, o) {
i.code = (i.code & MASK0(SIZE_OP, POS_OP)) | ((o << POS_OP) & MASK1(SIZE_OP, POS_OP));
fullins(i);
@@ -255,26 +259,50 @@ const setarg = function(i, v, pos, size) {
fullins(i);
};
+const GETARG_A = function(i) {
+ return i.A;
+};
+
const SETARG_A = function(i,v) {
setarg(i, v, POS_A, SIZE_A);
};
+const GETARG_B = function(i) {
+ return i.B;
+};
+
const SETARG_B = function(i,v) {
setarg(i, v, POS_B, SIZE_B);
};
+const GETARG_C = function(i) {
+ return i.C;
+};
+
const SETARG_C = function(i,v) {
setarg(i, v, POS_C, SIZE_C);
};
+const GETARG_Bx = function(i) {
+ return i.Bx;
+};
+
const SETARG_Bx = function(i,v) {
setarg(i, v, POS_Bx, SIZE_Bx);
};
+const GETARG_Ax = function(i) {
+ return i.Ax;
+};
+
const SETARG_Ax = function(i,v) {
setarg(i, v, POS_Ax, SIZE_Ax);
};
+const GETARG_sBx = function(i) {
+ return i.sBx;
+};
+
const SETARG_sBx = function(i, b) {
SETARG_Bx(i, b + MAXARG_sBx);
};
@@ -326,6 +354,13 @@ module.exports.BITRK = BITRK;
module.exports.CREATE_ABC = CREATE_ABC;
module.exports.CREATE_ABx = CREATE_ABx;
module.exports.CREATE_Ax = CREATE_Ax;
+module.exports.GET_OPCODE = GET_OPCODE;
+module.exports.GETARG_A = GETARG_A;
+module.exports.GETARG_B = GETARG_B;
+module.exports.GETARG_C = GETARG_C;
+module.exports.GETARG_Bx = GETARG_Bx;
+module.exports.GETARG_Ax = GETARG_Ax;
+module.exports.GETARG_sBx = GETARG_sBx;
module.exports.INDEXK = INDEXK;
module.exports.ISK = ISK;
module.exports.LFIELDS_PER_FLUSH = LFIELDS_PER_FLUSH;