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 - Hacks for using Mega Drive controllers in SMS games

Reply to topic
Author Message
  • Joined: 20 Feb 2008
  • Posts: 117
  • Location: Saintes, France
Reply with quote
Hacks for using Mega Drive controllers in SMS games
Post Posted: Mon Nov 24, 2014 10:24 am
[Admin: split from Game Gear games on SMS / Megadrive Genesis, no longer off-topic...

This thread is for hacks to SMS games to enable using a Mega Drive (or Genesis, or Megadrive) controller. This is typically to enable the Start button on the controller to act the same as the Pause button on the console, with no hardware mods.]

OFF TOPIC : Wonder Boy - The Dragon's Trap hacked to have a MD joypad START button used as the SMS PAUSE button ;)

  View user's profile Send private message
  • Joined: 14 Jul 2008
  • Posts: 150
Reply with quote
Post Posted: Mon Nov 24, 2014 7:06 pm
vingazole wrote
OFF TOPIC : Wonder Boy - The Dragon's Trap hacked to have a MD joypad START button used as the SMS PAUSE button ;)


Awesome job, vingazole.

Is there any chance this could be done too with Wonder Boy in Monster World? AKA Wonder Boy V Monster World III, not the Monster World game which is known outside Japan as Wonder Boy in Monster Land.

That's the worst issue I have ever had with the Master System version of that game. You have to access the inventory a lot of times and doing it through the Master System "Pause" button is such a pain. I usually play this version on the Game Gear because of this.
  View user's profile Send private message
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 13290
  • Location: London
Reply with quote
Post Posted: Mon Nov 24, 2014 7:42 pm
Almost any game can be hacked this way.
  View user's profile Send private message Visit poster's website
  • Joined: 20 Feb 2008
  • Posts: 117
  • Location: Saintes, France
Reply with quote
Post Posted: Mon Nov 24, 2014 10:03 pm
Wesker wrote
Is there any chance this could be done too with Wonder Boy in Monster World? AKA Wonder Boy V Monster World III, not the Monster World game which is known outside Japan as Wonder Boy in Monster Land.


I hope this is the game you were talking about...

  View user's profile Send private message
  • Joined: 14 Jul 2008
  • Posts: 150
Reply with quote
Post Posted: Mon Nov 24, 2014 11:50 pm
vingazole wrote
Wesker wrote
Is there any chance this could be done too with Wonder Boy in Monster World? AKA Wonder Boy V Monster World III, not the Monster World game which is known outside Japan as Wonder Boy in Monster Land.


I hope this is the game you were talking about...


Indeed!

Thank you so much. This Master System port is now much more playable on an unmodified Master System (that is, without this modification).

On a related note, maybe there should be a separate thread for these Mega Drive controller Start button hacks when they are performed to existing Master System games and not to Game Gear to Master System ports.
  View user's profile Send private message
  • Joined: 23 Apr 2014
  • Posts: 116
  • Location: NYC
Reply with quote
Post Posted: Tue Nov 25, 2014 3:52 pm
Wesker wrote
maybe there should be a separate thread for these Mega Drive controller Start button hacks when they are performed to existing Master System games and not to Game Gear to Master System ports.

Good idea. These are awesome patches and shouldn't be lost in a random forum page.

Maxim, can we create a new hacks section for these? Wesker / vingazole, maybe create a new thread too?
  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 13290
  • Location: London
Reply with quote
Post Posted: Tue Nov 25, 2014 7:28 pm
I split the forum topic.

There's some overlap between GG2SMS and MD controller hacks, but I'd say the GG2SMS ones should live in the GG2SMS section (maybe even in the same archive as variants of the patch without this).

I've added a section for controller patches to the Hacks page, and it will pick up pages ending in the word "Controller". So I suggest we start with:

http://www.smspower.org/hacks/WonderBoyIII-SMS-MegaDriveController
http://www.smspower.org/hacks/WonderBoyInMonsterWorld-SMS-MegaDriveController

Let's stick with "Mega Drive" for the controller distinction. I'm thinking we can add in patches for paddle compatibility on export systems (there's a thread for that) and any future patches for using regular controllers on paddle games.

vingazole, are you providing 6-button controller compatibility? I'm not sure how that works, though...
  View user's profile Send private message Visit poster's website
  • Joined: 20 Feb 2008
  • Posts: 117
  • Location: Saintes, France
Reply with quote
Post Posted: Tue Nov 25, 2014 9:30 pm
Thank you, Maxim. I should have created a new topic but I hadn't the time at first (I'm on my afternoon shift this week [1:00 pm-9:00 pm]), and I must admit I've been too lazy afterwards ^^

From what I understand, it should work on a 6-button controller as there is a kind of "backward compatibility" with the 3-button controller : http://www.db-elec.com/home/technical-info/Genesis/gamepad-protocol

