summaryrefslogtreecommitdiff
path: root/vm.c
diff options
context:
space:
mode:
Diffstat (limited to 'vm.c')
-rw-r--r--vm.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/vm.c b/vm.c
index 1dc40e0..667ceed 100644
--- a/vm.c
+++ b/vm.c
@@ -57,7 +57,10 @@ int runvm(State *S) {
int status = 1;
- disasm_chunk(ch);
+ if (S->do_disasm) {
+ disasm_chunk(ch);
+ puts("---");
+ }
#define RBYTE() (ch->bc.d[th->ip++])
#define RSHORT() (th->ip += 2, (uint16_t)( ch->bc.d[th->ip-2] | ch->bc.d[th->ip-1] << 8 ))
@@ -66,13 +69,11 @@ int runvm(State *S) {
#define POP() (th->stack[--th->sp])
#define PEEK() (th->stack[th->sp-1])
- puts("---");
while (1) {
uint8_t instr = RBYTE();
switch (instr) {
case OP_RET:
status = 0;
- printf("done!\n");
goto done;
break;
case OP_LOADK: {