blob: 02e3108b8c394813e2bf5b62e5a795d28a227011 (
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
|
// license:BSD-3-Clause
// copyright-holders:Olivier Galibert
/***************************************************************************
dispatch.h
Signal dispatching devices.
***************************************************************************/
#pragma once
#ifndef __EMU_H__
#error Dont include this file directly; include emu.h instead.
#endif
#ifndef __DISPATCH_H__
#define __DISPATCH_H__
#define MCFG_LINE_DISPATCH_ADD(_tag, _count) \
MCFG_DEVICE_ADD(_tag, DEVCB_LINE_DISPATCH_ ## _count, 0)
#define MCFG_LINE_DISPATCH_FWD_CB(_entry, _count, _devcb) \
devcb = &devcb_line_dispatch_device<_count>::set_fwd_cb(*device, _entry, DEVCB_##_devcb);
template<int N> class devcb_line_dispatch_device : public device_t {
public:
devcb_line_dispatch_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
void init_fwd() {
for(int i=0; i<N; i++)
fwd_cb[i] = new devcb_write_line(*this);
}
virtual ~devcb_line_dispatch_device() {
for(int i=0; i<N; i++)
delete fwd_cb[i];
}
template<class _Object> static devcb_base &set_fwd_cb(device_t &device, int entry, _Object object) { return downcast<devcb_line_dispatch_device<N> &>(device).fwd_cb[entry]->set_callback(object); }
WRITE_LINE_MEMBER( in_w ) {
for(int i=0; i<N; i++)
(*(fwd_cb[i]))(state);
}
protected:
virtual void device_start() {
for(int i=0; i<N; i++)
fwd_cb[i]->resolve_safe();
}
private:
devcb_write_line *fwd_cb[N];
};
extern const device_type DEVCB_LINE_DISPATCH_2;
extern const device_type DEVCB_LINE_DISPATCH_3;
extern const device_type DEVCB_LINE_DISPATCH_4;
extern const device_type DEVCB_LINE_DISPATCH_5;
extern const device_type DEVCB_LINE_DISPATCH_6;
#endif
|