My PAL stimulator
If you’ve been following my blog, you’ll see that I’ve been reversing a Commodore Amiga SCSI HDD Expansion card called the Dataflyer. On that Dataflyer, there’s a PAL that handles address configuration (the latch), chip selects, and converting the 68000 signals to those the peripherals understand.
In order to reverse engineer the PAL equations so that I can create a new GAL that functions similarly, I often needed to try various input values, and see how the original behaved. And often, I needed to a SERIES of bus/memory access cycle transactions. That is, one input value, then another input value, then another, and so on. So I stimulate the input, and then record the output.
I think this is a perfect application for a microcontroller, and one of them that I have a particular fondness for is the Teensy. These things are powerful, small, with nice pin diagrams and OK support. The forums range from awesome to quiet, so your mileage may vary.
I wrote code in Arduino Scratch that essentially sits on the serial port and waits to receive a 12-bit input word in decimal. Then it asserts the value onto the input pins of the PAL, and reads the output pins, returning those via the serial port.
I wrote a small python script that reads a csv file full of input words, expected values, and then transmits the inputs, reads the value back from the Arduino scratch, and then writes it back to the row of the csv. I use python pandas for the csv handling, which is particularly nice, although a bit cryptic to use initially.
I contemplated sharing my code but it’s somewhat messy and there’s no real magic to it.
https://pythonhosted.org/pyserial/shortintro.html#opening-serial-ports
https://www.arduino.cc/reference/en/language/functions/communication/serial/