diff --git a/src/ops.c b/src/ops.c new file mode 100644 index 0000000..8884e64 --- /dev/null +++ b/src/ops.c @@ -0,0 +1,41 @@ +#include "config.h" +#include "types.h" +#include "ops.h" + +/* + Variable VM instruction operand sizes, must be consistent with ops_t enumeration (ops.h) +*/ + +const index_t ops_s[] = { + 0, + // ADD=1, DIV, MUL, SUB, NEG, MOD, + 0, 0, 0, 0, 0, 0, + // AND, OR, NOT, + 0, 0, 0, + // EQ, NEQ, LT, GT, LE, GE, CMPS, + 0, 0, 0, 0, 0, 0, 0, + // DROPD, DROPF, + index_s, index_s, + // PUSHD, PUSHF, NTHD, NTHF, TOF, SETF, SETSP, INCSP, + number_s, number_s, index_s, index_s, index_s, index_s, index_s, index_s, + // INCHAR, INNUMBER, INSTRING, INARRAY, + 0, 0, 0, 0, + // OUTCHAR, OUTNUMBER, OUTSTRING, OUTARRY, + 0, 0, 0, 0, + // STRING + index_s, + // JMP JZ, JNZ, TESTRANGE, LOOP, + address_s, address_s, address_s, 2*index_s, 0, + // READ, WRITE, READS, WRITES, DATA, EVENT, ERR, EMIT, + address_s, address_s, address_s, address_s, index_s, address_s, address_s, index_s, + // INTERRUPT, RESUME, CALL, CCALL, PROC, FUNC, RETURN, FORK, YIELD + index_s, index_s, address_s, index_s, index_s, index_s, index_s, 0, 0, +#if HAS_LOCK > 0 + // LOCK, UNLOCK + address_s, address_s, +#endif + // END, ENV + 0, index_s +}; + +