Re: Pac-Man Hardware (multiple games)

Right, nearly done. I've updated the scripts to pick up the filter from the library.
I've restructured the SD card directory.
The ROMs are for the Pong game which we can distribute (pong.ini).
pacman.ini and pacplus.ini look for roms in subdirectories.

You can always rename an ini file to replay.ini, and put it in root to auto-load a specific core.

I recommend you have loader (loader.bin, background.raw and replay.ini) in the root of the SD card. 

Then you can select the core to load by going to OSD menu (F12 from ps/2, serial or front button) and going "load target"
The you select the ini file you wish.


Re: Pac-Man Hardware (multiple games)

As soon as there is a standard JAMMA board I'd say it would make sense to have an alternate ARM firmware (configuration) optimized for use in a cabinet / cocktail table, where the board is somehwere buried and only the joystick ports are available. Could be an additional flag with the loader setup.

Instead of a lot of config stuff shown in the OSD it should be similar to the other JAMMA arcade boards:
just show a selection menu for all available games and then directly select & load/start the game. Something like the F12 keypress could be emulated by pressing the 1P and 2P button at the same time (or so) to open the OSD list again to select/load a new game...



Re: Pac-Man Hardware (multiple games)

Checked in the first version of the R-DAC, width and the array of resistor values can be defined as generic.

When used for silicon replacement (e.g. SID) it is also possible to specify W/L factors - at the end only the ratios count, not the absolute values. I had to do the weight calculations (which are finally 12bit constants per input bit) in integer (fixpoint) - this bunch of real numbers were too much for XST, it simply crashed with an internal error big_smile

I checked it in here:

It can model this part of the DAC used e.g. in Namco games and really produces the same "ugly" nonlinear transfer characteristics. Due to the integer calculations the results may be off by 1 LSB, but this means an error of <0.025% per bit, which is still massively smaller than the typical error of the resistors soldered on the PCB (= usually 5% per bit).

-- Principle circuit (clocked to improve timing for P&R):
--            MSB       R0
--             o--------###----*
--                      R1     |
-- inputs      o--------###----*-------o      output ("ratiomeric" from 0 to 4095)
--                      R2     |
--             o--------###----*
--            LSB

The size of the 4bit DAC is really small on FPGA:

Synthesizing Unit <r_dac_simple>.
    Found 12-bit register for signal <dac_o>.
    Found 12-bit adder for signal <dac_s$addsub0000> created at line 155.
    Found 12-bit adder for signal <dac_sum$addsub0000> created at line 155.
    Found 12-bit adder for signal <dac_sum$addsub0001> created at line 155.
    inferred  12 D-type flip-flop(s).
    inferred   3 Adder/Subtractor(s).
Unit <r_dac_simple> synthesized.

It is setup in a way that the output register can be removed as well (in case some other registers follow afterwards).

Will model the other DAC with the transfer gates (envelope/volume DAC) as well.


Re: Pac-Man Hardware (multiple games)

Looking at it now, very nice!
If you update your games I'll steal it for Pacman....

55 (edited by olekk77 2015-02-17 23:41:55)

Re: Pac-Man Hardware (multiple games)

Your solutions sounds like a killer, Wolfgang! smile
The very best for digital modelling i think, and i'm actually impressed, for digital resolutions that is. wink

But, analog is still analog.. But we'we been there... Great work, Wolf!


Btw, Mike..., is the boards finished in design yet, or do you do the core designs and the hw brush ups at the same time?
Is that why the Replay's release has taken so long time, and still does?

Also, i'm wondering.., could you please tell me the part nr / name of the DAC used onboard, i wanna know if it's a sigma delta multibit... What else could it be... Also i'm wondering if it has a builtin opamp...

Another question, Mike... Is the SVN repo closed and password protected for the select few only? wink


