Page 1 of 2
Multiple games on a single ROM chip ?
Posted: Sat Jun 25, 2016 7:12 am
by Ziggy587
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 ?
Posted: Sat Jun 25, 2016 10:06 am
by Myask
Each address bit chooses which half of the chip to look at. Consider if you only had 16 data pieces in a chip.
Code: Select all
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 ?
Posted: Sat Jun 25, 2016 10:51 am
by Ziggy587
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 ?
Posted: Sat Jun 25, 2016 11:49 am
by tokumaru
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 ?
Posted: Sat Jun 25, 2016 1:28 pm
by Ziggy587
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 ?
Posted: Sat Jun 25, 2016 1:34 pm
by Bregalad
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 ?
Posted: Sat Jun 25, 2016 1:44 pm
by Ziggy587
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 ?
Posted: Sat Jun 25, 2016 1:51 pm
by lidnariq
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 ?
Posted: Sun Jun 26, 2016 3:30 am
by Bregalad
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 ?
Posted: Sun Jun 26, 2016 8:24 am
by Ziggy587
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?
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 ?
Posted: Sun Jun 26, 2016 10:21 am
by lidnariq
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 ?
Posted: Sun Jun 26, 2016 1:29 pm
by Markfrizb
Are you doing the multi on a donor cart?
If so, I had these little chips made a long time ago
(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 ?
Posted: Sun Jun 26, 2016 2:34 pm
by Ziggy587
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 ?
Posted: Sun Jun 26, 2016 2:51 pm
by lidnariq
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 ?
Posted: Wed Jun 29, 2016 11:47 am
by Ziggy587
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?
I also found
this which uses a 555 timer. It seems like it might be better, but adds more components.
