C/PMuseum
Little Bits of Computing History
Home Tour Library Info

You are here: Home -> Tour -> 7603 Apple Lane -> Apple-1 (Not So Super) Serial-1

Apple-1 (Not So Super) Serial-1 


DIY


This project began in late January 2006, after purchasing an Apple-1 replica kit on eBay, and shortly thereafter failing to win an eBay auction for a Briel Computing serial interface.  Reading the description of how the interface and the Apple-1 I/O in general work in the book "Apple-I Replica Creation, Back to the Garage" by Tom Owad, I became intrigued with the idea of building an interface that was similar in functionality, but built the way I would have built it with the parts and knowledge I had access to back around the time the Apple-1 was released.  (There's just something about throwing a PIC processor that has more horsepower than the entire Apple-1 into an interface card that somehow feels, to me anyway, like "cheating" - no offense intended, Vince!)

I also had the very good fortune of finding a vintage AY-3-1015 UART and AY-5-8116 baud rate generator in my old parts collection (I used to build serial based hardware devices regularly) so I chose those devices at the starting point for this project.   (I could have used a 6550 UART designed for the 6502, which would also have been "period" - but because this design is really talking to the I/O pins of the 6820 PIA, not directly to the processor address and data busses, and because it was desirable to have the device function without program or firmware changes, it was actually advantageous to use the 1015, which has separate pins for data input and output, and can be "programmed" externally without CPU instructions to load control registers or set operating modes.)

Although I did subsequently get a Briel serial interface, it turned out that I still had a motivation to complete this project (beyond the natural curiosity anyone would have as to whether something they designed would or would not actually work.)   In corresponding with Vince, he explained to me that the reason that there were no �settings� on the serial card were because it could only operate at 2400 baud, in order to match the speed of the video section of the Apple-1, and thus avoid character loss.   This was a devastating blow to me, as even though in studying the Apple-1 schematics I came to understand why this would be the case (the timing of the 74123 at B3 cannot be modified without breaking things) it meant that I was still unable to achieve my �holy grail�, which is to use my Teletype ASR-33 to load Apple BASIC from and store programs to punched paper tape.

So, long story short, I applied the age old principle "necessity is a mother" and I "invented" this design, which in testing reliably supports baud rates below 2400 all the way to 110 (Teletype speed) and with a minor modification should also be able support baud rates up to 28.8Kbps, by implementing hardware "flow control". (28,800 is the published speed limit of an AY-3-1015 UART - with a 6402 in place of the 1015 baud rates up to 115,200 should be achievable.)  With a couple additional gates the interface could even support hardware flow control on the outbound side, meaning the external device could also utilize hardware flow control to indicate its ready/busy state.

HOW IT WORKS
(NOTE: At the bottom of this page the Library Documents section contains links to the actual schematics for this project, as well as IC spec sheets.  Before reading the detailed description you may want to download those schematics, as well as the schematics contained in the original Apple-1 manual.  You may also want to consider reading Tom Owad�s Apple-I Replica Creation book as mentioned above, it contains a tremendous amount of background info and insight that will help in the understanding of the following explanation.)

This (as well as Vince Briel's) serial card is not so much an "expansion" board (like the Apple-][ Super Serial card) but a "piggyback" onto the Apple-1 I/O circuit responsible for keyboard input and display output.  This is made possible because the Apple-1 does not have "memory mapped" video like the Apple-][, but instead uses a "tv typewriter" that behaves much like a terminal or TTY.  So the Apple-1 sends characters to the display one at a time, sequentially, and the only "cursor positioning" command the display recognizes is a CR, which causes the cursor to drop to the beginning of the next line.  (The logic for this is "hard wired" in gates at C5 & C6 in the display section of the Apple-1.  If you look at the schematic carefully, you will make out logic to decode 0x8D on the data lines!)  In the processor section of the Apple-1, it is the 6820 (or in the case of a replica, 6821) PIA which is responsible for communicating with the display section and keyboard, sending one character at a time out the "B" port of the PIA (with some handshaking described later in this article) and accepting characters from the keyboard on the "A" port.

Since the signals from the PIA are not present on the actual Apple-1 expansion bus, the easiest way to implement a serial interface is to "piggyback" onto the 6820, stealing the signals used to communicate with the display to provide serial output, and making serial input appear to the PIA as keyboard input.  The simplest way to do that is to construct a board that plugs in to the PIA socket (either via a "piggyback board", or via a ribbon cable) and then holds the actual PIA.  On the board virtually all of the "piggyback" or ribbon cable pins go directly to the matching pins on the PIA - to implement this interface it is only necessary to "cut" or intercept and modify two input pins on the PIA, plus 8 keyboard data lines.  All of the remaining signals used are monitored by the serial logic, but pass between the PIA and the motherboard otherwise unmodified.

Another aspect of a serial interface is the requirement for a negative voltage source (and technically a higher positive source than +5) to power the "driver" chip for RS232 output.  MAX232 chips are available today that accomplish this using only a single 5 volt power supply (using capacitors as voltage "pumps") but since I was striving to build as pure a "period" piece as possible, and MAX232 chips were certainly not available in 1977, I chose to stick with the old favorite 1488 and 1489 driver/receiver pair.  This required me to also tap the keyboard connector of the Apple-1, which provides +12 and -12 in addition to the +5 supply for the keyboard.  As you will see, in my original "piggyback" design I accomplished this by making the board such that it had two piggyback connectors, one for the 6820 and one for the keyboard.  However, this proved to be mechanically cumbersome to install (very difficult to get both sockets lined up simultaneously) so in my revised design I used a separate board with a ribbon cable to the PIA socket, and added to the board a pair of 16 pin sockets for keyboard in and out.  Since I had previously been using a "keyboard translator" to adapt the Keytronics keyboard to the Apple-1 keyboard pinout anyway, I decided to kill two birds with one stone and also build the keyboard translation into the revised board.  To avoid making the board specific to Keytronics keyboards I added a DIP header which can be "programmed" with jumper wires to match any keyboard pinout.  That way the card can be used to both provide serial I/O and adapt the keyboard pinout to any ASCII keyboard.  (Of course, you could always build your board using the MAX232 rather than the 1488/1489 pair, and eliminate the need to touch the keyboard connector at all.)

One other requirement for serial communication is a clock source, or "baud rate clock", which is used by the UART to control the speed of serial data.  Although most modern UARTs contain built-in baud rate generators, many old UARTs (including the one used in this project, an AY-3-1015) require an external baud rate clock source, which must be 16x the actual baud rate.  Although I happened to have an AY-5-8116 lying around in my parts bin, it is virtually impossible to find a source for baud rate clock chips today, so in the schematics I have included a "poor mans" baud rate generator suitable for basic baud rates from 9600 to 300.  If you are building this project yourself a suitable substitute for the AY-3-1015 UART is a 6402 UART, which (as of March 2006, at least) is still available from Jameco.  (Footnote:  As of April 2006, a several sets of AY-3-1015 and AY-5-8116 chips, along with the right crystal, have come up for sale on eBay, I purchased one set {to replace the ones I used from my collection for this project!} and they worked, so that might be another way for you to get the real thing.)

DETAILED THEORY OF OPERATION
The serial card actually performs two completely separate and distinct functions, taking serial input and causing it to appear to the PIA as keyboard input, and taking data from the PIA destined for the display and outputting it serially.  Please note that the following explanation assumes a fairly detailed understanding of how the Apple-1 display and keyboard operate.  (As mentioned above, the book "Apple-I Replica Creation - Back to the Garage" by Tom Owad, available at Amazon and other sources, is an excellent resource from which to gain a better understanding of the inner workings of the Apple-1.)

SERIAL INPUT
1/4 of a 7400 is used to invert the STROBE signal from the actual keyboard (MB pin 40) and the inverted signal is fed to one side of another 1/4 of the 7400, whose output goes to pin 40 on the actual PIA.  (The other side of the 2nd 7400 allows the UART to activate the strobe independently of the keyboard.)  The actual keyboard data (MB pins 2-9) are routed to the input side of a 74244 octal tri-state buffer, which is then routed to the actual PIA.  This makes the keyboard data lines tri-state, allowing the keyboard to be taken off of the PIA input lines when the UART is presenting received data. 

The UART itself operates as follows: When data is received, DR is raised to signal data availability in the receive buffer. This triggers the positive input of the first stage of a 74123 one-shot, which provides a negative strobe pulse which, OR�d with the keyboard strobe at the 2nd 7400 above, provides the keyboard strobe to the PIA on pin 40.  It also is used to gate the UART received data output on  RRD, causing the UART to present it's data to the PIA while the strobe is active, while simultaneously the positive output of the one-shot is used to gate the 74244, tri-stating the keyboard lines while the UART outputs its data.  The rising edge of the negative output pulse of the first stage triggers the positive input of the second stage of the 74123 one-shot, which in turn provides a negative output pulse to DRR, which tells the UART we have accepted the data and allows it to move the next character onto the receive data lines, and causes it to reset DR. Thus it is the timing of the first stage of the one-shot that controls the duration of the pseudo-keyboard strobe, and the timing of the first and second stage together that controls how quickly the receive buffer is flushed to be able to receive new data. The system itself does not in any way attempt to throttle the speed of data received, so if the speed of received data exceeds the timing of the 74123 then character overrun will occur.  (If running at baud rates above 2400, set your terminal program to "pad" between characters if you are sending a stream of data, to avoid overrun.  No flow control is provided, in this design, although simply routing DR through the RS232 driver would result in a "busy" signal that most devices would recognize on CTS or DSR if they support "hardware" flow control.)

SERIAL OUTPUT
Outputting serial data is actually quite a bit simpler.  When the Apple-1 wants to send a character to the display the PIA drops CB2 (which is inverted in C15 to create DA to the display) and the display acknowledges by dropping RDA when it's timing is correct, which toggles a 74123 one-shot to provide a 3.5us low strobe to CB1, which causes the PIA to output the data to the display and reset CB1.  Coincidentally the UART is also looking for a low strobe on TRBL to tell it to load a character for transmission, so by simply tying CB1 (PIA pin 18) directly to TRBL the same strobe that causes the PIA to output the data to the display causes the UART to simultaneously load it.  Upon the rising edge at the end of the strobe the UART transfers the data to an internal buffer and begins transmission.

The baud rate restriction on the output side is that the UART must complete transmission of the character before the Apple-1 sends the next character to the display, or else the UART is not ready to accept the character and data loss will occur.  (OK, technically the UART has a one character internal buffer, it can accept the second character right away - but the third character gets lost, etc.)  I struggled unsuccessfully with several solutions that involved modifying the timing or duration of the pulse on CB1 (my original board actually had three piggyback sockets, the PIA, the keyboard, and the 74123 next to the keyboard connector at B3!) but as Vince pointed out that timing was critical to the display and couldn't be altered without breaking things.  However, in the end the answer was to "cheat" and take a different approach...  In the original design, DA (inverted CB2) is fed back to PB7 (PIA pin 17) and the code always checks the state of PB7 before sending a character, to insure that the display has accepted the last character before the Apple-1 attempts to send the next.  So, by simply taking the signal TRE (Transmit Register Empty, the signal from the UART that the character loaded has been transferred to the buffer and the UART is ready to accept another character) along with CB2 thru another 1/4 of a 7400, and feeding that back to the PIA on pin 17 instead of DA, the result is that PB7 will be high when EITHER the display is in the process of accepting a character OR if the UART is not ready to accept another character.  Thus the monitor will behave as if the display has suddenly gotten much slower, but data loss to the serial device does not occur.  I have tested this reliably all the way down to 110 baud.  (For my TTY ASR-33, of course!)

Note that to provide the capability to accept serial input from slow devices (such as a TTY paper tape reader) without slowing down the Apple-1 display, I added a jumper, which I later changed to a toggle switch, which simply disconnects CB1 (PIA pin 18) from TRBL on the UART, thus disabling the UART output.  Since the UART never loads the character it never goes busy, and the display is allowed to operate at full speed while the UART continues to process incoming characters.

CONSTRUCTION NOTES

Power supply connections to all but the 1488 and 1489 IC's are not illustrated on the schematics.  They are as follows:
7400: GND = Pin 7, +5 = Pin 14
74244: GND = Pin 10, +5 = Pin 20
74123: GND = Pin 8, +5 = Pin 16
AY-3-8113: GND = Pin 11, +2 = Pin 2
AY-5-1015: GND = Pin 3, +5 = Pin 1
74HC4060: GND = Pin 8, +5 = Pin 16

Note that +5 can be derived from PIA pin 1, and GND from Pin 20, or if the keyboard connector is being tapped for +12 and -12, GND and +5 can be obtained from pins 9 and 16 of that connector respectively.

Consult the chip documentation for the values of the 4 UART and 4 baud rate jumpers/switch settings.  In this design I leave CLS2 (Pin 37) of the UART tied permenantly high, since low on CLS2 would select 5 or 6 bit data format, which is not useful for the Apple-1.  Thus CLS1 selects 7 bits (present) or 8 bits (absent), SBS selects 1 stop bit (present) and 2 stop bits (absent.), PI selects Parity Enabled (present) or No Parity (absent), and, if PI is present, EPE selects ODD Parity (present) or Even Parity (absent).  For most applications, SBS will be the only jumper installed, resulting in 8 data bits, no parity, one stop bit.  The jumper at JP9 is shown to allow the serial interface to receive 8 bit data, if the jumper is not present then the 8th bit is tied high thru a pullup resistor, which is what the Apple-1 monitor is expecting.  If 8 bit input is desired the jumper can be added, if present the UART 8th data bit will be passed to the Apple-1 as received.  (Or low, if a 7 bit data format is selected.)

For the actual serial connector I used an 8 pin header same as I used for the word format and baud rate jumpers, and a mating 8 pin connector wired to the DB25 serial connector via a short length of multiconductor cable.  Because I am a fanatic for RS232 "simplicity" and "correctness", in addition to the basic TXD, RXD and GND (which are the only pins absolutely required) not shown on the schematic I also tied 2A & 3A (pins 4 & 9) low, and tied the resulting output pins 2Y and 3Y (pins 6 and 8) to 2 unused pins on the 8 pin header, thus giving me a total of 5 pins to the DB25 (GND, TXD, RXD, and 2 "tied high" signals.)  To wire the connector DTE, like a PC or terminal, TXD ties to pin 2, RXD pin 3, one of the "high" lines to RTS pin 4, GND to 7, and the other "high" line to DTR (pin 20).  This allows connection to a modem or other DCE device with a straight thru cable, but requires a "null modem" cable to communicate directly with a PC or terminal.  To configure the serial connector to be PC or terminal ready, wire RXD to pin 2, TXD to pin 3, one of the high signals to CTS pin 5, the other high signal to DSR pin 6, and GND to Pin 7.  If you use a male DB25 connector, you can plug that cable directly in to your 25 pin PC serial port with a straight thru cable, or into your 9 pin PC port with a standard off-the-shelf 25 to 9 pin serial adapter available at the local Best Buy or Radio Shack.  (If you really want to wire the connector with a DB9 PC-style connector I leave it to you to translate the pinouts, since the DB9 PC serial standard wasn't developed until nearly 5 years after the release of the Apple-1 the idea of wiring a PC connector direcly to this card goes against my nature.  In 1976 ALL my serial connections were DB25, and this prototype remains true to that standard.)  On the first prototype I only used the 5 wires out of the 8 pin header, on the second prototype I came up with an idea (actually inspired by the reversable header on the Apple-][ Super Serial Card) which was to use all 8 pins on the connector and lay them out opposite, so that by plugging in the serial connector one way the DB25 appears DCE, and simply reversing the cable and plugging it in the other way the DB25 appears to be DTE instead.

Also not shown on the schematics, but present on the prototype, are 3 discreet LED's hooked up to the UART pins PE, FE, and OE (pins 13, 14, and 15) and tied to ground thru 330 ohm resistors.  If there is a mismatch between the serial card jumper settings and the device it is communicating with it will typically apear as a PE (Parity Error) or an FE (Framing Error).  If the OE (Overrun Error) light comes on, it is an indication that the UART is receiveing data too quickly from the external device, and either additional "padding" between characters should be added, or the baud rate reduced.  (At 9600 baud I find that a Hyperterminal setting of 100ms between characters, and 500ms at line end, results in the ability to load BASIC with no lost characters.)

To avoid adding power-on reset circuitry (which isn't present on the Apple-1 either!) in the schematic the UART Master Reset (MR) is tied thru an inverter to RES on the PIA.  (The PIA uses a low signal for reset, the UART requires a high reset pulse.)  In the first prototype I originally tried tapping the keyboard connector CLR (KBD pin 12) instead, since that signal is already the correct polarity for the UART and did not require inversion.  However, very strange problems occurred in initial testing that ended up coming down to the UART resetting inappropriately at the end of line.  (I still don't know why, I just know it shows up on the logic probe.)   Even with a very low value (100 ohm) pull down resisor tied directly to the UART pin 21 the problem still occurred, so I ended up changing it to the inverted RES signal and the problem cleared right up.

As mentioned above, this design has morphed through several incarnations.  The first incarnation (not shown here) was scrapped when I realized that it was pointless to piggyback B3, the second one is the working proof of concept test bed shown in the pictures and action footage, and the third and final one incorporates all of the lessons I learned from the first two, plus the mechanical knowledge I gained (piggybacking multiple connectors is bad, ribbon cables are better), as well as incorporating the keyboard matrix translation and DIP header into the board.

CONCLUSION
Beyond the schematics, and pictures of my prototypes as example, I leave it to you, the builder, to design your own board layout based on your requirements.  If you are one of those fortunate people with the skills and resources to realize this as a printed circuit board, bless you.  I tend to be a "quick and dirty" breadboard builder, I could see within a short time of starting the actual wiring on the second prototype that I could have done a much better job of laying out the chips to reduce the number of long cross-board interconnects, and the final prototype reflects that, although I'm sure many of you would still do much better (especially if you tend to think in terms of actual PCB layout!)  The circuit could also undoubtedly be improved in terms of making it more "bulletproof", in particular no attempt is made here to handle the conflict if data comes in from the keyboard and serial device simultaneously (other than the 74244 prevents both devices from physically shorting together) and as mentioned there is no flow control implemented on either the incoming or outgoing data - although the addition of a few more gates could undoubtedly provide either.

If you look closely at the pictures of the prototype, you will also notice that, because I also piggybacked the keyboard connector, I chose to "intercept" the 8 keyboard data lines and the strobe at the keyboard connector, thus as you look at the PIA only 1 pin is not connected, not 10 as described above.  I did this at the last minute to reduce the number of wires running all the way across the UART to the PIA socket, based on the way I laid out the board.  (The end result is the same, the Apple-1 board connects those pins together anyway.)  You could, of course, implement the same construction in your design, if desired.  (Or just lay the board out more efficiently to start with!)


A better wrap up to this article is coming soon, meanwhile I hope you enjoy this project, and encourage you to post any questions or comments in the Apple-1 message board at applefritter.com, where they can be shared/enjoyed by all.

REFERENCE MATERIAL

  • Parts List
    (1) AY-3-1015 UART (or 6402 or equivalent)
    (1) AY-5-8116 Baud Rate Generator
    Substitute (1) 4060 or 74HC4060 if AY-5-8116 unavailable
    (1) 1488
    (1) 1489
    Substitute (1) MAX232 for 1488 and 1489 if 5 volt only operation is desired
    (1) 74123
    (1) 74244
    (1) 7404
    (7) 10K resistors
    (1) .001uF capacitor
    (1) .020uF capacitor (.018 actual worked best in testing)
    (2) 40 pin sockets
    (1) 40 pin ribbon cable
    (1) Crystal*
    * For AY-5-8116, use 5.xxx MHz crystal
    For 4060, use 2.xxx crystal for 1200-9600 baud,
    or 3.xxxx crystal for 110 baud
    (1) 16 pin socket (optional), 2 if 4060 baud rate generator option used)
    (3) 14 pin sockets (optional)
    (1) 20 pin socket (optional)
    (1) 18 pin socket (optional, omit if 4060 baud rate generator option used)
    (3) 8-pin DIP headers
    (or one 16-pin DIP switch array, and connector of your choice for serial)

    If keyboard "tap" (for +/-12 volt) desired, add:
    (2) 16 pin sockets
    (1) 16 pin ribbon cable

    If keyboard adapter is desired add:
    (1) 28 pin socket
    (1) 28 pin DIP header
    (1) 28 pin DIP header cover (optional)

    PLEASE NOTE: Like all DIY exhibits on this site, the information contained herein is strictly for educational/entertainment purposes, no warranty is offered nor is the information within guaranteed to be suitable for yours or any other use.  (In other words folks, it worked for me, but do it yourself at your own risk, because I won�t be able to help you if you break your Apple!)


Image Gallery
NOTE: Images beginning with 100 and up are larger versions of the same numbered lower resolution images +100.  Not all images appear in high resolution format.

000 Serial-1 Prototype-1 (jpg, 79 KB)

001 Serial-1 Prototype-1 Rear (jpg, 173 KB)

002 Serial-1 Prototype-1 Side (jpg, 66 KB)

003 Serial-1 Prototype-1 Side2 (jpg, 76 KB)

004 Serial-1 Prototype-1 Bottom Angle (jpg, 98 KB)

005 Serial-1 Prototype-1 Bottom Edge (jpg, 58 KB)

006 Serial-1 Prototype-1 With Cable (jpg, 241 KB)

007 Serial-1 Prototype-1 UART Removed (jpg, 140 KB)

008 Serial-1 Prototype-1 Installed A (jpg, 322 KB)

009 Serial-1 Prototype-1 Installed B (jpg, 150 KB)

010 Serial-1 Prototype-1 Installed C (jpg, 322 KB)

011 Serial-1 Prototype-1 Installed D (jpg, 329 KB)

012 Serial-1 Prototype-2 (jpg, 288 KB)

013 Serial-1 Prototype-2 Angle (jpg, 171 KB)

014 Serial-1 Prototype-2 Rear (jpg, 215 KB)

015 Serial-1 Prototype-2 Rear Angle (jpg, 152 KB)

016 Serial-1 Prototype-2 With Ribbon And Header (jpg, 322 KB)

017 Serial-1 Prototype-2 Installed A (jpg, 270 KB)

018 Serial-1 Prototype-2 Installed B (jpg, 268 KB)

019 Serial-1 Prototype-2 Installed C (jpg, 151 KB)

020 Serial-1 Prototype-2 Installed D (jpg, 167 KB)

021 Serial-1 Prototype-2 DCE Mode (jpg, 304 KB)

022 Serial-1 Prototype-2 DTE Mode (jpg, 311 KB)

023 Both Apple-1s Serial Installed (jpg, 196 KB)

024 Action Shot ADM-3A Used To Key Test Program (jpg, 191 KB)

025 VIDEO Action Shot With ADM-3A (asf, 2.7 MB)

100 Serial-1 Prototype-1 LG (jpg, 280 KB)

101 Serial-1 Prototype-1 Rear LG (jpg, 371 KB)

102 Serial-1 Prototype-1 Side LG (jpg, 303 KB)

103 Serial-1 Prototype-1 Side2 LG (jpg, 499 KB)

104 Serial-1 Prototype-1 Bottom Angle LG (jpg, 542 KB)

105 Serial-1 Prototype-1 Bottom Edge LG (jpg, 292 KB)

106 Serial-1 Prototype-1 With Cable LG (jpg, 1.0 MB)

107 Serial-1 Prototype-1 UART Removed LG (jpg, 476 KB)

108 Serial-1 Prototype-1 Installed A LG (jpg, 2.3 MB)

109 Serial-1 Prototype-1 Installed B LG (jpg, 436 KB)

111 Serial-1 Prototype-1 Installed D LG (jpg, 2.3 MB)

112 Serial-1 Prototype-2 LG (jpg, 1.0 MB)

113 Serial-1 Prototype-2 Angle LG (jpg, 1.0 MB)

114 Serial-1 Prototype-2 Rear LG (jpg, 741 KB)

116 Serial-1 Prototype-2 With Ribbon And Header LG (jpg, 1.0 MB)

117 Serial-1 Prototype-2 Installed A LG (jpg, 2.0 MB)

118 Serial-1 Prototype-2 Installed B LG (jpg, 2.1 MB)


Library Documents
Serial-1 Schematic (pdf)
All documents and IC spec sheets


Related Web Resources
Apple-1 Users Group at Applefritter.com
Briel Computers website


Go to the main exhibit (Apple-1 Prototype)
C/PMuseum (2006) - The information on this website may be freely distributed.  Please contact "Curator" at this domain with any comments regarding this site.