blob: fdb6dbb0e745f91a3951653c296232460027c77f (
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
static void mapper_0007_init(struct nes_state *state) {
state->map.m0007.prg_ptr = state->prg_rom;
state->map.m0007.mirroring = 0;
}
static uint8_t mapper_0007_prg_read(struct nes_state *state, uint32_t addr) {
if(addr >= 0x8000) {
return state->map.m0007.prg_ptr[addr - 0x8000];
}
return 0;
}
static void mapper_0007_prg_write(struct nes_state *state, uint32_t addr, uint8_t value) {
if(addr >= 0x8000) {
state->map.m0007.prg_ptr = state->prg_rom + ((value & 0x07) * 0x8000);
state->map.m0007.mirroring = (value & 0x10) ? 1 : 0;
}
}
static uint8_t mapper_0007_chr_read(struct nes_state *state, uint32_t addr) {
return state->chr_ram[addr];
}
static void mapper_0007_chr_write(struct nes_state *state, uint32_t addr, uint8_t value) {
state->chr_ram[addr] = value;
}
static uint8_t mapper_0007_ciram_read(struct nes_state *state, uint32_t addr) {
if(state->map.m0007.mirroring == 0) {
addr = (addr & 0x800) | (addr & 0x3ff);
} else {
addr = addr & 0x7ff;
}
return state->ciram[addr];
}
static void mapper_0007_ciram_write(struct nes_state *state, uint32_t addr, uint8_t value) {
if(state->map.m0007.mirroring == 0) {
addr = (addr & 0x800) | (addr & 0x3ff);
} else {
addr = addr & 0x7ff;
}
state->ciram[addr] = value;
}
|