From 50c4ea79c8ba7f43cf0c47b8670824d0e60597ce Mon Sep 17 00:00:00 2001 From: Ben Kurtovic Date: Sat, 21 Mar 2015 23:53:54 -0400 Subject: [PATCH] Call different stuff for the assembler/disassembler. --- crater.c | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/crater.c b/crater.c index 3c26f5b..87de115 100644 --- a/crater.c +++ b/crater.c @@ -13,30 +13,36 @@ int main(int argc, char *argv[]) { Config *config; - ROM *rom; int retval; retval = config_create(&config, argc, argv); if (retval != CONFIG_OK) return retval == CONFIG_EXIT_SUCCESS ? EXIT_SUCCESS : EXIT_FAILURE; - printf("crater: a Sega Game Gear emulator\n\n"); - #ifdef DEBUG_MODE config_dump_args(config); #endif - if (!(rom = rom_open(config->rom_path))) { - if (errno == ENOMEM) - OUT_OF_MEMORY() - else - FATAL_ERRNO("couldn't load ROM image '%s'", config->rom_path) + if (config->assemble) { + printf("Running assembler: %s -> %s.\n",config->src_path, config->dst_path); + } else if (config->disassemble) { + printf("Running disassembler: %s -> %s.\n", config->src_path, config->dst_path); + } else { + ROM *rom; + + printf("crater: a Sega Game Gear emulator\n\n"); + if (!(rom = rom_open(config->rom_path))) { + if (errno == ENOMEM) + OUT_OF_MEMORY() + else + FATAL_ERRNO("couldn't load ROM image '%s'", config->rom_path) + } + printf("Loaded ROM image: %s.\n", rom->name); + + // TODO: start from here + rom_close(rom); } - printf("Loaded ROM image: %s.\n", rom->name); - - // TODO: start from here - rom_close(rom); config_destroy(config); return EXIT_SUCCESS; }