summaryrefslogtreecommitdiff
path: root/emux64/src/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'emux64/src/main.c')
-rw-r--r--emux64/src/main.c30
1 files changed, 28 insertions, 2 deletions
diff --git a/emux64/src/main.c b/emux64/src/main.c
index c23a48f..8c42655 100644
--- a/emux64/src/main.c
+++ b/emux64/src/main.c
@@ -32,8 +32,10 @@
#include <unistd.h>
#include <string.h>
#include "cpu/cpu.h"
+#include "rom.h"
static char *rom_file = NULL;
+struct osmx_rom g_firmware;
static void
help(void)
@@ -52,6 +54,31 @@ cleanup(void)
free(rom_file);
rom_file = NULL;
}
+
+ rom_release(&g_firmware);
+}
+
+static int
+run(struct osmx_core *core)
+{
+ int error;
+
+ if (rom_file == NULL) {
+ return -1;
+ }
+
+ /* Open the firmware ROM */
+ cpu_dump(core);
+ error = rom_open(rom_file, &g_firmware);
+ if (error < 0) {
+ return error;
+ }
+
+ printf("ROM: ");
+ for (int i = 0; i < g_firmware.length; ++i) {
+ printf("%02X ", g_firmware.buf[i]);
+ }
+ printf("\n");
}
int
@@ -84,6 +111,5 @@ main(int argc, char **argv)
return error;
}
- cpu_dump(&core);
- return 0;
+ return run(&core);
}