diff --git a/AltairZ80/altairZ80_sio.c b/AltairZ80/altairZ80_sio.c index dfa0a9bb..1f255a16 100644 --- a/AltairZ80/altairZ80_sio.c +++ b/AltairZ80/altairZ80_sio.c @@ -149,7 +149,6 @@ extern const t_bool rtc_avail; extern uint32 PCX; extern int32 sim_switches; extern int32 sim_quiet; -extern const char *scp_error_messages[]; extern int32 SR; extern UNIT cpu_unit; extern volatile int32 stop_cpu; @@ -1189,7 +1188,7 @@ static void attachCPM(UNIT *uptr) { sim_quiet = sim_switches & SWMASK ('Q'); /* -q means quiet */ lastCPMStatus = attach_unit(uptr, cpmCommandLine); if ((lastCPMStatus != SCPE_OK) && (simh_device.dctrl & VERBOSE_MSG)) - printf("SIMH: " ADDRESS_FORMAT " Cannot open '%s' (%s)." NLP, PCX, cpmCommandLine, scp_error_messages[lastCPMStatus - SCPE_BASE]); + printf("SIMH: " ADDRESS_FORMAT " Cannot open '%s' (%s)." NLP, PCX, cpmCommandLine, sim_error_text(lastCPMStatus)); } /* setClockZSDOSAdr points to 6 byte block in M: YY MM DD HH MM SS in BCD notation */ diff --git a/scp.c b/scp.c index 9c776a4c..565ea5ee 100644 --- a/scp.c +++ b/scp.c @@ -23,6 +23,7 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from Robert M Supnik. + 22-Jan-11 MP Added SET ON, SET NOON, ON, GOTO and RETURN command support 13-Jan-11 MP Added "SHOW SHOW" and "SHOW SHOW" commands 05-Jan-11 RMS Fixed bug in deposit stride for numeric input (John Dundas) 23-Dec-10 RMS Clarified some help messages (Mark Pizzolato) @@ -187,6 +188,7 @@ #include "sim_rev.h" #include #include +#include #if defined(HAVE_READLINE) #include @@ -211,7 +213,7 @@ #define SSH_SH 1 /* show */ #define SSH_CL 2 /* clear */ -#define DO_NEST_LVL 10 /* DO cmd nesting level */ +#define MAX_DO_NEST_LVL 10 /* DO cmd nesting level */ #define SRBSIZ 1024 /* save/restore buffer */ #define SIM_BRK_INILNT 4096 /* bpt tbl length */ #define SIM_BRK_ALLTYP 0xFFFFFFFF @@ -298,6 +300,7 @@ t_stat show_dev_modifiers (FILE *st, DEVICE *dptr, UNIT *uptr, int32 flag, char t_stat show_dev_show_commands (FILE *st, DEVICE *dptr, UNIT *uptr, int32 flag, char *cptr); t_stat show_version (FILE *st, DEVICE *dptr, UNIT *uptr, int32 flag, char *cptr); t_stat show_break (FILE *st, DEVICE *dptr, UNIT *uptr, int32 flag, char *cptr); +t_stat show_on (FILE *st, DEVICE *dptr, UNIT *uptr, int32 flag, char *cptr); t_stat show_device (FILE *st, DEVICE *dptr, int32 flag); t_stat show_unit (FILE *st, DEVICE *dptr, UNIT *uptr, int32 flag); t_stat show_all_mods (FILE *st, DEVICE *dptr, UNIT *uptr, int32 flg); @@ -360,6 +363,8 @@ t_stat dep_addr (int32 flag, char *cptr, t_addr addr, DEVICE *dptr, UNIT *uptr, int32 dfltinc); t_stat step_svc (UNIT *ptr); void sub_args (char *instr, char *tmpbuf, int32 maxstr, char *do_arg[]); +t_stat set_on (int32 flag, char *cptr); + /* Global data */ @@ -376,7 +381,7 @@ int32 sim_is_running = 0; uint32 sim_brk_summ = 0; uint32 sim_brk_types = 0; uint32 sim_brk_dflt = 0; -char *sim_brk_act = NULL; +char *sim_brk_act[MAX_DO_NEST_LVL]; BRKTAB *sim_brk_tab = NULL; int32 sim_brk_ent = 0; int32 sim_brk_lnt = 0; @@ -393,6 +398,13 @@ t_value *sim_eval = NULL; int32 sim_deb_close = 0; /* 1 = close debug */ FILE *sim_log = NULL; /* log file */ FILE *sim_deb = NULL; /* debug file */ + +static FILE *sim_gotofile; +static int32 sim_do_depth = 0; + +static int32 sim_on_check[MAX_DO_NEST_LVL+1]; +static char *sim_on_actions[MAX_DO_NEST_LVL+1][SCPE_MAX_ERR+1]; + static SCHTAB sim_stab; static UNIT sim_step_unit = { UDATA (&step_svc, 0, 0) }; @@ -417,51 +429,54 @@ static const char *sim_snet = "no Ethernet"; const char save_vercur[] = "V3.5"; const char save_ver32[] = "V3.2"; const char save_ver30[] = "V3.0"; -const char *scp_error_messages[] = { - "Address space exceeded", - "Unit not attached", - "I/O error", - "Checksum error", - "Format error", - "Unit not attachable", - "File open error", - "Memory exhausted", - "Invalid argument", - "Step expired", - "Unknown command", - "Read only argument", - "Command not completed", - "Simulation stopped", - "Goodbye", - "Console input I/O error", - "Console output I/O error", - "End of file", - "Relocation error", - "No settable parameters", - "Unit already attached", - "Hardware timer error", - "SIGINT handler setup error", - "Console terminal setup error", - "Subscript out of range", - "Command not allowed", - "Unit disabled", - "Read only operation not allowed", - "Invalid switch", - "Missing value", - "Too few arguments", - "Too many arguments", - "Non-existent device", - "Non-existent unit", - "Non-existent register", - "Non-existent parameter", - "Nested DO command limit exceeded", - "Internal error", - "Invalid magtape record length", - "Console Telnet connection lost", - "Console Telnet connection timed out", - "Console Telnet output stall", - "Assertion failed" - }; +const struct scp_error { + char *code; + char *message; + } scp_errors[1+SCPE_MAX_ERR-SCPE_BASE] = + {{"NXM", "Address space exceeded"}, + {"UNATT", "Unit not attached"}, + {"IOERR", "I/O error"}, + {"CSUM", "Checksum error"}, + {"FMT", "Format error"}, + {"NOATT", "Unit not attachable"}, + {"OPENERR", "File open error"}, + {"MEM", "Memory exhausted"}, + {"ARG", "Invalid argument"}, + {"STEP", "Step expired"}, + {"UNK", "Unknown command"}, + {"RO", "Read only argument"}, + {"INCOMP", "Command not completed"}, + {"STOP", "Simulation stopped"}, + {"EXIT", "Goodbye"}, + {"TTIERR", "Console input I/O error"}, + {"TTOERR", "Console output I/O error"}, + {"EOF", "End of file"}, + {"REL", "Relocation error"}, + {"NOPARAM", "No settable parameters"}, + {"ALATT", "Unit already attached"}, + {"TIMER", "Hardware timer error"}, + {"SIGERR", "SIGINT handler setup error"}, + {"TTYERR", "Console terminal setup error"}, + {"SUB", "Subscript out of range"}, + {"NOFNC", "Command not allowed"}, + {"UDIS", "Unit disabled"}, + {"NORO", "Read only operation not allowed"}, + {"INVSW", "Invalid switch"}, + {"MISVAL", "Missing value"}, + {"2FARG", "Too few arguments"}, + {"2MARG", "Too many arguments"}, + {"NXDEV", "Non-existent device"}, + {"NXUN", "Non-existent unit"}, + {"NXREG", "Non-existent register"}, + {"NXPAR", "Non-existent parameter"}, + {"NEST", "Nested DO command limit exceeded"}, + {"IERR", "Internal error"}, + {"MTRLNT", "Invalid magtape record length"}, + {"LOST", "Console Telnet connection lost"}, + {"TTMO", "Console Telnet connection timed out"}, + {"STALL", "Console Telnet output stall"}, + {"AFAIL", "Assertion failed"}, +}; const size_t size_map[] = { sizeof (int8), sizeof (int8), sizeof (int16), sizeof (int32), sizeof (int32) @@ -556,6 +571,8 @@ static CTAB cmd_table[] = { "set ENABLED enable unit\n" "set DISABLED disable unit\n" "set arg{,arg...} set unit parameters (see show modifiers)\n" + "set on enables error checking after command execution\n" + "set noon disables error checking after command execution\n" }, { "SHOW", &show_cmd, 0, "sh{ow} br{eak} show breakpoints\n" @@ -575,9 +592,18 @@ static CTAB cmd_table[] = { "sh{ow} NAMES show device logical name\n" "sh{ow} SHOW show device SHOW commands\n" "sh{ow} {arg,...} show device parameters\n" - "sh{ow} {arg,...} show unit parameters\n" }, + "sh{ow} {arg,...} show unit parameters\n" + "sh{ow} on show on condition actions\n" }, { "DO", &do_cmd, 1, "do {arg,arg...} process command file\n" }, + { "GOTO", &goto_cmd, 1, + "goto