Here is a project I've been working on that has not one, but two Propeller's onboard! I call it "Retro II" (every project should have a name, right?). It's a homebrew 6502 computer that plays Apple II games. The computer also has two 15 pin game ports, two 9 pin Apple II joystick ports, cassette in/out, built in speaker/volume/headphone out, vga, ps/2, sd card, and 8 peripheral slots.
Here is a short overview video of the finished computer: https://youtu.be/tcg8ul2Vst0
I've always had a love for the Apple II. It was the computer we had in our computer labs growing up. My mom was a teacher and somehow she was able to purchase one for our family. I still have a lot of fond memories of that computer, and I really wanted to see if I could recreate it in some way now with more modern hardware.
Some basic design decisions for the project. I wanted it to feel like an 80's era computer, with the big beefy through hole components and the big green PCB. I wanted to have it be a learning tool as well. I didn't want to stick everything in an FPGA, because I wanted my kids to be able to see the individual pieces that make the computer work. It also needed to be made of all off the shelf parts that you can buy today and are still manufactured. It needed to interface with modern keyboards and monitors and storage.
I started with the original Apple II schematic and quickly realized that there were going to be a few hurdles. There were several components like the keyboard encoder, DRAM, and 558 timer that were no longer manufactured. In looking at the timing of the system, everything was really tightly coupled and complicated. The timing for the video signals, keyboard multiplexer, and RAM access were all woven together in a beautiful tapestry by Steve Wozniak. But I wanted to see if I could simplify it a bit. This is where the Propeller got involved!
I initially just used a 1MHz oscillator to drive the clock, later on I wired up one of the Propeller's to generate the clock signal. This enabled me to do some neat things like overclocking/underclocking the computer. I can also stop the clock to pause program execution if I want to debug something. I took out the 24 DRAM chips and replaced them with a single dual port static RAM. I also consolidated the six ROM chips into a single ROM. By using dual port RAM, I was able to hook up the other Propeller to read from the video portions of RAM and draw out the VGA signals without interfering at all with the rest of the computer. After decoupling the timing a bit, there were a few small changes to the address decoding in order to ensure it was reading/writing to RAM at the correct times. In addition to handling the timing for the system clock, Propeller 1 also reads the soft switches and relays that data to the video processing Propeller. It also handles reading from the SD Card, parsing the DOS images, and handling the PS/2 keyboard. The two Propeller's talk to each other via an I2C bus.
The video processing Propeller took quite a bit of time to optimize at least for the hires mode. To get things running initially I created a very simple memory monitor in Spin in order to test out reading/writing to memory. The easiest video mode was of course just the full text mode. Initially I used Mike Christle's VGA display driver with the C64 font. After getting text mode working reasonably well, I started to convert the driver incrementally so that it would work with the original Apple II 7x8 fonts. To do this I used a lookup table that mapped between the 8x8 and 7x8 graphic columns.
The hires video mode probably took the greatest amount of time to really optimize. I made use of the book "Apple II Computer Graphics" by Ken Williams, and Bob and Lisa Kernaghan to understand how the video memory was laid out. The hires memory map for the Apple II divided the screen into three main sections. Each section has 8 rows. Each row was divided into 8x8 boxes. So each of these boxes is made up of 8 bytes. But then the bits are displayed in reverse order and the left most bit isn't displayed at all. So that was fun to figure out. I initially had hires mode programmed in Spin to just get the picture working. Not surprisingly though, Spin was pretty slow at drawing each hires frame (about one frame every 5 seconds!). I slowly started optimizing The Spin code, to where it was drawing 1 frame a second. Then I converted the Spin into PASM, which eventually I was able to achieve 50 frames per second! I figured that I could further optimize the frame rate if I divided up each of the three screen sections and had a separate cog processing each section. But I was pretty happy overall with the finished frame rate. Right now the computer draws the picture in one of seven monochrome colors. The nostalgia for me was for the green display, so that's what I set up initially. I may try to implement the full color graphics eventually. It's a little more complicated with the way the Apple II displays color pixels, and I'm not quite sure that the Propeller would support all the colors with the desired screen resolution.
There are still a few things to nail down with the current system. In order to support some of the peripheral cards I would like to use, I need to wire up the Propeller to generate the Phase 1 clock, which is just the inverted main clock, and the Q3 signal, which seems to be a 2MHz clock. I also discovered that my game port controller buttons need some rewiring to get them to work properly. My +-12V switching supply also needs to be fiddled with some more. It works, but it has a really high current draw initially before the output caps are charged. Other than that, there's four bodge wires on the bottom of the pcb, nothing too major, but something to fix with the next board revision.
I'd really like to thank the Parallax community for giving me the tools needed to get this project working. I've listed a few of the modules I'm using below, along with their author:
I2C Slave/Master module - Chris Gadd
fsrw - Tomas Rokicki and Jonathan Dummer
PS/2 Keyboard Driver - Chip Gracey
Button.spin v 1.00 - Kyle Crane
**Update 9/15/2020** I have color mode working!