THE CHIP BEHIND THE NINTENDO GAME BOY: THE SHARP LR35902
Having looked at the foundations for the Game Boy’s hybrid CPU, let us see just what did and what didn’t make it from the Intel 8080 and the Zilog Z80 into the SHARP LR35902.
We will now point out the essential:
- One important aspect adopted from the Z80 and not mentioned in part 1 is conventional rather than technical: The syntax used to program the Sharp LR35902 follows the Z80 rather than the 8080. This is fundamental to us as we’ll examine lots of programs written for the Game Boy (from the bootstrap ROM, to fragments of actual games). We will come familiar with this syntax later on.
- Adoption of the special instruction extender (opcode 0xcb) from the Z80.
- Adoption of the bit manipulation instruction set from the Z80, accessed through the instruction extender. This instructions were used to set, reset and test specific bits from registers or memory. Quite handy.
- It retained just the 8080’s register set; the registers added by the Z80 were left out.
- Clocked at 4MHz (4194304Hz). This is faster that the 8080’s 2MHz and the Z80’s 2.5MHz.
- As noted in part 1, it retained a single address space; the I/O address space used by the 8080 and Z80 was discarded, so communication with I/O devices was done thorough this single address space.
- Because registers IY and IX are missing, there is no index+base memory addressing.
- Not all the flags or status bits from the 8080’s and Z80’s F register were adopted. The following were used:
- Bits 0 to 3 are not used.
- Bit 4 represents the carry flag. It is set when a carry from bit 7 is produced in arithmetical instructions. Otherwise it is cleared.
- Bit 5 represents the half-carry flag. It is set when a carry from bit 3 is produced in arithmetical instructions. Otherwise it is cleared. It has a very common use, that is, for the DAA (decimal adjust) instruction. Games used it extensively for displaying decimal values on the screen.
- Bit 6 represents the subtract flag. When the instruction is a subtraction this bit is set. Otherwise (the instruction is an addition) it is cleared.
- Bit 7 represents the zero flag. It is set when the instruction results in a value of 0. Otherwise (result different to 0) it is cleared.
For a detailed account of the Nintendo Game Boy CPU, refer to:
- GBCPUman by: Pan of Anthrox, GABY, Marat Fayzullin, Pascal Felber, Paul Robson, Martin Korth, kOOPa, Bowser
Continue with: The Nintendo Game Boy, Part 3: The Rest of the Hardware.
HELP US IMPROVE!
Did you like this post? Do you have any suggestions? Please rate this post or leave us a comment so we can improve the quality of our work!