blob: 700a24bdf67961e00937f81fc5c58c24fac91bff (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
static void mapper_2002_init(struct nes_state *state) {
state->map.m2002.prg_bank0 = state->prg_rom; // default to bank 0
state->map.m2002.prg_bank1 = state->prg_rom + state->ines.prg_size - 0x4000;
}
static uint8_t mapper_2002_prg_read(struct nes_state *state, uint32_t addr) {
if(addr >= 0x8000 && addr < 0xc000) {
return state->map.m2002.prg_bank0[addr & 0x3fff];
} else if(addr >= 0xc000) {
return state->map.m2002.prg_bank1[addr & 0x3fff];
}
return 0;
}
static void mapper_2002_prg_write(struct nes_state *state, uint32_t addr, uint8_t value) {
if(addr >= 0x8000) {
state->map.m2002.prg_bank0 = state->prg_rom + ((value & 0x0f) * 0x4000);
}
}
static uint8_t mapper_2002_chr_read(struct nes_state *state, uint32_t addr) {
return state->chr_ram[addr];
}
static void mapper_2002_chr_write(struct nes_state *state, uint32_t addr, uint8_t value) {
state->chr_ram[addr] = value;
}
|