X-Git-Url: http://gitweb.hugovil.com/?a=blobdiff_plain;f=src%2Femuconsole.c;h=f29bbc53ff648d66dde8c677a11c929c39e9580c;hb=8d9b71ab3848729da1cf90a38a599be0b08cbb5c;hp=b8c3bc388a2478c6c9214208ecedb2d13367bc81;hpb=dfa6052123128f13ca08077da18b876f75fa6c83;p=emu8051.git diff --git a/src/emuconsole.c b/src/emuconsole.c index b8c3bc3..f29bbc5 100644 --- a/src/emuconsole.c +++ b/src/emuconsole.c @@ -33,6 +33,8 @@ #include "hexfile.h" #include "keyboard.h" +extern struct options_t options; + /* Capitalize all letters in buffer */ static void Capitalize(char *buffer) @@ -60,7 +62,6 @@ RemoveSpaces(char *buffer) static void console_exec(char *Address, char *NumberInst) { - char dummy; int NbInst = -1; /* -1 is infinity */ if (strlen(Address) == 0) { printf("Invalid address\n"); @@ -83,7 +84,7 @@ console_exec(char *Address, char *NumberInst) NbInst--; } while (!IsBreakpoint(cpu8051.pc) && (NbInst != 0) && !kbhit()); if (kbhit()) { - dummy = getch(); /* Flush key */ + (void) getch(); /* Flush key */ printf("Caught break signal!\n"); } if (NbInst == 0) @@ -155,7 +156,7 @@ console_show_registers(void) " - P |\n"); printf("| %.4X | %.2X | %.4X | %.2X | %.2X |", cpu8051.pc, cpu8051_ReadD(_SP_), - (cpu8051_ReadD(_DPTRHIGH_) << 8) + cpu8051_ReadD(_DPTRLOW_), + memory_sfr_read_dptr(), cpu8051_ReadD(_ACC_), cpu8051_ReadD(_B_)); printf(" %d %d %d %d %d %d %d %d |", (PSW >> 7) & 1, (PSW >> 6) & 1, (PSW >> 5) & 1, (PSW >> 4) & 1, @@ -256,7 +257,6 @@ console_main(void) while (!QuitRequest) { int slen; size_t len = 0; - ssize_t bytes_read; char Command[256]; char Args[256]; char Parameter1[256]; @@ -266,7 +266,7 @@ console_main(void) Parameter2[0] = '\0'; printf(prompt); - bytes_read = getline(&line, &len, stdin); + (void) getline(&line, &len, stdin); Capitalize(line); RemoveSpaces(line); @@ -453,22 +453,16 @@ TooMuchParameters: int main(int argc, char **argv) { - char *hex_file; - - ParseCommandLineOptions(argc, argv); + parse_command_line_options(argc, argv); cpu8051_init(); - hex_file = get_hex_filename(); - - if (hex_file != NULL) - LoadHexFile(hex_file); + if (options.filename != NULL) + LoadHexFile(options.filename); console_main(); -#ifdef EMU8051_DEBUG - printf("End of program.\n"); -#endif + log_info("Terminate"); return 0; }