summaryrefslogtreecommitdiff
path: root/mapper_0003.c
blob: 743df51d9d5851940dbd95978d36b49a09950f42 (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


static void mapper_0003_init(struct nes_state *state) {
	state->map.m0003.chr_ptr = state->chr_rom;
}

static uint8_t mapper_0003_prg_read(struct nes_state *state, uint32_t addr) {
	if(addr >= 0x8000) {
		return state->prg_rom[addr - 0x8000];
	}
	return 0;
}

static void mapper_0003_prg_write(struct nes_state *state, uint32_t addr, uint8_t value) {
	if(addr >= 0x8000) {
		state->map.m0003.chr_ptr = state->chr_rom + (value & 3) * 0x2000;
	}
}

static uint8_t mapper_0003_chr_read(struct nes_state *state, uint32_t addr) {
	return state->map.m0003.chr_ptr[addr];
}

static void mapper_0003_chr_write(struct nes_state *state, uint32_t addr, uint8_t value) {
}