Hey guys! It’s been a loooong, looooong
time, but FPGABoy is finally back! Yes, the project is not
dead…and yes I know the original website has been down for almost
6 years now.
Well, my life got really busy (and well that hasn’t changed), but
I have decided that I think FPGABoy is a pretty cool little
project and I don’t want it to remain gathering dust on an old
hard drive for the rest of eternity. In fact, I did a major
overhaul of the FPGABoy codebase a few months ago and rewrote the
whole CPU core as well as most of the video logic. It is now
capable of running most original GB mono games flawlessly
(although sound channels 3 and 4 are still missing.)
Since many of you may be completely new to this website and this
project, I will quickly explain what FPGABoy is. Nintendo
released their first handheld, the Dot Matrix Gameboy in 1988. It
almost instantly became extremely popular and marked the beginning
of what is now perhaps Nintendo’s most lucrative market
(continuing on with the Gameboy Color, the Gameboy Advance, the
Nintendo DS, and now the Nintendo DSi.) The Gameboy was the first
handheld that I ever owned, and I always wondered what made it
tick. I eventually discovered the homebrew development community
and bought myself a flash cartridge which I used to learn the
GBZ80 instruction set and to make a few little test programs which
are still gathering dust on an old HDD somewhere. Fast forward
years later to when FPGAs started becoming really popular (or more
accurately to when I first discovered FPGAs and all the cool
things that could be done with them.) I got my first FPGA
development board (which happened to sport a Xilinx Spartan IIE
300K FPGA on it) and after spending a while teaching myself VHDL
(yes, VHDL, not Verilog… unlike the majority I prefer VHDL
), I got the idea to try implementing as much of the original
Gameboy hardware as I could in VHDL. The goal was to be able to
eventually plug in original game cartridges to my clone system and
see them playing on (what soon came to be called) FPGABoy instead
of a real Gameboy.
I started with implementing the custom Gameboy CPU in VHDL, which
is very similar to the 8-bit Z80 but with distinct differences. I
was going off of some really old homebrew specs and documention as
well as some open source software emulators. After a while and
several rewrites, I got it to a point where it seemed to be
executing most instructions correctly and with perfect cycle
accuracy. I quickly hacked up a cartridge interface (I’ll post up
the old photos if I can still find them) and implemented sound
channels 1 and 2 (frequency synthesizer chans) and to my amazement
after fixing a bunch of bugs I was able to get some music out of a
Gameboy sound player demo program! I then managed to implement
some rudimentary video hardware and was able to get a few games
such as Zelda and Tetris booting up and displaying graphics. The
video output was to a VGA monitor using a not-so-great resistor
DAC that I built and the sound output was using an even worse
quality 9-bit R2R DAC which was also hand built with discrete
thruhole resistors. I used a GameCube controller for key input.
Things were looking great, when… real life did not give me much
free time to spend on continuing the project. I also became much
more interested in various other hobby projects reverse
engineering GameCube hardware, among other things), so FPGABoy was
left doomed to grow old and stale on the backburner.
Fastforward once again to a few months ago… and you will reach
the point where I picked up the project again! I was taking an
digital logic project class (EE119C) at Caltech and had to choose
an FPGA related project to work on for the term. Naturally,
FPGABoy came to mind as it was never completed, so I picked it up
once again. I opened up my old VHDL files for the first time in
*years* and was amazed at how poorly written my code looked back
then. I could barely even understand some of the things I was
doing in some of the parts! Further, after finding numerous bugs
in what I thought was a “bug-free” CPU core, I decided to scrap
the CPU core VHDL and start anew. I ended up completely rewriting
and debugging the GBZ80 CPU core as well as the video logic. I
also managed to add support for sprites. In fact, most of the
video logic has been completed now! (There are only a few timing
bugs which remain to be found and squashed.) The project has also
migrated from the ancient Spartan IIE to the Altera Cyclone II. I
was using a Terasic DE2 board during EE119C for developing and
testing the project, but I have plans to make a custom PCB for it
and may perhaps even make a run of a bunch of them for people if
there is enough interest.
The system still outputs as standard 640×480 VGA and uses a
GameCube controller as input. I am thinking of switching to using
a PS/2 port so a PC keyboard can be used instead… any input on
this? Perhaps the GC controller is more suitable for playing video
games.
The sound output is much crisper now since I am using a sigma
delta converter on the FPGA to output a 1-bit digital signal which
is simply low pass filtered and fed to a speaker. In fact, it
sounds great without any sort of filter, since the speaker itself
has a lowpass response. Also, the original GB had 5V TTL
signaling, whereas the Cyclone II (and any modern FPGAs) only
support 3.3V CMOS and below. Thus I completely did away with the
cartridge slot and am now using a big SDRAM to hold the ROM data.
MBC1 has been completely implemented in VHDL and is running
alongside FPGABoy, making the SDRAM controller and MBC1 appear as
a normal cartridge to the system. I can load any sort of ROM image
from my computer to FPGABoy (currently through a serial port, but
soon through USB) and make it run! I have implemented a pretty
simplistic hardware debugger, which allows pausing the system,
reseting it, reading an writing to any region of the FPGABoy
memory map as well as the virtual ROM, and simplistic breakpoints.
I don’t have them available right now, but very soon I will post
photos of the
system running (maybe even a video?) various original GB classics.
And finally… would any of you guys be interested in owning an
FPGABoy for yourself if I made a cool little PCB for it? If there
is enough interest in the project, I will complete the sound
hardware, fix the video timing issues remaining, and maybe even
add Gameboy Color support! I know that the Gameboy is over 20
years old and is rather vintage… but I was surprised when I saw
that there seem to be a good number of people still interested in
this thing.
…Wheew that was a long post!
Costis Sideris