summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/bw2/exp.cpp
blob: c5ee096723222873f66a7518be272fe6712a0042 (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
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
// license:BSD-3-Clause
// copyright-holders:Curt Coder
/**********************************************************************

    Bondwell 2 Expansion Port emulation

**********************************************************************/

#include "emu.h"
#include "exp.h"



//**************************************************************************
//  GLOBAL VARIABLES
//**************************************************************************

DEFINE_DEVICE_TYPE(BW2_EXPANSION_SLOT, bw2_expansion_slot_device, "bw2_expansion_slot", "Bondwell 2 expansion port")



//**************************************************************************
//  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_interface(device, "bw2exp")
{
	m_slot = dynamic_cast<bw2_expansion_slot_device *>(device.owner());
}



//**************************************************************************
//  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_t clock) :
	device_t(mconfig, BW2_EXPANSION_SLOT, tag, owner, clock),
	device_single_card_slot_interface<device_bw2_expansion_slot_interface>(mconfig, *this),
	m_memspace(*this, finder_base::DUMMY_TAG, -1),
	m_card(nullptr),
	m_bank(0)
{
}


//-------------------------------------------------
//  device_start - device-specific startup
//-------------------------------------------------

void bw2_expansion_slot_device::device_start()
{
	m_card = get_card_device();
}


//-------------------------------------------------
//  ram_select - select RAM bank
//-------------------------------------------------

void bw2_expansion_slot_device::ram_select(int bank)
{
	m_bank = bank;

	if (m_card != nullptr)
	{
		m_card->ram_select();
	}
}


// -------------------------------------------------
//  rs232_select - select RS-232 port
//-------------------------------------------------

void bw2_expansion_slot_device::rs232_select(int state)
{
	if (m_card != nullptr)
	{
		m_card->rs232_select(state);
	}
}


//-------------------------------------------------
//  slot_r - slot read
//-------------------------------------------------

u8 bw2_expansion_slot_device::slot_r(offs_t offset)
{
	u8 data = 0xff;

	if (m_card != nullptr)
	{
		data &= m_card->slot_r(offset);
	}

	return data;
}


//-------------------------------------------------
//  slot_w - slot write
//-------------------------------------------------

void bw2_expansion_slot_device::slot_w(offs_t offset, u8 data)
{
	if (m_card != nullptr)
	{
		m_card->slot_w(offset, data);
	}
}


//-------------------------------------------------
//  modsel_r - modem read
//-------------------------------------------------

u8 bw2_expansion_slot_device::modsel_r(offs_t offset)
{
	u8 data = 0xff;

	if (m_card != nullptr)
	{
		data &= m_card->modsel_r(offset);
	}

	return data;
}


//-------------------------------------------------
//  modsel_w - modem write
//-------------------------------------------------

void bw2_expansion_slot_device::modsel_w(offs_t offset, u8 data)
{
	if (m_card != nullptr)
	{
		m_card->modsel_w(offset, data);
	}
}



//-------------------------------------------------
//  SLOT_INTERFACE( bw2_expansion_cards )
//-------------------------------------------------

// slot devices
#include "ramcard.h"

void bw2_expansion_cards(device_slot_interface &device)
{
	device.option_add("ramcard", BW2_RAMCARD);
}