1
0
mirror of https://github.com/rcornwell/sims.git synced 2026-01-21 18:15:04 +00:00

KA10: Fixed up WAITS support so it will now boot.

This commit is contained in:
Richard Cornwell 2019-06-20 23:51:40 -04:00
parent 0b6718d429
commit 6c25bc60d8
5 changed files with 198 additions and 204 deletions

View File

@ -2261,7 +2261,7 @@ int Mem_write_waits(int flag, int cur_context) {
}
if (xct_flag & 010 && cur_context) /* Indirect */
uf = 1;
if (xct_flag & 001 && BYF5) /* XW or XLB or XDB */
if (xct_flag & 001) /* XW or XLB or XDB */
uf = 1;
if (uf)
M[AB + Rl] = MB;
@ -2889,7 +2889,7 @@ unasign:
}
#endif
AB = 040;
if (maoff && (IR & 0140) == 040)
if (maoff && uuo_cycle)
AB |= maoff;
Mem_write(uuo_cycle, 1);
AB += 1;

View File

@ -375,7 +375,7 @@ extern DEVICE dct_dev; /* PDP6 devices. */
extern DEVICE dtc_dev;
extern DEVICE mtc_dev;
extern DEVICE dsk_dev;
extern DEVICE t630_dev;
extern DEVICE dcs_dev;
extern t_stat (*dev_tab[128])(uint32 dev, t_uint64 *data);
@ -443,7 +443,6 @@ int auxcpu_write (int addr, t_uint64);
#define NUM_DEVS_PT 1
#define NUM_DEVS_CR 1
#define NUM_DEVS_CP 1
#define NUM_DEVS_DC 1
#define NUM_DEVS_DPY USE_DISPLAY
#define NUM_DEVS_WCNSLS USE_DISPLAY
#if PDP6_DEV
@ -451,9 +450,10 @@ int auxcpu_write (int addr, t_uint64);
#define NUM_DEVS_DCT 2
#define NUM_DEVS_MTC 1
#define NUM_DEVS_DSK 1
#define NUM_DEVS_T630 1
#define NUM_DEVS_DCS 1
#endif
#if !PDP6
#define NUM_DEVS_DC 1
#define NUM_DEVS_MT 1
#define NUM_DEVS_RC 1
#define NUM_DEVS_DT 1

View File

