1
0
mirror of https://github.com/simh/simh.git synced 2026-01-11 23:52:58 +00:00

Merge branch 'KDP' of http://github.com/tlhackque/simh into KDP

Conflicts:
	PDP11/pdp11_dmc.c
This commit is contained in:
Timothe Litt 2013-07-11 16:04:40 -04:00
commit e3b885505f
4 changed files with 849 additions and 1164 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,149 +0,0 @@
/* pdp11_dmc.h: DMC11 Emulation
------------------------------------------------------------------------------
Copyright (c) 2011, Robert M. A. Jarratt
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of the author shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from the author.
------------------------------------------------------------------------------
Modification history:
15-Jan-13 RJ Contribution from Paul Koning of support for RSTS using the ROM
INPUT (ROM I) command to get the DMC11 to report DSR status.
------------------------------------------------------------------------------*/
// Notes
// Base address needs to be 760060 according to DMC11 manual, but SYSGEN seems to think CSR is 0760100. However if I use
// 0760100 I get a conflict with the DZ because the first 13 bits are still 00100. If I use 760060 VMS sees the XM device, but
// if I remove the DZ to prevent the conflict VMS does not see an XM device, but I do get lots of reads and writes, possibly
// because it thinks it is a different device. What worries me more though is that there seems to be overlap in the 13-bit base
// addresses of the DZ and DMC.
#ifndef PDP11_DMC_H
#define PDP11_DMC_H
#if defined (VM_VAX) /* VAX version */
#include "vax_defs.h"
#elif defined(VM_PDP10)
#include "pdp10_defs.h"
#else /* PDP-11 version */
#include "pdp11_defs.h"
#endif
extern int32 IREQ (HLVL);
extern int32 tmxr_poll; /* calibrated delay */
extern int32 clk_tps; /* clock ticks per second */
extern int32 tmr_poll; /* instructions per tick */
#include "sim_sock.h"
#if !defined(DMC_NUMDEVICE)
#define DMC_NUMDEVICE 8 /* MAX # DMC-11 devices */
#endif
#if !defined(DMP_NUMDEVICE)
#define DMP_NUMDEVICE 8 /* MAX # DMP-11/DMV-11 devices */
#endif
#define DMC_RDX 8
/* debugging bitmaps */
#define DBG_TRC 0x0001 /* trace routine calls */
#define DBG_REG 0x0002 /* trace read/write registers */
#define DBG_WRN 0x0004 /* display warnings */
#define DBG_INF 0x0008 /* display informational messages (high level trace) */
#define DBG_DAT 0x0010 /* display data buffer contents */
#define DBG_DTS 0x0020 /* display data summary */
#define DBG_SOK 0x0040 /* display socket open/close */
#define DBG_CON 0x0080 /* display socket connection establishment */
#define TYPE_BACCI 0
#define TYPE_CNTLI 1
#define TYPE_BASEI 03
#define TYPE_BACCO 0
#define TYPE_CNTLO 1
#define TYPE_DMP_MODE 2
#define TYPE_DMP_CONTROL 1
#define TYPE_DMP_RECEIVE 0
#define TYPE_DMP_TRANSMIT 4
/* SEL0 */
#define DMC_TYPE_INPUT_MASK 0x0003
#define DMC_IN_IO_MASK 0x0004
#define DMP_IEO_MASK 0x0010
#define DMC_RQI_MASK 0x0020
#define DMP_RQI_MASK 0x0080
#define DMC_RDYI_MASK 0x0080
#define DMC_IEI_MASK 0x0040
#define DMP_IEI_MASK 0x0001
#define ROMI_MASK 0x0200
#define LU_LOOP_MASK 0x0800
#define MASTER_CLEAR_MASK 0x4000
#define RUN_MASK 0x8000
/* SEL2 */
#define DMP_IN_IO_MASK 0x0004
#define DMP_TYPE_INPUT_MASK 0x0007
#define TYPE_OUTPUT_MASK 0x0003
#define OUT_IO_MASK 0x0004
#define DMC_RDYO_MASK 0x0080
#define DMC_IEO_MASK 0x0040
#define DMP_RDYI_MASK 0x0010
/* BSEL6 */
#define LOST_DATA_MASK 0x0010
#define DISCONNECT_MASK 0x0040
#define DSPDSR 0x22b3 /* KMC opcode to move line unit status to SEL2 */
#define SEL0_RUN_BIT 15
#define SEL0_MCLR_BIT 14
#define SEL0_LU_LOOP_BIT 11
#define SEL0_ROMI_BIT 9
#define SEL0_RDI_BIT 7
#define SEL0_DMC_IEI_BIT 6
#define SEL0_DMP_IEI_BIT 0
#define SEL0_DMP_IEO_BIT 4
#define SEL0_DMC_RQI_BIT 5
#define SEL0_DMP_RQI_BIT 7
#define SEL0_IN_IO_BIT 2
#define SEL0_TYPEI_BIT 0
#define SEL2_TYPEO_BIT 0
#define SEL2_RDO_BIT 7
#define SEL2_IEO_BIT 6
#define SEL2_OUT_IO_BIT 2
#define SEL2_LINE_BIT 8
#define SEL2_LINE_BIT_LENGTH 6
#define SEL2_PRIO_BIT 14
#define SEL2_PRIO_BIT_LENGTH 2
#define SEL6_LOST_DATA_BIT 4
#define SEL6_DISCONNECT_BIT 6
#define BUFFER_QUEUE_SIZE 7
#endif /* _VAX_DMC_H */

