Mad-1 discrete logic replacement-new thread

Discussion of hardware and software development for Super NES and Super Famicom.

Moderator: Moderators

Forum rules
  • For making cartridges of your Super NES games, see Reproduction.
Post Reply
Markfrizb
Posts: 540
Joined: Sun Dec 02, 2012 8:17 am
Location: East Texas

Mad-1 discrete logic replacement-new thread

Post by Markfrizb »

Starting a new thread -- I am trying to make a cartridge and I'm stuck at the decoder.

I have the SRAM save part worked out such that I don't think I need that aspect of the decoder.
(planning on using a max795T. -OR- a FRAM, there's even a "MRAM" now. Fast, nonvolatile and specs say it's unlimited read/writes! Very cool but also only low voltage. :/ ) And thanks to Jim for pointing me in the right direction on the cic.

I've read the older posts about this subject and frankly, I didnt find a clear answer.

I just want to be able to have a circuit that functions like the mad 1 (minus the SRAM save part) that can decode 1 or 2 flash roms and 1 SRAM. I spent all day with a 1A3M cart with the mad removed and jumpers to a 74LS139 and trying to connect similar functions (I.e. OE is mad pin 4, 74ls139 is pin 1, etc...) but I didn't get it to work. I'll post my pinout tomorrow...maybe that'll shed some light.

So if there is a functional equivalent, please let me know.

Thank you
Mark
User avatar
MottZilla
Posts: 2835
Joined: Wed Dec 06, 2006 8:18 pm

Re: Mad-1 discrete logic replacement-new thread

Post by MottZilla »

Well how did you want to decode the ROMs exactly? HiROM or LoROM? Something mixed? It all depends on what memory you are wanting to use. I think a truth table has been posted for the MAD-1 in the past. With that and some 74 series chips you could likely make your own MAD-1 equal. In general what exactly is the end goal?
Markfrizb
Posts: 540
Joined: Sun Dec 02, 2012 8:17 am
Location: East Texas

Re: Mad-1 discrete logic replacement-new thread

Post by Markfrizb »

Thank you for responding. My end goal is to be able to make a repro cartridge without special Nintendo chips. I would love a combo circuit for hi or low rom, 64m capacity (2 x 32m) save ram -- up to 1m (question: is 1m even necessary? I think 95% games use the 64k). I would be fine with a pic - something I could program that would also perform the decoding functions.

I have a good direction to go forward with a power supervisory circuit for save ram (or a nv ram)

I have seen truth tables listed, but as I am still learning, I don't understand how to apply the truth tables to actual chips/circuits.

I noticed that the 1or2-A3B & J carts use the LS139 decoder. I tried playing around with that today -- adding jumpers to bring the A20 and 21 address lines to the cart edge connector but I can't get anything above 1m to run.

I have seen on some "commercial" repo carts that a cpld is used for decoding.
I would be open to hiring someone to make a pic or a working schematic, of which I would incorporate into my design and I would also freely make available to whoever wanted it also. Anyone want the job?

Thanks
Mark
User avatar
MottZilla
Posts: 2835
Joined: Wed Dec 06, 2006 8:18 pm

Re: Mad-1 discrete logic replacement-new thread

Post by MottZilla »

What do you mean without special chips? I think there already is a clone of the CIC chip. That's the only "special nintendo chip" in cartridges. The MAD-1 is just a specialized IC by Nintendo for decoding addresses and enabling MaskROMs or SRAM and handling battery backup stuff. All of that can be achieved by off the shelf parts. But it made sense for them to just make their own IC back then.

Games were made that use 2, 8, and 32 kilobytes of SRAM. I think the only games that have 64 kilobytes are Super FX titles. That would be 16kbit, 64kbit, and 256kbit. Although I think there is some japanese title that uses alot of SRAM.

Anyway they already have made 3 or 4 cartridges you can load nearly every game on. The PowerPAK, SD2SNES, and Super EverDrive to name some.
Markfrizb
Posts: 540
Joined: Sun Dec 02, 2012 8:17 am
Location: East Texas

Re: Mad-1 discrete logic replacement-new thread

Post by Markfrizb »

What I mean about "special chips" are non custom chips made by Nintendo.

I am all for pics! I recently learned about assembling the cic hex into a pic. So if there was a pic alternative for the Mad1, I'm all for that.

The 64k SRAMs are widely used I the 1A3M, 1J3M 2A3M, BJ3M, 2A3B, and other variants carts. The "3" being the 64k designations.

The super fx carts use 256k and 512 k SRAMs.

