From 4ace512eea31a7320839fe24e4a55ece18788925 Mon Sep 17 00:00:00 2001 From: Bob Supnik Date: Sat, 14 Mar 2020 07:20:10 -0700 Subject: [PATCH] SCP, TMXR: new extensions to support HP simulators --- scp.c | 5 +++++ scp.h | 2 ++ sim_tmxr.c | 28 +++++++++++++++++----------- sim_tmxr.h | 10 ++++++---- 4 files changed, 30 insertions(+), 15 deletions(-) diff --git a/scp.c b/scp.c index 0af86c05..b7cef257 100644 --- a/scp.c +++ b/scp.c @@ -24,6 +24,7 @@ in this Software without prior written authorization from Robert M Supnik. 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 09-Oct-19 JDB Corrected "sim_ref_type" use for RESTORE and DETACH ALL 19-Jul-19 JDB Added "sim_get_radix" extension hook @@ -378,6 +379,7 @@ int32 get_radix_local (const char *cptr, int32 switches, int32 default_radix); char *sim_vm_release; void (*sub_args) (char *iptr, char *optr, int32 len, char *args []) = sub_args_local; int32 (*sim_get_radix) (const char *cptr, int32 switches, int32 default_radix) = get_radix_local; +char * (*sim_vm_unit_name) (const UNIT *uptr) = NULL; /* Global data */ @@ -1632,6 +1634,7 @@ t_stat show_queue (FILE *st, DEVICE *dnotused, UNIT *unotused, int32 flag, char DEVICE *dptr; UNIT *uptr; int32 accum; +char *vptr; if (cptr && (*cptr != 0)) return SCPE_2MARG; @@ -1646,6 +1649,8 @@ accum = 0; for (uptr = sim_clock_queue; uptr != NULL; uptr = uptr->next) { if (uptr == &sim_step_unit) fprintf (st, " Step timer"); + else if (sim_vm_unit_name && (vptr = sim_vm_unit_name (uptr))) + fprintf (st, " %s", vptr); else if ((dptr = find_dev_from_unit (uptr)) != NULL) { fprintf (st, " %s", sim_dname (dptr)); if (dptr->numunits > 1) diff --git a/scp.h b/scp.h index 9bb6bb64..58d84cbd 100644 --- a/scp.h +++ b/scp.h @@ -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. + 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 13-Apr-19 JDB Added extension hooks @@ -211,6 +212,7 @@ extern uint32 sim_ref_type; /* reference type */ extern char *sim_vm_release; extern void (*sub_args) (char *iptr, char *optr, int32 len, char *args []); extern int32 (*sim_get_radix) (const char *cptr, int32 switches, int32 default_radix); +extern char * (*sim_vm_unit_name) (const UNIT *uptr); /* VM interface */ diff --git a/sim_tmxr.c b/sim_tmxr.c index a161a3d7..93d6d091 100644 --- a/sim_tmxr.c +++ b/sim_tmxr.c @@ -26,6 +26,7 @@ Based on the original DZ11 simulator by Thord Nilson, as updated by Arthur Krewat. + 19-Dec-19 JDB Added tmxr_is_extended global hook 19-Mar-19 JDB Added tmxr_read, tmxr_write, tmxr_show, tmxr_close global hooks and associated local hook routines; added tmxr_init_line, tmxr_report_connection, @@ -148,10 +149,11 @@ static int32 tmxr_local_write (TMLN *lp, int32 length); static void tmxr_local_show (TMLN *lp, FILE *stream); static void tmxr_local_close (TMLN *lp); -int32 (*tmxr_read) (TMLN *lp, int32 length) = tmxr_local_read; -int32 (*tmxr_write) (TMLN *lp, int32 length) = tmxr_local_write; -void (*tmxr_show) (TMLN *lp, FILE *stream) = tmxr_local_show; -void (*tmxr_close) (TMLN *lp) = tmxr_local_close; +int32 (*tmxr_read) (TMLN *lp, int32 length) = tmxr_local_read; +int32 (*tmxr_write) (TMLN *lp, int32 length) = tmxr_local_write; +void (*tmxr_show) (TMLN *lp, FILE *stream) = tmxr_local_show; +void (*tmxr_close) (TMLN *lp) = tmxr_local_close; +t_bool (*tmxr_is_extended) (TMLN *lp) = NULL; /* Poll for new connection @@ -370,8 +372,9 @@ for (i = 0; i < mp->lines; i++) { /* loop thru lines */ lp->rxbpi = lp->rxbpi + nbytes; /* adv pointers */ lp->rxcnt = lp->rxcnt + nbytes; - if (lp->exptr != NULL) /* if the line is extended */ - continue; /* then skip the Telnet processing */ + if (tmxr_is_extended != NULL /* if the line */ + && tmxr_is_extended (lp) == TRUE) /* is extended */ + continue; /* then skip the Telnet processing */ memset (&lp->rbr[j], 0, nbytes); /* clear status */ @@ -635,9 +638,10 @@ mp->master = sock; /* save master socket */ for (i = 0; i < mp->lines; i++) { /* initialize lines */ lp = mp->ldsc + i; - if (lp->exptr == NULL) { /* if the line is not extended */ - tmxr_init_line (lp); /* then initialize the line */ - lp->conn = 0; /* and clear the connection */ + if (tmxr_is_extended == NULL /* if the line */ + || tmxr_is_extended (lp) == FALSE) { /* is not extended */ + tmxr_init_line (lp); /* then initialize the line */ + lp->conn = 0; /* and clear the connection */ } } return SCPE_OK; @@ -678,8 +682,10 @@ TMLN *lp; for (i = 0; i < mp->lines; i++) { /* loop thru conn */ lp = mp->ldsc + i; - if (lp->exptr == NULL && lp->conn) /* if the line is not extended but is connected */ - tmxr_disconnect_line (lp); /* then disconnect it */ + if (lp->conn /* if the line is connected */ + && (tmxr_is_extended == NULL /* and the line */ + || tmxr_is_extended (lp) == FALSE)) /* is not extended */ + tmxr_disconnect_line (lp); /* then disconnect it */ } /* end for */ sim_close_sock (mp->master); /* close master socket */ mp->master = 0; diff --git a/sim_tmxr.h b/sim_tmxr.h index c801d846..6918e877 100644 --- a/sim_tmxr.h +++ b/sim_tmxr.h @@ -26,6 +26,7 @@ Based on the original DZ11 simulator by Thord Nilson, as updated by Arthur Krewat. + 19-Dec-19 JDB Added tmxr_is_extended global hook 19-Mar-19 JDB Added extension pointer to TMLN structure; added tmxr_read, tmxr_write, tmxr_show, tmxr_close global hooks; added tmxr_find_ldsc, tmxr_send_buffered_data, tmxr_init_line, @@ -139,10 +140,11 @@ void tmxr_disconnect_line (TMLN *lp); /* Extension interface */ -extern int32 (*tmxr_read) (TMLN *lp, int32 length); -extern int32 (*tmxr_write) (TMLN *lp, int32 length); -extern void (*tmxr_show) (TMLN *lp, FILE *stream); -extern void (*tmxr_close) (TMLN *lp); +extern int32 (*tmxr_read) (TMLN *lp, int32 length); +extern int32 (*tmxr_write) (TMLN *lp, int32 length); +extern void (*tmxr_show) (TMLN *lp, FILE *stream); +extern void (*tmxr_close) (TMLN *lp); +extern t_bool (*tmxr_is_extended) (TMLN *lp); /* V4.X shims */