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.
 
 
 
 
 

57 lignes
1.4 KiB

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