NESe (pronounced "Nessie") is a NES emulator based on the e6502 emulator, also written in C with a focus on speed and portability for use on embedded platforms, especially ARM.
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.

42 lines
1.1KB

  1. #ifndef NESE_MAPPER_H_
  2. #define NESE_MAPPER_H_
  3. #include <stdbool.h>
  4. #include "ines.h"
  5. struct nes_Memory;
  6. struct nes_Mapper {
  7. const char* name;
  8. int max_chr_banks;
  9. int data_size;
  10. void* data;
  11. int (*init)(struct nes_Mapper*, const ines_Header*, struct nes_Memory*);
  12. void (*done)(struct nes_Mapper*);
  13. void (*reset)(struct nes_Mapper*, struct nes_Memory*);
  14. int (*write_rom)(struct nes_Mapper*, struct nes_Memory*, uint16_t addr, uint8_t val);
  15. int (*write_sram)(struct nes_Mapper*, struct nes_Memory*, uint16_t addr, uint8_t val);
  16. int (*write_apu)(struct nes_Mapper*, struct nes_Memory*, uint16_t addr, uint8_t val);
  17. uint8_t (*read_apu)(struct nes_Mapper*, struct nes_Memory*, uint16_t addr);
  18. int (*hsync)(struct nes_Mapper*);
  19. int (*vsync)(struct nes_Mapper*);
  20. void (*ppu_bus)(struct nes_Mapper*, uint16_t addr);
  21. void (*ppu_mem_mode)(struct nes_Mapper*, uint8_t mode);
  22. void* irq_arg;
  23. void (*irq_callback)(void* irq_arg, bool enable);
  24. };
  25. typedef struct nes_Mapper nes_Mapper;
  26. extern const nes_Mapper* nes_mappers[256];
  27. #endif // NESE_MAPPER_H_