Edit: I am aware (and own) several of the repo carts including the SD2snes, ever drive, powerpak, and 1 other. My goal is to learn how any why they work. Building one of my own is more for learning and to see how it's done.

I have made all kinds of adapter for cartridges (see my YouTube) but I have never made a cart. The Mad1 is really the one area that I don't know how to get around.

Mark
User avatar
infiniteneslives
Posts: 2102
Joined: Mon Apr 04, 2011 11:49 am
Location: WhereverIparkIt, USA
Contact:

Re: Mad-1 discrete logic replacement-new thread

Post by infiniteneslives »

I'll try the teaching you to fish vice feeding you fish approach...

I couldn't find the original thread I stole this from, so apologies on that. I gave up after a few mins, but you're apparently familiar with all those MAD threads so perhaps you can help me credit the author.

This isn't Hi or Lo Rom. But, if you have the truth table for the LS189 and the MAD you should be able to figure out how this circuit differs from the MAD logically. Ignore all the fancy circuitry for the SRAM /CE and battery backing. Pretend the '189's pin 13 is connected directly to Vcc and pin9 is connected to your NVRAM's /CE line. Once you see the differences in the truth tables see if you can re-arrange this circuit, add more '189's or whatever you need to make it act like hi/lo ROM. Then get more complicated and try to add 2 ROMs if that's what you really need, 1 ROM will be a bit simpler so I'd start there.

I haven't done this myself, but I will say you should be able to accomplish your goal using (multiple?) 189's only, might not be the most efficient but you can make practically any combonational logic you want with that chip. Go for efficiency after you figure out what's going on.

No cash's truth tables make the most sense to me and give you the pinouts and everything clearly. If you're new to truth tables I suggest using his. You should be able to find plenty of good sources for how truth tables work online if needed.

Image
If you're gonna play the Game Boy, you gotta learn to play it right. -Kenny Rogers
Markfrizb
Posts: 540
Joined: Sun Dec 02, 2012 8:17 am
Location: East Texas

Re: Mad-1 discrete logic replacement-new thread

Post by Markfrizb »

That came from Magno.

It's a 139, not a 189 for clarity to others reading this.

Thanks for the tips. I'll check them out.

Mark


Edit: that circuit is a lo rom. The "A" denotes that. The first #1 says its a single rom, A - lo, next #1 means it uses a 16k SRAM, the B means it doesn't use the mad1.
User avatar
infiniteneslives
Posts: 2102
Joined: Mon Apr 04, 2011 11:49 am
Location: WhereverIparkIt, USA
Contact:

Re: Mad-1 discrete logic replacement-new thread

Post by infiniteneslives »

Good corrections/clarifications. Not the first time magno's handwriting threw me for a loop either on that 3/8 ;)

Yeah I knew it behaved similar to the LOROM but it's a little off compared to the MAD-1 because of the smaller ROM size I guess, and lacks the mirroring. That and I never took the time to decode the name, so thanks for pointing that out.
If you're gonna play the Game Boy, you gotta learn to play it right. -Kenny Rogers
Markfrizb
Posts: 540
Joined: Sun Dec 02, 2012 8:17 am
Location: East Texas

Re: Mad-1 discrete logic replacement-new thread

Post by Markfrizb »

There's a real handy chart that spells out what all the numbers mean... I'll have to look up where I got it (maybe from snescentral.com).

I tried matching functions/pin descriptions to these:
I used a super Mario all stars (2A3B. - 2 roms, Lo, 64k, no Mad1) for testing and comparing. I didn't get anywhere.

Then I tried a 1A3B (some football game) and I still wasn't able to get it to run.

For clarification! I am trying to run a 32m rom on these carts. The "B" carts (non mad1) are all 32 pin 8mbit or smaller cartridges. The 32mbit are 36 pin mask roms (or tsop adapter).
The difference between the 2 are 2 additional address lines (3 really but A22 isn't used) A20 and A21.
Using the existing decoder on these carts, I *thought* a good place to start was to try to add the additional address lines from the rom to the cart edge. Didn't work. This stumps me.

I'm trying to understand why and it's very frustrating. I know I'm not the sharpest knife in the drawer.

:)

Mark
User avatar
infiniteneslives
Posts: 2102
Joined: Mon Apr 04, 2011 11:49 am
Location: WhereverIparkIt, USA
Contact:

Re: Mad-1 discrete logic replacement-new thread

Post by infiniteneslives »

