diff --git a/vm_decode.c b/vm_decode.c index 22c4ac1..479caf2 100644 --- a/vm_decode.c +++ b/vm_decode.c @@ -1998,7 +1998,7 @@ void eval_instruction(struct lilith* vm, struct Instruction* current) case 0xFF: /* Deal with HALT */ { vm->halted = true; - fprintf(stderr, "Computer Program has Halted\n"); + fprintf(stderr, "Computer Program has Halted\nAfter Executing %i instructions\n", performance_counter); break; } default: /* Deal with illegal instruction */ diff --git a/vm_instructions.c b/vm_instructions.c index b8e987e..9dac589 100644 --- a/vm_instructions.c +++ b/vm_instructions.c @@ -231,6 +231,9 @@ void vm_FPUTC(struct lilith* vm) if (0x00000000 == vm->reg[1]) { fputc(byte, stdout); + #ifdef tty_lib + fflush(stdout); + #endif } if(0x00001100 == vm->reg[1]) diff --git a/wrapper.c b/wrapper.c index c1e60b6..819441d 100644 --- a/wrapper.c +++ b/wrapper.c @@ -48,7 +48,10 @@ void load_lilith(char* name) unsigned int step_lilith() { - execute_vm(Globalvm); + if(!Globalvm->halted) + { + execute_vm(Globalvm); + } return Globalvm->ip; }