Wednesday, January 22, 2014

The CPU

The CPU of the game boy handles almost everything except graphics, it does all the memory mapping and even sound synthesis. Here is a block diagram abstractly showing all the main components of the CPU:

Registers and Opcodes: The 8-bit registers come in pairs so that e.g. de and hl are often used as 16-bit numbers. There is a normal opcode table (with just a couple unused opcodes) and an extended opcode table for bit operations so just under 2x256 operations.

Memory Mapping: The CPU itself builds a memoy map that lets it address (using numbers from 0x0000 to 0xFFFF) various different chips like the two SRAM shown earlier as well as memory on the cartridge/game-pak inserted , there are also many specific addresses that act as hardware registers and this is how it interfaces with the serial port, lcd display, sound synthesis etc.

Interrupts: The CPU also supports interrupts via the interrupt controller. These  are triggered by special hardware events, during code execution the program-counter can jump to execute an interrupt routine to handle the event before returning back.

DMA: There is also a feature called Direct Memory Access which enables it to copy blocks of data around while executing other instructions.

Here are microscope photographs of one of these CPU chips decapped:

taken by Epop

and this fantastic image from tinytransistors (the link includes zooms of specific parts and descriptions of what they are)
Sources & Links:

No comments:

Post a Comment