Jump to content
IGNORED

Analog Joystick - How would you implement and interface one?


Omega-TI

Recommended Posts

There are lots of neat old video games out there, many of the ones in the arcades used analog joysticks for fine control and maneuvering. A couple of early examples are Lunar Lander and Omega race. This got me thinking, since we have a thriving hardware and software community here on Atari Age, the people to ask about implementation are here too.

 

Here are a couple of starter questions:

 

1) How would you prefer to interface an analog joystick to the TI? I figure there is probably more than one way.

2) What EXISTING assembly commands (if any) could be re-tasked to implement something like this?

 

Do you foresee any major hurdles or impediments? If not, a whole new class of programs could materialize in the coming years.

 

Link to comment
Share on other sites

There will need to be some form of circuitry between the joystick and the TI for the analog to digital conversion. A microcontroller like the arduino could easily do this, taking in the resistance values from the 2 joystick axes to compute the exact position of the stick then simply convert that to a digital number which could then be input via the parallel or serial port (parallel is easier and faster) to the TI. It will then be up to the programmer to interpret that number as they see fit by for example reading address >5000 (the PIO port address after setting up the CRU for the port) to access it. I'm actually working on a set of assembly routines which will allow the XB programmer to easily access the parallel port at the low level for interfacing purposes. A blog entry will be forthcoming on this.

Regardless, this would be completely incompatible with existing games. You could simulate the classic TI joysticks in software, but what would then be the point of using an analog joystick? :-D Frankly though, I don't see this taking off unless there is a killer game that absolutely needs an analog joystick and there is a readily available source of the needed joystick interface...

Interestingly, and I think uniquely among early microcomputers, the BBC Micro had an ADC port which would have come in very handy.

Link to comment
Share on other sites

pretty sure this is already out there http://www.unige.ch/medecine/nouspikel/ti99/joystick.htm#Analog%20joysticks

 

do you google ? :)

 

That seems more complicated than it needs to be, although quite original as a scheme. Modern microcontrollers will shrink everything down to essentially one chip and likely no support components if using the parallel port instead unless level shifting is required in which case an additional chip may be needed. The PIO port has the added advantage of providing a power source as well without modification. The driver would then be trivially simple as it would be only reading the PIO port and reporting a single value. Most of the conversion would be done by the microcontroller itself.

Link to comment
Share on other sites

You could always use the ADC pins on the UberGROM as an interface point--or an MBP/MBP-II board. . .

Yep, this.

 

Little known fact not known by a lot is the UberGrom has a very powerful microcontroller on it with lots of potential.

 

Way back in the day, I had a good local friend make the SmartPort for the Commodore Amiga, which let you use PC analog controllers with the Amiga's digital ports. As I remember, Alvin had to patch games (and he patched several too) so that they were actually more sensitive to the analog input.

 

Sent from my Moto G (4) using Tapatalk

  • Like 1
Link to comment
Share on other sites

That is so cool! Not only can you put a super new game in an UberGROM, the same cartridge can be used as the controller. Many of us already have UberGROM boards, so this might be a cool weekend project many of us could copy if or when it comes out.

 

Even if a joystick is never made, I'd still like to see an assortment of new projects to exploit the UberGROM's capability.

I wonder what diverse things people can come up with? Maybe a contest is in order?

Link to comment
Share on other sites

I've often wondered about the joystick analog/digital thing. In the end (from a high level) how does it work?

I imagine you send pulses of 0, -4, +4 to the TI appropriately? The further the joystick is moved the higher the frequency of the pulse? But still keep it high enough to hide any stop motion effect at the slowest speed?
I dunno. interested tho'.

Link to comment
Share on other sites

Sinphaltimus, on 11 Jan 2017 - 10:11 PM, said:

I've often wondered about the joystick analog/digital thing. In the end (from a high level) how does it work?

 

I imagine you send pulses of 0, -4, +4 to the TI appropriately? The further the joystick is moved the higher the frequency of the pulse? But still keep it high enough to hide any stop motion effect at the slowest speed?

I dunno. interested tho'.

 

The joystick is mechanically connected to a pair of variable resistors in the base of the joystick. Moving the joystick in the X and Y directions varies the two resistances. Apply a voltage across the resistors and this gives a pair of varying voltages which are proportional to the joystick position. Convert the analogue voltages to digital (through an analogue-to-digital converter IC) then you can do things with them in software. So with the joystick at one extreme X position might give you a reading of 0, and this increases steadily to 255 as you move the joystick to the opposite X position.

 

Take a look at http://www.stuartconner.me.uk/tm990/tm990.htm#etch-a-sketch which is an Etch-a-Sketch program using two rotary knobs rather than the pair of variable resistors in a joystick. If the UberGROM has two ADC channels then this could easily be ported to the 4A.

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

The Mechatronics mouse implemented an interesting approach; something similar can be done for any device that delivers some value that should not be too big.

 

The mouse (and its controller device that plugged into the joystick port) used the input lines left, right, down for the mouse motion, up for the first button, fire for the second button. By selecting joystick 1 or 2, the axes were swapped. So first you select stick 1, read the x motion (from -4 to +3), then select stick 2 and read the y motion. This is not all, though: The joystick port was polled in high frequency so that you got a sequence of x and y values, while the x and y value was decreased every time by that amount.

 