Markfrizb wrote: I *thought* a good place to start was to try to add the additional address lines from the rom to the cart edge. Didn't work. This stumps me.
It is, but it sounds like you're trying to find the difference without comparing the truth tables. Forgive me if I'm wrong, but it sounds like you're trying to tackle your project while avoiding truth tables. Bite the bullet! Learn em! Draw your own truth table for the MAD and these carts, compare them, and you should be able to find the difference.
If you're gonna play the Game Boy, you gotta learn to play it right. -Kenny Rogers
Markfrizb
Posts: 540
Joined: Sun Dec 02, 2012 8:17 am
Location: East Texas

Re: Mad-1 discrete logic replacement-new thread

Post by Markfrizb »

That is next on my to do list.

Thanks
magno
Posts: 193
Joined: Tue Aug 15, 2006 5:23 am
Location: Spain
Contact:

Re: Mad-1 discrete logic replacement-new thread

Post by magno »

infiniteneslives wrote:Good corrections/clarifications. Not the first time magno's handwriting threw me for a loop either on that 3/8 ;)
Yep, my '3' is kinda weird XDD
Nice that those "schematics" helped you!
Markfrizb
Posts: 540
Joined: Sun Dec 02, 2012 8:17 am
Location: East Texas

Re: Mad-1 discrete logic replacement-new thread

Post by Markfrizb »

Please correct me if I a wrong here....

The game programs have a header that tells the Snes how big it's size is, where the files are in the roms. Then the Snes try's to retrieve that data via the mad1 - which is hard wired to the cart based on rom, ram configuration. So attempting to run a 32m game file on a cartridge that is " hard wired" to 8m configurations is where things get lost. And even though the additional addresses lines can be jumpered to make a physical connection, the header information would have to be altered together access to the additional addresses?


Am I even close?
User avatar
MottZilla
Posts: 2835
Joined: Wed Dec 06, 2006 8:18 pm

Re: Mad-1 discrete logic replacement-new thread

Post by MottZilla »

Markfrizb wrote:Please correct me if I a wrong here....

The game programs have a header that tells the Snes how big it's size is, where the files are in the roms. Then the Snes try's to retrieve that data via the mad1 - which is hard wired to the cart based on rom, ram configuration. So attempting to run a 32m game file on a cartridge that is " hard wired" to 8m configurations is where things get lost. And even though the additional addresses lines can be jumpered to make a physical connection, the header information would have to be altered together access to the additional addresses?

Am I even close?
The internal header in games is *completely* ignored by the SNES. The only thing that matters are the CPU vectors that must appear in that 00/FFxx area. When the SNES reads data from the cartridge it is entirely up to the electronics in the cartridge to provide a response. Also the SNES doesn't have "files" in the ROM. It's just a binary ROM. Data in the ROM can be anything and anywhere except for the CPU vectors which must be located at a specific spot.

If you're talking about trying to run a 32m game on a retail board that used two 8m mask roms, you'll have issues because of how the board is setup to decode roms. Yes it is "hard wired" for that configuration. But it's relatively easy to modify the setup to allow different sized roms. Again the header information is useless. However emulators and some flash carts and copiers may rely on the header information being accurate! This is no so with an actual cartridge where you can completely leave the header blank or containing data that isn't a header at all.
User avatar
getafixx
Posts: 373
Joined: Tue Dec 04, 2012 3:28 pm
Location: Canada

Re: Mad-1 discrete logic replacement-new thread

Post by getafixx »

To bump this thread a little, I have been doing some work on this. I have successfully managed to get a 32Mbit Snes rom (Seiken Densetsu 3) to work and save without using the MAD-1. I wired up a LS139 as the decoder (similar to what is used in FF5), and used a BA6162 chip taken from the backup circuit of a Sega Genesis cart. The game plays perfectly.

There is a slight problem, however...

Over time, and with long periods of use, the data on my SRAM becomes erased. In the 3 save slots in SD3, the first 2 can periodically be erased. The third save slot is always there, and so far has never been erased. I can't seem to figure out what could be causing it. If it were losing power (IE if the BA6162 wasnt kicking over to the battery after powering off the system) it would wipe all contents of the SRAM, wouldnt it?

The other thing I need to mention is that this is using a proto cart that I have designed, so it is not using any Nintendo parts at all. Also, currently there are no resistors on it either, as I didnt add them to my initial testing design. Not sure if not having the resistors between the battery and the BA6162 could be an issue, but the Genesis cart I took it from didnt have any resistors there, only one by the SRAM, which I added to mine.

Any ideas?
Post Reply