}
struct NEDstate *
-init_simulator(void)
+init_simulator(char * input_file)
{
struct NEDstate * state = malloc(sizeof(struct NEDstate));
state->hack = malloc(sizeof(struct NEDhack));
state->halted = false;
state->hack->resume_word = false;
-// TODO: This needs to be passed in as a CLI option.
-#define AOUT_PATH "./test.out"
-
/* Load an initial image into memory. */
struct exec aout_exec;
struct nlist * symbol_table;
uint32_t symbol_count;
FILE * input = NULL;
- if ((input = fopen(AOUT_PATH, "r")) == NULL) {
- fprintf(stderr, "ERROR: %s: %s\n", AOUT_PATH, strerror(errno));
+ if ((input = fopen(input_file, "r")) == NULL) {
+ fprintf(stderr, "ERROR: %s: %s\n", input_file, strerror(errno));
state->halted = true;
}
parse_aout_file(input, &aout_exec, state->ram, &symbol_table, &symbol_count);