Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

PC joystick for apple?

654 views
Skip to first unread message

Rooted

unread,
Dec 25, 2013, 11:46:12 PM12/25/13
to
Hi, i recently found an old but very good condition analog pc joystick at
the local thrift store. I would like to know if there is an easy
modification that can be done to use this on a iigs. The box for this
joystick states analog, and the joystick has centering dials much like what
apple had on their joysticks, but this one has the 15 pin connector. Since
this joystick has centering adjustments can i simply build a 15 to 9 pin
adapter can call it a day? or will i have to use resistors and/or cap to
make it suitable for the iigs? I would rather not do the latter but if i
have to i will. anyways any feedback is always appreciated.

joystick information:

Suncom technologies: Analog Edge II high performance joystick

http://i.ebayimg.com/t/Analog-Edge-II-High-Performance-Joystick-Never-Used-/00/s/MTEzMlgxNDgx/z/h7AAAMXQWzNSitYB/$_35.JPG

Michael J. Mahon

unread,
Dec 26, 2013, 1:13:29 AM12/26/13
to
To get the full 0..255 range from the joystick, you'll need to add two
small capacitors, one for each axis, from the respective paddle input pin
to ground. Each capacitor should be about half the value of the capacitor
built into each paddle input.

This will compensate for the fact that the maximum resistance of each
joystick axis is only 100kohms instead of the Apple standard 150kohms.

