summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/bus/nes/mmc5.h
blob: cd15c58d81780c87d05e81f9b8eaf47fe038f81c (plain) (blame)
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#ifndef __NES_MMC5_H
#define __NES_MMC5_H

#include "nxrom.h"


// ======================> nes_exrom_device

class nes_exrom_device : public nes_nrom_device
{
public:
	// construction/destruction
	nes_exrom_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);

	// device-level overrides
	virtual void device_start();
	virtual DECLARE_READ8_MEMBER(read_l);
	virtual DECLARE_READ8_MEMBER(read_m);
	virtual DECLARE_WRITE8_MEMBER(write_l);
	virtual DECLARE_WRITE8_MEMBER(write_m);
	virtual DECLARE_WRITE8_MEMBER(write_h);

	virtual DECLARE_READ8_MEMBER(chr_r);
	virtual DECLARE_READ8_MEMBER(nt_r);
	virtual DECLARE_WRITE8_MEMBER(nt_w);

	virtual void hblank_irq(int scanline, int vblank, int blanked);
	virtual void pcb_reset();

protected:
	void set_mirror(int page, int src);
	void prgram_bank8_x(int start, int bank);
	void update_render_mode();
	void update_prg();

	inline UINT8 base_chr_r(int bank, UINT32 offset);
	inline UINT8 split_chr_r(UINT32 offset);
	inline UINT8 bg_ex1_chr_r(UINT32 offset);
	inline bool in_split();

	UINT16     m_irq_count;
	UINT8      m_irq_status;
	int        m_irq_enable;

	int        m_mult1, m_mult2;

	int m_mmc5_scanline;
	int m_vrom_page_a;
	int m_vrom_page_b;
	UINT16 m_vrom_bank[12];            // MMC5 has 10bit wide VROM regs!

	int m_floodtile;
	int m_floodattr;

	int m_prg_mode;     // $5100
	int m_chr_mode;     // $5101
	int m_wram_protect_1;   // $5102
	int m_wram_protect_2;   // $5103
	int m_exram_control;    // $5104
	int m_wram_base;    // $5113

	UINT8 m_last_chr;
	UINT8 m_ex1_chr;
	UINT8 m_split_chr;
	UINT8 m_prg_regs[4];
	UINT8 m_prg_ram_mapped[4];

	UINT8 m_ex1_bank;
	
	UINT8 m_high_chr;   // $5130

	UINT8 m_split_scr;  // $5200
	UINT8 m_split_rev;  // $5200
	UINT8 m_split_ctrl; // $5200
	UINT8 m_split_yst;  // $5201
	UINT8 m_split_bank; // $5202
	int m_vcount;

	// MMC-5 contains 1K of internal ram
	UINT8 m_exram[0x400];

	//  int m_nes_vram_sprite[8];
};



// device type definition
extern const device_type NES_EXROM;

#endif