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


SLOT_INTERFACE_EXTERN(msx_cart);


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

	// 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 sram_alloc(UINT32 size);

	UINT8* get_rom_base() { return m_rom; }
	UINT8* get_ram_base() { return m_ram; }
	UINT8* get_sram_base() { return m_sram; }
	UINT32 get_rom_size() { return m_rom.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_sram;
};


#endif