If you put another 50k in series with the axes, your range will be about
80..255 (which isn't much better than the unmodified range of 0..175).

If you don't need the full range of control, you may be able to get by by
adjusting the centering adjustments if they have enough range.
--
-michael - NadaNet 3.1 and AppleCrate II: http://home.comcast.net/~mjmahon

osgeld

unread,
Dec 26, 2013, 8:11:19 PM12/26/13
to
> To get the full 0..255 range from the joystick, you'll need to add two
>
> small capacitors, one for each axis, from the respective paddle input pin
>
> to ground. Each capacitor should be about half the value of the capacitor
>
> built into each paddle input.

or if you want to be nerdy about it

((original_potentiometer_value * internal_timing_capacitor) / new_potentiometer_value) – internal_timing_capacitor

I think the timing cap in the IIc, and probally the GS is 22nf sooooo

((150,000 * 0.022) / 100,000) - 0.022 = 0.011

or about half lol, but knowing how to get there is half the battle. Caps are not too accurate so just grab a 10nf (0.010uf, or code 103) ceramic cap for each axis and you will be in biz for full range


Toerless Eckert

unread,
Dec 29, 2013, 8:26:57 AM12/29/13
to
I just modded an old analog PC joystick for the apple over christmas
following the instructions on the FAQs. capacitor in series with
a 500kOhm resistor. Also, the push buttons need additional
reistors according to the FAQ.

The joystick itself had also these type of adjustment wheels that
yours seem to have too, so with the help of those and the adjustale
500k resistors, i managed to get the range between 0 and 255 and 127
on the midpoint. Pretty happy.

Michael J. Mahon

unread,
Dec 30, 2013, 1:08:33 AM12/30/13
to
"Toerless Eckert" <toerles...@gmail.com> wrote:
> I just modded an old analog PC joystick for the apple over christmas
> following the instructions on the FAQs. capacitor in series with
> a 500kOhm resistor. Also, the push buttons need additional
> reistors according to the FAQ.

That sounds incorrect.

> The joystick itself had also these type of adjustment wheels that
> yours seem to have too, so with the help of those and the adjustale
> 500k resistors, i managed to get the range between 0 and 255 and 127
> on the midpoint. Pretty happy.
>
>
>> Rooted <mod...@gmail.com> writes:
>> Hi, i recently found an old but very good condition analog pc joystick at
>> the local thrift store. I would like to know if there is an easy
>> modification that can be done to use this on a iigs. The box for this
>> joystick states analog, and the joystick has centering dials much like what
>> apple had on their joysticks, but this one has the 15 pin connector. Since
>> this joystick has centering adjustments can i simply build a 15 to 9 pin
>> adapter can call it a day? or will i have to use resistors and/or cap to
>> make it suitable for the iigs? I would rather not do the latter but if i
>> have to i will. anyways any feedback is always appreciated.
>
>> joystick information:
>
>> Suncom technologies: Analog Edge II high performance joystick
>
>> http://i.ebayimg.com/t/Analog-Edge-II-High-Performance-Joystick-Never-Used-/
> 00/s/MTEzMlgxNDgx/z/h7AAAMXQWzNSitYB/$_35.JPG


root

unread,
Jan 1, 2014, 3:55:33 AM1/1/14
to
Michael J. Mahon <mjm...@aol.com> writes:

>"Toerless Eckert" <toerles...@gmail.com> wrote:
>> I just modded an old analog PC joystick for the apple over christmas
>> following the instructions on the FAQs. capacitor in series with
>> a 500kOhm resistor. Also, the push buttons need additional
>> reistors according to the FAQ.

>That sounds incorrect.

http://apple2.org.za/gswv/a2zine/faqs/Csa2KBPADJS.html#005

look for the 680 Ohm resistor text. The book "Inside the apple 2" also
shows resistors inside the joystick/paddle, albeit slightly
lower ohm value.

Michael J. Mahon

unread,
Jan 1, 2014, 12:32:25 PM1/1/14
to
The entry you cite is for converting an Apple joystick to work with a PC,
not the other way around.

And any "conversion" involving wiring a 500K resistor in series with a
capacitor is incorrect.

The relatively low-value pulldown resistors for the pushbuttons are fine,
but unrelated to the "paddle" range.

option8

unread,
Jan 1, 2014, 2:04:18 PM1/1/14
to
i think the correct link is this one:
http://apple2.org.za/gswv/a2zine/faqs/Csa2KBPADJS.html#004

the 500K resistors mentioned are trim potentiometers for tuning.

i'm tempted to give it a shot myself, if only because PC joysticks are a lot easier (and cheaper) to come by.

Michael J. Mahon

unread,
Jan 1, 2014, 6:47:45 PM1/1/14
to
option8 <opt...@gmail.com> wrote:
> i think the correct link is this one:
> http://apple2.org.za/gswv/a2zine/faqs/Csa2KBPADJS.html#004
>
> the 500K resistors mentioned are trim potentiometers for tuning.

Any series resistance messes with the intended function of the timer
circuit, since the added capacitor must be DIScharged rapidly at the end of
the timing period, and series resistance will prevent that, causing the
measured paddle value to depend not only on the paddle resistance, but also
on the time elapsed between readings.

If trimming the maximum value is needed, the value of the capacitor should
be changed slightly, if necessary, by paralleling a small value capacitor
(say, 0.001uF) to enable reaching 255.

Having a small "dead band" at the high end, all reading 255, is more
desirable than not being able to reach 255.

Too many Apple "hacks" reflect a "cut and try" approach rather than proper
analysis and design. ;-(

BTW, the value of the pulldown resistors, here specified as 680 ohms, is
non-critical. Anything from 220 ohms to 750 ohms should be fine. (In other
words, use what you have at hand.)

> i'm tempted to give it a shot myself, if only because PC joysticks are a
> lot easier (and cheaper) to come by.


osgeld

unread,
Jan 2, 2014, 12:33:27 AM1/2/14
to
On Wednesday, January 1, 2014 5:47:45 PM UTC-6, Michael J. Mahon wrote:
when I did the trimpots in my apple II thumbstick on hack-a-day I put trimpots in parallel with the joystick pots in order to trim the resistance of said thumbsticks

nothing as far as resistance should go should be in series as it does mess with the timing discharge charge patterns you are trying to preserve

osgeld

unread,
Jan 2, 2014, 12:34:06 AM1/2/14
to

Michael J. Mahon

unread,
Jan 2, 2014, 2:45:34 AM1/2/14
to
Yes--that's a poor/incorrect circuit design, for the reasons I stated.

A lot of things are on the Internet that "seem to work", but do not work
properly under all conditions.

The 10K trimpot is much more likely to be useful than a 500K pot, but *any*
resistance in series with the capacitors is inappropriate. The designers of
the timer IC go to some lengths to minimize the internal discharge
impedance, and adding external series resistance unnecessarily reduces the
duty cycle range of the timer.

What is desired (but is actually unnecessary) is a variable
capacitor--which is not available in these capacitance ranges.

As noted earlier, there is no practical need to trim the maximum paddle
value (255) to occur only at the extreme end of the joystick excursion. The
parameter variations with temperature alone will guarantee that any such
trim will drift by a few counts in any case.

Just choose a capacitance--possibly trimmed with a smaller parallel
capacitor--to cause a count of 255 to be achieved slightly before the
joystick's extreme excursion (after setting the centering and verifying
that a count of 0 is also achievable).

In the case of a 10K trimpot, and reading paddle values only from BASIC, it
is unlikely that the paddle input can be read frequently enough to observe
a slow-discharge effect, but an M/L program could easily observe it.

Michael J. Mahon

unread,
Jan 2, 2014, 2:45:34 AM1/2/14
to
However, since the pot(s) are configured as rheostats (two terminal),
bridging the pot with a resistance can get the end resistances to match the
desired values (0 and 150K ohms), but the variation of resistance with
wiper position is then nonlinear. This will prevent the midpoint of the
wiper from corresponding to a paddle count of 128.

For example, say you had thumbstick pots of 300K. To bring the maximum
resistance down to the desired 150K, you parallel the end terminals with
300K fixed resistors (or trimpots adjusted to 300K). This sets the extreme
resistances to 0 and 150K. So far, so good.

Now you set the stick pot to the center of its range. The resistance
presented to the paddle input is now half the stick resistance (150K) in
parallel with the sum of the external 300K and the other half of the stick
pot (150K). The net resistance seen by the paddle input is then 112.5K, not
the desired 75K for the midpoint position.

If, instead, you connected the external 300K resistor between the +5v end
of the stick pot and the wiper of the stick pot, then, again, you'd have a
total resistance range of 0 to 150K, but at the midpoint, the stick pot's
150K would be in parallel with the external 300K, for a net resistance of
100K, still quite different from the desired 75K at midpoint.

The only way to keep the RC time constant the same as for an Apple standard
150K pot *and retain linearity* is to adjust the capacitance.

If the paddle pot is less than 150K, this can be achieved by adding
external capacitance. If the paddle pot is greater than 150K, then this can
only be achieved simply by reducing the timing capacitance inside the
Apple.

I said "simply", because it would be possible to configure an external
opamp as a "negative capacitance" to reduce the effective capacitance
without modifying the Apple circuitry, but that seems a bit extreme for the
application. ;-). It would be more straightforward to use a paddle pot of
*any* resistance to control a variable current source in the proper range,
but that's still an active circuit.