Anyway, I only have 3-button MD controllers, I couldn't test the 6-button gamepad behaviour myself...

I read the state of the controller using this code :
  ld     a,$0D     ; configure TH as an output, set TH=0
  out    ($3F),a   ;

  in     a,($DC)   ; read START button status
  bit    5,a       ;

  call   z,$66     ; if it is 0 (button pressed), call the PAUSE routine

  ld     a,$2D     ; configure TH as an output, set TH=1
  out    ($3F),a   ;

  in     a,($DC)   ; read  SMS "standard" buttons
  View user's profile Send private message
  • Joined: 14 Jul 2008
  • Posts: 150
Reply with quote
Post Posted: Tue Nov 25, 2014 10:25 pm
I can confirm both hacks work perfectly using a 6-button controller.
  View user's profile Send private message
  • Joined: 17 Sep 2013
  • Posts: 115
  • Location: Gravataí, RS, Brazil
Reply with quote
Post Posted: Wed Nov 26, 2014 12:02 am
vingazole wrote
Thank you, Maxim. I should have created a new topic but I hadn't the time at first (I'm on my afternoon shift this week [1:00 pm-9:00 pm]), and I must admit I've been too lazy afterwards ^^

From what I understand, it should work on a 6-button controller as there is a kind of "backward compatibility" with the 3-button controller : http://www.db-elec.com/home/technical-info/Genesis/gamepad-protocol

Anyway, I only have 3-button MD controllers, I couldn't test the 6-button gamepad behaviour myself...

I read the state of the controller using this code :
  ld     a,$0D     ; configure TH as an output, set TH=0
  out    ($3F),a   ;

  in     a,($DC)   ; read START button status
  bit    5,a       ;

  call   z,$66     ; if it is 0 (button pressed), call the PAUSE routine

  ld     a,$2D     ; configure TH as an output, set TH=1
  out    ($3F),a   ;

  in     a,($DC)   ; read  SMS "standard" buttons


If you hold the mode button while turning on the system, it will work exactly like a 3-button pad, so testing with a 3-button controller is good enought.

I noticed that you didn't put any delay between setting TH and reading the buttons. This couldn't cause some problems depending on the revision of the pad?
  View user's profile Send private message
  • Joined: 31 Oct 2007
  • Posts: 847
  • Location: Estonia, Rapla city
Reply with quote
Post Posted: Wed Nov 26, 2014 12:02 am
For 6 button controllers you need to make sure you don't read controllers more than once a frame.
  View user's profile Send private message Visit poster's website
  • Joined: 20 Feb 2008
  • Posts: 117
  • Location: Saintes, France
Reply with quote
Post Posted: Wed Nov 26, 2014 8:32 am
gvx32 wrote
I noticed that you didn't put any delay between setting TH and reading the buttons. This couldn't cause some problems depending on the revision of the pad?

I wasn't aware of this. Do you know what would be the correct delay to be added between setting TH and reading the buttons ?

TmEE wrote
For 6 button controllers you need to make sure you don't read controllers more than once a frame.

I guess that's what games usually do (at least to avoid reading potential rebounds on the contacts).
  View user's profile Send private message
  • Joined: 31 Oct 2007
  • Posts: 847
  • Location: Estonia, Rapla city
Reply with quote
Post Posted: Wed Nov 26, 2014 2:04 pm
On 68K side on MD you need two NOPs after changing TH to avoid "autofire" effect. Z80 is significantly slower and you can do without deliberate delays.
  View user's profile Send private message Visit poster's website
  • Joined: 29 Oct 2014
  • Posts: 89
  • Location: Chicagoland, USA
Reply with quote
Post Posted: Wed Nov 26, 2014 4:45 pm
I made a little adapter with a couple of DB9 sockets (one male, one female) which cuts the select line (pin 7) from the console side and wires pin 7 to pin 5 on the controller side with a 100K resistor. Works great for Carmen Sandiego :) It disables Start/A/X/Y/Z/Mode from being read, but way cheaper than finding an SMS pad ;)
  View user's profile Send private message
  • Joined: 17 Sep 2013
  • Posts: 115
  • Location: Gravataí, RS, Brazil
Reply with quote
Post Posted: Wed Nov 26, 2014 8:26 pm
vingazole wrote
gvx32 wrote
I noticed that you didn't put any delay between setting TH and reading the buttons. This couldn't cause some problems depending on the revision of the pad?

I wasn't aware of this. Do you know what would be the correct delay to be added between setting TH and reading the buttons ?

TmEE wrote
For 6 button controllers you need to make sure you don't read controllers more than once a frame.

I guess that's what games usually do (at least to avoid reading potential rebounds on the contacts).


