AltairZ80: Updated M2SIO device
This commit is contained in:
parent
1f6d0822bd
commit
5f2470904b
3 changed files with 57 additions and 32 deletions
|
@ -176,6 +176,7 @@ static t_stat m2sio_detach(UNIT *uptr);
|
||||||
static t_stat m2sio_set_baud(UNIT *uptr, int32 value, const char *cptr, void *desc);
|
static t_stat m2sio_set_baud(UNIT *uptr, int32 value, const char *cptr, void *desc);
|
||||||
static t_stat m2sio_show_baud(FILE *st, UNIT *uptr, int32 value, const void *desc);
|
static t_stat m2sio_show_baud(FILE *st, UNIT *uptr, int32 value, const void *desc);
|
||||||
static t_stat m2sio_config_line(UNIT *uptr);
|
static t_stat m2sio_config_line(UNIT *uptr);
|
||||||
|
static t_stat m2sio_config_rts(DEVICE *dptr, char rts);
|
||||||
static int32 m2sio0_io(int32 addr, int32 io, int32 data);
|
static int32 m2sio0_io(int32 addr, int32 io, int32 data);
|
||||||
static int32 m2sio1_io(int32 addr, int32 io, int32 data);
|
static int32 m2sio1_io(int32 addr, int32 io, int32 data);
|
||||||
static int32 m2sio_io(DEVICE *dptr, int32 addr, int32 io, int32 data);
|
static int32 m2sio_io(DEVICE *dptr, int32 addr, int32 io, int32 data);
|
||||||
|
@ -384,6 +385,9 @@ static t_stat m2sio_reset(DEVICE *dptr, int32 (*routine)(const int32, const int3
|
||||||
/* Reset status registers */
|
/* Reset status registers */
|
||||||
xptr->stb = 0;
|
xptr->stb = 0;
|
||||||
xptr->txp = 0;
|
xptr->txp = 0;
|
||||||
|
if (dptr->units[0].flags & UNIT_ATT) {
|
||||||
|
m2sio_config_rts(dptr, 1); /* disable RTS */
|
||||||
|
}
|
||||||
|
|
||||||
if (!(dptr->flags & DEV_DIS)) {
|
if (!(dptr->flags & DEV_DIS)) {
|
||||||
sim_activate(&dptr->units[0], dptr->units[0].wait);
|
sim_activate(&dptr->units[0], dptr->units[0].wait);
|
||||||
|
@ -408,11 +412,6 @@ static t_stat m2sio_svc(UNIT *uptr)
|
||||||
if (uptr->flags & UNIT_ATT) {
|
if (uptr->flags & UNIT_ATT) {
|
||||||
if (tmxr_poll_conn(xptr->tmxr) >= 0) { /* poll connection */
|
if (tmxr_poll_conn(xptr->tmxr) >= 0) { /* poll connection */
|
||||||
|
|
||||||
/* Clear DTR and RTS if serial port */
|
|
||||||
if (xptr->tmln->serport) {
|
|
||||||
tmxr_set_get_modem_bits(xptr->tmln, 0, TMXR_MDM_DTR | TMXR_MDM_RTS, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
xptr->conn = 1; /* set connected */
|
xptr->conn = 1; /* set connected */
|
||||||
|
|
||||||
sim_debug(STATUS_MSG, uptr->dptr, "new connection.\n");
|
sim_debug(STATUS_MSG, uptr->dptr, "new connection.\n");
|
||||||
|
@ -506,11 +505,11 @@ static t_stat m2sio_attach(UNIT *uptr, CONST char *cptr)
|
||||||
|
|
||||||
if ((r = tmxr_attach(xptr->tmxr, uptr, cptr)) == SCPE_OK) {
|
if ((r = tmxr_attach(xptr->tmxr, uptr, cptr)) == SCPE_OK) {
|
||||||
|
|
||||||
|
if (xptr->tmln->serport) {
|
||||||
|
r = m2sio_config_rts(uptr->dptr, xptr->rts); /* update RTS */
|
||||||
|
}
|
||||||
|
|
||||||
xptr->tmln->rcve = 1;
|
xptr->tmln->rcve = 1;
|
||||||
|
|
||||||
sim_activate(uptr, uptr->wait);
|
|
||||||
|
|
||||||
sim_debug(VERBOSE_MSG, uptr->dptr, "activated service.\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
|
@ -558,11 +557,12 @@ static t_stat m2sio_set_baud(UNIT *uptr, int32 value, const char *cptr, void *de
|
||||||
case 2400:
|
case 2400:
|
||||||
case 4800:
|
case 4800:
|
||||||
case 9600:
|
case 9600:
|
||||||
|
case 19200:
|
||||||
xptr->baud = baud;
|
xptr->baud = baud;
|
||||||
r = m2sio_config_line(uptr);
|
r = m2sio_config_line(uptr);
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -630,7 +630,7 @@ static t_stat m2sio_config_line(UNIT *uptr)
|
||||||
sim_debug(STATUS_MSG, uptr->dptr, "port configuration set to '%s'.\n", config);
|
sim_debug(STATUS_MSG, uptr->dptr, "port configuration set to '%s'.\n", config);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** AltairZ80 and TMXR refuse to want to play together
|
** AltairZ80 and TMXR refuse to want to play together
|
||||||
** nicely when the CLOCK register is set to anything
|
** nicely when the CLOCK register is set to anything
|
||||||
** other than 0.
|
** other than 0.
|
||||||
**
|
**
|
||||||
|
@ -651,6 +651,44 @@ static t_stat m2sio_config_line(UNIT *uptr)
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
** RTS is active low
|
||||||
|
** 0 = RTS active
|
||||||
|
** 1 = RTS inactive
|
||||||
|
*/
|
||||||
|
static t_stat m2sio_config_rts(DEVICE *dptr, char rts)
|
||||||
|
{
|
||||||
|
M2SIO_CTX *xptr;
|
||||||
|
t_stat r = SCPE_OK;
|
||||||
|
int32 s;
|
||||||
|
|
||||||
|
xptr = (M2SIO_CTX *) dptr->ctxt;
|
||||||
|
|
||||||
|
if (dptr->units[0].flags & UNIT_ATT) {
|
||||||
|
/* RTS Control */
|
||||||
|
s = TMXR_MDM_RTS;
|
||||||
|
if (dptr->units[0].flags & UNIT_M2SIO_DTR) {
|
||||||
|
s |= TMXR_MDM_DTR;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!rts) {
|
||||||
|
r = tmxr_set_get_modem_bits(xptr->tmln, s, 0, NULL);
|
||||||
|
if (xptr->rts) {
|
||||||
|
sim_debug(STATUS_MSG, dptr, "RTS state changed to HIGH.\n");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
r = tmxr_set_get_modem_bits(xptr->tmln, 0, s, NULL);
|
||||||
|
if (!xptr->rts) {
|
||||||
|
sim_debug(STATUS_MSG, dptr, "RTS state changed to LOW.\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
xptr->rts = rts; /* Active low */
|
||||||
|
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
static int32 m2sio0_io(int32 addr, int32 io, int32 data)
|
static int32 m2sio0_io(int32 addr, int32 io, int32 data)
|
||||||
{
|
{
|
||||||
DEVICE *dptr;
|
DEVICE *dptr;
|
||||||
|
@ -685,7 +723,7 @@ static int32 m2sio_io(DEVICE *dptr, int32 addr, int32 io, int32 data)
|
||||||
static int32 m2sio_stat(DEVICE *dptr, int32 io, int32 data)
|
static int32 m2sio_stat(DEVICE *dptr, int32 io, int32 data)
|
||||||
{
|
{
|
||||||
M2SIO_CTX *xptr;
|
M2SIO_CTX *xptr;
|
||||||
int32 r,s;
|
int32 r;
|
||||||
|
|
||||||
xptr = (M2SIO_CTX *) dptr->ctxt;
|
xptr = (M2SIO_CTX *) dptr->ctxt;
|
||||||
|
|
||||||
|
@ -696,37 +734,25 @@ static int32 m2sio_stat(DEVICE *dptr, int32 io, int32 data)
|
||||||
|
|
||||||
/* Master Reset */
|
/* Master Reset */
|
||||||
if ((data & M2SIO_RESET) == M2SIO_RESET) {
|
if ((data & M2SIO_RESET) == M2SIO_RESET) {
|
||||||
xptr->stb &= (M2SIO_CTS | M2SIO_DCD); /* Reset status register */
|
|
||||||
xptr->txp = 0;
|
|
||||||
sim_debug(STATUS_MSG, dptr, "MC6850 master reset.\n");
|
sim_debug(STATUS_MSG, dptr, "MC6850 master reset.\n");
|
||||||
|
xptr->stb &= (M2SIO_CTS | M2SIO_DCD); /* Reset status register */
|
||||||
|
xptr->rxb = 0;
|
||||||
|
xptr->txp = 0;
|
||||||
|
m2sio_config_rts(dptr, 1); /* disable RTS */
|
||||||
} else if (dptr->units[0].flags & UNIT_ATT) {
|
} else if (dptr->units[0].flags & UNIT_ATT) {
|
||||||
/* Interrupt Enable */
|
/* Interrupt Enable */
|
||||||
xptr->tie = (data & M2SIO_RIE) == M2SIO_RIE; /* Receive enable */
|
xptr->tie = (data & M2SIO_RIE) == M2SIO_RIE; /* Receive enable */
|
||||||
xptr->rie = (data & M2SIO_RTSMSK) == M2SIO_RTSLTIE; /* Transmit enable */
|
xptr->rie = (data & M2SIO_RTSMSK) == M2SIO_RTSLTIE; /* Transmit enable */
|
||||||
|
|
||||||
/* RTS Control */
|
|
||||||
s = TMXR_MDM_RTS;
|
|
||||||
if (dptr->units[0].flags & UNIT_M2SIO_DTR) {
|
|
||||||
s |= TMXR_MDM_DTR;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (data & M2SIO_RTSMSK) {
|
switch (data & M2SIO_RTSMSK) {
|
||||||
case M2SIO_RTSLTIE:
|
case M2SIO_RTSLTIE:
|
||||||
case M2SIO_RTSLTID:
|
case M2SIO_RTSLTID:
|
||||||
tmxr_set_get_modem_bits(xptr->tmln, s, 0, NULL);
|
r = m2sio_config_rts(dptr, 0); /* enable RTS */
|
||||||
if (xptr->rts) {
|
|
||||||
sim_debug(STATUS_MSG, dptr, "RTS state changed to HIGH.\n");
|
|
||||||
}
|
|
||||||
xptr->rts = 0; /* Active low */
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case M2SIO_RTSHTID:
|
case M2SIO_RTSHTID:
|
||||||
case M2SIO_RTSHTBR:
|
case M2SIO_RTSHTBR:
|
||||||
tmxr_set_get_modem_bits(xptr->tmln, 0, s, NULL);
|
r = m2sio_config_rts(dptr, 1); /* disable RTS */
|
||||||
if (!xptr->rts) {
|
|
||||||
sim_debug(STATUS_MSG, dptr, "RTS state changed to LOW.\n");
|
|
||||||
}
|
|
||||||
xptr->rts = 1; /* Active low */
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -627,7 +627,6 @@ static t_stat HDC1001_doCommand(void)
|
||||||
uint32 track_len;
|
uint32 track_len;
|
||||||
uint32 xfr_len;
|
uint32 xfr_len;
|
||||||
uint32 file_offset;
|
uint32 file_offset;
|
||||||
uint32 xfr_count = 0;
|
|
||||||
uint8 rwopts; /* Options specified in the command: DMA, Multi-sector, long. */
|
uint8 rwopts; /* Options specified in the command: DMA, Multi-sector, long. */
|
||||||
|
|
||||||
/* Abort the read/write operation if C/H/S/N is not valid. */
|
/* Abort the read/write operation if C/H/S/N is not valid. */
|
||||||
|
|
|
@ -842,7 +842,7 @@ static t_stat icom_set_membase(UNIT *uptr, int32 val, CONST char *cptr, void *de
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newba) {
|
if (newba) {
|
||||||
r = set_membase(uptr, val, cptr, desc);
|
r = set_membase(uptr, val, cptr, desc);
|
||||||
if (r) {
|
if (r) {
|
||||||
sim_debug(ERROR_MSG, &icom_dev, "Error setting MEM resource at 0x%04x\n", icom_info->mem_base);
|
sim_debug(ERROR_MSG, &icom_dev, "Error setting MEM resource at 0x%04x\n", icom_info->mem_base);
|
||||||
icom_info->mem_base = 0;
|
icom_info->mem_base = 0;
|
||||||
|
|
Loading…
Add table
Reference in a new issue