Reverse Engineering Namco Customs: My setup

Time passed....

Thanks to the decap project I managed to set up the 51xx and 54xx together with the 06xx custom ICs. For that I set up the Fujitsu mb88xx 4bit core based on some paper specs and many simulations. Still no perfect implementations (the serial peripheral is still not working, but that's not really needed). They fully work using a replacement-FPGA-setup I set up as well in my original Galaga board. See here: http://www.pin4.at/pro_custom.php

Edit: Now I also finalized the core to run with all available namco firmware binaries and I did also quite some testing on original boards here: http://www.pin4.at/pro_custom_5xxx.php using my small FPGA-DIL-replacement boards here: http://www.pin4.at/pro_misc.php#fdil (~ 100kGate).

Basically I required this to set up Galaga, which is ready to use as well (thanks to further custom IC code from Adam and Mike/fpgaarcade) except the 05xx, which still not use the fully correct LSFR...

I am using the fpgaarcade replay board for it:
http://www.pin4.at/pro_arcade_galaga.php
But I'll wait for the release until Mike has the new setup ready, I am using some development stuff I don't want to distribute yet.
 
Last edited:
Great to see more progress being made! It's always depressing when you see an awesome project start up but then it completely drops off the radar.
The long awaited Asteroids Multi is a prime example.
 
With the new platforms coming up (and using large enough FPGAs) I hope there will be more people working on this stuff in future. I really like MAME as well, they did a great job, but IMHO nothing is as good as a bunch of gates and flip-flops directly controlled by a joystick, and the original ones will not last forever...

I have even more Namco-based boards, so enough in the queue. I hope as I understood one of them quite well, the others should be set up faster. Let's see :)
 
Galaga on FPGA is alive!

I got the Galaga "emulation" ready. Honest, pure logic at work - no CPU-based emulation - including all custom chips (which means there are really 5 processors, 3xZ80 & 2xMB88 running on the FPGA) :)

http://www.pin4.at/pro_arcade_galaga.php

