FPGApple revisited
In a couple of years since I did the original FPGApple
, other people created FPGA based replicas of my first love
among computers - the Apple 2.
Among them Stephen Edwards
of the Columbia University who
claims to have gotten some inspiration from my project. His version is
open source (in VHDL) and is far better structured than mine. Not
surprising - the intent was to use it as a teaching aid.
http://www1.cs.columbia.edu/~sedwards/apple2fpga/
At the same time I was asked to look into porting
FPGApple to a different platform - C-One.This
is a rather interesting platform designed specifically to implement
re-configurable retro-computers. The heart is an Altera FPGA that is
configured on-the-fly by a second FPGA from a bitstream residing on a
CDROM or a CF card. The user can select which configuration to use at
boot time.
Payton Byrd loaned
me his C-One to do the port. Unfortunately what first seemed to be a
relatively simple "port" has to be an almost complete re-write. The
architecture of the C-One board is such that some options are limited.
For example the pixel clock can be either 25 or 33 MHz. This is fine
for VGA compatible timing, but my FPGApple doesn't map to it.
The real
Apple 2 has a 14.28 MHz master clock used as the pixel clock in the
highest resolution and everything else is derived from it. The CPU
clock divides it by 14, etc.
So my FPGApple used twice that (about 28
MHz) as a master clock and generated a nice 60 Hz vertical, more or
less VGA compatible video. One clock out of 28 used as a 6502 clock, so
everything ran at the native speed. Good for games, sound, etc.Now if
we have to use 33 MHz clock and a similar clocking scheme, the CPU will
run faster by some 15%. If the 33 MHz is divided by 33 instead, it
would be impossible to use the same number of CPU cycles per video
frame. In addition the synchronization between the video and the CPU -
one of the most ingenious features of the Apple 2 will also be
broken.
Either way a serious rewrite is needed. Unfortunately the C-One
board doesn't have the JTAG pins of the FPGA connected. So not only
does a reconfiguration require writing the bitstream to the CF card
which is way slower than a normal JTAG upload, but the wonderful Altera
tools like the memory editor and most importantly the SignalTap
debugger can't be used.However since I use FPGAs for more than
retro-computing toys, I have all kinds of neat hardware.
Including the Altera/Terrasic
DE1 board.
Apart from being a great development tool, it is a really
nice retro-computing platform.It has SRAM, SDRAM, FLASH memories, 12
bit VGA and an MMC/SD card connector.It has a different (much newer and
more powerful) FPGA chip than the C-One board but I decided that it
would be better to debug the design on this platform and then
re-synthesize it for the C-One.So this DE1 version started as a way to
help with the C-One development, but became something probably more
useful than the intended result.I will still try to make at least some
kind of an Apple 2 compatible for the C-One but lack of documentation,
no debugging facilities and the fact that I don't even own a C-One
board mean that it will not likely be a very complete computer.
On the
other hand the DE1 version is
already usefully. The most interesting feature is the use of the MMC/SD card for holding floppy disk
images. No extra hardware is needed - just the DE1 board itself plus a
PS/2 keyboard and an MMC/SD card. I'm using a second soft CPU (inside
the same Cyclone 2 FPGA) to parse the MMC card with a FAT16 file
system.
The .NIB images can be written to the card on any PC (or MAC or a Linux
box).
The second CPU happens to be a Z80. It will later be also used to run
CP/M from Apple .NIB disk images intended for Z80 card equipped Apples.
Only a single track is read from the MMC card to a memory buffer at a
time. No write capability so far.
Of course the MMC card with the FAT16 and NIB images is compatible with
my PseudoDisk.
.DSK files are not yet supported - this would require translating them
on-the-fly into .NIB images. No big deal, but somebody needs to write
the code... I really hope somebody other than myself does, as I
strongly prefer Verilog to 6502 (or Z80) machine code. The project is open source.
New soft ZX Spectrum.
The ZX directory on my MMC card is for running on my DE1 version of a
Sinclair Spectrum.I am probably not going to develop it any further but
the source is available here.It is a full
Spectrum 128 including the sound and capable of loading "snapshot"
files available on the web.
What's available.
The new FPGApple DE1 is work in progress. It is a bit
cleaner than the first one. Everything is pure Verilog this time,
including a different version of the 6502 CPU.
"BC6502" (C) 2002 Bird
Computer.
Video is very basic - just a crude translation to RGB. No
attempt to emulate the NTSC screen.Currently the Z80 is only used for
FAT processing. No joystick interface yet. I think this may be a nice
toy for somebody who wants to go one step beyond software emulators. A
better "feel" of a "real" computer, but uses a VGA screen. It looks
best on an analog CRT. LCD needs to resample the video TWICE: first to
convert from the Apple's 280 pixels per line to almost 640 pixels and
then again from 640 to the native 1024 (or whatever) horizontal
resolution of the LCD panel. Still on reasonable quality LCD displays
it doesn't look too bad.
Some mandatory screenshots :)
Left to do:
- Implement 80 column Apple 2e video mode and "double high res"
graphics.
- Map the Z80 to act like the SoftCard.
- Enable DSK image files processing.
- Add SuperSerial card emulation.
- Add read/write ProDOS mode to MMC. This is a software task.
Then with any luck I'll try to
make the C-One port that started this project...
Should you get yourself a DE1 board?
Maybe. It is probably an almost perfect platform to run retro-computer
replicas. A few are available in addition to my Apple and Sinclair
Spectrum. Including a full blown Amiga ("minimig"), soft 68000 CPU and everything!
Another example is an Intel 8080 based computer by Viacheslav Slavinsky. Open source
at
http://code.google.com/p/vector06cc
The FPGA is pretty powerfull: my 2 CPUs and all the glue only take
about 20% of the available logic. If you want to learn programmable
logic, this board is likely one of the best. If you just want to
play with old computers it may still be a good idea to buy DE1: only
$150 and no extra hardware needed. Cheaper than C-One and much more
powerful and flexible.
Of course it doesn't have a CDROM interface but one can be added if you
want it badly enough.
to contact me add "alex@" to this
page's domain