summaryrefslogtreecommitdiff
path: root/dis.c
diff options
context:
space:
mode:
Diffstat (limited to 'dis.c')
-rw-r--r--dis.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/dis.c b/dis.c
index 6ba934d..16c5b0e 100644
--- a/dis.c
+++ b/dis.c
@@ -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")