update debug

This commit is contained in:
Elias Bennour 2023-12-09 22:00:13 +01:00
parent c0d25212af
commit 27400289f5

9
njvm.c
View File

@ -149,17 +149,22 @@ void execute(struct program program) {
case BRF:
if (debug == 1) printf("brf: %i\n", SIGN_EXTEND(IMMEDIATE(program.program[i])));
if (debug == 1) printf("pop: %i\n", peek(stack, 1));
if (pop(stack) == 0)
if (pop(stack) == 0) {
i = SIGN_EXTEND(IMMEDIATE(program.program[i]));
if (debug == 1) printf("new i: %i\n", i);
}
break;
case BRT:
if (debug == 1) printf("brt: %i\n", SIGN_EXTEND(IMMEDIATE(program.program[i])));
if (debug == 1) printf("pop: %i\n", peek(stack, 1));
if (pop(stack) == 1)
if (pop(stack) == 1) {
i = SIGN_EXTEND(IMMEDIATE(program.program[i]));
if (debug == 1) printf("new i: %i\n", i);
}
case JMP:
if (debug == 1) printf("jmp: %i\n", SIGN_EXTEND(IMMEDIATE(program.program[i])));
i = SIGN_EXTEND(IMMEDIATE(program.program[i]));
if (debug == 1) printf("new i: %i\n", i);
break;
}
}