Porchy

I have no background in electronics or programming. Everything I have learnt over the years has been through self teaching and the help from other kind people willing to lend a hand.

May 132017
 

I recently bought myself a Hi-Lo ALL-11 programmer. This unit uses the original ALL-LAB base unit to connect to the outside world and also as a power supply.
Inside there are four PALCE16V8 chip. Three of them are already dumped and are out in the wild here
The one at U9 is registered and there cannot be recreated using our usual methods. I suspect this is also why it hasn’t been dumped before.
As the device is a PALCE there is a good chance I could reset the security fuse by power glitching. This was successful and I was able to read out the fusemap without any issues.
The registered part looks like a 4 bit binary counter and the equations show that too so I am going to mark this as ‘Assumed Working’ for now. I haven’t tested as I really wanted to get the programmer back together for some playing around with.

All the ALL-LAB PAL’s are now dumped and a copy has also been sent to the site above for inclusion.

 Posted by at 2:48 pm

How to use JEDutil

 Guides  Comments Off on How to use JEDutil
Apr 292017
 

JEDutil is a program included with MAME.
While MAME doesn’t directly use PAL dumps for emulation it does look to load them if they are available. As each programmer has its own output format when reading these chips (some are really different, other not so much) there arose the need to have a standard.
Read here for more information

What can JEDutil do?

It can convert a programmer usable .jed file to a MAME usable .bin file
It can convert from the MAME usable .bin file back to a programmer usable .jed file
It can be used to view the equations of any support .jed or.bin file

To see a list of supported devices you use the “-viewlist” argument

To view equations use the “-view” argument

These equations show exactly how the outputs works in relation to any given input and I believe is self explanatory to those who are looking.
Here is what the file im using for this example looks like in a text editor

You can clearly see it was created using WinCUPL.

Here is what a JEDutil created .jed file will look like opened up in a text editor

It looks very similar to the WinCUPL created file and most programmers i’ve encountered can load these without issue. One exception to that (and there are certainly others too) is the Needham EMP-20 which seems to use its own binary format that is not compatible with the MAME format.

Here is what a MAME usable binary file for a .jed will look like in a hex editor

There are clear difference between the binary and jedec files and should be easy to spot if you are not 100% sure what you have got.

Converting a MAME binary to a Jedec file
If you want to use the PAL dumps found in MAME on real hardware then you MUST convert them from their binary format back into .jed format.
You need to use the “-convert” argument

Note the filename extensions used here. The output file must be .jed (or .pla) or the conversion will fail and you will see this useful message

Converting a Jedec file to a MAME binary
To convert a .jed file into a MAME .bin file you simply use the same command but swap the filename extensions.

This will create the binary file. The original .jed file will remain untouched.

The only time I can really think of anyone needing to convert to a MAME binary is if you are submitting your dumps for inclusion to MAME
I’ve yet to ever find a use for the Berkeley PLA conversion so I haven’t covered it in here but if required it should be straight forward enough to work out.

Other Errors
Occasionally you might see some more cryptic error messages when using JEDutil. While there are things you can do to try and get around these they might also be a sign of a corrupt file or one of incorrect format.
The Jedec file format has two checksums both found at the end of the file.
The first is the fusemap checksum and the second is the transmission checksum

In the example used above the fusemap checksum is “3E71”. I believe the “C” part is always present.
The transmission checksum is “D5F0”

The fusemap checksum is the 16bit sum of all the 8bit fuse values.
The transmission checksum is a little more. Using the same example as before

The transmission checksum is a 16 bit sum of all the ASCII characters between (and including) the STX and ETX markers.

If the fusemap checksum if incorrect but the transmission checksum is correct then you will get this message

If the transmission checksum is incorrect then you will get this message

I believe you will get this message even if there is a fusemap checksum error as well.
You can disable the transmission checksum by changing it to “0000”.

In the past if I got stuck working with a strange .jed file I have loaded it into my programmers software and saved it back. This rewrites all the checksums to be correct. Your milage may vary!

There may be other errors, maybe not. I’ve not come across any other to really bother myself about.

 Posted by at 3:03 pm
Apr 232017
 


