Which Microcontroller Can Emulate a Vintage EPROM? The Raspberry Pi RP2040!
Experience three potential solutions firsthand in this short video journey.
While most projects have a single output or goal, they all have smaller steps that require problem-solving to achieve it. The element14 Presents YouTube channel explores one such step in their latest video. The episode titled "How hard could it be to replace a vintage EPROM with a microcontroller" explores three solutions to combining vintage and modern computer technology.
(Note: The author of this article and the presenter in the episode are the same person.)
James "Bald Engineer" Lewis explores what it would take to replace a vintage EPROM from an Apple IIe with a modern microcontroller in the inaugural segment. The Apple IIe's keyboard system includes the keyboard switch matrix, a dedicated microcontroller, and an EPROM. The microcontroller scans the matrix and lets the IIe's logic know when it decodes a keypress. The EPROM in between maps the keypress to an ASCII value.
The final project needs to interface a modern USB keyboard to the vintage computer's 8-bit bus. The problem is that the IIe logic only gives the EPROM, or its replacement, about 500 nanoseconds to respond. That limitation created the question: is that something a microcontroller interrupt can handle?
At first, it seemed like an interrupt service routine (ISR) on an Arduino Mega 2560 would work. However, the time it takes to respond to an ISR is on the order of microseconds. The blazing-fast 600 MHz Teensy 4.0 could respond faster but still took 200 nanoseconds to get into the ISR, which is almost half of the IIe's timing budget.
Fortunately, the Raspberry Pi's RP2040 has programmable IO (PIO) modules. These modules are state machines that run assembly-like instructions independent of the main CPUs. The PIO responded to the Apple IIe's request in about 60 nanoseconds. That time is almost 2X faster than the original EPROM!
Lewis also highlights another advantage of the PIO in the video. All of the assembly code development happened inside of a CircuitPython script. CircuitPython takes a string of the assembly language program, assembles it, and then configures the PIO!
Ultimately, the PIO-based solution worked as expected. It can put characters into the Apple IIe's main data bus just like the actual keyboard. However, this implementation did not fully emulate an EPROM because it did not decode the address bus. (Yet.) But Lewis is confident that it should be possible with the PIO and direct memory access (DMA.)
For more information about the episode, check out this post on the element14 Community. If you're interested in the larger ongoing project, there are over 60 hours of Livestream archives on the BaldEngineer Twitch channel.
Electronics enthusiast, Bald Engineer, and freelance content creator. AddOhms on YouTube. KN6FGY.