diff options
Diffstat (limited to 'lib/inst.c')
-rw-r--r-- | lib/inst.c | 20 |
1 files changed, 16 insertions, 4 deletions
@@ -59,6 +59,12 @@ const char *opcode_as_cstr(opcode_t code) return "MALLOC_HWORD"; case OP_MALLOC_WORD: return "MALLOC_WORD"; + case OP_MALLOC_STACK_BYTE: + return "MALLOC_STACK_BYTE"; + case OP_MALLOC_STACK_HWORD: + return "MALLOC_STACK_HWORD"; + case OP_MALLOC_STACK_WORD: + return "MALLOC_STACK_WORD"; case OP_MSET_BYTE: return "MSET_BYTE"; case OP_MSET_HWORD: @@ -171,6 +177,12 @@ const char *opcode_as_cstr(opcode_t code) return "PLUS_HWORD"; case OP_PLUS_WORD: return "PLUS_WORD"; + case OP_SUB_BYTE: + return "SUB_BYTE"; + case OP_SUB_HWORD: + return "SUB_HWORD"; + case OP_SUB_WORD: + return "SUB_WORD"; case OP_MULT_BYTE: return "MULT_BYTE"; case OP_MULT_HWORD: @@ -229,7 +241,7 @@ void data_print(data_t datum, data_type_t type, FILE *fp) void inst_print(inst_t instruction, FILE *fp) { - static_assert(NUMBER_OF_OPCODES == 90, "inst_bytecode_size: Out of date"); + static_assert(NUMBER_OF_OPCODES == 96, "inst_bytecode_size: Out of date"); fprintf(fp, "%s(", opcode_as_cstr(instruction.opcode)); if (OPCODE_IS_TYPE(instruction.opcode, OP_PUSH)) { @@ -262,7 +274,7 @@ void inst_print(inst_t instruction, FILE *fp) size_t inst_bytecode_size(inst_t inst) { - static_assert(NUMBER_OF_OPCODES == 90, "inst_bytecode_size: Out of date"); + static_assert(NUMBER_OF_OPCODES == 96, "inst_bytecode_size: Out of date"); size_t size = 1; // for opcode if (OPCODE_IS_TYPE(inst.opcode, OP_PUSH)) { @@ -287,7 +299,7 @@ size_t inst_bytecode_size(inst_t inst) void inst_write_bytecode(inst_t inst, darr_t *darr) { - static_assert(NUMBER_OF_OPCODES == 90, "inst_write_bytecode: Out of date"); + static_assert(NUMBER_OF_OPCODES == 96, "inst_write_bytecode: Out of date"); // Append opcode darr_append_byte(darr, inst.opcode); // Then append 0 or more operands @@ -363,7 +375,7 @@ data_t read_type_from_darr(darr_t *darr, data_type_t type) inst_t inst_read_bytecode(darr_t *darr) { - static_assert(NUMBER_OF_OPCODES == 90, "inst_read_bytecode: Out of date"); + static_assert(NUMBER_OF_OPCODES == 96, "inst_read_bytecode: Out of date"); if (darr->used >= darr->available) return (inst_t){0}; inst_t inst = {0}; |