From 81fc652d5e67bf7c871bdabc8a70163598c75853 Mon Sep 17 00:00:00 2001 From: Dennis Boone Date: Tue, 27 Jul 2021 14:54:31 -0400 Subject: [PATCH] In-progress work on an option / functionality to _not_ arbitrarily strip off mark parity on AMLC lines. Also, now that they can oocur in the output data stream, manage escaping of telnet IAC characters. THIS WORK IS NOT COMPLETE OR FUNCTIONAL YET. --- devamlc.h | 31 +++++++++++++++++++++++++++++-- em.c | 4 ++-- makefile | 9 ++++++++- 3 files changed, 39 insertions(+), 5 deletions(-) diff --git a/devamlc.h b/devamlc.h index 5c32f8d..eee8f7d 100644 --- a/devamlc.h +++ b/devamlc.h @@ -991,6 +991,7 @@ int devamlc (int class, int func, int device) { if (dc[dx].xmitenabled & BITMASK16(lx+1)) { int n, maxn; unsigned short qtop, qbot, qseg, qmask, qents; + short hasiac; /* This buffer contains an escaped IAC */ ea_t qentea, qcbea; n = 0; qcbea = dc[dx].baseaddr + lx*4; @@ -1019,12 +1020,35 @@ int devamlc (int class, int func, int device) { precludes the use of TTY8BIT mode... */ n = 0; + hasiac = 0; for (i=0; i < maxn; i++) { unsigned short utemp; utemp = get16mem(qentea); - qentea = (qentea & ~qmask) | ((qentea+1) & qmask); +/* qentea = (qentea & ~qmask) | ((qentea+1) & qmask); */ //printf("Device %o, line %d, entry=%o (%c)\n", device, lx, utemp, utemp & 0x7f); +#ifdef NOMASKAMLC + if (((utemp & 0xff) == 0xff) && (dc[dx].ctype[lx] != CT_SERIAL)) + { + if (n != 0) + break; /* Clear the buffer before handling IAC */ + else + { + buf[n++] = 0xFF; + buf[n++] = 0xFF; + hasiac = 1; + qentea = (qentea & ~qmask) | ((qentea+1) & qmask); + break; /* Now ship _just_ the IAC */ + } + } + else + { + buf[n++] = utemp & 0xFF; + qentea = (qentea & ~qmask) | ((qentea+1) & qmask); + } +#else + /* None of the IAC handling matters if we splatter parity */ buf[n++] = utemp & 0x7F; +#endif } } else { @@ -1089,7 +1113,10 @@ int devamlc (int class, int func, int device) { used and Unix buffers get full so writes can't complete */ - qtop = (qtop & ~qmask) | ((qtop+nw) & qmask); + if (hasiac) + qtop = (qtop & ~qmask) | ((qtop+1) & qmask); + else + qtop = (qtop & ~qmask) | ((qtop+nw) & qmask); put16io(qtop, qcbea); if (nw > maxxmit) maxxmit = nw; diff --git a/em.c b/em.c index e39031d..fdb37d1 100644 --- a/em.c +++ b/em.c @@ -2383,8 +2383,8 @@ static ea_t apea(unsigned short *bitarg) { iwea = ea; ea = ip; TRACE(T_EAAP, " After indirect, AP ea = %o/%o, bit=%d %s\n", ea>>16, ea & 0xFFFF, bit, searchloadmap(ea,' ')); - if (ea & 0x80000000) - fault(POINTERFAULT, ea>>16, iwea); +// if (ea & 0x80000000) +// fault(POINTERFAULT, ea>>16, iwea); } if (bitarg != NULL) *bitarg = bit; diff --git a/makefile b/makefile index 5662e3a..29ca409 100644 --- a/makefile +++ b/makefile @@ -33,7 +33,7 @@ trace: $(em_deps) $(all_deps) # the fixed clock rate build is useful for making problems reproduceable. # -# If the emulator crashes on a specific program, run it at the end of +# If the emulator crashes on a specific program, run it at the end of # PRIMOS.COMI to get a more consistent instruction count for the # failure, then enable tracing a little before that with -trace @@ -41,5 +41,12 @@ trace: $(em_deps) $(all_deps) fixed: $(em_deps) $(all_deps) $(CC) -DREV=\"${REV}\" ${CFLAGS} -DFIXEDCLOCK -DNOIDLE -DFAST -O em.c -o em +# Experimental "don't mask off the high bit on amlc lines" build +# +# Let's see if this is breaking e.g. ymodem file transfers. + +nomaskamlc: $(em_deps) $(all_deps) + $(CC) -DREV=\"${REV}\" -DNOMASKAMLC ${CFLAGS} -DNOTRACE -DFAST -O -Winline -Wno-return-type em.c -o em.nomaskamlc + clean: rm -f $(em_objs)