--> For now I set up everything to run the code on a Digilent Nexys2 or Nexys3, without pain - at the end of my web page is a link to the file area section - just go directly to the file area - this DL is open, no need to send a request (ok, except the fact that you need to get the original ROMs from an original board, I don't distribute them). I am also working on a generic "Jamma PMOD" for these boards.

--> As soon as MikeJ releases the new environment of the FPGAArcade Replay board, I'll release the code for this board. My "pre-beta" prototype with some (intermediate) code booting from the SDCard is already working, but that does not help anyone yet... :)

Now there is a BUT,which will be solved soon:

The only issue is the "starfield generation": in my Galaga set up it is not correct, although it looks quite good - and there was no known information source about the "real thing", reverse-engineering a Galag bootlech didn't work out as well. So I was curious to get it out directly by myself - how hard can it be...?

I was now able to get out the 100% correct LSFR polynomial used in the 05xx!
This includes the exact start point of the LSFR used (= the "feedback code" and "init value" required to set up the pseudo-random pattern correctly). Then it just needs some gates to generate the 4 starfield maps - and voilá!

Simulations already show exactly the same pattern the 05xx generates from the first clock cycle on - and as JROK mentioned it should/will fit in the 64 macrocell CPLD (I use the boards from MikeJ which were already mentioned in this thread). Just have to check the exact mechanism of handling VS/HS for X/Yscrolling I want to have a perfect replacement for Bosconian and Galaga. I'll test it "in-board" the next few weeks when I have again some time. Details here, set the page up yesterday: http://www.pin4.at/pro_custom_05xx.php

With this code the Galaga-FPGA set up is nearly perfect to the original (unfortunately a robust design - especially for Spartan6 and up - requires a clean synchronous setup compared to the old design style with 74xx devices). Stay tuned - can't take too long!

--Wolfgang

PS:

Just because I got already a few some mails asking for an implementation on this small 500E boards available for ~100€/$ or even more (including all the external stuff for VGA out, buttons, additional flash memory for the ROMs etc. the people tend to forget when they see the "low price" of the "naked" board alone):

My answer this way: forget it, the memory and gate count of Galaga plus a "clean" separation of board implementation for all the EEPROMs on CPU/VID boards requires at least a 700...800k gate fabric - and also an external Flash, SD-Card etc. to use it stand-alone in a (very) simple way (= allow none-FPGA designers just to use the binaries with a downloader instead of all the FPGA tools). This "3-CPU board" is more complex than "1-CPU board" implementations for FPGAs flying around on the Web...

And "no", I spend my time better in implementing another board than trying to spend a lot of efforts in fitting it to a device by ressource sharing etc. which is simply to small! And it is a contradiction to my approach to have a similar implementation than the original board - which means it also runs at the same clock speed without (!) overclocking, CPU multiplexing, etc.

So please better spend some 10...20 €/$ more and invest in a "real" FPGA eval board (Xilinx S3 >=1200E, S6 >=16LX) or take a look at the Replay Arcade board (then you will also get a perfect retro/gaming platform). If someone donates an (old) Altera board (for now I stick on Xilinx, I don't want to buy yet another board) I'd try it on that one as well, but again needs some useful size. The Nintendo/Popeye implementation I am about to release next needs even more internal BRAM for graphics to do it exactly the same way, so 1200E will be even at the limit. And don't believe the guys telling you 500k gates on a FPGA are enough - ask them how much memory they have in the PC, because there also 1GB should be more than enough... :)
 
Last edited:
Good gravy, that's impressive! Good luck on finishing up - I'm glad to see someone making the effort to fully replicate this stuff. It's a heck of a lot of work, and I'm glad you're doing it!
 
Galaga on FPGA is finally complete, including starfield!

I managed to fully reverse-engineer the 05xx starfield generator - this means I was able to find the real LFSR (linear feedback shift register) setup - including the logic to generate the (4) starfield(s). :D :D :D :D

I contrast to existing solutions (taking a fixed look-up table of star positions), this one behaves exactly as the original one - as close as possible to replace the real 05xx with a minimum HW effort.

It easily fits in a standard 64-macrocell CPLD - by that I could also test the implementation on real boards (Bosconian and Galaga), I did some more testing and it works just great ;)

For interested readers: http://www.pin4.at/pro_custom_05xx.php
 
Sorry for waking this thread from the dead, I've posted this at arcade-projects as well

I have a broken custom 27 used on Namco 86 and System 1 hardware.
The custom 27 seems pretty similar to 07xx.

I've attached some pics of the pinout of these, the second picture is of the 27 and that is the pinouts that i've read from pac-land, rolling thunder and Galaga88 schematics.

I would love to have a replacement for this custom, but i just don't have the know-how to do it :(
 

Attachments

  • cust07xx.PNG
    cust07xx.PNG
    99.3 KB · Views: 38
  • cust27.PNG
    cust27.PNG
    14.3 KB · Views: 34
I managed to fully reverse-engineer the 05xx starfield generator - this means I was able to find the real LFSR (linear feedback shift register) setup - including the logic to generate the (4) starfield(s). :D :D :D :D

I contrast to existing solutions (taking a fixed look-up table of star positions), this one behaves exactly as the original one - as close as possible to replace the real 05xx with a minimum HW effort.

It easily fits in a standard 64-macrocell CPLD - by that I could also test the implementation on real boards (Bosconian and Galaga), I did some more testing and it works just great ;)

For interested readers: http://www.pin4.at/pro_custom_05xx.php

Excellent work...

Correlation is your friend! :)
 
Galaga on FPGA is finally complete, including starfield!

I managed to fully reverse-engineer the 05xx starfield generator - this means I was able to find the real LFSR (linear feedback shift register) setup - including the logic to generate the (4) starfield(s). :D :D :D :D

I contrast to existing solutions (taking a fixed look-up table of star positions), this one behaves exactly as the original one - as close as possible to replace the real 05xx with a minimum HW effort.