> nothing as far as resistance should go should be in series as it does
> mess with the timing discharge charge patterns you are trying to preserve


Rooted

unread,
Jan 4, 2014, 2:28:47 PM1/4/14
to
Hi Folks,

thanks for the great responses, but unfortunately after reading all the
responses I am more confused than ever on how to make this joystick work :)




Michael J. Mahon

unread,
Jan 5, 2014, 2:38:48 AM1/5/14
to
Add the capacitors.

Rooted

unread,
Jan 9, 2014, 7:03:25 AM1/9/14
to
Hi Michael,

So I will try your suggestion and get two caps. Any specific cap value to
start with? would 0.01uf or 100nf be good? Also how about the volt
reading? I have seen 25v right up to 200v, should I stick with the lowest
value voltage or can you recommend one? thanks for your help.

Michael J. Mahon

unread,
Jan 9, 2014, 12:41:06 PM1/9/14
to
Rooted <mod...@gmail.com> wrote:
> Hi Michael,
>
> So I will try your suggestion and get two caps. Any specific cap value to
> start with? would 0.01uf or 100nf be good? Also how about the volt
> reading? I have seen 25v right up to 200v, should I stick with the lowest
> value voltage or can you recommend one? thanks for your help.

Two 0.01uF (=100nF) at any voltage (whatever is most available) will be
great. The highest voltage they will ever see is 5v, so 25 or more is fine.


Good luck!

> Michael J. Mahon wrote:
>> Rooted <mod...@gmail.com> wrote:
>>> Hi Folks,
>>>
>>> thanks for the great responses, but unfortunately after reading all the
>>> responses I am more confused than ever on how to make this joystick work
>>> :)
>>
>> Add the capacitors.
>>


osgeld

unread,
Jan 9, 2014, 7:42:27 PM1/9/14
to
> Two 0.01uF (=100nF) at any voltage (whatever is most available) will be

0.01uf is 10nf

Michael J. Mahon

unread,
Jan 10, 2014, 3:27:27 AM1/10/14
to
osgeld <ke...@hackaday.com> wrote:
>> Two 0.01uF (=100nF) at any voltage (whatever is most available) will be
>
> 0.01uf is 10nf

Aaaack! Of course!

Michael Black

unread,
Jan 10, 2014, 2:20:26 PM1/10/14
to
On Fri, 10 Jan 2014, Michael J. Mahon wrote:

> osgeld <ke...@hackaday.com> wrote:
>>> Two 0.01uF (=100nF) at any voltage (whatever is most available) will be
>>
>> 0.01uf is 10nf
>
> Aaaack! Of course!

Or, 10,000pf. Or, 10,000uuF? It's been so long, I can't even remember
what the annoying previous

That "newfangled" nanofarad was technically there since the early sixties
when the standards were changed (which included the move from "cycles per
second" to Hertz as a measure of frequency), but nobody used it. Except
in Europe, and then at some point it was being used in North America.

Michael

Michael J. Mahon

unread,
Jan 10, 2014, 4:36:36 PM1/10/14
to
Yes, my lifetime of using uF and uuF (that one was easy to switch to
"puffs") has made nF non-intuitive for me. Still no excuse for blowing the
decimal point. ;-)

When I was learning electronics, everything down to 0.0001 was uF, and
smaller capacitances were 1-1000 uuF (now pF).

osgeld

unread,
Jan 10, 2014, 7:37:37 PM1/10/14
to
On Friday, January 10, 2014 3:36:36 PM UTC-6, Michael J. Mahon wrote:
the only reason I use it is cause I get tired of verbally saying "zero POINT zero, screw it 10 nano"

Alex Freed

unread,
Jan 10, 2014, 7:47:32 PM1/10/14
to
On 1/10/2014 1:36 PM, Michael J. Mahon wrote:
>
> When I was learning electronics, everything down to 0.0001 was uF, and
> smaller capacitances were 1-1000 uuF (now pF).
>

My learning came a bit later, but as I remember it 6800 pF was a
standard value called just that, but 10,000 pF was 0.01 uF.

So I think the cut-off was a bit higher than 1000 pF. And by
mid-seventies "kilocycles" and uuF were just terms from old books.

-Alex.

Michael J. Mahon

unread,
Jan 11, 2014, 1:08:21 AM1/11/14
to
I was learning this stuff in the 1950s, when pF was unheard of, and uuF was
something that only showed up in RF circuits. 6800pF woul have appeared in
schematics as 0.0068uF.

Back then there were no "2Nxxx" parts, but 6SN7 was quite common. ;-)

While we're on the subject, the now-common practice of replacing the
decimal point in component values with a (partial) unit designation still
seems wierd and grating to me. I think a resistor is 4.7k, not 4k7.

I also expect positive voltages to come in the top, and ground and negative
voltages to come in the bottom, and I want to see signal flow left to
right. Ah, well...

Michael Black

