What's new
Bumping this old thread because I've been playing around with these a bit and have some questions.

I've been using WinCUPL to play around with making my own GALs, it's not to difficult to use. Is that what everyone else uses or is there a better alternative out there?

Also I was wondering if there is a way to de-compile .jed files into something more human readable, or even just view the jed file with some kind of context mapping? it'd be great if I could see the logic of existing devices so I can make some adjustment and reprogram the GALs.
 
I'm not aware of an application better than WinCUPL, compiling equations is only so complicated.

You can decompile .jed files using the 'jedutil.exe' that comes with MAME to dump logic equations:

jedutil -view <source.jed> <device>

Use this command to view device list:

jedutil -viewlist
 
Bumping this old thread because I've been playing around with these a bit and have some questions.

I've been using WinCUPL to play around with making my own GALs, it's not to difficult to use. Is that what everyone else uses or is there a better alternative out there?

Also I was wondering if there is a way to de-compile .jed files into something more human readable, or even just view the jed file with some kind of context mapping? it'd be great if I could see the logic of existing devices so I can make some adjustment and reprogram the GALs.
I've dumped, reversed or handcrafted dozens of PALs/GALs and I do use WinCUPL (although really buggy in some situations).

Great minds think alike here's a fresh article on a PLS153 device converted to a GAL chip:

http://arcadefixer.blogspot.com/2019/01/sega-315-5298-gal22v10-alternative.html

Yesterday I've also finished reversing the Altera MCU found on S24 romboards :D which means I can now design my own romboard or revive games with a missing/faulty security chip.

Regarding other projects I've worked on, when PALs are used as simple mappers I just deduct equations (GAL chips for M72 multi kit are good examples, CPS1 graphic PALs are good to exercise too).

And as @brizzo said jedutil is a very powerful tool.
 
You can decompile .jed files using the 'jedutil.exe' that comes with MAME to dump logic equations
Excellent! I'll check out, thanks.


I've dumped, reversed or handcrafted dozens of PALs/GALs

...
when PALs are used as simple mappers I just deduct equations
What's your process for doing this?

I started designing a little PCB with LEDs on the outputs and dip switches on the inputs so that I could set different input states and view the output but quickly determined that it could get very complicated if I wanted to use for more than one device and would be very laborious to test every input combination manually. surely There's a better method.

My next though was to designing a PCB to plug into a Raspberry Pi or Arduino, that way I could configure the chip layout in software and it could run through every combination quickly. The challenge then comes from analyzing the output and converting to a jed... but I didn't want to re-invent the wheel if someone else has already gone down this road.
 
What's your process for doing this?
Ok let me give you a simplified example of what I did for the M72 PAL found on the top board (maps ROM/RAM):
1) I probed the chip to determine which pins are inputs and which are outputs (no bidirectional on that one)
2) This gave me something that made sense: address lines on one side, multiplexed chip enable lines on the other side (when I say side it doesn't mean left/right but more input side/output side). Only higher address lines are connected to the PAL (logical since you want to access the whole region).
3) Looking in MAME sources I learned what was the actual memory map used by M72 (varies from game to game).

