diff --git a/tty.c b/tty.c index 6166e12..d1ec478 100644 --- a/tty.c +++ b/tty.c @@ -8,6 +8,7 @@ * wish to use. Please note that they contain bugs * ****************************************************/ +#define tty_lib true /* In order to restore at exit.*/ static struct termios orig_termios; diff --git a/vm.c b/vm.c index ae6a2ac..787db72 100644 --- a/vm.c +++ b/vm.c @@ -1,5 +1,4 @@ #include "vm.h" -//#define DEBUG true uint32_t performance_counter; /* Prototypes for functions in vm_instructions.c*/ diff --git a/vm_instructions.c b/vm_instructions.c index 8d5ec91..cd7531b 100644 --- a/vm_instructions.c +++ b/vm_instructions.c @@ -2,6 +2,10 @@ FILE* tape_01; FILE* tape_02; +#ifdef tty_lib +char tty_getchar(); +#endif + /* Correctly write out bytes on little endian hardware */ void writeout_Reg(struct lilith* vm, uint32_t p, uint32_t value) { @@ -199,7 +203,12 @@ void vm_FGETC(struct lilith* vm) if (0x00000000 == vm->reg[1]) { + #ifdef tty_lib + byte = tty_getchar(); + #endif + #ifndef tty_lib byte = fgetc(stdin); + #endif } if(0x00001100 == vm->reg[1])