Full 8-Bit Parallel Interface on the Joystick Ports

Type
DIY project
Category
Parallel I/O interface
Manufacturer
Homebrew design (anonymous author, distributed with the JOYPORT text package)

Overview

Several 1980s magazine projects, such as Paul Swanson's printer interface in ANALOG Computing #16, used two joystick ports as a parallel printer port. All of them had the same limitation. PORTA has only eight bits, so one bit has to be given up for handshaking, leaving 7-bit data: fine for plain ASCII, useless for graphics printing or 8-bit devices. This anonymous design, circulated in the JOYPORT text package together with a joystick-port configuration tutorial, delivers a full 8-bit data bus plus four handshake lines from PORTA alone. So it works on XL/XE machines as well as the 400/800. The author used it for an almost complete IEEE-488 interface and for a ham-radio phone-patch controller.

How it works

The trick is to send each byte in two halves:

  1. Joystick port 1 (PORTA bits 0–3) carries a nibble of data.
  2. Two 74LS75 4-bit latches capture the low nibble and then the high nibble. PORTA bits 4 and 5 (on joystick port 2) enable one latch at a time. A single bit would do, but using two is slightly cleaner.
  3. The latch outputs together form the full 8-bit word.
  4. PORTA bits 6 and 7 are left over as outgoing handshake lines, for example a data-valid (DAV) strobe.
  5. The two joystick trigger inputs (pin 6 of each port) don't go through the PIA, so they serve as incoming handshake lines, for example a printer's BUSY or ACK.

The result is 8 data lines out, 2 control lines out and 2 control lines in. A 74LS244 octal buffer sits between the joystick ports and the rest of the circuit to protect the Atari's PIA.

Parts

Ref Part Power pins
IC1 74LS244 octal non-inverting buffer 20 = +5 V, 10 = GND
IC2, IC3 74LS75 quad latch 5 = +5 V, 12 = GND
— two DB-9 female connectors (joystick ports 1 and 2)
PSU 7805 regulator, 9 V 200 mA transformer, 1N4005, 100 µF, 0.01 µF and 25 µF capacitors

Power: don't run it from the joystick port's +5 V pin. The author notes that pin supplies only about 50 mA, and the 74LS244 draws a fair amount, which could cause trouble if other devices also take power from the computer (an SIO-powered printer interface, for example). Build a separate 5 V supply with a 7805. An old cassette-recorder adapter makes a good source.

Joystick pins used: 1–4 data, 6 trigger input, 8 ground. Leave 5, 7 and 9 unconnected.

Programming

Atari BASIC is too slow for this kind of bit-juggling. The original article gives example routines in Action!, and the author remarks that compiled Action! code disassembles into very tidy 6502. To send one byte:

  1. Configure PORTA as all outputs (PACTL to $38, PORTA to $FF, PACTL to $3C). The companion PORTCNFG text in the same package explains this step for beginners.
  2. Write the low nibble to bits 0–3 and pulse the first latch's enable bit.
  3. Write the high nibble and pulse the second latch enable.
  4. Assert the DAV/strobe bit, then wait on a trigger input for the device's acknowledge.

In machine language this is a handful of instructions per byte, which is plenty fast for printers.

Uses

  • A true 8-bit Centronics-style printer port, without an 850 interface.
  • Instrument control (the author's IEEE-488 bus), relay boards, or links to other computers.
  • A learning project in PIA programming. See also Joystick-Port Interfacing for the PIA basics, and the Dual PIA mod for a way to gain a whole extra port on an 800.