From e519c93ebf8855a83e8ee95641c8e9a6386f35c7 Mon Sep 17 00:00:00 2001 From: Mark Pizzolato Date: Tue, 8 Jun 2021 14:25:23 -0700 Subject: [PATCH] H316, NOVA, PDP11, PDP8, PDP18B, KX10: Record Sequential updates consistently Devices that do single character I/O could be attached to non seekable host OS devices (tty, pipes, etc.) and thus shouldn't count on fseek() and ftell(). These DEVICEs on these simulators do single character I/O and easily can update their POS REGisters to reflect how much data has been emitted. Changing such a REGister will have no useful effect when attached to a non seekable file. --- H316/h316_stddev.c | 8 ++++---- NOVA/nova_lp.c | 2 +- PDP10/kx10_pt.c | 2 +- PDP11/pdp11_lp.c | 2 +- PDP18B/pdp18b_lp.c | 2 +- PDP8/pdp8_lp.c | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/H316/h316_stddev.c b/H316/h316_stddev.c index cf519a9f..5752f634 100644 --- a/H316/h316_stddev.c +++ b/H316/h316_stddev.c @@ -408,7 +408,7 @@ else { } else if ((uptr->flags & UNIT_ASC) && (c != 0)) /* ASCII? */ c = c | 0200; - uptr->pos = ftell (uptr->fileref); /* update pos */ + uptr->pos = uptr->pos + 1; /* update pos */ } SET_INT (INT_PTR); /* set ready flag */ uptr->buf = c & 0377; /* get byte */ @@ -568,7 +568,7 @@ if (putc (c, uptr->fileref) == EOF) { /* output byte */ clearerr (uptr->fileref); return SCPE_IOERR; } -uptr->pos = ftell (uptr->fileref); /* update pos */ +uptr->pos = uptr->pos + 1; /* update pos */ return SCPE_OK; } @@ -704,7 +704,7 @@ else if ((ruptr->flags & UNIT_ATT) && /* TTR attached */ } else if ((ruptr->flags & UNIT_ASC) && (c != 0)) c = c | 0200; /* ASCII nz? cvt */ - ruptr->pos = ftell (ruptr->fileref); + ruptr->pos = ruptr->pos + 1; } if (ttr_xoff_read != 0) { /* reader stopping? */ if (c == RUBOUT) /* rubout? stop */ @@ -808,7 +808,7 @@ if ((puptr->flags & UNIT_ATT) && /* TTP attached */ clearerr (puptr->fileref); return SCPE_IOERR; } - puptr->pos = ftell (puptr->fileref); /* update pos */ + puptr->pos = puptr->pos + 1; /* update pos */ } } return SCPE_OK; diff --git a/NOVA/nova_lp.c b/NOVA/nova_lp.c index c7f71d56..59de2380 100644 --- a/NOVA/nova_lp.c +++ b/NOVA/nova_lp.c @@ -133,12 +133,12 @@ DEV_UPDATE_INTR ; if ((lpt_unit.flags & UNIT_ATT) == 0) /* attached? */ return IORETURN (lpt_stopioe, SCPE_UNATT); fputc (uptr->buf, uptr->fileref); -uptr->pos = ftell (uptr->fileref); if (ferror (uptr->fileref)) { sim_perror ("LPT I/O error"); clearerr (uptr->fileref); return SCPE_IOERR; } +uptr->pos = uptr->pos + 1; return SCPE_OK; } diff --git a/PDP10/kx10_pt.c b/PDP10/kx10_pt.c index 6a326e3c..842463af 100644 --- a/PDP10/kx10_pt.c +++ b/PDP10/kx10_pt.c @@ -181,12 +181,12 @@ t_stat ptp_svc (UNIT *uptr) return SCPE_OK; } fputc (uptr->CHR, uptr->fileref); /* print char */ - uptr->pos = ftell (uptr->fileref); if (ferror (uptr->fileref)) { /* error? */ perror ("PTP I/O error"); clearerr (uptr->fileref); return SCPE_IOERR; } + uptr->pos = uptr->pos + 1; return SCPE_OK; } diff --git a/PDP11/pdp11_lp.c b/PDP11/pdp11_lp.c index e9fb881b..0410e9ae 100644 --- a/PDP11/pdp11_lp.c +++ b/PDP11/pdp11_lp.c @@ -163,12 +163,12 @@ if (lpt_csr & CSR_IE) if ((uptr->flags & UNIT_ATT) == 0) return IORETURN (lpt_stopioe, SCPE_UNATT); fputc (uptr->buf & 0177, uptr->fileref); -uptr->pos = ftell (uptr->fileref); if (ferror (uptr->fileref)) { sim_perror ("LPT I/O error"); clearerr (uptr->fileref); return SCPE_IOERR; } +uptr->pos = uptr->pos + 1; lpt_csr = lpt_csr & ~CSR_ERR; return SCPE_OK; } diff --git a/PDP18B/pdp18b_lp.c b/PDP18B/pdp18b_lp.c index 0db2ec41..b7ab1d1e 100644 --- a/PDP18B/pdp18b_lp.c +++ b/PDP18B/pdp18b_lp.c @@ -623,12 +623,12 @@ c = uptr->buf & 0177; /* get char */ if ((c == 0) || (c == 0177)) /* skip NULL, DEL */ return SCPE_OK; fputc (c, uptr->fileref); /* print char */ -uptr->pos = ftell (uptr->fileref); /* update position */ if (ferror (uptr->fileref)) { /* error? */ sim_perror ("LPT I/O error"); clearerr (uptr->fileref); return SCPE_IOERR; } +uptr->pos = uptr->pos + 1; /* update position */ return SCPE_OK; } diff --git a/PDP8/pdp8_lp.c b/PDP8/pdp8_lp.c index 092758b6..d352e825 100644 --- a/PDP8/pdp8_lp.c +++ b/PDP8/pdp8_lp.c @@ -149,12 +149,12 @@ if ((uptr->flags & UNIT_ATT) == 0) { return IORETURN (lpt_stopioe, SCPE_UNATT); } fputc (uptr->buf, uptr->fileref); /* print char */ -uptr->pos = ftell (uptr->fileref); if (ferror (uptr->fileref)) { /* error? */ sim_perror ("LPT I/O error"); clearerr (uptr->fileref); return SCPE_IOERR; } +uptr->pos = uptr->pos + 1; return SCPE_OK; }