Its hard for me to believe that i’ve been maintaining this program since 2011.
I’ve added to this as I needed extra functionality and for the last 12 months or so its been untouched but for the last few weeks I’ve been rewriting some parts I wasn’t happy with and changing a few things around.
Its now got to the point where I think its pretty much complete (although i’ve said that before) so though it was about time I did a proper post on some of the things it does and how to use it.
I wont go into everything as I dont think I need to but let me know.

What does it do?
Back when I started this program I wanted a quick, easy and no fuss way of quickly interleaving, deinterleaving and byte swapping files. That’s exactly what it did but that’s all it did.
Take a look

What it does now:

  • Create a new files filled with recurring byte or word values
  • Analyse a file (8 bit or 16 bit) – check for stuck bits, upper and lower halfs matching, etc
  • Bit manipulation – simulate stuck bits in a file & swap bit order of address and/or data bus
  • Byte swap
  • Deinterleave
  • Invert the whole file
  • Reverse the file
  • Split the file in to smaller files
  • Swap the upper and lower half of the file
  • Concatenate up to 4 files at once
  • Interleave in 16 bit or 32 bit format
  • Compare 2 files – checks how many bytes match
  • Display CRC32, SHA1 and MD5 hash values

Creating a new file
Click the ‘Single File’ menu and select ‘Create a new file’
You should see this

You can fill the new file with a byte pattern or a word pattern.
To fill with a specified byte pattern you can enter something like this

This will fill each byte with a value of 0x55
To fill with a word pattern you will enter

This will fill the file with the word value 0x55AA

If the slot is empty you can also load a file by double clicking on the slot.
You can overwrite any loaded file by dragging and dropping a new file onto the slot.

Analysing a file
Analysing a file check for a few things.
First you will need to select from the menu whether the binary file you loaded is from an 8 bit or 16 bit source.
The output from the analysis will be displayed in the Log window.
In this example I have created a new file filled with 0x0

As you can see it has flagged up all the bits (8 bit) as being stuck LOW. This means that throughout the file non of the bits changed from logic state 0.
It also shows that the upper and lower half of the file are filled with 0x0. If the file (or half the file) was filled with 0xFF then this would be flagged instead.
Finally, we have flagged up that the upper half of the file is identical to the lower half of the file.

Viewing the file contents
There is a basic HEX viewer built in to the program. Just double click on any of the loaded slots to view it.

Checksums
There are 3 different checksums that the program can show you.
The default is CRC32 but by clicking on the “CRC32” box you can cycle between CRC32, SHA-1 and MD5.

Compare files
If any loaded file is the same as another file that is already loaded you will get an instant notification in the Log window that is matches

If however the files are not a match, its sometimes nice to see how much of the file actually does match. For example, if you have a a new revision ROM dump of a game you might want to see how much has actually changed. If its just 1 byte different then it could be bit rot or a region code change.

I think the rest of the functionality is self explanatory so wont go into it.
The program is in the software section now.
Please do let me know if you find this program useful, find any bugs or maybe want to see something added or changed (no guarantees though).

 Posted by at 2:21 pm

Flicky repair log #2

 PCB Repair Logs, Repair Logs  Comments Off on Flicky repair log #2
Apr 222017
 

Quick repair this one.
Game booted to a black screen, sometimes garbage on screen and could see/hear the watchdog doing its thing.
This board was running the encrypted version of the game with its custom Z80 CPU.
As the CPU is socketed I just plugged the Fluke straight in and ran the usual tests.
All the ROM’s passed but work the RAM failed

The schematics are the same as for Star Jacker and the RAM could easily be located

Tested the RAM out of circuit and sure enough my tester flagged up address pin A8 as being disconnected so it matched the Fluke’s output too.
I replaced the RAM and fire up the game

The sound and controls both work fine and my work here is done.

 Posted by at 3:26 pm

Popeye tech info

 Technical Info  Comments Off on Popeye tech info
Apr 072017
 

I’ve been working with a Popeye PCB recently and I wanted to figure out the hardware so I thought it would be good to document what I found.

