Fixing Sega Cartridges With Old BIOS Chips

For one reason or another, [Dragao] has an old Sonic The Hedgehog cartridge that throws an illegal instruction somewhere in the Marble Zone stage. While the cause of this illegal instruction is probably cosmic rays, how to repair this cartridge isn’t quite as clear. It can be done, though, using BIOS chips from an old computer.

[Dragao] got the idea of repairing this cartridge from Game Boy flash carts. These cartridges use chips that are a simple parallel interface to the address and data lines of the Game Boy’s CPU, and Sega Genesis / Mega Drive flash cart would work the same way. The problem was finding old DIP flash chips that would work. He eventually found some 8-bit wide chips on the motherboard of an old computer, and by stacking the chips, he had a 16-bit wide Flash chip.

To program the chips, [Dragao] wired everything up to an Arduino Mega, put a ROM on the chip, and wired it up to the old Sega cartridge. Surprisingly or unsurprisingly, everything worked, and now [Dragao] has a fully functioning copy of Sonic The Hedgehog.

34 thoughts on “Fixing Sega Cartridges With Old BIOS Chips

  1. Cool!

    I think if you compared a dump of the broken ROM to the working dump, there would be only 1 address broken; maybe even only 1 bit is broken. You could probably wire it up so you use the low (or high, whereever the defect isn’t) side of the original ROM chip, and a single 8-bit ROM to replace the output of the broken side.

    Actually, if its only 1 broken bit, you might be able to have a little logic that forces one of the bits high or low if and only iff the defective address is on the bus.

    1. Hi,
      When I got the game the problem was only in marble zone stage, but before replacing the chip last week it was nothing good. The sega logo was not being displayed right and the “illegal instruction” messages were on the screnn just after reset. None way of using the old chip.

        1. Once the bit is flipped, it’s a done deal. It doesn’t flip back. These are flash chips, one cosmic ray is all that’s needed to flip the bit, then it stays flipped even through power cycles.

          1. Uh, no, they’re not. Pretty much all game cartridges from the 90’s and earlier are either mask ROM, or in rare cases, EPROM. There’s no way a cosmic ray can permanently affect either type of ROM.

          2. Cosmic rays can permanently affect EPROM, but I’m not sure about mask ROM’s. Considering you can erase EPROMs with UV light, it should be effected by any ionizing radiation. The only difference between a UV erasable EPROM and a regular EPROM is the packaging.

          3. Indeed.

            Though these chips are probably not flash chips. If cosmic rays are to blame, I would expect is because the chip was a PROM (like an EPROM, minus the erasing window). they’re manufactured en mass (blank) and can be programmed afterwards, meaning it’s cheaper to use than a mask ROM, especially if you use the same chip/board/ect. for all your games. I have seen people able to erase some PROMS (even though its supposed to be impossible) by hitting it with gamma radiation that can penetrate the chip’s casing, unlike UV. If so, some random UV ray might have struck a bit and been enough to mess it up.

            Alternatively, these chips are old and it’s possible the charge used to program this one might have leaked through the transistor gates with time enough to be read wrong. This is also more likely if it’s true that other things got corrupted, as that would indicate a problem in more than one isolated area.

            The chip might have even gone bad simply because it was inferior. I’ve heard of old logic chips (of certain brands) that are common in arcade repairs that have pins die for whatever reason, and are often found by piggybacking good chips over top. I’ve even seen IBM terminals that had ram boards with chips intentionally soldered on top of one another, so that if a pin failed or a chip’s signals started to get weak enough to not make the transitions between high and low, the chip’s partner could pick up the slack and drive the signals instead.

            I once read about chip manufacturers which tried to cut down on random bit flips by massively improving the cleanliness of their assembly, believing it to have been caused by minute amounts of radioactive elements (like carbon 14?), only to find that the flips were caused by cosmic rays (and that the solution was to either make the bits bigger and harder to flip, or smaller and harder to hit). That lack of purity in earlier chips might cause problems with higher density chips, like rams, and the issue might not show up immediately, but the transistors might just fail with time. This would be an interesting thing to investigate, and it will be interesting to see if modern chips will fail from use at any time in the remote future. Anyone know of anything that’s covered this?

          4. It’s almost certainly mask ROM. Sonic 1 was the pack-in game for the Megadrive. They made tens of millions of copies, maybe hundreds of millions. Using a bit less ink on the label would save enough money to buy someone a new car. They’re not gonna bother with PROM when mask is so much cheaper.

            Can cosmic rays damage mask ROM? I dunno, maybe a really energetic one. Mask ROM is an array of diodes, right? Harder to destroy a diode than it is to disrupt a tiny static charge on EPROM. Still with millions of cartridges in the world, could happen. More likely is probably static electricity.

            There’s also transistors in the address-decoding line-select logic on a ROM. Maybe one of those went.

  2. Just wondering… He has dumped the data from the old cartridge’s chip to new flash chips? But if some data were corrupted by cosmic rays, the same corrupted data should have been copied too. So the problem was probably not corrupted data, or am i missing something?

  3. This might be a good time to point out to people that when using memories of any sort, the actual order of the data or address lines is not especially important as long as the chip is programmed in the same scrambled order. In some cases, this simplifies your wiring when doing 1 layer boards.

    This was also used as a simple security technique in very old hardware (I haven’t seen it in a long time) with custom processors that you couldn’t get the datasheets for. They would scramble the address and data lines and if you tried to read it back using the pinout of the flash/ram/eeprom, you ended up with a scrambled binary.

    As long as your processor is wired in the same scrambled pattern, it won’t know the difference.

    1. Kind of sad how everyone forgets what were once common ideas like this.

      I realized this very early when assembling one-off circuits. A few Perl scripts acting as “bit and address translators” takes care of the rest of the tool chain and my time soldering jumpers on two sided boards went to almost zero.

  4. What’s the difference between this hack and the game reproductions you can find everywhere? A friend of mine made and gave me some sega genesis carts with unlicensed roms and hacked games inside; the carts were once retail sega games who had their roms replaced with new eproms with other games inside. There is a full comunity of users who made game reproductions transforming cheap and common games into rare and expensive games using the metod described in this hack. I mean this hack is a very old and common procedure.

      1. -2 for that response. Come on now!

        It was a valid question. He/she wasn’t putting down your work. They were asking what was different about it and your second sentence was a good reply. The name-calling was uncalled for.

        You probably just discouraged a lot of people from responding to this article.

        1. I undestand, just take it easy.
          I’m not proud of my sentence, but i think that what he/she said in last line totally puts down my work.
          See my other comments, I’m not the bad guy here. I just don’t want somebody “raining on my beach”.
          I’m very happy of being here for the fisrt time, and trying to reply every question that points what could be better in my work with a nice answer.
          I’m here every day reading, and commenting almost never, there is no need of saying bad things about something I think that is easy to do, or is not the century’s invention.
          I think that what discourage people is comments with hate.

      2. Sorry I don’t mind to put down your work; I’m only a bit shocked about your procedure not being covered before on hackaday. You’re right when you say the main difference is to scavenge parts from old computers, besides this is not the first time I’ve seen old eproms reused to fix or modify genesis cartridges, but the usual way is to use brand new eproms.
        Also the eprom sandwich trick is a very cool way to increase the size of a cartidge, my friend made a sandwich to fit knuckles the echidna in sonic the hedgehog rom in a sonic the hedgehog cart (he also had to rewire the extra pad to one of the free conections in the cart header).

        1. I’m sorry, I really did not get it that way, my apologies.
          I’m not using eproms because, if I’m not wrong, they need a higher voltage than an Arduino can handle in its outputs.
          Also they aren’t easy to find, and are expensive, where I live.

          1. True, most EPROMs require a +12v source for programming.

            If you had a +12v wall-wart power supply, you could use that to feed Vpp (with a regulator) and still use the Arduino to drive the address / data pins. When parallel ports were still around, I built an EPROM programmer that used the parallel port + binary counter chips to handle address lines, and then an external power brick provided the necessary +12v for programming voltage.

  5. Hey guys, thanks for posting this.
    You don’t know my happiness of seeing my work here.
    Could you fix my name? “Dragao” means simply “Dragon” in portuguese, it is because my page is somethig like “Flameless Dragon”
    Thanks again.

  6. If i recall correctly the 27c322 is an exact fit for these carts, offering up 4mbyte and already operating at 16 bits. For smaller games you can either buy smaller chips such as the 27c160, or clip/tie the unused address lines high.

    1. Seems very nice, i will take note.
      But if i’m not wrong, this chips need more the 5V of Arduino to be programmed, they also need a UV light to be erased, so debugging would take much time. And living in Brazil doesn’t help, we don’t find these things easy( and not a little cheap) here and ordering on ebay can take months to arrive.
      So I had to improvise with what I had.

      1. That’s true, VPP is 12 or 12.5 i think. I had a Chinese Willem clone and 16 bit adapter from ebay when messing around with them. Did manage to screw up a rom and it sits in a box until i get a cheap chinese uv eraser.

        I attempted something similar several years ago involving a pair of plcc 49f040’s scaveneged from old motherboards, using yet another motherboard to hotswap the bios chip and use the flashrom dos program. I ended up failing and shelving the project after I toner transfer etched a board backwards and didnt notice until i had soldered the IC’s down..

      1. I might post up the ‘dev’ cart i hacked togher on hackaday .io one of these days. I soldered in a socket and cut a few traces which i wired to switches allowing changing the rom size from 1,2,4 mb and picking banks. It’s hacky but worked well enough to play a copy of darxide with the region code modified to NTSC :D

  7. Cool stuff!

    Very coincidental, but just yesterday I finished an NES cart using these exact same chips. (39SF020A). I wrote the programmer and reader in C for the Arduino Mega 2560. I actually bought these chips for that very purpose off of Mouser, so if you’re looking for more they have loads in stock. I took a look at your burner code, and ours is nearly identical, but I chose to use an SD card instead of Serial. Good work!

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.