An emulator, assembler, and disassembler for the Sega Game Gear
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

43 lines
963 B

  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. ROM *rom;
  14. int retval;
  15. retval = config_create(&config, argc, argv);
  16. if (retval != CONFIG_OK)
  17. return retval == CONFIG_EXIT_SUCCESS ? EXIT_SUCCESS : EXIT_FAILURE;
  18. printf("crater: a Sega Game Gear emulator\n\n");
  19. #ifdef DEBUG_MODE
  20. config_dump_args(config);
  21. #endif
  22. if (!(rom = rom_open(config->rom_path))) {
  23. if (errno == ENOMEM)
  24. OUT_OF_MEMORY()
  25. else
  26. FATAL_ERRNO("couldn't load ROM image '%s'", config->rom_path)
  27. }
  28. printf("Loaded ROM image: %s.\n", rom->name);
  29. // TODO: start from here
  30. rom_close(rom);
  31. config_destroy(config);
  32. return EXIT_SUCCESS;
  33. }