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
|
// license:BSD-3-Clause
// copyright-holders:AJR
/*********************************************************************
Apple II Game I/O Connector
This 16-pin DIP socket is described in the Apple II Reference
Manual (January 1978) as "a means of connecting paddle controls,
lights and switches to the APPLE II for use in controlling video
games, etc." The connector provides for four analog "paddle"
input signals (0-150KΩ resistance) which are converted to
digital pulses by a NE558 quad timer on the main board. The
connector also provides several digital switch inputs and
"annunciator" outputs, all LS/TTL compatible.
While pins 9 and 16 are unconnected on the Apple II, they provide
additional digital output and input pins respectively on the Sanyo
MBC-550/555 (which uses 74LS123 monostables instead of a NE558).
The Apple //gs also recognizes a switch input 3, though this is
placed on pin 9 of the internal connector rather than 16.
The Apple IIe, IIc and IIgs also have an external DE-9 connector
that carries a subset of the signals, excluding the annunciator
outputs and utility strobe (which the IIc and IIgs do not have).
**********************************************************************
____________
+5V 1 |* | 16 (SW3)
SW0 2 | | 15 AN0
SW1 3 | | 14 AN1
SW2 4 | | 13 AN2
/STB 5 | GAME I/O | 12 AN3
PDL0 6 | | 11 PDL3
PDL2 7 | | 10 PDL1
GND 8 | | 9 (AN4/SW3)
------------
---------------------------------
\ PDL0 PDL2 GND +5V SW1 /
\ (5) (4) (3) (2) (1) /
\ (9) (8) (7) (6) /
\ PDL3 PDL1 SW0 SW2 /
\_______________________/
*********************************************************************/
#include "emu.h"
#include "bus/a2gameio/gameio.h"
#include "bus/a2gameio/joystick.h"
//**************************************************************************
// CONNECTOR DEVICE IMPLEMENTATION
//**************************************************************************
// device type definition
DEFINE_DEVICE_TYPE(APPLE2_GAMEIO, apple2_gameio_device, "a2gameio", "Apple II Game I/O Connector")
apple2_gameio_device::apple2_gameio_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
: device_t(mconfig, APPLE2_GAMEIO, tag, owner, clock)
, device_slot_interface(mconfig, *this)
, m_intf(nullptr)
{
}
void apple2_gameio_device::default_options(device_slot_interface &slot)
{
slot.option_add("joy", APPLE2_JOYSTICK);
}
void apple2_gameio_device::device_config_complete()
{
m_intf = dynamic_cast<device_a2gameio_interface *>(get_card_device());
}
void apple2_gameio_device::device_start()
{
}
//**************************************************************************
// PASSTHROUGH HANDLERS
//**************************************************************************
u8 apple2_gameio_device::pdl0_r()
{
if (m_intf != nullptr)
return m_intf->pdl0_r();
return 0;
}
u8 apple2_gameio_device::pdl1_r()
{
if (m_intf != nullptr)
return m_intf->pdl1_r();
return 0;
}
u8 apple2_gameio_device::pdl2_r()
{
if (m_intf != nullptr)
return m_intf->pdl2_r();
return 0;
}
u8 apple2_gameio_device::pdl3_r()
{
if (m_intf != nullptr)
return m_intf->pdl3_r();
return 0;
}
READ_LINE_MEMBER(apple2_gameio_device::sw0_r)
{
if (m_intf != nullptr)
return m_intf->sw0_r();
return 1;
}
READ_LINE_MEMBER(apple2_gameio_device::sw1_r)
{
if (m_intf != nullptr)
return m_intf->sw1_r();
return 1;
}
READ_LINE_MEMBER(apple2_gameio_device::sw2_r)
{
if (m_intf != nullptr)
return m_intf->sw2_r();
return 1;
}
READ_LINE_MEMBER(apple2_gameio_device::sw3_r)
{
if (m_intf != nullptr)
return m_intf->sw3_r();
return 1;
}
WRITE_LINE_MEMBER(apple2_gameio_device::an0_w)
{
if (m_intf != nullptr)
m_intf->an0_w(state);
}
WRITE_LINE_MEMBER(apple2_gameio_device::an1_w)
{
if (m_intf != nullptr)
m_intf->an1_w(state);
}
WRITE_LINE_MEMBER(apple2_gameio_device::an2_w)
{
if (m_intf != nullptr)
m_intf->an2_w(state);
}
WRITE_LINE_MEMBER(apple2_gameio_device::an3_w)
{
if (m_intf != nullptr)
m_intf->an3_w(state);
}
WRITE_LINE_MEMBER(apple2_gameio_device::an4_w)
{
if (m_intf != nullptr)
m_intf->an4_w(state);
}
WRITE_LINE_MEMBER(apple2_gameio_device::strobe_w)
{
if (m_intf != nullptr)
m_intf->strobe_w(state);
}
//**************************************************************************
// GAME I/O DEVICE INTERFACE
//**************************************************************************
device_a2gameio_interface::device_a2gameio_interface(const machine_config &mconfig, device_t &device)
: device_slot_card_interface(mconfig, device)
{
}
device_a2gameio_interface::~device_a2gameio_interface()
{
}
|