Suppose the device detects a value of x=+30, y=-21. In that case you got a sequence of x=3+3+3+3+3+3+3+3+3+3+0 and y=-4-4-4-4-4-1+0+0+0+0+0+0, or, in binary, x=011 + 011 + 011 + 011 + ... + 011 + 000, y=100 + ... + 100 + 111 + 000. So 011 could mean left line off, right line on, down line on.

 

Should be a simple job for an Arduino or a similar controller. You just need a power supply.

  • Like 1
Link to comment
Share on other sites

 

The joystick is mechanically connected to a pair of variable resistors in the base of the joystick. Moving the joystick in the X and Y directions varies the two resistances. Apply a voltage across the resistors and this gives a pair of varying voltages which are proportional to the joystick position. Convert the analogue voltages to digital (through an analogue-to-digital converter IC) then you can do things with them in software. So with the joystick at one extreme X position might give you a reading of 0, and this increases steadily to 255 as you move the joystick to the opposite X position.

 

Take a look at http://www.stuartconner.me.uk/tm990/tm990.htm#etch-a-sketch which is an Etch-a-Sketch program using two rotary knobs rather than the pair of variable resistors in a joystick. If the UberGROM has two ADC channels then this could easily be ported to the 4A.

OH, So with this solution you're not using CALL JOYST at all?

 

I'm looking at this from an extended basic point of view.

Edited by Sinphaltimus
Link to comment
Share on other sites

An analog input device would not have to be just for a joystick, it could also be for a steering wheel for a new racing game... with a decent life like accelerator, or even a gamepad type controller for the younger crowd.

 

If the great minds got together and settled on and came up with an input method for a PC based device, it would open up lots of possibilities and

dozens of options to choose from.

 

I can imagine a whole new class of games and an extended life for our old TI's. And we could even choose to go with a WIRELESS controller.

Link to comment
Share on other sites

gfreige, on 12 Jan 2017 - 01:18 AM, said:

Any way to reuse the analog joystick support already present in ROM (as used by MESS) ?

 

That's only in the 99/4 ROM, the 4A dropped it.

 

Quote

Little known fact not known by a lot is the UberGrom has a very powerful microcontroller on it with lots of potential.

 

Not due to any lack of trying on my part. ;)

 

Anyway, to get on topic...

 

Quote

How would you prefer to interface an analog joystick to the TI?

 

While it's not my ultimate preference, joystick/steering wheel was one of my envisioned uses for the UG's analog inputs (it has FOUR of them - that's enough for a nice flight stick too ;) ).

 

They work best wired as a voltage divider - using the three leads of a standard potentiometer, connect each end to +5v and ground, and the wiper pin goes to the analog input.

 

For an old-school PC analog joystick, I haven't outright tried one. I would expect it should work to run them in, but it'd be worth testing. They usually don't have the ground connection, so I'm not sure how the ADC responds. Should be able to get something...

 

Another interesting effect is the analog inputs, if left floating (just run to copper pads, for instance) can actually work as touch sensors. You could put four touch pads on your cartridge -- this is actually how I tested the initial carts analog support. ;)

 

Reading the position is simply reading a GROM address, very simple. There are also 6 general purpose inputs for reading the buttons... these have (optional) built-in pull-up resistors so can be connected directly to the buttons with no extra hardware.

 

What I'd like to do is interface the wired Playstation controllers. They have a really simple clocked protocol and provide all the inputs we could want. I had started that ages ago and then the project to mod Genesis pads came around, so I dropped it. It could run through the joystick port, though we'd need to pull power from somewhere... I always envisioned something like JoyTalk, stealing power from the video modulator port. ;)

 

Downside with all those plans is no compatibility with CALL JOYST, although if you included a microcontroller you could add an emulation mode, I guess.

  • Like 1
Link to comment
Share on other sites

--- Ω ---, on 12 Jan 2017 - 06:09 AM, said:

gallery_35324_1027_19659.jpg

 

This would make a perfect thread!

 

One example E/A5 program (in FR99 format too) and a PDF showing us how to interface it.

Like the movie meme, "If you build it, they will come".

 

Riiiight, cause all the other stuff I've built on request has had such a response. ;) Anyway, I have too many other things at the moment. People want finished products, not components.

 

There's example code in the UberGROM distribution - GROMTEST exercises every peripheral in the device.

  • Like 1
Link to comment
Share on other sites

 

Riiiight, cause all the other stuff I've built on request has had such a response. ;) Anyway, I have too many other things at the moment. People want finished products, not components.

 

There's example code in the UberGROM distribution - GROMTEST exercises every peripheral in the device.

 

You know Tursi, I've personally enjoyed many of the things you've made! In fact I use your NEW & IMPROVED SLIDESHOW program (also available in FR99 format) nearly every day, in fact it's running on my as I write this. I also plan to make at least a dozen more F18A compatible graphics for it in the next week or two. It'll probably even be running at Fest West when I'm not using my 'small footprint system' that I plan to take... which reminds me I've still not completed that HDMI project yet.

 

You are correct, most consumers really do want finished products, fortunately we have plenty of hardware hackers here. The lack of new hardware is not an issue at the moment, honestly it's software to exploit all the new capabilities that is behind the curve. Also, there is a LOT going on in the community right now and a project like this might actually get overlooked. Maybe someday when things slow down a little someone might have the time to take a shot/gamble at starting the next gaming revolution on the TI.

Link to comment
Share on other sites

The trick it, it's not so much "build it and they will come". What it is, is the enthusiasm of people like you, Omega, and Opry99er, and countless others. Nobody wants to release into a vacuum - a lot of the things that happened have happened because people got excited about it. :)

  • Like 1
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...