An emulator, assembler, and disassembler for the Sega Game Gear
25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
 
 
 
 
 

42 satır
1.1 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 <stdbool.h>
  5. #include <stddef.h>
  6. #include <stdint.h>
  7. #include "save.h"
  8. #define MMU_NUM_SLOTS (3)
  9. #define MMU_NUM_ROM_BANKS (64)
  10. #define MMU_ROM_BANK_SIZE (16 * 1024)
  11. #define MMU_SYSTEM_RAM_SIZE ( 8 * 1024)
  12. #define MMU_CART_RAM_SIZE (32 * 1024)
  13. /* Structs */
  14. typedef struct {
  15. uint8_t *system_ram;
  16. uint8_t *cart_ram;
  17. const uint8_t *rom_slots[MMU_NUM_SLOTS];
  18. const uint8_t *rom_banks[MMU_NUM_ROM_BANKS];
  19. uint8_t *cart_ram_slot;
  20. bool cart_ram_mapped, cart_ram_external;
  21. Save *save;
  22. } MMU;
  23. /* Functions */
  24. void mmu_init(MMU*);
  25. void mmu_free(MMU*);
  26. void mmu_load_rom(MMU*, const uint8_t*, size_t);
  27. void mmu_load_save(MMU*, Save*);
  28. void mmu_power(MMU*);
  29. uint8_t mmu_read_byte(const MMU*, uint16_t);
  30. uint16_t mmu_read_double(const MMU*, uint16_t);
  31. uint32_t mmu_read_quad(const MMU*, uint16_t);
  32. bool mmu_write_byte(MMU*, uint16_t, uint8_t);
  33. bool mmu_write_double(MMU*, uint16_t, uint16_t);