Wolfgang.... about filters, rc filters are good, but please avoid linear interpolation like the pest, it is bad, and not the same (most people doesn't seem to know that).

Those MIST guys just recently added simple linear interpolation to their sound output core (sigma delta, verilog), and it made the sound even worse.. I say, some people just don't got any taste, and some doesn't know any better. They have also added random jitter to the sound stream.. Tasteless! Ehhh..., BUT the pseudo random modelled PSU noise you mentioned on the other hand, sounds fun, crazy fun.. big_smile smile

Not to critisise them too much really, but.. yes.. Seems to me that you know a lot better than them what you are doing, Wolfgang.

Selvgjort er velgjort! wink

Re: Pac-Man Hardware (multiple games)

The DAC is a Wolfson WM8729. It's a delta sigma - you can't make 24 bit multi bit DACs, the resistor matching required would be impossible.  Before you comment, it's designed for high end audio equipment and the response plots are in the data sheet.

I'm sure it has a lot of built in opamps.

The reason the Minimig added a LFSR noise generator is complex, but should improve the performance of the delta sigma converter they are using.

The SVN repos is restricted purely because the framework was not stable. It's rapidly becoming so, and once we have figured out which bits can be released (we need to check each author, license etc) we will publicly mirror.


57 (edited by olekk77 2015-02-18 00:06:38)

Re: Pac-Man Hardware (multiple games)

Ok, i thought as much, and i know... multibit has to be delta sigma... sad

About the repos.. ok..
This philosophy will also ensure quality, like how Steve Jobs wanted control of the whole consumer experience.
Full opensource could damage the project before it becomes ready.. I think i understand. Also it would lead to ripofs.

It's too bad for me though... wink and others... hehehe..
Not that i would want to rip off, but i'm curious on exactly what you are working on, and how you solve etc stuff... smile
However... i understand that you write in VHDL, which i think is puke puke... so i would probably not delve into the hdl for that very reason anyway....

A matter of taste they say.


Selvgjort er velgjort! wink

58 (edited by olekk77 2015-02-18 00:20:09)

Re: Pac-Man Hardware (multiple games)

About the WM8729... I personally would not even touch this device.. Call me oldschool, but i see that you'we got no other real choice, really.

Yes, i peeked a little bit into it's datasheet.

In a perfect world we would have 32bits R2R or weighed, real dacs.. but.. such is not reality.., yet..
They sounds so cold those "modern" dacs.... sad, but unavoidable.

Not the worst dac for a modern one, far from it, rather the oposite.
I just don't like modern.. Maybe that's why it's called de'velopment, and not en'velopment... see my point? big_smile wink

Selvgjort er velgjort! wink

Re: Pac-Man Hardware (multiple games)

I've built and tested the Pacman core against the latest lib. Works fine.
It's been pushed to the public server now.

Pacman is a great starting point for doing your own game using the Replay framework!


Re: Pac-Man Hardware (multiple games)

I tried Pacman which works fine.

When I tried the data files of ms pacman, ms pacman is corrupted and on the demo screen the images of the ghosts are also corrupted. The rest seems to work.

Re: Pac-Man Hardware (multiple games)

I've "just" checked in a new version where the joystick is fixed, you get this one?

There is a C program in pacman/tools which decrypts Mr TNT ROMs

If I remember correctly, there was a slight hardware difference with ms pacman, some pins were swapped.
Some ROM images are processed to correct this.

I'm working on Scramble at the moment, but if you can find what the hardware difference is I'll fix it straight away.

Re: Pac-Man Hardware (multiple games)

I got rev 42 from the public svn. Which is 19 hours old. I'll have a look if I can find a different rom set.

Btw, is there some instruction on how to write a new ini file, since I want to try Pengo but the rom has more files listed.

Re: Pac-Man Hardware (multiple games)

I think there are more roms actually in Ms Pac which will require a change to the core.

The ROMs are really dual ported RAMs. One port is attached to the original hardware at the correct address for the game.
The other port is connected to the ARM, with the addresses below :


# enables verification feature, checks back any ROM/DATA upload

ROM = roms_pacman/pacrom_6e.bin, 0,    0x80000000
ROM = roms_pacman/pacrom_6f.bin, 0,    0x80001000
ROM = roms_pacman/pacrom_6h.bin, 0,    0x80002000
ROM = roms_pacman/pacrom_6j.bin, 0,    0x80003000
ROM = roms_pacman/pacrom_5e.bin, 0,    0x80004000
ROM = roms_pacman/pacrom_5f.bin, 0,    0x80005000
ROM = roms_pacman/pacrom_4a.bin, 0x80, 0x80006000
ROM = roms_pacman/pacrom_7f.bin, 0x10, 0x80007000
ROM = roms_pacman/pacrom_1m.bin, 0,    0x80008000

If the game has more ROMs, I need to add them to the core and then extend this memory map.
Perhaps you could start a table of each game and where the ROMs go?

64 (edited by Lizard 2015-08-27 22:37:14)

Re: Pac-Man Hardware (multiple games)

For ms pacman I found this rom descrambler: … ambler.vhd

His code is based on your original source. Maybe you can adapt/backport it?

For Pengo I have no clue how to proceed, since the filenames are completely different than the original pacman roms.

I did find this memory map:

While peeking at the mame sources I found this:

ROM_START( pengo )
    ROM_REGION( 0x10000, "maincpu", 0 )
    ROM_LOAD( "ep1689c.8",    0x0000, 0x1000, CRC(f37066a8) SHA1(0930de17a763a527057f60783a92662b09554426) )
    ROM_LOAD( "ep1690b.7",    0x1000, 0x1000, CRC(baf48143) SHA1(4c97529e61eeca5d94938b1dfbeac41bf8cbaf7d) )
    ROM_LOAD( "ep1691b.15",   0x2000, 0x1000, CRC(adf0eba0) SHA1(c8949fbdbfe5023ee17a789ef60205e834a76c81) )
    ROM_LOAD( "ep1692b.14",   0x3000, 0x1000, CRC(a086d60f) SHA1(7079769d14dfe3873ffe29623ba0a93413706c6d) )
    ROM_LOAD( "ep1693b.21",   0x4000, 0x1000, CRC(b72084ec) SHA1(c0508951c2ad8dc31481be8b3bfee2063e3fb0d7) )
    ROM_LOAD( "ep1694b.20",   0x5000, 0x1000, CRC(94194a89) SHA1(7b47aec61593efd758e2a031f72a854bb0ba8af1) )
    ROM_LOAD( "ep5118b.32",   0x6000, 0x1000, CRC(af7b12c4) SHA1(207ed466546f40ca60a38031b83aef61446902e2) )
    ROM_LOAD( "ep5119c.31",   0x7000, 0x1000, CRC(933950fe) SHA1(fec7236b3dee2ea6e39c68440a6d2d9e3f72675a) )

    ROM_REGION( 0x4000, "gfx1", 0 )
    ROM_LOAD( "ep1640.92",    0x0000, 0x1000, CRC(d7eec6cd) SHA1(e542bcc28f292be9a0a29d949de726e0b55e654a) ) /* tiles (bank 1) */
    ROM_CONTINUE(             0x2000, 0x1000 ) /* sprites (bank 1)*/
    ROM_LOAD( "ep1695.105",   0x1000, 0x1000, CRC(5bfd26e9) SHA1(bdec535e486b43a8f5550334beff423eeace10b2) ) /* tiles (bank 2) */
    ROM_CONTINUE(             0x3000, 0x1000 ) /* sprites (bank 2) */

    ROM_REGION( 0x0420, "proms", 0 )
    ROM_LOAD( "pr1633.78",    0x0000, 0x0020, CRC(3a5844ec) SHA1(680eab0e1204c9b74adc11588461651b474021bb) ) /* color palette */
    ROM_LOAD( "pr1634.88",    0x0020, 0x0400, CRC(766b139b) SHA1(3fcd66610fcaee814953a115bf5e04788923181f) ) /* color lookup */

    ROM_REGION( 0x0200, "namco", 0 )
    ROM_LOAD( "pr1635.51",    0x0000, 0x0100, CRC(c29dea27) SHA1(563c9770028fe39188e62630711589d6ed242a66) ) /* waveform */
    ROM_LOAD( "pr1636.70",    0x0100, 0x0100, CRC(77245b66) SHA1(0c4d0bee858b97632411c440bea6948a74759746) ) /* timing - not used */

While for pacman there's only these:

ROM_START( pacman )
    ROM_REGION( 0x10000, "maincpu", 0 )
    ROM_LOAD( "pacman.6e",    0x0000, 0x1000, CRC(c1e6ab10) SHA1(e87e059c5be45753f7e9f33dff851f16d6751181) )
    ROM_LOAD( "pacman.6f",    0x1000, 0x1000, CRC(1a6fb2d4) SHA1(674d3a7f00d8be5e38b1fdc208ebef5a92d38329) )
    ROM_LOAD( "pacman.6h",    0x2000, 0x1000, CRC(bcdd1beb) SHA1(8e47e8c2c4d6117d174cdac150392042d3e0a881) )
    ROM_LOAD( "pacman.6j",    0x3000, 0x1000, CRC(817d94e3) SHA1(d4a70d56bb01d27d094d73db8667ffb00ca69cb9) )

    ROM_REGION( 0x2000, "gfx1", 0 )
    ROM_LOAD( "pacman.5e",    0x0000, 0x1000, CRC(0c944964) SHA1(06ef227747a440831c9a3a613b76693d52a2f0a9) )
    ROM_LOAD( "pacman.5f",    0x1000, 0x1000, CRC(958fedf9) SHA1(4a937ac02216ea8c96477d4a15522070507fb599) )

    ROM_REGION( 0x0120, "proms", 0 )
    ROM_LOAD( "82s123.7f",    0x0000, 0x0020, CRC(2fc650bd) SHA1(8d0268dee78e47c712202b0ec4f1f51109b1f2a5) )
    ROM_LOAD( "82s126.4a",    0x0020, 0x0100, CRC(3eb3a8e4) SHA1(19097b5f60d1030f8b82d9f1d3a241f93e5c75d6) )

    ROM_REGION( 0x0200, "namco", 0 )    /* sound PROMs */
    ROM_LOAD( "82s126.1m",    0x0000, 0x0100, CRC(a9cc86bf) SHA1(bbcec0570aeceb582ff8238a4bc8546a23430081) )
    ROM_LOAD( "82s126.3m",    0x0100, 0x0100, CRC(77245b66) SHA1(0c4d0bee858b97632411c440bea6948a74759746) )    /* timing - not used */

So I guess the core must be adapted to allow the extra files.

1 final thing, when loading a non working ini file, the board goes into failsafe mode, but the keyboard is not working anymore then.

See attached picture. I have to powercycle the board to get it working again.

Post's attachments

IMAG0218.jpg 1.08 mb, file has never been downloaded. 

You don't have the permssions to download the attachments of this post.

Re: Pac-Man Hardware (multiple games)

Yes that's correct, it just halts. I suppose I could restart the software when the SD card has been removed and then re-inserted?

Thanks for the memory map, I see what needs to be done.
I'll steal the decoder back as well!

Re: Pac-Man Hardware (multiple games)

I need to move the main program ROMs to DRAM first to fit Pengo in. This is actually quite a good idea to demonstrate how the DRAM interface works.

I'll do this first, then the few other changes required for Pengo (larger colour table and sprite banking).

Re: Pac-Man Hardware (multiple games)

Ok, I've modified Pacman to move the program ROMs to DRAM. Now I can extend and see if Pengo will run.

Re: Pac-Man Hardware (multiple games)

I've checked in the Pengo variant of Pacman, and the ini file. All changes are made, and Pacman still runs.
I need to add the ROM decrypt next....

Re: Pac-Man Hardware (multiple games)

It seems ini files are not mirrored to the public server?

Re: Pac-Man Hardware (multiple games)

mm I'll check

Re: Pac-Man Hardware (multiple games)

I've been pulling out what remains of my hair trying to figure out why Pengo doesn't run.
Seeing as the other implementations out there are based on mine, it's a bit frustrating!

I've just cracked it - Pengo has additional SRAM.
The other implementation merged the three SRAMs in Pacman into two block RAMs - and in the process filled the missing space, so it may be chance it worked for them.

Anyhow, will tidy up now and check in.

Re: Pac-Man Hardware (multiple games)

ok, it's on the public SVN. Remember to update the ini files as well.
Look in the ini file for the ROMs you need.
I'm not sure I have all the dip switch options correct for Pengo - please feel free to test and edit the ini file.
Look in pacman_top.vhd for the mapping of the config word to inputs.

The two dip switches are bits 31..24 and bits 7..0

  cfg.dipsw2           <= i_cfg_dynamic(31 downto 24);
  cfg.dipsw1           <= i_cfg_dynamic( 7 downto  0);


item   = "PCB Option 1",    0x00000080,dynamic
option = "on",              0x00000080
option = "off",             0x00000000,default

is setting dipswitch1 bit 7. Note that the bit set is "on", it's inverted in the core as the inputs are active low.

I'll do the other Pacman games shortly (TNT and LizWiz need minor updates, MsPacman needs the trap logic)

Re: Pac-Man Hardware (multiple games)

I've added Mr TNT support now, and added the ini file.
Note you can use the ps/2 keyboard to emulate the joystick, cursor keys and space is the fire button.
Keypad enter is credit, and keypad 1/2 are start 1/2

Re: Pac-Man Hardware (multiple games)

Do not forget to PacManicMinerMan, this is good fun ... … an-release

The Manic Miner on the PacMan hardware

Re: Pac-Man Hardware (multiple games)

arrggh, just when I was about to go to bed.

Done - just created a new .ini file with the new ROMs - no new FPGA image required, the beauty of soft upload wink

It works, although I can't start it as the credit button isn't working. I have wired it to input(7) on Pacman and left coin1 and coin2 open, this may be wrong. I'll check the original manual!