unread,
Jan 11, 2014, 1:12:51 AM1/11/14
to
On Fri, 10 Jan 2014, Alex Freed wrote:

> On 1/10/2014 1:36 PM, Michael J. Mahon wrote:
>>
>> When I was learning electronics, everything down to 0.0001 was uF, and
>> smaller capacitances were 1-1000 uuF (now pF).
>>
>
> My learning came a bit later, but as I remember it 6800 pF was a standard
> value called just that, but 10,000 pF was 0.01 uF.
>
1000pf is .001 a very common value (like .01uF and .1uF). SO generally
you would specifiy ".001uF" if that was the value.

You could specify .0068 or 6800, about equally the same. But, if it was
.0068, I'd think "the value probably doesn't need to be exact" while if
you said 6800uF, I'd be envisioning not a ceramic bypass capacitor but
something like a mylar and assume it was a higher tolerance component.


> So I think the cut-off was a bit higher than 1000 pF. And by mid-seventies
> "kilocycles" and uuF were just terms from old books.
>
And the only reason I brought up uuF was because someone a few years back
in sci.electronics.basics had asked about it, and suddenly I was thinking
"that was an odd way to define it".

Michael

Rooted

unread,
Jan 15, 2014, 7:00:24 AM1/15/14
to
Hi, to update this thread, I did follow Michaels suggestion on just adding
the caps to the x and y axis. I tested the joystick connected to my db15 to
db9 adapter and I do get 0 to 255 in both directions, as an aside i also
picked up a db15 gamepad (which i prefer) that do not have any centering
adjust dials on it and when i tested that out it too shows me 0 to 255 in
left and right direction. I tested both the joystick and gamepad out on an
actual game and it works flawlessly except for the buttons.. Looking at the
linked schematic and actually opening up an old apple joystick I have the
buttons indeed need to have +5v but there are two resistors (i believe the
colors work out to 270r (red, purple, brown, gold)) hooked in parallel? to
the buttons.. now i don't know if its connected to the input or the output
of the button, if anybody can give me insight on this that would be
appreciated. I believe once do connect the buttons up correctly i will have
a working PC to apple adapter!

option8

unread,
Feb 7, 2014, 1:59:15 PM2/7/14
to
RJ: I've built an adapter according to the diagram here:
http://apple2.org.za/gswv/a2zine/faqs/R029PCA2XRF.GIF

and my buttons work fine by putting the 680ohm resistors between the button lines and ground. The X and Y work pretty well with the stick I'm using, a Radio Shack joystick that has both IBM and Apple connectors.

What gamepad are you using?

RJ

unread,
Feb 7, 2014, 7:44:33 PM2/7/14
to
Hi option8,

the gamepad I intended to use with the 2gs was a 15pin Gravis gamepad. I
have fabbed up that exact same adapter but still the buttons do not work. I
have since gone the route of a USB joystick adapter for the apple and am
enjoying my favorite games (choplifter, rescue radiers, and wings of fury)
using a sub Logitech gamepad controller. Now I just need to make a case for
the adapter or mount it inside the 2gs.

option8

unread,
Feb 8, 2014, 7:21:50 PM2/8/14
to
cool. what USB adapter? one from Nishida?

RJ

unread,
Feb 8, 2014, 7:49:42 PM2/8/14
to
option8 wrote:
> cool. what USB adapter? one from Nishida?
>

Yes its from Nishida. I had to modd it a bit as the 16pin connector did not
'seat' well. I soldered on a 9pin dsub connector to the circuit board and
put that into the joystick port.

Michael J. Mahon

unread,
Feb 9, 2014, 6:03:15 AM2/9/14
to
A machined-pin socket fixes both sloppy-fitting DIP plugs and loose DIP
sockets...

Dagen Brock

unread,
Feb 11, 2014, 10:29:44 AM2/11/14
to
I'm sorry, but I'm trying to build one of these thumbstick joysticks as well and I'm really confused. It doesn't help that I know almost nothing about electronics.

First, is there a reference diagram for a typical Apple II joystick? I've seen a couple variations. This page seems to have a fairly straightforward version of the paddles: http://www.atariarchives.org/ccc/chapter1.php

But I don't understand the resistors on the pushbuttons to ground. Do I need those? I wired up two buttons directly to +5 and PB0 and PB1 and they seemed to function fine. I haven't started trying to wire up my thumbstick yet because I'm still trying to make sure I understand how to get the correct resistance.

Thanks for any help. I'm really struggling to wrap my head around electronics. I've always been more of a software guy. :|

Dagen Brock

unread,
Feb 11, 2014, 3:45:52 PM2/11/14
to
Hrmm.. seems like this article says you do need a 680Ohm resistor between each button and ground. I still don't don't understand why. I also don't understand why mine was working fine the way I'd wired it. I hope it's not easy to blow up an Apple IIgs via the gamepad port.

Michael J. Mahon

unread,
Feb 11, 2014, 6:53:56 PM2/11/14
to
The resistor to ground is a "pull-down" resistor. It is needed to overcome
the (higher resistance) pull-up resistor installed on the //e main board to
make it look to firmware like both Open-Apple and Closed-Apple are
depressed when the board is powered up with neither a keyboard nor a
joystick is attached. This causes a bare //e main board to continuously run
its self-test during manufacturing burn-in.

