An emulator, assembler, and disassembler for the Sega Game Gear
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

crater.c 1.2 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /* Copyright (C) 2014-2015 Ben Kurtovic <ben.kurtovic@gmail.com>
  2. Released under the terms of the MIT License. See LICENSE for details. */
  3. #include <stdlib.h>
  4. #include "src/config.h"
  5. #include "src/logging.h"
  6. #include "src/rom.h"
  7. /*
  8. Main function.
  9. */
  10. int main(int argc, char *argv[])
  11. {
  12. Config *config;
  13. int retval;
  14. retval = config_create(&config, argc, argv);
  15. if (retval != CONFIG_OK)
  16. return retval == CONFIG_EXIT_SUCCESS ? EXIT_SUCCESS : EXIT_FAILURE;
  17. #ifdef DEBUG_MODE
  18. config_dump_args(config);
  19. #endif
  20. if (config->assemble) {
  21. printf("Running assembler: %s -> %s.\n",config->src_path, config->dst_path);
  22. } else if (config->disassemble) {
  23. printf("Running disassembler: %s -> %s.\n", config->src_path, config->dst_path);
  24. } else {
  25. ROM *rom;
  26. printf("crater: a Sega Game Gear emulator\n\n");
  27. if (!(rom = rom_open(config->rom_path))) {
  28. if (errno == ENOMEM)
  29. OUT_OF_MEMORY()
  30. else
  31. FATAL_ERRNO("couldn't load ROM image '%s'", config->rom_path)
  32. }
  33. printf("Loaded ROM image: %s.\n", rom->name);
  34. // TODO: start from here
  35. rom_close(rom);
  36. }
  37. config_destroy(config);
  38. return EXIT_SUCCESS;
  39. }