Forums

Sega Master System / Mark III / Game Gear
SG-1000 / SC-3000 / SF-7000 / OMV
Home - Forums - Games - Scans - Maps - Cheats - Credits
Music - Videos - Development - Hacks - Translations - Homebrew

View topic - Read joypad through Game Gear's cartridge Pins

Reply to topic
Author Message
  • Joined: 06 Sep 2023
  • Posts: 3
Reply with quote
Read joypad through Game Gear's cartridge Pins
Post Posted: Wed Sep 06, 2023 9:49 am
Greating,

For a personal project, I will need to do something a bit tricky that requieres some good knowledge in Sega hardware and electronic obv.
Maybe for some of you it will seems simple but anyway, here is what I'm trying to do :

Getting joystick informations from a Game Gear cartridge slot.

To be more precise and after reading the GG Hardware Reference Manual I have to retrieve data from 8 pins (D0-D7), each bit to 0 meaning that corresponding button is pressed.

But, when am I supposed to read this data as D0-D7 are used for a lot of other things ?

BTW I'm planing to redirect those 8 pins to a esp32's GPIO in order to process data.


Thanks for your help
  View user's profile Send private message
  • Joined: 06 Mar 2022
  • Posts: 671
  • Location: London, UK
Reply with quote
Post Posted: Wed Sep 06, 2023 10:01 am
Greating to you too @Galix! ;)

Assuming that the Game Gear works like a Master System in this respect and drives the cartridge port buses while reading from the control port (it may not!), then you just need to decode the I/O read request in addition to reading the data port.

Since most of what you need is read through port $DC in software, you can fully decode the read by registering the values on the data port only when address lines A7:0 read 11011100, and when #RD is 0, and when #IOREQ is 0.

You might be able to get away with a partial decode. The SMS decodes only A7, A6 and A0, in which case you'd be looking for a 1, 1 and 0 respectively; but I know the GG has some more ports and itself fully decodes all the address lines, so it might not be enough. Will get back to you.

EDIT: quickly flicking through this doc one might guess that a partial decode of A6, A7 and A0 would probably work.

The start / pause button is a bit different - for that you need to watch the #NMI line, which I don't think is exposed through the cart slot :(
If you really need to catch it, you could maybe watch for a memory read to address $0066 where #M1 is 0 and #RFSH is 1 - I think!
  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 14745
  • Location: London
Reply with quote
Post Posted: Wed Sep 06, 2023 10:28 am
Last edited by Maxim on Wed Sep 06, 2023 12:28 pm; edited 1 time in total
I guess it’s worth mentioning that this would be snooping on the bus while a game is running. If there is no game then it won’t work. Depending on what you’re trying to achieve, you might instead have to create a ROM to drive the host system to do what you need; but it can also then present the results to you in a form that’s easier to handle, eg by writing it to another memory or IO address.
  View user's profile Send private message Visit poster's website
  • Joined: 06 Mar 2022
  • Posts: 671
  • Location: London, UK
Reply with quote
Post Posted: Wed Sep 06, 2023 10:39 am
Maxim wrote
I guess it’s worth mentioning that this would be snooping on the bus while a game is running. If there is no game then it won’t work. Depending on what you’re trying to achieve, you might instead have to create a ROM to drive the host system to do what you need; but it can also then present the results to you in a form that’s easier to handle, eg by writing it to another memory or IO address.

Hmmm, that is a very interesting thought — I hadn't considered that! You're right, you could write a ROM which polled the control port constantly and then send the results to your snooper in whatever form you wanted. That said, the amount of logic you'd need to decode an arbitrary memory or I/O operation I think would broadly similar to what you'd need to decode a true read from the control port.
  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 14745
  • Location: London
Reply with quote
Post Posted: Wed Sep 06, 2023 12:27 pm
Indeed - but you could combine the start button and regular controls reading together on the Z80 side so you’d only need to snoop one thing.
  View user's profile Send private message Visit poster's website
  • Joined: 06 Sep 2023
  • Posts: 3
Reply with quote
Post Posted: Thu Sep 07, 2023 8:44 am
Thank you gentlemen for all this clear explanations !! :)

Did I mentionned that I wanted to use Joystick with the Tuner TV ? My project is simply to transform a Tuner TV to a RetroPie player that works on any Game Gear.

But I discovered there is a "TV" pin that allows to change de cartridge data mapping and I hope joystick is not disabled (I also saw that most of the pins a not connected but I can fix this.)

I will compare values with a random game and with a tuner TV ... and hope I still receive the buttons infos ¯\_(ツ)_/¯

I'll tell you
  View user's profile Send private message
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 14745
  • Location: London
Reply with quote
Post Posted: Thu Sep 07, 2023 11:00 am
When in TV mode, the whole Game Gear is shut down and the cartridge port is just an LCD interface. There’s no CPU, no ROM or RAM, and nothing reading the buttons. Sorry, I don’t think this is possible.
  View user's profile Send private message Visit poster's website
  • Joined: 06 Sep 2023
  • Posts: 3
Reply with quote
Post Posted: Thu Sep 07, 2023 12:14 pm
Argh thanks Maxim :')

Guess my remaining options will be :
- Wireless Pad
- Modify a Game Gear to expose a USB interface

I don't want to modify my Game Gears, so I'm good to buy an other one.


Anyway, thanks again for your precious help guys
  View user's profile Send private message
Reply to topic



Back to the top of this page

Back to SMS Power!