diff --git a/scp.c b/scp.c index 51c7129c..9a37e8ce 100644 --- a/scp.c +++ b/scp.c @@ -8510,12 +8510,8 @@ if (signal (SIGTERM, int_handler) == SIG_ERR) { /* set WRU */ sim_ttcmd (); return r; } -if (sim_step) { /* set step timer */ - if (sim_switches & SWMASK ('T')) /* stepping for elapsed time? */ - sim_activate_after (&sim_step_unit, (uint32)sim_step);/* wall clock based step */ - else - sim_activate (&sim_step_unit, sim_step); /* instruction based step */ - } +if (sim_step) /* set step timer */ + sim_sched_step (); sim_activate_after (&sim_flush_unit, FLUSH_INTERVAL); /* Enable periodic buffer flushing */ stop_cpu = FALSE; sim_is_running = TRUE; /* flag running */ @@ -8565,7 +8561,7 @@ do { else sim_step = 1; if (sim_step) /* set step timer */ - sim_activate (&sim_step_unit, sim_step); + sim_sched_step (); } while (1); if ((SCPE_BARE_STATUS(r) == SCPE_STOP) && @@ -8593,7 +8589,7 @@ signal (SIGHUP, SIG_DFL); /* cancel WRU */ signal (SIGTERM, SIG_DFL); /* cancel WRU */ sim_flush_buffered_files(); sim_cancel (&sim_flush_unit); /* cancel flush timer */ -sim_cancel (&sim_step_unit); /* cancel step timer */ +sim_cancel_step (); /* cancel step timer */ sim_throt_cancel (); /* cancel throttle */ AIO_UPDATE_QUEUE; UPDATE_SIM_TIME; /* update sim time */ @@ -8732,6 +8728,16 @@ t_stat sim_cancel_step (void) return sim_cancel (&sim_step_unit); } +/* schedule step service */ + +t_stat sim_sched_step (void) +{ +if (sim_switches & SWMASK ('T')) /* stepping for elapsed time? */ + return sim_activate_after_abs (&sim_step_unit, (uint32)sim_step);/* wall clock based step */ +else + return sim_activate_abs (&sim_step_unit, sim_step); /* instruction based step */ +} + /* Signal handler for ^C signal - set stop simulation flag */ void int_handler (int sig) diff --git a/scp.h b/scp.h index 07f5424e..7d795fd2 100644 --- a/scp.h +++ b/scp.h @@ -318,6 +318,7 @@ t_stat show_dev_debug (FILE *st, DEVICE *dptr, UNIT *uptr, int32 flag, CONST cha t_stat sim_add_debug_flags (DEVICE *dptr, DEBTAB *debflags); const char *sim_error_text (t_stat stat); t_stat sim_string_to_stat (const char *cptr, t_stat *cond); +t_stat sim_sched_step (void); t_stat sim_cancel_step (void); void sim_printf (const char *fmt, ...) GCC_FMT_ATTR(1, 2); void sim_perror (const char *msg); diff --git a/sim_console.c b/sim_console.c index 7d3cb2c0..74ac587d 100644 --- a/sim_console.c +++ b/sim_console.c @@ -1405,7 +1405,8 @@ for (i=(was_active_command ? sim_rem_cmd_active_line : 0); sim_rem_cmd_active_line = -1; /* Done with active command */ if (!sim_rem_active_command) { /* STEP command? */ stat = SCPE_STEP; - _sim_rem_message ("STEP", stat); /* produce a STEP complete message */ + if (sim_con_stable_registers || !sim_rem_master_mode) + _sim_rem_message ("STEP", stat);/* produce a STEP complete message */ } _sim_rem_log_out (lp); sim_rem_active_command = NULL; /* Restart loop to process available input */ @@ -1840,8 +1841,14 @@ if (sim_rem_master_was_connected && /* Master mode ever !sim_rem_con_tmxr.ldsc[0].sock) /* Master Connection lost? */ return sim_messagef (SCPE_EXIT, "Master Session Disconnect");/* simulator has been 'unplugged' */ if (sim_rem_cmd_active_line != -1) { - if (steps) - sim_activate(uptr, steps); /* check again after 'steps' instructions */ + if (steps) { + if (!sim_con_stable_registers && sim_rem_master_mode) { + sim_step = steps; + sim_sched_step (); + } + else + sim_activate(uptr, steps); /* check again after 'steps' instructions */ + } else return SCPE_REMOTE; /* force sim_instr() to exit to process command */ } @@ -2065,8 +2072,11 @@ if (sim_rem_master_mode) { } sim_rem_cmd_active_line = 0; /* Make it look like */ sim_rem_consoles[0].single_mode = FALSE; + sim_cancel_step (); if (stat != SCPE_STEP) sim_rem_active_command = &allowed_single_remote_cmds[0];/* Dummy */ + else + sim_activate_abs (rem_con_data_unit, 0); /* force step completion processing */ sim_last_cmd_stat = SCPE_BARE_STATUS(stat); /* make exit status available to remote console */ } sim_rem_master_was_enabled = FALSE;