The //e keyboard also contains pull-down resistors, so they may not be
needed in a joystick (for pushbuttons 0 and 2), but they are recommended.
Since the Apple II and II+ do not have keyboard pull-down resistors, a
joystick must have them to be usable on these machines.

If there is not a sufficiently low resistance pull-down to ground, the
buttons will appear to be pressed even when they are an open circuit.

RJ

unread,
Feb 11, 2014, 8:00:31 PM2/11/14
to
Hi Dagen,

I feel your pain, im also just a hobbyist/hack trying homebrew things for my
A2GS. Ive created the circuitry with the ones just showing the two caps and
two resistors and that seems to work well with the 15 pin PC gamepad I have,
but the buttons just didn't register. I believe if you follow that
circuitry and connect +5v to both buttons, it should work. At the moment,
Ive shelved this project but may complete it when I have time for it again.
good luck!

RJ

unread,
Feb 11, 2014, 8:02:30 PM2/11/14
to
I did trace and sketch up a circuit of a apple iic joystick that I have. I
will scan it and post it up.



Dagen Brock

unread,
Feb 11, 2014, 8:10:47 PM2/11/14
to
On Tuesday, February 11, 2014 5:53:56 PM UTC-6, Michael J. Mahon wrote:

>
> The resistor to ground is a "pull-down" resistor. It is needed to overcome
> the (higher resistance) pull-up resistor installed on the //e main board
> make it look to firmware like both Open-Apple and Closed-Apple are
> depressed when the board is powered up with neither a keyboard nor a
> joystick is attached. This causes a bare //e main board to continuously run
> its self-test during manufacturing burn-in.
>
> The //e keyboard also contains pull-down resistors, so they may not be
> needed in a joystick (for pushbuttons 0 and 2), but they are recommended.
>
> Since the Apple II and II+ do not have keyboard pull-down resistors, a
> joystick must have them to be usable on these machines.
>
>
> If there is not a sufficiently low resistance pull-down to ground, the
> buttons will appear to be pressed even when they are an open circuit.
>

Thank you MJM! You have enlightened me. This is a perfect explanation and exactly what I couldn't find information on anywhere.

Dagen Brock

unread,
Feb 19, 2014, 3:32:01 PM2/19/14
to
I finished a joystick design over the weekend which seems to match what everyone else has done. Thumbstick (10Kohm) with trim-pot(10Kohm) -> capacitors (~0.33nf) -> GND

It worked ok, but I see two issues.
1) When I poll the joystick in basic reading PDL(0) and immediately after, PDL(1), it starts to have a weird effect of not being able to hit max values. If I put in a delay, it works fine. I don't think this happens with my "genuine" Apple joystick so I assume I've somehow screwed up the timing with the capacitor.

2) I'm only getting values down to 2 or 3. It hits 255 fine. Even if I adjust the trim-pots down.

Any feedback would be appreciated. I'm still pretty happy for my own uses, but I would like to build something a little more perfect. I can post pics/schematic if it helps.

D Finnigan

unread,
Feb 19, 2014, 3:43:54 PM2/19/14
to
Dagen Brock wrote:
>
> It worked ok, but I see two issues.
> 1) When I poll the joystick in basic reading PDL(0) and immediately after,
> PDL(1), it starts to have a weird effect of not being able to hit max
> values. If I put in a delay, it works fine. I don't think this happens
> with my "genuine" Apple joystick so I assume I've somehow screwed up the
> timing with the capacitor.

That's a long-known and well-documented side-effect. Search around for
"simultaneous paddle reading". The workaround, as you discovered, is to
introduce a delay between readings.

--
]DF$
Apple II Book: http://macgui.com/newa2guide/
Usenet: http://macgui.com/usenet/ <-- get posts by email!
Apple II Web & Blog hosting: http://a2hq.com/

osgeld

unread,
Feb 19, 2014, 7:33:43 PM2/19/14
to
I imagine the increased capacitance exaggerates the phenomenon as well

Michael J. Mahon

unread,
Feb 19, 2014, 8:27:44 PM2/19/14
to
No, the effect is related only to the time constant, which is unchanged if
the PDL routines work with proper range.

Of course, if there is a trimpot in series with the added capacitor, then
all bets are off.

Don't use a trimpot or other resistance in series with the added capacitor.
Just use a couple of capacitors in parallel to achieve calibration. Or try
several different caps prior to soldering to get good calibration--actual
capacitance tolerances are pretty wide.

Dagen Brock

unread,
Feb 19, 2014, 10:35:04 PM2/19/14
to
Firstly, someone brought up the phenomenon of reading the timers too closely in sequence and how that can go awry. So it appears my joystick behaves "OK", assuming the input routines are properly implemented. After double checking, this phenomenon *does* occur with my Apple joystick as well, but only in the fast mode on Apple IIgs. I wish mine behaved a bit better.

Regardless, if I am to understand Michael correctly, the use of a trim pot for centering could interfere with the circuit design. Is there no way around this? Or put another way, is there no other way to allow centering with a potentiometer? The reason I'm asking is because I'm afraid that I could build a joystick and calibrate using only capacitors to center it on my machine, but wouldn't other people's machines have slightly different timing capacitors? I'd like a design that someone else could easily calibrate to their machine.



