1
0
mirror of https://github.com/simh/simh.git synced 2026-02-27 01:00:07 +00:00

SCP: Add minor extensions for better compatibility with 4.x (Dave Bryan)

This commit is contained in:
Mark Pizzolato
2017-05-24 09:00:23 -07:00
parent f03e1fe9b0
commit 2f7af39d0b
4 changed files with 128 additions and 5 deletions

11
scp.c
View File

@@ -38,6 +38,7 @@
24-Feb-13 JDB Added REG_VMAD check in fprint_stopped_gen for VM address call
Added SIM_SW_STOP to examine call in fprint_stopped_gen
05-Feb-13 JDB Added sim_vm_fprint_stopped for VM-specific stop messages
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 <x> SHOW" commands
06-Jan-12 JDB Fixed "SHOW DEVICE" with only one enabled unit (Dave Bryan)
@@ -3051,8 +3052,9 @@ if (!(flag & EX_E))
GET_RADIX (rdx, rptr->radix);
if ((rptr->flags & REG_VMAD) && sim_vm_fprint_addr)
sim_vm_fprint_addr (ofile, sim_dflt_dev, (t_addr) val);
else if (!(rptr->flags & REG_VMIO) ||
(fprint_sym (ofile, rdx, &val, NULL, sim_switches | SIM_SW_REG) > 0))
else if (!(rptr->flags & REG_VMFLAGS) ||
(fprint_sym (ofile, (rptr->flags & REG_UFMASK) | rdx, &val,
NULL, sim_switches | SIM_SW_REG) > 0))
fprint_val (ofile, val, rdx, rptr->width, rptr->flags & REG_FMT);
if (flag & EX_I)
fprintf (ofile, "\t");
@@ -3145,8 +3147,9 @@ if ((rptr->flags & REG_VMAD) && sim_vm_parse_addr) { /* address form? */
if ((tptr == cptr) || (*tptr != 0) || (val > mask))
return SCPE_ARG;
}
else if (!(rptr->flags & REG_VMIO) || /* dont use sym? */
(parse_sym (cptr, rdx, NULL, &val, sim_switches | SIM_SW_REG) > SCPE_OK)) {
else if (!(rptr->flags & REG_VMFLAGS) || /* dont use sym? */
(parse_sym (cptr, (rptr->flags & REG_UFMASK) | rdx, NULL,
&val, sim_switches | SIM_SW_REG) > SCPE_OK)) {
val = get_uint (cptr, rdx, mask, &r);
if (r != SCPE_OK)
return SCPE_ARG;

View File

@@ -25,9 +25,11 @@
25-Sep-16 RMS Removed KBD_WAIT and friends
08-Mar-16 RMS Added shutdown invisible switch
03-Feb-16 JDB [4.0] Added "help_base" and "message" fields to sim_ctab
24-Dec-14 JDB Added T_ADDR_FMT
14-Dec-14 JDB Extended sim_device for compatibility
04-Nov-14 JDB Added UNIT.dynflags field for tape density support
05-Feb-13 JDB Added REG_V_UF and REG_UFMASK for VM-specific register flags
21-Jul-08 RMS Removed inlining support
28-May-08 RMS Added inlining support
28-Jun-07 RMS Added IA64 VMS support (from Norm Lastovica)
@@ -425,6 +427,8 @@ struct sim_reg {
uint32 qptr; /* circ q ptr */
};
/* Register flags */
#define REG_FMT 00003 /* see PV_x */
#define REG_RO 00004 /* read only */
#define REG_HIDDEN 00010 /* hidden */
@@ -436,6 +440,10 @@ struct sim_reg {
#define REG_FIT 01000 /* fit access to size */
#define REG_HRO (REG_RO | REG_HIDDEN) /* hidden, read only */
#define REG_V_UF 16 /* device specific */
#define REG_UFMASK (~((1u << REG_V_UF) - 1)) /* user flags mask */
#define REG_VMFLAGS (REG_VMIO | REG_UFMASK) /* call VM routine if any of these are set */
/* Command tables, base and alternate formats */
struct sim_ctab {
@@ -444,6 +452,9 @@ struct sim_ctab {
/* action routine */
int32 arg; /* argument */
char *help; /* help string */
const char *help_base; /* [4.0] structured help base*/
void (*message)(const char *unechoed_cmdline, t_stat stat);
/* [4.0] message printing routine */
};
struct sim_c1tab {
@@ -601,4 +612,19 @@ typedef struct sim_debtab DEBTAB;
#define INT64_C(x) (x)
/* SCP API shim.
The SCP API for version 4.0 introduces a number of "pointer-to-const"
parameter qualifiers that were not present in the 3.x versions. To maintain
compatibility with the earlier versions, the new qualifiers are expressed as
"CONST" rather than "const". This allows macro removal of the qualifiers
when compiling for SIMH 3.x.
*/
#include "sim_sock.h"
#ifdef CONST
#undef CONST
#define CONST
#endif /* CONST */
#endif

View File

@@ -26,6 +26,7 @@
Based on the original DZ11 simulator by Thord Nilson, as updated by
Arthur Krewat.
06-Aug-15 JDB [4.0] Added modem control functions
28-Mar-15 RMS Revised to use sim_printf
16-Jan-11 MP Made option negotiation more reliable
20-Nov-08 RMS Added three new standardized SHOW routines
@@ -61,6 +62,8 @@
tmxr_poll_rx - poll receive
tmxr_putc_ln - put character for line
tmxr_poll_tx - poll transmit
tmxr_set_modem_control_passthru - enable modem control on a multiplexer
tmxr_set_get_modem_bits - set and/or get a line modem bits
tmxr_open_master - open master connection
tmxr_close_master - close master connection
tmxr_attach - attach terminal multiplexor
@@ -238,6 +241,83 @@ lp->dstb = 0;
return;
}
/* Enable modem control pass thru
Inputs:
none
Output:
none
Implementation note:
1 Calling this API disables any actions on the part of this
library to directly manipulate DTR (&RTS) on serial ports.
2 Calling this API enables the tmxr_set_get_modem_bits and
tmxr_set_config_line APIs.
*/
static t_stat tmxr_clear_modem_control_passthru_state (TMXR *mp, t_bool state)
{
if (mp->master)
return SCPE_ALATT;
else
return SCPE_OK;
}
t_stat tmxr_set_modem_control_passthru (TMXR *mp)
{
return tmxr_clear_modem_control_passthru_state (mp, TRUE);
}
/* Manipulate the modem control bits of a specific line
Inputs:
*lp = pointer to terminal line descriptor
bits_to_set TMXR_MDM_DTR and/or TMXR_MDM_RTS as desired
bits_to_clear TMXR_MDM_DTR and/or TMXR_MDM_RTS as desired
Output:
incoming_bits if non NULL, returns the current stat of DCD,
RNG, CTS and DSR along with the current state
of DTR and RTS
Implementation note:
If a line is connected to a serial port, then these values affect
and reflect the state of the serial port. If the line is connected
to a network socket (or could be) then the network session state is
set, cleared and/or returned.
*/
t_stat tmxr_set_get_modem_bits (TMLN *lp, int32 bits_to_set, int32 bits_to_clear, int32 *incoming_bits)
{
int32 incoming_state;
if ((bits_to_set & ~(TMXR_MDM_OUTGOING)) || /* Assure only settable bits */
(bits_to_clear & ~(TMXR_MDM_OUTGOING)) ||
(bits_to_set & bits_to_clear)) /* and can't set and clear the same bits */
return SCPE_ARG;
if (lp->conn)
incoming_state = TMXR_MDM_DCD | TMXR_MDM_DSR;
else
incoming_state = 0;
if (incoming_bits)
*incoming_bits = incoming_state;
if (lp->conn && (bits_to_clear & TMXR_MDM_DTR)) { /* drop DTR? */
tmxr_linemsg (lp, "\r\nDisconnected from the ");
tmxr_linemsg (lp, sim_name);
tmxr_linemsg (lp, " simulator\r\n\n");
tmxr_reset_ln (lp);
}
return SCPE_OK;
}
/* Get character from specific line
Inputs:

View File

@@ -1,6 +1,6 @@
/* sim_tmxr.h: terminal multiplexor definitions
Copyright (c) 2001-2014, Robert M Supnik
Copyright (c) 2001-2015, 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"),
@@ -26,6 +26,7 @@
Based on the original DZ11 simulator by Thord Nilson, as updated by
Arthur Krewat.
06-Aug-15 JDB [4.0] Added modem control bits and functions
14-Dec-14 JDB [4.0] Added include of "sim_sock.h" for SOCKET, etc.
20-Nov-08 RMS Added three new standardized SHOW routines
27-May-08 JDB Added lnorder to TMXR structure,
@@ -51,6 +52,17 @@
#define TMXR_MAXBUF 256 /* buffer size */
#define TMXR_GUARD 12 /* buffer guard */
/* Modem Control Bits */
#define TMXR_MDM_DTR 0x01 /* Data Terminal Ready */
#define TMXR_MDM_RTS 0x02 /* Request To Send */
#define TMXR_MDM_DCD 0x04 /* Data Carrier Detect */
#define TMXR_MDM_RNG 0x08 /* Ring Indicator */
#define TMXR_MDM_CTS 0x10 /* Clear To Send */
#define TMXR_MDM_DSR 0x20 /* Data Set Ready */
#define TMXR_MDM_INCOMING (TMXR_MDM_DCD|TMXR_MDM_RNG|TMXR_MDM_CTS|TMXR_MDM_DSR) /* Settable Modem Bits */
#define TMXR_MDM_OUTGOING (TMXR_MDM_DTR|TMXR_MDM_RTS) /* Settable Modem Bits */
struct tmln {
SOCKET conn; /* line conn */
uint32 ipad; /* IP address */
@@ -95,6 +107,8 @@ t_stat tmxr_open_master (TMXR *mp, char *cptr);
t_stat tmxr_close_master (TMXR *mp);
t_stat tmxr_attach (TMXR *mp, UNIT *uptr, char *cptr);
t_stat tmxr_detach (TMXR *mp, UNIT *uptr);
t_stat tmxr_set_modem_control_passthru (TMXR *mp);
t_stat tmxr_set_get_modem_bits (TMLN *lp, int32 bits_to_set, int32 bits_to_clear, int32 *incoming_bits);
t_stat tmxr_ex (t_value *vptr, t_addr addr, UNIT *uptr, int32 sw);
t_stat tmxr_dep (t_value val, t_addr addr, UNIT *uptr, int32 sw);
void tmxr_msg (SOCKET sock, char *msg);