summaryrefslogtreecommitdiffstats
path: root/src/emu/devcb.cpp
blob: 75e43ad606ed2ed721bc4478f6bb7a5e3410e6c9 (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
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
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
// license:BSD-3-Clause
// copyright-holders:Vas Crabb
/***************************************************************************

    devcb.cpp

    Device callback interface helpers.

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

#include "emu.h"
#include "devcb.h"

template class devcb_read<u8>;
template class devcb_read<u16>;
template class devcb_read<u32>;
template class devcb_read<u64>;
template class devcb_read<int, 1U>;

template class devcb_read8::delegate_builder<read8_delegate>;
template class devcb_read8::delegate_builder<read16_delegate>;
template class devcb_read8::delegate_builder<read32_delegate>;
template class devcb_read8::delegate_builder<read64_delegate>;
template class devcb_read8::delegate_builder<read_line_delegate>;

template class devcb_read16::delegate_builder<read8_delegate>;
template class devcb_read16::delegate_builder<read16_delegate>;
template class devcb_read16::delegate_builder<read32_delegate>;
template class devcb_read16::delegate_builder<read64_delegate>;
template class devcb_read16::delegate_builder<read_line_delegate>;

template class devcb_read32::delegate_builder<read8_delegate>;
template class devcb_read32::delegate_builder<read16_delegate>;
template class devcb_read32::delegate_builder<read32_delegate>;
template class devcb_read32::delegate_builder<read64_delegate>;
template class devcb_read32::delegate_builder<read_line_delegate>;

template class devcb_read64::delegate_builder<read8_delegate>;
template class devcb_read64::delegate_builder<read16_delegate>;
template class devcb_read64::delegate_builder<read32_delegate>;
template class devcb_read64::delegate_builder<read64_delegate>;
template class devcb_read64::delegate_builder<read_line_delegate>;

template class devcb_read_line::delegate_builder<read8_delegate>;
template class devcb_read_line::delegate_builder<read16_delegate>;
template class devcb_read_line::delegate_builder<read32_delegate>;
template class devcb_read_line::delegate_builder<read64_delegate>;
template class devcb_read_line::delegate_builder<read_line_delegate>;

template class devcb_read8::creator_impl<devcb_read8::delegate_builder<read8_delegate> >;
template class devcb_read8::creator_impl<devcb_read8::delegate_builder<read16_delegate> >;
template class devcb_read8::creator_impl<devcb_read8::delegate_builder<read32_delegate> >;
template class devcb_read8::creator_impl<devcb_read8::delegate_builder<read64_delegate> >;
template class devcb_read8::creator_impl<devcb_read8::delegate_builder<read_line_delegate> >;
template class devcb_read8::creator_impl<devcb_read8::ioport_builder>;

template class devcb_read16::creator_impl<devcb_read16::delegate_builder<read8_delegate> >;
template class devcb_read16::creator_impl<devcb_read16::delegate_builder<read16_delegate> >;
template class devcb_read16::creator_impl<devcb_read16::delegate_builder<read32_delegate> >;
template class devcb_read16::creator_impl<devcb_read16::delegate_builder<read64_delegate> >;
template class devcb_read16::creator_impl<devcb_read16::delegate_builder<read_line_delegate> >;
template class devcb_read16::creator_impl<devcb_read16::ioport_builder>;

template class devcb_read32::creator_impl<devcb_read32::delegate_builder<read8_delegate> >;
template class devcb_read32::creator_impl<devcb_read32::delegate_builder<read16_delegate> >;
template class devcb_read32::creator_impl<devcb_read32::delegate_builder<read32_delegate> >;
template class devcb_read32::creator_impl<devcb_read32::delegate_builder<read64_delegate> >;
template class devcb_read32::creator_impl<devcb_read32::delegate_builder<read_line_delegate> >;
template class devcb_read32::creator_impl<devcb_read32::ioport_builder>;

template class devcb_read64::creator_impl<devcb_read64::delegate_builder<read8_delegate> >;
template class devcb_read64::creator_impl<devcb_read64::delegate_builder<read16_delegate> >;
template class devcb_read64::creator_impl<devcb_read64::delegate_builder<read32_delegate> >;
template class devcb_read64::creator_impl<devcb_read64::delegate_builder<read64_delegate> >;
template class devcb_read64::creator_impl<devcb_read64::delegate_builder<read_line_delegate> >;
template class devcb_read64::creator_impl<devcb_read64::ioport_builder>;

template class devcb_read_line::creator_impl<devcb_read_line::delegate_builder<read8_delegate> >;
template class devcb_read_line::creator_impl<devcb_read_line::delegate_builder<read16_delegate> >;
template class devcb_read_line::creator_impl<devcb_read_line::delegate_builder<read32_delegate> >;
template class devcb_read_line::creator_impl<devcb_read_line::delegate_builder<read64_delegate> >;
template class devcb_read_line::creator_impl<devcb_read_line::delegate_builder<read_line_delegate> >;
template class devcb_read_line::creator_impl<devcb_read_line::ioport_builder>;

template class devcb_write<u8>;
template class devcb_write<u16>;
template class devcb_write<u32>;
template class devcb_write<u64>;
template class devcb_write<int, 1U>;

template class devcb_write8::delegate_builder<write8_delegate>;
template class devcb_write8::delegate_builder<write16_delegate>;
template class devcb_write8::delegate_builder<write32_delegate>;
template class devcb_write8::delegate_builder<write64_delegate>;
template class devcb_write8::delegate_builder<write_line_delegate>;

template class devcb_write16::delegate_builder<write8_delegate>;
template class devcb_write16::delegate_builder<write16_delegate>;
template class devcb_write16::delegate_builder<write32_delegate>;
template class devcb_write16::delegate_builder<write64_delegate>;
template class devcb_write16::delegate_builder<write_line_delegate>;

template class devcb_write32::delegate_builder<write8_delegate>;
template class devcb_write32::delegate_builder<write16_delegate>;
template class devcb_write32::delegate_builder<write32_delegate>;
template class devcb_write32::delegate_builder<write64_delegate>;
template class devcb_write32::delegate_builder<write_line_delegate>;

template class devcb_write64::delegate_builder<write8_delegate>;
template class devcb_write64::delegate_builder<write16_delegate>;
template class devcb_write64::delegate_builder<write32_delegate>;
template class devcb_write64::delegate_builder<write64_delegate>;
template class devcb_write64::delegate_builder<write_line_delegate>;

template class devcb_write_line::delegate_builder<write8_delegate>;
template class devcb_write_line::delegate_builder<write16_delegate>;
template class devcb_write_line::delegate_builder<write32_delegate>;
template class devcb_write_line::delegate_builder<write64_delegate>;
template class devcb_write_line::delegate_builder<write_line_delegate>;

template class devcb_write8::creator_impl<devcb_write8::delegate_builder<write8_delegate> >;
template class devcb_write8::creator_impl<devcb_write8::delegate_builder<write16_delegate> >;
template class devcb_write8::creator_impl<devcb_write8::delegate_builder<write32_delegate> >;
template class devcb_write8::creator_impl<devcb_write8::delegate_builder<write64_delegate> >;
template class devcb_write8::creator_impl<devcb_write8::delegate_builder<write_line_delegate> >;
template class devcb_write8::creator_impl<devcb_write8::inputline_builder>;
template class devcb_write8::creator_impl<devcb_write8::latched_inputline_builder>;
template class devcb_write8::creator_impl<devcb_write8::ioport_builder>;
template class devcb_write8::creator_impl<devcb_write8::membank_builder>;
template class devcb_write8::creator_impl<devcb_write8::output_builder>;
template class devcb_write8::creator_impl<devcb_write8::log_builder>;

template class devcb_write16::creator_impl<devcb_write16::delegate_builder<write8_delegate> >;
template class devcb_write16::creator_impl<devcb_write16::delegate_builder<write16_delegate> >;
template class devcb_write16::creator_impl<devcb_write16::delegate_builder<write32_delegate> >;
template class devcb_write16::creator_impl<devcb_write16::delegate_builder<write64_delegate> >;
template class devcb_write16::creator_impl<devcb_write16::delegate_builder<write_line_delegate> >;
template class devcb_write16::creator_impl<devcb_write16::inputline_builder>;
template class devcb_write16::creator_impl<devcb_write16::latched_inputline_builder>;
template class devcb_write16::creator_impl<devcb_write16::ioport_builder>;
template class devcb_write16::creator_impl<devcb_write16::membank_builder>;
template class devcb_write16::creator_impl<devcb_write16::output_builder>;
template class devcb_write16::creator_impl<devcb_write16::log_builder>;

template class devcb_write32::creator_impl<devcb_write32::delegate_builder<write8_delegate> >;
template class devcb_write32::creator_impl<devcb_write32::delegate_builder<write16_delegate> >;
template class devcb_write32::creator_impl<devcb_write32::delegate_builder<write32_delegate> >;
template class devcb_write32::creator_impl<devcb_write32::delegate_builder<write64_delegate> >;
template class devcb_write32::creator_impl<devcb_write32::delegate_builder<write_line_delegate> >;
template class devcb_write32::creator_impl<devcb_write32::inputline_builder>;
template class devcb_write32::creator_impl<devcb_write32::latched_inputline_builder>;
template class devcb_write32::creator_impl<devcb_write32::ioport_builder>;
template class devcb_write32::creator_impl<devcb_write32::membank_builder>;
template class devcb_write32::creator_impl<devcb_write32::output_builder>;
template class devcb_write32::creator_impl<devcb_write32::log_builder>;

template class devcb_write64::creator_impl<devcb_write64::delegate_builder<write8_delegate> >;
template class devcb_write64::creator_impl<devcb_write64::delegate_builder<write16_delegate> >;
template class devcb_write64::creator_impl<devcb_write64::delegate_builder<write32_delegate> >;
template class devcb_write64::creator_impl<devcb_write64::delegate_builder<write64_delegate> >;
template class devcb_write64::creator_impl<devcb_write64::delegate_builder<write_line_delegate> >;
template class devcb_write64::creator_impl<devcb_write64::inputline_builder>;
template class devcb_write64::creator_impl<devcb_write64::latched_inputline_builder>;
template class devcb_write64::creator_impl<devcb_write64::ioport_builder>;
template class devcb_write64::creator_impl<devcb_write64::membank_builder>;
template class devcb_write64::creator_impl<devcb_write64::output_builder>;
template class devcb_write64::creator_impl<devcb_write64::log_builder>;

template class devcb_write_line::creator_impl<devcb_write_line::delegate_builder<write8_delegate> >;
template class devcb_write_line::creator_impl<devcb_write_line::delegate_builder<write16_delegate> >;
template class devcb_write_line::creator_impl<devcb_write_line::delegate_builder<write32_delegate> >;
template class devcb_write_line::creator_impl<devcb_write_line::delegate_builder<write64_delegate> >;
template class devcb_write_line::creator_impl<devcb_write_line::delegate_builder<write_line_delegate> >;
template class devcb_write_line::creator_impl<devcb_write_line::inputline_builder>;
template class devcb_write_line::creator_impl<devcb_write_line::latched_inputline_builder>;
template class devcb_write_line::creator_impl<devcb_write_line::ioport_builder>;
template class devcb_write_line::creator_impl<devcb_write_line::membank_builder>;
template class devcb_write_line::creator_impl<devcb_write_line::output_builder>;
template class devcb_write_line::creator_impl<devcb_write_line::log_builder>;


devcb_base::devcb_base(device_t &owner)
	: m_owner(owner)
	, m_dflt_space_finder(owner, finder_base::DUMMY_TAG)
	, m_dflt_space_index(-1)
	, m_dflt_space(nullptr)
{
	owner.register_callback(*this);
}


devcb_base::~devcb_base()
{
}


void devcb_base::validity_check(validity_checker &valid) const
{
	// if a default address space is configured, ensure it exists
	if (m_dflt_space_finder)
	{
		if (!m_dflt_space_finder->has_space(m_dflt_space_index))
			osd_printf_error("Callback references non-existent memory space %d of device %s (%s)\n", m_dflt_space_index, m_dflt_space_finder->device().tag(), m_dflt_space_finder->device().name());
	}
	else if (m_dflt_space_finder.finder_tag() != finder_base::DUMMY_TAG)
	{
		osd_printf_error("Callback references non-existent memory space device tag %s\n", m_dflt_space_finder.finder_tag());
	}
}


void devcb_base::resolve()
{
	if (m_dflt_space_finder && m_dflt_space_finder->has_space(m_dflt_space_index))
		m_dflt_space = &m_dflt_space_finder->space(m_dflt_space_index);
	else
		m_dflt_space = &m_owner.machine().dummy_space();
}


devcb_read_base::~devcb_read_base()
{
}


devcb_write_base::~devcb_write_base()
{
}