USB reader for SNES game carts

posted Jun 19th 2009 4:00pm by
filed under: home entertainment hacks, news, nintendo hacks

Reader, [Matthias_H], sent in a video about his USB adapter for SNES game carts. All you have to do is plug in the SNES game cartridge and USB cable, then a ROM file of the game shows up as an external storage device on your computer. After that, you can play the ROM with your choice of emulator. We emailed [Matthias] asking for more information, and he quickly replied with a very nice writeup about the hack that is pasted below.

Update: [Matthias] launched a site for the “snega2usb” with updates on the development of the board and a FAQ.

[Matthias] writes:

Part list:
Atmel AT90USBKey Evaluation Board (Digikey – $30)
FCI 10046971-003LF 70-pos. 2-row connector (Digikey – $4.76)
a little piece of prototyping board to solder the connector onto
thousands of little wires

I used the following reference documents:
http://www.emulatronia.com/doctec/consolas/snes/sneskart.html
(SNES cart pinout and ROM memory map)
http://www.microsoft.com/whdc/system/platform/firmware/fatgen.mspx
(FAT16/32 specs)

The somewhat ugly cable solution is due to the USBKey’s weird choice for .05″ pitch port connectors, for which I was not able to find suitable pin headers and ribbon cable connectors. The exact pinout is a bit weird and not worth publishing yet, since many of the I/O pins are in fact shared by the onboard peripherals, so I have to spread the address and data bits among the available pins. A cleaner version with all parts on a custom PCB is on its way, as well as support for the Sega Genesis (working hard towards the all-in-one solution :-))

Code is based on the Atmel USB Mass Storage example app, to which I added a module for ROM access and a read-only FAT16 (the latter was hard-coded in a hex editor – FUN!). Again, development is still at a very early stage (I tested this on exactly one game cart), and as of now, redistribution of the source is in fact prohibited by Atmel’s proprietary license.

I’m not quite satisfied with the data rate yet. As of now, newer-generation console carts (N64 etc), while absolutely possible to read out, would take forever to load. The device is running at USB 2.0 full-speed (12 Mbps), and I am not aware of any cheap solution that offers high-speed USB (480 Mbps).

Open issues:
- testing with as many different games as possible (feel free to donate your least favorite game carts! :-))
- issuing a refresh when the cartridge is removed/replaced! The USB Mass Storage protocol uses the SCSI command set, so the device cannot send requests (“refresh directory, file may have changed”) to the host.
- optimization for speed
- add compatibility for HiROM games

By the way, I’ve never done anything like this before. The fact that it was so easy kind of scares the hell out of me ;-)

I think this is as exhaustive a description as I can give for now.
Hope you’re fine with it.

-Matthias



