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_002_2.c | |
| parent | a8e0c141b0184d629504b9f0ee8dbc4fefb90934 (diff) | |
renaming
Diffstat (limited to 'mappers/mapper_002_2.c')
| -rw-r--r-- | mappers/mapper_002_2.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/mappers/mapper_002_2.c b/mappers/mapper_002_2.c index 4dbea85..e6cddf7 100644 --- a/mappers/mapper_002_2.c +++ b/mappers/mapper_002_2.c @@ -1,8 +1,9 @@ __attribute__((section(".mapper_002_2"))) -static uint8_t mapper_002_2_prg_read(struct nes_state *state, uint32_t addr) { - struct mapper_002_2 *mapper = (struct mapper_002_2 *)&state->map; +static uint8_t mapper_002_2_prg_rom_read(struct nes_state *state, uint32_t addr) { + struct mapper_002_2 *mapper = &state->mapper_data.m002_2; + if(addr >= 0x8000 && addr < 0xc000) { return mapper->prg_bank0[addr & 0x3fff]; @@ -14,8 +15,8 @@ static uint8_t mapper_002_2_prg_read(struct nes_state *state, uint32_t addr) { } __attribute__((section(".mapper_002_2"))) -static void mapper_002_2_prg_write(struct nes_state *state, uint32_t addr, uint8_t value) { - struct mapper_002_2 *mapper = (struct mapper_002_2 *)&state->map; +static void mapper_002_2_prg_rom_write(struct nes_state *state, uint32_t addr, uint8_t value) { + struct mapper_002_2 *mapper = &state->mapper_data.m002_2; if(addr >= 0x8000) { mapper->prg_bank0 = state->prg_rom + ((value & 0x0f) * 0x4000); @@ -34,13 +35,13 @@ static void mapper_002_2_chr_write(struct nes_state *state, uint32_t addr, uint8 __attribute__((section(".mapper_002_2"))) static void mapper_002_2_init(struct nes_state *state) { - struct mapper_002_2 *mapper = (struct mapper_002_2 *)&state->map; + struct mapper_002_2 *mapper = &state->mapper_data.m002_2; mapper->prg_bank0 = state->prg_rom; mapper->prg_bank1 = state->prg_rom + state->ines.prg_size - 0x4000; - state->mapper.prg_read = mapper_002_2_prg_read; - state->mapper.prg_write = mapper_002_2_prg_write; - state->mapper.chr_read = mapper_002_2_chr_read; - state->mapper.chr_write = mapper_002_2_chr_write; + state->mapper_function.prg_rom_read = mapper_002_2_prg_rom_read; + state->mapper_function.prg_rom_write = mapper_002_2_prg_rom_write; + state->mapper_function.chr_read = mapper_002_2_chr_read; + state->mapper_function.chr_write = mapper_002_2_chr_write; } |
