An emulator, assembler, and disassembler for the Sega Game Gear
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. crater
  2. ======
  3. **crater** is an emulator for the [Sega Game Gear][game gear], with an included
  4. [Z80][z80] assembler/disassembler, written in C.
  5. [game gear]: https://en.wikipedia.org/wiki/Sega_Game_Gear
  6. [z80]: https://en.wikipedia.org/wiki/Zilog_Z80
  7. Why?
  8. ----
  9. While the internet is full of emulators for retro game systems, writing one is
  10. nevertheless a fun learning project.
  11. crater is named after [31 Crateris][crateris], a star that was – for a short
  12. time in 1974 – misidentified as [a moon of Mercury][moon]. Mercury was Sega's
  13. codename for the Game Gear during development.
  14. [crateris]: http://www.astrostudio.org/xhip.php?hip=58587
  15. [moon]: https://en.wikipedia.org/wiki/Mercury%27s_moon
  16. Installing
  17. ----------
  18. Only OS X and Linux are tested. You'll need a modern compiler that supports C11
  19. (clang preferred) and SDL 2. Using Homebrew, you can `brew install sdl2`; using
  20. apt, you can `apt-get install libsdl2-dev`.
  21. Run `make` to create `./crater`. To build the development version with debug
  22. symbols (they can exist simultaneously), run `make DEBUG=1`, which creates
  23. `./crater-dev`. This also enables the printing of debugging info to stdout.
  24. Usage
  25. -----
  26. Running `./crater` without arguments will display a list of ROM images located
  27. in the `roms/` directory, and then ask the user to pick one, or enter their own
  28. ROM path. You can provide a path directly with `./crater path/to/rom`.
  29. Add or symlink ROMs to `roms/` at your leisure. Note that they must end in
  30. `.gg` or `.bin` to be auto-detected.
  31. Add `--fullscreen` (`-f`) to enable fullscreen mode, or `--scale <n>`
  32. (`-s <n>`) to scale the game screen by an integer factor.
  33. Add `--debug` (`-g`) to display detailed information about emulation state
  34. while running, including register values and memory contents. You can also
  35. pause emulation to set breakpoints and change state.
  36. `./crater -h` gives (fairly basic) command-line usage, and `./crater -v` gives
  37. the current version.
  38. ### Assembler/Disassembler
  39. crater has built-in support for converting Z80 assembly into ROM images, as
  40. well as attempting the reverse process (i.e., disassembling).
  41. `--assemble <input> [<output>]` (`-a`) converts source code into a `.gg` binary
  42. that can be run by crater. `--disassemble <input> [<output>]` (`-d`) executes
  43. the opposite operation. If no output file is given, crater will use the name of
  44. the input file, with the extension replaced with `.gg` for `-a` and `.asm` for
  45. `-d`. By default, this will never overwrite the original filename; pass
  46. `--overwrite` (`-r`) to let crater do so.
  47. Credits
  48. -------
  49. Special thanks to [SMS Power!][sms_power]'s excellent [development][sms_dev]
  50. section, which has been invaluable in figuring out many of the Game Gear's
  51. details, including ROM header structure and the memory mapping system. Various
  52. source code comments reference their pages.
  53. Also thanks to [Thomas Scherrer's Z80 website][scherrer] for many useful
  54. resources about the Game Gear's CPU, including info about
  55. [undocumented opcodes][undoc_ops] and [flags][undoc_flags]. Finally, credit
  56. goes to [ClrHome][clrhome] for their helpful Z80 [instruction table][clrtab].
  57. [sms_power]: http://www.smspower.org/
  58. [sms_dev]: http://www.smspower.org/Development/Index
  59. [scherrer]: http://z80.info/
  60. [undoc_ops]: http://www.z80.info/z80undoc.htm
  61. [undoc_flags]: http://z80.info/z80sflag.htm
  62. [clrhome]: http://clrhome.org/
  63. [clrtab]: http://clrhome.org/table/