MAME said:
#define M72_CPU1_MEMORY(NAME,ROMSIZE,WORKRAM) \
static ADDRESS_MAP_START( NAME##_map, AS_PROGRAM, 16 , m72_state ) \
AM_RANGE(0x00000, ROMSIZE-1) AM_ROM \
AM_RANGE(WORKRAM, WORKRAM+0x3fff) AM_RAM /* work RAM */ \
AM_RANGE(0xc0000, 0xc03ff) AM_RAM AM_SHARE("spriteram") \
AM_RANGE(0xc8000, 0xc8bff) AM_READWRITE(palette1_r, palette1_w) AM_SHARE("paletteram") \
AM_RANGE(0xcc000, 0xccbff) AM_READWRITE(palette2_r, palette2_w) AM_SHARE("paletteram2") \
AM_RANGE(0xd0000, 0xd3fff) AM_RAM_WRITE(videoram1_w) AM_SHARE("videoram1") \
AM_RANGE(0xd8000, 0xdbfff) AM_RAM_WRITE(videoram2_w) AM_SHARE("videoram2") \
AM_RANGE(0xe0000, 0xeffff) AM_READWRITE(soundram_r, soundram_w) \
AM_RANGE(0xffff0, 0xfffff) AM_ROM \
ADDRESS_MAP_END

/* ROMSIZE WORKRAM */
M72_CPU1_MEMORY( m72, 0x80000, 0xa0000 )
M72_CPU1_MEMORY( rtype, 0x40000, 0x40000 )
M72_CPU1_MEMORY( xmultiplm72, 0x80000, 0x80000 )
M72_CPU1_MEMORY( dbreedm72, 0x80000, 0x90000 )
4) My game was Legend Of Hero Tonma, using M72 standard mapping. If you look at work RAM: it starts @ 0xa0000 and has a length of 0x4000:
Work RAM must be enabled from 0xa0000 to 0xa3fff.
0xa0000 = 1010 0000 (0000 0000 0000) = a19 & !a18 & a17 & !a16 & !a15 & !a14 & !a13 & !a12
0xa3fff = 1010 0011 (1111 1111 1111) = a19 & !a18 & a17 & !a16 & !a15 & !a14 & a13 & a12
Which gives the following equation (active low): !ce_wr = a19 & !a18 & a17 & !a16 & !a15 & !a14

Note: sometimes some terms can be dropped (lower address lines), extending the region size, if there's no conflict with any other device.
 
Last edited by a moderator:
That is EXACTLY the kind of example I was looking for for the board I'm working on. Thank you!
 
Also worth a mention the equation syntax output from jedutil.exe is different from the syntax used by WinCUPL, so watch out for that :)
 
Bumping this thread as I'm looking into reading/burning PAL/GALs.

I've seen people interested in cheap ways to read and write to those devices, so I'll write a bit about what I've been doing.

I'm following this guide to build my own programmer. Mind you, I'm doing this without any kind of pull-up resistors because I'll be using Lattice GAL16V8D which, as per datasheet, have active pull-ups on all the pins.

This is the cheapest, riskiest way to work with GALs, everything is directly connected and there are no buffers. If things go wrong, go REALLY wrong.
I've revived a very old thin client, a Fujitsu Futro S200 which has a parallel port and I've put Windows 98SE on it as we're going to need an operating system with direct access to the hardware resources (from Windows NT 4.0 onwards, there's the hardware abstraction layer which prevents direct control).

As I don't have a laboratory/bench PSU, I had to create something myself for the both the Vcc and programming voltage.

Vcc is the classic 5V, I'm going to get this from the computer's USB port. I've measured it with a multimeter and it's a nice 5,02V (datasheet says anything from 4,75 to 5,25V is acceptable).
Programming voltage is another story: we need it to start at 12V which will enable us to read the GAL but then it may need to go as high as 16V to program it.
For this, I've grabbed an old Sony Vaio notebook PSU which outputs 16,5V and I've used a potentiometer as a voltage divider so I can change the output voltage to what will be required.

Right now I'm waiting for the GALs to arrive from China.
Meanwhile, this is the monstrosity I've built:

F0dobD5.jpg


Note that there's an error as I forgot to connect the USB's ground. I'll fix it this later.
 
Minimum effort GAL programmingThis document describes how to program the GAL chips 16V8/A/B/C/D/Z/ZD, 18V10/B, 20V8/A/B/Z, 20RA10/B, 20XV10/B, 22V10/B/C/Z, 26CV12/B, 6001/B, and 6002B from Lattice, National Semiconductors and STMicrosystems with minimal effort.
You needIC socket matching GAL
some 4k7 resistors 0.25W
100nF ceramic capacitor
SubD 25 pin male connector
some 4" short patch cables
5V/250mA and adjustable 8.5-16.5V/20mA laboratory power supply
ProgrammingInsert the GAL into the socket. Connect GND and VCC to the +5V output of a laboratory power supply. Connect GND and EDIT to an output of the power supply adjusted to +12V.
Launch the GALBlast program and select the parallel printer port used. Load the JEDEC file, the required GAL type should be automatically selected. Plug the SubD25 connector into the printer port, and issue the 'Write GAL' command. The PES of the GAL is read out and the required programming voltage will be displayed. Adjust the power supply to the required programming voltage (without overshoot, or disconnect first the SubD25, than the programming voltage, while adjusting) and continue with 'Write GAL'. Remove the SubD25 plug, turn off the programming voltage, turn off the power supply and remove the GAL from the socket.
Not my definition of "minimal effort", and not talking about how risky this method is... And the fact you need a parallel port. And an external power supply...
Nah just grab some cheap programmer than can do PALs/GALs.
 
