Splitting banks with a binary counter

Programming the 6502 microprocessor and its relatives in assembly and other languages.
Post Reply
Imagesowner2
Posts: 17
Joined: 28 Aug 2013

Splitting banks with a binary counter

Post by Imagesowner2 »

I'm not sure if this is in the right section or not. But here goes.

I have been babbling with making a few multi carts for the NES and I have found a tutorial that explains how to make a 4 in 1 cart. But I want to try and make a 8 in 1 or a 16 in 1. I'm not 100% on how the binary counter works. Can someone check out this tutorial and see f you can explain how to break it into 8 banks ?

I was goin to cut and paste the whole thing here but the pics wouldn't transfer.

Here I the link. I appreciate any help I can get.

http://callanbrown.com/index.php/super- ... -multicart



Ryan
User avatar
enso
Posts: 904
Joined: 29 Sep 2012

Re: Splitting banks with a binary counter

Post by enso »

A binary counter is a circuit that outputs a set of sequential binary values on its output pins. A pulse on its input will make it step forward through the sequence. For instance, a 2-bit binary counter will output the following sequence on its 2 output pins:
00
01
10
11

In this case, the binary counter is used to address the high bits of a memory chip, and 'bank-switch' between the possible memory spaces. In order to accomplish your task, you need a memory chip x times larger than the original addressable space. That memory chip will have extra high address pins that the original circuit has no way to control. The binary counter outputs the missing address bits, and using its control pin you can switch between the banks.

To have 4 banks you need 2 extra bits, therefore a 2-bit binary counter. 3 bits will give you 8 banks, 4 bits - 16 banks, etc.

So take the original circuit, find a binary counter with more bits, and connect the outputs to high address bits of an appropriately-sized memory (for each extra bit you add double the memory size).

P.S. This topic is probably more appropriate in the 'hardware' forum.
In theory, there is no difference between theory and practice. In practice, there is. ...Jan van de Snepscheut
nyef
Posts: 235
Joined: 28 Jul 2013

Re: Splitting banks with a binary counter

Post by nyef »

Out of curiousity, can you get a counter that will do a gray code? That is, where it still has the same number of states (four in the two-bit case), but only transitions one bit at a time for a state change, as follows:
00
01
11
10

Not really as useful for bankswitching control, but such a counter has to be useful for something...
User avatar
enso
Posts: 904
Joined: 29 Sep 2012

Re: Splitting banks with a binary counter

Post by enso »

It's pretty easy to make one in an FPGA (even more off-topic, but why not):

grey_count[x:0] = binary_count[x:0] xor {0, binary_count[x:1]];

Take the binary_count and xor it with binary_count shifted right by one.

I seem to remember seeing an even simpler way of doing it, but unfortunately can't remember where.
In theory, there is no difference between theory and practice. In practice, there is. ...Jan van de Snepscheut
Imagesowner2
Posts: 17
Joined: 28 Aug 2013

Re: Splitting banks with a binary counter

Post by Imagesowner2 »

Thanks so much !!!


So , if I have it right , if I use a 1mb chip and use Roms that are 128Kb in size each and attach 3 wires iN this order

Pin 1 to q3
Pin 31 to q2
Pin 30 to q1


And it works !! Thanks so much guys.


One more question.

If I want to use 4 games that each have a sac feature , can I bank switch the SRAM ?
User avatar
enso
Posts: 904
Joined: 29 Sep 2012

Re: Splitting banks with a binary counter

Post by enso »

I am happy that we could help.

I am not familiar with the 'sac' feature, but perhaps someone else here could assist.
In theory, there is no difference between theory and practice. In practice, there is. ...Jan van de Snepscheut
Imagesowner2
Posts: 17
Joined: 28 Aug 2013

Re: Splitting banks with a binary counter

Post by Imagesowner2 »

Sorry , I meant a "save" feature. Damn auto correct. If I have 4 games that all have the save feature. Like zelda , is there a way that all four games could use there own save feature? Right now the SRAM transfers all data from game to game.
nyef
Posts: 235
Joined: 28 Jul 2013

Re: Splitting banks with a binary counter

Post by nyef »

Imagesowner2 wrote:
Sorry , I meant a "save" feature. Damn auto correct. If I have 4 games that all have the save feature. Like zelda , is there a way that all four games could use there own save feature? Right now the SRAM transfers all data from game to game.
I don't see why not, except for possible interference from the WRAM write-protect option in some mappers. Run the lines from the same counter that you're using to switch game ROMs, and that should be the worst of it.
Post Reply