Skip to content

Work-in-progress Game Boy emulator

Notifications You must be signed in to change notification settings

tuankiet65/knocknock

Repository files navigation

knocknock

A WIP Game Boy emulator, written during my downtime at work. The name is choosen after the company I'm doing an intern at (exactly which company is left as an exercise for the reader) downtime in school, I've left that company for undergraduate studies.

knocknock screenshot

Current status:

  • Pass all blargg's cpu_instrs tests.
  • Runs some games with none or minor graphics glitches.

Features

Core library

  • CPU
    • All instructions implemented
    • Cycle-accurate decoder
    • Cycle-accurate instructions
  • Memory bank controllers
    • FlatROM aka no memory bank controller
    • MBC1 (verified using mooneye)
    • MBC2 (verified using mooneye)
    • MBC3
    • MBC5
  • Peripherals
    • Serial
    • Joypad
    • Clock
    • Timer (partly implemented, not accurate)
  • PPU
    • Tile
    • Tile Map
    • Tile Data
    • OAM Sprite
    • Renderer (partly implemented, not accurate)
  • Audio

knocknock-sdl

  • Memory viewer
  • Memory map viewer
  • PPU debugger
    • Tile Data viewer
    • Window / background viewer
    • Rendered frame viewer
    • OAM viewer
    • Jump to next scanline
  • CPU debugger
    • Disassembly viewer
    • Register viewer
    • Step into, over, to next instruction, ...
    • Breakpoints
  • Interrupt viewer

Building knocknock

Dependencies

You'll need:

  • CMake.
  • A recent C++ compiler that supports C++17 (tested: GCC 10.0, Clang 10.0, latest Microsoft Visual C++)
  • Doxygen for generating documents.
  • SDL2 (only needed for the SDL frontend)
  • FFmpeg (only needed for the SDL frontend)

Some dependencies are bundled with the source, but you can use flags to force knocknock to use the system version instead:

  • fmt (flag: USE_SYSTEM_FMT)
  • glog (flag: USE_SYSTEM_GLOG)
  • Catch2 (flag: USE_SYSTEM_CATCH2) (only needed for tests)

Linux

Create a build directory and change to it:

mkdir build
cd build

Then invoke CMake and make:

cmake -DCMAKE_BUILD_TYPE=BUILD_TYPE [additional options] ..
make -jCORES

Replace CORES with the number of CPU cores and BUILD_TYPE with one of these build types:

  • Release for a release build (recommemded, most performance)
  • MinSizeRel for a release build, optimized for binary size (might be faster than Release)
  • Debug if you want to debug the emulator (and please send a pull request or file an issue if you find any bugs!)

This will only build the core knocknock library. To also build other components, use these additional options:

  • -DWITH_SDL_FRONTEND=On to build the SDL GUI frontend (recommended, this is probably what you want)
  • -DWITH_CLI_FRONTEND=On to build the CLI (command-line) frontend. This frontend is pretty useless, as it emulates the ROM, but only prints out the serial output to stdout.
  • -DWITH_TESTS=On to build the unittests.

References

About

Work-in-progress Game Boy emulator

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published