Dante Gonzales and Ian Doten Overview  History  and Game Boy Color Specs  CPU architectures  8080  Z80  Sharp LR35902  Sharp LR35902 in depth  Changes from the Z80 to the LR35902  Memory  Cartridge compatibility History  The Game Boy was released in 1989 and worldwide by 1990.  The Game Boy Color was released worldwide in 1998.  The first Handheld system released by Nintendo was the Game & Watch Series. Game Boy and Game Boy Color Specs

Specifications Gameboy Gameboy Color CPU 8-bit Sharp LR35902 4Mhz 8-bit Sharp LR35902 4Mhz or 8MHz (two running modes) 8-bit data-BUS 16-bit address-BUS RAM 8kB internal up to 32kB 32kB internal up t o32kB external external Video RAM 8kB internal 16Kb internal Video Display: Reflective LCD 160x144 dots (physical) Sprites: 40 sprites of 8x8 / 8x16 Color Palette 4 shades of grey 10, 32, or 56 colors on screen. From a palette of 32,768 Supports 4 colors per sprite 1 color being transparent ROM (Based on cartridge) On-CPU-Die 256 bit bootstrap 16kBit up to 4Mbit are known. Possibly 8Mbit? (Debated) Game Boy and Game Boy Color Specs (Cont.)

Specifications Gameboy Gameboy Color

Sound Sound: 1 Mono Speaker. Stereo headphone jack 4 sound channels. -Each can be mapped to either L or R speaker or both 1 programmable PCM (Pulse Code Modulation) 4-bit wave channel, -64 4bit samples in 1x64 bank array or 2x32 bank array 1 noise generator. 1 audio input from cartridge. 2 Pulse wave generators 2 Square wave channels Communication one serial port, up to four Gameboys can be connected together using these ports (wire linking)

Infrared communications port

Power 6 Volt, 0.7 Watt 3 Volt, 0.6 Watts 4 AA Batteries) 2 AA Batteries) CPU architectures   Released in 1974   Released in 1976  Binary compatibility with the Intel 8080  Sharp LR35902  Based on the Intel 8080 and Zilog Z80  Removed unneeded features from the Z80  Used memory mapping for IO devices instead of using separate . Intel 8080 Specifications: • 16-bit wide address bus • 8-bit wide data bus • Allowed access to 64K of byte addressable memory • 8-bit accumulator • 8-bit status register • Six 8-bit general purpose registers • 16-bit stack pointer • 16-bit

Intel 8080 registers

1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 (bit position) Main registers A Flags AF (accumulator and flags) B C BC D E DE H L HL (indirect address) Index registers SP Stack Pointer Program counter PC Program Counter Status register

S Z I H - P - C Flags

Zilog Z80 Specifications: • 16-bit wide address bus • 8-bit wide data bus • Allowed access to 64K of byte addressable memory • 8-bit accumulator • 8-bit status register • Six 8-bit general purpose registers • 16-bit stack pointer • 16-bit program counter • Enhanced instruction set • Added 256 more instructions • Two special registers IX and IY • Allowed for base + offset memory addressing • system • Binary compatibility w/ Intel 8080 • Designed by the same team that designed the Intel 8080

Sharp LR35902  Customized hybrid of Intel 8080 and Zilog Z80.  Uses instruction extender from the Z80.  Only uses a single address space.  Communication with I/O devices were mapped to memory.  Only retained the single Intel 8080 register set  Uses custom flag registers.  Reused some of the Z80 flags.

Customized Hybrid

 “The Game Boy uses a computer chip similar to an Intel 8080. It contains all of the instructions of an 8080 except there are no exchange instructions. In many ways the is more similar to the Zilog Z80 processor. Compared to the Z80, some instructions have been added and some have been taken away.” - http://marc.rawer.de/Gameboy/Docs/GBCPUman.pdf (p. 6)

Instruction Extender (Opcode 0xCB)  Adopted the Zilog Z80’s instruction set extension.  Did not use all of the extended instructions.  Kept the bit-manipulation instruction set.  These instructions were used to set, reset, and test specific bits from registers or memory.  Very useful for programmers to test and debug their code with. Trade off of single address space  Advantages  Small and fixed number of devices only used 128 bytes of memory  No need for In or Out instructions. Load and Store were used to read from and write to devices.  Disadvantages  Special circuitry was required to redirect data operations to the devices in use.  Used up some of the limited 64kB of memory. Memory  The Game Boy supported a single address space.  All interactions and mappings took place here.  Game Boy has 64KB of memory due to the CPU address bus was 16 bits wide.  Everything form from I/O, working RAM, external RAM, video RAM, and other special memory areas has to be accessed through this 64KB space.  Many games have megabytes of ROM.

Memory Management  A technique known as memory banking was used to solve this issue.  The same space was reused to map different parts of the games ROM. Games for the Game Boy were divided into equally sized chunks called banks.  The first bank was permanently mapped to addresses (0x0000 - 0x3FFF), the first 16kB of address space.  The rest of them were alternately mapped to addresses (0x4000 - 0x7FFF).  Switching the banks allowed game cartridge ROM to be as big as it needed.  However, this required the game programmer to be responsible for the bank switching. Memory Mapping  Distribution of the 64kB address space  Addresses (0xE000 – 0xFDFF) not typically used.  This space echoes (0xC000 – 0xDDFF) Purpose 0x0000 - 0x3FFF Permanently mapped ROM Bank 0x4000 - 0x7FFF Area for switch ROM Bank 0x8000 - 0x9FFF Video RAM 0xA000 - 0xBFFF Area for switchable external RAM banks 0xC000 - 0xCFFF Game Boy’s working RAM bank 0 0xD000 - 0xDFFF Game Boy’s working RAM bank 1 0xFE00 - 0xFEFF Sprite Attribute Table 0xFF00 - 0xFF7F Devices Mappings. Used to access I/O devices 0xFF80 - 0xFFFE High RAM Area 0xFFFF Interrupt Enable Register Game Cartridge memory management  Each cartridge had a special unit which implemented the mechanisms for memory banking, called the Memory Bank Controller (MBC).  There are many different types of MBCs  MBC1 max 2mB ROM and max 32kB RAM  MBC3 max 2mB ROM and max 32kB RAM and timer

Questions? Sources http://marc.rawer.de/Gameboy/docu_1.htm#1.1 https://en.wikipedia.org/wiki/Game_Boy https://en.wikipedia.org/wiki/Game_Boy_Color http://marc.rawer.de/Gameboy/Docs/GBCPUman.pdf https://realboyemulator.wordpress.com/2013/01/01/the- nintendo-game-boy-1/ https://realboyemulator.wordpress.com/2013/01/02/the- nintendo-game-boy-part-2/ https://realboyemulator.wordpress.com/2013/01/02/the- nintendo-game-boy-part-3/ http://bgb.bircd.org/pandocs.htm