It easily fits in a standard 64-macrocell CPLD - by that I could also test the implementation on real boards (Bosconian and Galaga), I did some more testing and it works just great ;)

For interested readers: http://www.pin4.at/pro_custom_05xx.php
If you could provide any verilog/pld sources or more discrete gate logic schematics for this, I'd be really appreciative - getting back into FPGA and CPLD programming after letting myself get rusty after my college ECE courses some years ago. I've got some Atmel ATF1504s on the way as well as the needed USB-JTAG cable (I already have a PLCC44-to-DIP adapter from my chinese T56 programmer I can borrow), and in the meantime I've already got an Alchitry Cu (Lattice ICE40HX8k) and Au (Xilinx Artix 7) FPGA dev boards and software set up. My biggest issue aside from not being able to see any existing logic references for these reverse-engineering projects, is that absolutely zero original or crowd-sourced schematics appear to exist for the 05xx chip pinout, let alone function-specific descriptions. My only other brainstorm idea to begin tinkering was to hook the original 05xx chip up (either in-circuit to the gameboard, or otherwise at least hooked up to power on a breadboard) to logic probes/multimeter leads and try to figure out power/ground first, then try to find a way to scrape any data patterns across various pins over time (possibly either a microcontroller reader interface, like I borrowed from others on the web to scrape rom contents from Atari's 213 Centipede Video Driver BPROM, or a proper digital signal analyzer, like those FPGA-based skus that Digilent sells).

But I'm shooting quite a bit into the dark here, frankly.

Especially that "Best Correlation" test you describe performing on your site. What sort of program or formulas were you using in order to achieve this?

Ngl, I find it frustrating that these enigmas seem to have been at least technically cracked-and-solved for up to the last ten years or more, and yet at the same time, educational/supportive documentation for the process is still almost sparse enough to be missed completely.
:cry:
 
Last edited:
So I guess absolutely no one else, including this Mike/Jrok and wuzl persons, still has any access to schematics or logic diagrams or Verilog/hdl for these 05xx/other Namco Custom RE chips?? I see wuzl's site details for the 05xx and test adapters and I appreciate the effort taken and want to replicate but his logic diagrams are small, compressed and hard to read. He also leaves no access to code sources and doesn't seem any longer to be active on forums or by email message.

I know the efforts to restore Atari's Pokey chip in modern logic is alive and well, one user on this forum has open-source RE discussions on converting the original Chip's gate and clock designs over to a Lattice ICE40HX FPGA DIP PCB. I feel confident in saying that Namco Custom ICs should be getting the same open-source love and preservation. I need my Galaga starfields forever, damn it!!
 
I mean how do you even go about "finding the correct polynomial and exact start point? My best hypothesis is using an XOR gate with two inputs, and strobing one of the XOR input wires up from LSB to MSB of the Register, while simultaneously analyzing the data between the reproduction signal and the original signal (implying also along the exact same clockycles). If none of the datasets from the first strobe match perfectly with the control Chip's output, then proceed to move the lower of the two XOR inputs up by one along the Register's bank (implying the higher of the two inputs wires moves to the left along with it). Then continue to strobe the higher of the two XOR inputs wires along the left to the MSB and compare data with sync'd control chip output. Repeat cascading-strobing process as necessary until data between reproduction and control chip accurately match in- sync.

But I'm still a little confused from the logic diagram wuzl made: I count 14 inputs and 7 outputs in his drawn logic diagram. That's 21 pins, and if we include VCC and Ground it becomes 23 pins - but the 05xx is a DIP28 chip, so where's the other 5? If they really only needed 23 pins, why not use a DIP24 instead and leave an unused NC pin?

And also, which, if not all, of the shift registers make use of the polynomial XOR gate vs just being a plain linear shift register? I guess the ones that just say "shift register" in his diagram are perfectly linear, and the one that says "linear feedback shift register" likely makes use of at least some variation of the XOR logic described above, unless I'm totally fundamentally mistaken, but then I'd love to be accurately corrected where possible anyway. This is as much for me to learn cool things as it is to preserve and protect computing history.
 
