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.
 
 
 
 
 

49 lignes
1.2 KiB

  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. #pragma once
  4. #include <stdint.h>
  5. #include <stdlib.h>
  6. #define ROM_SIZE_MIN (32 << 10) // 32 KB
  7. #define ROM_SIZE_MAX ( 1 << 20) // 1 MB
  8. /* Header info */
  9. #define HEADER_SIZE 16
  10. #define HEADER_MAGIC_LEN 8
  11. static const char rom_header_magic[HEADER_MAGIC_LEN + 1] = "TMR SEGA";
  12. /* Error strings */
  13. static const char* rom_err_isdir = "Is a directory";
  14. static const char* rom_err_notfile = "Is not a regular file";
  15. static const char* rom_err_badsize = "Invalid size";
  16. static const char* rom_err_badread = "Couldn't read the entire file";
  17. static const char* rom_err_badheader = "Invalid header";
  18. static const char* rom_err_sms = "Master System ROMs are not supported";
  19. /* Structs */
  20. typedef struct {
  21. char *name;
  22. uint8_t *data;
  23. size_t size;
  24. uint16_t header_location;
  25. uint16_t reported_checksum;
  26. uint16_t expected_checksum;
  27. uint32_t product_code;
  28. uint8_t version;
  29. uint8_t region_code;
  30. uint8_t declared_size;
  31. } ROM;
  32. /* Functions */
  33. const char* rom_open(ROM*, const char*);
  34. void rom_close(ROM*);
  35. const char* rom_product(const ROM*);
  36. const char* rom_region(const ROM*);