PDP8: Refinement to prior fix for issue #86. Avoid data loss if prior character hasn't been read yet when a poll event happens.

This commit is contained in:
Mark Pizzolato 2013-11-03 13:08:17 -08:00
parent be46bac750
commit 6f4e718fda
5 changed files with 33 additions and 6 deletions

View file

@ -179,6 +179,8 @@ t_stat tti_svc (UNIT *uptr)
int32 c;
sim_clock_coschedule (uptr, tmxr_poll); /* continue poll */
if (dev_done & INT_TTI) /* prior character still pending? */
return SCPE_OK;
if ((c = sim_poll_kbd ()) < SCPE_KFLAG) /* no char or error? */
return c;
if (c & SCPE_BREAK) /* break? */

View file

@ -119,12 +119,29 @@ MTAB ttix_mod[] = {
{ 0 }
};
/* debugging bitmaps */
#define DBG_XMT TMXR_DBG_XMT /* display Transmitted Data */
#define DBG_RCV TMXR_DBG_RCV /* display Received Data */
#define DBG_RET TMXR_DBG_RET /* display Returned Received Data */
#define DBG_CON TMXR_DBG_CON /* display connection activities */
#define DBG_TRC TMXR_DBG_TRC /* display trace routine calls */
DEBTAB ttx_debug[] = {
{"XMT", DBG_XMT},
{"RCV", DBG_RCV},
{"RET", DBG_RET},
{"CON", DBG_CON},
{"TRC", DBG_TRC},
{0}
};
DEVICE ttix_dev = {
"TTIX", &ttix_unit, ttix_reg, ttix_mod,
1, 10, 31, 1, 8, 8,
&tmxr_ex, &tmxr_dep, &ttix_reset,
NULL, &ttx_attach, &ttx_detach,
&ttix_dib, DEV_MUX | DEV_DISABLE,
&ttix_dib, DEV_MUX | DEV_DISABLE | DEV_DEBUG,
0, ttx_debug
};
/* TTOx data structures
@ -170,7 +187,8 @@ DEVICE ttox_dev = {
4, 10, 31, 1, 8, 8,
NULL, NULL, &ttox_reset,
NULL, NULL, NULL,
NULL, DEV_DISABLE
NULL, DEV_DISABLE | DEV_DEBUG,
0, ttx_debug
};
/* Terminal input: IOT routine */
@ -236,6 +254,8 @@ if (ln >= 0) /* got one? rcv enb*/
tmxr_poll_rx (&ttx_desc); /* poll for input */
for (ln = 0; ln < TTX_LINES; ln++) { /* loop thru lines */
if (ttx_ldsc[ln].conn) { /* connected? */
if (dev_done & (INT_TTI1 << ln)) /* Last character still pending? */
continue;
if ((temp = tmxr_getc_ln (&ttx_ldsc[ln]))) { /* get char */
if (temp & SCPE_BREAK) /* break? */
c = 0;

View file

@ -162,12 +162,14 @@ UNIT sim_con_unit = { UDATA (&sim_con_poll_svc, 0, 0) }; /* console connectio
#define DBG_TRC TMXR_DBG_TRC /* trace routine calls */
#define DBG_XMT TMXR_DBG_XMT /* display Transmitted Data */
#define DBG_RCV TMXR_DBG_RCV /* display Received Data */
#define DBG_RET TMXR_DBG_RET /* display Returned Received Data */
#define DBG_ASY TMXR_DBG_ASY /* asynchronous thread activity */
static DEBTAB sim_con_debug[] = {
{"TRC", DBG_TRC},
{"XMT", DBG_XMT},
{"RCV", DBG_RCV},
{"RET", DBG_RET},
{"ASY", DBG_ASY},
{0}
};

View file

@ -1317,6 +1317,7 @@ if (lp->conn && lp->rcve) { /* conn & enb? */
} /* end if conn */
if (lp->rxbpi == lp->rxbpr) /* empty? zero ptrs */
lp->rxbpi = lp->rxbpr = 0;
tmxr_debug_return(lp, val);
return val;
}

View file

@ -68,10 +68,11 @@ typedef int SERHANDLE;
#define TMXR_DBG_XMT 0x010000 /* Debug Transmit Data */
#define TMXR_DBG_RCV 0x020000 /* Debug Received Data */
#define TMXR_DBG_MDM 0x040000 /* Debug Modem Signals */
#define TMXR_DBG_CON 0x080000 /* Debug Connection Activities */
#define TMXR_DBG_ASY 0x100000 /* Debug Asynchronous Activities */
#define TMXR_DBG_TRC 0x200000 /* Debug trace routine calls */
#define TMXR_DBG_RET 0x040000 /* Debug Returned Received Data */
#define TMXR_DBG_MDM 0x080000 /* Debug Modem Signals */
#define TMXR_DBG_CON 0x100000 /* Debug Connection Activities */
#define TMXR_DBG_ASY 0x200000 /* Debug Asynchronous Activities */
#define TMXR_DBG_TRC 0x400000 /* Debug trace routine calls */
/* Modem Control Bits */
@ -203,6 +204,7 @@ t_stat tmxr_stop_poll (void);
void _tmxr_debug (uint32 dbits, TMLN *lp, const char *msg, char *buf, int bufsize);
extern FILE *sim_deb; /* debug file */
#define tmxr_debug(dbits, lp, msg, buf, bufsize) if (sim_deb && (lp)->mp->dptr && ((dbits) & (lp)->mp->dptr->dctrl)) _tmxr_debug (dbits, lp, msg, buf, bufsize); else (void)0
#define tmxr_debug_return(lp, val) if (sim_deb && (val) && (lp)->mp->dptr && (TMXR_DBG_RET & (lp)->mp->dptr->dctrl)) sim_debug (TMXR_DBG_RET, (lp)->mp->dptr, "Ln%d: 0x%x\n", (int)((lp)-(lp)->mp->ldsc), val); else (void)0
#define tmxr_debug_trace(mp, msg) if (sim_deb && (mp)->dptr && (TMXR_DBG_TRC & (mp)->dptr->dctrl)) sim_debug (TMXR_DBG_TRC, mp->dptr, "%s\n", (msg)); else (void)0
#define tmxr_debug_trace_line(lp, msg) if (sim_deb && (lp)->mp && (lp)->mp->dptr && (TMXR_DBG_TRC & (lp)->mp->dptr->dctrl)) sim_debug (TMXR_DBG_TRC, (lp)->mp->dptr, "Ln%d:%s\n", (int)((lp)-(lp)->mp->ldsc), (msg)); else (void)0
#define tmxr_debug_connect(mp, msg) if (sim_deb && (mp)->dptr && (TMXR_DBG_CON & (mp)->dptr->dctrl)) sim_debug (TMXR_DBG_CON, mp->dptr, "%s\n", (msg)); else (void)0