Jump to content
IGNORED

Joystick + Alpha-Lock where is the path to ground?


matthew180

Recommended Posts

Ok, I know this to be true: on a keyboard without the diode fix, with the Alpha-Lock pressed down (switch closed), it interferes with the joystick "up" direction, effectively making it look like the joystick is always pushed up.

 

However, I have been noodling the schematics for a while, and I'm not seeing the path to ground that creates the false joystick input.  I have included the SAMS Computer Facts schematic for the keyboard and joystick I/O (it is the only schematic I have seen that includes everything in one place).

 

Can someone please enlighten me as to the ground path that creates the phantom "up"?

 

Also, are there *any* schematics of the original wired controllers floating around?  I know the circuit *should be* simple, but I never make assumptions about hardware anymore.

994a_io.png

Link to comment
Share on other sites

Unless I am reading it wrong, the article at MainByte indicates the "negative" side of the diode faces pin 6, which is pin 20 of the 9901.  I read that as the problem being back-feeding of 5v from pin 20 into the column fed by pin 34.  But why?  I feel like there is some context missing from just this snippet of the schematics.  When I get home, I am going to pull out the full schematics and see what they show.

  • Like 1
Link to comment
Share on other sites

There is a 5V pull-up on both the top column line, on pin 34 on the 9901, as well as on the ALPHA LOCK line, pin 20 on the 9901, both fed through a 10k resistor.

 

The "test joystick 1" and "test joystick 2" lines are connected via 1.5k resistors to -5V.  They are also connected to +5V by NPN transistors Q300 and Q301.  When the transistors are switched on by the 74LS156 at U302, both +5V and -5V connected on the lines.The UP line is pulled up by a 10k resistor, then passes through a 470 ohm resistor.  That connects to joystick port pin 3 and keyboard connector pin 7.  From pin 3 on the joystick port, the UP line passes through a diode in the joystick then to pin 2 or pin 7 (joy-1 and joy-2, respectively,) then through a path of two resistors of 10 and 270 ohms, then 1.5k to -5V.

 

If the ALPHA LOCK key is on, then it pumps 5V into that path after the 470 ohm, and circuit-wise before the 10ohm resistor on the appropriate joystick select line.

 

I need a schematic of the joysticks, but it looks like the diode on the ALPHA LOCK key plays the same role as the diodes in the joystick, to prevent any positive voltage from feeding back up into the rows to which the joystick lines are connected.

 

Weird.  There seems to be some kind of voodoo happening here.  Now I am missing how scanning the keyboard and joysticks play with all of these lines to fully grok what is going on.

  • Like 1
Link to comment
Share on other sites

17 hours ago, Tursi said:

I'm not able to check yet myself, but the symptom is the other way - the joystick /never/ reports up, presumably because the Alpha lock path sinks all the current or whatever it is.

That's how I remember it from when I was little.

Link to comment
Share on other sites

15 hours ago, Tursi said:

I'm not able to check yet myself, but the symptom is the other way - the joystick /never/ reports up, presumably because the Alpha lock path sinks all the current or whatever it is.

 

AHHHH!  You could have said that yesterday! :P

 

That does make sense now.  I built a simulation with Falstad Circuit Emulator too see where the problem was.  I'll have to take some real measurements, but it appears that using a typical diode (like a 1N4148) for the fix it on the edge of not working.  A Schottky diode with a lower junction voltage should be used to give at least *some* margin.

 

A screenshot of the circuit, as well as the circuit text, is attached.  Go to the link above, choose import from text, and paste the circuit text into the box.

 

18 hours ago, OLD CS1 said:

... the UP line passes through a diode in the joystick ...

 

I do not think the stock joysticks have diodes in them.  If anyone has a pair of TI sticks and does not mind opening them, a few photos of the innards would be appreciated.

 

18 hours ago, Willsy said:

This sounds like an insanely complex joystick circuit! What were they thinking?

 

Let me introduce you to the ColecoVision joystick input circuit... 🤣🤬

 

18 hours ago, Willsy said:

Why, for example, is the -5v line even involved in such a circuit?!

 

Because some EE at TI was in love with negative voltages?  Seriously, it is used on the reset circuit too, for a pseudo-ground in the cartridge, and in the GROMs (which is why P-Code cards blow up so much, apparently).

 

The keyboard has so many pull-ups and caps on the lines, it is no wonder there are so many problems.  They keys don't know if they are coming or going.  And with all that filtering, you also have to wonder why it is still so freaking noisy!  FYI, the noise on the audio line is caused by the keyboard scanning circuit.

 

sim_falstad_994a_keyboard.png

sim_falstad_994a_keyboard.txt

  • Like 3
Link to comment
Share on other sites

19 minutes ago, matthew180 said:

I do not think the stock joysticks have diodes in them.  If anyone has a pair of TI sticks and does not mind opening them, a few photos of the innards would be appreciated.

::sigh::  I cannot believe you doubted me...

 

20221017_230239.JPG

  • Like 2
  • Haha 1
Link to comment
Share on other sites

27 minutes ago, matthew180 said:

The keyboard has so many pull-ups and caps on the lines, it is no wonder there are so many problems.  They keys don't know if they are coming or going.  And with all that filtering, you also have to wonder why it is still so freaking noisy!  FYI, the noise on the audio line is caused by the keyboard scanning circuit.

 

sim_falstad_994a_keyboard.png

This answers a question I posed quietly to myself: does the 9901 tri-state?

Link to comment
Share on other sites

2 hours ago, OLD CS1 said:

::sigh::  I cannot believe you doubted me...

 

Not doubt, just the first time I have *ever* seen the inside of the TI joysticks.  I looked for any photos or a schematic for a while yesterday, so I'll go out on a limb and say this is the first and only photo of the elusive wired controllers in the wild.  AND, what the heck is that chip in there?  More photos please. :)

 

Edit: I see now, that is a connector for the flex PCB.  Heh, flex PCB...  And people think flex PCB stuff is all new tech these days.

 

2 hours ago, OLD CS1 said:

This answers a question I posed quietly to myself: does the 9901 tri-state?

 

There is no indication that any I/O on the 9901 can tri-state.  Inputs look like hi-Z anyway, and outputs are always driven hi or lo, so no tri-state, no #OE pin, and no way to set an output as tri-state programmatically.

Edited by matthew180
  • Like 3
Link to comment
Share on other sites

51 minutes ago, matthew180 said:

More photos please. :)

hehehe what more do you want?

52 minutes ago, matthew180 said:

There is no indication that any I/O on the 9901 can tri-state.

That was a consideration as to how the circuit was behaving on inputs and outputs.  Fun stuff.

  • Like 1
Link to comment
Share on other sites

