From 2870bc03bc8dc25ecd491f2dd2d9d3c74e88d21d Mon Sep 17 00:00:00 2001 From: Peter Evans Date: Wed, 21 Mar 2018 15:26:58 -0500 Subject: [PATCH] Remove option flags; remove unnecessary --flash option --- include/option.h | 3 +-- src/apple2.c | 5 ++--- src/option.c | 19 ------------------- tests/option.c | 13 ------------- 4 files changed, 3 insertions(+), 37 deletions(-) diff --git a/include/option.h b/include/option.h index 31f2b27..09783ab 100644 --- a/include/option.h +++ b/include/option.h @@ -5,8 +5,7 @@ #include enum option_flags { - OPTION_FLASH = 1, - OPTION_DISASSEMBLE = 2, + OPTION_DISASSEMBLE = 1, }; /* diff --git a/src/apple2.c b/src/apple2.c index a0ee0f2..d4e84f0 100644 --- a/src/apple2.c +++ b/src/apple2.c @@ -337,10 +337,9 @@ apple2_free(apple2 *mach) void apple2_run_loop(apple2 *mach) { - FILE *dlog = NULL; + FILE *dlog = (FILE *)vm_di_get(VM_DISASM_LOG); - if (option_flag(OPTION_DISASSEMBLE)) { - dlog = (FILE *)vm_di_get(VM_DISASM_LOG); + if (dlog != NULL) { vm_reflect_disasm(NULL); } diff --git a/src/option.c b/src/option.c index ee78b29..4be5d34 100644 --- a/src/option.c +++ b/src/option.c @@ -44,8 +44,6 @@ static char error_buffer[ERRBUF_SIZE] = ""; static int width = 840; static int height = 576; -static int flags = 0; - /* * These are all of the options we allow in our long-form options. It's * a bit faster to identify them by integer symbols than to do string @@ -55,7 +53,6 @@ enum options { DISK1, DISK2, HELP, - FLASH, DISASSEMBLE, }; @@ -66,7 +63,6 @@ static struct option long_options[] = { { "disassemble", 1, NULL, DISASSEMBLE }, { "disk1", 1, NULL, DISK1 }, { "disk2", 1, NULL, DISK2 }, - { "flash", 0, NULL, FLASH }, { "help", 0, NULL, HELP }, }; @@ -120,7 +116,6 @@ option_parse(int argc, char **argv) switch (opt) { case DISASSEMBLE: - flags |= OPTION_DISASSEMBLE; if (!option_open_file(&disasm_log, optarg, "w")) { return 0; } @@ -144,10 +139,6 @@ option_parse(int argc, char **argv) vm_di_set(VM_DISK2, input2); break; - case FLASH: - flags |= OPTION_FLASH; - break; - case HELP: option_print_help(); @@ -200,17 +191,7 @@ option_print_help() --disassemble=FILE Write assembly notation into FILE\n\ --disk1=FILE Load FILE into disk drive 1\n\ --disk2=FILE Load FILE into disk drive 2\n\ - --flash Flash CPU memory with contents of drive 1\n\ --help Print this help message\n\ --size=WIDTHxHEIGHT Use WIDTH and HEIGHT for window size\n\ (only 700x480 and 875x600 are supported)\n"); } - -/* - * Return true if the given option flag is set. - */ -bool -option_flag(int flag) -{ - return flags & flag; -} diff --git a/tests/option.c b/tests/option.c index c900863..d2197e6 100644 --- a/tests/option.c +++ b/tests/option.c @@ -75,16 +75,3 @@ Test(option, parse) cr_assert_eq(option_parse(argc, argv), 0); } - -Test(option, flag) -{ - int argc = 2; - char *argv[] = { - "prog_name", - "--flash", - }; - - cr_assert_eq(option_flag(OPTION_FLASH), false); - cr_assert_eq(option_parse(argc, argv), 1); - cr_assert_eq(option_flag(OPTION_FLASH), true); -}