78 Responses to USB reader for SNES game carts

  • Lupin says:

    wow, it’s playing “directly” from cart! Really nice. Kicks ass!

  • Matthias_H says:

    @foley: Please name
    (1) ONE eSATA capable microcontroller that is within reach for hobbyist developers and
    (2) ONE smartphone or portable open handheld with eSATA interface

    There you go. (1) Impossible and (2) useless :-)

  • GaryC says:

    Nice Job! Can’t wait to see one that supports Mega Drive carts too :)

  • sly says:

    all-in-one system? that would have about … atari, nes, snes, master system (card and cart), genesis, n64… we’re looking at about 7 or more cart slots. That’s ambitious! and I want one if it gets pulled off.

  • KnightGeek says:

    Dude! You need to keep us posted on this! This could actually be a product I would pay good money for (assuming a reasonable price)!

  • smilr says:

    Favorite part of the video:
    “Awww…crud.”
    :)

  • Matthias_H says:

    @sly: Don’t forget the handhelds…. :) No, seriously: I’m doing exactly the platforms that I think are worth it (also, of course they need to be documented somewhere). If you think I should think your favorite console is worth it, you should start sending me game cartridges NOW ;-)

  • Tordre says:

    First off awesome…
    Secondly awesome…

    Third i pondered doing this back in my days of high school, the idea was to fill a bunch of 5.25 drive slots in a computer with different game consoles and play directly off the original carts. I am glad someone has more initiative than me.

    Forth a great addition but seems like it would be much more work. Make it so you can write the save file directly to it. This would probably need a custom emu or special decode on your usb board because i don’t think emus save the same format as the games itself.

    Fifth… Don’t stop.

  • foley says:

    @Matthias_H

    1) I have no idea what your price range is or capabilities.

    2) I didn’t realize that was the intended use. I assumed if you were going to be using bulky cartridges that portability was not the intent.

    My point was to see if it was a possibility. If it does not meet the requirements of your intended use then that is all well and good. This does not make it impossible nor useless.

  • foley says:

    Tordre said the type of application I was thinking of.

  • nubie says:

    Oh god, just waiting for the lawsuits.

    Does it create a filename? Cool, must check it out later.

  • nubie says:

    Love the genesis, hope that works :)

  • Matthias_H says:

    @foley: Just look at the sophisticated cabling, and you will get a pretty good estimate about my price range and capabilities ;-) Portability was in fact a key issue when I came up with the idea. The smaller the host device, the larger the eyes of the people around you when you plug a huge SNES cartridge into it ;-)

    @tordre: (ad savegames to the device) Probably not. Most emulators I’ve met tend to store savegames in their own directory. Also, this would mean I have to add a considerable amount of rewritable external memory to the circuit. Strictly sticking to a read-only structure keeps the effort on a tolerable level.

    @nubie: Lawsuits? Please elaborate. The filename and size are taken straight from the info header on the cartridge. This will probably break once the first Japanese cart comes along :-)

    @everyone: Genesis support is definitely coming, but for now I guess this is it. Perhaps someday I’ll build a limited number of overpriced all-in-one readers coated with 24kt sheet gold and encrusted with diamonds ;-)

  • Spork says:

    Very nice hack, I really like to see this cross-platform interface. It would be interesting to have a modular socket for the carts and maybe a modular socket for controllers. This could be a method to allow gamers to play nostalgia games on their PC!

    @nubie

    I don’t see any room for lawsuits, as long as he doesn’t release any copy written code.

  • Tordre says:

    foley, i think we are not alone, me and my friends have all dreamed of the ultimate universal retro system.

    Since i am the more technical of the bunch i put way more thought into it. The one thing we could never agree on would be is what control will we use. One of my friends suggest make the ultimate controller for convenient use with all systems emulated. I was all for having the right ports for all the old controller, but that would make too much clutter.

  • Jordan says:

    Aww yea getting my roms from Russian porn sites ;)

  • brian says:

    this is begging for a remake using an avropendous and LUFA.

  • phreak97 says:

    Nice work!
    I love projects like this, i’ve never started with just an idea though.
    Truthfully It’s a just for fun project right? So anyone saying it isnt useful or that it’s too hard are looking at it the wrong way or are not the people this is targeted at.

    I havnt looked at the datasheets, but I’ve got heaps of Atmel ATMEGA8-16′s which were cheap on ebay.. do these have the capabilities required for this project?

    would it be possible some time down the track to copy save data to and from the cartridge? I own all the original consoles for my games and I really dont enjoy playing games emulated, but I sure would love to back up my saves.. I’m a collector and I have enough games that it often takes me years to get back into a game I’ve started. more than once I’ve gone back to find the battery in the cart had died and lost my save.

  • strider_mt2k says:

    very cool work!

    Well done!

  • thecityspiders says:

    Very nice hack.I can see this as a nice way to get rom images from your own carts instead of ripping off a unreliable site.
    Which means if you own the cart no real legal issues … {not many to begin with}
    Support for Sega sounds great ;because there are a ton of super cool Sega games out there.
    Having more than one cart slot will pose an issue with the current controller being used etc …
    Perhaps others have tried this before and would like to share some tips or a bit of their source code that they wrote from scratch ;)

  • Matthias_H says:

    @thecityspiders – you want source code candy? Here you are:

    // hard-coded FAT16 reserved area (sector 0)
    const U8 Sector0[] = “\xEB\x3C\x90MSDOS5.0\x00\x02\x01\x02\x00\
    \x02\x00\x02\x00\x80\xf8\x7f\x00\x3f\x00\xff\x00\x00\x00\x00\x00\
    \x00\x00\x00\x00\x00\x00\x29\x12\x34\x56\x78NO NA\
    ME FAT16 \x33\xC9\
    \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\
    [more zeros]
    \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x55\xAA”;

    // How to assemble a long filename from SNES cartridge name field. These are the offsets in Sector 256 for the 21 letters (plus 5 more for extension and terminating null) of the game title
    const U8 VfatAddr[] = “\
    \x41\x43\x45\x47\x49\x4E\x50\x52\x54\x56\x58\x5C\x5E\
    \x21\x23\x25\x27\x29\x2E\x30\x32\x34\x36\x38\x3C\x3E”;

    ;-)

  • Matthias_H says:

    Seriously: During the early debugging phase, I compared “my” SMW image on a binary level to various ROMs of what I thought should be the same game. Turns out that many of the roms that can be obtained through said channels are in fact far from original rips. You find all kinds of glitches and watermarks, but also signatures of other tools:
    ———–
    Lunar Magic Version 1.51 ©2002 FuSoYa, Defender of Relm http://fusoya.cjb.net fusoya@moon.co.jp I am Naaall, and I love fiiiish!
    ———–

  • michaelb says:

    Really nice! I really want this (or how to make it).
    .. but… how many zeros are in [more zeros]?

  • ian says:

    @matthias_h – Nice work, and clever fake-out of the FAT tables. Another way to get them would be to copy the tables from an SD card using a hex editor (my lazy method).

    Converting the game title and using it for the file name is super sweet. I’d probably just expose a single file called ‘game.rom’. It’s easier, and Microsoft claims active patents on the use of long file names in the FAT file system (one reason why digital cameras stick with 8.3 naming format).

  • mrrix32 says:

    Cool!
    I was thinking of “making” a N64, using a small PC, some Controler to USB leads and some ROMS, if I could get this working then I can skip the ROMs!

    (I have an N64, I want to be able to add stuff like high res textures and online play. Also I want to be able to claim I got my N64 to play DVDs :P)

  • foley says:

    @Matthias_H

    Right on man, I meant no disrespect. Great job. I was just thinking of a device that you could plug into your comp and have just sit there. Then you could have one possibly with multiple cartridge ports and a built in emulator, kind of like an all in one classic game station. I think I was dreaming outside of the original design ideals. LOL I just got carried away.

  • foley says:

    *edit* When I said ‘built in’ I meant ‘accompanying’ it’s early and I’m tired.

  • Matthias_H says:

    @ian: Using the same filename for all games will get you in trouble with the savegame handling, since most emulators relate their nomenclature to the ROM name. Since Microsoft has filed a patent infringement lawsuit related to FAT exactly once (TomTom), I don’t think I am in big danger here… Otherwise, I’m simply going to switch to unique 8-char hashes, retaining the possibility for savegame identification.

    @foley: No offense taken and none intended from my side. My only PC happens to be this laptop (with an OpenPandora to come soon, hopefully), so this is what I am developing for.

    @michaelb: Just add zeros until you have a total of 512 bytes :-)

  • digidev says:

    Awesome HaX0ry!! A pretty neat idea and it would be cool if use with one of these: http://www.joystiq.com/2009/06/20/modders-gut-an-snes-cram-in-a-pc/ !

  • Shabadage says:

    Heya Matthias! Glad to see you’re still plugging along! Great hardware hacking here. You just keep getting better and better!

  • Andrewr05 says:

    That pretty awesome dude, it is amazing that it was that easy. This has the potential to be the next “big thing”, if I were you I would try to secure your work so some company doesn’t pop out of nowhere and gobble up your idea.

  • MarkyB86 says:

    This is freaking amazing. IF you ever are to produce another, and have a reasonable price please inform me!

  • YLS says:

    it’s a kool project, would be nice to use with the Pandora for quick game transfers

  • Jiremi says:

    Does this have write capabilities? It would be awesome if I could take a spare cartridge and put whatever I want on it.

  • Teebo says:

    Beautiful. A hack I like. Could you ever do the opposite setup, ie make your own cuttle cart that just draws in the data from a system?

    I would love to see this setup for all consoles. You would have the ultimate cart tester & hybrid emulator(ie real hardware carts, software-driven console).

  • Matthias_H says:

    @jiremi: no, it doesn’t, and since I am not a homebrew person, this is not on my list even in the long term. In the limited time I have, there are only so many things I can focus on, and I hope nobody will mind if I pick the ones that matter the most to myself.

    Which are, as of now:
    - reading game carts correctly
    - getting more games to work
    - adding genesis/megadrive support
    - custom PCB and a nice case
    - possibly organizing a group order for kits

    The following, among many others, are definitely not on my list:
    - fighting with bitchy games that I don’t care about and not even the SWC can do
    - write support of any kind (flash ROM, savestates)

    Which doesn’t mean these things will never happen. I mean, I will hardly file a patent for connecting 20-year old technology with a bunch of wires, and once the idea is out there, someone might still sit down and do it.

  • Matthias_H says:

    One more thing: Of the many enhancement chips that can be found on SNES carts, the SA-1 and S-DD1 are particularly notorious for being a pain in the butt. Don’t expect games using these chips ever to work in the USB reader. here’s a list of affected titles:

    http://en.wikipedia.org/wiki/List_of_Super_NES_enhancement_chips#List_of_Super_NES_games_that_use_enhancement_chips

  • @matthias_h
    aren’t these chips separate from the actual game data? I thought these were just co processors that linked into the console in a completely different way.

  • Acha says:

    nice…bro..
    thanks so much…
    _salam anget_

  • Matthias_H says:

    @gerrit: Not these two particular ones. The S-dd1 is a cryptic data compression/decompression chip, so whichever part of the ROM is hidden behind that chip remains mingled or incomplete. Super FX and others should be fine, though.

  • tom61 says:

    Neat.

    As far as 480mbps USB 2.0 in a hobbyist microcontroller platform, the Gumstix Overo and the TI Beagleboard both support that speed (both host and client). Though, they are on the upper end of the hobbyist price range, and most would not get one to just to dump carts, unless they collect uber-rares and prototypes.

    Can you give a general area where you are, that way shipping could be figured out if someone wanted to donate carts to you?

  • We actually need the reverse of this.. a modern day MultiGameDoctor would be awesome and easily done if you’ve got FPGA skills. But not one has yet :(.

  • Matthias_H says:

    @tom61: Beagleboard and Gumstix are of course a possibility, but (1) you would still have to add extra hardware, (2) they are pretty darn expensive and what they offer is a total overkill for a simple cart reader, and (3) it would easily double the power consumption of your mobile device.

    In case someone actually wants to send me games (I wouldn’t mind :-)), I am in Boston MA for another week, but moving back to Germany next Saturday (Jun 27). Address inquiries to hackaday at matthias.hu(please_disregard)llin.net.

    @daniel palmer: Sorry, but I don’t need the reverse of this :)

  • Roger says:

    Awesome little invention, Matthias! I came from Kotaku. This device would be awesome with a little pine box case! Does this device heat up at all? Perhaps cooling would help with the slow downs if you have a high-speed USB, etc. I don’t know much about electronics.

    Hope everything works out with this. I would love to be able to pick one of these up. Keep up the good work!

  • Alo Press says:

    That device is really cool ^ ^

    I have a question for you! If u can access the game on the cart – could u also put your own (converted) games on it or just use it as external memor like usb sticks??

  • Matthias_H says:

    @alo: Please familiarize yourself with the difference between reading data from vs. writing data to a device…. you can’t write to read-only devices, period.

    again: this is a device for l e g a l l y taking games that are stored on a read-only cartridge, and playing them on your computer. a device that stores your illegal (however modified you or others may have them) roms to a writable cartridge for playing them on the console, while technically possible, is exactly the opposite of what I did / will ever do.

  • JP says:

    This is incredible! Please give us as much detail as possible, and when you make something sellable make sure I can buy it here in the UK!
    I’d also really love to have a Gameboy version – you should set up a getsatisfaction account so people can vote on features & console support!
    Cheers!

  • Tim says:

    So to all of you who are intellegent, forgive me I don’t know a lot about this stuff, and forgive me further if someone already sugested this, but could a posible solution be firewire 800 I know it is suposed to be faster than usb 2?

  • meow says:

    Cypress EZ-USB FX2LP.

  • Matthias_H says:

    @meow: development kit for the ez-usb: us$500.

    @tim: usb 2 is by far fast enough, but the chip i’m using cannot do the “high-speed” mode. also, coming up with an idea for an interface is not enough. you need to find a suitable controller chip, someone who will sell you a small number of them ($10,000), etc.

  • DanAdamKOF says:

    I’d love to see a NeoGeo cartridge get read at that speed. 700 megabits over that interface, fun times…

  • meow says:

    @matthias_h: Try Acquired Devices SerMod-100 or similar instead of the official devkit.

    Also when you hit the limit of the Keil crippleware, try free SDCC instead.

  • Matthias_H says:

    @all: I made a little project website, http://www.snega2usb.com – this is where I will put all the updates from now on.

  • drewg says:

    This is a very cool little device

    doesn’t the scsi command set specify an “ejected” signal or something – whatever usb cd drives or memory card readers do? at worst, you could just cycle the usb connection.

    I’m going to echo the sentiments of above posters that save games would be awesome. couldn’t you make a r/w file next to the rom file that just maps to the sram on the cart? I know zsnes writes its save files next to the rom image, and other emulators can be modified to do this as well.

  • Matthias_H says:

    @drewg: good idea, but not too easy. Allowing the system to write on a removable medium means it can in principle do whatever it wants, including reordering FAT entries and defragmenting files.

    As for the “eject” signal, resetting the USB connection is exactly what I do now. It probably invalidates open file handles, but it works.

  • Brent says:

    matthias: If you need a hand designing a circuit board etc let me know.

  • Jeroen says:

    I’m scepticall.
    I mean, .SMC ?
    If I take my copybox or some other device and dump a cart to my PC…the file get’s NO EXTENSION!!!

    I’m not saying you tried cheating or frauding us, but I’m scepticall about the fact that this has a file extension.

  • Ian Lesnet says:

    @jeroen

    His microcontroller code tells the PC that the cart ROM is like a USB flash disk device. It shows the PC a FAT file system with a single file. The uC maps the cart ROM space to a single file so the PC understands how to read it.

    He’s ‘faking’ it in the sense that there isn’t actually a file or extension inside the cart, the cart is just a bunch of memory chips. The microcontroller reads the game info header inside the cart and ‘fakes’ a name so the PC knows how to read the ROM.

    The microcontroller acts like a USB storage device. The PC sees it as a FAT disk and asks for the list of files on the disk called the directory table. His code reads out the directory table format and inserts the name it read from the cart plus the .smc extension. The uC tells the PC what ‘files’ are there. His code determines the name and extension of the ‘file’, in the same way that your dump software has some code that determines the extension when you do ROM dumps.

    This must be a common issue because he addresses it in his FAQ:
    Q: The ROM file in the video is called SUPER MARIOWORLD.smc, which can’t be true, so this is all a fake.
    A: First of all, this is not a question…

    If anyone likes, I can make a post with some graphics and a more expansive explanation of FAT file systems, ROM, and what’s going on in this project. [matthias_h] has a beautifully elegant solution for playing ROMs legally*.

    *Probably varies by jurisdiction.

  • Impulse says:

    Interesting… Personally I’d pay up to $100 for something like this, ‘specially an all-in-one solution that covers a few of teh classic consoles (at ‘least SNES/Genesis/N64)… Considering the number of old carts I’d have, it’d be well worth it. I’d probably spend more time scouring for all the ROMs to my old games than it’d be worth it.

  • SNES DB says:

    Mash-Mods.com USB Flash Cart anyone?

  • Evony says:

    Have you guys played evony yet? What do you think? evony.com

  • Request_Driven says:

    so far, have you been able to incorporate reading the save file as well (srm, etc…), within the cartridge, are you intending to, or is that not a concern for you?

  • Matthias_H says:

    Reading works fine, but writing savestates back to the cart turns out even more of a pain than expected. Once you allow the slightest bit of writing on a medium, Windows automatically starts tampering with the FAT (which doesn’t go well if the FAT is supposed to remain static).

  • hikaye says:

    Interesting… Personally I’d pay up to $100 for something like this, ’specially an all-in-one solution that covers a few of teh classic consoles (at ‘least SNES/Genesis/N64)… Considering the number of old carts I’d have, it’d be well worth it. I’d probably spend more time scouring for all the ROMs to my old games than it’d be worth it.

  • Namelesswonder says:

    Very good, I would like to see a USB Reader for games like the NDS. It would probably increase the piracy…

  • StevenMcFly says:

    Haven’t you ever heard of SNESX? LOL. This look like more hassle then a emulator …

  • Tordre says:

    @stevenmcfly, I am not speaking on behalf of the creator, but i would assume he was say for the fun of it, for shits and giggles, and in this case to learn of the USB mass device driver, and the FAT file system.

    If we all did what was easy we would not get any progression of technology.

  • Matthias_H says:

    @StevenMcFly: You are absolutely right. Diskettes look like more hassle than an operating system, and cables look like more hassle than electricity.
    :-D

  • Vaati says:

    THIS IS AWESOME!!!! I have all of my game cartridges and my SNES, but instead of going (all the way) downstairs to play them, this would let me play them all right on my pc!! I wonder if there is something like this that I can use for my old NES games…. My NES stopped working, so I gutted it… Nice, cheap mcu, ppu, and sram.

  • it is interesting. thhx for video

  • Walling says:

    I have learned a lot reading your site. Thanks for posting.

  • Will says:

    dude can I buy one of those from you just the super nes port thing you already made, I want to upload my on rom images to pc for my own personal use and it looks like this would actually work to do that. I like playing on pc rather than wearing out my game consoles plus you have more option like wireless game pads and better speed and smoother game play.

  • Conner says:

    I know that I certainly don’t want to go to russian porn sites to get roms for snes!

  • Leave a Reply

    XHTML: You can use these tags: <a href="" title="" rel=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

    Hack a Day serves up fresh hacks each day, every day from around the web as well as hacking related news.

    Send us your hacks










         




    Hacks

    Resources