ID16, ID32: Fixed testing of 8b mode and echoed character (COVERITY)
This commit is contained in:
parent
a37e9284e1
commit
e1f8e88373
2 changed files with 15 additions and 13 deletions
|
@ -79,7 +79,7 @@ t_stat tt_set_enbdis (UNIT *uptr, int32 val, CONST char *cptr, void *desc);
|
||||||
DIB tt_dib = { d_TT, -1, v_TT, NULL, &tt, NULL };
|
DIB tt_dib = { d_TT, -1, v_TT, NULL, &tt, NULL };
|
||||||
|
|
||||||
UNIT tt_unit[] = {
|
UNIT tt_unit[] = {
|
||||||
{ UDATA (&tti_svc, TT_MODE_KSR|UNIT_IDLE, 0), 0 },
|
{ UDATA (&tti_svc, TT_MODE_KSR|UNIT_IDLE, 0), KBD_POLL_WAIT },
|
||||||
{ UDATA (&tto_svc, TT_MODE_KSR, 0), SERIAL_OUT_WAIT }
|
{ UDATA (&tto_svc, TT_MODE_KSR, 0), SERIAL_OUT_WAIT }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ REG tt_reg[] = {
|
||||||
{ HRDATA (STA, tt_sta, 8) },
|
{ HRDATA (STA, tt_sta, 8) },
|
||||||
{ HRDATA (KBUF, tt_unit[TTI].buf, 8) },
|
{ HRDATA (KBUF, tt_unit[TTI].buf, 8) },
|
||||||
{ DRDATA (KPOS, tt_unit[TTI].pos, T_ADDR_W), PV_LEFT },
|
{ DRDATA (KPOS, tt_unit[TTI].pos, T_ADDR_W), PV_LEFT },
|
||||||
{ DRDATA (KTIME, tt_unit[TTI].wait, 24), PV_LEFT },
|
{ DRDATA (KTIME, tt_unit[TTI].wait, 24), PV_LEFT + REG_NZ },
|
||||||
{ HRDATA (TBUF, tt_unit[TTO].buf, 8) },
|
{ HRDATA (TBUF, tt_unit[TTO].buf, 8) },
|
||||||
{ DRDATA (TPOS, tt_unit[TTO].pos, T_ADDR_W), PV_LEFT },
|
{ DRDATA (TPOS, tt_unit[TTO].pos, T_ADDR_W), PV_LEFT },
|
||||||
{ DRDATA (TTIME, tt_unit[TTO].wait, 24), REG_NZ + PV_LEFT },
|
{ DRDATA (TTIME, tt_unit[TTO].wait, 24), REG_NZ + PV_LEFT },
|
||||||
|
@ -159,6 +159,7 @@ switch (op) { /* case IO op */
|
||||||
tt_chp = 0; /* clear pend */
|
tt_chp = 0; /* clear pend */
|
||||||
if (tt_rd)
|
if (tt_rd)
|
||||||
tt_sta = (tt_sta | STA_BSY) & ~STA_OVR;
|
tt_sta = (tt_sta | STA_BSY) & ~STA_OVR;
|
||||||
|
sim_activate_abs (&tt_unit[TTI], tt_unit[TTI].wait);
|
||||||
return (tt_unit[TTI].buf & 0xFF);
|
return (tt_unit[TTI].buf & 0xFF);
|
||||||
|
|
||||||
case IO_WD: /* write */
|
case IO_WD: /* write */
|
||||||
|
@ -184,8 +185,7 @@ t_stat tti_svc (UNIT *uptr)
|
||||||
{
|
{
|
||||||
int32 out, temp;
|
int32 out, temp;
|
||||||
|
|
||||||
sim_activate (uptr, KBD_WAIT (uptr->wait, lfc_cosched (lfc_poll)));
|
sim_activate (uptr, lfc_cosched (lfc_poll)); /* continue poll */
|
||||||
/* continue poll */
|
|
||||||
tt_sta = tt_sta & ~STA_BRK; /* clear break */
|
tt_sta = tt_sta & ~STA_BRK; /* clear break */
|
||||||
if ((temp = sim_poll_kbd ()) < SCPE_KFLAG) /* no char or error? */
|
if ((temp = sim_poll_kbd ()) < SCPE_KFLAG) /* no char or error? */
|
||||||
return temp;
|
return temp;
|
||||||
|
@ -241,7 +241,7 @@ t_stat tt_reset (DEVICE *dptr)
|
||||||
{
|
{
|
||||||
if (dptr->flags & DEV_DIS) /* dis? cancel poll */
|
if (dptr->flags & DEV_DIS) /* dis? cancel poll */
|
||||||
sim_cancel (&tt_unit[TTI]);
|
sim_cancel (&tt_unit[TTI]);
|
||||||
else sim_activate (&tt_unit[TTI], KBD_WAIT (tt_unit[TTI].wait, lfc_poll));
|
else sim_activate (&tt_unit[TTI],lfc_poll);
|
||||||
sim_cancel (&tt_unit[TTO]); /* cancel output */
|
sim_cancel (&tt_unit[TTO]); /* cancel output */
|
||||||
tt_rd = tt_fdpx = 1; /* read, full duplex */
|
tt_rd = tt_fdpx = 1; /* read, full duplex */
|
||||||
tt_chp = 0; /* no char */
|
tt_chp = 0; /* no char */
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* id_ttp.c: Interdata PASLA console interface
|
/* id_ttp.c: Interdata PASLA console interface
|
||||||
|
|
||||||
Copyright (c) 2000-2012, Robert M. Supnik
|
Copyright (c) 2000-2017, Robert M. Supnik
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a
|
Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
copy of this software and associated documentation files (the "Software"),
|
copy of this software and associated documentation files (the "Software"),
|
||||||
|
@ -25,6 +25,8 @@
|
||||||
|
|
||||||
ttp console (on PAS)
|
ttp console (on PAS)
|
||||||
|
|
||||||
|
09-Mar-17 RMS Fixed testing of 8b mode (COVERITY)
|
||||||
|
Fixed testing of echoed character (COVERITY)
|
||||||
18-Apr-12 RMS Revised to use clock coscheduling
|
18-Apr-12 RMS Revised to use clock coscheduling
|
||||||
18-Jun-07 RMS Added UNIT_IDLE flag to console input
|
18-Jun-07 RMS Added UNIT_IDLE flag to console input
|
||||||
18-Oct-06 RMS Sync keyboard to LFC clock
|
18-Oct-06 RMS Sync keyboard to LFC clock
|
||||||
|
@ -78,7 +80,7 @@ t_stat ttp_set_enbdis (UNIT *uptr, int32 val, CONST char *cptr, void *desc);
|
||||||
DIB ttp_dib = { d_TTP, -1, v_TTP, ttp_tplte, &ttp, NULL };
|
DIB ttp_dib = { d_TTP, -1, v_TTP, ttp_tplte, &ttp, NULL };
|
||||||
|
|
||||||
UNIT ttp_unit[] = {
|
UNIT ttp_unit[] = {
|
||||||
{ UDATA (&ttpi_svc, UNIT_IDLE, 0), 0 },
|
{ UDATA (&ttpi_svc, UNIT_IDLE, 0), KBD_POLL_WAIT },
|
||||||
{ UDATA (&ttpo_svc, 0, 0), SERIAL_OUT_WAIT }
|
{ UDATA (&ttpo_svc, 0, 0), SERIAL_OUT_WAIT }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -140,6 +142,7 @@ switch (op) { /* case IO op */
|
||||||
case IO_RD: /* read */
|
case IO_RD: /* read */
|
||||||
ttp_kchp = 0; /* clr chr pend */
|
ttp_kchp = 0; /* clr chr pend */
|
||||||
ttp_sta = ttp_sta & ~STA_OVR; /* clr overrun */
|
ttp_sta = ttp_sta & ~STA_OVR; /* clr overrun */
|
||||||
|
sim_activate_abs (&ttp_unit[TTI], ttp_unit[TTI].wait);
|
||||||
return ttp_unit[TTI].buf; /* return buf */
|
return ttp_unit[TTI].buf; /* return buf */
|
||||||
|
|
||||||
case IO_WD: /* write */
|
case IO_WD: /* write */
|
||||||
|
@ -179,8 +182,7 @@ t_stat ttpi_svc (UNIT *uptr)
|
||||||
{
|
{
|
||||||
int32 c, out;
|
int32 c, out;
|
||||||
|
|
||||||
sim_activate (uptr, KBD_WAIT (uptr->wait, lfc_cosched (lfc_poll)));
|
sim_activate (uptr, lfc_cosched (lfc_poll)); /* continue poll */
|
||||||
/* continue poll */
|
|
||||||
ttp_sta = ttp_sta & ~STA_FR; /* clear break */
|
ttp_sta = ttp_sta & ~STA_FR; /* clear break */
|
||||||
if ((c = sim_poll_kbd ()) < SCPE_KFLAG) /* no char or error? */
|
if ((c = sim_poll_kbd ()) < SCPE_KFLAG) /* no char or error? */
|
||||||
return c;
|
return c;
|
||||||
|
@ -196,14 +198,14 @@ if (c & SCPE_BREAK) { /* break? */
|
||||||
else {
|
else {
|
||||||
out = c & 0x7F; /* echo is 7b */
|
out = c & 0x7F; /* echo is 7b */
|
||||||
c = sim_tt_inpcvt (c, TT_GET_MODE (uptr->flags));
|
c = sim_tt_inpcvt (c, TT_GET_MODE (uptr->flags));
|
||||||
if (TT_GET_MODE (uptr->flags) != TT_MODE_8B) /* not 8b mode? */
|
if (TT_GET_MODE (uptr->flags) != TTUF_MODE_8B) /* not 8b mode? */
|
||||||
c = pas_par (ttp_cmd, c); /* apply parity */
|
c = pas_par (ttp_cmd, c); /* apply parity */
|
||||||
uptr->buf = c; /* save char */
|
uptr->buf = c; /* save char */
|
||||||
uptr->pos = uptr->pos + 1; /* incr count */
|
uptr->pos = uptr->pos + 1; /* incr count */
|
||||||
ttp_kchp = 1; /* char pending */
|
ttp_kchp = 1; /* char pending */
|
||||||
if (ttp_cmd & CMD_ECHO) {
|
if (ttp_cmd & CMD_ECHO) {
|
||||||
out = sim_tt_outcvt (out, TT_GET_MODE (uptr->flags));
|
out = sim_tt_outcvt (out, TT_GET_MODE (uptr->flags));
|
||||||
if (c >= 0)
|
if (out >= 0)
|
||||||
sim_putchar (out);
|
sim_putchar (out);
|
||||||
ttp_unit[TTO].pos = ttp_unit[TTO].pos + 1;
|
ttp_unit[TTO].pos = ttp_unit[TTO].pos + 1;
|
||||||
}
|
}
|
||||||
|
@ -216,7 +218,7 @@ t_stat ttpo_svc (UNIT *uptr)
|
||||||
int32 c;
|
int32 c;
|
||||||
t_stat r;
|
t_stat r;
|
||||||
|
|
||||||
if (TT_GET_MODE (uptr->flags) == TT_MODE_8B) /* 8b? */
|
if (TT_GET_MODE (uptr->flags) == TTUF_MODE_8B) /* 8b? */
|
||||||
c = pas_par (ttp_cmd, uptr->buf); /* apply parity */
|
c = pas_par (ttp_cmd, uptr->buf); /* apply parity */
|
||||||
else c = sim_tt_outcvt (uptr->buf, TT_GET_MODE (uptr->flags));
|
else c = sim_tt_outcvt (uptr->buf, TT_GET_MODE (uptr->flags));
|
||||||
if (c >= 0) {
|
if (c >= 0) {
|
||||||
|
@ -238,7 +240,7 @@ t_stat ttp_reset (DEVICE *dptr)
|
||||||
{
|
{
|
||||||
if (dptr->flags & DEV_DIS)
|
if (dptr->flags & DEV_DIS)
|
||||||
sim_cancel (&ttp_unit[TTI]);
|
sim_cancel (&ttp_unit[TTI]);
|
||||||
else sim_activate (&ttp_unit[TTI], KBD_WAIT (ttp_unit[TTI].wait, lfc_poll));
|
else sim_activate (&ttp_unit[TTI], lfc_poll);
|
||||||
sim_cancel (&ttp_unit[TTO]);
|
sim_cancel (&ttp_unit[TTO]);
|
||||||
CLR_INT (v_TTP); /* clear int */
|
CLR_INT (v_TTP); /* clear int */
|
||||||
CLR_ENB (v_TTP);
|
CLR_ENB (v_TTP);
|
||||||
|
|
Loading…
Add table
Reference in a new issue