An emulator, assembler, and disassembler for the Sega Game Gear
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 
 
 
 
Ben Kurtovic 981c4d4783 Disable ASan; bugfix for immediate masks. vor 9 Jahren
roms Initial commit vor 10 Jahren
scripts Implement inc; make update script save updates; bugfix. vor 9 Jahren
src Disable ASan; bugfix for immediate masks. vor 9 Jahren
tests Makefile improvement; remove optimizer; minor tweaks. vor 9 Jahren
.gitignore Add to README, finish makefile; project structure. vor 10 Jahren
LICENSE Update copyright for 2015; makefile updates. vor 9 Jahren
README.md Add some credits. vor 9 Jahren
crater.c Make crater be quiet when assembling/disassembling is successful. vor 9 Jahren
makefile Disable ASan; bugfix for immediate masks. vor 9 Jahren

README.md

crater

crater is an emulator for the Sega Game Gear, with an included Z80 assembler/disassembler, written in C.

Why?

While the internet is full of emulators for retro game systems, writing one is nevertheless a fun learning project.

crater is named after 31 Crateris, a star that was – for a short time in 1974 – misidentified as a moon of Mercury. Mercury was Sega’s codename for the Game Gear during development.

Installing

Only OS X and Linux are tested. You’ll need a modern compiler that supports C11 (clang preferred) and SDL 2. Using Homebrew, you can brew install sdl2; using apt, you can apt-get install libsdl2-dev.

Run make to create ./crater. To build the development version with debug symbols (they can exist simultaneously), run make DEBUG=1, which creates ./crater-dev. This also enables the printing of debugging info to stdout.

Usage

Running ./crater without arguments will display a list of ROM images located in the roms/ directory, and then ask the user to pick one, or enter their own ROM path. You can provide a path directly with ./crater path/to/rom.

Add or symlink ROMs to roms/ at your leisure. Note that they must end in .gg or .bin to be auto-detected.

Add --fullscreen (-f) to enable fullscreen mode, or --scale <n> (-s <n>) to scale the game screen by an integer factor.

Add --debug (-g) to display detailed information about emulation state while running, including register values and memory contents. You can also pause emulation to set breakpoints and change state.

./crater -h gives (fairly basic) command-line usage, and ./crater -v gives the current version.

Assembler/Disassembler

crater has built-in support for converting Z80 assembly into ROM images, as well as attempting the reverse process (i.e., disassembling).

--assemble <input> [<output>] (-a) converts source code into a .gg binary that can be run by crater. --disassemble <input> [<output>] (-d) executes the opposite operation. If no output file is given, crater will use the name of the input file, with the extension replaced with .gg for -a and .asm for -d. By default, this will never overwrite the original filename; pass --overwrite (-r) to let crater do so.

Credits

Special thanks to SMS Power!‘s excellent development section, which has been invaluable in figuring out many of the Game Gear’s details, including ROM header structure and the memory mapping system. Various source code comments reference their pages.

Also thanks to Thomas Scherrer’s Z80 website for many useful resources about the Game Gear’s CPU, including info about undocumented opcodes and flags. Finally, credit goes to ClrHome for their helpful Z80 instruction table.