From 7cca3bdbec289328b537c8256b43dcfedc5d56b8 Mon Sep 17 00:00:00 2001 From: Peter Fors Date: Tue, 27 May 2025 15:03:30 +0200 Subject: renaming --- mappers/mapper_007_2.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'mappers/mapper_007_2.c') diff --git a/mappers/mapper_007_2.c b/mappers/mapper_007_2.c index c42bc62..7f5963f 100644 --- a/mappers/mapper_007_2.c +++ b/mappers/mapper_007_2.c @@ -1,7 +1,8 @@ __attribute__((section(".mapper_007_2"))) -static uint8_t mapper_007_2_prg_read(struct nes_state *state, uint32_t addr) { - struct mapper_007_2 *mapper = (struct mapper_007_2 *)&state->map; +static uint8_t mapper_007_2_prg_rom_read(struct nes_state *state, uint32_t addr) { + struct mapper_007_2 *mapper = &state->mapper_data.m007_2; + if(addr >= 0x8000) { return mapper->prg_rom[addr & 0x7fff]; } @@ -9,8 +10,8 @@ static uint8_t mapper_007_2_prg_read(struct nes_state *state, uint32_t addr) { } __attribute__((section(".mapper_007_2"))) -static void mapper_007_2_prg_write(struct nes_state *state, uint32_t addr, uint8_t value) { - struct mapper_007_2 *mapper = (struct mapper_007_2 *)&state->map; +static void mapper_007_2_prg_rom_write(struct nes_state *state, uint32_t addr, uint8_t value) { + struct mapper_007_2 *mapper = &state->mapper_data.m007_2; if(addr >= 0x8000) { uint32_t prg_off = (value & 0x0f) << 15; uint32_t ciram_off = (value & 0x10) << 11; @@ -34,26 +35,26 @@ static void mapper_007_2_chr_write(struct nes_state *state, uint32_t addr, uint8 __attribute__((section(".mapper_007_2"))) static uint8_t mapper_007_2_ciram_read(struct nes_state *state, uint32_t addr) { - struct mapper_007_2 *mapper = (struct mapper_007_2 *)&state->map; + struct mapper_007_2 *mapper = &state->mapper_data.m007_2; return mapper->ciram[addr & 0x3ff]; } __attribute__((section(".mapper_007_2"))) static void mapper_007_2_ciram_write(struct nes_state *state, uint32_t addr, uint8_t value) { - struct mapper_007_2 *mapper = (struct mapper_007_2 *)&state->map; + struct mapper_007_2 *mapper = &state->mapper_data.m007_2; mapper->ciram[addr & 0x3ff] = value; } __attribute__((section(".mapper_007_2"))) static void mapper_007_2_init(struct nes_state *state) { - struct mapper_007_2 *mapper = (struct mapper_007_2 *)&state->map; + struct mapper_007_2 *mapper = &state->mapper_data.m007_2; mapper->prg_rom = state->prg_rom; mapper->ciram = 0; - state->mapper.prg_read = mapper_007_2_prg_read; - state->mapper.prg_write = mapper_007_2_prg_write; - state->mapper.chr_read = mapper_007_2_chr_read; - state->mapper.chr_write = mapper_007_2_chr_write; - state->mapper.ciram_read = mapper_007_2_ciram_read; - state->mapper.ciram_write = mapper_007_2_ciram_write; + state->mapper_function.prg_rom_read = mapper_007_2_prg_rom_read; + state->mapper_function.prg_rom_write = mapper_007_2_prg_rom_write; + state->mapper_function.chr_read = mapper_007_2_chr_read; + state->mapper_function.chr_write = mapper_007_2_chr_write; + state->mapper_function.ciram_read = mapper_007_2_ciram_read; + state->mapper_function.ciram_write = mapper_007_2_ciram_write; } -- cgit v1.2.3