mirror of
https://github.com/simh/simh.git
synced 2026-01-11 23:52:58 +00:00
SCP: Add warning about reset when RUN command is used multiple times.
The RUN command implicitly resets all devices which may have unexpected consequences for a novice user. The logic now produces a warning about this side effect when more than one RUN command is executed in the same simulator session. An explicit RESET command suppresses this warning for a subsequent RUN command. A RUN command with the -Q switch also suppresses this warning.
This commit is contained in:
parent
fc3ac62218
commit
ff95fb8ec2
BIN
doc/simh_doc.doc
BIN
doc/simh_doc.doc
Binary file not shown.
20
scp.c
20
scp.c
@ -5257,12 +5257,15 @@ switch (flg) {
|
||||
re[set] device reset specific device
|
||||
*/
|
||||
|
||||
static t_bool run_cmd_did_reset = FALSE;
|
||||
|
||||
t_stat reset_cmd (int32 flag, CONST char *cptr)
|
||||
{
|
||||
char gbuf[CBUFSIZE];
|
||||
DEVICE *dptr;
|
||||
|
||||
GET_SWITCHES (cptr); /* get switches */
|
||||
run_cmd_did_reset = FALSE;
|
||||
if (*cptr == 0) /* reset(cr) */
|
||||
return (reset_all (0));
|
||||
cptr = get_glyph (cptr, gbuf, 0); /* get next glyph */
|
||||
@ -6271,7 +6274,7 @@ if ((flag == RU_RUN) || (flag == RU_GO)) { /* run or go */
|
||||
}
|
||||
}
|
||||
if ((flag == RU_RUN) && /* run? */
|
||||
((r = sim_run_boot_prep ()) != SCPE_OK)) { /* reset sim */
|
||||
((r = sim_run_boot_prep (flag)) != SCPE_OK)) { /* reset sim */
|
||||
put_rval (sim_PC, 0, orig_pcv); /* restore original PC */
|
||||
return r;
|
||||
}
|
||||
@ -6363,7 +6366,7 @@ else if (flag == RU_BOOT) { /* boot */
|
||||
!(uptr->flags & UNIT_ATT))
|
||||
return SCPE_UNATT;
|
||||
unitno = (int32) (uptr - dptr->units); /* recover unit# */
|
||||
if ((r = sim_run_boot_prep ()) != SCPE_OK) /* reset sim */
|
||||
if ((r = sim_run_boot_prep (flag)) != SCPE_OK) /* reset sim */
|
||||
return r;
|
||||
if ((r = dptr->boot (unitno, dptr)) != SCPE_OK) /* boot device */
|
||||
return r;
|
||||
@ -6522,9 +6525,10 @@ if (sim_deb && (sim_deb != stdout) && (sim_deb != sim_log))/* debug if enabled *
|
||||
|
||||
/* Common setup for RUN or BOOT */
|
||||
|
||||
t_stat sim_run_boot_prep (void)
|
||||
t_stat sim_run_boot_prep (int32 flag)
|
||||
{
|
||||
UNIT *uptr;
|
||||
t_stat r;
|
||||
|
||||
sim_interval = 0; /* reset queue */
|
||||
sim_time = sim_rtime = 0;
|
||||
@ -6533,7 +6537,15 @@ for (uptr = sim_clock_queue; uptr != QUEUE_LIST_END; uptr = sim_clock_queue) {
|
||||
sim_clock_queue = uptr->next;
|
||||
uptr->next = NULL;
|
||||
}
|
||||
return reset_all (0);
|
||||
r = reset_all (0);
|
||||
if ((r == SCPE_OK) && (flag == RU_RUN)) {
|
||||
if ((run_cmd_did_reset) && (0 == (sim_switches & SWMASK ('Q')))) {
|
||||
sim_printf ("Resetting all devices... This may not have been your intention.\n");
|
||||
sim_printf ("The GO and CONTINUE commands do not reset devices.\n");
|
||||
}
|
||||
run_cmd_did_reset = TRUE;
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
/* Print stopped message
|
||||
|
||||
2
scp.h
2
scp.h
@ -128,7 +128,7 @@ t_stat _sim_activate_after_abs (UNIT *uptr, uint32 usecs_walltime);
|
||||
t_stat sim_cancel (UNIT *uptr);
|
||||
t_bool sim_is_active (UNIT *uptr);
|
||||
int32 sim_activate_time (UNIT *uptr);
|
||||
t_stat sim_run_boot_prep (void);
|
||||
t_stat sim_run_boot_prep (int32 flag);
|
||||
double sim_gtime (void);
|
||||
uint32 sim_grtime (void);
|
||||
int32 sim_qcount (void);
|
||||
|
||||
@ -1233,7 +1233,7 @@ if (sim_rem_master_mode) {
|
||||
t_stat stat_nomessage;
|
||||
|
||||
sim_printf ("Command input starting on Master Remote Console Session\n");
|
||||
stat = sim_run_boot_prep ();
|
||||
stat = sim_run_boot_prep (0);
|
||||
sim_rem_master_was_enabled = TRUE;
|
||||
while (sim_rem_master_mode) {
|
||||
sim_rem_single_mode[0] = FALSE;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user