diff options
Diffstat (limited to 'dis.c')
-rw-r--r-- | dis.c | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -14,13 +14,22 @@ void disasm_chunk(Chunk *ch) { case opcode: puts(str); break; switch (instr) { SIMPLE_INSTR(OP_RET, "ret") - case OP_LOADK:; + case OP_LOADK: { uint8_t ix = ch->bc.d[ip++]; printf("loadk #%d\t; ",ix); Val k = ch->consts.d[ix]; printf("%-4s : ",typename_str(k)); println_val(k); break; + } + case OP_GETGLOBAL: { + uint8_t ix = ch->bc.d[ip++]; + printf("getglobal #%d\t; ",ix); + Val k = ch->consts.d[ix]; + printf("%-4s : ",typename_str(k)); + println_val(k); + break; + } SIMPLE_INSTR(OP_PRINT, "print") SIMPLE_INSTR(OP_ADD, "add") SIMPLE_INSTR(OP_SUB, "sub") |