Is the Game Boy a Computer? Colin (This Does Not Compute) - June 06 2016
This is the first post in an occasional series by Colin from This Does Not Compute.
One of the things that has always interested me are devices that should be computers, but aren't really. We generally think of "computers" as multi-purpose systems, things that run an operating system and applications. But there are tons of devices out there that have processors and RAM but don't really run an operating system in the traditional sense. What is one very famous example of this that we are all familiar with? The Nintendo Game Boy series, specifically the original Game Boy, Game Boy Pocket, and Game Boy Color, sometimes referred to as the "DMG", "MGB" and "GBC" respectively.
I recently ran across the RealBoy emulator project (https://realboyemulator.wordpress.com). There are plenty of Game Boy emulators out there and this one isn't really any different... except for this excellent blog series that explains in depth how the original DMG works. It's meant as a primer in order to understand how the emulator's code works, but it's also an amazing look at the underlying hardware.
In short, the architecture of the Game Boy is pretty simple -- processor, RAM, and ROM. The first two reside in the console itself while the ROM (and some more RAM) is in the game cartridge. There's only a small amount of permanent code in the Game Boy hardware, basically just enough to get the device to perform an initial cartridge check. (The check is, in a way, a form of DRM; it makes sure that the game was licensed by Nintendo and not independently released).
The CPU is perhaps the most interesting part of the system. In the DMG, it's a Sharp LR35902. By all appearances it's a custom part, and in many ways it is, but designing an entire processor from the ground up just for a hand-held game system (or any game system at all really) isn't cost effective. So the Game Boy's CPU is actually based on the Zilog Z80, which was at that time -- and still is -- a common 8-bit processor. The Z80 itself was actually a binary-compatible version of the Intel 8080; not necessarily a clone, but capable of executing all the same instructions. There were some additions to the Z80 beyond that of the 8080, but the custom Sharp CPU wasn't just a rebadged Z80. It actually leveraged parts from both processor architectures, while omitting anything that wasn't relevant to a game console.
What to me at least, makes the Game Boy more of a device than a computer is that there was no traditional operating system layer, firmware, or anything standing in the way between the game and the hardware. After that initial check, the CPU simply ran any instructions presented to it by the game. Modern games are written using a high-level programming language like C, but older games were written in machine language telling the CPU exactly what to do and when. In some ways, the game itself was an operating system. (This is also partially why emulators aren't perfect -- you have to write high-level code that mimics how hardware works, whereas modern games, already written in a high-level language, can simply be ported to another platform)
You might be most surprised by the lineage of the Intel 8080. It was originally designed in 1974 (along with the Z80), and made its way into early PCs and even some arcade games like Space Invaders. But the 8080 also was the basis for subsequent Intel processors, like the 8086. The 8086 is where we get the common computer term "x86", as it spawned the 286, 386 and 486 CPUs. Those of course led to the Pentium series, and on to the modern processors we use in our computers today. It's crazy to think that in 1989 when it was released, the Game Boy actually shared some similarities with computers running Windows. It is in its own right, a computer... that also isn't.
This Does Not Compute is a YouTube channel (https://www.youtube.com/c/thisdoesnotcompute) about gaming, content creation and all things technology. Colin can be reached on Twitter @thisdoesnotcomp (https://www.twitter.com/thisdoesnotcomp) and Instagram (https://www.instagram.com/thisdoesnotcomp).