summaryrefslogtreecommitdiffstatshomepage
path: root/src/mess/machine/md_sk.c
blob: e2b38b7da47035e3fb387b2bf13f9603fd4b80cc (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
91
92
93
/***********************************************************************************************************
 
 
 Sonic & Knuckles pass-thorugh cart emulation

 
 TODO: currently we only support loading of base carts with no bankswitch or protection...
       shall we support other as well?
 
 
 ***********************************************************************************************************/




#include "emu.h"
#include "machine/md_sk.h"
#include "machine/md_rom.h"


//-------------------------------------------------
//  md_rom_device - constructor
//-------------------------------------------------

const device_type MD_ROM_SK = &device_creator<md_rom_sk_device>;


md_rom_sk_device::md_rom_sk_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock)
					: device_t(mconfig, type, name, tag, owner, clock),
						device_md_cart_interface( mconfig, *this ),
						m_exp(*this, "subslot")
{
}

md_rom_sk_device::md_rom_sk_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
					: device_t(mconfig, MD_ROM_SK, "MD Sonic & Knuckles", tag, owner, clock),
						device_md_cart_interface( mconfig, *this ),
						m_exp(*this, "subslot")
{
}


void md_rom_sk_device::device_start()
{
}

/*-------------------------------------------------
 mapper specific handlers
 -------------------------------------------------*/

READ16_MEMBER(md_rom_sk_device::read)
{
	if (m_exp->m_cart != NULL && m_exp->m_cart->get_rom_base() != NULL && offset >= 0x200000/2 && offset < (0x200000 + m_exp->m_cart->get_rom_size())/2)
		return m_exp->m_cart->m_rom[offset - 0x200000/2];
	if (offset < 0x400000/2) 
		return m_rom[MD_ADDR(offset)]; 
	else 
		return 0xffff;
}

WRITE16_MEMBER(md_rom_sk_device::write)
{
// should there be anything here?
}

//-------------------------------------------------
//  MACHINE_CONFIG_FRAGMENT( sk_slot )
//-------------------------------------------------

static SLOT_INTERFACE_START(sk_sub_cart)
	SLOT_INTERFACE_INTERNAL("rom",  MD_STD_ROM)
	SLOT_INTERFACE_INTERNAL("rom_svp",  MD_STD_ROM)
	SLOT_INTERFACE_INTERNAL("rom_sram",  MD_ROM_SRAM)
	SLOT_INTERFACE_INTERNAL("rom_sramsafe",  MD_ROM_SRAM)
	SLOT_INTERFACE_INTERNAL("rom_fram",  MD_ROM_FRAM)
// add all types??
SLOT_INTERFACE_END

static MACHINE_CONFIG_FRAGMENT( sk_slot )
	MCFG_MDSUB_CARTRIDGE_ADD("subslot", sk_sub_cart, NULL, NULL)
MACHINE_CONFIG_END


//-------------------------------------------------
//  machine_config_additions - device-specific
//  machine configurations
//-------------------------------------------------

machine_config_constructor md_rom_sk_device::device_mconfig_additions() const
{
	return MACHINE_CONFIG_NAME( sk_slot );
}