First off, thanks for your enthusiasm and willingness to take this on.

Keep in mind, some people don't spend their days looking at a thread which started a decade ago, and had been sputtering on occasion ever since. Give people a chance to respond.
 
And food for thought: The Op that started this thread @ajcrm125 hasn't been on since April 9, 2022.
Three other contributors haven't been on since:
9/12/2023
5/16/2018
8/18/2016

Others are looking in, but unless it is someone in the know about stuff like this (e.g., someone brilliant in chip work like @DirtyMcDingus ) it may be a few hours, days, weeks or months until your question get answered.
 
So I guess absolutely no one else, including this Mike/Jrok and wuzl persons, still has any access to schematics or logic diagrams or Verilog/hdl for these 05xx/other Namco Custom RE chips??
The people who "have access to schematics or logic diagrams or Verilog/hdl" are the ones who reverse-engineered them, and most of them sell replacements and consider them proprietary.

I know the efforts to restore Atari's Pokey chip in modern logic is alive and well, one user on this forum has open-source RE discussions on converting the original Chip's gate and clock designs over to a Lattice ICE40HX FPGA DIP PCB. I feel confident in saying that Namco Custom ICs should be getting the same open-source love and preservation. I need my Galaga starfields forever, damn it!!
If you think they should be getting "open-source love and preservation", go ahead and do the work and release your files.

You're not going to learn anything by copying someone else's homework.
 
The people who "have access to schematics or logic diagrams or Verilog/hdl" are the ones who reverse-engineered them, and most of them sell replacements and consider them proprietary.


If you think they should be getting "open-source love and preservation", go ahead and do the work and release your files.

You're not going to learn anything by copying someone else's homework.
FWIW I understand the desire to protect efforts in order to sell products and recoup on inital R&D, but I've only seen one online listing for any sort of aftermarket 05XX replacement, and it hasn't been in-stock for who knows how long.

But yes, I plan to put the analysis in. I understand it will take time and fiddling both with the game hardware and with trying to compare simultaneous in/out signals between the dev and reference chips, not to mention the polynomial gate "hacking" approach which I can only theorize is how others have matched up the PRNG-like data transforms with the LSFRs. When I have something I'll absolutely link to an open git repo.

EDIT: As part of my preliminary LFSR research, I've found this interesting and (seemingly) comprehensive theory/application document on the topic provided by none other than the folks at Texas Instruments themselves, figured I'd link to it here for any other interested eyes: Texas Instruments on LSFR Theory and Application.

What the initial description is telling me is that I appear to have been on the right track regarding the XOR gate hacking methodology, but may potentially have to contend with testing for an XOR circuit that contains more than 2 input gates from the register. If test results between Dev and reference chip do not match after using a 2-line XOR polynomial gate across all potential permutations in the register, then we may have to contend with adding a third input line to the XOR gate in sequence, and repeating the cascade-shift from LSB across to MSB just as described for attempting to test inputs for the 2-input XOR test - so on and so forth for a 4+ input XOR gate for every respective test cycle in which all given XOR input permutations for given input size n have been exhausted.

Now, I doubt they're using 4+ inputs into the XOR gate, since that would mean half or more of the register's inputs would potentially be toggling (or affecting the toggle effect) of the Exclusive OR gate, likely leading to an unsatisfactory PRNG generator. I'm only making an educated guess when I say this, of course. I could be totally wrong, and haven't gotten far enough into the document to see if TI expresses concerns over practical input-count limits for a given-sized register/array of SRs. I'll obviously have to observe test behavior to know, ultimately.