View File

@ -68,9 +68,11 @@
tmxr_detach_ln - reset line and close per line listener and outgoing destination
tmxr_getc_ln - get character for line
tmxr_get_packet_ln - get packet from line
tmxr_get_packet_ln_ex - get packet from line with separater byte
tmxr_poll_rx - poll receive
tmxr_putc_ln - put character for line
tmxr_put_packet_ln - put packet on line
tmxr_put_packet_ln_ex - put packet on line with separator byte
tmxr_poll_tx - poll transmit
tmxr_send_buffered_data - transmit buffered data
tmxr_set_modem_control_passthru - enable modem control on a multiplexer
@ -1341,6 +1343,8 @@ return val;
*lp = pointer to terminal line descriptor
**pbuf = pointer to pointer of packet contents
*psize = pointer to packet size
frame_byte - byte which separates packets in the tcp stream
(0 means no separation character)
Output:
SCPE_LOST link state lost
@ -1356,28 +1360,34 @@ return val;
t_stat tmxr_get_packet_ln (TMLN *lp, const uint8 **pbuf, size_t *psize)
{
return tmxr_get_packet_ln_ex (lp, pbuf, psize, 0);
}
t_stat tmxr_get_packet_ln_ex (TMLN *lp, const uint8 **pbuf, size_t *psize, uint8 frame_byte)
{
int32 c;
size_t pktsize;
size_t fc_size = (frame_byte ? 1 : 0);
while (TMXR_VALID & (c = tmxr_getc_ln (lp))) {
if (lp->rxpboffset + 1 > lp->rxpbsize) {
lp->rxpbsize += 512;
lp->rxpb = (uint8 *)realloc (lp->rxpb, lp->rxpbsize);
}
lp->rxpb[lp->rxpboffset] = c;
if ((lp->rxpboffset == 0) && (c != 0x1E)) {
tmxr_debug (TMXR_DBG_PRCV, lp, "Received Unexpected Byte", (char *)&lp->rxpb[lp->rxpboffset], 1);
if ((lp->rxpboffset == 0) && (fc_size) && (c != frame_byte)) {
tmxr_debug (TMXR_DBG_PRCV, lp, "Received Unexpected Framing Byte", (char *)&lp->rxpb[lp->rxpboffset], 1);
continue;
}
lp->rxpb[lp->rxpboffset] = c & 0xFF;
lp->rxpboffset += 1;
if (lp->rxpboffset >= 3) {
pktsize = (lp->rxpb[1] << 8) | lp->rxpb[2];
if (lp->rxpboffset >= (2 + fc_size)) {
pktsize = (lp->rxpb[0+fc_size] << 8) | lp->rxpb[1+fc_size];
if (pktsize == (lp->rxpboffset - 2)) {
++lp->rxpcnt;
*pbuf = &lp->rxpb[3];
*pbuf = &lp->rxpb[2+fc_size];
*psize = pktsize;
lp->rxpboffset = 0;
tmxr_debug (TMXR_DBG_PRCV, lp, "Received Packet", (char *)&lp->rxpb[3], pktsize);
tmxr_debug (TMXR_DBG_PRCV, lp, "Received Packet", (char *)&lp->rxpb[2+fc_size], pktsize);
return SCPE_OK;
}
}
@ -1600,6 +1610,7 @@ return SCPE_STALL; /* char not sent */
*lp = pointer to line descriptor
*buf = pointer to packet data
size = size of packet
frame_char = inter-packet franing character (0 means no frame character)
Outputs:
status = ok, connection lost, or stall
@ -1612,7 +1623,13 @@ return SCPE_STALL; /* char not sent */
*/
t_stat tmxr_put_packet_ln (TMLN *lp, const uint8 *buf, size_t size)
{
return tmxr_put_packet_ln_ex (lp, buf, size, 0);
}
t_stat tmxr_put_packet_ln_ex (TMLN *lp, const uint8 *buf, size_t size, uint8 frame_byte)
{
t_stat r;
size_t fc_size = (frame_byte ? 1 : 0);
if (!lp->conn)
return SCPE_LOST;
@ -1620,17 +1637,17 @@ if (lp->txppoffset < lp->txppsize) {
tmxr_debug (TMXR_DBG_PXMT, lp, "Skipped Sending Packet - Transmit Busy", (char *)&lp->txpb[3], size);
return SCPE_STALL;
}
if (lp->txpbsize < size + 3) {
lp->txpbsize = size + 3;
if (lp->txpbsize < size + 2 + fc_size) {
lp->txpbsize = size + 2 + fc_size;
lp->txpb = (uint8 *)realloc (lp->txpb, lp->txpbsize);
}
lp->txpb[0] = 0x1E; /* Record Separator to Frame packet */
lp->txpb[1] = (size >> 8) & 0xFF;
lp->txpb[2] = size & 0xFF;
memcpy (lp->txpb + 3, buf, size);
lp->txppsize = size + 3;
lp->txpb[0] = frame_byte;
lp->txpb[0+fc_size] = (size >> 8) & 0xFF;
lp->txpb[1+fc_size] = size & 0xFF;
memcpy (lp->txpb + 2 + fc_size, buf, size);
lp->txppsize = size + 2 + fc_size;
lp->txppoffset = 0;
tmxr_debug (TMXR_DBG_PXMT, lp, "Sending Packet", (char *)&lp->txpb[3], size);
tmxr_debug (TMXR_DBG_PXMT, lp, "Sending Packet", (char *)&lp->txpb[2+fc_size], size);
++lp->txpcnt;
while ((lp->txppoffset < lp->txppsize) &&
(SCPE_OK == (r = tmxr_putc_ln (lp, lp->txpb[lp->txppoffset]))))
@ -4000,7 +4017,7 @@ if ((lp->mp->dptr) && (dbits & lp->mp->dptr->dctrl)) {
if (tmxr_debug_buf)
tmxr_debug_buf[tmxr_debug_buf_used] = '\0';
if (!lp->notelnet) {
if (lp->notelnet) {
int same, group, sidx, oidx;
char outbuf[80], strbuf[18];
static char hex[] = "0123456789ABCDEF";

View File

@ -168,9 +168,11 @@ t_stat tmxr_reset_ln (TMLN *lp);
t_stat tmxr_detach_ln (TMLN *lp);
int32 tmxr_getc_ln (TMLN *lp);
t_stat tmxr_get_packet_ln (TMLN *lp, const uint8 **pbuf, size_t *psize);
t_stat tmxr_get_packet_ln_ex (TMLN *lp, const uint8 **pbuf, size_t *psize, uint8 frame_byte);
void tmxr_poll_rx (TMXR *mp);
t_stat tmxr_putc_ln (TMLN *lp, int32 chr);
t_stat tmxr_put_packet_ln (TMLN *lp, const uint8 *buf, size_t size);
t_stat tmxr_put_packet_ln_ex (TMLN *lp, const uint8 *buf, size_t size, uint8 frame_byte);
void tmxr_poll_tx (TMXR *mp);
int32 tmxr_send_buffered_data (TMLN *lp);
t_stat tmxr_open_master (TMXR *mp, char *cptr);