Well, when I was developing my reading routine, if I had no delay, some of the buttons won't work, Now I don't remember witch ones.

Also, Charles' Genesis pad demo uses 4 nops.

this is my routine:


.section "readMegaDriveController" free
readMegaDriveController:
   ; TH = 1 : ?1CBRLDU      3-button pad return value
   in a, ($DC)
   or $c0
   ld b, a

   ; TH = 0 : ?0SA00DU      3-button pad return value
   ld a, Th.lo
   out ($3F), a

   ld hl, pauseButtonPressed
   ld a, (hl)
   and b
   ld b, a
   ld (hl), $ff

   in a, ($DC)
   rlca
   rlca
   or $3f
   and b
   ld (noHoldedKeys), a

   ;Set TH hi for the next pass
   ld a, Th.hi
   out ($3F), a
   jp endControlReading
.ends


the first delay is to map the console pause button into the start button. The second delay is the time between two readings, this works both with a 3-button or a 6-button controller. But the logic here is a little reverse, You read the start button and call the pause interrupt when necessary. I set a flag on the pause interrupt and then add to the controls readings.
  View user's profile Send private message
  • Joined: 20 Feb 2008
  • Posts: 117
  • Location: Saintes, France
Reply with quote
Post Posted: Wed Nov 26, 2014 9:07 pm
OK, I'm going to insert 2 NOPs after writing to port $3F and before reading port $DC (soon....).
  View user's profile Send private message
  • Joined: 19 Apr 2009
  • Posts: 11
Reply with quote
Post Posted: Sun Apr 12, 2015 5:34 pm
Hello, is possible to map the not used Mega Drive A-BUTTON as an auxiliary Master System BUTTON-2 for Makai Retsuden and Alex Kidd Miracle World (Japan version) ? I can do the hack by myself but I can't find the correct rom addresses..

please help:)
  View user's profile Send private message
  • Joined: 20 Feb 2008
  • Posts: 117
  • Location: Saintes, France
Reply with quote
Post Posted: Wed Apr 22, 2015 7:12 pm
The controller is polled at $1024 in Makai Retsuden and at $356 in AKIMW(J).

You will find IPS patches for Alex Kidd in Miracle World (J) and for Makai Retsuden (the japanese "Kung Fu Kid") attached to this message : with a Megadrive controller, you'll be able to use whether button A or button C as the SMS button 2, button B being mapped to button 1.

(I hope I didn't break anything in Makai Retsuden as I've put my code in the first series of 0s I found in the ROM...)

  View user's profile Send private message
  • Joined: 19 Apr 2009
  • Posts: 11
Reply with quote
Post Posted: Wed Apr 22, 2015 8:47 pm
great ! You saved the day :)

I'll try to use your codes for another couple of old japanese games that really need standard button layout and pause button..thx
  View user's profile Send private message
  • Joined: 13 Apr 2005
  • Posts: 207
  • Location: Aracruz - ES, Brazil
Reply with quote
Post Posted: Fri Jun 05, 2015 9:01 pm
Last edited by rouken on Sat Jun 06, 2015 11:57 am; edited 1 time in total
I was thinking... It's possible to add a controller detection command to make the patched games detect if a Master System or Mega Drive controller is connected, and set the game to use the current controller?



Another thing... It's possible to make special movemets of specific games do be activated using one of the not-used Genesis button instead of a special command?

Examples of games can use an unique button to active special movements...
> Golden Axe = Magic (1+2)
> E-Swat = Special Weapon (1+2)
> Wonderboy in Monster Land = Special Item (Down)
> Altered Beast = Jump (1+2)
> Asterix = Special Item (Up + 1, Down + 1)
> Asterix and the Secret Mission = Run (Hold 1)
> Mortal Kombat = Block (Back + 1)
> Ninja Princess / The Ninja = Disappear (1+2)
  View user's profile Send private message
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 13290
  • Location: London
Reply with quote
Post Posted: Fri Jun 05, 2015 11:15 pm
Yes, all of these are probably possible.
  View user's profile Send private message Visit poster's website
  • Joined: 10 Aug 2005
  • Posts: 78
Reply with quote
Post Posted: Fri Jun 05, 2015 11:25 pm
It would be amazing to see some of the GG to SMS conversions changed to use the start button of a Mega Drive pad.
  View user's profile Send private message
  • Joined: 19 Apr 2009
  • Posts: 11
Reply with quote
Post Posted: Sat Sep 19, 2015 3:30 pm
Quote
(I hope I didn't break anything in Makai Retsuden as I've put my code in the first series of 0s I found in the ROM...)



played non stop and work perfect:)

for Miracle World [J] and Lord of Sword [J] is possible to do the two hacks (pause button + auxiliary A button) work in the game ?
  View user's profile Send private message
  • Joined: 19 Apr 2009
  • Posts: 11
