diff options
Diffstat (limited to 'mappers/mapper_001_0.c')
| -rw-r--r-- | mappers/mapper_001_0.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/mappers/mapper_001_0.c b/mappers/mapper_001_0.c index 0a03a27..51d22a2 100644 --- a/mappers/mapper_001_0.c +++ b/mappers/mapper_001_0.c @@ -1,7 +1,7 @@ __attribute__((section(".mapper_001_0"))) -static uint8_t mapper_001_0_prg_read(struct nes_state *state, uint32_t addr) { - struct mapper_001_0 *mapper = (struct mapper_001_0 *)&state->map; +static uint8_t mapper_001_0_prg_rom_read(struct nes_state *state, uint32_t addr) { + struct mapper_001_0 *mapper = &state->mapper_data.m001_0; if(addr >= 0x8000) { if(addr < 0xc000) { return mapper->prg_rom_0[addr & 0x3fff]; @@ -13,8 +13,8 @@ static uint8_t mapper_001_0_prg_read(struct nes_state *state, uint32_t addr) { } __attribute__((section(".mapper_001_0"))) -static void mapper_001_0_prg_write(struct nes_state *state, uint32_t addr, uint8_t value) { - struct mapper_001_0 *mapper = (struct mapper_001_0 *)&state->map; +static void mapper_001_0_prg_rom_write(struct nes_state *state, uint32_t addr, uint8_t value) { + struct mapper_001_0 *mapper = &state->mapper_data.m001_0; if(addr < 0x8000) return; if(value & 0x80) { @@ -71,7 +71,7 @@ static void mapper_001_0_prg_write(struct nes_state *state, uint32_t addr, uint8 __attribute__((section(".mapper_001_0"))) static uint8_t mapper_001_0_chr_read(struct nes_state *state, uint32_t addr) { - struct mapper_001_0 *mapper = (struct mapper_001_0 *)&state->map; + struct mapper_001_0 *mapper = &state->mapper_data.m001_0; if(mapper->control & 0x10) { // 4KB mode if(addr < 0x1000) { @@ -103,7 +103,7 @@ static void mapper_001_0_ciram_write(struct nes_state *state, uint32_t addr, uin __attribute__((section(".mapper_001_0"))) static void mapper_001_0_init(struct nes_state *state) { - struct mapper_001_0 *mapper = (struct mapper_001_0 *)&state->map; + struct mapper_001_0 *mapper = &state->mapper_data.m001_0; mapper->control = 0x0c; mapper->prg_rom_0 = state->prg_rom; @@ -112,10 +112,10 @@ static void mapper_001_0_init(struct nes_state *state) { mapper->chr_bank_0 = state->chr_rom; mapper->chr_bank_1 = state->chr_rom + 0x1000; - state->mapper.prg_read = mapper_001_0_prg_read; - state->mapper.prg_write = mapper_001_0_prg_write; - state->mapper.chr_read = mapper_001_0_chr_read; - state->mapper.chr_write = mapper_001_0_chr_write; - state->mapper.ciram_read = mapper_001_0_ciram_read; - state->mapper.ciram_write = mapper_001_0_ciram_write; + state->mapper_function.prg_rom_read = mapper_001_0_prg_rom_read; + state->mapper_function.prg_rom_write = mapper_001_0_prg_rom_write; + state->mapper_function.chr_read = mapper_001_0_chr_read; + state->mapper_function.chr_write = mapper_001_0_chr_write; + state->mapper_function.ciram_read = mapper_001_0_ciram_read; + state->mapper_function.ciram_write = mapper_001_0_ciram_write; } |
