strcpy(buffer, &buffer[k]);
}
-/* CPU exec and Console UI update */
-static void
-console_exec(char *Address, char *NumberInst)
-{
- int NbInst = -1; /* -1 is infinity */
- if (strlen(Address) == 0) {
- log_err("Invalid address");
- return;
- }
-
- if (!STREQ(Address, "PC"))
- cpu8051.pc = Ascii2Hex(Address, strlen(Address));
-
- if (NumberInst)
- if (strlen(NumberInst) != 0)
- NbInst = Ascii2Hex(NumberInst, strlen(NumberInst));
-
- InitUnixKB();
-
- log_info("Program executing...");
-
- cpu8051_run(NbInst, kbhit);
-
- if (kbhit()) {
- (void) getch(); /* Flush key */
- log_info("Caught break signal!");
- }
-
- ResetUnixKB();
-}
-
/* Disassemble NumberInst instructions at Address */
static void
DisasmN(unsigned int Address, int NumberInst)
log_info("Done");
}
+/* CPU exec and Console UI update */
+static void
+console_exec(char *NumberInst)
+{
+ int NbInst = -1; /* -1 is infinity */
+
+ if (NumberInst)
+ if (strlen(NumberInst) != 0)
+ NbInst = Ascii2Hex(NumberInst, strlen(NumberInst));
+
+ InitUnixKB();
+
+ log_info("Program executing...");
+
+ cpu8051_run(NbInst, kbhit);
+
+ if (kbhit()) {
+ (void) getch(); /* Flush key */
+ log_info("Caught break signal!");
+ }
+
+ ResetUnixKB();
+ console_show_registers();
+ DisasmN(cpu8051.pc, 1);
+}
+
/* CPU trace and Console UI update */
static void
-console_trace(char *Address)
+console_trace()
{
- if (strlen(Address) != 0)
- cpu8051.pc = Ascii2Hex(Address, strlen(Address));
cpu8051_Exec();
console_show_registers();
DisasmN(cpu8051.pc, 1);
" Dump Internal Data Memory... DI [address] [size]",
" Dump Program Memory......... DP [address] [size]",
" Display Registers content... DR",
- " Execute (Run)............... EM [address"
- " [number of instructions]]",
+ " Execute (Run)............... EM [number of instructions]",
" Help........................ H or ?",
" Modify External Data Memory. ME address value",
" Modify Internal Data Memory. MI address value",
" Modify Program Memory....... MP address value",
" Modify Register............. MR register value",
" Quit Emulator............... Q",
- " Trace mode (step)........... T [address]",
+ " Trace (step)................ T",
" Unassemble.................. U [address]"
" [number of instructions]",
" Reset processor............. Z",
if (options.stop_address != 0) {
/* Automatically run program and stop at specified address. */
- console_exec("PC", NULL);
- console_show_registers();
+ console_exec(NULL);
QuitRequest = 1;
} else {
Index = 0;
break;
case 'E':
if (STREQ(Command, "EM") &&
- (strlen(Parameter1) == 0) &&
- (strlen(Parameter2) == 0))
- console_exec("PC", NULL);
- else if (STREQ(Command, "EM") &&
- (strlen(Parameter1) != 0) &&
- (strlen(Parameter2) == 0))
- console_exec(Parameter1, NULL);
+ (strlen(Parameter1) == 0))
+ console_exec(NULL);
else if (STREQ(Command, "EM") &&
- (strlen(Parameter1) != 0) &&
- (strlen(Parameter2) != 0))
- console_exec(Parameter1, Parameter2);
+ (strlen(Parameter1) != 0))
+ console_exec(Parameter1);
else
goto syntax_error;
break;
goto syntax_error;
break;
case 'T':
- if (strlen(Parameter2) != 0)
+ if ((strlen(Parameter1) != 0) ||
+ (strlen(Parameter2) != 0))
printf("Wrong Number of Parameters!\n");
if (STREQ(Command, "T"))
- console_trace(Parameter1);
+ console_trace();
else
goto syntax_error;
break;