From 971e51eebbf088f1ac590da1fc57e803eb1ee8cf Mon Sep 17 00:00:00 2001 From: Peter Fors Date: Wed, 2 Apr 2025 13:17:35 +0200 Subject: add mapper #66 (GXROM) --- mapper_gxrom.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 mapper_gxrom.c (limited to 'mapper_gxrom.c') diff --git a/mapper_gxrom.c b/mapper_gxrom.c new file mode 100644 index 0000000..e03f9d2 --- /dev/null +++ b/mapper_gxrom.c @@ -0,0 +1,27 @@ + +static void mapper_66_init(struct nes_state *state) { + state->map.gxrom.prg_offset = 0; + state->map.gxrom.chr_offset = 0; +} + +static uint8_t mapper_66_read(struct nes_state *state, uint32_t addr) { + if(addr >= 0x8000) { + uint32_t base = state->map.gxrom.prg_offset; + return state->rom[base + (addr - 0x8000)]; + } + return 0; +} + +static void mapper_66_write(struct nes_state *state, uint32_t addr, uint8_t value) { + if(addr >= 0x8000) { + uint32_t prg_bank = (value >> 4) & 3; + uint32_t chr_bank = (value >> 0) & 3; + + state->map.gxrom.prg_offset = prg_bank * 0x8000; + state->map.gxrom.chr_offset = chr_bank * 0x2000; + } +} + +static void mapper_66_tick(struct nes_state *state) { + // No IRQ or timing logic needed +} -- cgit v1.2.3