Pages

Monday, December 26, 2011

SMS emulator with original pads

I have always liked the SEGA consoles (and games) more than the Nintendo stuff. So I decided to install an emulator for my old SEGA Master System games and build an adapter to play the SMS games with the original gamepad on my old 650MHz Notebook. The reason that I play the games on my old notebook is simple: I have no new workstation or notebook with a parallel port anymore. Before you start make sure that your parallel port supports EPP:

# dmesg | grep parport
...
parport0: PC-style at 0x378, irq 7 [PCSPP,TRISTATE,EPP]
...

Then build an adapter like the following schematics:


The following image is the adapter I have build (opened):


If you have setup your adapter then remove the lp module first:

# rmmod lp

Next load the db9 module:

# modprobe db9 dev=0,2

Check the logs:

# dmesg
...
input: Multisystem joystick (2 fire) as /devices/virtual/input/input7

And check that the input device was created:

# ls /dev/input/js*
/dev/input/js0

Then do a simple check that the gamepad works. Execute cat on the js device and press any button on your gamepad. You should see some weird characters on your screen:

# cat /dev/input/js0
...

The parameters for the db9 module are easy: the first 0 is for the parallel port you want to use, in my case I use the first and only port on my notebook. If you want to use the second port then type 1 etc. The second digit defines the gamepad to use, here is a short list:

0 None
1 Multisystem 1-button joystick
2 Multisystem 2-button joystick
...

The SEGA Master System gamepads are Multisystem gamepads with 2 buttons, so 2 is the the appropiate choice here. Next you need an emulator for you roms. I like to use mednafen, it supports a lot of other consoles to. First get the source eg. from http://sourceforge.net/projects/mednafen/files/Mednafen/0.8.D.3/mednafen-0.8.D.3.tar.bz2/download. Then move the tar package to /usr/src and extract it:

# mv mednafen-0.8.D.3.tar.bz2 /usr/src
# cd /usr/src
# tar xf mednafen-0.8.D.3.tar.bz2

Then change into the new directory and configure the source:

# cd mednafen
# ./configure --prefix=/usr/games
...

Compile the sources and install the binaries:

# make
...
# make install
...

With the db9 driver loaded and mednafen installed you should be able to play a good old SEGA Master System rom:

$ /usr/games/bin/mednafen ~/custom_rom.sms

You can configure the first pad by pressing ALT+SHIFT+1 simultanously. Just follow the questions on the bottom of the screen.

Links:
Documentation how to set up an adapter and which gamepads are supported:
http://www.mjmwired.net/kernel/Documentation/input/joystick-parport.txt

No comments:

Post a Comment