[comp.os.cpm] MEX1.65 Character Loss

marwood@DMC-CRC.ARPA (G. J. Marwood) (12/29/87)

 
The CP/M system that I use is an Apple ][+ and PCPI Applicard.  While 
developing a new overlay and PCPI driver using interrupts, to avoid the 
usual character loss at high baud rates, I have come across a problem 
which seems to afflict the Apple/Applicard even without interrupts and at 
1200 baud.  At this baud rate, I experience no character loss on screen 
during normal operation.  However, if I invoke a capture file, I do experience
character loss at the place where the capture buffer is being written to disk 
(in this case it is the Applicard add-on Ramdisk).  THis loss occurs both on 
screen and in the captured file and, typically may be half a dozen or so 
characters.  It seems that this bug has always been present in the MEX software
that I have used, though I had not noticed it because I don't usually capture
files as large as the capture buffer (16-17K).  Another local user has done a 
similar test with MEX1.65B and a non-Apple CP/M machine and the loss does not 
occur.  It does not, therefore, seem to be a basic problem with MEX.  If any 
Apple/Applicard user has noticed this before and has any clues about solving 
the problem, I would be interested to know.

                                              Gordon Marwood

bridger%rcc@RAND-UNIX.ARPA (Bridger Mitchell) (12/31/87)

If mex is "smart", it should be polling the modem input status between
each sector-write call in the flushing routine, and buffering any
received characters for "catch-up" processing when the buffer-flushing
is completed.  [Ron Fowler: does mex do this?]  But if not, it's
likely that characters are arriving at the modem port before the
buffer-flushing operation completes.  Unless the arriving bytes are
buffered before they reach mex, the first ones will be overwritten by
the later ones, creating a gap in the input stream received by the mex
software.

The real time required to flush a buffer is system-dependent, probably
dominated by the drive's step rate and the track number of the capture
file, and also affected by the CPU clock rate.  Another system with
faster disks, a faster cpu, or even a differently located file, could
have no lossage.  On your system, if you capture to a ram disk, for
example, there may be no lossage.

Many systems have 1-3 byte buffering in the UART chip that receives
the bytes from the modem; different systems use different UARTS.  More
buffering can be obtained by writing an interrupt-service routine for
the modem ports; only a few bioses have such support, but it may be
possible to write the mex overlay that way.

--bridger