update debug
This commit is contained in:
4
njvm.c
4
njvm.c
@@ -101,9 +101,11 @@ void execute(struct program program) {
|
||||
*stack.current = *stack.current + SIGN_EXTEND(IMMEDIATE(program.program[i]));
|
||||
break;
|
||||
case RSF:
|
||||
if (debug == 1) printStack(stack, fp);
|
||||
if (debug == 1) printf("rsf\n");
|
||||
*stack.current = fp + 2;
|
||||
fp = pop(stack);
|
||||
if (debug == 1) printStack(stack, fp);
|
||||
case POPL:
|
||||
if (debug == 1) printf("popl: %i\n", SIGN_EXTEND(IMMEDIATE(program.program[i])));
|
||||
stack.stack[fp + SIGN_EXTEND(IMMEDIATE(program.program[i]))] = pop(stack);
|
||||
@@ -167,11 +169,13 @@ void execute(struct program program) {
|
||||
if (debug == 1) printf("new i: %i\n", i);
|
||||
break;
|
||||
case CALL:
|
||||
if (debug == 1) printStack(stack, fp);
|
||||
if (debug == 1) printf("call: %i\n", SIGN_EXTEND(IMMEDIATE(program.program[i])));
|
||||
push(stack, i + 1);
|
||||
if (debug == 1) printf("push: %i\n", i + 1);
|
||||
i = SIGN_EXTEND(IMMEDIATE(program.program[i])) - 1;
|
||||
if (debug == 1) printf("new i: %i\n", i);
|
||||
if (debug == 1) printStack(stack, fp);
|
||||
break;
|
||||
case RET:
|
||||
if (debug == 1) printStack(stack, fp);
|
||||
|
||||
Reference in New Issue
Block a user