From 1b32dfecc4fd1c9d9d024bb053c43ea17021cc65 Mon Sep 17 00:00:00 2001 From: Alex AUVOLAT Date: Fri, 3 Jan 2014 20:41:22 +0100 Subject: Monitor now works correctly. --- csim/load.c | 2 +- csim/sim.c | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'csim') diff --git a/csim/load.c b/csim/load.c index 485a743..e54c0f0 100644 --- a/csim/load.c +++ b/csim/load.c @@ -41,7 +41,7 @@ void add_rom(const char *prefix, FILE *file) { eat_comment(file); if (fscanf(file, "/%lu", &(rom->data[i]))) { // ok, value is read - } else if (fscanf(file, "x%x", &(rom->data[i]))) { + } else if (fscanf(file, "x%lx", &(rom->data[i]))) { // ok, value is read } else { rom->data[i] = read_bool(file, NULL); diff --git a/csim/sim.c b/csim/sim.c index f91ac75..1dd2791 100644 --- a/csim/sim.c +++ b/csim/sim.c @@ -61,6 +61,7 @@ void machine_banner(t_machine *m, FILE *stream) { m->prog->vars[m->prog->inputs[i]].name); } fprintf(stream, "\n"); + fflush(stream); } void read_inputs(t_machine *m, FILE *stream) { @@ -80,6 +81,8 @@ void read_inputs(t_machine *m, FILE *stream) { fscanf(stream, " "); if (fscanf(stream, "/%lu", &(m->var_values[var]))) { // ok, value is read + } else if (fscanf(stream, "x%lx", &(m->var_values[var]))) { + // ok, value is read } else { m->var_values[var] = read_bool(stream, NULL); } @@ -223,6 +226,7 @@ void write_outputs(t_machine *m, FILE *stream) { fprintf(stream, "\t%ld\n", m->var_values[var]); } fprintf(stream, "\n"); + fflush(stream); } -- cgit v1.2.3