• Stars
    star
    310
  • Rank 134,926 (Top 3 %)
  • Language
  • License
    Creative Commons ...
  • Created over 5 years ago
  • Updated almost 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Reverse-engineered schematics for DMG-CPU-B

DMG-CPU-Inside

This repo contains an annotated overlay for the Nintendo Game Boy DMG-CPU-B chip die and the extracted schematics.

DMG-CPU-B die vector overlay

This was done manually with only a few automated checks so THERE'S A HIGH RISK OF ERROR. I'm in no way responsible if you made someone's life depend on this and it fucked up.

What is done:

  • All APU logic.
  • All PPU logic.
  • All I/O and timer logic.
  • All DMA logic.
  • All interrupt logic.
  • Various stuff used for testing/debugging.

What isn't done:

  • CPU. Why: it's a standalone core which doesn't use the standard cell topology. Visibility isn't good enough and it's too complex for me, sorry.
  • Clock complements. Why: They don't affect functionality. Only required because the DFF cells need a clock and its complement to work.
  • Some analog parts. Why: Poor visibility, lazyness.
  • Some cell groups related to embedded ROM and RAM blocks. Why: They don't affect functionality.

How to use

Just read the schematics :)

If you want to use the overlay:

  • Get Inkscape
  • Download the die picture from Digshadow
  • Resize it to 8000px wide if you're using Inkscape 0.92.2, otherwise it may freeze
  • Download the SVG overlay
  • Open the overlay in Inkscape, import the die picture (chose link, not embed), stick it under the overlay layers, align it and lock it in place
  • Have "fun"

Notes

Nets named FROM_CPU* and TO_CPU are connected to the CPU core but are not clearly identified. Many of them are trigger and acknowledge signals for interrupts. Others might be state indicators like the Z80 /M1 or HALT.

Some DFF clock polarities have to be verified.

The parallel-in-serial-out shift registers used for the serial link and video rendering are made of chains of set-reset-capable DFFs. Their loading logic require a lot of cells and seem complex, but in the end it forms something quite simple.

Rather than using multiplexers, many internal busses are instead tri-state capable. The "TRIBUFFER" cells are extensively used for this.

Mysteries

  • Bit 4 and 5 of FF26 (NR52) can be written to.
    • Bit 4 sets NET03 (APU test mode ?).
    • Bit 5 allows software clocking of the CH1 sweep timer when NET03 is high.
  • Bit 0 of FF23 (NR44) can be read. It relates to the CH4 prescaler.
  • The current wave RAM address can be read in bits 4~0 of FF1C (NR32) when NET03 is high.
  • The whole chip can be made a slave for an external CPU by using the test pins. This was already discovered by @Gekkio and maybe others.
  • Probably other things I missed...

PAQ (Potentially Asked Questions)

  • Why ?

It is well known by emulator authors that the Game Boy is full of quirks. Knowing exactly how and when signals change can help reaching perfect accuracy.

  • Why are the schematics not in an editable format ?

Because I used proprietary CAD software for speed and I didn't finish making the converter for the KiCAD format. I hope to be able to do that soon.

  • What's up with the cell labels ?

They're random, unique names. The first letter corresponds to the column they're in on the silicon die.

  • Many small lines aren't traced, why ?

I didn't bother tracing branching lines when their end point was near enough to see it on my 15" screen at the zoom level I used. They're reported on the schematic, of course.

  • Why are there copies of logic blocks providing identical functions ?

It's a way to trade off die space for speed, it seems weird but it's useful. Look up "logic duplication".

  • I found a mistake, how can I report it ?

Until I get the files exported in KiCAD format, please open an issue and describe what's wrong (cell name, net name, position on die, ...).

  • How did you know which cells did what ?

I had to take guesses. Inputs and outputs are easily identified and the cell size gives some clues. When connections are made on the schematic, it becomes quickly obvious when a guess is wrong. Check out the cell zoo.

  • How long did it take ?

Identifying the cells, isolating them, tracing the connections and the schematics took 191 hours.

If you find it worth it, I accept donations through Paypal: paypal.me/furrtek

Thanks to Gekkio, Tanjent and Kevin Murphy for the help.

More Repositories

1

PrecIR

You know what this is for ;-)
C
285
star
2

SiliconRE

Traces, schematics, and general infos about custom chips reverse-engineered from silicon
Verilog
155
star
3

GB303

GB303 wavetable-based TB-303 style synthesizer for the Nintendo Gameboy.
Assembly
131
star
4

GBCameraProjects

Lo-Fi portable video recorder using a GameBoy Camera cartridge.
C
91
star
5

VirtualTap

Mod kit for the Virtual Boy to make it output VGA or RGB video
Verilog
61
star
6

NeoCDSDLoader

Neo CD SD Loader
C
61
star
7

Neogeo_MiSTer_old

SNK NeoGeo core for the MiSTer platform
Verilog
52
star
8

Arcade-TMNT_MiSTer

Konami's Teenage Mutant Ninja Turtles for the MiSTer FPGA platform
Verilog
30
star
9

PTouchHH

Brother P-Touch label printer reverse-engineering and firmware un-crap attempt
29
star
10

Airaki

Tile-matching RPG puzzle game for the Nintendo GameBoy released in 2014
Assembly
20
star
11

Waimea

Compact chronogram editor for Windows
Visual Basic
19
star
12

PSGTalk

Command line tool for generating register streams for the SN76489 (PSG) from speech wave files.
C
17
star
13

Kemochi

DIY customizable Tamagotchi aimed towards the furry (Kemono) community.
C
16
star
14

MagicWandMods

Mods for Magic Wand clones
C
16
star
15

SpeakAndSpellTi

Commented source code of Texas Instrument's original Speak and Spellâ„¢
14
star
16

MonotronDS

Korg Monotron emulator for the Nintendo DS
C
14
star
17

HanoverFlipDot

Analysis of a Hanover Displays flip-dot display firmware
Assembly
12
star
18

Svengali

GUI authoring tool for Teddy Ruxpin tapes
Python
11
star
19

DottoriLog

Dottori-Kun for FPGA
Verilog
9
star
20

AoC2022

Advent of Code 2022 in 68k assembly
Assembly
6
star
21

LGV3

Outils et docs concernant les transmissions radio de matériel de Laser Tag
Python
6
star
22

ASICRE

Logic cell info for gate array and standard cell ASIC reverse-engineering
5
star
23

ChappieEarsSMS

Small Sega Master System game made for smspower's 2015 coding compo
Assembly
5
star
24

AcidRefluxSMS

Small Sega Master System runner made for smspower's 2016 coding compo
Assembly
4
star
25

Radboy

Just in case you were worried about gamma rays and only had a Gameboy handy.
Assembly
4
star
26

babtool

Pack and depack Build-a-Bear sound module data
Python
3
star
27

ChipRef

Common integrated circuits reference app for the Pebble smartwatch
C
3
star
28

ChannelF

Fairchild Channel F
Verilog
3
star
29

MailboxAlert

Compact and cheap radio mail alert TX/RX pair
C
3
star
30

Arcade-Alpha68k_MiSTer

SNK Alpha68k arcade system for MiSTer
Verilog
3
star
31

ddg-pnp-translation

Densha de Go! Plug & Play English translation
Python
3
star
32

MetamorphicForce

BEAST
VHDL
2
star
33

MetarikkuOS

OS/Firmware for the Metarikku YM2612 synthesizer
2
star