summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/bus/msx_cart/cartridge.h
blob: ebaee3f6e56d64e9e6f56d649b1496d052b9bd1e (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
#ifndef __MSX_CART_CARTRIDGE_H
#define __MSX_CART_CARTRIDGE_H


SLOT_INTERFACE_EXTERN(msx_cart);
SLOT_INTERFACE_EXTERN(msx_yamaha_60pin);   // 60 pin expansion slots as found in yamaha machines


class msx_cart_interface : public device_slot_card_interface
{
public:
	msx_cart_interface(const machine_config &mconfig, device_t &device);

	template<class _Object> void set_out_irq_cb(_Object object) { m_out_irq_cb.set_callback(object); m_out_irq_cb.resolve_safe(); }

	// This is called after loading cartridge contents and allows the cartridge
	// implementation to perform some additional initialization based on the
	// cartridge contents.
	virtual void initialize_cartridge() {}

	// reading and writing
	virtual DECLARE_READ8_MEMBER(read_cart) { return 0xff; }
	virtual DECLARE_WRITE8_MEMBER(write_cart) {}

	// ROM/RAM/SRAM management
	// Mainly used by the cartridge slot when loading images
	void rom_alloc(UINT32 size);
	void ram_alloc(UINT32 size);
	void rom_vlm5030_alloc(UINT32 size);
	void sram_alloc(UINT32 size);

	UINT8* get_rom_base() { return m_rom; }
	UINT8* get_rom_vlm5030_base() { return m_rom_vlm5030; }
	UINT8* get_ram_base() { return m_ram; }
	UINT8* get_sram_base() { return m_sram; }
	UINT32 get_rom_size() { return m_rom.count(); }
	UINT32 get_rom_vlm5030_size() { return m_rom_vlm5030.count(); }
	UINT32 get_ram_size() { return m_ram.count(); }
	UINT32 get_sram_size() { return m_sram.count(); }

protected:
	dynamic_buffer m_rom;
	dynamic_buffer m_ram;
	dynamic_buffer m_rom_vlm5030;
	dynamic_buffer m_sram;
	devcb_write_line m_out_irq_cb;
};


#endif