Reply with quote
Post Posted: Sun Jan 17, 2016 1:10 pm
found some japanese dumps/hacks that have MD start button mapped:

Chase HQ [o] or [S]
Castle Of Illusion [a1] (rom need fixed with sms checker to run in real hardware)


vingazole, would you write a brief tutorial on how hack start / A button ? I'm stuck with:

1st: locate where the controller is polled
the instruction is usually DB DC at the begin of the rom

2st: locate some empty space (zeroes or FF)
and remermber the address location

about the z80 thing, use CALL or JUMP ?
the *universal* code for START is (?)

3E 0D D3 3F DB DC CB 6F CC 66 00 3E 2D D3 3F DB DC 2F
(+C9 at the end only for Monster World II)

the *universal code for A is (?)

06 00 3E 0D D3 3F 00 00 DB DC CB 67 20 02 06 20 3E 2D D3 3F 00 00 DB DC 2F E6 3F B0
(+C9 at the end only for Makairetsuden)
  View user's profile Send private message
  • Joined: 20 Feb 2008
  • Posts: 117
  • Location: Saintes, France
Reply with quote
Post Posted: Sun Jan 17, 2016 3:00 pm
1. Use Meka's debugger and set a breakpoint to stop the program each time it polls the controller :

b r io dc

(type "c" to resume)

2. Use your hex editor, very often there is some spare space available around $7FF0 ;)
Don't search beyond $7FFF otherwise you'd have to take care about paging.

(3). Do what you prefer, with CALL you won't have to put a JUMP at the end of the code.

(4) Sorry, I won't check hex codes :/
You should use wla-z80 for your hacks instead of a hex editor : http://www.smspower.org/maxim/Maps/AsterixAndTheGreatRescue
  View user's profile Send private message
  • Joined: 16 May 2016
  • Posts: 5
  • Location: Recife, Brazil
Reply with quote
Post Posted: Mon Jun 20, 2016 9:04 pm
Would be possible to instead of doing a software hack in all roms to do a hardware hack? Use a microcontroller to detect when Genesis 3-pad or 6-pad controller are connected and then send TH signals to detect pause button. Without genesis controllers on the port, the microcontroller would allow normal behaviour of the system.
  View user's profile Send private message
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 13290
  • Location: London
Reply with quote
Post Posted: Tue Jun 21, 2016 8:48 am
Yes, it would be fairly easy to demultiplex the Mega Drive pad and then feed the Master System with the appropriate signals. With a bit more work you could also support USB and Bluetooth controllers, although the button mapping might be tricky to configure at runtime.
  View user's profile Send private message Visit poster's website
  • Joined: 16 May 2016
  • Posts: 5
  • Location: Recife, Brazil
Reply with quote
Post Posted: Tue Jun 21, 2016 6:01 pm
The problem is, wouldn't this TH signal I'm generating interfere with the system recognition of the signals, much like the games that doesn't support genesis controllers? I would probably need to desolder the controller connectors and send the signals from the controller straight to the microcontroller, and then get the signals from the microcontroller and send to the system. Then I could also add bluetooth internally.

For Genesis 3-pad, 6-pad the TH signal would be generated by the microcontroller for demultiplexing.

I would also need to send the TH signal from the system to the controller through the microcontroller in case it doesn't detect a genesis controller in case a light phaser is connected.
  View user's profile Send private message
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 13290
  • Location: London
Reply with quote
Post Posted: Tue Jun 21, 2016 6:21 pm
Yes, I was thinking that the controller would sit in between rather than trying to inject signals.
  View user's profile Send private message Visit poster's website
  • Joined: 12 Nov 2017
  • Posts: 3
Reply with quote
Post Posted: Sun Nov 12, 2017 8:43 am
Hi all,

can someone try to do the same, or explain how to do, the same for Alex Kidd in Miracle World ?

Thanks a lot
  View user's profile Send private message
  • Joined: 19 Apr 2009
  • Posts: 11
Reply with quote
Post Posted: Mon Aug 27, 2018 3:46 pm
use the last version of kidded, on the hacks list there is md start button mapping but work only with rev01 UE version
  View user's profile Send private message
  • Joined: 15 Oct 2017
  • Posts: 4
  • Location: Bari (Italy)
Reply with quote
Post Posted: Thu Aug 30, 2018 7:02 am
please guys hacks Psycho Fox to the same!!
  View user's profile Send private message
  • Joined: 19 Apr 2009
  • Posts: 11
Reply with quote
Post Posted: Fri Jul 10, 2020 4:33 pm
seconded

I think games that use pause as MENU BUTTON, frequently used as in PF, should be mapped to A instead of START :)
  View user's profile Send private message
Reply to topic



Back to the top of this page

Back to SMS Power!