Michael J. Mahon

unread,
Feb 20, 2014, 3:24:05 AM2/20/14
to
Your concern about the tolerance of the on-board capacitor is real, but not
as much of an issue in the stick you described (with a maximum resistance
of 10k and an added capacitance of about 0.3uF).

The added capacitor is about 15 times the internal (approximately 0.02uF)
capacitor, so the tolerance of the parallel combo is dominated by the
tolerance of the added cap.

In short, the modified stick should be close to centered on most Apple's if
it is centered on one Apple.

The best way to adjust a stick for centering (when min and max values are
not critical, as in most flight games) is to pivot the pot body to get a
127/128 reading in the "centered" position.

The way the Apple-compatible joystick is designed, the stick must be able
to reach nearly zero ohms to get a zero paddle reading, so any calibrating
resistance cannot be in series with the pot.

If you go a little high with the external capacitor, say, around 20% over
the exact value that would give you 0 to 255, then a rheostat-connected
trimpot of about 10x the axis pot's resistance and in parallel with it (in
the 10k case, about 100k) would provide "centering" without too much
non-linearity.

Still, any way short of mechanically adjustable axis pot scheme is going to
require a small set of capacitors, ranging from a little under the required
capacitance down to significantly smaller values (20x to 100x) the required
value. The smaller caps can be connected in parallel with the main external
cap to "trim" it to the proper value for approximate centering.

Usually three, or even the right two, capacitors soldered in parallel will
add up to just the right total capacitance for the joystick's pot. (BTW,
the tolerance on inexpensive pots is around 10%!)

RJ

unread,
Feb 20, 2014, 6:26:05 AM2/20/14
to
Micheal, I have a gamepad controller that when hooked up to the adapter and
run through the joystick test shows both x and y axis at 255 value when the
thumbpad is untouched. The circuit I have is using the 0.01uf caps
connected at the axis to ground. What is the best way of bringing the x and
y centering values down to 128/128? any help will be appreciated.

option8

unread,
Feb 20, 2014, 9:04:42 AM2/20/14
to
Dagen - Are you building a new joystick, or an adapter for existing joysticks?

I'm fiddling around with an adapter for the RetroConnector line, so I'm following this conversation closely :)

Michael J. Mahon

unread,
Feb 20, 2014, 12:07:26 PM2/20/14
to
When you say "untouched", does that mean that both axes are in their
centered positions?

And what is the maximum resistance of each axis?

Dagen Brock

unread,
Feb 20, 2014, 5:17:05 PM2/20/14
to
On Thursday, February 20, 2014 8:04:42 AM UTC-6, option8 wrote:
> Dagen - Are you building a new joystick, or an adapter for existing joysticks?
>
>
>
> I'm fiddling around with an adapter for the RetroConnector line, so I'm following this conversation closely :)

I built a joystick somewhat following the hack-a-day instructions. It all works fine in actual use with a couple of games, but I don't feel it's technically correct enough for me to share the design. I don't like that the resistance with a trim pot won't go low enough to hit 0 when reading a paddle. I'm going to try and build another one using the fuller understanding I now have thanks to Michael's explanations.

I know Koichi Nishida has some USB adapter, but I suppose you are trying to learn for your own edification.

Here's what I've been able to accomplish in two weeks thanks to the help of the folks on this newsgroup:
https://plus.google.com/102985994237517217379/posts/3H3NB79L9ZV

I wanted to make a point to post that because I've struggled to do *anything* with electronics my entire life. People have been helping me almost daily to make this journey to a working joystick I built with my own two hands. I am extremely grateful for all of the feedback and explanations. At some point (hopefully soon) I will pay it forward by trying to pass along what I've learned to others.

Thanks again for everyone's patient help. I hope there's some satisfaction in knowing that I did something with it.

RJ

unread,
Feb 20, 2014, 5:18:42 PM2/20/14
to
> When you say "untouched", does that mean that both axes are in their
> centered positions?
>
> And what is the maximum resistance of each axis?


that is correct. Also, how can I check resistance? do I need to open up
the gamepad controller and check the thumbpad connectors or can I do that
from the 15 pin connector? If 15 pin connector, how do I use the multimeter
to read resistance? Sorry im but a noob in electronics.



Dagen Brock

unread,
Feb 20, 2014, 7:50:03 PM2/20/14
to
RJ - You can check resistance using the multimeter and there are plenty of youtube videos on how to do that (as well your meter should have come with instructions).

You can check the resistance from the pins on the joystick (+5,X/Y). Basically, you move your pot left and right (or up and down) and one side will be very low ("close" to zero), and the other side will be much higher. You move it all the way up to find the max resistance. HOWEVER, if you want to know the resistance of the potentiometer ONLY, then you would need to open it up and verify there aren't other components affecting resistance.

Anyway, in the case of my thumbstick, I think it measured ~100ohms at the low end and ~9900 ohms at the high end. That makes sense, because it's a 10Kohm thumbstick so 9900 is pretty much 10K, right? Tolerances, how do they work? ;)

One final note. I built a cable that is a female db9 to header pins on the other end. That way, I can plug the header pin side into my breadboard and plug the db9 into an Apple joystick or MY joystick. Then I can easily measure and compare the devices with much less hacking.

