Home Creators Posts Import Register Favorites Logout

Content

The Lucas Deeco terminal I'm working on has a PAL between the CPU and ROM address lines designed to scramble the contents of the ROM. This was likely installed to prevent cloning of the system -- but it also has the effect of making it impossible to edit the ROMs or emulate the system.

I dumped the ROMs and created a Github Repo with my notes on what I found. If anyone wants to take a crack and figuring out the scrambling "keys," that would be a fun thing to tackle!

I gave it a try the other night using Google Gemini but without knowing being well versed in x86 assembly, all I could do is decode some of the english language strings in the ROM. The video I posted (Part 1 in the series) shows other strings you will likely find in the ROM code.Oh side note, this is a registered PAL. That means depending on implementation and programming, may not be possible to dump in a conventional way using an external dumper. One surefire way to decode this would be to connect up a logic analyzer with at least 18 inputs to every I/O line on the PAL and take note of it in circuit. (I don't have such a logic analyzer.) Watch the system boot up and observe what it's doing. A project I've been meaning to build up is this: https://github.com/rpocc/PALDump

This might help in decoding this chip if I removed it from the board, although again if it's registered then this likely will not work.

See here for the ROMs and notes:

https://github.com/misterblack1/lucasdeeco/tree/main

https://archive.org/details/lucas-deeco-seal-touchThis problem has been solved by patron Peter Tirsek!!"After a little trial and error, it looks like the "key" is pretty straight forward. I ended up not numbering them the same way you did, but the structure is probably pretty obvious: ``` # Output bit number #0, 1, 2,3, 4,5, 6, 7 [0, 4, 6,7, 1,2, 3, 5], # <-- Input bit number [0, 4, 7,6, 1,2, 3, 5], [0, 4, 6,7, 2,1, 3, 5], [0, 4, 7,6, 2,1, 3, 5], [0, 3, 6,7, 1,2, 4, 5], [0, 3, 7,6, 1,2, 4, 5], [0, 3, 6,7, 2,1, 4, 5], [0, 3, 7,6, 2,1, 4, 5], ``` (Here's hoping that Patreon supports markdown :) ). As you said yourself, the "key" switches every 32 bytes and cycles after 8 keys or 256 bytes total. At least this arrangement gives me something where all strings appear readable, and the disassembled code looks plausible. I'll send an e-mail with the descrambled ROM."The Github Repo is updated with the descrambled ROM. I also turned Peter's C code into a web version for anyone to easily try: https://htmlpreview.github.io/?https://raw.githubusercontent.com/misterblack1/lucasdeeco/refs/heads/main/Lucas%20Deeco%20ROM%20(de)scrambler.html

Thanks everyone who worked on this!

Files

Comments

Mr Bill

I built up my own decoder using an arduino 2560 mega (for all the I/O) but you'll need to look at the rest of the circuit to figure out inputs and outputs. I just program a loop (2^inputs) output the loop value, read all the inputs and dump a formatted table via the serial port and capture with terminal emulator and import into a spread sheet. edit: I just looked at the link to the github .... I guess, disregard my post.

Jon Guidry

Region 1: 0x0000–0x3FFF — Fixed Segment Order Each 256-byte block is split into 8 × 16-byte segments The segments are reordered using a fixed key: From order: [0, 1, 2, 3, 4, 5, 6, 7] To order: [0, 2, 3, 4, 5, 1, 6, 7] Working on the next - 0x4000-0xFFFF is using 256 byte segments still, and there's 120 of them, apparently, each that have their own order.

Jon Guidry

@Adrian - sent you a toolkiit via e-mail with what I have so far so you can put it on GitHub

David Giller

That's the general direction I've gone too, but I noticed that bytes 0-31 and bytes 31-64 (at least as ordered by decrypted data) are slightly different. I'm using byte orders and address lines relative to the CPU's address space (not the ROM's scrambled address space and not the ROM address lines, which are shifted by one). The bit order I found for the first 32 bytes is ( 0 4 5 6 1 7 2 3 ) and the second is ( 0 4 5 6 1 7 3 2 ). I'm sure the first 0x4000 bytes don't use the same key. I'm speculating that there are 8 keys, and every 256 byte block uses the same 8 keys, so each group of 32 bytes has a key (meaning bit scramble order) and they repeat every 256 bytes or 8 blocks of 32.

indycas

I'd cheat and and use an ATMEGA to just record the address and data lines at the CPU - you should be able to get most

Adrian's Digital Basement

I took a look at the files - I'm a bit confused, is the descramble file actually descrambled? I don't see any human readable strings, even using the python script. The code for the 8086 CPU core inside the machine definitely wouldn't be using 16 bit characters, just good old 8-bit ASCII.

Peter Tirsek

After a little trial and error, it looks like the "key" is pretty straight forward. I ended up not numbering them the same way you did, but the structure is probably pretty obvious: ``` # Output bit number #0, 1, 2,3, 4,5, 6, 7 [0, 4, 6,7, 1,2, 3, 5], # <-- Input bit number [0, 4, 7,6, 1,2, 3, 5], [0, 4, 6,7, 2,1, 3, 5], [0, 4, 7,6, 2,1, 3, 5], [0, 3, 6,7, 1,2, 4, 5], [0, 3, 7,6, 1,2, 4, 5], [0, 3, 6,7, 2,1, 4, 5], [0, 3, 7,6, 2,1, 4, 5], ``` (Here's hoping that Patreon supports markdown :) ). As you said yourself, the "key" switches every 32 bytes and cycles after 8 keys or 256 bytes total. At least this arrangement gives me something where all strings appear readable, and the disassembled code looks plausible. I'll send an e-mail with the descrambled ROM.

Adrian's Digital Basement

Very nice!! Now do you think it's possible to make something that can descramble and reacramble a ROM, so we can make changes to it?

Jon (0ryn) Westgate

I wondered if built a static ram chip with a battery to keep it live, hooked it up to the data lines on the ROM but hooked the address lines to the CPU side of the pal chip. If you enabled the write on the SRAM and ran up the card long enough for it to initialize. There aught to be most of the decoded ROM data written to that SRAM. Obviously you'd need to tie the chip enable of the SRAM to the chip enable of the ROM and probably tie the write enable of the SRAM to the same. That way you could read the SRAM in an EPROM reader.

Peter Tirsek

Of course :) ... My prototype code wasn't quite ready for public viewing, but I'll get it cleaned up and add the reverse step to it as well.

Damian Powell

I’m looking forward to the video on this one!

Thomas Jager

Happy to see that someone else managed to solve it! I gave it a shot last night, but got too into trying to brute-force all combinations (with heuristics like counting the length of strings above a certain length), instead of just trying things.

Jon Guidry

Nice job, Peter! I was close - I was getting gibberish in the first 16K that looked like words. I figured it couldn't be too complex with the PAL. If we could get the DuPAL to decrypt the PAL, it could likely be automated (Adrian, have you ever tried the DuPAL before? I've successfully used it on many PALs, but it's like a six step process. I'm using their older revision, but the new revision is out - I haven't looked at the new rev yet.)

Peter Tirsek

Thanks Jon! My "trial and error" was somewhat brute force, I took a few 32-byte chunks that looked like they were full of text, ran them through all 8! (8 factorial, approximately 40K) possible bit permutations and looked for output that made sense. After the first couple started to fall in place, it was clear that there's a pattern to it. I don't know how PALs are designed or programmed, but from the mapping tables it's clear that the high 3 bits (of the lower 8), trigger whether some of the other bits swap places in the mapping, so A5 must trigger whether A2/3 go to A6/7 or 7/6, A6 controls A4/5 to A1/2 or 2/1, and A7 controls A1+A6 to A3/4 or 4/3 — or backwards depending on how you look at it I guess. I tried drawing it out as a logic circuit, but I didn't really get anywhere with that. I should probably stick to software. ;-)

Adrian's Digital Basement

Heh all that matters is we can trivially go between scrambled and unscrambled now. Would be interesting to dramatically change the functionality of this thing...... Future project I guess :-)

Mr Bill

Another option would be to program a different GAL to use a non-scrambled EPROM to make changes to.

Mark Wilson

this looks like a good puzzle - looking forward

Mark Krueger

This is probably the coolest conversation I have ever witnessed on Patreon.

Peter Kooiman

The boolean equations turn out to be A0_EE = (A3 & ~A5) | (A4 & iA5) A1_EE = (A3 & A5) | (A4 & ~A5) A2_EE = (A0 & A6) | (A5 & ~A6) A3_EE = (A0 & ~A6) | (A5 & A6) A4_EE = A6 A5_EE = (A1 & ~A4) | (A2 & A4) A6_EE = (A1 & A4) | (A2 & ~A4) For each output address line, they select one input line or another depending on the state of a third line. Looking at A0, it becomes A3 if A5 = 0, A4 if A5 =1.

Peter Tirsek

That makes total sense of course, thanks for clarifying.