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
|
// license:BSD-3-Clause
// copyright-holders:Nigel Barnes
/**********************************************************************
Acorn Bus Extension emulation
**********************************************************************/
#ifndef MAME_BUS_ACORN_BUS_H
#define MAME_BUS_ACORN_BUS_H
#pragma once
#include <forward_list>
//**************************************************************************
// FORWARD DECLARATIONS
//**************************************************************************
class acorn_bus_device;
class device_acorn_bus_interface;
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
class acorn_bus_slot_device : public device_t, public device_single_card_slot_interface<device_acorn_bus_interface>
{
public:
// construction/destruction
template <typename T, typename U>
acorn_bus_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, T &&bus_tag, U &&opts, const char *dflt)
: acorn_bus_slot_device(mconfig, tag, owner)
{
option_reset();
opts(*this);
set_default_option(dflt);
set_fixed(false);
m_bus.set_tag(std::forward<T>(bus_tag));
}
acorn_bus_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, const XTAL &clock = XTAL());
protected:
// device-level overrides
virtual void device_start() override;
// configuration
required_device<acorn_bus_device> m_bus;
};
// device type definition
DECLARE_DEVICE_TYPE(ACORN_BUS_SLOT, acorn_bus_slot_device)
// ======================> acorn_bus_device
class acorn_bus_device : public device_t
{
public:
// construction/destruction
acorn_bus_device(const machine_config &mconfig, const char *tag, device_t *owner, const XTAL &clock = XTAL());
// inline configuration
template <typename T> void set_space(T &&tag, int spacenum) { m_space.set_tag(std::forward<T>(tag), spacenum); }
auto out_irq_callback() { return m_out_irq_cb.bind(); }
auto out_nmi_callback() { return m_out_nmi_cb.bind(); }
address_space &memspace() const { return *m_space; }
DECLARE_WRITE_LINE_MEMBER(irq_w);
DECLARE_WRITE_LINE_MEMBER(nmi_w);
void add_slot(acorn_bus_slot_device &slot);
protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
// internal state
required_address_space m_space;
devcb_write_line m_out_irq_cb;
devcb_write_line m_out_nmi_cb;
std::forward_list<acorn_bus_slot_device *> m_slot_list;
};
// device type definition
DECLARE_DEVICE_TYPE(ACORN_BUS, acorn_bus_device)
// ======================> device_acorn_bus_interface
// class representing interface-specific live acorn bus card
class device_acorn_bus_interface : public device_interface
{
public:
friend class acorn_bus_device;
// construction/destruction
virtual ~device_acorn_bus_interface();
// inline configuration
void set_acorn_bus(acorn_bus_device &bus) { assert(!device().started()); m_bus = &bus; }
protected:
device_acorn_bus_interface(const machine_config &mconfig, device_t &device);
virtual void interface_pre_start() override;
acorn_bus_device *m_bus;
};
void acorn_bus_devices(device_slot_interface &device);
void atom_bus_devices(device_slot_interface &device);
void cms_bus_devices(device_slot_interface &device);
#endif // MAME_BUS_ACORN_BUS_H
|