The document also mentions loading an initial seed into the LFSR, and clarifies that if all-zeros are loaded into the LFSRs upon initialization, that randomization effects would not be observed. Now, I'm not sure what factor Namco's implementation plays in initializing this seed, at least for Galaga, if not universally (they only ever used this IC in two games anyway), but if we confirm that a 0-default LFSR init causes all-Low/linear outputs when provided with test data, then we could proceed to experiment with bit-level iteration/evaluation steps for initializing and verifying the seed/feedback effect across permutations. This would take some time, even for an 8-bit array, but clearly is in the realm of doability (it's been done before, after all, as we can see from others results).

The original idea in my head was that the randomization effects would be observed even without a preset seed, as when high values would be clocked into the register through the initial D input line, they would eventually shift their way into one or more of the XOR input lines, causing an erratic, variable change in the register value (the changed bit is seemingly usually towards the end of of the register bank, closer to the MSB, at least if Nintendo's CIC polynomial LFSR implementation is anything to go by).

But it could be the case, that the output may not be considered "erratic enough" for the game's implementation, so if that's the case then perhaps having an extra seed value initialized into the register on-start helps to improve the non-linearity of the perceived output, or perhaps even just to prevent some sort of jarring startup behavior on the starfield during the initialization of the playfield - still totally conjecture at this time.

I see additional resources claiming that some LFSRs use XNOR gates instead of XOR gates as their functional feedback implementation. Welp, there's yet another Truth Table variable to keep track of for iterative purposes

Here's the second reference I'm alluding to

I also found another reference from a university site - haven't verified all info but it appears it may even have linked access to a comparable polynomial simulation program to whichever one wuzl used in their analysis

Scratch the sim program part - that repo is dead as well.

But according to various sources, including AMD, tap points to appropriately allow for max-length LFSR iteration are contained in this doc's tables

And from that we get a suggested starting tap-points set of bits 16, 15, 13, and 4 BUT it's for an XNOR implementation, so not my first choice for logic-fit testing. It's totally possible that this may not be the right combination - apparently in these LFSRs, you can mirror the combinational effect by mirroring the position of the taps mathematically to the opposite end of the shift registers in/out data lines, for example. There's also a possibility of more than one non-mirrored max-length existing for this 16-bit dataset, but there's just no way to know without more testing or sim programs. What I have at least learned is that for a max-length LSFR tapset to be possible, it must be of an even number of taps.

Another University resource indicates some Verilog code to test an LFSR template with (basically just D-Flipflops in sequence with the extra combinational logic, so not hard to follow anyway). It also has what may be a viable 16-degree (16-bit) minimum polynomial equation for max-length iteration across all 65535 possible step-states
 
Last edited:
Ok, one dumb set of confusion's been answered - I wrongly counted 28 pins on reference Photos for the 05XX, but now that I've got my PCB and schematics out, it's clearly a DIP 24 with at least one or more unused pins. That makes much more sense, since from wuzl's logic overview diagrams, there were about 21 I/O lines counted entering and exiting the logic circuits.
 
If the LFSR is initialized with 0's you need to add an inversion (or change an XOR to an XNOR) for it to be "random". Next bit shifted in must be a 1.
If it's initialized with 1's the bit shifted in has to be a 0 (so for 2 feedback terms, an XOR alone is fine).
 
Ok, one dumb set of confusion's been answered - I wrongly counted 28 pins on reference Photos for the 05XX, but now that I've got my PCB and schematics out, it's clearly a DIP 24 with at least one or more unused pins. That makes much more sense, since from wuzl's logic overview diagrams, there were about 21 I/O lines counted entering and exiting the logic circuits.
What are you looking for because I want to help with recreating these customs. I have a lot info I have obtained from here and the UKVac site and my personal stash of galaga and a current track and field I am working on.
I recently came a cross a tutankham bootleg it looks like with full blown daughter card with about 4 or 5 customs built on it. I also have the Reversed docs on it to which is in a thread here I forget where I saw it.
I am just learning about FPGAs through arduino and Nucleo boards. Dont let my new learning be taken for granted I am a network systems engineer by day and work in the shop at night using what I earned as a degree in Computer Automation.
Would love to collaborate on a project like this. I think it would help the community a bunch to get as many of these available.
 
Back
Top Bottom