Newsgroups: comp.sys.apple2.comm Path: news.weeg.uiowa.edu!news.uiowa.edu!hobbes.physics.uiowa.edu!math.ohio-state.edu!sol.ctr.columbia.edu!newsxfer.itd.umich.edu!nntp.cs.ubc.ca!uw-beaver!netnews.nwnet.net!news.clark.edu!lclark!NewsWatcher!user From: drucker@lclark.edu (Ivan Drucker) Subject: plans for simple serial i/o (game port) part 1 Message-ID: Followup-To: comp.sys.apple2.comm Sender: usenet@lclark.edu (News Poster) Nntp-Posting-Host: 149.175.6.233 Organization: Lewis and Clark College, Portland OR Date: Sun, 27 Feb 1994 18:13:36 +0000 Lines: 138 By previous demand from a long time ago, I'm going to reproduce the plans for a simple serial output from the ][/][+/][e 16-pin game port. These originally appeared in the January 1978 Apple ][ Reference manual that was included with the computer back when they gave useful informatin as part of the package. A SIMPLE SERIAL OUTPUT The Apple II is equipped with a 16 pin DIP socket most frequently used to connect potentiometers, switches, etc. to the computer for paddle control and other game applicatins. This socket, located at J-14, has outputs available as well. With an appropriate machine language program, these output lines may be used to serialize data in a format suitable for a teletype. A suitable interface circuit must be built since the outputs are merely LSTTL and won't run a teletype without help. Several interface circuits are discussed below and the user may pick the one best suited to his needs. The ASR-33 Teletype The ASR-33 Teletype of recent vintage has a transistor circuit to drive its solenoids. This circuit is quite easy to interface to, since it is provided with its own power supply. (Figure 1a) It can be set up for a 20mA current loop and interfaced as follows (whether or not the teletype is strapped for full duplex or half duplex operation): a) The yellow wire and purple wire should both go to terminal 9 of Terminal Strip X. If the purple wire is going to terminal 8, then remove it and relocate it at terminal 9. This is necessary to change from the 60mA current loop to the 20mA current loop. b) Above Terminal Strip X is a connector output socket identified as "2". Pin 8 is the input line + or high; Pin 7 is the input line - or low. This connector mates with a Molex receptacle model 1375 #03-09-2151 or #03-09-2153. Recommended terminals are Molex #02-09-2136. An alternate connection method is via spade lugs to Terminal Strip X, terminal 7 (the + input line) and 6 (the - input line). c) The following circuit can be built on a 16 pin DIP component carrier and then plugged into the Apple 16 pin socket found at J-14: (The junction of the 3.3k resistor and the transistor base lead is floating). Pins 16 and 9 are used as tie points as they are unconnected on the Apple board. (Figure 1a). The "RS-232 Interface" For this interface to be legitimate, it is necessary to twice invert the signal appearing at J-14 pin 15 and have it swing more than 5 volts both above and below ground. The following circuit does that but requires that both +12 and -12 supplies be used. (Figure 2) Snipping off pins on the DIP-component carrier will allow the spare terminals to be used for other tie points. The output ground connects to pin 7 of the DB-25 connector. The signal output connects to pin 3 of the DB-25 connector. The "protective" ground wire normally found on pin 1 of the DB-25 connector may be connected to the Apple's base plate if desired. Placing a #4 lug under one of the four power supply mounting screws is perhaps the simplest method. The +12 volt supply is easily found on the auxiliary Video connector (see Figure S-11 or Figure 7 of the manual). The -12 volt supply may be found at pin 33 of the peripheral connectors (see Figure 4) or at the poer supply connector (see Figure 5 of the manual). A Serial Out Machine Center Language Program Once the appropriate circuit has been selected and constructed a machine language program is needed to drive the circuit. Figure 3 lists such a teletype output machine language routine. It can be used in conjunction with an Integer BASIC program that doesn't require page $300 hex of memory. This program resides in memory from $370 to $3E9. Columns three and four of the listing show the op-code used. To enter this program into the Apple II the following procedure is followed: Entering Machine Language Program 1. Power up Apple II 2. Depress and release the "RESET" key. [Note: This is for Rev. 0 Apple ]['s!] An asterick and flashing cursor should appear on the left hand side of the screen below the random text matrix. 3. Now type in the data from columns one, two and three for each line from $370 to 03E9. For example, type in "370: A9 82" and then depress and release the "RETURN" key. Then repeat ths procedure for the data at $372 and on until you cokmplete entering the program. Executing this Program 1. From BASIC a CALL 880 ($370) will start the execution of this program. It will use the teletype or suitable 80 column printer as the primary output device. 2. PR#0 will inactivate the printer transferring control back to the Video monitor as the primary output device. 3. In Monitor mode $370G activates the printer and hitting the "RESET" key exits the program. [Note: I know you don't need to know this, I'm entering it for completion's sake and 'cause I find it amusing...] Saving the Machine Language Program After the machine language program has been entered and checked for accuracy it should, for convenience, be saved on tape - that is unless you prefer to enter it from the keyboard every time you want to use it. The way it is saved is as follows: 1. Insert a blank program cassette into the tape recorder and rewind it. 2. Hit the "RESET" key. The system should move into Monitor mode. An asterick "*" and flashing cursor should appear on the left-hand side of the screen. 3. Type in "370.03E9W 370.03E9W". [Teaching you to back up even then.] 4. Start the tape recorder in record mode and depress the "RETURN" key. 5. When the program has been written to tape, the asterick and flashing cursor will reappear. The Program After entering, checking and saving the program perform the following procedure to get a feeling of how the program is used: 1. Bc (control B) into BASIC 2. Turn the teletype (printer on) 3. Type in the following 10 CALL 880 15 PRINT "ABCD...XYZ0l123456789" 20 PR#0 25 END 4. Type in RUN and hit the "RETURN" key. The text in line 15 should be printed on the teletype and control is returned to the keyboard and Video monitor. Line 10 activates the teletype machine routine and all "PRINT" statements following it will be printed to the teletype until a PR#0 statement is encountered. Then the text in line 15 will appear on the teletype's output. Line 20 deactivates the printer and the program ends on line 25. Conclusion With the circuits and machine language program described in this paper the user may develop a relatively simple serial output interface to an ASR-33 or RS-232 compatible printers. This circuit can be activated through BASIC or monitor levels. And it is a valuable addition to any users program library. Ok. That's all of the text -- all that's left to reproduce is the machine code and the two schematics. I'm debating whether or not to reproduce the whole source with comments, or whether to just do a hex dump -- it'll depend upon how ambitious I'm feeling. I'm not so slick with schematics so we'll see how this turns out with only ASCII to work with. It'll be in the next post. Ivan Drucker drucker@lclark.edu Lewis & Clark College, Portland OR