diff options
| author | Peter Fors <peter.fors@mindkiller.com> | 2025-05-27 15:03:30 +0200 |
|---|---|---|
| committer | Peter Fors <peter.fors@mindkiller.com> | 2025-05-27 15:03:30 +0200 |
| commit | 7cca3bdbec289328b537c8256b43dcfedc5d56b8 (patch) | |
| tree | 181c22764d3d881ccd41d5c0282cd364d3f5197d /mappers/mapper_007_2.c | |
| parent | a8e0c141b0184d629504b9f0ee8dbc4fefb90934 (diff) | |
renaming
Diffstat (limited to 'mappers/mapper_007_2.c')
| -rw-r--r-- | mappers/mapper_007_2.c | 27 |
1 files changed, 14 insertions, 13 deletions
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; } |
