mirror of
https://github.com/simh/simh.git
synced 2026-01-11 23:52:58 +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:
parent
42d6f414fc
commit
6d376b2fd9
@ -1468,7 +1468,7 @@ t_stat cpu_set_hist(UNIT *uptr, int32 val, CONST char *cptr, void *desc)
|
||||
|
||||
/* If no length was provided, give up */
|
||||
if (result != SCPE_OK) {
|
||||
return SCPE_ARG;
|
||||
return sim_messagef (SCPE_ARG, "Invalid Numeric Value: %s. Maximum is %d\n", cptr, MAX_HIST_SIZE);
|
||||
}
|
||||
|
||||
/* Legnth 0 is a special flag that means disable the feature. */
|
||||
@ -1535,6 +1535,10 @@ t_stat cpu_show_hist(FILE *st, UNIT *uptr, int32 val, CONST void *desc)
|
||||
fprintf(st, "PSW SP PC IR\n");
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
if (stop_cpu) { /* Control-C (SIGINT) */
|
||||
stop_cpu = FALSE;
|
||||
break; /* abandon remaining output */
|
||||
}
|
||||
ip = &INST[(di++) % (int32) cpu_hist_size];
|
||||
if (ip->valid) {
|
||||
/* Show the opcode mnemonic */
|
||||
|
||||
@ -7186,6 +7186,10 @@ t_stat cpu_show_hist (FILE *st, UNIT *uptr, int32 val, CONST void *desc)
|
||||
if (di < 0) di = di + hst_lnt;
|
||||
|
||||
for (k = 0; k < lnt; k++) {
|
||||
if (stop_cpu) { /* Control-C (SIGINT) */
|
||||
stop_cpu = FALSE;
|
||||
break; /* abandon remaining output */
|
||||
}
|
||||
h = &hst[(di++) % hst_lnt];
|
||||
|
||||
if (h->valid) { /* valid entry? */
|
||||
|
||||
@ -3929,8 +3929,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);
|
||||
@ -3974,6 +3976,10 @@ cpu_show_hist(FILE * st, UNIT * uptr, int32 val, CONST void *desc)
|
||||
" X S F R M GH KV Flags"
|
||||
" Q Intruction IAR\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->c & HIST_PC) { /* instruction? */
|
||||
int i;
|
||||
|
||||
@ -1735,8 +1735,10 @@ if (cptr == NULL) {
|
||||
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);
|
||||
@ -1769,7 +1771,7 @@ if (hst_lnt == 0) /* enabled? */
|
||||
if (cptr) {
|
||||
lnt = (int32) get_uint (cptr, 10, hst_lnt, &r);
|
||||
if ((r != SCPE_OK) || (lnt == 0))
|
||||
return SCPE_ARG;
|
||||
return sim_messagef (SCPE_ARG, "Invalid count specifier: %s, max is %d\n", cptr, hst_lnt);
|
||||
}
|
||||
else lnt = hst_lnt;
|
||||
di = hst_p - lnt; /* work forward */
|
||||
@ -1778,6 +1780,10 @@ if (di < 0)
|
||||
fprintf (st, " PC C A B X ea IR\n");
|
||||
fprintf (st, "----- - ------ ------ ------ ----- -----------\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->pc & HIST_PC) { /* instruction? */
|
||||
cr = (h->pc & HIST_C)? 1: 0; /* carry */
|
||||
|
||||
@ -1893,8 +1893,10 @@ if (cptr == NULL) {
|
||||
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);
|
||||
@ -1925,7 +1927,7 @@ if (hst_lnt == 0) /* enabled? */
|
||||
if (cptr) {
|
||||
lnt = (int32) get_uint (cptr, 10, hst_lnt, &r);
|
||||
if ((r != SCPE_OK) || (lnt == 0))
|
||||
return SCPE_ARG;
|
||||
return sim_messagef (SCPE_ARG, "Invalid count specifier: %s, max is %d\n", cptr, hst_lnt);
|
||||
}
|
||||
else lnt = hst_lnt;
|
||||
di = hst_p - lnt; /* work forward */
|
||||
@ -1933,6 +1935,10 @@ if (di < 0)
|
||||
di = di + hst_lnt;
|
||||
fprintf (st, "IS IR\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->ilnt) { /* instruction? */
|
||||
fprintf (st, "%05d ", h->is);
|
||||
|
||||
@ -2408,8 +2408,10 @@ if (cptr == NULL) {
|
||||
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);
|
||||
@ -2442,7 +2444,7 @@ if (hst_lnt == 0) /* enabled? */
|
||||
if (cptr) {
|
||||
lnt = (int32) get_uint (cptr, 10, hst_lnt, &r);
|
||||
if ((r != SCPE_OK) || (lnt == 0))
|
||||
return SCPE_ARG;
|
||||
return sim_messagef (SCPE_ARG, "Invalid count specifier: %s, max is %d\n", cptr, hst_lnt);
|
||||
}
|
||||
else lnt = hst_lnt;
|
||||
di = hst_p - lnt; /* work forward */
|
||||
@ -2450,6 +2452,10 @@ if (di < 0)
|
||||
di = di + hst_lnt;
|
||||
fprintf (st, "PC IR\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->vld) { /* instruction? */
|
||||
fprintf (st, "%05d ", h->pc);
|
||||
|
||||
@ -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':' ');
|
||||
|
||||
@ -2373,8 +2373,10 @@ if (cptr == NULL) {
|
||||
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);
|
||||
@ -2468,6 +2470,10 @@ if (di < 0)
|
||||
di = di + hst_lnt;
|
||||
fprintf (st, " PC repeat AC MQ SI EA IR\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 */
|
||||
cpu_fprint_one_inst (st, h->pc, h->rpt, h->ea, h->ir, h->ac, h->mq, h->si, h->opnd);
|
||||
} /* end for */
|
||||
|
||||
@ -1555,8 +1555,10 @@ t_stat 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);
|
||||
@ -1586,7 +1588,7 @@ t_stat cpu_show_hist(FILE *st, UNIT *uptr, int32 val, CONST void *desc)
|
||||
if (cptr) {
|
||||
lnt = (int32) get_uint (cptr, 10, hst_lnt, &r);
|
||||
if ((r != SCPE_OK) || (lnt == 0))
|
||||
return SCPE_ARG;
|
||||
return sim_messagef (SCPE_ARG, "Invalid count specifier: %s, max is %d\n", cptr, hst_lnt);
|
||||
}
|
||||
else lnt = hst_lnt;
|
||||
di = hst_p - lnt; /* work forward */
|
||||
@ -1594,6 +1596,10 @@ t_stat cpu_show_hist(FILE *st, UNIT *uptr, int32 val, CONST void *desc)
|
||||
di = di + hst_lnt;
|
||||
fprintf (st, "PC SP CC A B C D E F H L Instruction\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 */
|
||||
ir = h->inst[0];
|
||||
fprintf (st, "%04X %04X %02X ", h->pc , h->sp, h->psw);
|
||||
|
||||
@ -1979,8 +1979,10 @@ if (cptr == NULL) {
|
||||
return SCPE_OK;
|
||||
}
|
||||
lnt = (uint32) 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);
|
||||
@ -2011,7 +2013,7 @@ if (hst_lnt == 0) /* enabled? */
|
||||
if (cptr) {
|
||||
lnt = (int32) get_uint (cptr, 10, hst_lnt, &r);
|
||||
if ((r != SCPE_OK) || (lnt == 0))
|
||||
return SCPE_ARG;
|
||||
return sim_messagef (SCPE_ARG, "Invalid count specifier: %s, max is %d\n", cptr, hst_lnt);
|
||||
}
|
||||
else lnt = hst_lnt;
|
||||
di = hst_p - lnt; /* work forward */
|
||||
@ -2019,6 +2021,10 @@ if (di < 0)
|
||||
di = di + hst_lnt;
|
||||
fprintf (st, "PC r1 opnd ea IR\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->vld) { /* instruction? */
|
||||
fprintf (st, "%04X %04X %04X ", h->pc, h->r1, h->opnd);
|
||||
|
||||
@ -2366,8 +2366,10 @@ if (cptr == NULL) {
|
||||
return SCPE_OK;
|
||||
}
|
||||
lnt = (uint32) 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);
|
||||
@ -2398,7 +2400,7 @@ if (hst_lnt == 0) /* enabled? */
|
||||
if (cptr) {
|
||||
lnt = (int32) get_uint (cptr, 10, hst_lnt, &r);
|
||||
if ((r != SCPE_OK) || (lnt == 0))
|
||||
return SCPE_ARG;
|
||||
return sim_messagef (SCPE_ARG, "Invalid count specifier: %s, max is %d\n", cptr, hst_lnt);
|
||||
}
|
||||
else lnt = hst_lnt;
|
||||
di = hst_p - lnt; /* work forward */
|
||||
@ -2406,6 +2408,10 @@ if (di < 0)
|
||||
di = di + hst_lnt;
|
||||
fprintf (st, "PC r1 operand ea IR\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->pc & HIST_PC) { /* instruction? */
|
||||
fprintf (st, "%06X %08X %08X ", h->pc & VAMASK32, h->r1, h->opnd);
|
||||
|
||||
@ -1642,8 +1642,10 @@ if (cptr == NULL) {
|
||||
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);
|
||||
@ -1673,7 +1675,7 @@ if (hst_lnt == 0) /* enabled? */
|
||||
if (cptr) {
|
||||
lnt = (int32) get_uint (cptr, 10, hst_lnt, &r);
|
||||
if ((r != SCPE_OK) || (lnt == 0))
|
||||
return SCPE_ARG;
|
||||
return sim_messagef (SCPE_ARG, "Invalid count specifier: %s, max is %d\n", cptr, hst_lnt);
|
||||
}
|
||||
else lnt = hst_lnt;
|
||||
di = hst_p - lnt; /* work forward */
|
||||
@ -1681,6 +1683,10 @@ if (di < 0)
|
||||
di = di + hst_lnt;
|
||||
fprintf (st, "PC OV AC IO PF EA IR\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->pc & HIST_PC) { /* instruction? */
|
||||
ov = (h->ovac >> HIST_V_SHF) & 1; /* overflow */
|
||||
|
||||
@ -13956,8 +13956,10 @@ if (cptr == NULL) {
|
||||
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);
|
||||
@ -13995,6 +13997,10 @@ if (di < 0)
|
||||
di = di + hst_lnt;
|
||||
fprintf (st, "PC AC EA AR RES FLAGS IR\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->pc & HIST_PC) { /* instruction? */
|
||||
#if KL
|
||||
|
||||
@ -2512,15 +2512,17 @@ t_stat cpu_set_hist (UNIT *uptr, int32 val, CONST char *cptr, void *desc)
|
||||
int32 i, lnt;
|
||||
t_stat r;
|
||||
|
||||
if (cptr == NULL) {
|
||||
if (cptr == NULL) { /* Clear History */
|
||||
for (i = 0; i < hst_lnt; i++)
|
||||
hst[i].pc = 0;
|
||||
hst_p = 0;
|
||||
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);
|
||||
@ -2550,7 +2552,7 @@ if (hst_lnt == 0) /* enabled? */
|
||||
if (cptr) {
|
||||
lnt = (int32) get_uint (cptr, 10, hst_lnt, &r);
|
||||
if ((r != SCPE_OK) || (lnt == 0))
|
||||
return SCPE_ARG;
|
||||
return sim_messagef (SCPE_ARG, "Invalid count specifier: %s, max is %d\n", cptr, hst_lnt);
|
||||
}
|
||||
else lnt = hst_lnt;
|
||||
di = hst_p - lnt; /* work forward */
|
||||
@ -2558,6 +2560,10 @@ if (di < 0)
|
||||
di = di + hst_lnt;
|
||||
fprintf (st, "PC AC EA IR\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->pc & HIST_PC) { /* instruction? */
|
||||
fprintf (st, "%06o ", h->pc & AMASK);
|
||||
|
||||
@ -3630,8 +3630,10 @@ if (cptr == NULL) {
|
||||
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);
|
||||
@ -3662,7 +3664,7 @@ if (hst_lnt == 0) /* enabled? */
|
||||
if (cptr) {
|
||||
lnt = (int32) get_uint (cptr, 10, hst_lnt, &r);
|
||||
if ((r != SCPE_OK) || (lnt == 0))
|
||||
return SCPE_ARG;
|
||||
return sim_messagef (SCPE_ARG, "Invalid count specifier: %s, max is %d\n", cptr, hst_lnt);
|
||||
}
|
||||
else lnt = hst_lnt;
|
||||
di = hst_p - lnt; /* work forward */
|
||||
@ -3670,6 +3672,10 @@ if (di < 0)
|
||||
di = di + hst_lnt;
|
||||
fprintf (st, "PC SP PSW src dst IR\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->pc & HIST_VLD) { /* instruction? */
|
||||
ir = h->inst[0];
|
||||
|
||||
@ -2329,8 +2329,10 @@ if (cptr == NULL) {
|
||||
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);
|
||||
@ -2362,7 +2364,7 @@ if (hst_lnt == 0) /* enabled? */
|
||||
if (cptr) {
|
||||
lnt = (int32) get_uint (cptr, 10, hst_lnt, &r);
|
||||
if ((r != SCPE_OK) || (lnt == 0))
|
||||
return SCPE_ARG;
|
||||
return sim_messagef (SCPE_ARG, "Invalid count specifier: %s, max is %d\n", cptr, hst_lnt);
|
||||
}
|
||||
else lnt = hst_lnt;
|
||||
di = hst_p - lnt; /* work forward */
|
||||
@ -2370,6 +2372,10 @@ if (di < 0)
|
||||
di = di + hst_lnt;
|
||||
fprintf (st, "PC L AC MQ IR\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->pc & HIST_PC) { /* instruction? */
|
||||
l = (h->lac >> 18) & 1; /* link */
|
||||
|
||||
@ -1572,8 +1572,10 @@ if (cptr == NULL) {
|
||||
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);
|
||||
@ -1603,7 +1605,7 @@ if (hst_lnt == 0) /* enabled? */
|
||||
if (cptr) {
|
||||
lnt = (int32) get_uint (cptr, 10, hst_lnt, &r);
|
||||
if ((r != SCPE_OK) || (lnt == 0))
|
||||
return SCPE_ARG;
|
||||
return sim_messagef (SCPE_ARG, "Invalid count specifier: %s, max is %d\n", cptr, hst_lnt);
|
||||
}
|
||||
else lnt = hst_lnt;
|
||||
di = hst_p - lnt; /* work forward */
|
||||
@ -1611,6 +1613,10 @@ if (di < 0)
|
||||
di = di + hst_lnt;
|
||||
fprintf (st, "PC L AC MQ ea IR\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->pc & HIST_PC) { /* instruction? */
|
||||
l = (h->lac >> 12) & 1; /* link */
|
||||
|
||||
@ -1871,8 +1871,10 @@ if (cptr == NULL) {
|
||||
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 (sim_switches & SWMASK('M'))
|
||||
hst_exclude = MON_MODE;
|
||||
@ -1912,7 +1914,7 @@ if (hst_lnt == 0) /* enabled? */
|
||||
if (cptr) {
|
||||
lnt = (int32) get_uint (cptr, 10, hst_lnt, &r);
|
||||
if ((r != SCPE_OK) || (lnt == 0))
|
||||
return SCPE_ARG;
|
||||
return sim_messagef (SCPE_ARG, "Invalid count specifier: %s, max is %d\n", cptr, hst_lnt);
|
||||
}
|
||||
else lnt = hst_lnt;
|
||||
di = hst_p - lnt; /* work forward */
|
||||
@ -1920,6 +1922,10 @@ if (di < 0)
|
||||
di = di + hst_lnt;
|
||||
fprintf (st, "CYC PC MD OV A B X EA C\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->typ) { /* instruction? */
|
||||
ov = (h->typ >> 4) & 1; /* overflow */
|
||||
|
||||
@ -7548,8 +7548,10 @@ cpu_set_hist(UNIT *uptr, int32 val, CONST char *cptr, void *desc)
|
||||
}
|
||||
/* the user has specified options, process them */
|
||||
lnt = (int32)get_uint(cptr, 10, HIST_MAX, &r);
|
||||
if ((r != SCPE_OK) || (lnt && (lnt < HIST_MIN)))
|
||||
return SCPE_ARG; /* arg error for bad input or too small a value */
|
||||
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; /* start at beginning */
|
||||
if (hst_lnt) { /* if a new length was input, resize history buffer */
|
||||
free(hst); /* out with the old */
|
||||
@ -7586,6 +7588,10 @@ t_stat cpu_show_hist(FILE *st, UNIT *uptr, int32 val, CONST void *desc)
|
||||
if (di < 0)
|
||||
di = di + hst_lnt; /* wrap */
|
||||
for (k = 0; k < lnt; k++) { /* print specified entries */
|
||||
if (stop_cpu) { /* Control-C (SIGINT) */
|
||||
stop_cpu = FALSE;
|
||||
break; /* abandon remaining output */
|
||||
}
|
||||
h = &hst[(++di) % hst_lnt]; /* entry pointer */
|
||||
/* display the instruction and results */
|
||||
if (MODES & BASEBIT)
|
||||
|
||||
@ -1140,7 +1140,10 @@ if (cptr == NULL) {
|
||||
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);
|
||||
@ -1167,13 +1170,18 @@ InstHistory *h;
|
||||
if (hst_lnt == 0) return SCPE_NOFNC; /* enabled? */
|
||||
if (cptr) {
|
||||
lnt = (int32) get_uint (cptr, 10, hst_lnt, &r);
|
||||
if ((r != SCPE_OK) || (lnt == 0)) return SCPE_ARG;
|
||||
if ((r != SCPE_OK) || (lnt == 0))
|
||||
return sim_messagef (SCPE_ARG, "Invalid count specifier: %s, max is %d\n", cptr, hst_lnt);
|
||||
}
|
||||
else lnt = hst_lnt;
|
||||
di = hst_p - lnt; /* work forward */
|
||||
if (di < 0) di = di + hst_lnt;
|
||||
fprintf (st, "PC OV AC IO PF EA IR\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->pc & HIST_PC) { /* instruction? */
|
||||
ov = (h->ovac >> HIST_V_SHF) & 1; /* overflow */
|
||||
|
||||
@ -1586,7 +1586,7 @@ for ( ;; ) {
|
||||
hst_p = hst_p + 1;
|
||||
if (hst_p >= hst_lnt)
|
||||
hst_p = 0;
|
||||
if (hst_log && (hst_p == hst_log_p))
|
||||
if (hst_log && (hst_p == hst_log_p)) /* File Logging and Full, then write all records*/
|
||||
cpu_show_hist_records (hst_log, FALSE, hst_log_p, hst_lnt);
|
||||
}
|
||||
|
||||
@ -3533,21 +3533,21 @@ int32 i, lnt;
|
||||
char gbuf[CBUFSIZE];
|
||||
t_stat r;
|
||||
|
||||
if (cptr == NULL) {
|
||||
for (i = 0; i < hst_lnt; i++)
|
||||
hst[i].iPC = 0;
|
||||
hst_p = 0;
|
||||
if (cptr == NULL) { /* Clear History */
|
||||
if (hst_log) {
|
||||
sim_set_fsize (hst_log, (t_addr)0);
|
||||
hst_log_p = 0;
|
||||
cpu_show_hist_records (hst_log, TRUE, 0, 0);
|
||||
}
|
||||
for (i = 0; i < hst_lnt; i++)
|
||||
hst[i].iPC = 0;
|
||||
hst_p = 0;
|
||||
return SCPE_OK;
|
||||
}
|
||||
cptr = get_glyph (cptr, gbuf, ':');
|
||||
lnt = (int32) get_uint (gbuf, 10, HIST_MAX, &r);
|
||||
if (r != SCPE_OK)
|
||||
return sim_messagef (SCPE_ARG, "Invalid Numeric Value: %s\n", gbuf);
|
||||
return sim_messagef (SCPE_ARG, "Invalid Numeric Value: %s. Maximum is %d\n", gbuf, 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;
|
||||
@ -3594,7 +3594,7 @@ if (hst_lnt == 0) /* enabled? */
|
||||
if (cptr) {
|
||||
lnt = (int32) get_uint (cptr, 10, hst_lnt, &r);
|
||||
if ((r != SCPE_OK) || (lnt == 0))
|
||||
return SCPE_ARG;
|
||||
return sim_messagef (SCPE_ARG, "Invalid count specifier: %s, max is %d\n", cptr, hst_lnt);
|
||||
}
|
||||
else lnt = hst_lnt;
|
||||
di = hst_p - lnt; /* work forward */
|
||||
@ -3616,6 +3616,10 @@ if (do_header) {
|
||||
fprintf (st, "PC PSL IR\n\n");
|
||||
}
|
||||
for (k = 0; k < count; k++) { /* print specified */
|
||||
if (stop_cpu) { /* Control-C (SIGINT) */
|
||||
stop_cpu = FALSE;
|
||||
break; /* abandon remaining output */
|
||||
}
|
||||
h = &hst[(start++) % hst_lnt]; /* entry pointer */
|
||||
if (h->iPC == 0) /* filled in? */
|
||||
continue;
|
||||
@ -4010,7 +4014,7 @@ fprintf (st, " sim> SET CPU HISTORY clear history buffer\n");
|
||||
fprintf (st, " sim> SET CPU HISTORY=0 disable history\n");
|
||||
fprintf (st, " sim> SET CPU {-T} HISTORY=n{:file} enable history, length = n\n");
|
||||
fprintf (st, " sim> SHOW CPU HISTORY print CPU history\n");
|
||||
fprintf (st, " sim> SHOW CPU HISTORY=n print first n entries of CPU history\n\n");
|
||||
fprintf (st, " sim> SHOW CPU HISTORY=n print most recent n entries of history\n\n");
|
||||
fprintf (st, "The -T switch causes simulator time to be recorded (and displayed)\n");
|
||||
fprintf (st, "with each history entry.\n");
|
||||
fprintf (st, "When writing history to a file (SET CPU HISTORY=n:file), 'n' specifies\n");
|
||||
|
||||
@ -1768,7 +1768,10 @@ if (cptr == NULL) {
|
||||
return SCPE_OK;
|
||||
}
|
||||
lnt = (uint32) 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);
|
||||
@ -1847,13 +1850,18 @@ InstHistory *h;
|
||||
if (hst_lnt == 0) return SCPE_NOFNC; /* enabled? */
|
||||
if (cptr) {
|
||||
lnt = (int32) get_uint (cptr, 10, hst_lnt, &r);
|
||||
if ((r != SCPE_OK) || (lnt == 0)) return SCPE_ARG;
|
||||
if ((r != SCPE_OK) || (lnt == 0))
|
||||
return sim_messagef (SCPE_ARG, "Invalid count specifier: %s, max is %d\n", cptr, hst_lnt);
|
||||
}
|
||||
else lnt = hst_lnt;
|
||||
di = hst_p - lnt; /* work forward */
|
||||
if (di < 0) di = di + hst_lnt;
|
||||
fprintf (st, "PC Ra Rb IR\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->pc & HIST_PC) { /* instruction? */
|
||||
cpu_fprint_one_inst (st, h->ir, h->pc, h->ra, h->rb);
|
||||
|
||||
@ -525,6 +525,10 @@ cpu_show_hist (FILE *st, UNIT *uptr, int32 val, CONST void *desc)
|
||||
j = history_m + history_i - history_n;
|
||||
|
||||
for (i = 0; i < history_n; i++) {
|
||||
if (stop_cpu) { /* Control-C (SIGINT) */
|
||||
stop_cpu = FALSE;
|
||||
break; /* abandon remaining output */
|
||||
}
|
||||
fprintf (st, "%06o %06o %06o %06o %06o %d ",
|
||||
history[j].PC,
|
||||
history[j].IR,
|
||||
|
||||
@ -2777,8 +2777,10 @@ if (cptr == NULL) {
|
||||
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);
|
||||
@ -2839,13 +2841,18 @@ if (hst_lnt == 0) /* enabled? */
|
||||
return SCPE_NOFNC;
|
||||
if (cptr) {
|
||||
lnt = (int32) get_uint (cptr, 10, hst_lnt, &r);
|
||||
if ((r != SCPE_OK) || (lnt == 0)) return SCPE_ARG;
|
||||
if ((r != SCPE_OK) || (lnt == 0))
|
||||
return sim_messagef (SCPE_ARG, "Invalid count specifier: %s, max is %d\n", cptr, hst_lnt);
|
||||
}
|
||||
else lnt = hst_lnt;
|
||||
di = hst_p - lnt; /* work forward */
|
||||
if (di < 0) di = di + hst_lnt;
|
||||
fprintf (st, " PC CC Rn Rn|1 EA operand operand1 IR\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->typ_cc_pc) /* instruction? */
|
||||
cpu_fprint_one_inst (st, h->typ_cc_pc, h->ir, h->rn, h->rn1, h->ea, h->op, h->op1);
|
||||
|
||||
@ -2173,8 +2173,10 @@ t_stat 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);
|
||||
@ -2204,7 +2206,7 @@ t_stat cpu_show_hist (FILE *st, UNIT *uptr, int32 val, CONST void *desc)
|
||||
if (cptr) {
|
||||
lnt = (int32) get_uint (cptr, 10, hst_lnt, &r);
|
||||
if ((r != SCPE_OK) || (lnt == 0))
|
||||
return SCPE_ARG;
|
||||
return sim_messagef (SCPE_ARG, "Invalid count specifier: %s, max is %d\n", cptr, hst_lnt);
|
||||
}
|
||||
else lnt = hst_lnt;
|
||||
di = hst_p - lnt; /* work forward */
|
||||
@ -2212,6 +2214,10 @@ t_stat cpu_show_hist (FILE *st, UNIT *uptr, int32 val, CONST void *desc)
|
||||
di = di + hst_lnt;
|
||||
fprintf (st, "PC SP CC A B IX Instruction\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 */
|
||||
ir = h->inst[0];
|
||||
fprintf (st, "%04X %04X %02X ", h->pc , h->sp, h->cc);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user