@ -493,25 +493,6 @@ pmp_devio(uint32 dev, uint64 *data) {
}
if (*data & STS_CLR) /* Clear status bits */
pmp_status &= ~STS_MASK;
if (*data & NSTS_CLR) { /* Clear new status */
pmp_status &= ~NEW_STS;
if ((pmp_statusb & OP1) == 0) { /* Check if any device requesting attn */
pmp_cur_unit = NULL;
for (i = 0; i < NUM_UNITS_PMP; i++) {
if ((pmp_dev.units[i].CMD & DK_ATTN) != 0) {
pmp_cur_unit = &pmp_dev.units[i];
pmp_status |= NEW_STS|DEV_END;
pmp_dev.units[i].CMD &= ~DK_ATTN;
break;
}
}
if (pmp_cur_unit == NULL) {
pmp_statusb &= ~REQ_CH;
if (pmp_statusb & CMD_LD)
pmp_startcmd();
}
}
}
if (*data & CLR_DATCH) /* Data chaining */
pmp_cmd &= ~DATCH_ON;
if (*data & CMD_CLR) /* Clear pending command */
@ -521,6 +502,24 @@ pmp_devio(uint32 dev, uint64 *data) {
}
if (*data & (CLR_UEND|CLR_IRQ)) /* Clear unusual end condtions */
pmp_status &= ~(UNU_END|NEW_STS|STS_MASK);
if (*data & NSTS_CLR) { /* Clear new status */
pmp_status &= ~NEW_STS;
if ((pmp_statusb & OP1) == 0) { /* Check if any device requesting attn */
for (i = 0; i < NUM_UNITS_PMP; i++) {
if ((pmp_dev.units[i].CMD & DK_ATTN) != 0) {
pmp_cur_unit = &pmp_dev.units[i];
pmp_status |= NEW_STS|DEV_END;
pmp_dev.units[i].CMD &= ~DK_ATTN;
break;
}
}
if ((pmp_statusb & NEW_STS) == 0) {
pmp_statusb &= ~REQ_CH;
if (pmp_statusb & CMD_LD)
pmp_startcmd();
}
}
}
(void)pmp_checkirq();
break;
@ -592,7 +591,7 @@ chan_read_byte(uint8 *data) {
return 1;
}
/* Check if finished transfer */
if (pmp_cnt == BUFF_CHNEND)
if (pmp_cnt & BUFF_CHNEND)
return 1;
load:
@ -604,25 +603,20 @@ load:
pmp_data = M[pmp_addr];
sim_debug(DEBUG_DETAIL, &pmp_dev, "chan_read %06o %012llo\n", pmp_addr, pmp_data);
pmp_addr++;
pmp_cnt = 0;
xfer = 1; /* Read in a word */
}
/* Handle word vs byte mode */
if (pmp_cmd & BYTE_MODE) {
if (pmp_cnt & BUFF_CHNEND)
goto next;
byte = (pmp_data >> 4 + (8 * (3 - (pmp_cnt & 0x3)))) & 0xff;
pmp_cnt = 07 & (pmp_cnt + 1);
pmp_cnt++;
*data = byte;
if ((pmp_cnt & 03) == 0)
pmp_cnt |= BUFF_EMPTY;
pmp_cnt = BUFF_EMPTY;
} else {
if ((pmp_cnt & 0xf) > 0x3) {
if ((pmp_cnt & 0xf) == 0x4) { /* Split byte */
byte = (pmp_data << 4) & 0xf0;
if (pmp_cnt & BUFF_CHNEND) {
*data = byte;
goto next;
}
if (pmp_addr >= (int)MEMSIZE)
return pmp_posterror(NXM_ERR);
pmp_data = M[pmp_addr];
@ -636,12 +630,9 @@ load:
} else {
byte = (pmp_data >> 4 + (8 * (3 - (pmp_cnt & 0xf)))) & 0xff;
}
pmp_cnt =(pmp_cnt + 1);
if ((pmp_cnt & 0xf) == 9) {
pmp_cnt++;
if ((pmp_cnt & 0xf) == 9)
pmp_cnt = BUFF_EMPTY;
if (pmp_cnt & BUFF_CHNEND)
goto next;
}
}
*data = byte;
if (pmp_cmd & CNT_BYT) {
@ -959,6 +950,9 @@ pmp_startcmd() {
if (cmd == 0x3 || cmd == DK_RELEASE) {
pmp_status &= ~(STS_MASK);
pmp_status |= NEW_STS|CHN_END|DEV_END;
if ((pmp_cmd & CMDCH_ON) == 0)
/* Indicate that device is done */
pmp_statusb &= ~OP1;
(void)pmp_checkirq();
return;
}
@ -1385,12 +1379,12 @@ sense_end:
if (uptr->CMD & DK_PARAM) {
if ((uptr->POS >> 8) == data->cyl) {
uptr->LASTCMD = cmd;
uptr->CMD &= ~(0xff);
uptr->CMD &= ~(0xff|DK_PARAM);
// uptr->CMD |= DK_ATTN;
// pmp_statusb |= REQ_CH;
chan_end(SNS_DEVEND|SNS_CHNEND);
sim_debug(DEBUG_DETAIL, dptr, "seek end unit=%d %d %d %x\n", unit,
uptr->POS >> 8, data->cyl, data->state);
chan_end(SNS_DEVEND|SNS_CHNEND);
}
break;
}

View File

@ -141,8 +141,8 @@ DEVICE *sim_devices[] = {
#if (NUM_DEVS_DC > 0)
&dc_dev,
#endif
#if (NUM_DEVS_T630 > 0)
&t630_dev,
#if (NUM_DEVS_DCS > 0)
&dcs_dev,
#endif
#if (NUM_DEVS_DK > 0)
&dk_dev,
@ -247,13 +247,15 @@ t_stat load_dmp (FILE *fileref)
while (fgets((char *)buffer, 80, fileref) != 0) {
p = (char *)buffer;
if (*p >= '0' && *p <= '7') {
while (*p >= '0' && *p <= '7') {
data = 0;
while (*p >= '0' && *p <= '7') {
data = (data << 3) + *p - '0';
p++;
}
M[addr++] = data;
if (*p == ' ' || *p == '\t')
p++;
}
}
return SCPE_OK;

View File

@ -29,15 +29,15 @@
#include "sim_sock.h"
#include "sim_tmxr.h"
#ifndef NUM_DEVS_T630
#define NUM_DEVS_T630 0
#ifndef NUM_DEVS_DCS
#define NUM_DEVS_DCS 0
#endif
#if (NUM_DEVS_T630 > 0)
#if (NUM_DEVS_DCS > 0)
#define T630_DEVNUM 0300
#define DCS_DEVNUM 0300
#define T630_LINES 16
#define DCS_LINES 16
#define STATUS u3
@ -54,86 +54,86 @@
#define LINE 0000077 /* Line number in Left */
int t630_rx_scan = 0; /* Scan counter */
int t630_tx_scan = 0; /* Scan counter */
int t630_send_line = 0; /* Send line number */
TMLN t630_ldsc[T630_LINES] = { 0 }; /* Line descriptors */
TMXR t630_desc = { T630_LINES, 0, 0, t630_ldsc };
uint32 t630_tx_enable, t630_rx_rdy; /* Flags */
uint32 t630_enable; /* Enable line */
uint32 t630_rx_conn; /* Connection flags */
int dcs_rx_scan = 0; /* Scan counter */
int dcs_tx_scan = 0; /* Scan counter */
int dcs_send_line = 0; /* Send line number */
TMLN dcs_ldsc[DCS_LINES] = { 0 }; /* Line descriptors */
TMXR dcs_desc = { DCS_LINES, 0, 0, dcs_ldsc };
uint32 dcs_tx_enable, dcs_rx_rdy; /* Flags */
uint32 dcs_enable; /* Enable line */
uint32 dcs_rx_conn; /* Connection flags */
extern int32 tmxr_poll;
t_stat t630_devio(uint32 dev, uint64 *data);
t_stat t630_svc (UNIT *uptr);
t_stat t630_doscan (UNIT *uptr);
t_stat t630_reset (DEVICE *dptr);
t_stat t630_setnl (UNIT *uptr, int32 val, CONST char *cptr, void *desc);
t_stat t630_set_log (UNIT *uptr, int32 val, CONST char *cptr, void *desc);
t_stat t630_set_nolog (UNIT *uptr, int32 val, CONST char *cptr, void *desc);
t_stat t630_show_log (FILE *st, UNIT *uptr, int32 val, CONST void *desc);
t_stat t630_attach (UNIT *uptr, CONST char *cptr);
t_stat t630_detach (UNIT *uptr);
t_stat t630_help (FILE *st, DEVICE *dptr, UNIT *uptr, int32 flag,
t_stat dcs_devio(uint32 dev, uint64 *data);
t_stat dcs_svc (UNIT *uptr);
t_stat dcs_doscan (UNIT *uptr);
t_stat dcs_reset (DEVICE *dptr);
t_stat dcs_setnl (UNIT *uptr, int32 val, CONST char *cptr, void *desc);
t_stat dcs_set_log (UNIT *uptr, int32 val, CONST char *cptr, void *desc);
t_stat dcs_set_nolog (UNIT *uptr, int32 val, CONST char *cptr, void *desc);
t_stat dcs_show_log (FILE *st, UNIT *uptr, int32 val, CONST void *desc);
t_stat dcs_attach (UNIT *uptr, CONST char *cptr);
t_stat dcs_detach (UNIT *uptr);
t_stat dcs_help (FILE *st, DEVICE *dptr, UNIT *uptr, int32 flag,
const char *cptr);
const char *t630_description (DEVICE *dptr);
const char *dcs_description (DEVICE *dptr);
/* Type 630 data structures
t630_dev Type 630 device descriptor
t630_unit Type 630 unit descriptor
t630_reg Type 630 register list
dcs_dev Type 630 device descriptor
dcs_unit Type 630 unit descriptor
dcs_reg Type 630 register list
*/
DIB t630_dib = { T630_DEVNUM, 2, &t630_devio, NULL };
DIB dcs_dib = { DCS_DEVNUM, 2, &dcs_devio, NULL };
UNIT t630_unit = {
UDATA (&t630_svc, TT_MODE_7B+UNIT_IDLE+UNIT_ATTABLE, 0), KBD_POLL_WAIT
UNIT dcs_unit = {
UDATA (&dcs_svc, TT_MODE_7B+UNIT_IDLE+UNIT_ATTABLE, 0), KBD_POLL_WAIT
};
REG t630_reg[] = {
{ DRDATA (TIME, t630_unit.wait, 24), REG_NZ + PV_LEFT },
{ DRDATA (STATUS, t630_unit.STATUS, 18), PV_LEFT },
REG dcs_reg[] = {
{ DRDATA (TIME, dcs_unit.wait, 24), REG_NZ + PV_LEFT },
{ DRDATA (STATUS, dcs_unit.STATUS, 18), PV_LEFT },
{ NULL }
};
MTAB t630_mod[] = {
MTAB dcs_mod[] = {
{ TT_MODE, TT_MODE_KSR, "KSR", "KSR", NULL },
{ TT_MODE, TT_MODE_7B, "7b", "7B", NULL },
{ TT_MODE, TT_MODE_8B, "8b", "8B", NULL },
{ TT_MODE, TT_MODE_7P, "7p", "7P", NULL },
{ MTAB_XTD|MTAB_VDV|MTAB_VALR, 1, NULL, "DISCONNECT",
&tmxr_dscln, NULL, &t630_desc, "Disconnect a specific line" },
&tmxr_dscln, NULL, &dcs_desc, "Disconnect a specific line" },
{ UNIT_ATT, UNIT_ATT, "SUMMARY", NULL,
NULL, &tmxr_show_summ, (void *) &t630_desc, "Display a summary of line states" },
NULL, &tmxr_show_summ, (void *) &dcs_desc, "Display a summary of line states" },
{ MTAB_XTD|MTAB_VDV|MTAB_NMO, 1, "CONNECTIONS", NULL,
NULL, &tmxr_show_cstat, (void *) &t630_desc, "Display current connections" },
NULL, &tmxr_show_cstat, (void *) &dcs_desc, "Display current connections" },
{ MTAB_XTD|MTAB_VDV|MTAB_NMO, 0, "STATISTICS", NULL,
NULL, &tmxr_show_cstat, (void *) &t630_desc, "Display multiplexer statistics" },
NULL, &tmxr_show_cstat, (void *) &dcs_desc, "Display multiplexer statistics" },
{ MTAB_XTD|MTAB_VDV|MTAB_VALR, 0, "LINES", "LINES=n",
&t630_setnl, &tmxr_show_lines, (void *) &t630_desc, "Set number of lines" },
&dcs_setnl, &tmxr_show_lines, (void *) &dcs_desc, "Set number of lines" },
{ MTAB_XTD|MTAB_VDV|MTAB_NC, 0, NULL, "LOG=n=file",
&t630_set_log, NULL, (void *)&t630_desc },
&dcs_set_log, NULL, (void *)&dcs_desc },
{ MTAB_XTD|MTAB_VDV|MTAB_VALR, 0, NULL, "NOLOG",
&t630_set_nolog, NULL, (void *)&t630_desc, "Disable logging on designated line" },
&dcs_set_nolog, NULL, (void *)&dcs_desc, "Disable logging on designated line" },
{ MTAB_XTD|MTAB_VDV|MTAB_NMO, 0, "LOG", NULL,
NULL, &t630_show_log, (void *)&t630_desc, "Display logging for all lines" },
NULL, &dcs_show_log, (void *)&dcs_desc, "Display logging for all lines" },
{ 0 }
};
DEVICE t630_dev = {
"DCS", &t630_unit, t630_reg, t630_mod,
DEVICE dcs_dev = {
"DCS", &dcs_unit, dcs_reg, dcs_mod,
1, 10, 31, 1, 8, 8,
&tmxr_ex, &tmxr_dep, &t630_reset,
NULL, &t630_attach, &t630_detach,
&t630_dib, DEV_NET | DEV_DISABLE | DEV_DEBUG, 0, dev_debug,
NULL, NULL, &t630_help, NULL, NULL, &t630_description
&tmxr_ex, &tmxr_dep, &dcs_reset,
NULL, &dcs_attach, &dcs_detach,
&dcs_dib, DEV_NET | DEV_DISABLE | DEV_DEBUG, 0, dev_debug,
NULL, NULL, &dcs_help, NULL, NULL, &dcs_description
};
/* IOT routine */
t_stat t630_devio(uint32 dev, uint64 *data) {
UNIT *uptr = &t630_unit;
t_stat dcs_devio(uint32 dev, uint64 *data) {
UNIT *uptr = &dcs_unit;
TMLN *lp;
int ln;
@ -141,13 +141,13 @@ t_stat t630_devio(uint32 dev, uint64 *data) {
case CONI:
/* Check if we might have any interrupts pending */
if ((uptr->STATUS & (RSCN_ACT|XSCN_ACT)) != 0)
t630_doscan(uptr);
dcs_doscan(uptr);
*data = uptr->STATUS & (RPI_CHN|TPI_CHN);
if ((uptr->STATUS & (RSCN_ACT)) == 0)
*data |= 010LL;
if ((uptr->STATUS & (XSCN_ACT)) == 0)
*data |= 01000LL;
sim_debug(DEBUG_CONI, &t630_dev, "T630 %03o CONI %06o PC=%o\n",
sim_debug(DEBUG_CONI, &dcs_dev, "DCS %03o CONI %06o PC=%o\n",
dev, (uint32)*data, PC);
break;
@ -156,75 +156,77 @@ t_stat t630_devio(uint32 dev, uint64 *data) {
uptr->STATUS &= ~(RPI_CHN|TPI_CHN);
uptr->STATUS |= (RPI_CHN|TPI_CHN) & *data;
if (*data & RST_SCN)
t630_rx_scan = 0;
dcs_rx_scan = 0;
if ((*data & (RLS_SCN|RST_SCN)) != 0)
uptr->STATUS |= RSCN_ACT;
if ((*data & (XSCN_ACT)) != 0)
if ((*data & (XMT_RLS)) != 0) {
uptr->STATUS |= XSCN_ACT;
dcs_tx_enable &= ~(1 << dcs_tx_scan);
}
sim_debug(DEBUG_CONO, &t630_dev, "T630 %03o CONO %06o PC=%06o\n",
sim_debug(DEBUG_CONO, &dcs_dev, "DCS %03o CONO %06o PC=%06o\n",
dev, (uint32)*data, PC);
t630_doscan(uptr);
dcs_doscan(uptr);
break;
case DATAO:
case DATAO|4:
ln = (dev & 4) ? t630_send_line : t630_tx_scan;
if (ln < t630_desc.lines) {
lp = &t630_ldsc[ln];
ln = (dev & 4) ? dcs_send_line : dcs_tx_scan;
if (ln < dcs_desc.lines) {
lp = &dcs_ldsc[ln];
if (lp->conn) {
int32 ch = *data & DATA;
ch = sim_tt_outcvt(ch, TT_GET_MODE (t630_unit.flags) | TTUF_KSR);
ch = sim_tt_outcvt(ch, TT_GET_MODE (dcs_unit.flags) | TTUF_KSR);
tmxr_putc_ln (lp, ch);
t630_tx_enable |= (1 << ln);
dcs_tx_enable |= (1 << ln);
}
}
if (dev & 4) {
uptr->STATUS |= XSCN_ACT;
t630_doscan(uptr);
dcs_doscan(uptr);
}
sim_debug(DEBUG_DATAIO, &t630_dev, "DC %03o DATO %012llo PC=%06o\n",
sim_debug(DEBUG_DATAIO, &dcs_dev, "DC %03o DATO %012llo PC=%06o\n",
dev, *data, PC);
break;
case DATAI:
case DATAI|4:
ln = t630_rx_scan;
if (ln < t630_desc.lines) {
ln = dcs_rx_scan;
if (ln < dcs_desc.lines) {
/* Nothing happens if no recieve data, which is transmit ready */
lp = &t630_ldsc[ln];
lp = &dcs_ldsc[ln];
if (tmxr_rqln (lp) > 0) {
int32 ch = tmxr_getc_ln (lp);
if (ch & SCPE_BREAK) /* break? */
ch = 0;
else
ch = sim_tt_inpcvt (ch, TT_GET_MODE(t630_unit.flags) | TTUF_KSR);
ch = sim_tt_inpcvt (ch, TT_GET_MODE(dcs_unit.flags) | TTUF_KSR);
*data = (uint64)(ch & DATA);
t630_tx_enable &= ~(1 << ln);
dcs_tx_enable &= ~(1 << ln);
}
t630_rx_rdy &= ~(1 << ln);
dcs_rx_rdy &= ~(1 << ln);
}
if (dev & 4) {
uptr->STATUS |= RSCN_ACT;
t630_doscan(uptr);
dcs_doscan(uptr);
}
sim_debug(DEBUG_DATAIO, &t630_dev, "T630 %03o DATI %012llo PC=%06o\n",
sim_debug(DEBUG_DATAIO, &dcs_dev, "DCS %03o DATI %012llo PC=%06o\n",
dev, *data, PC);
break;
case CONI|4:
/* Read in scanner */
if ((uptr->STATUS & (RSCN_ACT)) != 0)
*data = (uint64)(t630_tx_scan);
*data = (uint64)(dcs_tx_scan) + 2;
else
*data = (uint64)(t630_rx_scan);
sim_debug(DEBUG_CONI, &t630_dev, "T630 %03o CONI %06o PC=%o recieve line\n",
*data = (uint64)(dcs_rx_scan) + 2;
sim_debug(DEBUG_CONI, &dcs_dev, "DCS %03o CONI %06o PC=%o recieve line\n",
dev, (uint32)*data, PC);
break;
case CONO|4:
/* Output buffer pointer */
t630_send_line = (int)(*data & 077);
sim_debug(DEBUG_CONO, &t630_dev, "T630 %03o CONO %06o PC=%06o send line\n",
dcs_send_line = (int)(*data & 077) - 2;
sim_debug(DEBUG_CONO, &dcs_dev, "DCS %03o CONO %06o PC=%06o send line\n",
dev, (uint32)*data, PC);
break;
}
@ -234,67 +236,67 @@ t_stat t630_devio(uint32 dev, uint64 *data) {
/* Unit service */
t_stat t630_svc (UNIT *uptr)
t_stat dcs_svc (UNIT *uptr)
{
int32 ln;
if ((uptr->flags & UNIT_ATT) == 0) /* attached? */
return SCPE_OK;
ln = tmxr_poll_conn (&t630_desc); /* look for connect */
ln = tmxr_poll_conn (&dcs_desc); /* look for connect */
if (ln >= 0) { /* got one? rcv enb*/
t630_ldsc[ln].rcve = 1;
t630_tx_enable |= 1 << ln;
sim_debug(DEBUG_DETAIL, &t630_dev, "DC line connect %d\n", ln);
dcs_ldsc[ln].rcve = 1;
dcs_tx_enable |= 1 << ln;
sim_debug(DEBUG_DETAIL, &dcs_dev, "DC line connect %d\n", ln);
}
tmxr_poll_tx(&t630_desc);
tmxr_poll_rx(&t630_desc);
for (ln = 0; ln < t630_desc.lines; ln++) {
tmxr_poll_tx(&dcs_desc);
tmxr_poll_rx(&dcs_desc);
for (ln = 0; ln < dcs_desc.lines; ln++) {
/* Check to see if any pending data for this line */
if (tmxr_rqln(&t630_ldsc[ln]) > 0) {
t630_rx_rdy |= (1 << ln);
sim_debug(DEBUG_DETAIL, &t630_dev, "DC recieve %d\n", ln);
if (tmxr_rqln(&dcs_ldsc[ln]) > 0) {
dcs_rx_rdy |= (1 << ln);
sim_debug(DEBUG_DETAIL, &dcs_dev, "DC recieve %d\n", ln);
}
/* Check if disconnect */
if ((t630_rx_conn & (1 << ln)) != 0 && t630_ldsc[ln].conn == 0) {
t630_tx_enable &= ~(1 << ln);
t630_rx_conn &= ~(1 << ln);
sim_debug(DEBUG_DETAIL, &t630_dev, "DC line disconnect %d\n", ln);
if ((dcs_rx_conn & (1 << ln)) != 0 && dcs_ldsc[ln].conn == 0) {
dcs_tx_enable &= ~(1 << ln);
dcs_rx_conn &= ~(1 << ln);
sim_debug(DEBUG_DETAIL, &dcs_dev, "DC line disconnect %d\n", ln);
}
}
/* If any pending status request, raise the PI signal */
t630_doscan(uptr);
dcs_doscan(uptr);
sim_clock_coschedule(uptr, tmxr_poll); /* continue poll */
return SCPE_OK;
}
/* Scan to see if something to do */
t_stat t630_doscan (UNIT *uptr) {
t_stat dcs_doscan (UNIT *uptr) {
uint32 lmask;
if ((uptr->STATUS & (RSCN_ACT|XSCN_ACT)) == 0)
return SCPE_OK;
clr_interrupt(T630_DEVNUM);
// if ((uptr->STATUS & (RSCN_ACT|XSCN_ACT)) == 0)
// return SCPE_OK;
clr_interrupt(DCS_DEVNUM);
if ((uptr->STATUS & (RSCN_ACT)) != 0) {
for (;t630_rx_rdy != 0; t630_rx_scan++) {
t630_rx_scan &= 037;
for (;dcs_rx_rdy != 0; dcs_rx_scan++) {
dcs_rx_scan &= 037;
/* Check if we found it */
if (t630_rx_rdy & (1 << t630_rx_scan)) {
if (dcs_rx_rdy & (1 << dcs_rx_scan)) {
uptr->STATUS &= ~RSCN_ACT;
/* Stop scanner */
set_interrupt(T630_DEVNUM, uptr->STATUS);
set_interrupt(DCS_DEVNUM, uptr->STATUS);
return SCPE_OK;
}
}
}
if ((uptr->STATUS & (XSCN_ACT)) != 0) {
for (;t630_tx_enable != 0; t630_tx_scan++) {
t630_tx_scan &= 037;
for (;dcs_tx_enable != 0; dcs_tx_scan++) {
dcs_tx_scan &= 037;
/* Check if we found it */
if (t630_tx_enable & (1 << t630_tx_scan)) {
if (dcs_tx_enable & (1 << dcs_tx_scan)) {
uptr->STATUS &= ~XSCN_ACT;
/* Stop scanner */
set_interrupt(T630_DEVNUM, (uptr->STATUS >> 6));
set_interrupt(DCS_DEVNUM, (uptr->STATUS >> 6));
return SCPE_OK;
}
}
@ -304,60 +306,60 @@ t_stat t630_doscan (UNIT *uptr) {
/* Reset routine */
t_stat t630_reset (DEVICE *dptr)
t_stat dcs_reset (DEVICE *dptr)
{
if (t630_unit.flags & UNIT_ATT) /* if attached, */
sim_activate (&t630_unit, tmxr_poll); /* activate */
if (dcs_unit.flags & UNIT_ATT) /* if attached, */
sim_activate (&dcs_unit, tmxr_poll); /* activate */
else
sim_cancel (&t630_unit); /* else stop */
t630_tx_enable = 0;
t630_rx_rdy = 0; /* Flags */
t630_rx_conn = 0;
t630_send_line = 0;
t630_tx_scan = 0;
t630_rx_scan = 0;
t630_unit.STATUS = 0;
clr_interrupt(T630_DEVNUM);
sim_cancel (&dcs_unit); /* else stop */
dcs_tx_enable = 0;
dcs_rx_rdy = 0; /* Flags */
dcs_rx_conn = 0;
dcs_send_line = 0;
dcs_tx_scan = 0;
dcs_rx_scan = 0;
dcs_unit.STATUS = 0;
clr_interrupt(DCS_DEVNUM);
return SCPE_OK;
}
/* SET LINES processor */
t_stat t630_setnl (UNIT *uptr, int32 val, CONST char *cptr, void *desc)
t_stat dcs_setnl (UNIT *uptr, int32 val, CONST char *cptr, void *desc)
{
int32 newln, i, t;
t_stat r;
if (cptr == NULL)
return SCPE_ARG;
newln = (int32) get_uint (cptr, 10, T630_LINES, &r);
if ((r != SCPE_OK) || (newln == t630_desc.lines))
newln = (int32) get_uint (cptr, 10, DCS_LINES, &r);
if ((r != SCPE_OK) || (newln == dcs_desc.lines))
return r;
if ((newln == 0) || (newln >= T630_LINES) || (newln % 8) != 0)
if ((newln == 0) || (newln >= DCS_LINES) || (newln % 8) != 0)
return SCPE_ARG;
if (newln < t630_desc.lines) {
for (i = newln, t = 0; i < t630_desc.lines; i++)
t = t | t630_ldsc[i].conn;
if (newln < dcs_desc.lines) {
for (i = newln, t = 0; i < dcs_desc.lines; i++)
t = t | dcs_ldsc[i].conn;
if (t && !get_yn ("This will disconnect users; proceed [N]?", FALSE))
return SCPE_OK;
for (i = newln; i < t630_desc.lines; i++) {
if (t630_ldsc[i].conn) {
tmxr_linemsg (&t630_ldsc[i], "\r\nOperator disconnected line\r\n");
tmxr_send_buffered_data (&t630_ldsc[i]);
for (i = newln; i < dcs_desc.lines; i++) {
if (dcs_ldsc[i].conn) {
tmxr_linemsg (&dcs_ldsc[i], "\r\nOperator disconnected line\r\n");
tmxr_send_buffered_data (&dcs_ldsc[i]);
}
tmxr_detach_ln (&t630_ldsc[i]); /* completely reset line */
tmxr_detach_ln (&dcs_ldsc[i]); /* completely reset line */
}
}
if (t630_desc.lines < newln)
memset (t630_ldsc + t630_desc.lines, 0, sizeof(*t630_ldsc)*(newln-t630_desc.lines));
t630_desc.lines = newln;
return t630_reset (&t630_dev); /* setup lines and auto config */
if (dcs_desc.lines < newln)
memset (dcs_ldsc + dcs_desc.lines, 0, sizeof(*dcs_ldsc)*(newln-dcs_desc.lines));
dcs_desc.lines = newln;
return dcs_reset (&dcs_dev); /* setup lines and auto config */
}
/* SET LOG processor */
t_stat t630_set_log (UNIT *uptr, int32 val, CONST char *cptr, void *desc)
t_stat dcs_set_log (UNIT *uptr, int32 val, CONST char *cptr, void *desc)
{
t_stat r;
char gbuf[CBUFSIZE];
@ -368,34 +370,34 @@ t_stat t630_set_log (UNIT *uptr, int32 val, CONST char *cptr, void *desc)
cptr = get_glyph (cptr, gbuf, '=');
if ((cptr == NULL) || (*cptr == 0) || (gbuf[0] == 0))
return SCPE_ARG;
ln = (int32) get_uint (gbuf, 10, t630_desc.lines, &r);
if ((r != SCPE_OK) || (ln >= t630_desc.lines))
ln = (int32) get_uint (gbuf, 10, dcs_desc.lines, &r);
if ((r != SCPE_OK) || (ln >= dcs_desc.lines))
return SCPE_ARG;
return tmxr_set_log (NULL, ln, cptr, desc);
}
/* SET NOLOG processor */
t_stat t630_set_nolog (UNIT *uptr, int32 val, CONST char *cptr, void *desc)
t_stat dcs_set_nolog (UNIT *uptr, int32 val, CONST char *cptr, void *desc)
{
t_stat r;
int32 ln;
if (cptr == NULL)
return SCPE_ARG;
ln = (int32) get_uint (cptr, 10, t630_desc.lines, &r);
if ((r != SCPE_OK) || (ln >= t630_desc.lines))
ln = (int32) get_uint (cptr, 10, dcs_desc.lines, &r);
if ((r != SCPE_OK) || (ln >= dcs_desc.lines))
return SCPE_ARG;
return tmxr_set_nolog (NULL, ln, NULL, desc);
}
/* SHOW LOG processor */
t_stat t630_show_log (FILE *st, UNIT *uptr, int32 val, CONST void *desc)
t_stat dcs_show_log (FILE *st, UNIT *uptr, int32 val, CONST void *desc)
{
int32 i;
for (i = 0; i < t630_desc.lines; i++) {
for (i = 0; i < dcs_desc.lines; i++) {
fprintf (st, "line %d: ", i);
tmxr_show_log (st, NULL, i, desc);
fprintf (st, "\n");
@ -406,11 +408,11 @@ t_stat t630_show_log (FILE *st, UNIT *uptr, int32 val, CONST void *desc)
/* Attach routine */
t_stat t630_attach (UNIT *uptr, CONST char *cptr)
t_stat dcs_attach (UNIT *uptr, CONST char *cptr)
{
t_stat reason;
reason = tmxr_attach (&t630_desc, uptr, cptr);
reason = tmxr_attach (&dcs_desc, uptr, cptr);
if (reason != SCPE_OK)
return reason;
sim_activate (uptr, tmxr_poll);
@ -419,28 +421,24 @@ return SCPE_OK;
/* Detach routine */
t_stat t630_detach (UNIT *uptr)
t_stat dcs_detach (UNIT *uptr)
{
int32 i;
t_stat reason;
reason = tmxr_detach (&t630_desc, uptr);
for (i = 0; i < t630_desc.lines; i++)
t630_ldsc[i].rcve = 0;
reason = tmxr_detach (&dcs_desc, uptr);
for (i = 0; i < dcs_desc.lines; i++)
dcs_ldsc[i].rcve = 0;
sim_cancel (uptr);
return reason;
}
t_stat t630_help (FILE *st, DEVICE *dptr, UNIT *uptr, int32 flag, const char *cptr)
t_stat dcs_help (FILE *st, DEVICE *dptr, UNIT *uptr, int32 flag, const char *cptr)
{
fprintf (st, "Type 630 Terminal Interfaces\n\n");
fprintf (st, "The Type 630 supported up to 8 blocks of 8 lines. Modem control was on a seperate\n");
fprintf (st, "line. The simulator supports this by setting modem control to a fixed offset\n");
fprintf (st, "from the given line. The number of lines is specified with a SET command:\n\n");
fprintf (st, " sim> SET DC LINES=n set number of additional lines to n [8-32]\n\n");
fprintf (st, "line. The number of lines is specified with a SET command:\n\n");
fprintf (st, " sim> SET DCS LINES=n set number of additional lines to n [8-32]\n\n");
fprintf (st, "Lines must be set in multiples of 8.\n");
fprintf (st, "The default offset for modem lines is 32. This can be changed with\n\n");
fprintf (st, " sim> SET DC MODEM=n set offset for modem control to n [8-32]\n\n");
fprintf (st, "Modem control must be set larger then the number of lines\n");
fprintf (st, "The ATTACH command specifies the port to be used:\n\n");
tmxr_attach_help (st, dptr, uptr, flag, cptr);
fprintf (st, "The additional terminals can be set to one of four modes: UC, 7P, 7B, or 8B.\n\n");
@ -455,24 +453,24 @@ fprintf (st, " 8B no changes no changes\n\n");
fprintf (st, "The default mode is 7P.\n");
fprintf (st, "Finally, each line supports output logging. The SET DCn LOG command enables\n");
fprintf (st, "logging on a line:\n\n");
fprintf (st, " sim> SET DCn LOG=filename log output of line n to filename\n\n");
fprintf (st, "The SET DCn NOLOG command disables logging and closes the open log file,\n");
fprintf (st, " sim> SET DCSn LOG=filename log output of line n to filename\n\n");
fprintf (st, "The SET DCSn NOLOG command disables logging and closes the open log file,\n");
fprintf (st, "if any.\n\n");
fprintf (st, "Once DC is attached and the simulator is running, the terminals listen for\n");
fprintf (st, "connections on the specified port. They assume that the incoming connections\n");
fprintf (st, "are Telnet connections. The connections remain open until disconnected either\n");
fprintf (st, "by the Telnet client, a SET DC DISCONNECT command, or a DETACH DC command.\n\n");
fprintf (st, "Other special commands:\n\n");
fprintf (st, " sim> SHOW DC CONNECTIONS show current connections\n");
fprintf (st, " sim> SHOW DC STATISTICS show statistics for active connections\n");
fprintf (st, " sim> SET DCn DISCONNECT disconnects the specified line.\n");
fprint_reg_help (st, &t630_dev);
fprintf (st, " sim> SHOW DCS CONNECTIONS show current connections\n");
fprintf (st, " sim> SHOW DCS STATISTICS show statistics for active connections\n");
fprintf (st, " sim> SET DCSn DISCONNECT disconnects the specified line.\n");
fprint_reg_help (st, &dcs_dev);
fprintf (st, "\nThe additional terminals do not support save and restore. All open connections\n");
fprintf (st, "are lost when the simulator shuts down or DC is detached.\n");
return SCPE_OK;
}
const char *t630_description (DEVICE *dptr)
const char *dcs_description (DEVICE *dptr)
{
return "Type 630 asynchronous line interface";
}