From da8a18c338885653e78586a40284a983710c167e Mon Sep 17 00:00:00 2001 From: Ben Kurtovic Date: Thu, 19 Mar 2015 17:37:00 -0500 Subject: [PATCH] Start adding some new arguments. --- README.md | 16 +++++++++++++++- crater.c | 25 ++++++++++++++++++++++++- 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1d70d20..4821b26 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ 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][crateris], a star that was – for a short +crater is named after [31 Crateris][crateris], a star that was – for a short time in 1974 – misidentified as [a moon of Mercury][moon]. Mercury was Sega's codename for the Game Gear during development. @@ -39,5 +39,19 @@ 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 should end in `.gg` or `.bin`. +Add `--fullscreen` (`-f`) to enable fullscreen mode, or `--scale ` +(`-s `) to scale the game screen by an integer factor. + `./crater -h` gives (fairly basic) command-line usage, and `./crater -v` gives the current version. + +### Advanced options + +crater supports several advanced features. 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. + +`--assemble ` (`-a`) converts z80 assembly source code into a +`.gg` binary that can be run by crater. `--disassemble ` (`-d`) +executes the opposite operation. diff --git a/crater.c b/crater.c index c3787f1..3f01739 100644 --- a/crater.c +++ b/crater.c @@ -18,7 +18,25 @@ /* Print command-line help/usage. */ static void print_help(const char *arg1) { - printf("%s [--help|-h] [--version|-v] [rom_path]\n", arg1); + printf("%s [-h] [-v] [-f] [-s ] [] ...\n" +"\n" +"basic options:\n" +" -h, --help show this help message and exit\n" +" -v, --version show crater's version number and exit\n" +" -f, --fullscreen enable fullscreen mode\n" +" -s, --scale scale the game screen by an integer factor\n" +" (applies to windowed mode only)\n" +" path to the rom file to execute; if not given, will look\n" +" in the roms/ directory and prompt the user\n" +"\n" +"advanced options:\n" +" -g, --debug display information about emulation state while running,\n" +" including register and memory values; can also pause\n" +" emulation, set breakpoints, and change state\n" +" -a, --assemble convert z80 assembly source code into a\n" +" binary file that can be run by crater\n" +" -d, --disassemble convert a binary file into z80 assembly code\n", + arg1); } /* Print crater's version. */ @@ -47,6 +65,11 @@ static void parse_args(int argc, char *argv[]) } else if (!strcmp(arg, "v") || !strcmp(arg, "version")) { print_version(); exit(0); + // f fullscreen + // s scale + // g debug + // a assemble + // d disassemble } else { FATAL("unknown argument: %s", argv[i]) }