• Stars
    star
    202
  • Rank 187,301 (Top 4 %)
  • Language
    Kotlin
  • License
    Apache License 2.0
  • Created almost 5 years ago
  • Updated 7 months ago

Reviews

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

Repository Details

Sharp SM83 / Game Boy extension for Ghidra

GhidraBoy: Sharp SM83 / Game Boy extension for Ghidra

Very experimental! No compatibility guarantees!

Ghidra version: Ghidra 10.3_PUBLIC_20230510

Tetris disassembly

Features

  • Sharp SM83 (CPU core used in Game Boy) support for Sleigh
  • Game Boy ROM loader:
    • Can load unbanked ROMs (<= 32kB, e.g. Tetris)
    • Can load banked ROMs (> 32kB, e.g. Pokemon)
    • Can load greyscale boot ROMs (DMG/DMG0/MGB/SGB/SGB2)
    • Can load color boot ROMs (CGB/CGB0)
  • Memory blocks based on the hardware memory map
    • Banked regions use overlays (TODO: figure out if there's a better way to support them)
    • GB vs GBC differences are handled (e.g. banked WRAM)
  • Symbols for hardware registers (0xFFxx range)
    • GB vs GBC differences are handled (e.g. existence of KEY1 register)
  • Game Boy cartridge header data types
    • Enumerated types for some things

How to install

  1. Download a prebuilt GhidraBoy release, or build it yourself.
  2. Start Ghidra
  3. File -> Install Extensions
  4. Press the plus icon ("Add extension")
  5. Choose the built or downloaded GhidraBoy zip file
  6. Restart Ghidra when prompted to load the extension properly

How to build

As a prerequisite, you need to have a Ghidra installation somewhere (an actual installation, not a copy of Ghidra source code!).

export GHIDRA_INSTALL_DIR=/path/to/ghidra
./gradlew

or

./gradlew -Pghidra.dir=/path/to/ghidra

You can then find a built extension .zip in the build/distributions directory.

Open questions / problems

  • Decompiler output is difficult to read if certain instructions are used (e.g. rotates, JP HL for jumptables)
  • Default "ASM calling convention" assumes all registers can be inputs and/or outputs. Inputs/outputs are often guessed incorrectly, so manual tuning is required for almost every function
  • Are overlays the only / the best solution for handling banked memory areas? Right now in banked ROMs every function call to 0x4000-0x7fff needs to be manually resolved to the correct bank(s)

License

Licensed under the Apache License, Version 2.0.

More Repositories

1

mooneye-gb

A Game Boy research project and emulator written in Rust
Rust
852
star
2

gb-schematics

Game Boy -related schematics
386
star
3

gb-ctr

Game Boy: Complete Technical Reference
TeX
292
star
4

gb-hardware

Game Boy -related custom hardware by gekkio
Shell
275
star
5

gb-research

Game Boy hardware research
VHDL
212
star
6

gnome-session-xmonad

Ubuntu package for Gnome + XMonad session files
Shell
96
star
7

mooneye-test-suite

Mooneye Test Suite is a suite of Game Boy test ROMs
Assembly
62
star
8

gekkio-kicad-libs

KiCad 7.x libraries by gekkio
Python
55
star
9

sbt-jrebel-plugin

JRebel plugin for Simple Build Tool
Scala
36
star
10

gb-hardware-db

Game Boy hardware database
Rust
32
star
11

docker-fpga

Dockerized FPGA toolchain experiments
Shell
21
star
12

lcdoff-rs

Tiny utility to turn off the screen on Windows machines
Rust
15
star
13

samsung-photo-frame-ctrl

A small Python application for controlling Samsung photo frames
Python
11
star
14

robotic-chameleon

Android Java library for YUV scaling and conversion
Java
9
star
15

gb-cartpp

GB-CARTPP-XC/DIY cartridge flasher/dumper firmware/hardware/software
C
8
star
16

gb-cart256k-a

GB-CART256K-A flash cart firmware
VHDL
7
star
17

sbt-vaadin-plugin

Vaadin plugin for Simple Build Tool
Scala
7
star
18

misc-hardware

Miscellaneous/utility/convenience hardware by Gekkio
5
star
19

gb-cart8m-a

GB-CART8M-A flash cart firmware
Python
5
star
20

moca-hcho

Bluetooth 5 BLE formaldehyde/temperature/humidity sensor beacon
Rust
5
star
21

sbt-eclipse-plugin

SBT Eclipse Classpath Container
Java
5
star
22

vaadin-skeleton

Sample project for SBT/Scala that uses Vaadin
Scala
5
star
23

zk-async-example

Example of asynchronous processing and server push with ZK
Java
4
star
24

blog

All sample code that is used in my blog
Java
4
star
25

mcp2210-rs

Microchip MCP2210 library using hiddraw (Linux-only)
Rust
4
star
26

snooze-rs

Experimental library for sleeping periodically in Rust code
Rust
4
star
27

libyuv

Unofficial mirror of libyuv
C++
3
star
28

naughtyemu

naughtyemu.gb: silly Game Boy internal bus conflict test ROM
Assembly
3
star
29

gb-live32

Firmware and utilities for the GB-LIVE32 rapid development cartridge
C
3
star
30

jawscala

Jawsy Solutions libraries for Scala 2.9+
Scala
2
star
31

retro-dat

Parsing library for Logiqx DAT files
Rust
2
star
32

splake

Collection of extensions and library code for the ZK framework
JavaScript
2
star
33

gekkio.fi-hakyll

Hakyll source code for gekkio.fi (legacy)
HTML
2
star
34

jawwa

Jawsy Solutions libraries for Java 1.6+
JavaScript
2
star
35

nelma

Simple boilerplate for serial communications with proper packet framing
C
2
star
36

sbt-metadata-exporter

Processor for Simple Build Tool that exports project metadata in XML format
Scala
2
star
37

gb-chr

Game Boy: Complete Hardware Reference
TeX
2
star
38

red-sculpin

Experimental Rust crate intended for implementing controller-side IEEE 488.2 / SCPI 1999.0 protocols
Rust
2
star
39

bamboo-sbt

Adds SBT support to Bamboo
Java
1
star
40

maghug

A battery-powered device that blinks a LED if it doesn't get hugs from a magnet
Eagle
1
star
41

gekkio-eagle-libs

Eagle CAD libraries by gekkio
1
star
42

picdux-41630

Arduino/Teensy-based PIC low-voltage ICSP programmer for devices listed in Microchip datasheet 41630
Arduino
1
star