summaryrefslogtreecommitdiff
path: root/mapper.h
blob: 73fafc0a1602ff18d8d5d75feafdec286bd5aeec (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

// #include "mapper_0000.h"	// NOTE(peter): Has no header
#include "mapper_0003.h"
#include "mapper_0007.h"
#include "mapper_000b.h"
#include "mapper_0042.h"
#include "mapper_2002.h"

struct nes_state;

struct mapper_entry {
	uint64_t	id;
	uint8_t	(*prg_read)(struct nes_state *state, uint32_t addr);
	void		(*prg_write)(struct nes_state *state, uint32_t addr, uint8_t value);
	uint8_t	(*chr_read)(struct nes_state *state, uint32_t addr);
	void		(*chr_write)(struct nes_state *state, uint32_t addr, uint8_t value);
	uint8_t	(*ciram_read)(struct nes_state *state, uint32_t addr);
	void		(*ciram_write)(struct nes_state *state, uint32_t addr, uint8_t value);
	void		(*tick)(struct nes_state *state);
	void		(*init)(struct nes_state *state);
};

union mapper_data {
	struct mapper_0003 m0003;
	struct mapper_0007 m0007;
	struct mapper_000b m000b;
	struct mapper_0042 m0042;
	struct mapper_2002 m2002;
};