Multiple games on a single ROM chip ?

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
Multiple games on a single ROM chip ?
by on (#174205)
Hey all,

So I've seen this done a few times. Multiple games programmed to a single ROM chip with the game selection done by a mechanical switch.

Just as an example... http://playntradeonline.com/dp/starfox2pcb.jpg

I have an idea for a couple of carts I want to make for the Racketboy Charity Auction. I can resort to using two ROM chips and toggling the CE pins, but using one chip would be a lot cleaner. It would also mean less parts and a smaller PCB, so it would cost less to make.

My problem is that I have basically NO idea how this is accomplished. The closest thing I've been able to find in Google is this which suggest that programming two 16Mb files to a 27C322, toggling A20 high or low will select between them. This isn't enough for me to understand how it works so that I can try on my own with different variables.

Can anyone break it down for me? Or is there no simple answer to this?

Thanks!
Re: Multiple games on a single ROM chip ?
by on (#174210)
Each address bit chooses which half of the chip to look at. Consider if you only had 16 data pieces in a chip.

Code:
On chip 1    On chip 2   
Game 1       Game 2
data,address|data,address
1    0001   |1    0001
2    0010   |2    0010
3    0011   |3    0011
4    0100   |4    0100
5    0101   |5    0101
6    0110   |6    0110
7    0111   |7    0111
8    1000   |8    1000
9    1001   |9    1001
a    1010   |a    1010
b    1011   |b    1011
c    1100   |c    1100
d    1101   |d    1101
e    1110   |e    1110
f    1111   |f    1111
Both on one    Game 1   
data.address       
1    00001       
2    00010       
3    00011       
4    00100       
5    00101       
6    00110       
7    00111       
8    01000       
9    01001       
a    01010       
b    01011       
c    01100       
d    01101       
e    01110       
f    01111       
Game 2
data,address       
1    10001       
2    10010       
3    10011       
4    10100       
5    10101       
6    10110       
7    10111       
8    11000       
9    11001       
a    11010       
b    11011       
c    11100       
d    11101       
e    11110       
f    11111       

Note that the new fifth address line is 0 for all of game 1, and 1 for all of game 2.

If that didn't help, think of it like books. Suppose you have two books, 100 pages long. If you put them in separate books, each book runs pages 0-99. If you put them in one volume, then book 2 will be at pages 100-199. The hundreds digit tells you whether you are in book 1 (0) or book 2 (1).

In this way, attaching the switch to the new address line makes it pick whether to use the data from game 1, or the data from game 2.
Re: Multiple games on a single ROM chip ?
by on (#174216)
Thank you for that explanation. I think it makes sense to me.

So what pin on the memory chip would become the new address line to toggle? Whatever the highest address line is? So in the case of the 27C322, it's A20. But if I were using, say, a 27C160 with two 8Mb games, it would be A19?

So the game data wouldn't have to be altered? I could simply program game 1 to the first half of the chip, and game 2 to the second half? Then toggling the highest address pin high or low would select which half of the chip is being read?

I should point out that this sort of thing isn't my forte, and I feel like I've been learning everything backwards.
Re: Multiple games on a single ROM chip ?
by on (#174218)
This is correct. There's no need to hack the games if you're using a physical switch. The switch should always control the highest address line, tying it to +5V or GND. You can also put a switch on the second highest address line and have 4 games instead of 2, as long as all the games fit in one chip. Each additional switch doubles the number of combinations.
Re: Multiple games on a single ROM chip ?
by on (#174219)
Awesome! After reading these replies, along with this post, I believe I understand now. Thank you both for your help!
Re: Multiple games on a single ROM chip ?
by on (#174221)
You can even switch games during gameplay and get... somewhat unexpected effects. With the SNES I have no idea how this'll turn out, but on the NES I was able to get a game boot with different palette for instance.
Re: Multiple games on a single ROM chip ?
by on (#174222)
Bregalad wrote:
You can even switch games during gameplay and get... somewhat unexpected effects. With the SNES I have no idea how this'll turn out, but on the NES I was able to get a game boot with different palette for instance.


And for that reason I was considering trying to figure out how to do a "reset to switch games" (is that documented anywhere?) instead of a physical switch, but I think I can do something cool with the label to indicate switch positions. I feel like most people will let curiosity get the best of them and have to see what happens when you flip the switch with the game already on.
Re: Multiple games on a single ROM chip ?
by on (#174223)
Ziggy587 wrote:
And for that reason I was considering trying to figure out how to do a "reset to switch games" (is that documented anywhere?) instead of a physical switch, but I think I can do something cool with the label to indicate switch positions.
There are a lot of simple parts that will work here. See this thread.

You could add LEDs if you want it to indicate which slot is active.
Re: Multiple games on a single ROM chip ?
by on (#174254)
lidnariq wrote:
And for that reason I was considering trying to figure out how to do a "reset to switch games" (is that documented anywhere?) instead of a physical switch

The only way I can think to do this is to use a counter integreated circuit, such as the 74HC161 (for 3 or more games), or a simple T-flip-flop (for 2 games), and clock it with the reset signal. However, this would be more complicated to wire and insert in a cartridge than a physical switch.
Re: Multiple games on a single ROM chip ?
by on (#174264)
lidnariq wrote:
There are a lot of simple parts that will work here. See this thread.


Thanks for the link. So if I used a 74xx74, could I wire it like this?

Attachment:
74xx74 copy.jpg


Or, if I wanted to use two ROM chips, I could use pin 5 for ROM 1 CE and pin 6 for ROM 2 CE. And if I wanted to add LEDs (great idea!) I could use the other side of the '74.

Bregalad wrote:
However, this would be more complicated to wire and insert in a cartridge than a physical switch.


I was actually hoping to make my own custom boards for this. So to that point, it would actually be easier to solder in 1 extra IC versus having to cut a hole in the cart case for a switch.
Re: Multiple games on a single ROM chip ?
by on (#174266)
Ziggy587 wrote:
Thanks for the link. So if I used a 74xx74, could I wire it like this?
(No.) The 74'74 will copy the value from the D pin to the Q pin when the CLK pin goes from low to high. So if you tie D high all the time ... Q will always be high.

This is what you want if you're using a 74'74.
Re: Multiple games on a single ROM chip ?
by on (#174275)
Are you doing the multi on a donor cart?

If so, I had these little chips made a long time ago
Attachment:
image.jpeg
image.jpeg [ 1.83 MiB | Viewed 3933 times ]
(and I don't use them anymore) that "marry" to the back side of the MAD1 chip and does the reset based game switching on a donor cart (with the rom switched out of course). All you have to do is run a few jumper wires to whatever high address line(s) you're using.
It even has a 2 second delay before it switches in case you just want to reset your game and not actually cycle to a different game.
It's quite a versatile little adapter. It can bank 2,4,8 games or 2 individual rom with 2 games in each, etc...
If interested, just PM me.
Re: Multiple games on a single ROM chip ?
by on (#174283)
lidnariq wrote:
The 74'74 will copy the value from the D pin to the Q pin when the CLK pin goes from low to high. So if you tie D high all the time ... Q will always be high.


Ahhhh, I think I understand it now. If I use that diagram, do I have to use a diode and cap on the reset line?

Markfrizb wrote:
Are you doing the multi on a donor cart?


No, I was hoping to make my own boards. That is, if I can learn Eagle with enough time to get the carts done before the auction (it's at the end of the year). I plan to get this SNES PCB and this Genesis PCB so I can prototype my plans before getting my own boards made up. So my backup plan, if I run into trouble designing my own boards, will be to just use those existing boards. It wouldn't look as nice, but at least it would work.

Thanks for the offer though, I appreciate it! I like the idea of the delay, that isn't something I thought of. How is that accomplished? Perhaps that's what the diode and cap are doing in the romlab diagram?
Re: Multiple games on a single ROM chip ?
by on (#174286)
Ziggy587 wrote:
Ahhhh, I think I understand it now. If I use that diagram, do I have to use a diode and cap on the reset line?
No, that's only for the NES.

(The SNES has a /RESET pin; a front-loading NES with a functioning CIC has a +RESET pin; the Famicom and top-loading NES have nothing at all. In order to work with all NES-like-devices, you have to indirectly figure out whether the NES CPU is being reset, which you can do by checking whether either of M2 or A0 is alternating. That's what the diode & capacitor are doing.)
Re: Multiple games on a single ROM chip ?
by on (#174459)
What would be the best way to add a delay on the reset signal?

I found this, which suggest that a simple resistor and cap can delay the signal by X seconds depending on the RC values. Would this work? Would there be a problem with cap having a partial charge, which would affect the time required to hold reset?

Attachment:
RCdelay.JPG
RCdelay.JPG [ 25.06 KiB | Viewed 3821 times ]


I also found this which uses a 555 timer. It seems like it might be better, but adds more components.

Image
Re: Multiple games on a single ROM chip ?
by on (#174460)
The problem with trying to implement the time delay in analog is that the SNES /RESET already relies on a large (1k) resistor in series, and any other parts you add could adversely affect that.

Also it's tricky to get consistent RC time constants that slow. But I guess you could try R·C = 2sec, R≟1MΩ → C=2µF. I'd also be worried about designing something before you could test it. And at this small of a current you'll definitely have to use 74HC/AC/&c instead of 74LS/&c.
Re: Multiple games on a single ROM chip ?
by on (#174964)
lidnariq wrote:
The problem with trying to implement the time delay in analog is that the SNES /RESET already relies on a large (1k) resistor in series, and any other parts you add could adversely affect that.


So what would the alternative to analog be? A microcontroller? I'm assuming a microcontroller could probably replace the 74'74 and add the delay, but programming for one is out of my league for now. The hold-reset-to-switch thing would be a nice touch, but I think I'll just keep it simple. The two games that I'm going to be switching between aren't actually games, they're utilities. So aside from it just being neat, there's no real point to go out of my way to try and implement the delay.

lidnariq wrote:
I'd also be worried about designing something before you could test it.


I'm definitely going to do a test build before I order the boards. I knew OSH Park was $5/sq-in, but I guess I wasn't thinking that even these small boards would be ~$30 each. And you have to buy three, so, ~$90!
Re: Multiple games on a single ROM chip ?
by on (#174975)
Ziggy587 wrote:
So what would the alternative to analog be?
Just electrically isolating the two signals using an inverter or buffer, so that the time delay part isn't drawing any current from the SNES/RESET line.

Quote:
I'm definitely going to do a test build before I order the boards. I knew OSH Park was $5/sq-in, but I guess I wasn't thinking that even these small boards would be ~$30 each. And you have to buy three, so, ~$90!
Ouch. That's like early-2000s board house prices.

Have you considered one of the cheap chinese vendors like Seeed? 10 boards, ~$20 shipped, takes a month to get to you. ( http://pcbshopper.com/ )
Re: Multiple games on a single ROM chip ?
by on (#174984)
lidnariq wrote:
Ouch. That's like early-2000s board house prices.


I was thinking about shopping around a little, especially since this will be my first board order, but I like what I'm seeing on OSH Park so far. Their prices include shipping, they ship in 12 days, and they're USA based (as am I) so I'll get them very quickly. They also have a $1/sq-in service, but it's a 150 square inch minimum.

edit: Hmm, I just put in the dimensions on PCB Shopper and it's showing that OSH Park is $30 for three boards ($10/ea) so maybe I misread something. Either that or PCB Shopper is wrong. OSH Park states "$5/sq-in for a set of three boards" which I interpreted as:

6 square inch × $5 × 3 = $90.

Seeed and others on PCB Shopper are showing some pretty hefty shipping charges and lead times, although I do realize those are just estimates.
Re: Multiple games on a single ROM chip ?
by on (#174988)
Ziggy587 wrote:
OSH Park is $30 for three boards ($10/ea) so maybe I misread something. Either that or PCB Shopper is wrong. OSH Park states "$5/sq-in for a set of three boards" which I interpreted as:

6 square inch × $5 × 3 = $90.
I'm pretty certain they mean "5$/in² of design, three instances"

Quote:
Seeed and others on PCB Shopper are showing some pretty hefty shipping charges and lead times,
Yeah, the shipping costs are noticeable but the PCBs are inexpensive, so it works out.

Although I'm a little surprised you're seeing higher prices; the lowest I'm seeing Maker Studio with $9.5 for 10× 10cm×5cm, $5.64 shipping, ETA 20 days.

Maybe the problem you're running in to is that the cheap board houses have a price point right at 5cm/10cm on each axis?
Re: Multiple games on a single ROM chip ?
by on (#174992)
lidnariq wrote:
I'm pretty certain they mean "5$/in² of design, three instances"


Looks like you're right. Elsewhere on the site they say, "For example, a 2 square inch board would cost $10 and you’d get three copies of your board." I guess I'm too used to ULINE, where you multiply the price each by the minimum quantity.

lidnariq wrote:
Although I'm a little surprised you're seeing higher prices; the lowest I'm seeing Maker Studio with $9.5 for 10× 10cm×5cm, $5.64 shipping, ETA 20 days.

Maybe the problem you're running in to is that the cheap board houses have a price point right at 5cm/10cm on each axis?


I was searching 4×1.5 inches, so ~10.16×3.8cm (rough estimate of one of my boards). I'm also searching with and without ENIG finish and double sided silk screen options as OSH Park includes both of those in their price.

I'd be funny if the threshold is 10cm, and I'm going over by a lousy 1.6mm. I don't think I can shrink the width any without messing up the key shape.
Re: Multiple games on a single ROM chip ?
by on (#175788)
I have a question regarding the 74'161. I made a test build with IC sockets so I could easily swap things around. I wired a 74'161 like this:

Attachment:
File comment: http://www.sega-16.com/forum/showthread.php?28939-Guide-Basic-Genesis-Multicart
74161.JPG
74161.JPG [ 46.17 KiB | Viewed 3450 times ]


Everything is working fine, but I'm wondering if it's OK to leave the unused pins floating in the final design. Should I tie any of them high or low?
Re: Multiple games on a single ROM chip ?
by on (#175801)
Unused outputs should float, but don't leave inputs floating unless they're specifically designed for that. They can pick up noise that causes the circuit to misbehave or use excessive power. An input designed to float will have an internal pull-up or pull-down resistor; check the datasheet.
Re: Multiple games on a single ROM chip ?
by on (#175809)
In this specific case, the only inputs you've left floating are clocked inputs, which are mostly safe to leave floating.

Pedantically: this is not true of latched inputs. It is only true of ones that only do a thing in response to a rising or falling edge on another pin.
Re: Multiple games on a single ROM chip ?
by on (#175812)
I was under the impression that even a latched input could lead to metastabilty in the latch if it's right at the crossover point when it's latched. Am I wrong?

You don't want Buridan's ass to kick yours.
Re: Multiple games on a single ROM chip ?
by on (#175858)
The way my board is laid out the inputs on the '161 are right next to a ground plane, so I suppose I have no reason not to tie them all low. From what I've read, some people say to use a resistor to ground while others say either a resistor or directly to ground is OK. So my question is, is there an upside to using a resistor when I'm connecting unused inputs to ground?
Re: Multiple games on a single ROM chip ?
by on (#175859)
Use a resistor when the pin is bidirectional (both input and output), like the data pins of a RAM. You can use a resistor for an input-only pin, but it'll save money not to.
Re: Multiple games on a single ROM chip ?
by on (#175944)
It'll save some room on the board as well.

Thanks, everyone, for your help!
Re: Multiple games on a single ROM chip ?
by on (#175963)
Bregalad wrote:
You can even switch games during gameplay and get... somewhat unexpected effects. With the SNES I have no idea how this'll turn out, but on the NES I was able to get a game boot with different palette for instance.


With a Pac-Man PCB set up to dual boot Ms. Pac-Man, switching in the middle of the game is absolutely fine. Ms. Pac-Man is a binary hack of Pac-Man, so you get dropped into a fully working gamestate with slightly different logic.
Re: Multiple games on a single ROM chip ?
by on (#195983)
Hey guys. I know this topic was from about a year ago, but I wanted to share my success and say thanks!

Image

Image

I was planning on making something special for the Racketboy Charity Auction, but since the forum participation has been dwindling the yearly auction didn't occur as it normally would have in past years. That being said, I stalled my work on this project for some time. But I would like to finally finish it so I can share it.

I have it shared on OSH Park right now ( https://oshpark.com/shared_projects/Ptrw5hb8 ). I still want to tweak it a little more before I share it properly, but this current design is 100% functional from my testing. I was also thinking about making a through hole version, as it seems like a lot of people complain about surface mount stuff.

I know the PCB thickness from OSH Park is off spec, but it was good enough for me to do a test build. I wouldn't recommend ordering the PCB from there because of this, but you can download the .brd from there.

I would appreciate any feedback, especially negative, in regards to the board layout as this was my first. The OSH Park link has nice high res pics of the front and back of the board, but I thought they would be too large to post on the forum. I'll resize them to fit properly when I get the chance.

edit: Resized the pics:

Image

Image

I also wanted to say thank you to everyone that helped me! This forum has been a great resource for me. Being that I only do this as a hobby, I don't know a whole lot about this kind of stuff. It's always a little intimidating asking for help when you barely know the questions you need to be asking, but everyone here has always been very kind and patient with my ignorance. So... Thanks, NESdev!