From 6d376b2fd97d46db92d9227e5f853bda31a80ced Mon Sep 17 00:00:00 2001 From: Mark Pizzolato Date: Mon, 4 Dec 2023 10:57:31 -1000 Subject: [PATCH] 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 --- 3B2/3b2_cpu.c | 6 +++++- AltairZ80/altairz80_cpu.c | 4 ++++ B5500/b5500_cpu.c | 10 ++++++++-- H316/h316_cpu.c | 12 +++++++++--- I1401/i1401_cpu.c | 12 +++++++++--- I1620/i1620_cpu.c | 12 +++++++++--- I7000/i7010_cpu.c | 10 ++++++++-- I7000/i701_cpu.c | 10 ++++++++-- I7000/i7070_cpu.c | 10 ++++++++-- I7000/i7080_cpu.c | 10 ++++++++-- I7000/i7090_cpu.c | 10 ++++++++-- I7094/i7094_cpu.c | 10 ++++++++-- Intel-Systems/common/i8080.c | 12 +++++++++--- Interdata/id16_cpu.c | 12 +++++++++--- Interdata/id32_cpu.c | 12 +++++++++--- PDP1/pdp1_cpu.c | 12 +++++++++--- PDP10/kx10_cpu.c | 10 ++++++++-- PDP10/pdp10_cpu.c | 14 ++++++++++---- PDP11/pdp11_cpu.c | 12 +++++++++--- PDP18B/pdp18b_cpu.c | 12 +++++++++--- PDP8/pdp8_cpu.c | 12 +++++++++--- SDS/sds_cpu.c | 12 +++++++++--- SEL32/sel32_cpu.c | 10 ++++++++-- TX-0/tx0_cpu.c | 12 ++++++++++-- VAX/vax_cpu.c | 20 ++++++++++++-------- alpha/alpha_cpu.c | 12 ++++++++++-- imlac/imlac_cpu.c | 4 ++++ sigma/sigma_cpu.c | 13 ++++++++++--- swtp6800/common/m6800.c | 12 +++++++++--- 29 files changed, 245 insertions(+), 74 deletions(-) diff --git a/3B2/3b2_cpu.c b/3B2/3b2_cpu.c index b86d2df4..d16e0218 100644 --- a/3B2/3b2_cpu.c +++ b/3B2/3b2_cpu.c @@ -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 */ diff --git a/AltairZ80/altairz80_cpu.c b/AltairZ80/altairz80_cpu.c index 9afd4ce9..2b7e8132 100644 --- a/AltairZ80/altairz80_cpu.c +++ b/AltairZ80/altairz80_cpu.c @@ -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? */ diff --git a/B5500/b5500_cpu.c b/B5500/b5500_cpu.c index 70ce9b50..291ee419 100644 --- a/B5500/b5500_cpu.c +++ b/B5500/b5500_cpu.c @@ -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; diff --git a/H316/h316_cpu.c b/H316/h316_cpu.c index 2c5d8c02..6dbc73b2 100644 --- a/H316/h316_cpu.c +++ b/H316/h316_cpu.c @@ -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 */ diff --git a/I1401/i1401_cpu.c b/I1401/i1401_cpu.c index 3d6c7cf4..4f623eae 100644 --- a/I1401/i1401_cpu.c +++ b/I1401/i1401_cpu.c @@ -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); diff --git a/I1620/i1620_cpu.c b/I1620/i1620_cpu.c index b7a6d89e..633fb44e 100644 --- a/I1620/i1620_cpu.c +++ b/I1620/i1620_cpu.c @@ -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); diff --git a/I7000/i7010_cpu.c b/I7000/i7010_cpu.c index e4aaf027..593e0293 100644 --- a/I7000/i7010_cpu.c +++ b/I7000/i7010_cpu.c @@ -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; diff --git a/I7000/i701_cpu.c b/I7000/i701_cpu.c index cc76ef8a..0b6229da 100644 --- a/I7000/i701_cpu.c +++ b/I7000/i701_cpu.c @@ -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); diff --git a/I7000/i7070_cpu.c b/I7000/i7070_cpu.c index da09ef8b..e207a2ea 100644 --- a/I7000/i7070_cpu.c +++ b/I7000/i7070_cpu.c @@ -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); diff --git a/I7000/i7080_cpu.c b/I7000/i7080_cpu.c index 69fa0cc5..ef7d7eb8 100644 --- a/I7000/i7080_cpu.c +++ b/I7000/i7080_cpu.c @@ -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, diff --git a/I7000/i7090_cpu.c b/I7000/i7090_cpu.c index ca71b5f7..e2080860 100644 --- a/I7000/i7090_cpu.c +++ b/I7000/i7090_cpu.c @@ -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':' '); diff --git a/I7094/i7094_cpu.c b/I7094/i7094_cpu.c index a8ad9450..0a4174e1 100644 --- a/I7094/i7094_cpu.c +++ b/I7094/i7094_cpu.c @@ -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 */ diff --git a/Intel-Systems/common/i8080.c b/Intel-Systems/common/i8080.c index ca5f02f5..90209a7e 100644 --- a/Intel-Systems/common/i8080.c +++ b/Intel-Systems/common/i8080.c @@ -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); diff --git a/Interdata/id16_cpu.c b/Interdata/id16_cpu.c index d2929d13..9d074c79 100644 --- a/Interdata/id16_cpu.c +++ b/Interdata/id16_cpu.c @@ -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); diff --git a/Interdata/id32_cpu.c b/Interdata/id32_cpu.c index 9dc132b6..bd46b5a4 100644 --- a/Interdata/id32_cpu.c +++ b/Interdata/id32_cpu.c @@ -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); diff --git a/PDP1/pdp1_cpu.c b/PDP1/pdp1_cpu.c index e4f789d7..122534ee 100644 --- a/PDP1/pdp1_cpu.c +++ b/PDP1/pdp1_cpu.c @@ -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 */ diff --git a/PDP10/kx10_cpu.c b/PDP10/kx10_cpu.c index db86c6e6..0eec1c67 100644 --- a/PDP10/kx10_cpu.c +++ b/PDP10/kx10_cpu.c @@ -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 diff --git a/PDP10/pdp10_cpu.c b/PDP10/pdp10_cpu.c index 3bcbd522..34dd92d1 100644 --- a/PDP10/pdp10_cpu.c +++ b/PDP10/pdp10_cpu.c @@ -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); diff --git a/PDP11/pdp11_cpu.c b/PDP11/pdp11_cpu.c index 1fbe97e7..89fa7073 100644 --- a/PDP11/pdp11_cpu.c +++ b/PDP11/pdp11_cpu.c @@ -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]; diff --git a/PDP18B/pdp18b_cpu.c b/PDP18B/pdp18b_cpu.c index 7ae54a04..cdabc085 100644 --- a/PDP18B/pdp18b_cpu.c +++ b/PDP18B/pdp18b_cpu.c @@ -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 */ diff --git a/PDP8/pdp8_cpu.c b/PDP8/pdp8_cpu.c index 1fce64d9..e1d9f215 100644 --- a/PDP8/pdp8_cpu.c +++ b/PDP8/pdp8_cpu.c @@ -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 */ diff --git a/SDS/sds_cpu.c b/SDS/sds_cpu.c index d4130c04..103691cd 100644 --- a/SDS/sds_cpu.c +++ b/SDS/sds_cpu.c @@ -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 */ diff --git a/SEL32/sel32_cpu.c b/SEL32/sel32_cpu.c index 67a09238..7bfbef71 100644 --- a/SEL32/sel32_cpu.c +++ b/SEL32/sel32_cpu.c @@ -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) diff --git a/TX-0/tx0_cpu.c b/TX-0/tx0_cpu.c index 993c2125..0b6be86c 100644 --- a/TX-0/tx0_cpu.c +++ b/TX-0/tx0_cpu.c @@ -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 */ diff --git a/VAX/vax_cpu.c b/VAX/vax_cpu.c index 45befe4b..3be7f0cf 100644 --- a/VAX/vax_cpu.c +++ b/VAX/vax_cpu.c @@ -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"); diff --git a/alpha/alpha_cpu.c b/alpha/alpha_cpu.c index a8dcd063..dee7b4fd 100644 --- a/alpha/alpha_cpu.c +++ b/alpha/alpha_cpu.c @@ -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); diff --git a/imlac/imlac_cpu.c b/imlac/imlac_cpu.c index 2c05ef4d..610b1925 100644 --- a/imlac/imlac_cpu.c +++ b/imlac/imlac_cpu.c @@ -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, diff --git a/sigma/sigma_cpu.c b/sigma/sigma_cpu.c index e7469bbb..edd760d2 100755 --- a/sigma/sigma_cpu.c +++ b/sigma/sigma_cpu.c @@ -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); diff --git a/swtp6800/common/m6800.c b/swtp6800/common/m6800.c index 915efe50..e662077e 100644 --- a/swtp6800/common/m6800.c +++ b/swtp6800/common/m6800.c @@ -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);