An emulator, assembler, and disassembler for the Sega Game Gear
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 
 

45 строки
1.1 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. /* Structs */
  19. typedef struct {
  20. char *name;
  21. uint8_t *data;
  22. size_t size;
  23. uint16_t reported_checksum;
  24. uint16_t expected_checksum;
  25. uint32_t product_code;
  26. uint8_t version;
  27. uint8_t region_code;
  28. } ROM;
  29. /* Functions */
  30. const char* rom_open(ROM**, const char*);
  31. void rom_close(ROM*);
  32. const char* rom_region(const ROM*);