mirror of
https://github.com/simh/simh.git
synced 2026-05-19 02:59:04 +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:
@@ -3850,8 +3850,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);
|
||||
@@ -3892,6 +3894,10 @@ cpu_show_hist(FILE * st, UNIT * uptr, int32 val, CONST void *desc)
|
||||
di = di + hst_lnt;
|
||||
fprintf(st, "IC A B Aend Bend \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? */
|
||||
pc = h->ic & HIST_MSK;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -2887,8 +2887,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);
|
||||
@@ -2929,6 +2931,10 @@ cpu_show_hist(FILE * st, UNIT * uptr, int32 val, CONST void *desc)
|
||||
di = di + hst_lnt;
|
||||
fprintf(st, "IC EA BEFORE AFTER INST\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, "%05d ", h->ic & 0xffff);
|
||||
|
||||
@@ -3320,8 +3320,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);
|
||||
@@ -3363,6 +3365,10 @@ cpu_show_hist(FILE * st, UNIT * uptr, int32 val, CONST void *desc)
|
||||
di = di + hst_lnt;
|
||||
fprintf(st, "IC OP MA REG\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, "%06d %c %06d %02d ", h->ic & 0x3ffff,
|
||||
|
||||
@@ -4272,8 +4272,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);
|
||||
@@ -4315,6 +4317,10 @@ cpu_show_hist(FILE * st, UNIT * uptr, int32 val, CONST void *desc)
|
||||
fprintf(st,
|
||||
"IC AC MQ EA SR XR1 XR2 XR4\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, "%06o%c", h->ic & 077777, ((h->ic>>19)&1)?'b':' ');
|
||||
|
||||
Reference in New Issue
Block a user