When I started selling the Classic 64K Bank-Switch Boards on the CHC store, I wanted to follow Jon’s lead and offer a cartridge shell. Currently the only place to get a 99/4A cartridge shell is to removed the circuit board from an existing TI produced cartridge, at least until someone coughs up the cash to have an injection mold tool made… Maybe when I’m rich (don’t hold your breath.)
So, I’m taking the circuit boards out of a perfectly good TI Invaders cart so I can supply the shell with the 64K Boards being bought on the store. As I’m doing this, I start to become perplexed by the whole thing. The TI produced cartridge boards are in excellent condition and they have pretty much everything necessary to become a bank switching board.
They look almost the same, don’t they? 😉 However, the TI board has a ROM and GROM, while the 64K boards use some sort of programmable chip like an EPROM and requires a logic chip (currently the 74LS379) to support the bank switching. However, the TI boards have all the necessary connections except for two, the we* (write enable) and A3 (address line 3 on a 99/4A is A12 for the rest of the world since TI numbered their pins backwards from everyone else.) The TI cartridge did not connect we* because you can’t write to a ROM, and the A3 was not necessary because the ROM is only 4K on this board.
So I started thinking that I could make a smaller circuit board to plug into the ROM location and pick up the we* and A3 with wires. This way I could convert a typical TI produced cartridge board into a bank switch board. Thus the Bank Switch Mini idea was hatched.
As long as I was making a new board, I figured I would fix a few of the things I would have done different from the 64K boards that Jon made.
Disclaimer: don’t get me wrong, what Jon did is absolutely wonderful and he spent a lot of personal time and money making the 64K boards, and without them I would not be selling much on the CHC store, and people would not be making their own carts.
I had some ideas of my own though, so I thought I would try some. My goals for the board were:
- Be smaller and cheaper than the 64K board, otherwise the project is not much different than the existing 64K board…
- Eliminate the 74LS379. The biggest problem with the 379 is that the part is obsolete, i.e. no one is making it any more, so it is hard to get and usually expensive (for a logic chip) once you find old stock.
- Eliminate the jumpers.
- Support bigger memories, since they exist.
I’m not sure why Jon used the 74LS379, except I think it had to do with compatibility with old bank-switching carts. Also, the 379 is a QUAD latch, but only 3 of the 4 latches are used, which limits the board to supporting up to only 8 banks via a 512K x 8 chip (27512). However, by simply adding the extra traces to the board during the design phase to pick up that 4th latch, Jon could have doubled the banking capacity to 16 banks. The board can do it, everything is there except two traces on the board. I have not asked Jon about it yet, but it was probably just an oversight and I think this was his first board too. Anyway, not that it matters, it is just a little confusing.
When I started researching memory components I quickly realized that the old UV EPROMs are EXPENSIVE! Industry has moved on and the cost for those chips are going up. A new 27512 from STMicro can cost as much as $7 to $9 from Mouser and DigiKey. Ouch! They are also a pain in the ass to work with and erase. What I did find, however, is that flash and EEPROM memories have replaced them, which are much easier to deal with, have pin-compatible layouts, and most importantly are a *lot* cheaper.
So, I picked a nice fat 27SF020, which is a 2Mbit x 8 chip, in a 32-pin PLCC package costing about $1.09 each. 🙂 That is a 256K *byte* chip, which means it can have 32 8K banks! And for that cheap, there is no need to support various size chips, and that simplifies the design. Just stick a 020 in the board and be done with it, whether you use 1, 5, 18, or all 32 banks, it does not matter.
FIXING THE 379 PROBLEM
Now for the 74LS379 chip. Aside from the lack of easy availability and cost, the chips only have 4 latches, and to get 32 banks we need 5. Also, since the chips are discrete logic, they don’t have any known power-on state, which means you don’t know what bank would be selected when the cart is plugged in. While this is not typically a big problem, and it can be solved by setting up the bank switching code correctly, it would be nice to have a known power-on bank, especially when dealing with 32 banks. The Motorola 379’s I bought all power-on with a 1011 output, which means bank 3 is always selected (remember only 3 of the 4 latches are used in the 64K boards.)
The last problem with the 74LS379 was the inverted outputs being used for bank selection. From a programming standpoint it does not make any difference, however it makes a *really* big difference when you are programming your chip, and I personally don’t like to think backwards if I can help it.
With inverted bank selections you have to put your lowest numbered bank (bank 0) at the highest memory location in the chip, and all subsequent banks must grow down in the chip’s address space as the bank number goes up. Like this:
>0000 bank 3
>2000 bank 2
>4000 bank 1
>6000 bank 0
That is a 4-bank chip, or 27C256. If you program the chip with your code for bank 0 starting at address >0000, then your program will not work. Anyway, all that to say I’d rather have non-inverted bank selection, or at least a way to have the option.
Since I have been messing with FPGA’s lately, I started looking for a programmable logic solution and found this nice device called a “GAL” (generic array logic), which apparently replaced the “PAL” (programmable array logic). So, I find this common GAL called the 16V8D which means 16 inputs and 8 outputs, all in a 16-pin package, available in PLCC and DIP cases (among others) and only costs about $1.07 at Mouser. So I bought a few made by Lattice (which much to my chagrin are actually now coming to their end of life…)
Now I had to figure out how to program the GAL (I bought them before I looked into that slight detail.) I downloaded the Lattice tools and discovered, to my delight, that I can use the same hardware description language (VHDL) that I had been using for the FPGA work! I think it took me about 10 minutes to described the logic of the 74LS379. It was a happy day.
Also, with the 16V8D I had the ability to have the required 5 inputs and 5 outputs to support all 32 banks, plus I have an input that, via a jumper (I know, but only 1 jumper) I could select inverted or non-inverted bank selection logic. The GAL also has active pull-ups on all input pins as well as a guaranteed power-on state! At power-on, all the outputs of the GAL are high, which means the highest bank (bank 31) in the 27020 will always be selected when the cart is plugged in. While I would have liked all the outputs to be *low* at power-on, I’ll take what I can get, and consistency is better than nothing.
Designing a circuit board is something I have always wanted to do, but never actually done before (aside from the dismal attempts at etching my own back in the early 1990’s.) I did some searching and found that Eagle CAD is still around and a popular choice, well supported, and they have a free version which is only limited in the max size of a board you can make. After installing a few programs and poking around, I settled on Eagle and started following various tutorials from places like SparkFun and such.
After about two weeks of work I had a schematic and initial board layout and I started looking for a place to have it made. I needed a prototype so I could test the design before I had a batch made up. Again, after a lot of searching, calls, emails, and quotes from various board houses, I settled on BatchPCB.com which is part of SparkFun. It is a nice service for limited small runs and prototypes, however you trade price for time. It took me 4 weeks to get my boards from the time I ordered them, however this was no surprise as they clearly state it will take between 3 and 4 weeks. This is the result and I’m really happy with them.
Also, I only ordered (and paid for) 2 boards and they sent me 4!! I’m not sure why, maybe the small size (1.4″x1.3″), but I’m happy about it.
The biggest problem I realized during board assembly is that I need to fix the through-hole pins. Since this board has to mate with the original TI board, it needs through-hole pins sticking out of the bottom. However, since there is a surface mounted PLCC-32 *socket* on the top-side of the board, the pins can not come up through the board, they must be flush or shorter than the thickness of the board (which is only 0.062″). You would not think that would really be a problem (finding such pins), but I’m here to tell you that it is! I can not find a standard header with a tail (the part that goes into the circuit board) short enough, and I ended up using two styles of individual PCB pins from Mill-Max:
In case you didn’t notice the penny sitting there, those are some SMALL pins, especially the ones designed for surface mounting! The through-hole pins (on the right) actually stick up just enough to get in the way of the socket, so there are 8 pins (4 on each side) that use the really small ones on the left. It was tedious to handle the pins and a show stopper for having the boards made, or for hand making them myself in any kind of quantity. The hardest part about assembling the board was these pins and the PLCC-32 socket.
I bought a fancy SMD hot-air rework station and some solder paste to try and use with the sockets, however the paste ended up making more of a mess than it was worth and I could not make it work. I guess I’ll have to experiment with it before trying to use it on another project. So I tinned the leads of the PLCC-20 socket and the hot-air worked for that one. The PLCC-32 socket was another story. I could not get it to solder down flat with the hot-air, and after 5 failed attempts, I had to cut the center out of the socket and hand solder the pins.
Not exactly what I wanted to do, but hey, it’s a prototype and my first SMD assembly. One of the last minutes changes I made to the board was to add some low current LEDs and current limiting resistors to the board so I could see what bank was actually selected. These are 0603 SMD parts (the smallest currently made) and they were actually not to bad to solder once I got them aligned, which was a lot harder than I though it was going to be. They are so small that even taking them out of their packaging was a task in trying not to lose them. The LEDs are smaller than a grain of rice and transparent, and I had to use a 10x loupe just to determine which end was the cathode.
I was also not sure if having the LEDs on the address lines was going interfere with the operation of the board, but I selected LEDs that use less current than a standard TTL input, and made my current limiting resistor selection carefully, and it all worked out.
I tested the bank switching with Retroclousds’ PITFALL! and it worked perfectly the first time! I was shocked! Actually, the first time I tried the board I had forgotten to program both the GAL and the 27SF020 and it did not work when I plugged in it (obviously). It was a deflating end to a long night of board assembly (4 hours to put the sucker together thanks to those pins and that 32-pin socket.) But after realizing my error, and a quick programming later, I was playing PITFALL! on my 99/4A and watching the bank selecting via cool looking orange LEDs. Here are a few shots with the board plugged into my test-bench 99/4A.
The board in these pictures was set up to use the inverted bank selection, so in the second picture you see bank 28 is actually selected, i.e. binary 11100, but the game code actually executed a switch to bank 3.
To test the non-inverted bank selection I put the game in the 27SF020 twice, once at the top of the chip in reverse bank order, and again at the bottom of the chip with the four 8K game code banks in the opposite order. With the non-inverting jumper set, the game ran and I could see banks 0 – 3 being selected. Without the jumper banks 28 – 31 were used. It was pretty cool.
I can hear some of you yelling about programming the PLCC chip. Well, for doing that I went to this really nice site, EZprototypes.com, where a guy is making chip adapters for *really* cheap, and got one of these:
It costs about $6.50 and is really well made. My chip programmer software already supports the 27SF020, so it worked right out of the box. Not quite as convenient as a ZIF I know, but not too bad and you get the small size and *really* cheap 020 chips! I also picked up a PLCC-20 to DIP-20 converter to program the GAL 16V8D, which I was really surprised to find my programmer also supported.
All around it was a fun project and one that I hope to have available soon on the CHC store if I can work out the pin problem. I really need to find a single header for the through-hole connection to the TI board so the part count can go from 30+ pieces to about 7 (without the LEDs.)
I had a request for the code used to program the GAL, so here it is.
entity memsel is
cp : in std_logic;
clken : in std_logic;
invert : in std_logic;
d_in : in std_logic_vector(0 to 4);
oe : in std_logic;
q_out : out std_logic_vector(0 to 4)
architecture behavorial of memsel is
signal reg : std_logic_vector(0 to 4);
if rising_edge(cp) and clken = '0' then
if invert = '0' then
reg <= d_in;
reg <= not d_in;
q_out <= reg when oe = '0' else (others => 'Z');