Five years ago, James asked: "Can the Mega-II operate as a computer?" With countless hours of debugging, the help of many fantastic people, and every obscure information resource he could find, James has the answer.
Watch the Video:
Downloads and Links | Discussion
This video follows up with another element14 Presents project video. Previously, James took the Mega-II chip out of an Apple IIGS and successfully booted it with custom PCBs. In the project's next phase, he aimed to determine the Mega-II's full functionality.
As a quick review, the Mega-II is an application-specific integrated circuit (ASIC) Apple designed in the late 1980s. It reduced the extremely popular Apple IIe's 5 custom chipset to a single chip. At least, that is what many people have said. Regardless, the Apple IIe featured some of Apple's first custom chips when it reduced the Apple II+ down from about 80 off-the-shelf 7400-series logic chips.
In his last project video, James got the Mega-II to a point where it would boot to an Applesoft prompt . (the BASIC interpreter built into the IIe's ROM.). However, he could not type anything, so the "computer" wasn't much use. Debugging it was a nightmare due to the massive amount of wiring involved. He decided to take another approach.
Rev 2
Stepping back and thinking about the project, James realized he needed more flexibility in testing each Apple II circuit block. Instead of making a large monolithic circuit board, he designed rev2 around a backplane. This modular approach had two significant benefits. First, it lowered the cost of spinning new circuit boards. And second, eliminating the colossal wire mess made debugging significantly easier.
James says his favorite aspect of this design was how the Digilent Digital Discovery connected directly to the backplane! With deep capture memory, these high-speed logic analyzers can simultaneously sample up to 40 signals: 24 at high speed and 16 at a lower rate. They are part of the Discovery series of tools from Digilent. You might remember from the first part that James had written a decoder for the Waveforms software to help decode Apple II memory accesses from Digilent. (In the first part, James wrote a decoder for the Waveforms software to help decode Apple II memory accesses.)
Keyboard
One objective James had for this project was to use a USB keyboard. Why do so many retro projects use PS/2 anyway? Since the RP2040 found on the Pi Pico could support being a USB Host AND has programmable IO pins, it is a perfect option for the keyboard interface.
The programmable IO is critical because the Mega-II's data bus must be driven within 150 nanoseconds of a specific memory operation. The RP2040's PIO can respond fast enough. It took all 32 instructions of one PIO state machine to implement the logic necessary to respond to those Apple II I/O calls.
Slotmaker
The secret to getting the keyboard to work was another ASIC in the IIGS called Slotmaker. Oddly, Apple's engineers put one of the KSEL (keyboard control) lines on this chip for some reason. That said, Slotmaker's primary function is managing slots in the IIGS.
Slotmaker's primary function is selecting between the slots or internal devices in an IIGS. For example, the disk controller is in virtual slot 6. Slotmaker allows the user to use the internal device or change to the slot.
Another objective of the Mega IIe project was to incorporate disk control into the final board. Therefore, the Slotmaker chip was required for two reasons: the KSEL0 keyboard signal and to talk to the disk controller chip.
Disk Drives
In 1978, Steve Wozniak took a completely different approach to disk drive control from other personal computer vendors. He created a hardware-reduced controller that implemented a software-controlled state machine. The result was the Disk ][ Controller Card.
Later in the 1980s, Wendall Sanders took that design and created a custom ASIC called the Integrated Woz Machine or IWM.
James incorporated the IWM into the Mega-II design but encountered a problem when looking for the "boot code." It turns out he had to patch his ROM to include it!
Video
Now that saving and loading programs was possible, James wanted to improve the video signal.
One of the unique features of the Mega-II chip is how it outputs video information. There is a signal called SERVID. This signal provides a line of luma and chroma information.
On Mega-II, the signals RGB8, RGB4, RGB2, and RGB1 contain the same data as SERVID but in a de-multiplexed format. James decided to use another RP2040 to capture those signals (at 14 MHz) to capture each "pixel" of color information.
James focused his efforts on the input side with another PIO program to capture the RGBx data and used a library called PicoVGA to handle the output side. The result was super clean output and the end of the project's second phase.
Rev 3
The project's third phase is the final goal: a single PCB incorporating all of Rev 2's features. The design task was arduous, but James worked through all the necessary issues to make the chips and connectors fit.
And, of course, he added some blinky LEDs, because LEDs make every project better.
James encountered vastly different experiences between Rev 2 and Rev 3. With Rev 2, James ran into a few problems, but they were all relatively easy to solve or occurred because of misconceptions about Mega II. With Rev 3, however, the issue list was completely different. You won't believe how much trouble he ran into!
Enclosure
To honor this design, James modified a model of the Apple IIe he found on Grabcad. That model only contained faces, so it was not 3D printable as-is. After creating a printable model, James got to sanding, painting, and gluing, as well as adding mounting holes, and making an appropriate back panel.
With the help of some custom decals, the result is an adorably sized Apple IIe computer. On the front, it has a USB Keyboard and Earphone Jack. The back has Power, VGA, Floppy Drive, and Gameport (Joystick) ports.
The Future
In the future, James hopes to do a few more things with the Mega IIe. First, he is still trying to get Smartport support to work. This feature would enable hard drive support through the IWM. Of course, he wants to correct some mistakes made on the Rev 3 logic board. Finally, he'd like to re-design the enclosure to be multiple pieces. But what do you think about the design, and what would you add if you built a computer based on the Mega-II chip?
Download and Links:
- World’s First Single-Chip Apple II Boots! -- Episode 532
- Emulate an EPROM - How Hard Could it Be? -- Episode 517
- Mega IIe Design Files (Github): https://github.com/baldengineer/mega-iie
- Apple IIGS Schematic in Bit Preserve: https://github.com/baldengineer/bit-preserve/tree/main/Apple/Apple%20IIGS/IIgs
- Jon Relay's Apple II I/O Memory (Soft Switches)
- David Schmidt's Tiger Learning Computer documentation project https://github.com/david-schmidt/tlc-apple2
- PicoVGA Library https://github.com/Panda381/PicoVGA
- ProDOS 8 (Active Development)
- Identify ][ (Apple II Diagnostic Program)
- DOLRES Library and Demos (Spinning Apple Logo)
- Apple Iie Grabcad Model (faces only!)
Bill of Material:
Product Name | Quantity | Buy Kit |
---|---|---|
RP2040, 32-bit dual-core Arm Cortex-M0+ | 1 | Buy Now |
Pi Pico (RP2040) | 1 | Buy Now |
Digital Discovery | 1 | Buy Now |
74HC245, octal buffer | 1 | Buy Now |
74HC573, transparent latch | 1 | Buy Now |
Surface Mount Dip Switches (8 position) | 1 | Buy Now |
Grey PLA | 1 | Buy Now |
Additional Parts:
Mega-II, Slotmaker, and IWM ASIC from Apple IIGS |
Patience, a metric ton of it |