Question about bank switching

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
Question about bank switching
by on (#137277)
I've been reading up on it, as I'd like to make a multi-cart game.

From what I understand, the SNES, like the NES, can send a strobe to a binary counter to increment it on reset.
You use this counter to tie the appropriate address pin of your EPROM high or low to "force" the active memory the SNES can see into a smaller chunk.

Each Address line is a binary number, so if I wanted to calculate the visible address space, I could plug 1111111111111111111111 (A21) into a programming calculator and convert it to decimal to see how many bytes that is, and hexadecimal to see what the highest address is (4194304, or 0x3FFFFF) This would mean the maximum addressable size on an SNES mask rom is 4 Megabytes.
By disabling A21, I'd limit the usable space of the Mask Rom to 2 Megabytes, and when the line is pulled high, it would shift all addresses up to the 2-4MB sections of the rom.

Is that about right?
Re: Question about bank switching
by on (#137278)
The maximum addressable size without bank switching is 95 Mbit, as seen in the decompressed hack of Star Ocean.

You can use A22 and A23, which raises maximum size to 128 Mbit. However, $0000-$7FFF in banks $00-$3F and $80-$FF are reserved for I/O, low RAM, and save memory, which reduces size to 96 Mbit. $7E0000-$7FFFFF is also reserved for RAM, which knocks off another Mbit.

But bank switching is still useful for a multicart because you don't have to reserve 8 bytes of low RAM for NMI and IRQ trampolines nor relink all games to run from a higher bank number.
Re: Question about bank switching
by on (#137279)
You're greatly limited by the SNES's not-so-great memory map/layout (I've ranted about it in the past).

There is what's known as "mode 25" per the official documentation (mode 20 = "lorom", mode 21 = "hirom") which is specifically designed/documented to support ROM sizes greater than 32mbits, specifically up to 63.5mbit (you lose 0.5mbit due to the memory map). I've attached verification. Anything else would require a mapper.

Maybe I'm misunderstanding the goal, but "multi-cart game" is a strange term. Did you mean a "multi-game cart", as in fitting multiple games into a single cart? If so, yeah, I suppose you'd have to implement a mapper (in hardware) for you to get control over which address lines on the cart edge connector went to which address lines/etc. on the ROMs. It'd probably be easiest with mode 20 games, particularly all which referenced the same bank (for ROM) all throughout their code.

But stepping back: is this project really at all feasible (i.e. is it really worth doing) when compared to, say, buying a SNES flash cart?
Re: Question about bank switching
by on (#137280)
tepples wrote:
The maximum addressable size without bank switching is 95 Mbit

Well, for special carts, sure. I was thinking more in lines with your standard 36 pin TSOP, which maxes out at 64mb/8MB because it only goes up to A22.

multi-game cart would probably be the better term.
Also, the games I want are special chip games, which don't work on most flash carts.
Like, Starfox 1 and 2, or a Kirby mega kart with Kirby 3 and superstar, or Mega Man X2 and X3 on a single cart.

Flash carts that do that don't really exist, except the MMX2 and X3 on SD2SNES, which is more expensive than just buying a copy of MMX2 and modifying it to play MMX2 and X3 on a single cart.
Also, I kinda want to do it just because it sounds neat.
I'd also like to do it with games like FF2 and 3, or Secret of Mana 2 and 3, but I have an Everdrive anyway.

Besides, I need a new project after I finished converting my N64, TG16, and NES to RGB.
Re: Question about bank switching
by on (#137296)
If you're really making a multicart, it can't really be called bank switching.

Basically a menu loader would latch on a write to the rom area for the upper address lines beyond say A23 and then do nothing more with that latch, jumping to the start point, and having the running program not even aware of anything beyond the normal memory map.
Re: Question about bank switching
by on (#137782)
Maybe what you are wanting to do is something like this?
http://youtu.be/0vfLNjXzNMw

Or this
http://youtu.be/Qb99wXsS7_s

your "bank switching" is an accurate term when you are dealing with games smaller than 32mbits like starfox2 and megaman X2/3 and others in an effort to make a "multi game" cart.

Each address line doubles the rom in size. So A21 removed from the Snes control buss, then pulled high or low manually or through a counter or like the video shows -with a micro controller, accesses the upper half of the rom or lower half. So A21 (32mbits) is = to 2 x A20 (2 x 16mbits). That make sense?

I understand the desire to make your own cart. I own every flash cart made but I wanted to learn how (and why) to make my own. It was a frustrating, hair-pulling, and gratifying project.