Don't feel bad about being a noob. I highly recommend re-reading this entire thread over and over. Pretty much everything has been explained, but sometimes it took me getting past a certain mental bridge before I could understand that it had been explained quite clearly in here previously. In fact, looking through the group archives, I feel a certain Mr. M. has explained this many times now! :)

If anyone working on a project wants to discuss their work directly, feel free to contact me via email. I'd like to keep the discussion here for the sake of future generations of Apple hackers, but I can understand wanting to compare notes or just trying to discuss paths already traversed.

gid...@sasktel.net

unread,
Feb 20, 2014, 11:58:40 PM2/20/14
to
On Wednesday, 19 February 2014 14:43:54 UTC-6, D Finnigan wrote:
> Dagen Brock wrote:

> > It worked ok, but I see two issues.
> > 1) When I poll the joystick in basic reading PDL(0) and immediately after,
> > PDL(1), it starts to have a weird effect of not being able to hit max
> > values. If I put in a delay, it works fine. I don't think this happens
> > with my "genuine" Apple joystick so I assume I've somehow screwed up the
> > timing with the capacitor.

> That's a long-known and well-documented side-effect. Search around for
> "simultaneous paddle reading". The workaround, as you discovered, is to
> introduce a delay between readings.>


Some notes and programs I came across which includes reading 2 paddles at the same time, extended range and paddle jitter. I was attempting to combine them.


Reading Two Paddles at the Same Time

You may have discovered by now that if you try to read both game paddles from BASIC, there is some interaction at certain ranges. The problem is that there is only one trigger for both (really, all four) analog ports. If one of them times out long enough before the other one, you will read the tail end of the count on the second timer.
I wrote a little subroutine which reads both paddles at once, eliminating all interaction. It also stretches the range, meaning you need a higher resistance than the standard paddles to get a full 0-255 counting range. Programs which use both paddles will run faster using this subroutine, because you get two readings in the time of one.

Conquering Paddle Jitter

A well-known problem with the paddles supplied with the Apple (at least they USED to be supplied!) concerns their tendency to rock back and forth between two adjacent values. "Jittering" like this can cause problems unless accuracy is unimportant, or unless the effect is somehow pleasing.

One solution to the jitter problem is to force the new paddle reading to move at least two increments from the prior reading. This works, but at the price of lower resolution. Also, it can have subtle side-effects.

A better solution is to keep track of the previous direction of movement, and enforcing the "rule of two" only if the direction is reversed.

The following program demonstrates my solution. It is set up to work with Applesoft, but it would be rather simple to make it directly callable from your own assembly language routines. To use from Applesoft, POKE the paddle number (0-3) at 768, CALL 770, and read the paddle value with PEEK(769).

I set up the following Applesoft program to test the routine, and to compare it with normal paddle readings:

10 POKE 768,0:CALL 770:PRINT PEEK(769):GOTO10
20 PRINT PDL(0):GOTO20

I typed RUN 20 and set the paddle to a jittery position. Then I typed control-C and RUN 10 to test the smoothing subroutine. The program really works!

*--------------------------------
* READ BOTH GAME PADDLES AT THE SAME TIME
* and extended paddle range
*--------------------------------



KEYBOARD .EQ $C000
*--------------------------------
TEST JSR READ.BOTH.PADDLES
TYA ; (Y) = PDL 1 SETTING
JSR $FDDA ; PRINT IN HEX ON SCREEN
INC $24
TXA ; (X) = PDL 0 SETTING
JSR $FDDA ; PRINT IN HEX ON SCREEN
LDA #0 ; HTAB 1
STA $24
LDA $C000
BPL TEST ; NO KEYPRESS, KEEP READING PADDLES
STA $C010 ; CLEAR KEYBOARD STROBE
RTS ; RETURN


READ.BOTH.PADDLES EQU *
LDX #0 ; PADDLE 0 & 1

* Enter here with x=0 for pdls 0 & 1 or x=2 for pdls 2 & 3

LDA $C070 ; START THE PADDLE TIMERS
]lp LDA $C064,X ; CHECK PADDLE 0 TIMER
BPL pdl1 ; TIMED OUT
inx
INC $6 ; COUNT PDL0
LDA $C064.x ; CHECK PADDLE 1
BPL pdl0 ; TIMED OUT
dex
INC $8 ; COUNT PDL1
BNE ]lp ; AGAIN
INC $7 ; INCREMENT HIGH BYTE COUNTER FOR X
INC $9 ; FOR Y
BPL ]lp ; ALWAYS


*---PADDLE 0 TIMED OUT, KEEP LOOKING AT PADDLE 1

pdl1 inx
LDA $C064,X ; CHECK PADDLE 1
BPL jit3 ; TIMED OUT
INC $6 ; COUNT PDL1
NOP ; EQUALIZE TIMING
NOP
NOP
BNE pdl1+1
LDA $7
BNE .3
INC $7 ; INCREMEMT HIGH BYTE FOR X
BPL pdl1+1 ; ALWAYS
jit3 JMP PDL.JITTER ; NOW CHECK PADDLE JITTER

*---PADDLE 1 TIMED OUT, KEEP LOOKING AT PADDLE 0

