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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
|
// license:BSD-3-Clause
// copyright-holders:Curt Coder
/**********************************************************************
Bondwell 2 Expansion Port emulation
Copyright MESS Team.
Visit http://mamedev.org for licensing and usage restrictions.
**********************************************************************/
#include "exp.h"
//**************************************************************************
// GLOBAL VARIABLES
//**************************************************************************
const device_type BW2_EXPANSION_SLOT = &device_creator<bw2_expansion_slot_device>;
//**************************************************************************
// CARD INTERFACE
//**************************************************************************
//-------------------------------------------------
// device_bw2_expansion_slot_interface - constructor
//-------------------------------------------------
device_bw2_expansion_slot_interface::device_bw2_expansion_slot_interface(const machine_config &mconfig, device_t &device)
: device_slot_card_interface(mconfig,device)
{
m_slot = dynamic_cast<bw2_expansion_slot_device *>(device.owner());
}
//-------------------------------------------------
// ~device_bw2_expansion_slot_interface - destructor
//-------------------------------------------------
device_bw2_expansion_slot_interface::~device_bw2_expansion_slot_interface()
{
}
//**************************************************************************
// LIVE DEVICE
//**************************************************************************
//-------------------------------------------------
// bw2_expansion_slot_device - constructor
//-------------------------------------------------
bw2_expansion_slot_device::bw2_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
device_t(mconfig, BW2_EXPANSION_SLOT, "Bondwell 2 expansion port", tag, owner, clock, "bw2_expansion_slot", __FILE__),
device_slot_interface(mconfig, *this)
{
}
//-------------------------------------------------
// bw2_expansion_slot_device - destructor
//-------------------------------------------------
bw2_expansion_slot_device::~bw2_expansion_slot_device()
{
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void bw2_expansion_slot_device::device_start()
{
m_cart = dynamic_cast<device_bw2_expansion_slot_interface *>(get_card_device());
}
//-------------------------------------------------
// device_reset - device-specific reset
//-------------------------------------------------
void bw2_expansion_slot_device::device_reset()
{
if (m_cart != NULL)
{
m_cart->device().reset();
}
}
//-------------------------------------------------
// cd_r - cartridge data read
//-------------------------------------------------
UINT8 bw2_expansion_slot_device::cd_r(address_space &space, offs_t offset, UINT8 data, int ram2, int ram3, int ram4, int ram5, int ram6)
{
if (m_cart != NULL)
{
data = m_cart->bw2_cd_r(space, offset, data, ram2, ram3, ram4, ram5, ram6);
}
return data;
}
//-------------------------------------------------
// cd_w - cartridge data write
//-------------------------------------------------
void bw2_expansion_slot_device::cd_w(address_space &space, offs_t offset, UINT8 data, int ram2, int ram3, int ram4, int ram5, int ram6)
{
if (m_cart != NULL)
{
m_cart->bw2_cd_w(space, offset, data, ram2, ram3, ram4, ram5, ram6);
}
}
//-------------------------------------------------
// slot_r - slot read
//-------------------------------------------------
READ8_MEMBER( bw2_expansion_slot_device::slot_r )
{
UINT8 data = 0xff;
if (m_cart != NULL)
{
data = m_cart->bw2_slot_r(space, offset);
}
return data;
}
//-------------------------------------------------
// slot_w - slot write
//-------------------------------------------------
WRITE8_MEMBER( bw2_expansion_slot_device::slot_w )
{
if (m_cart != NULL)
{
m_cart->bw2_slot_w(space, offset, data);
}
}
//-------------------------------------------------
// modsel_r - modsel read
//-------------------------------------------------
READ8_MEMBER( bw2_expansion_slot_device::modsel_r )
{
UINT8 data = 0xff;
if (m_cart != NULL)
{
data = m_cart->bw2_modsel_r(space, offset);
}
return data;
}
//-------------------------------------------------
// modsel_w - modsel write
//-------------------------------------------------
WRITE8_MEMBER( bw2_expansion_slot_device::modsel_w )
{
if (m_cart != NULL)
{
m_cart->bw2_modsel_w(space, offset, data);
}
}
//-------------------------------------------------
// SLOT_INTERFACE( bw2_expansion_cards )
//-------------------------------------------------
SLOT_INTERFACE_START( bw2_expansion_cards )
SLOT_INTERFACE("ramcard", BW2_RAMCARD)
SLOT_INTERFACE_END
|