The PCB uses some fairly simple obfuscation for the CPU address lines utilising what the schematics refer to as a PLA device. Further investigation revealed that the devices used on the address bus here are actually 74LS367 at locations 6F and 6H. I originally believed the IC at location 6E to be the same but in the decoding routine that MAME uses, the new address value returned after swapping the bits gets XOR’d by 0x3F.


Checking further I found this chip is actually a 74LS368 (inverting line driver). If you notice on the video PCB there is another chip with its markings removed at location 5U.

This is a 74LS04 inverter and is needed because the lower 6 address bits are inverted from the CPU by the 74LS368 at location 6E so we need to return them to their intended state. Inverting them again allows the video and background RAM to be addressed properly.
All these so called PLA’s are actually regular TTL with their markings etched off.

The data lines are also scrambled and can be easily followed from the schematics.
The code in the program EPROM’s is scrambled to accommodate the above methods.

There are 2 additional IC’s also marked as PLA’s attached to the outputs of 3 x 74LS161 counters at location 3E and 4E. These have been identified as a 74LS367 at location 4E and a 74LS368 at location 3E and are part of the DMA circuit.

NMI
The hardware doesn’t use any other interrupts, only the NMI.
The NMI vector is the same for all Z80 program and starts at address $66 in ROM.
It is triggered essentially by the /VBLANK signal and during this time all the on screen background and sprites are updated.

MAIN RAM
The main RAM for Popeye lies at address $8800 – $8FFF and is a TMM2016 located at 7H on the CPU PCB.
The main RAM doesn’t appear to invert the lower 6 bits of the address bus so the actual locations written to in RAM will be different to what the program actually expects however this is not an issue as all the accesses will give the correct data. In the event of fault finding though this could potentially cause confusion.
DMA accesses to this RAM are all correct.
Access to this RAM is controlled via a 74LS139 at location 8F.
The first demultiplexor of this IC is enabled when address bit A15 is HIGH (address $8000). Output Y0 connects to select input B of the second multiplexor and address bit A11 is connected to select input A. Output Y1 (pin 11) is connected to the /CS pin of the RAM.
In order for Y1 to be active A15 and A11 need to be HIGH (address $8800).

There are two pull-up resistors used on this RAM connected to AD10 and AD11. These are present for when DMA accesses are happening as it only uses 9 bits. Without these resistors AD10 and AD11 would be floating during these times.

BACKGROUND RAM
As we only write nibbles to the RAM section but need to preserve the nibble value we currently are not writing too there is a system in place to deal with that.

/CSBW is generated when we write to anywhere in address $C000 – $CFFF.
This signal clears the DMA access to background RAM and sets the 74LS157 chips to use the address bus instead of DMA.

When a write to the background RAM is initiated the 74LS174 at 8U gets clocked before the write enable for the RAM goes low. This latches the current RAM nibble not being written to, onto the outputs of 8U which lets the RAM get updated without losing data.
The delay for latching the RAM data before writing is achieved by a 74LS20 at 5D on the CPU board. One of these signals is the /WR but goes through a 74LS74 in order to create a delay of 1 clock cycle. This gives enough time to latches the RAM data before the write enable is active on the RAM itself.

SECURITY ALU
There is a security ALU that sits at address $E000 – $E001 in the memory map. It can be both read from and written to. MAME has functional behaviour for this emulated in the driver.
The various modes of the ALU are selected by an IC labelled as ‘Selected Decoder’. This is actually a 74LS139.

I wanted to implement this chip into one of the 28 pin CPLD modules I have. Being an amateur in HDL programming I wasn’t too sure whether the design could be implemented into an unclocked CPLD design so I asked my friend Charles MacDonald for some advice on Verilog.
He kindly sent me a draft code based on the MAME implementation. I have adapted this to reflect the real hardware and it is now implemented and seems to be working. The programming file can be found in the download section if anyone ever feels the need to use it. I would still like to get hold of an original chip to study as although the code for this works with the titles that use it, all the behaviours of the chip are not fully documented that I know of.

Without this chip present Popeye will reset when starting a game. There may be other issues as well but I cannot pinpoint them.
There is an unprotected version of Popeye available in MAME which does away with the requirement for this security chip so there isn’t much need to use a reproduction of this chip.

 Posted by at 8:01 pm