pdl0 dex
LDA $C064,X ; CHECK PADDLE 0
BPL jit5 ; TIMED OUT
INC $8 ; COUNT PDL0
NOP ; EQUALIZE TIMING
NOP
NOP
BNE pdl0+1 ; KEEP CHECKING
LDA $9
BNE jit5
INC $9
BPL pdl0+1
jit5 JMP PDL.JITTER ; NOW CHECK PADDLE JITTER


*---------------------------------
* PADDLE JITTER SMOOTHER
*
* POKE 768,<PADDLE NUMBER> 0, 1, 2, OR 3
* CALL 770
* P=PEEK(769) PADDLE VALUE 0-255
*---------------------------------

PADDLE.NUMBER .BS 1
PADDLE.VALUE .BS 1
*---------------------------------
PADDLE.JITTER
LDA PADDLE.NUMBER
AND #3 BE CERTAIN 0>=PDL#>=3
TAX
JSR MON.PREAD READ PADDLE VALUE
TYA SAVE IN A-REG TOO
CPY PADDLE.VALUE.1
BEQ .8 SAME, RETURN THIS VALUE
LDX PADDLE.VALUE.1 DETERMINE PREVIOUS DIRECTION
CPX PADDLE.VALUE.2
BCS .2 branch if INCREASING
CPY PADDLE.VALUE.1 WHAT IS CURRENT DIRECTION?
BCC .6 STILL DECREASING, SO ACCEPT IT
DEY SEE IF ONLY 1 STEP
BCS .5 ...ALWAYS
.2 CPY PADDLE.VALUE.1 DETERMINE CURRENT DIRECTION
BCS .6 STILL INCREASING, SO ACCEPT IT
INY SEE IF ONLY 1 STEP
.5 CPY PADDLE.VALUE.1 IF SAME NOW, IGNORE IT
BNE .6 USE NEW VALUE
TXA USE PREVIOUS VALUE
BCS .8 ...ALWAYS
.6 STX PADDLE.VALUE.2 OLDEST READING
STA PADDLE.VALUE.1 PREVIOUS READING
.8 STA PADDLE.VALUE CURRENT READING
RTS
*---------------------------------
PADDLE.VALUE.1 .DA #0
PADDLE.VALUE.2 .DA #0
*---------------------------------



Increased Paddle Range

LDX L32A
LDY #$00
STY L328
STY L329
LDA $C070
NOP
NOP
L311 LDA $C064,X
BPL L323
INY
BNE L311
INC L329
LDA L329
CMP #$02
BNE L311
L323 TYA
STA L328
RTS
L328: * low paddle count
L329: * high paddle count
L32A: * paddle number


The following is a 16-bit assembley routine to read both paddles at once. In 2.8 MHz mode, it works almost exactly like the // Rom code PRead called thru FWEntry, which is a nice feature. I'm not too sure of the copyright on the code, so if anyone could clarify it for me, I'd be glad to acknowledge it.

Here's the code I used. There are a few things to keep in mind with this code: Because I'm using wide registers, the X and Y values of the joystick may come back with values greater than $FF. The size of the number returned depends (in part) upon the speed of the machine that the code is running on. Accellerated IIGS's will return greater values than stock 2.8 MHz machines. Having the user do a joystick calibration at the start of the program would be one way of solving this problem.

Also, because the maximum joystick value returned is not "clipped
off" (i.e. maxed out at $FF), the X and Y maximum returned values may differ, depending on the model and wear of your joystick. And one last thing: The timing cycles of my routine are greater than the sum of the cycles required to execute the standard paddle reading routine built into the II+ ROM. But, since my routine will execute at speeds greater than 1 MHz, the net difference results in a faster joystick read. That, coupled with the fact that both paddles are read at the same time, makes this routine much faster than the standard ROM call.

; Read the joystick controls:
PRead anop
php
sei
ldal $00C070 ; trigger paddles (6)
ldy #0 ; (3)
ldx #3 ; (3)
PRtime dex ; (2)
bne PRtime ; timing loop for 1st count (2,3)
PRead2 ldal $00C064 ; check paddle 0,1 status (6)
and #$8080 ; check high bits of each (3)
beq PRXit ; exit if both are done (2)
cmp #$0080 ; see if X only is active (3)
bmi PRBoth ; > no, do both (2,3)
beq PRXOnly ; > X axis only (2,3)
PRYonly iny ; (2)
bpl PRYmore ; (just for timing) (3)
bmi PRXit ; (prevent endless loop)
PRYmore bra PRead2 ; go back for more (3)
PRXOnly inx ; (2)
bmi PRXit ; (prevent endless loop) (2)
bra PRead2 ; go back for more (3)
PRBoth inx ; (2)
iny ; (2)
nop ; match timing of others (2)
bpl PRead2 ; (3)
PRXit plp
rts ; x = pdl(0), y = pdl(1)



Michael J. Mahon

unread,
Feb 21, 2014, 6:31:31 PM2/21/14
to
Just a quick note: the time to read a joystick is directly proportional to
the PDL value, if read singly, and directly proportional to the largest
value if two axes are read concurrently.

The read routine waits until a paddle RC circuit has timed out, and that is
independent of the code reading it.

On the other hand, the maximum paddle value (if less than 255) is inversely
proportional to the speed of an iteration of the reading loop.
0 new messages