From 685ca317a31cc37c21dcbecb177708874a9c29b9 Mon Sep 17 00:00:00 2001 From: "J. David Bryan" Date: Tue, 19 Jan 2021 19:23:33 -0800 Subject: [PATCH] SCP: HP Only SCP and additional 3.11.2 JDB SCP Extensions --- Makefile.mak | 7 +- makefile | 13 +- scp.c | 109 ++++++++++------ scp.h | 13 +- sim_defs.h | 10 +- sim_extension.c | 110 +++++++++++++--- sim_extension.h | 35 ++++-- sim_rev.h | 70 ++++++++++- sim_shmem.c | 20 ++- sim_sock.c | 31 ++--- sim_sock.h | 8 +- sim_tmxr.c | 328 +++++++++++++++++++++++++++++++++++------------- sim_tmxr.h | 4 +- 13 files changed, 565 insertions(+), 193 deletions(-) diff --git a/Makefile.mak b/Makefile.mak index 147ae464..d1d1e79f 100644 --- a/Makefile.mak +++ b/Makefile.mak @@ -45,16 +45,17 @@ HP2100 = $(HP2100D)/hp2100_baci.c $(HP2100D)/hp2100_cpu.c $(HP2100D)/hp2100_cpu_ $(HP2100D)/hp2100_mt.c $(HP2100D)/hp2100_mux.c $(HP2100D)/hp2100_pif.c \ $(HP2100D)/hp2100_pt.c $(HP2100D)/hp2100_sys.c $(HP2100D)/hp2100_tbg.c \ $(HP2100D)/hp2100_tty.c -HP2100_OPT = /DHAVE_INT64 /I$(HP2100D) +HP2100_OPT = /D USE_VM_INIT /DHAVE_INT64 /I$(HP2100D) HP3000D = $(SCPD)\HP3000 HP3000 = $(HP3000D)/hp_disclib.c $(HP3000D)/hp_tapelib.c $(HP3000D)/hp3000_atc.c \ $(HP3000D)/hp3000_clk.c $(HP3000D)/hp3000_cpu.c $(HP3000D)/hp3000_cpu_base.c \ - $(HP3000D)/hp3000_cpu_fp.c $(HP3000D)/hp3000_cpu_cis.c $(HP3000D)/hp3000_ds.c \ + $(HP3000D)/hp3000_cpu_fp.c $(HP3000D)/hp3000_cpu_eis.c \ + $(HP3000D)/hp3000_cpu_cis.c $(HP3000D)/hp3000_ds.c \ $(HP3000D)/hp3000_iop.c $(HP3000D)/hp3000_lp.c $(HP3000D)/hp3000_mem.c \ $(HP3000D)/hp3000_mpx.c $(HP3000D)/hp3000_ms.c $(HP3000D)/hp3000_scmb.c \ $(HP3000D)/hp3000_sel.c $(HP3000D)/hp3000_sys.c -HP3000_OPT = /I$(HP3000D) +HP3000_OPT = /D USE_VM_INIT /I$(HP3000D) clean : diff --git a/makefile b/makefile index 00f5927a..38ae1cd7 100644 --- a/makefile +++ b/makefile @@ -321,8 +321,8 @@ ifeq ($(WIN32),) #*nix Environments (&& cygwin) ifeq (,$(NOASYNCH)) OS_CCDEFS += -DSIM_ASYNCH_IO endif -# OS_LDFLAGS += -lpthread -# $(info using libpthread: $(call find_lib,pthread) $(call find_include,pthread)) + OS_LDFLAGS += -lpthread + $(info using libpthread: $(call find_lib,pthread) $(call find_include,pthread)) endif endif ifneq (,$(call find_include,semaphore)) @@ -534,7 +534,7 @@ endif # Shut up annoying clang default warnings. -ifeq ($(GCC),clang) +ifeq ($(findstring clang,$(COMPILER_NAME)),clang) OS_CCDEFS += -Wno-parentheses -Wno-bitwise-op-parentheses -Wno-dangling-else endif @@ -568,16 +568,17 @@ HP2100 = ${HP2100D}/hp2100_baci.c ${HP2100D}/hp2100_cpu.c ${HP2100D}/hp2100_cpu_ ${HP2100D}/hp2100_mt.c ${HP2100D}/hp2100_mux.c ${HP2100D}/hp2100_pif.c \ ${HP2100D}/hp2100_pt.c ${HP2100D}/hp2100_sys.c ${HP2100D}/hp2100_tbg.c \ ${HP2100D}/hp2100_tty.c -HP2100_OPT = -D HAVE_INT64 -I ${HP2100D} +HP2100_OPT = -D USE_VM_INIT -D HAVE_INT64 -I ${HP2100D} HP3000D = HP3000 HP3000 = ${HP3000D}/hp_disclib.c ${HP3000D}/hp_tapelib.c ${HP3000D}/hp3000_atc.c \ ${HP3000D}/hp3000_clk.c ${HP3000D}/hp3000_cpu.c ${HP3000D}/hp3000_cpu_base.c \ - ${HP3000D}/hp3000_cpu_fp.c ${HP3000D}/hp3000_cpu_cis.c ${HP3000D}/hp3000_ds.c \ + ${HP3000D}/hp3000_cpu_fp.c ${HP3000D}/hp3000_cpu_eis.c \ + ${HP3000D}/hp3000_cpu_cis.c ${HP3000D}/hp3000_ds.c \ ${HP3000D}/hp3000_iop.c ${HP3000D}/hp3000_lp.c ${HP3000D}/hp3000_mem.c \ ${HP3000D}/hp3000_mpx.c ${HP3000D}/hp3000_ms.c ${HP3000D}/hp3000_scmb.c \ ${HP3000D}/hp3000_sel.c ${HP3000D}/hp3000_sys.c -HP3000_OPT = -I ${HP3000D} +HP3000_OPT = -D USE_VM_INIT -I ${HP3000D} # diff --git a/scp.c b/scp.c index b7cef257..d4e4b8a6 100644 --- a/scp.c +++ b/scp.c @@ -23,6 +23,10 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from Robert M Supnik. + 23-Oct-20 JDB Added tmxr_post_logs calls to flush and close log files + 04-Jun-20 JDB Call of "sim_vm_init" is now conditional on USE_VM_INIT + 28-May-20 RMS Flush stdout after prompting (Mark Pizzolato) + 23-Mar-20 RMS Added SET APPEND command 13-Feb-20 RMS Spelled out CONTINUE in command table (Dave Bryan) 09-Jan-20 JDB Added "sim_vm_unit_name" extension hook 26-Oct-19 RMS Removed commented out MTAB_VAL code @@ -58,7 +62,7 @@ Modified ex_reg and dep_reg to pass VM-specific register flags 08-May-12 RMS Fixed memory leaks in save/restore (Peter Schorn) 20-Mar-12 MP Fixes to "SHOW SHOW" commands - 06-Jan-12 JDB Fixed "SHOW DEVICE" with only one enabled unit (Dave Bryan) + 06-Jan-12 JDB Fixed "SHOW DEVICE" with only one enabled unit (Dave Bryan) 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) @@ -220,6 +224,7 @@ /* Macros and data structures */ #include "sim_defs.h" +#include "sim_tmxr.h" #include #include @@ -278,10 +283,8 @@ #define GET_RADIX(val,dft) \ val = sim_get_radix (NULL, sim_switches, dft); -/* The per-simulator init routine is a weak global that defaults to NULL - The other per-simulator pointers can be overrriden by the init routine */ +/* The per-simulator pointers can be overrriden by a VM init routine */ -void (*sim_vm_init) (void); char* (*sim_vm_read) (char *ptr, int32 size, FILE *stream) = NULL; void (*sim_vm_post) (t_bool from_scp) = NULL; CTAB *sim_vm_cmd = NULL; @@ -297,6 +300,7 @@ t_bool (*sim_vm_is_subroutine_call) (t_addr **ret_addrs) = NULL; t_stat set_dev_radix (DEVICE *dptr, UNIT *uptr, int32 flag, char *cptr); t_stat set_dev_enbdis (DEVICE *dptr, UNIT *uptr, int32 flag, char *cptr); t_stat set_dev_debug (DEVICE *dptr, UNIT *uptr, int32 flag, char *cptr); +t_stat set_dev_unit_append (DEVICE *dptr, UNIT *uptr, int32 flag, char *cptr); t_stat set_unit_enbdis (DEVICE *dptr, UNIT *uptr, int32 flag, char *cptr); t_stat ssh_break (FILE *st, char *cptr, int32 flg); t_stat show_cmd_fi (FILE *ofile, int32 flag, char *cptr); @@ -531,7 +535,7 @@ static CTAB cmd_table[] = { { "RUN", &run_cmd, RU_RUN, "ru{n} {new PC} reset and start simulation\n" }, { "GO", &run_cmd, RU_GO, - "go {new PC} start simulation\n" }, + "go {new PC} start simulation\n" }, { "STEP", &run_cmd, RU_STEP, "s{tep} {n} simulate n instructions\n" }, { "CONTINUE", &run_cmd, RU_CONT, @@ -574,23 +578,25 @@ static CTAB cmd_table[] = { "set DISABLED disable device\n" "set DEBUG{=arg} set device debug flags\n" "set NODEBUG={arg} clear device debug flags\n" + "set APPEND set first unit's position for appending\n" "set arg{,arg...} set device parameters (see show modifiers)\n" "set ENABLED enable unit\n" "set DISABLED disable unit\n" + "set APPEND set unit's position for appending\n" "set arg{,arg...} set unit parameters (see show modifiers)\n" }, { "SHOW", &show_cmd, 0, "sh{ow} br{eak} show breakpoints\n" "sh{ow} con{figuration} show configuration\n" "sh{ow} cons{ole} {arg} show console options\n" - "sh{ow} dev{ices} show devices\n" - "sh{ow} m{odifiers} show modifiers for all devices\n" - "sh{ow} s{how} show SHOW commands for all devices\n" - "sh{ow} n{ames} show logical names\n" - "sh{ow} q{ueue} show event queue\n" + "sh{ow} dev{ices} show devices\n" + "sh{ow} m{odifiers} show modifiers for all devices\n" + "sh{ow} s{how} show SHOW commands for all devices\n" + "sh{ow} n{ames} show logical names\n" + "sh{ow} q{ueue} show event queue\n" "sh{ow} ti{me} show simulated time\n" - "sh{ow} th{rottle} show simulation rate\n" - "sh{ow} ve{rsion} show simulator version\n" + "sh{ow} th{rottle} show simulation rate\n" + "sh{ow} ve{rsion} show simulator version\n" "sh{ow} RADIX show device display radix\n" "sh{ow} DEBUG show device debug flags\n" "sh{ow} MODIFIERS show device modifiers\n" @@ -636,6 +642,7 @@ static C1TAB set_dev_tab[] = { { "HEX", &set_dev_radix, 16 }, { "ENABLED", &set_dev_enbdis, 1 }, { "DISABLED", &set_dev_enbdis, 0 }, + { "APPEND", &set_dev_unit_append, 0 }, { "DEBUG", &set_dev_debug, 1 }, { "NODEBUG", &set_dev_debug, 0 }, { NULL, NULL, 0 } @@ -644,6 +651,7 @@ static C1TAB set_dev_tab[] = { static C1TAB set_unit_tab[] = { { "ENABLED", &set_unit_enbdis, 1 }, { "DISABLED", &set_unit_enbdis, 0 }, + { "APPEND", &set_dev_unit_append, 0 }, { NULL, NULL, 0 } }; @@ -717,7 +725,7 @@ for (i = 1; i < argc; i++) { /* loop thru args */ return 0; } if (*cbuf) /* concat args */ - strcat (cbuf, " "); + strcat (cbuf, " "); strcat (cbuf, argv[i]); lookswitch = FALSE; /* no more switches */ } @@ -726,9 +734,10 @@ sim_quiet = sim_switches & SWMASK ('Q'); /* -q means quiet */ sim_init_sock (); /* init socket capabilities */ -if (sim_vm_init != NULL) /* call once only */ - (*sim_vm_init)(); -sim_finit (); /* init fio package */ +#if defined (USE_VM_INIT) +(*sim_vm_init)(); /* call once only */ +#endif +sim_finit(); /* init fio package */ stop_cpu = 0; sim_interval = 0; sim_time = sim_rtime = 0; @@ -804,7 +813,8 @@ while (stat != SCPE_EXIT) { /* in case exit */ (*sim_vm_post) (TRUE); } /* end while */ -detach_all (0, TRUE); /* close files */ +detach_all (0, TRUE); /* close device files */ +tmxr_post_logs (TRUE); /* close all mux log files */ sim_set_deboff (0, NULL); /* close debug */ sim_set_logoff (0, NULL); /* close log */ sim_set_notelnet (0, NULL); /* close Telnet */ @@ -913,7 +923,7 @@ return SCPE_OK; Note that SCPE_STEP ("Step expired") is considered a note and not an error and so does not abort command execution when using -E. - + Inputs: flag = caller and nesting level indicator fcptr = filename and optional arguments, space-separated @@ -1081,10 +1091,10 @@ return; } /* ASSERT command. - + The ASSERT command tests the value of a device register or memory location. The syntax is: - + ASSERT {} {} If is not specified, CPU is assumed. If a register is specified, the @@ -1352,6 +1362,25 @@ else { return SCPE_OK; } +/* Set unit position to end for appending */ + +t_stat set_dev_unit_append (DEVICE *dptr, UNIT *uptr, int32 flag, char *cptr) +{ +if (cptr) + return SCPE_ARG; +if (uptr == NULL) + return SCPE_NOFNC; +if (((uptr->flags & UNIT_SEQ) == 0) || /* must be sequential, */ + ((uptr->flags & UNIT_ROABLE) != 0) || /* not RO settable */ + ((uptr->flags & UNIT_MUSTBUF) != 0)) /* not buffered */ + return SCPE_NOFNC; +if ((uptr->flags & UNIT_ATT) == 0) /* must be attached */ + return SCPE_UNATT; +if (sim_fseek (uptr->fileref, 0, SEEK_END) != 0) /* seek to end */ + return SCPE_IOERR; +uptr->pos = (t_addr) sim_ftell (uptr->fileref); /* set at EOF */ +return SCPE_OK; +} /* Set device debug enabled/disabled routine */ t_stat set_dev_debug (DEVICE *dptr, UNIT *uptr, int32 flag, char *cptr) @@ -1452,7 +1481,7 @@ while (*cptr != 0) { /* do all mods */ *cvptr++ = 0; for (mptr = dptr->modifiers; mptr && (mptr->mask != 0); mptr++) { if (((mptr->mask & MTAB_XTD)? /* right level? */ - (mptr->mask & lvl): (MTAB_VUN & lvl)) && + (mptr->mask & lvl): (MTAB_VUN & lvl)) && ((mptr->disp && mptr->pstring && /* named disp? */ (MATCH_CMD (gbuf, mptr->pstring) == 0)))) { if (cvptr && !(mptr->mask & MTAB_SHP)) @@ -1544,7 +1573,7 @@ if (uptr->flags & UNIT_ATT) { } else if (uptr->flags & UNIT_ATTABLE) fprintf (st, ", not attached"); -show_all_mods (st, dptr, uptr, MTAB_VUN); /* show unit mods */ +show_all_mods (st, dptr, uptr, MTAB_VUN); /* show unit mods */ fprintf (st, "\n"); return SCPE_OK; } @@ -1723,7 +1752,7 @@ DEVICE *dptr; if (cptr && (*cptr != 0)) /* now eol? */ return SCPE_2MARG; -for (i = 0; (dptr = sim_devices[i]) != NULL; i++) +for (i = 0; (dptr = sim_devices[i]) != NULL; i++) show_dev_modifiers (st, dptr, NULL, flag, cptr); return SCPE_OK; } @@ -1777,7 +1806,7 @@ if (dptr->modifiers == NULL) return SCPE_OK; for (mptr = dptr->modifiers; mptr->mask != 0; mptr++) { if (mptr->pstring && ((mptr->mask & MTAB_XTD)? - ((mptr->mask & flag) && !(mptr->mask & MTAB_NMO)): + ((mptr->mask & flag) && !(mptr->mask & MTAB_NMO)): ((MTAB_VUN & flag) && ((uptr->flags & mptr->mask) == mptr->match)))) { fputs (", ", st); show_one_mod (st, dptr, uptr, mptr, NULL, 0); @@ -1815,7 +1844,7 @@ DEVICE *dptr; if (cptr && (*cptr != 0)) /* now eol? */ return SCPE_2MARG; -for (i = 0; (dptr = sim_devices[i]) != NULL; i++) +for (i = 0; (dptr = sim_devices[i]) != NULL; i++) show_dev_show_commands (st, dptr, NULL, flag, cptr); return SCPE_OK; } @@ -1875,7 +1904,7 @@ t_stat r; t_addr lo, hi, max; int32 cnt; -if (sim_brk_types == 0) +if (sim_brk_types == 0) return SCPE_NOFNC; if (dptr == NULL) /* sanity checks */ return SCPE_IERR; @@ -1913,7 +1942,7 @@ while (*cptr) { sim_brk_showall (st, sim_switches); else return SCPE_ARG; } - else { + else { for ( ; lo <= hi; lo = lo + 1) { r = ssh_break_one (st, flg, lo, cnt, aptr); if (r != SCPE_OK) @@ -2541,7 +2570,7 @@ sim_ref_type = REF_NONE; /* use no references */ READ_S (buf); /* [V2.5+] read version */ v35 = v32 = FALSE; if (strcmp (buf, save_vercur) == 0) /* version 3.5? */ - v35 = v32 = TRUE; + v35 = v32 = TRUE; else if (strcmp (buf, save_ver32) == 0) /* version 3.2? */ v32 = TRUE; else if (strcmp (buf, save_ver30) != 0) { /* version 3.0? */ @@ -2583,7 +2612,7 @@ for ( ;; ) { /* device loop */ } READ_S (buf); /* [V3.0+] logical name */ deassign_device (dptr); /* delete old name */ - if ((buf[0] != 0) && + if ((buf[0] != 0) && ((r = assign_device (dptr, buf)) != SCPE_OK)) return r; READ_I (flg); /* [V2.10+] ctlr flags */ @@ -2842,6 +2871,7 @@ for (i = 1; (dptr = sim_devices[i]) != NULL; i++) { /* flush attached files fflush (uptr->fileref); } } +tmxr_post_logs (FALSE); /* flush all mux log files */ #if defined (VMS) sim_printf ("\n"); #endif @@ -2879,7 +2909,7 @@ t_stat r = 0; t_addr k; t_value pcval; -fputc ('\n', st); /* skip a line */ +fputc ('\n', st); /* skip a line */ if (v >= SCPE_BASE) /* SCP error? */ fputs (sim_error_text (v), st); /* print it from the SCP list */ @@ -3012,7 +3042,7 @@ for (gptr = gbuf, reason = SCPE_OK; tdptr = sim_dfdev; /* working dptr */ if (strncmp (gptr, "STATE", strlen ("STATE")) == 0) { tptr = gptr + strlen ("STATE"); - if (*tptr && (*tptr++ != ',')) + if (*tptr && (*tptr++ != ',')) return SCPE_ARG; if ((lowr = sim_dfdev->registers) == NULL) return SCPE_NXREG; @@ -3071,7 +3101,7 @@ return reason; exdep_addr_loop examine/deposit range of addresses */ -t_stat exdep_reg_loop (FILE *ofile, SCHTAB *schptr, int32 flag, char *cptr, +t_stat exdep_reg_loop (FILE *ofile, SCHTAB *schptr, int32 flag, char *cptr, REG *lowr, REG *highr, uint32 lows, uint32 highs) { t_stat reason; @@ -3317,13 +3347,13 @@ if ((rptr->depth > 1) && (rptr->flags & REG_UNIT)) { #if defined (USE_INT64) if (sz <= sizeof (uint32)) *((uint32 *) uptr) = (*((uint32 *) uptr) & - ~(((uint32) mask) << rptr->offset)) | + ~(((uint32) mask) << rptr->offset)) | (((uint32) val) << rptr->offset); else *((t_uint64 *) uptr) = (*((t_uint64 *) uptr) & ~(mask << rptr->offset)) | (val << rptr->offset); #else *((uint32 *) uptr) = (*((uint32 *) uptr) & - ~(((uint32) mask) << rptr->offset)) | + ~(((uint32) mask) << rptr->offset)) | (((uint32) val) << rptr->offset); #endif } @@ -3505,7 +3535,7 @@ for (i = 0, j = addr; i < count; i++, j = j + dptr->aincr) { else { if (!(uptr->flags & UNIT_ATT)) return SCPE_UNATT; - if (uptr->flags & UNIT_RAW) + if (uptr->flags & UNIT_RAW) return SCPE_NOFNC; if ((uptr->flags & UNIT_FIX) && (j >= uptr->capac)) return SCPE_NXM; @@ -3513,7 +3543,7 @@ for (i = 0, j = addr; i < count; i++, j = j + dptr->aincr) { loc = j / dptr->aincr; if (uptr->flags & UNIT_BUF) { SZ_STORE (sz, sim_eval[i], uptr->filebuf, loc); - if (loc >= uptr->hwmark) + if (loc >= uptr->hwmark) uptr->hwmark = (uint32) loc + 1; } else { @@ -3636,13 +3666,16 @@ if (prompt) { /* interactive? */ } else { printf ("%s", prompt); /* display prompt */ + fflush (stdout); cptr = fgets (cptr, size, stream); /* get cmd line */ } } else cptr = fgets (cptr, size, stream); /* get cmd line */ #else -if (prompt) /* interactive? */ +if (prompt) { /* interactive? */ printf ("%s", prompt); /* display prompt */ + fflush (stdout); + } cptr = fgets (cptr, size, stream); /* get cmd line */ #endif @@ -4241,7 +4274,7 @@ while (*cptr) { /* loop through modifier cptr = get_glyph_nc (cptr + 1, gbuf, 0); sim_ofile = sim_fopen (gbuf, "a"); /* open for append */ if (sim_ofile == NULL) { /* open failed? */ - *st = SCPE_OPENERR; + *st = SCPE_OPENERR; return NULL; } sim_opt_out |= CMD_OPT_OF; /* got output file */ diff --git a/scp.h b/scp.h index 58d84cbd..50bb567b 100644 --- a/scp.h +++ b/scp.h @@ -1,6 +1,6 @@ /* scp.h: simulator control program headers - Copyright (c) 1993-2019, Robert M Supnik + Copyright (c) 1993-2020, Robert M Supnik Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), @@ -23,6 +23,7 @@ be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from Robert M Supnik. + 04-Jun-20 JDB Declaration of "sim_vm_init" is now conditional on USE_VM_INIT 08-Dec-19 JDB Added "sim_vm_unit_name" extension hook 09-Oct-19 JDB Added "detach_all" global declaration 19-Jul-19 JDB Added "sim_get_radix" extension hook @@ -228,10 +229,14 @@ extern t_stat fprint_sym (FILE *ofile, t_addr addr, t_value *val, extern t_stat parse_sym (char *cptr, t_addr addr, UNIT *uptr, t_value *val, int32 sw); -/* The per-simulator init routine is a weak global that defaults to NULL - The other per-simulator pointers can be overrriden by the init routine */ +/* The per-simulator init routine is declared (and called) only if the + compilation defines the USE_VM_INIT symbol. The other per-simulator pointers + can be overrriden by the init routine or by the CPU reset routine that is + called during simulator startup, whichever is preferred. */ -extern void (*sim_vm_init) (void); +#if defined (USE_VM_INIT) +extern void(*sim_vm_init) (void); +#endif extern char* (*sim_vm_read) (char *ptr, int32 size, FILE *stream); extern void (*sim_vm_post) (t_bool from_scp); extern CTAB *sim_vm_cmd; diff --git a/sim_defs.h b/sim_defs.h index aa5159e8..a1c288bc 100644 --- a/sim_defs.h +++ b/sim_defs.h @@ -116,6 +116,9 @@ #include #include #include +#if defined(_MSC_VER) && (_MSC_VER < 1900) +#define snprintf _snprintf /* poor man's snprintf which will work most of the time but has different return value */ +#endif #include #include #include @@ -542,6 +545,9 @@ struct sim_debtab { #define FLDATA(nm,loc,pos) #nm, &(loc), 2, 1, (pos), 1 #define GRDATA(nm,loc,rdx,wd,pos) #nm, &(loc), (rdx), (wd), (pos), 1 #define BRDATA(nm,loc,rdx,wd,dep) #nm, (loc), (rdx), (wd), 0, (dep) +#define VBRDATA(nm,loc,rdx,wd,dep) #nm, (loc), (rdx), (wd), 0, (dep) +#define SAVEDATA(nm,loc) \ + #nm, &(loc), 8, 8, 0, sizeof(loc), REG_HRO #define URDATA(nm,loc,rdx,wd,off,dep,fl) \ #nm, &(loc), (rdx), (wd), (off), (dep), ((fl) | REG_UNIT) #else @@ -551,6 +557,9 @@ struct sim_debtab { #define FLDATA(nm,loc,pos) "nm", &(loc), 2, 1, (pos), 1 #define GRDATA(nm,loc,rdx,wd,pos) "nm", &(loc), (rdx), (wd), (pos), 1 #define BRDATA(nm,loc,rdx,wd,dep) "nm", (loc), (rdx), (wd), 0, (dep) +#define VBRDATA(nm,loc,rdx,wd,dep) "nm", (loc), (rdx), (wd), 0, (dep) +#define SAVEDATA(nm,loc) \ + "nm", &(loc), 8, 8, 0, sizeof(loc), REG_HRO #define URDATA(nm,loc,rdx,wd,off,dep,fl) \ "nm", &(loc), (rdx), (wd), (off), (dep), ((fl) | REG_UNIT) #endif @@ -585,7 +594,6 @@ typedef struct sim_debtab DEBTAB; when compiling for SIMH 3.x. */ - #if defined (__STDC__) || defined (_WIN32) #define ORDATAD(nm,loc,wd,desc) #nm, &(loc), 8, (wd), 0, 1 #define DRDATAD(nm,loc,wd,desc) #nm, &(loc), 10, (wd), 0, 1 diff --git a/sim_extension.c b/sim_extension.c index ba469f60..ab4fc0f8 100644 --- a/sim_extension.c +++ b/sim_extension.c @@ -23,6 +23,11 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the author. + 21-Oct-20 JDB A NULL poll pointer is now valid for MUX attach and detach + 20-Oct-20 JDB Added FLUSH command to post file contents to disc + 25-Aug-20 JDB Call of "vm_sim_vm_init" is now conditional on USE_VM_INIT + 03-Aug-20 JDB IF now retains remainder of breakpoint command list + 06-Jul-20 JDB Silence spurious compiler warning in "ex_if_cmd" 14-Feb-20 JDB First release version 18-Mar-19 JDB Created @@ -274,14 +279,11 @@ static void ex_initialize (void); void (*sim_vm_init) (void) = ex_initialize; /* use our one-time initializer */ -/* Hooks provided by us for the back end virtual machine */ +/* Hooks provided by us for use by the back end virtual machine */ -CTAB *vm_sim_vm_cmd = NULL; - -void (*vm_sim_vm_init) (void); - -UNIT *vm_console_input_unit; /* console input unit pointer */ -UNIT *vm_console_output_unit; /* console output unit pointer */ +CTAB *vm_sim_vm_cmd = NULL; /* VM command extension table */ +UNIT *vm_console_input_unit = NULL; /* console input unit pointer */ +UNIT *vm_console_output_unit = NULL; /* console output unit pointer */ /* Pointer to the VM handler for unit names */ @@ -519,6 +521,7 @@ static t_stat ex_run_cmd (int32 flag, char *cptr); static t_stat ex_do_cmd (int32 flag, char *cptr); static t_stat ex_if_cmd (int32 flag, char *cptr); static t_stat ex_delete_cmd (int32 flag, char *cptr); +static t_stat ex_flush_cmd (int32 flag, char *cptr); static t_stat ex_restricted_cmd (int32 flag, char *cptr); static t_stat ex_set_cmd (int32 flag, char *cptr); static t_stat ex_show_cmd (int32 flag, char *cptr); @@ -605,6 +608,7 @@ static CTAB ex_cmds [] = { { "IF", ex_if_cmd, 0, "if ;... execute commands if condition TRUE\n" }, { "DELETE", ex_delete_cmd, 0, "del{ete} delete a file\n" }, + { "FLUSH", ex_flush_cmd, 0, "f{lush} flush all open files to disc\n" }, { "GOTO", ex_restricted_cmd, EX_GOTO, "goto