Newsgroups: comp.sys.apple2 Path: blue.weeg.uiowa.edu!news.uiowa.edu!hobbes.physics.uiowa.edu!math.ohio-state.edu!howland.reston.ans.net!news.starnet.net!wupost!waikato!comp.vuw.ac.nz!actrix.gen.nz!dempson From: dempson@atlantis.actrix.gen.nz (David Empson) Subject: Re: Pinout for Joystick Port on Apple IIe ? Message-ID: Sender: news@actrix.gen.nz (News Administrator) Organization: Actrix - New Zealand Internet Service Providers Date: Fri, 27 Jan 1995 12:44:29 GMT References: <3g9akt$r8t@crl7.crl.com> X-Nntp-Posting-Host: atlantis.actrix.gen.nz Lines: 127 In article <3g9akt$r8t@crl7.crl.com>, Derek Wong wrote: > > Could someone please post the pinouts for the joystick port on an AppleIIe? There are two of them (the DB-9 on the back, and the internal 16-pin socket). The internal one is the original game connector, which is identical on the Apple ][, ][+ and all versions of the IIe. The IIgs's game connector is identical except for two signals (see below). The external one is provided on the IIe, IIc and IIgs. The IIc version also supports a mouse. Here are the pinouts for all the variations. DB-9 16-pin Function Notes 2 1 +5 Volts 7 2 Button 0 IIe, IIc, IIgs: Open Apple (Apple) 1 3 Button 1 IIe, IIc, IIgs: Closed Apple (Option) 6 4 Button 2 ][, ][+, IIe: used with shift-key mod IIc: no connection - 5 Strobe Output IIgs: not supported 5 6 Paddle 0 IIc: also used for Mouse X move 4 7 Paddle 2 IIc: Mouse X direction 3 8 Ground - 9 No connection IIgs: Button 3 8 10 Paddle 1 IIc: also used for Mouse Y direction 9 11 Paddle 3 IIc: Mouse Y move - 12 Annunciator 3 - 13 Annunciator 2 - 14 Annunciator 1 - 15 Annunciator 0 - 16 No connection Hardware Notes ============== A joystick should be wired to use Paddle 0 for the X direction and Paddle 1 for the Y direction. The paddle inputs are intended to be used with a 150 Kohm variable resistor between the paddle input and +5V. Low resistance returns a low reading and high resistance returns a high reading. The button inputs should be driven by momentary contact pushbuttons, connecting the appropriate input line to +5V while pressed. There should be no connection to the button input while the button is released. The shift-key mod (switch 2) operates by connecting the shift key to the button input pin. The shift key reads in the opposite state to a button - the bit is clear while the button is down. Note that with the standard shift-key mod (a simple wire), the power supply will be shorted out if the shift key is pressed at the same time as pushbutton 2. This can be avoided by using a low value resistor in series with the wire. (There is no problem with pressing button 0 or 1 at the same time as the Apple or Option key.) The annunciators generate a TTL-level output, which can be set high or low under software control. The strobe output is a TTL-level signal that is normally high, and goes low for half a microsecond when the strobe location is accessed. On the IIgs, this output is permanently high. Software Notes ============== The paddle timing circuits are triggered by reading $C070. Locations $C064 to $C067 can then be monitored to see when the high order bit goes to zero. The time this takes is proportional to the resistance setting of the paddle. There is a standard routine provided in the ROM to read one paddle (PREAD at $FB1E: load X with the paddle number from 0 to 3, and the value is returned in Y). Applesoft BASIC provides the PDL(n) function. With both these routines, false readings may occur unless the software waits long enough between calls to read different paddles. If the paddle is still counting down from the previous reading, it will not be retriggered. (All paddles are triggered at the same time.) Most programs deal with this by separating the reading of the X and Y axis of the joystick, or by using a custom routine to read both paddles at the same time. The button inputs can be sensed in locations $C061-$C063. Bit 7 goes high if the button is pressed. On the IIgs, button 3 can be accessed at $C060 (this is the cassette input on the II+ and IIe). With the shift-key mod installed, the shift key can be sensed by testing for bit 7 of $C062 (button 2) being low. On the IIe, IIc and IIgs, the Apple and Option keys cause bit 7 of $C061 (Apple) or $C062 (Option) to be set. On the IIe and IIc, it is not possible to distinguish a paddle or joystick button from these keys. On the IIgs, the modifier keys can be read from another location, so a press of the button can be identified as long as the corresponding key is not being pressed. A pulse is generated on the strobe output by reading location $C040. This location is unused on the IIgs. The annunciators are controlled by pairs of locations in $C058-$C05F. Reading or writing the lower of the two addresses sets the output off (low). Reading or writing The higher of the two addresses sets the output on (high). I won't go into the IIc mouse support - it is far too complicated. The mouse interface is designed to be able to detect whether a mouse is connected, and this does not interfere with a standard joystick plugged into the game port. -- David Empson dempson@actrix.gen.nz Snail mail: P.O. Box 27-103, Wellington, New Zealand