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
|
// license:BSD-3-Clause
// copyright-holders:Nigel Barnes
/**********************************************************************
Aquarius Mini Expander
**********************************************************************/
#include "emu.h"
#include "mini.h"
#include "speaker.h"
//**************************************************************************
// DEVICE DEFINITIONS
//**************************************************************************
DEFINE_DEVICE_TYPE(AQUARIUS_MINI, aquarius_mini_device, "aquarius_mini", "Aquarius Mini Expander")
//-------------------------------------------------
// INPUT_PORTS( mini )
//-------------------------------------------------
static INPUT_PORTS_START(mini)
PORT_START("RIGHT")
PORT_BIT( 0x001000, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_UP ) PORT_PLAYER(1) PORT_NAME("P1 12:00 (Up)") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x1fb)
PORT_BIT( 0x002000, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_UP ) PORT_PLAYER(1) PORT_NAME("P1 01:00") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x1eb)
PORT_BIT( 0x004000, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_RIGHT ) PORT_PLAYER(1) PORT_NAME("P1 01:30") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x1e9)
PORT_BIT( 0x008000, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_RIGHT ) PORT_PLAYER(1) PORT_NAME("P1 02:00") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x1f9)
PORT_BIT( 0x000001, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_RIGHT ) PORT_PLAYER(1) PORT_NAME("P1 03:00 (Right)") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x1fd)
PORT_BIT( 0x000002, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_RIGHT ) PORT_PLAYER(1) PORT_NAME("P1 04:00") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x1ed)
PORT_BIT( 0x000004, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_DOWN ) PORT_PLAYER(1) PORT_NAME("P1 04:30") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x1ec)
PORT_BIT( 0x000008, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_DOWN ) PORT_PLAYER(1) PORT_NAME("P1 05:00") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x1fc)
PORT_BIT( 0x000010, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_DOWN ) PORT_PLAYER(1) PORT_NAME("P1 06:00 (Down)") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x1fe)
PORT_BIT( 0x000020, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_DOWN ) PORT_PLAYER(1) PORT_NAME("P1 06:30") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x1ee)
PORT_BIT( 0x000040, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_LEFT ) PORT_PLAYER(1) PORT_NAME("P1 07:00") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x1e6)
PORT_BIT( 0x000080, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_LEFT ) PORT_PLAYER(1) PORT_NAME("P1 08:00") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x1f6)
PORT_BIT( 0x000100, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_LEFT ) PORT_PLAYER(1) PORT_NAME("P1 09:00 (Left)") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x1f7)
PORT_BIT( 0x000200, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_LEFT ) PORT_PLAYER(1) PORT_NAME("P1 09:30") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x1e7)
PORT_BIT( 0x000400, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_UP ) PORT_PLAYER(1) PORT_NAME("P1 10:00") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x1e3)
PORT_BIT( 0x000800, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_UP ) PORT_PLAYER(1) PORT_NAME("P1 11:00") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x1f3)
PORT_BIT( 0x010000, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x1bf)
PORT_BIT( 0x020000, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x17b)
PORT_BIT( 0x040000, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x15f)
PORT_BIT( 0x080000, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(1) PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x1df)
PORT_BIT( 0x100000, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_PLAYER(1) PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x17d)
PORT_BIT( 0x200000, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_PLAYER(1) PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x17e)
PORT_START("LEFT")
PORT_BIT( 0x001000, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_UP ) PORT_PLAYER(2) PORT_NAME("P2 12:00 (Up)") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x0fb)
PORT_BIT( 0x002000, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_UP ) PORT_PLAYER(2) PORT_NAME("P2 01:00") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x0eb)
PORT_BIT( 0x004000, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_RIGHT ) PORT_PLAYER(2) PORT_NAME("P2 01:30") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x0e9)
PORT_BIT( 0x008000, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_RIGHT ) PORT_PLAYER(2) PORT_NAME("P2 02:00") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x0f9)
PORT_BIT( 0x000001, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_RIGHT ) PORT_PLAYER(2) PORT_NAME("P2 03:00 (Right)") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x0fd)
PORT_BIT( 0x000002, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_RIGHT ) PORT_PLAYER(2) PORT_NAME("P2 04:00") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x0ed)
PORT_BIT( 0x000004, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_DOWN ) PORT_PLAYER(2) PORT_NAME("P2 04:30") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x0ec)
PORT_BIT( 0x000008, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_DOWN ) PORT_PLAYER(2) PORT_NAME("P2 05:00") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x0fc)
PORT_BIT( 0x000010, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_DOWN ) PORT_PLAYER(2) PORT_NAME("P2 06:00 (Down)") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x0fe)
PORT_BIT( 0x000020, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_DOWN ) PORT_PLAYER(2) PORT_NAME("P2 06:30") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x0ee)
PORT_BIT( 0x000040, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_LEFT ) PORT_PLAYER(2) PORT_NAME("P2 07:00") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x0e6)
PORT_BIT( 0x000080, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_LEFT ) PORT_PLAYER(2) PORT_NAME("P2 08:00") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x0f6)
PORT_BIT( 0x000100, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_LEFT ) PORT_PLAYER(2) PORT_NAME("P2 09:00 (Left)") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x0f7)
PORT_BIT( 0x000200, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_LEFT ) PORT_PLAYER(2) PORT_NAME("P2 09:30") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x0e7)
PORT_BIT( 0x000400, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_UP ) PORT_PLAYER(2) PORT_NAME("P2 10:00") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x0e3)
PORT_BIT( 0x000800, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_UP ) PORT_PLAYER(2) PORT_NAME("P2 11:00") PORT_16WAY PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x0f3)
PORT_BIT( 0x010000, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x0bf)
PORT_BIT( 0x020000, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x07b)
PORT_BIT( 0x040000, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(2) PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x05f)
PORT_BIT( 0x080000, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(2) PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x0df)
PORT_BIT( 0x100000, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_PLAYER(2) PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x07d)
PORT_BIT( 0x200000, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_PLAYER(2) PORT_CHANGED_MEMBER(DEVICE_SELF, aquarius_mini_device, input_changed, 0x07e)
INPUT_PORTS_END
//-------------------------------------------------
// input_ports - device-specific input ports
//-------------------------------------------------
ioport_constructor aquarius_mini_device::device_input_ports() const
{
return INPUT_PORTS_NAME(mini);
}
//-------------------------------------------------
// device_add_mconfig - add device configuration
//-------------------------------------------------
void aquarius_mini_device::device_add_mconfig(machine_config &config)
{
INPUT_MERGER_ANY_HIGH(config, m_irqs).output_handler().set(DEVICE_SELF_OWNER, FUNC(aquarius_cartridge_slot_device::irq_w));
/* sound hardware */
SPEAKER(config, "mono").front_center();
AY8910(config, m_ay, DERIVED_CLOCK(1, 2));
m_ay->port_a_read_callback().set([this] () { return m_ctrl_input[0]; });
m_ay->port_b_read_callback().set([this] () { return m_ctrl_input[1]; });
m_ay->add_route(ALL_OUTPUTS, "mono", 0.25);
/* cartridge */
AQUARIUS_CARTRIDGE_SLOT(config, m_exp[0], DERIVED_CLOCK(1,1), aquarius_cartridge_devices, nullptr);
m_exp[0]->irq_handler().set(m_irqs, FUNC(input_merger_device::in_w<0>));
m_exp[0]->nmi_handler().set(DEVICE_SELF_OWNER, FUNC(aquarius_cartridge_slot_device::nmi_w));
AQUARIUS_CARTRIDGE_SLOT(config, m_exp[1], DERIVED_CLOCK(1,1), aquarius_cartridge_devices, nullptr);
m_exp[1]->irq_handler().set(m_irqs, FUNC(input_merger_device::in_w<1>));
m_exp[1]->nmi_handler().set(DEVICE_SELF_OWNER, FUNC(aquarius_cartridge_slot_device::nmi_w));
}
//**************************************************************************
// LIVE DEVICE
//**************************************************************************
//-------------------------------------------------
// aquarius_mini_device - constructor
//-------------------------------------------------
aquarius_mini_device::aquarius_mini_device(const machine_config &mconfig, const char *tag, device_t *owner, const XTAL &clock)
: device_t(mconfig, AQUARIUS_MINI, tag, owner, clock)
, device_aquarius_cartridge_interface(mconfig, *this)
, m_irqs(*this, "irqs")
, m_exp(*this, "exp%u", 1U)
, m_ay(*this, "ay8910")
{
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void aquarius_mini_device::device_start()
{
m_ctrl_input[0] = 0xff;
m_ctrl_input[1] = 0xff;
save_item(NAME(m_ctrl_input));
}
//**************************************************************************
// IMPLEMENTATION
//**************************************************************************
INPUT_CHANGED_MEMBER(aquarius_mini_device::input_changed)
{
if (newval)
m_ctrl_input[BIT(param, 8)] &= param;
else
m_ctrl_input[BIT(param, 8)] |= ~param;
}
uint8_t aquarius_mini_device::mreq_r(offs_t offset)
{
uint8_t data = 0xff;
data &= m_exp[0]->mreq_r(offset);
data &= m_exp[1]->mreq_r(offset);
return data;
}
void aquarius_mini_device::mreq_w(offs_t offset, uint8_t data)
{
m_exp[0]->mreq_w(offset, data);
m_exp[1]->mreq_w(offset, data);
}
uint8_t aquarius_mini_device::mreq_ce_r(offs_t offset)
{
uint8_t data = 0xff;
data &= m_exp[0]->mreq_ce_r(offset);
data &= m_exp[1]->mreq_ce_r(offset);
return data;
}
void aquarius_mini_device::mreq_ce_w(offs_t offset, uint8_t data)
{
m_exp[0]->mreq_ce_w(offset, data);
m_exp[1]->mreq_ce_w(offset, data);
}
uint8_t aquarius_mini_device::iorq_r(offs_t offset)
{
uint8_t data = 0xff;
switch (offset & 0xff)
{
case 0xf6:
data &= m_ay->data_r();
break;
case 0xf7:
break;
}
data &= m_exp[0]->iorq_r(offset);
data &= m_exp[1]->iorq_r(offset);
return data;
}
void aquarius_mini_device::iorq_w(offs_t offset, uint8_t data)
{
switch (offset & 0xff)
{
case 0xf6:
m_ay->data_w(data);
break;
case 0xf7:
m_ay->address_w(data);
break;
}
m_exp[0]->iorq_w(offset, data);
m_exp[1]->iorq_w(offset, data);
}
|