PDP1: Fix PTP and PTR ASCII Mode from Bob Supnik

ASCII mode for the paper tape reader and punch didn't <quite> work.

In ASCII mode, the <simulator> 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.
This commit is contained in:
Mark Pizzolato 2016-07-13 14:58:11 -07:00
parent 654d106b9d
commit 2425ba55b2

View file

@ -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;
}