From 2425ba55b27d33c46fff1d535ce4e9a7074167dd Mon Sep 17 00:00:00 2001 From: Mark Pizzolato Date: Wed, 13 Jul 2016 14:58:11 -0700 Subject: [PATCH] PDP1: Fix PTP and PTR ASCII Mode from Bob Supnik ASCII mode for the paper tape reader and punch didn't work. In ASCII mode, the must create the leader and trailer. The leader was already there. There shouldn't be nulls in an ASCII file. The whole point is to be able to prepare and look at input and output files with a normal text editor. So this version should work right. It "autogens" trailer more or less forever. It doesn't really need to return a STOP code on EOF, but users would probably forget to put form feed at the end, so it doesn't hurt. --- PDP1/pdp1_stddev.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/PDP1/pdp1_stddev.c b/PDP1/pdp1_stddev.c index 862814c6..255fdfe8 100644 --- a/PDP1/pdp1_stddev.c +++ b/PDP1/pdp1_stddev.c @@ -406,8 +406,10 @@ if (ptr_hold & CW) { /* char waiting? */ } else { for (;;) { /* until valid char */ - if ((c = getc (uptr->fileref)) == EOF) /* get next char, EOF? */ + if ((c = getc (uptr->fileref)) == EOF) { /* get next char, EOF? */ + ptr_leader = PTR_LEADER; /* set up for trailer */ return FIODEC_STOP; /* return STOP */ + } uptr->pos = uptr->pos + 1; /* count char */ c = c & 0177; /* cut to 7b */ if (c == '\n') /* NL -> CR */ @@ -532,11 +534,13 @@ if ((uptr->flags & UNIT_ATT) == 0) /* not attached? */ return IORETURN (ptp_stopioe, SCPE_UNATT); if ((uptr->flags & UNIT_ASCII) != 0) { /* ASCII mode? */ int32 c1 = uptr->buf & 077; - if (c1 == FIODEC_UC) { + if (uptr->buf == 0) /* ignore nulls */ + return SCPE_OK; + if (c1 == FIODEC_UC) { /* UC? absorb */ ptp_uc = UC; return SCPE_OK; } - else if (c1 == FIODEC_LC) { + else if (c1 == FIODEC_LC) { /* LC? absorb */ ptp_uc = 0; return SCPE_OK; }