From 39715ca6bf65d2e2dd889cdef4b39d584464d9e7 Mon Sep 17 00:00:00 2001 From: Peter Fors Date: Sun, 6 Apr 2025 12:27:12 +0200 Subject: added more mappers (buggy) --- mapper_000b.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 mapper_000b.c (limited to 'mapper_000b.c') diff --git a/mapper_000b.c b/mapper_000b.c new file mode 100644 index 0000000..9252060 --- /dev/null +++ b/mapper_000b.c @@ -0,0 +1,27 @@ + + +static void mapper_000b_init(struct nes_state *state) { + state->map.m000b.prg_ptr = state->prg_rom; + state->map.m000b.chr_ptr = state->chr_rom; +} + +static uint8_t mapper_000b_prg_read(struct nes_state *state, uint32_t addr) { + if(addr >= 0x8000) { + return state->map.m000b.prg_ptr[addr - 0x8000]; + } + return 0; +} + +static void mapper_000b_prg_write(struct nes_state *state, uint32_t addr, uint8_t value) { + if(addr >= 0x8000) { + state->map.m000b.prg_ptr = state->prg_rom + ((value >> 4) & 7) * 0x8000; + state->map.m000b.chr_ptr = state->chr_rom + (value & 0x0F) * 0x2000; + } +} + +static uint8_t mapper_000b_chr_read(struct nes_state *state, uint32_t addr) { + return state->map.m000b.chr_ptr[addr]; +} + +static void mapper_000b_chr_write(struct nes_state *state, uint32_t addr, uint8_t value) { +} -- cgit v1.2.3