blob: 7a2b542293e2cf3d7b8989734499bb427ae422c0 (
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
48
49
50
51
52
53
54
55
56
57
58
|
static void mapper_066_init(struct nes_state *state) {
state->map.m066.prg_offset = 0;
state->map.m066.chr_offset = 0;
}
static uint8_t mapper_066_prg_read(struct nes_state *state, uint32_t addr) {
if(addr >= 0x8000) {
uint32_t base = state->map.m066.prg_offset;
return state->prg_rom[base + (addr - 0x8000)];
}
return 0;
}
static void mapper_066_prg_write(struct nes_state *state, uint32_t addr, uint8_t value) {
if(addr >= 0x8000) {
uint32_t prg_bank = (value >> 4) & 3;
uint32_t chr_bank = (value >> 0) & 3;
state->map.m066.prg_offset = prg_bank * 0x8000;
state->map.m066.chr_offset = chr_bank * 0x2000;
}
}
static uint8_t mapper_066_chr_read(struct nes_state *state, uint32_t addr) {
return state->chr_rom[state->map.m066.chr_offset + addr];
}
static void mapper_066_chr_write(struct nes_state *state, uint32_t addr, uint8_t value) {
}
static uint8_t mapper_066_ciram_read(struct nes_state *state, uint32_t addr) {
uint32_t mirrored = addr & 0x0fff;
if(state->ines.mirroring == 0) { // Horizontal
mirrored = (mirrored & 0x800) | (mirrored & 0x3ff);
} else { // Vertical (default fallback)
mirrored = mirrored & 0x7ff;
}
return state->ciram[mirrored];
}
static void mapper_066_ciram_write(struct nes_state *state, uint32_t addr, uint8_t value) {
uint32_t mirrored = addr & 0x0fff;
if(state->ines.mirroring == 0) {
mirrored = (mirrored & 0x800) | (mirrored & 0x3ff);
} else {
mirrored = mirrored & 0x7ff;
}
state->ciram[mirrored] = value;
}
static void mapper_066_tick(struct nes_state *state) {
// No IRQ or timing logic needed
}
|