SCP: Add support for BREAK/EXPECT/UNTIL/IF action steps in remote console

This commit is contained in:
Mark Pizzolato 2018-01-07 12:09:35 -08:00
parent 35f214c937
commit 154320bf71
3 changed files with 19 additions and 2 deletions

8
scp.c
View file

@ -10557,6 +10557,14 @@ else
sim_brk_clract ();
}
char *sim_brk_replace_act (char *new_action)
{
char *old_action = sim_brk_act_buf[sim_do_depth];
sim_brk_act_buf[sim_do_depth] = new_action;
return old_action;
}
/* New PC */
void sim_brk_npc (uint32 cnt)

1
scp.h
View file

@ -274,6 +274,7 @@ uint32 sim_brk_test (t_addr bloc, uint32 btyp);
void sim_brk_clrspc (uint32 spc, uint32 btyp);
void sim_brk_npc (uint32 cnt);
void sim_brk_setact (const char *action);
char *sim_brk_replace_act (char *new_action);
const char *sim_brk_message(void);
t_stat sim_send_input (SEND *snd, uint8 *data, size_t size, uint32 after, uint32 delay);
t_stat sim_show_send_input (FILE *st, const SEND *snd);

View file

@ -963,6 +963,7 @@ if (ep != NULL) { /* if a semicolon is present */
else {
strlcpy (buf, rem->act, size); /* copy action */
rem->act += strlen (rem->act); /* adv ptr to end */
sim_rem_clract (line);
}
return buf;
}
@ -1794,7 +1795,7 @@ for (i=(was_active_command ? sim_rem_cmd_active_line : 0);
}
if (sim_rem_master_was_connected && /* Master mode ever connected? */
!sim_rem_con_tmxr.ldsc[0].sock) /* Master Connection lost? */
return SCPE_EXIT; /* simulator has been 'unplugged' */
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 */
@ -1998,6 +1999,8 @@ if (sim_rem_master_mode) {
sim_rem_master_was_enabled = TRUE;
sim_last_cmd_stat = SCPE_OK;
while (sim_rem_master_mode) {
char *brk_action;
sim_rem_consoles[0].single_mode = FALSE;
sim_cancel (rem_con_data_unit);
sim_activate (rem_con_data_unit, -1);
@ -2006,9 +2009,14 @@ if (sim_rem_master_mode) {
stat_nomessage = stat & SCPE_NOMESSAGE; /* extract possible message supression flag */
stat = _sim_rem_message ("RUN", stat);
}
sim_debug (DBG_MOD, &sim_remote_console, "Master Session Returned: Status - %d Active_Line: %d, Mode: %s, Active Cmd: %s\n", stat, sim_rem_cmd_active_line, sim_rem_consoles[0].single_mode ? "Single" : "^E Stopped", sim_rem_active_command ? sim_rem_active_command->name : "");
brk_action = sim_brk_replace_act (NULL);
sim_debug (DBG_MOD, &sim_remote_console, "Master Session Returned: Status - %d Active_Line: %d, Mode: %s, Active Cmd: %s%s%s\n", stat, sim_rem_cmd_active_line, sim_rem_consoles[0].single_mode ? "Single" : "^E Stopped", sim_rem_active_command ? sim_rem_active_command->name : "", brk_action ? " Break Action: " : "", brk_action ? brk_action : "");
if (stat == SCPE_EXIT)
sim_rem_master_mode = FALSE;
if (brk_action) {
free (sim_rem_consoles[0].act);
sim_rem_consoles[0].act = brk_action;
}
sim_rem_cmd_active_line = 0; /* Make it look like */
sim_rem_consoles[0].single_mode = FALSE;
if (stat != SCPE_STEP)