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
|
// license:BSD-3-Clause
// copyright-holders:r09
/****************************************************************************
Fujitsu FM Towns SCSI card slot
This is a dedicated 30-pin slot for the FMT-121 SCSI Card. It is only
present on the Model 1 and 2; all later models integrate the SCSI
controller directly on the motherboard.
****************************************************************************/
#include "emu.h"
#include "fmt_scsi.h"
#include "fmt121.h"
//**************************************************************************
// GLOBAL VARIABLES
//**************************************************************************
// device type definition
DEFINE_DEVICE_TYPE(FMT_SCSI_SLOT, fmt_scsi_slot_device, "fmt_scsi_slot", "FM Towns SCSI card slot")
//**************************************************************************
// FMT_SCSI SLOT DEVICE
//**************************************************************************
//-------------------------------------------------
// fmt_scsi_slot_device - construction
//-------------------------------------------------
fmt_scsi_slot_device::fmt_scsi_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
: device_t(mconfig, FMT_SCSI_SLOT, tag, owner, clock)
, device_single_card_slot_interface<fmt_scsi_card_interface>(mconfig, *this)
, m_card(nullptr)
, m_irq_handler(*this)
, m_drq_handler(*this)
{
}
//-------------------------------------------------
// device_resolve_objects - resolve objects that
// may be needed for other devices to set
// initial conditions at start time
//-------------------------------------------------
void fmt_scsi_slot_device::device_resolve_objects()
{
m_card = get_card_device();
if (m_card != nullptr)
m_card->m_slot = this;
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void fmt_scsi_slot_device::device_start()
{
m_irq_handler.resolve_safe();
m_drq_handler.resolve_safe();
}
//-------------------------------------------------
// read - I/O read access
//-------------------------------------------------
u8 fmt_scsi_slot_device::read(address_space &space, offs_t offset)
{
if (m_card)
return m_card->fmt_scsi_read(offset);
else
return space.unmap();
}
//-------------------------------------------------
// write - I/O write access
//-------------------------------------------------
void fmt_scsi_slot_device::write(offs_t offset, u8 data)
{
if (m_card)
m_card->fmt_scsi_write(offset, data);
}
//-------------------------------------------------
// data_read - data read access
//-------------------------------------------------
u8 fmt_scsi_slot_device::data_read()
{
if (m_card)
return m_card->fmt_scsi_data_read();
else
return 0;
}
//-------------------------------------------------
// data_write - data write access
//-------------------------------------------------
void fmt_scsi_slot_device::data_write(u8 data)
{
if (m_card)
m_card->fmt_scsi_data_write(data);
}
void fmt_scsi_slot_device::irq_w(int state)
{
m_irq_handler(state);
}
void fmt_scsi_slot_device::drq_w(int state)
{
m_drq_handler(state);
}
//**************************************************************************
// FMT_SCSI CARD INTERFACE
//**************************************************************************
//-------------------------------------------------
// fmt_scsi_card_interface - construction
//-------------------------------------------------
fmt_scsi_card_interface::fmt_scsi_card_interface(const machine_config &mconfig, device_t &device)
: device_interface(device, "fmtscsicard")
, m_slot(nullptr)
{
}
//-------------------------------------------------
// interface_pre_start - called before the
// device's own start function
//-------------------------------------------------
void fmt_scsi_card_interface::interface_pre_start()
{
if (!m_slot)
throw device_missing_dependencies();
}
//-------------------------------------------------
// fmt_scsi_default_devices - add standard options
// for main slots
//-------------------------------------------------
void fmt_scsi_default_devices(device_slot_interface &device)
{
device.option_add("fmt121", FMT121);
}
|