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.
 
 
 
 
 

33 lines
837 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. #pragma once
  4. #include <stdbool.h>
  5. #include <stddef.h>
  6. #include <stdint.h>
  7. #define MMU_NUM_SLOTS (3)
  8. #define MMU_NUM_ROM_BANKS (64)
  9. #define MMU_ROM_BANK_SIZE (16 * 1024)
  10. #define MMU_SYSTEM_RAM_SIZE (8 * 1024)
  11. /* Structs */
  12. typedef struct {
  13. uint8_t *system_ram;
  14. const uint8_t *map_slots[MMU_NUM_SLOTS];
  15. const uint8_t *rom_banks[MMU_NUM_ROM_BANKS];
  16. } MMU;
  17. /* Functions */
  18. void mmu_init(MMU*);
  19. void mmu_free(MMU*);
  20. void mmu_load_rom(MMU*, const uint8_t*, size_t);
  21. void mmu_power(MMU*);
  22. uint8_t mmu_read_byte(const MMU*, uint16_t);
  23. uint16_t mmu_read_double(const MMU*, uint16_t);
  24. uint32_t mmu_read_quad(const MMU*, uint16_t);
  25. bool mmu_write_byte(MMU*, uint16_t, uint8_t);