Since they originally intended to use joysticks with more levels than just on/off (that's why "on" is returned as 4, not 1), could the positive/negative voltages have something to do with that? Analogue input -5 to +5 V, maybe?

I have photos of the innards of my joysticks, but they aren't in the wild. Not yet. I took them to document how I fixed the issue with Defender wearing out the fire button.

 

This is the only joystick photo I have in the wild.

Joystick

Edited by apersson850
  • Like 2
Link to comment
Share on other sites

12 hours ago, OLD CS1 said:

hehehe what more do you want?

 

To be able to see where the wires go on the top of the PCB, and a photo of the bottom of that PCB.  I think I worked it out, but I want to be sure.  I updated the simulation with a diode in the joystick switch area.  Also, the Alpha-Lock fix not working for some people makes more sense now, seeing that the low-level voltage is actually out of spec with the added diode voltage-drop.

 

It seems worth repeating, a low forward-voltage Schottky diode should be used for the Alpha-Lock fix, NOT a 1N4001 or 1N4148, etc.

 

4 hours ago, apersson850 said:

Since they originally intended to use joysticks with more levels than just on/off (that's why "on" is returned as 4, not 1),

 

Is there a reference for this?  The 9901 operates as a digital-device and does not have any kind of ADC on any inputs, and I'm not seeing any of the "cheap" method of doing analog input (see how the Apple 2e did analog sticks).

 

I think the choice of using +/- 4 was just a software mapping choice.  A detailed review of the KSCAN routine might indicate why.

 

From a technical aspect, the joystick bits come in like this (I did not dig to see which bit-ordering was used, so I put it both ways):

 

Everyone-Else numbering:

7 6 5 4 3 2 1 0
U D R L F - - -

0001 1 L
0010 2 R
0100 4 D
0101 5 DL
0110 6 DR
1000 8 U
1001 9 UL
1010 A UR


TI numbering:

- - - F L R D U
0 1 2 3 4 5 6 7

0001 1 U
0010 2 D
0100 4 R
0101 5 UR
0110 6 DR
1000 8 L
1001 9 UL
1010 A DL

 

Maybe some else can see a pattern where +4 and -4 would be convenient representations for the direction values?

 

4 hours ago, apersson850 said:

could the positive/negative voltages have something to do with that? Analogue input -5 to +5 V, maybe?

 

Mmmm, depends on how the rest of the (non-existent) circuit was designed.  The -5V use around the console seems like it was just some engineer's "way", or maybe they were a junior engineer and that is what they learned or understood best.  It is not anything I would do, or anything I have seen much of in other retro computers or coin-op computers of the same era.

 

This was also a weird transition time in the chip industry, moving from chips that used two or three voltages (some of them negative, i.e. see the DRAM ICs), to single positive voltage devices, etc..

 

The 99/4A is certainly a mix of all kinds of ICs.  But the abuse on the keyboard circuits it just nuts, IMO.

 

Edit: Forgot the new attachments.

 

sim_falstad_994a_keyboard.png

sim_falstad_994a_keyboard.txt

Edited by matthew180
  • Like 1
Link to comment
Share on other sites

1 hour ago, matthew180 said:

To be able to see where the wires go on the top of the PCB, and a photo of the bottom of that PCB.  I think I worked it out, but I want to be sure.

This should sort things out for you.  Ignore the shadows.

20221018_160700.JPG

  • Like 2
  • Thanks 1
Link to comment
Share on other sites

13 hours ago, matthew180 said:

Is there a reference for this?  The 9901 operates as a digital-device and does not have any kind of ADC on any inputs, and I'm not seeing any of the "cheap" method of doing analog input (see how the Apple 2e did analog sticks).

For the 99/4, not the 99/4A. I don't remember exactly, but I think I've read they had 16 levels on from the analogue joysticks. In which case returning 4 from a digital one could be appropriate, if there already was software taking the 0-15 range into account. Then it would still work reasonably, but be very slow with a returned value of 1.

Edited by apersson850
  • Like 1
Link to comment
Share on other sites

I looked at the 99/4 I/O schematics a few times, but I don't see evidence (or direct electronics) on the motherboard for analog sticks.  However, that is not to say the 99/4 joystick itself does not do something to utilize the 5 digital outputs as other than open/close switch positions, like 4-bits per direction as a signed value (which would require support in the ROM to read the position correctly).  But support for analog-level voltages on each joystick input itself, I see no support for that.  Maybe someone sees something I don't?

 

The joystick code in the 99/4 ROMs could be checked if they support reading other than binary U, D, L, R, F.

ti994_io.png

Link to comment
Share on other sites

The analog joystick concept is in the C.B. Wilson papers. It’s also in TI’s joystick patent, I recall. 
 

As shipped, the 99/4 and wired remote controllers had the same capability as the new ones and the 99/4A. 
 

I was perplexed why a CALL JOYST would return such a silly thing as -4 when all I wanted was to move a character 1 space. 
 


 


 

 

Link to comment
Share on other sites

From the CYC, looking at the 99/4 Reference Guide, it would appear the demo program was expecting variable values to be returned, not fixed values.....

 

>NEW
>100 CALL CLEAR
>110 CALL CHAR(42,"FFFFFFFFFF
FFFFFF")
>120 INPUT "SCREEN COLOR?":S
>130 INPUT "BLOCK COLOR?":F
>140 CALL CLEAR
>150 CALL SCREEN (S)
>160 CALL COLOR(2,F,1)
>170 CALL JOYST(2,X,Y)
>180 A=X*2.2+16.6
>190 B=-Y*1.6+12.2
>200 CALL HCHAR(B,A,42)
>210 GOTO 170
>RUN
-- screen clears
SCREEN COLOR?14
BLOCK COLOR?9
-- screen clears
-- color block will move around screen as joystick controller is moved
(Press SHIFT C to stop the program)
[Line 190 originally read:
>190 B=Y*1.6+12.2
The added "-" fixes the vertical placement to correspond with the joystick direction. However, this program
only "plots" 8 positions at the extremities of the joystick and does not move the color block around the
screen. In Line 170 X and Y can only be 0, 4, and -4. These fixed values are multiplied by constant values
which will always yield the same result. — Cyc Ed.]

  • Like 1
Link to comment
Share on other sites

Based on the code and comment from the 99/4 User's Reference Guide, pg. 116

 

"-- color block will move around screen as joystick controller is moved"

 

Two possibilities come to mind:

 

1. The tech writer of that program did not understand the console's joystick capabilities, so the code and comment are erroneous.

2. An initial spec for the 99/4, which the User's Reference Guide was written against, indicated analog values, but it never materialized.

 

I'm not convinced of either though, since the description part of the JOYST subprogram is correct, and makes no mention of values other than 4, 0, and -4.  The incorrect code could have been missed during review, I suppose.  So, sloppy editing perhaps?

 

However, from a hardware perspective, the 99/4 does not appear to have been designed with any kind of analog joystick in mind.

 

... time passes ...

 

I checked the ROM (99/4A ROM anyway).  The joystick values updated by KSCAN into scratchpad are from a GROM table, so the return values could have been anything.  There are 5-bits of joystick input to the 9901, so a much larger number of inputs (32) could have been encoded, similar to the ColecoVision keypad and such.  However, 1-bit is wasted entirely on the fire button, and 50% of the 4-bit range is thrown away (not possible values, i.e. up and down cannot be physically (under normal circumstances) be triggered at the same time).

 

                      1
                      68421
           Y  X (X  Y)UDRLF
16E0 DATA 00 00       0000-  0
16E2 DATA 00 00       0000-  2
16E4 DATA 00 00       0000-  4
16E6 DATA 00 00       0000-  6
16E8 DATA 00 00       0000-  8
16EA DATA 04 04  4  4 0101- 10 UR
16EC DATA 04 FC -4  4 0110- 12 UL 
16EE DATA 04 00  0  4 0111- 14 U
                      UDRLF
16F0 DATA 00 00       0000- 16
16F2 DATA FC 04  4 -4 1001- 18 DR
16F4 DATA FC FC -4 -4 1010- 20 DL
16F6 DATA FC 00  0 -4 1011- 22 D
16F8 DATA 00 00       0000- 24
16FA DATA 00 04  4  0 1101- 26 R
16FC DATA 00 FC -4  0 1110- 28 L 
16FE DATA 00 00       0000- 30


Section from ROM KSCAN subprogram for reading joystick inputs, isolating the
fire button, converting 4-bit UDRL into a table offset, then reading the
Y,X values from GROM and storing the values into their designated scratchpad
memory locations.

0302 0704 SETO R4                  R4 = 1111 1111 1111 1111
0304 3544 STCR R4,5                Fetch CRU 5-bits into MSB of R4 (000U DRLF 1111 1111)
0306 0994 SRL  R4,9                R4 = 0000 0000 0000 UDRL|F, fire button to carry-flag
0308 1803 JOC  >0310               Jump if no fire button, Carry=0 fire, Carry=1 no-fire
030A D825 MOVB @>02F1(R5),@>83E7   Save fire status?
030C 02F1
030E 83E7
0310 0A14 SLA  R4,1                Adjust for table: R4*2 = 0000 0000 000U DRL0
0312 0224 AI   R4,>16E0            Add GROM address of joystick table to R4
0314 16E0
0316 DB44 MOVB R4,@>0402(R13)      Set MSB of GROM read address?
0318 0402
031A DB60 MOVB @>83E9,@>0402(R13)  Set LSB (from R4's LSB) of GROM read address?
031C 83E9
031E 0402
0320 1000 JMP  >0322               Delay for GROM?
0322 D81D MOVB *R13,@>8376         Read Y value from GROM table, store to scratchpad
0324 8376
0326 D81D MOVB *R13,@>8377         Read X value from GROM table, store to scratchpad

 

I'm not sure why I just spent so much time looking in to this...

 

The first part shows the GROM table, note I reversed the hex Y,X data into decimal X,Y to more easily recognize the values, and to match the diagram in the User's Reference Guide.

 

 

joyst.png

  • Like 2
  • Thanks 1
Link to comment
Share on other sites

The mention of the analog joysticks comes from the original design when it was designed to be a game console with two analog, 15 button controllers. ;)

 

It probably never made it all the way to hardware. The two joysticks became the split keyboard, though.

 

  • Like 4
Link to comment
Share on other sites

I was imagining  if there would have been some advantage to having separate -5 and +5 voltages for opposite axes. 

I recall how the Apple II paddles worked—not sure if it was a linear pot (probably, not logarithmic as in audio). So voltage divider.
 

The 2 paddle interface became 1 joystick with two tricky adjustment levers for centering it. 
 

 

But the circuit to read it was an RC and a voltage comparator, right? Given a fraction of 5V on the input from the paddle, the 6502 counts how many ticks before the RC charges up to equal the voltage. 

 

But if I understand it right, that’s not linear. It’s exponential. So measuring linear time with the CPU, you need to take the logarithm to derive a linear position.

 

 Exponential growth of an RC: If the RC is charging up from 0 to 5V, then after T microseconds it reaches 3.1 V (63%) and at 2T it is 4.2V (82%). At 3T microseconds, it is 4.8V (97%). 4T, 99%. 5T is considered to be fully charged.
Somewhere in there you get the signal that you’ve matched the input voltage, and you have your number t. 
 

You would have to have a lookup table of exponential values. Say 256 positions? Because paddles. Or 16 might do! Reliably finding the center is tricky.
 

I recall how in 2600 paddle games, there is an unstable point near the middle of the range (Warlords bumper jittered near the middle position.) Apple II might have dealt with that in software. 
 

Anyhow, if the range were -5 to +5, you might try to measure the value from both directions.  If you like the stick to have a non-linear  response, great. And the centering error is bypassed. 
 

Im humble enough to know this might be a dumb rookie idea. But I’m trying to find a good reason for having assumed -5 in the spec. After all, other machines did it acceptably with just 0-5V. 
 

Maybe the joystick only needed  16 levels , then you could have a resistor ladder to create reference voltages for each… hmm , there must be a trick to measure crossings with just one voltage comparator (using 8 parts == cost.)

 

Inside SuperSketch there was one 8 bit ADC, so problem solved there in 1983. But an ADC must have cost more in 1979, motivating the cheap RC comparator in Apple II and others. 

  • Like 1
Link to comment
Share on other sites

TI Intern shows in GPL GROM 0 a DST 4 that sets the value of 4 or inverse 4 into -4.

If you change that DST 4 to 1 or -1 the return would be 1 or -1.

 

>374B puts >0004 into >8310 and down for joystick is 4 and up for joystick is -4

Later it puts >0010 into >8310 for Split Keyboard scan and only 15 keys are available.

Oddly Down Arrow is 10 while Up Arrow is 11

  • Like 1
Link to comment
Share on other sites

On 10/20/2022 at 11:50 AM, FarmerPotato said:

Say 256 positions? Because paddles.

Yea.. Got it... The MBP card was very popular for interfacing a Radio Shack mouse. I thought it was just because the interface was easy, now reading your email I understand that it also very much has to do with acceleration / velocity...

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...