Jump to content

Photo

Analog Joystick - How would you implement and interface one?


26 replies to this topic

#1 --- Ω --- OFFLINE  

--- Ω ---

    TI-Runner

  • 10,600 posts

Posted Tue Jan 10, 2017 7:46 PM

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. 

 



#2 Vorticon OFFLINE  

Vorticon

    River Patroller

  • 2,805 posts
  • Location:Eagan, MN, USA

Posted Tue Jan 10, 2017 9:04 PM

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.



#3 arcadeshopper OFFLINE  

arcadeshopper

    River Patroller

  • 2,556 posts
  • Location:Portland, Oregon USA

Posted Tue Jan 10, 2017 10:14 PM

pretty sure this is already out there http://www.unige.ch/...nalog joysticks

 

do you google ? :)



#4 Vorticon OFFLINE  

Vorticon

    River Patroller

  • 2,805 posts
  • Location:Eagan, MN, USA

Posted Wed Jan 11, 2017 2:39 AM

pretty sure this is already out there http://www.unige.ch/...nalog joysticks

 

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.



#5 Ksarul OFFLINE  

Ksarul

    River Patroller

  • 4,215 posts

Posted Wed Jan 11, 2017 6:37 AM

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



#6 acadiel OFFLINE  

acadiel

    Dragonstomper

  • 981 posts
  • www.hexbus.com
  • Location:USA

Posted Wed Jan 11, 2017 7:54 AM

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

#7 --- Ω --- OFFLINE  

--- Ω ---

    TI-Runner

  • Topic Starter
  • 10,600 posts

Posted Wed Jan 11, 2017 9:21 AM

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?



#8 acadiel OFFLINE  

acadiel

    Dragonstomper

  • 981 posts
  • www.hexbus.com
  • Location:USA

Posted Wed Jan 11, 2017 9:32 AM

Stay tuned. I have something in the works with others :)

Sent from my Moto G (4) using Tapatalk

#9 Vorticon OFFLINE  

Vorticon

    River Patroller

  • 2,805 posts
  • Location:Eagan, MN, USA

Posted Wed Jan 11, 2017 3:03 PM

Stay tuned. I have something in the works with others :)

Sent from my Moto G (4) using Tapatalk

 

I hate suspense  :-D



#10 --- Ω --- OFFLINE  

--- Ω ---

    TI-Runner

  • Topic Starter
  • 10,600 posts

Posted Wed Jan 11, 2017 3:13 PM

Stay tuned. I have something in the works with others :)

 

Oh yes, 2017 is starting out to be a wonderful year!  Lot's of public projects, and others not so public.  ;)

 

 

I hate suspense  :-D

 

Ditto!



#11 Sinphaltimus OFFLINE  

Sinphaltimus

    Stargunner

  • 1,970 posts
  • Distracted at the Keyboard
  • Location:Poconos, PA

Posted Wed Jan 11, 2017 4:11 PM

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'.



#12 Stuart OFFLINE  

Stuart

    Dragonstomper

  • 707 posts
  • Location:Southampton, UK

Posted Wed Jan 11, 2017 4:33 PM

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.stuartcon...m#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, Wed Jan 11, 2017 4:42 PM.


#13 mizapf OFFLINE  

mizapf

    River Patroller

  • 2,583 posts
  • Location:Germany

Posted Wed Jan 11, 2017 4:46 PM

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.



#14 Sinphaltimus OFFLINE  

Sinphaltimus

    Stargunner

  • 1,970 posts
  • Distracted at the Keyboard
  • Location:Poconos, PA

Posted Wed Jan 11, 2017 5:49 PM

 

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.stuartcon...m#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, Wed Jan 11, 2017 5:51 PM.


#15 Vorticon OFFLINE  

Vorticon

    River Patroller

  • 2,805 posts
  • Location:Eagan, MN, USA

Posted Wed Jan 11, 2017 5:50 PM

That's right. You need a special driver.



#16 arcadeshopper OFFLINE  

arcadeshopper

    River Patroller

  • 2,556 posts
  • Location:Portland, Oregon USA

Posted Wed Jan 11, 2017 8:32 PM

the mechatronic mouse driver just attached itself to sprite #1 and mouse clicks were buttons.. 



#17 --- Ω --- OFFLINE  

--- Ω ---

    TI-Runner

  • Topic Starter
  • 10,600 posts

Posted Wed Jan 11, 2017 11:44 PM

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.



#18 gfreige OFFLINE  

gfreige

    Star Raider

  • 75 posts
  • Location:La Plata, Argentina

Posted Thu Jan 12, 2017 3:18 AM

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



#19 Tursi OFFLINE  

Tursi

    River Patroller

  • 4,822 posts
  • HarmlessLion
  • Location:BUR

Posted Thu Jan 12, 2017 5:59 AM

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.



#20 --- Ω --- OFFLINE  

--- Ω ---

    TI-Runner

  • Topic Starter
  • 10,600 posts

Posted Thu Jan 12, 2017 8:09 AM

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".



#21 apersson850 OFFLINE  

apersson850

    Moonsweeper

  • 436 posts

Posted Thu Jan 12, 2017 9:00 AM

Here's mine.

Joystick



#22 --- Ω --- OFFLINE  

--- Ω ---

    TI-Runner

  • Topic Starter
  • 10,600 posts

Posted Thu Jan 12, 2017 9:25 AM

Here's mine.

 

You have this interfaced to your TI?

 

med_gallery_35324_1027_46248.jpg



#23 Tursi OFFLINE  

Tursi

    River Patroller

  • 4,822 posts
  • HarmlessLion
  • Location:BUR

Posted Thu Jan 12, 2017 5:15 PM

--- Ω ---, 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.



#24 --- Ω --- OFFLINE  

--- Ω ---

    TI-Runner

  • Topic Starter
  • 10,600 posts

Posted Thu Jan 12, 2017 6:28 PM

 

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. 



#25 Tursi OFFLINE  

Tursi

    River Patroller

  • 4,822 posts
  • HarmlessLion
  • Location:BUR

Posted Thu Jan 12, 2017 6:37 PM

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. :)






0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users