Skip to content
A Game Boy Advance emulator written in C#
C#
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.idea/.idea.G-BATS/.idea More CPU stuff Dec 18, 2017
GBATS Remove extra using, no longer needed after cleanups Dec 23, 2017
.gitignore License, a bunch of little cleanups Dec 23, 2017
G-BATS.sln ALU mostly done, timers sort of done Dec 22, 2017
LICENSE License, a bunch of little cleanups Dec 23, 2017
README.md Add README Dec 23, 2017

README.md

G-BATS

A Game Boy Emulator written in C#. Target .NET Framework 4.6.2, works with Mono 5.4, uses OpenTK and should work on Windows/Linux. Well, "should work" is a bit of a stretch - at the moment it doesn't really run anything interesting yet, not even the BIOS. The goal for me is to learn how emulators more or less work, plus maybe run a few games I have - if you're looking for something useful, try mGBA, a much superior emulator.

Usage

Run the binary from the command line passing --bios bios_binary to point at the dumped BIOS binary and --rom rom_image.gba to load a given dumped game. BIOS image is required at the moment - HLE BIOS isn't implemented. A small window will appear - as long as it's focused, the standard key bindings are Z/X for A/B, A/S for L/R, Enter for Start, Right Shift for Select, arrow keys for the D-Pad. These are not rebindable at the moment, controller input isn't there either.

Building and developing

Clone the repo and open it in your C# IDE of choice. Make sure you're building against .NET 4.6.2 for x64 (AnyCPU isn't supported for now). Restore all NuGet packages, build and you should be all set - no special steps are needed.

The most interesting things in this repository's main project are:

  • GbaEmulator.cs: The central point that exposes the interface to the GBA emulator and takes together all the subsystems. The core loop is in there, which manages which subsystem should execute next, and so on. Start here.
  • Subsystems/: Most GBA components are in there: ArmSeven.cs is the ARM7 CPU emulator, Memory/ contains all the blocks to emulate each memory map component, Video/ contains the video subsystem, and so on.
  • Utils/ are all the misc stuff which fits nowhere else, really.
  • Platforms/ contains the platform binding - if you're interested in adding support for more platforms other than Windows/Linux, add that here.
  • Interfaces/ contains interfaces needed to abstract away some blocks.

Now, it turns out that the more accurate this emulator gets, the more OOP rules it'll violate. It's not really possible to create a cleanly-separated program which tries to emulate a very-much-not-cleanly-separated hardware platform. If that doesn't bother you - happy hacking!

You can’t perform that action at this time.