1
0
mirror of https://github.com/simh/simh.git synced 2026-04-27 20:38:04 +00:00

SCP, TMXR: new extensions to support HP simulators

This commit is contained in:
Bob Supnik
2020-03-14 07:20:10 -07:00
committed by Mark Pizzolato
parent e97675cc7a
commit 4ace512eea
4 changed files with 30 additions and 15 deletions

5
scp.c
View File

@@ -24,6 +24,7 @@
in this Software without prior written authorization from Robert M Supnik. in this Software without prior written authorization from Robert M Supnik.
13-Feb-20 RMS Spelled out CONTINUE in command table (Dave Bryan) 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 26-Oct-19 RMS Removed commented out MTAB_VAL code
09-Oct-19 JDB Corrected "sim_ref_type" use for RESTORE and DETACH ALL 09-Oct-19 JDB Corrected "sim_ref_type" use for RESTORE and DETACH ALL
19-Jul-19 JDB Added "sim_get_radix" extension hook 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; char *sim_vm_release;
void (*sub_args) (char *iptr, char *optr, int32 len, char *args []) = sub_args_local; 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; 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 */ /* Global data */
@@ -1632,6 +1634,7 @@ t_stat show_queue (FILE *st, DEVICE *dnotused, UNIT *unotused, int32 flag, char
DEVICE *dptr; DEVICE *dptr;
UNIT *uptr; UNIT *uptr;
int32 accum; int32 accum;
char *vptr;
if (cptr && (*cptr != 0)) if (cptr && (*cptr != 0))
return SCPE_2MARG; return SCPE_2MARG;
@@ -1646,6 +1649,8 @@ accum = 0;
for (uptr = sim_clock_queue; uptr != NULL; uptr = uptr->next) { for (uptr = sim_clock_queue; uptr != NULL; uptr = uptr->next) {
if (uptr == &sim_step_unit) if (uptr == &sim_step_unit)
fprintf (st, " Step timer"); 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) { else if ((dptr = find_dev_from_unit (uptr)) != NULL) {
fprintf (st, " %s", sim_dname (dptr)); fprintf (st, " %s", sim_dname (dptr));
if (dptr->numunits > 1) if (dptr->numunits > 1)

2
scp.h
View File

@@ -23,6 +23,7 @@
be used in advertising or otherwise to promote the sale, use or other dealings 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. 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 09-Oct-19 JDB Added "detach_all" global declaration
19-Jul-19 JDB Added "sim_get_radix" extension hook 19-Jul-19 JDB Added "sim_get_radix" extension hook
13-Apr-19 JDB Added extension hooks 13-Apr-19 JDB Added extension hooks
@@ -211,6 +212,7 @@ extern uint32 sim_ref_type; /* reference type */
extern char *sim_vm_release; extern char *sim_vm_release;
extern void (*sub_args) (char *iptr, char *optr, int32 len, char *args []); 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 int32 (*sim_get_radix) (const char *cptr, int32 switches, int32 default_radix);
extern char * (*sim_vm_unit_name) (const UNIT *uptr);
/* VM interface */ /* VM interface */

View File

@@ -26,6 +26,7 @@
Based on the original DZ11 simulator by Thord Nilson, as updated by Based on the original DZ11 simulator by Thord Nilson, as updated by
Arthur Krewat. 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 19-Mar-19 JDB Added tmxr_read, tmxr_write, tmxr_show, tmxr_close
global hooks and associated local hook routines; global hooks and associated local hook routines;
added tmxr_init_line, tmxr_report_connection, 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_show (TMLN *lp, FILE *stream);
static void tmxr_local_close (TMLN *lp); static void tmxr_local_close (TMLN *lp);
int32 (*tmxr_read) (TMLN *lp, int32 length) = tmxr_local_read; int32 (*tmxr_read) (TMLN *lp, int32 length) = tmxr_local_read;
int32 (*tmxr_write) (TMLN *lp, int32 length) = tmxr_local_write; int32 (*tmxr_write) (TMLN *lp, int32 length) = tmxr_local_write;
void (*tmxr_show) (TMLN *lp, FILE *stream) = tmxr_local_show; void (*tmxr_show) (TMLN *lp, FILE *stream) = tmxr_local_show;
void (*tmxr_close) (TMLN *lp) = tmxr_local_close; void (*tmxr_close) (TMLN *lp) = tmxr_local_close;
t_bool (*tmxr_is_extended) (TMLN *lp) = NULL;
/* Poll for new connection /* 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->rxbpi = lp->rxbpi + nbytes; /* adv pointers */
lp->rxcnt = lp->rxcnt + nbytes; lp->rxcnt = lp->rxcnt + nbytes;
if (lp->exptr != NULL) /* if the line is extended */ if (tmxr_is_extended != NULL /* if the line */
continue; /* then skip the Telnet processing */ && tmxr_is_extended (lp) == TRUE) /* is extended */
continue; /* then skip the Telnet processing */
memset (&lp->rbr[j], 0, nbytes); /* clear status */ 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 */ for (i = 0; i < mp->lines; i++) { /* initialize lines */
lp = mp->ldsc + i; lp = mp->ldsc + i;
if (lp->exptr == NULL) { /* if the line is not extended */ if (tmxr_is_extended == NULL /* if the line */
tmxr_init_line (lp); /* then initialize the line */ || tmxr_is_extended (lp) == FALSE) { /* is not extended */
lp->conn = 0; /* and clear the connection */ tmxr_init_line (lp); /* then initialize the line */
lp->conn = 0; /* and clear the connection */
} }
} }
return SCPE_OK; return SCPE_OK;
@@ -678,8 +682,10 @@ TMLN *lp;
for (i = 0; i < mp->lines; i++) { /* loop thru conn */ for (i = 0; i < mp->lines; i++) { /* loop thru conn */
lp = mp->ldsc + i; lp = mp->ldsc + i;
if (lp->exptr == NULL && lp->conn) /* if the line is not extended but is connected */ if (lp->conn /* if the line is connected */
tmxr_disconnect_line (lp); /* then disconnect it */ && (tmxr_is_extended == NULL /* and the line */
|| tmxr_is_extended (lp) == FALSE)) /* is not extended */
tmxr_disconnect_line (lp); /* then disconnect it */
} /* end for */ } /* end for */
sim_close_sock (mp->master); /* close master socket */ sim_close_sock (mp->master); /* close master socket */
mp->master = 0; mp->master = 0;

View File

@@ -26,6 +26,7 @@
Based on the original DZ11 simulator by Thord Nilson, as updated by Based on the original DZ11 simulator by Thord Nilson, as updated by
Arthur Krewat. Arthur Krewat.
19-Dec-19 JDB Added tmxr_is_extended global hook
19-Mar-19 JDB Added extension pointer to TMLN structure; 19-Mar-19 JDB Added extension pointer to TMLN structure;
added tmxr_read, tmxr_write, tmxr_show, tmxr_close global hooks; added tmxr_read, tmxr_write, tmxr_show, tmxr_close global hooks;
added tmxr_find_ldsc, tmxr_send_buffered_data, tmxr_init_line, added tmxr_find_ldsc, tmxr_send_buffered_data, tmxr_init_line,
@@ -139,10 +140,11 @@ void tmxr_disconnect_line (TMLN *lp);
/* Extension interface */ /* Extension interface */
extern int32 (*tmxr_read) (TMLN *lp, int32 length); extern int32 (*tmxr_read) (TMLN *lp, int32 length);
extern int32 (*tmxr_write) (TMLN *lp, int32 length); extern int32 (*tmxr_write) (TMLN *lp, int32 length);
extern void (*tmxr_show) (TMLN *lp, FILE *stream); extern void (*tmxr_show) (TMLN *lp, FILE *stream);
extern void (*tmxr_close) (TMLN *lp); extern void (*tmxr_close) (TMLN *lp);
extern t_bool (*tmxr_is_extended) (TMLN *lp);
/* V4.X shims */ /* V4.X shims */