View on GitHub

dmgcpu

DMG CPU Core Reverse Engineering

DMG CPU Core

DMG-01 SM83 core research.

The core can be found here:

cpu_location

The B revision of the DMG SoC is being studied.

Basic Circuit Designs

The core consists of the following main components:

sm83

Gekkio Research

There is also an SM83 study by @Gekkio: https://github.com/Gekkio/gb-research/tree/main/sm83-cpu-core

All places where there is any parallel with his study (signal names) are marked as Gekkio.

Latest Progress

At the moment, the entire topology have been obtained. The basic circuit principles are understood and the transistor circuits of most of the modules are obtained. The main emphasis was made on the sequencer circuit, as the most demanded one.

The research has come to an end. It remains to check the correctness of the circuits in the HDL simulator.

DMG01B_Core_Fused_Topo

Why SM83?

There is a manual from Sharp: https://archive.org/details/1996_Sharp_Microcomputer_Data_Book/page/n147/mode/2up

On page 148 of this PDF (or page 140 if you look at the original page numbers of the scan), it describes four microcomputers (SM8311, SM8313, SM8314 and SM8315). They all contain a CPU core that is labeled “SM83CPU” in the diagram on the next few pages, which has exactly the same instruction set and the same timings that the Game Boy CPU has. That is why we call the Game Boy CPU “SM83”. It seems to be the official name from Sharp for this core. I think @Gekkio found this originally, but I’m not sure. Before we knew about this document, most people called the CPU “LR35902”, because this was the label that was printed on the first batch of the rev. 0 chips. It seems to be that LR35902 is the name of the SoC as a whole, and SM83 is the name of the CPU core that was used inside. But I think we can’t be 100% sure that they really called this CPU SM83 back in 1989, or if they retroactively labeled it that when they reused it for those microcomputers in this 1996 data book.

by @msinger (Discussion #13)

Latch vs DFF vs DLatch vs FF

On this site we use the following conventions for terminology:

You may have heard other definitions on other sites/Wikipedia, but they are different everywhere (depending on the context), so we clearly define them.

Signals Disclaimer

I understand that everyone wants the signals to be called by human-readable and proper names. The SM83 study was conducted at different times, so sometimes you can see strange signal names.

Do not expect that all of them are quickly renamed to proper names. Such a process runs the risk of turning the study into signal renaming and nothing more.

From experience - frequent renaming of signals also contributes to various errors and confusion.

Renaming a signal does not make it work differently :smiley:

EDIT: This is the last project in which I accept signal name corrections. All subsequent ones will have a big sign at the beginning that signal corrections are not accepted.