TL866 can do GAL16V8/20V8/22V10 and ATF16V8
 
Yeah, but I had all the components at hand, it took me not more than an hour to build this and another hour to set the PC up.

Of course you can buy a TL866 for 35€ or, maybe even better, buy the GALs already programmed from BuyICnow, but I prefer to have means to program the GAL myself and the DIY way is always very satisfying :D

I'll probably add a small LED Voltmeter so I don't have to use my multimeter to check the voltage of the external PSU.

By the way, it is called "minimal effort" because compared to the full blown GALBlast it uses very few components and it's very barebone.
The full version has buffers, pull-up resistors and adjusts the voltage by itself, but it's way more work and components which doesn't make it worth it, IMHO. With the price of the components needed alone you'd probably get a TL866.
 
the DIY way is always very satisfying :D
I clearly understand that, it's the key factor.
But still, 35€ for a TL866 (even so I don't like this programmer for EPROMs) is worth it to me vs ~$15 in parts + 2h of my time + spare computer with parallel port + external PSU + risk of frying something.
 
I can respect DIYing things but I've got SO many projects that if there's a cheap solution that exists my time is better "spent" working on other projects that don't have a solution already available.
 
Yeah, I agree. I did this only because I already had all the parts ready at home, so I didn't spend a cent. I just spent some time to hook it all up and that was it, but in the end it's ok, I've found a use for a very old PC which otherwise would still be sitting on a shelf collecting dust.

Last update:

EuloNnU.jpg


I've cleaned it up a bit, glued the pot to the connector, shortened the USB cable and added a voltmeter to keep track of the Vpp. The voltmeter is the only thing I've bought for safety and convenience reasons and costed me 3€.

All in all I'm very satisfied with how it turned out, I'll report back when the GALs arrive and I start programming them.
 
I'm bumping this thread because I recently got a Charles MacDonald brute force dumper setup and I get some weird results sometimes.

index.php


dumped the IC23 PAL on Koshien and got these results: https://www.arcade-projects.com/forums/index.php?attachments/32856/

You can see in the pld file the equations for the first two output pins look like they just include every possible combination of input pins. if there is a more subtle equation in there it's difficult to find.

I dumped a few other PALs I had laying around and got similar results. Is this typical? if so what's a good way to weed through it to uncover a usable equation? If this is NOT typical am I doing something wrong?
 
You can see in the pld file the equations for the first two output pins look like they just include every possible combination of input pins. if there is a more subtle equation in there it's difficult to find.

I dumped a few other PALs I had laying around and got similar results. Is this typical? if so what's a good way to weed through it to uncover a usable equation? If this is NOT typical am I doing something wrong?
Maybe you won't like my answer but...
So dumping a purely combinational PLD by testing all possible inputs and reading resulting outputs is a 100% efficient method.

The generated file (which size depends of the numbers of I/Os the PLD has) can then be reduced using various methods. Not sure what tool (if any) you are using for that.

One easy to automate is the Karnaugh map reduction method:
https://en.wikipedia.org/wiki/Karnaugh_map

You could design you own piece of code for that. If you don't have any computer development software you can use VBA and any of the Office products. It's not going to be the fastest code ever but for the small files we're dealing with (few MB at most) it should be fine.
 
I see 3 pieces of software for optimisation mentioned at the bottom of the page.
yeah, I'm using WinCUPL as that's what everyone has recommended up to this point but I get the impression that it does "minimization" as part of the compile routine. Maybe I'm missing something but I don't see any options to minimize the equations directly. If I try to compile with the giant equations it tells me they're too large and can't be compiled.

I haven't tried ISPLever Classic, but Logic Friday seems to be no longer officially available and I haven't been able to track it down.
 
Back
Top