1
0
mirror of https://github.com/simh/simh.git synced 2026-05-03 06:28:41 +00:00

ALL simulators with instruction history support: Minor history enhancements

- Issue reasonable error message explaining invalid SET CPU HISTORY=n input
- Let SIGINT (^C) abort SHOW HISTORY output
This commit is contained in:
Mark Pizzolato
2023-12-04 10:57:31 -10:00
parent 42d6f414fc
commit 6d376b2fd9
29 changed files with 245 additions and 74 deletions

View File

@@ -838,8 +838,10 @@ cpu_set_hist(UNIT * uptr, int32 val, CONST char *cptr, void *desc)
return SCPE_OK;
}
lnt = (int32) get_uint(cptr, 10, HIST_MAX, &r);
if ((r != SCPE_OK) || (lnt && (lnt < HIST_MIN)))
return SCPE_ARG;
if (r != SCPE_OK)
return sim_messagef (SCPE_ARG, "Invalid Numeric Value: %s. Maximum is %d\n", cptr, HIST_MAX);
if (lnt && (lnt < HIST_MIN))
return sim_messagef (SCPE_ARG, "%d is less than the minumum history value of %d\n", lnt, HIST_MIN);
hst_p = 0;
if (hst_lnt) {
free(hst);
@@ -880,6 +882,10 @@ cpu_show_hist(FILE * st, UNIT * uptr, int32 val, CONST void *desc)
di = di + hst_lnt;
fprintf(st, "IC AC MQ EA SR\n\n");
for (k = 0; k < lnt; k++) { /* print specified */
if (stop_cpu) { /* Control-C (SIGINT) */
stop_cpu = FALSE;
break; /* abandon remaining output */
}
h = &hst[(++di) % hst_lnt]; /* entry pointer */
if (h->ic & HIST_PC) { /* instruction? */
fprintf(st, "%06lo ", h->ic & AMASK);