These are a set of simple utilities I created to recover data from paper tape.

PTR (Paper Tape Reader) reads data from a paper tape reader connected to the
PC printer port and stores it in a raw binary file on the PC. Although designed
and tested with an OAE (Oliver Audio Engineering) OP-80A, it should be able
to work with any reader that presents 8-bits of parallel data, a "Read Data
Available" strobe, and uses an "ACK" pulse to reset for the next byte.

PTR provides several options:

  /A    - Remove ALL 00 bytes from the tape (useful for text tapes which
          have NUL pad characters punched after every newline.
  /L /T - Remove Leading/Trailing 00 bytes (useful to eliminate the unpunched
          Leader/Trailer data).
  /R    - Reverse the data (useful if you have a broken tape - read the
          second half in reverse so that you can use the trailer as a
          leader and avoid losing data).
  /V    - Visual display of tape as it is read.
  /W    - Display parallel port wiring/connection information.
  +M[xx]- Mask input stream - remove specific bits. Default value (7F) is
          useful to remove the unwanted high bit from ASCII tapes.
  +D[xx]- Xor DATA, Default value (FF) is useful if your reader provides
          it's data as logically inverted.
  +A    - Sets the reader ACK to a positive pulse, otherwise PTR will generate
          a negative pulse to ACK each byte.
  +S    - Tells PTR to expect a positive Read Data Available strobe pulse from
          the reader - otherwise PTR will expect a negative strobe.
  P=lpt - Specify the LPT port (1-3) or address where the reader is connected.
          If not specified, PTR will read from the highest available LPT port
          (3-1 - this accomodates people who like me have an easily-replaced
          add-in card as a second LPT port for special hardware interfacing).

PTR can also accept an input filename where it will read it's data instead
of from a physical reader. This is useful if you want to apply the /A, /L,
/T, /R, +M or +D operations to a file that you have already read.

To read a tape, simply start PTR with the name of the file to receive the
data and any options that you want to invoke. Then, start the reader (or
manually pull the tape on manual readers like the OP-80A). When the tape
has been completely read, press ESC to terminate the program and save the
data.


Note that there are no standard ways of performing error detection on paper
tape - error detection is done at a "higher level" by the application using
the data, and differs from one application to another.


To help insure that you get error-free reads, I have also included a "Paper
Tape Compare" (PTC) utility, which compares two paper tape files, ignoring
the leader and trailer, and reporting on any differences in the two data
streams. PTC accepts two filenames, and the following options:

 M=n  - Specifies the number of tape bytes which must Match in order
        for PTC to resynchronize to the tape following a difference
        having been detected. After a difference is found, PTE will
        scan forward on both tape images looking for an area of at
        least this many bytes which matches on both tapes. If such
        an area is found, PTC marks this point as the end of the
        differing area and continues comparing from this point.
 R=n  - PTC will abort if the images to not Resynchronize before
        more than this many bytes are found in a difference area.
 E=n  - If more than this many Errors (differences) occur, PTC will
        abort the compare.
 D=n  - Allows you to Dump this many bytes of tape image data occuring
        at the point of errors (the error location is centered in the
        display).

Until you are very confident in your reader, and even then in cases where
you are archiving the data for historical purposes, I recommend that you
perform several independent reads of the tape, and use PTC to confirm that
the data matches before you consider the data "good".


To further assist in verifying tape images, I have included a "Paper Tape
Viewer" (PTV) utility, which allows you to see a visual representation of
the paper tape image which you can compare to the physical tape. PTR can
also show two images visually, allowing you to line them up for comparison,
and placing indicators at points where they differ.


PTE is a paper tape reader emulator - it reads a paper tape image file
and provides emulation of common paper tape reader interfaces via the
PC serial or parallel ports. PTE accepts the following command line
options:

  -H{...}     - Obtain detailed help
  AC=string   - Automatic Command
                Allows you to specify a series of commands to execute
                when PTE starts up. See -H2 for more information.
  EM={m}      - specifies Emulation Mode, must be one of:
                    PS  - Parallel Strobe only
                    PO  - Parallel, Overlapped ACK
                    PN  - Parallel, Non-overlapped ACK
                    SS  - Serial Stream
                    SX  - Serial with XON/XOFF
                    SH  - Serial with Hardware control
                Use -H{m} for information on each mode.
  ES={v}      - Emulation Speed
                Inserts a delay of {v} milliseconds between each byte
  IM={v}      - data Invert Mask
                XORs data with this mask to invert bits before sending.
  LF=name     - preLoad tape image File
  PI={v}      - Parallel Idle mask
                Specifies value written to LPT control register for idle
                (no strobe) operation.
  PS={v}      - Parallel Strobe mask
                Specifies value written to LPT control register to provide
                a strobe signal.
  PA={v}      - Parallel Ack mask
                Specifies value ANDed with LPT status register to detect
                ACK signal.
  PP=1-3/addr - Parallel Port
                Use 1-3 for LPT1-LPT3, or absolute address.
  SF={f}      - Serial Format
                <Data-bits><Parity: Odd/Even/Mark/Space/None><stop-bits>
                eg: 8N1 = 8-data, No parity, 1-stop
  SH={v}      - Serial Hw flowctl mask
                Specifies value ANDed with serial uart status register to
                detect "OK to send" signal.
  SP=1-4      - Serial Port
                Use 1-4 for COM1-COM4
  SS={v}      - Serial Speed
  XN={v}      - XofF character
                Character to halt transmission from the reader
  XF={v}      - XoN character
                Character to restart transmission from the reader

For more information on PTE options, see the detailed help available with
"PTE ?" and "PTE -H".


Notes:
------
In case you need to modify the PTR program for your reader, I have included
the C source code - this is compiled with my own Micro-C/PC compiler, which
is available from www.dunfield.com - please do not ask me for assistance in
making the program compile with other tools.

These programs are 16-bit DOS programs that are real-time intensive, and
will run best in a DOS environment without excessive TSRs, device drivers
etc. loaded - It may work on Win9X, however note that the non-real-time
nature of these systems may cause read errors. PTR and PTE will NOT work
under WinNT/2K/XP as these systems prevent access to the parallel port.

PTR uses the 8 data lines on the parallel port as inputs - Until you run
PTR at least once, the PC lines will be configured as outputs. This means
that both your reader and the PC will be trying to drive the lines, which
could damage your reader or the PC - To avoid this possibility, I recommend
that you connect the data lines from your reader through 100 Ohm resistors
which will limit the current flow when both devices are trying to drive the
signals.

I have provided a "Parallel Port Debug" (PPDEBUG) utility which can be used
to diagnose problems with the parallel port. It allows you to set and clear
any output signal on the parallel port interface, and to see the input signal
status from the interface. To obtain a list of command line options, use:

    PPDEBUG ?

NOTE: You should press 'F' as soon as you execute PPDEBUG in order to set
the data lines to inputs.
Press ESC to exit PPDEBUG.

Dave Dunfield
http://www.dunfield.com
http://www.classiccmp.org/dunfield
