From bd803a996b334e6d9e7f5cefa44341523fea2c63 Mon Sep 17 00:00:00 2001 From: Jeremiah Orians Date: Wed, 24 Aug 2016 19:26:45 -0400 Subject: [PATCH] Fixed minor user interaction bug in Development mode and fixed the continued execution of a Halted vm in the IDE --- vm_decode.c | 2 +- vm_instructions.c | 3 +++ wrapper.c | 5 ++++- 3 files changed, 8 insertions(+), 2 deletions(-) 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; }