-
Notifications
You must be signed in to change notification settings - Fork 1.9k
/
buscard2.cpp
230 lines (173 loc) · 6.87 KB
/
buscard2.cpp
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
222
223
224
225
226
227
228
229
230
// license:BSD-3-Clause
// copyright-holders:Curt Coder
/**********************************************************************
Batteries Included BusCard II cartridge emulation
SYS 61000 -> Enable BASIC 4.0
SYS 61003 -> Disable BASIC 4.0
SYS 61006 -> Enter Machine Language Monitor
**********************************************************************/
/*
PCB Layout
----------
|------| |-------------|
| CN1 |-------------| CN2 |
| |-
| RIOT SW1 LS245 LS245 |
| |
| PIA |CN3
| |
| LS164 PROM1 ROM |
| LS164 PROM2 |
| LS00 LS00 LS133 |-
| LS00 LS211 |
|-------| CN5 |-----------|
| CN4 |
|--------------|
Notes:
All IC's shown.
RIOT - Rockwell R6532AP
PIA - Motorola MC6821P
ROM - Fujitsu MBM2764-25 8Kx8 EPROM (no label)
PROM1 - Signetics N82S129N 256x4 Bipolar PROM (no label)
PROM2 - Signetics N82S129N 256x4 Bipolar PROM (no label)
CN1 - 11x2 PCB edge, parallel printer
CN2 - 12x2 PCB edge, IEEE-488
CN3 - 22x2, cartridge port passthru
CN4 - 22x2 PCB edge, cartridge port
CN5 - 3 pin PCB header, clip to C64 R44 (_HIRAM)
*/
#include "emu.h"
#include "buscard2.h"
//**************************************************************************
// DEVICE DEFINITIONS
//**************************************************************************
DEFINE_DEVICE_TYPE(C64_BUSCARD2, c64_buscard2_device, "c64_buscard2", "C64 BusCard II cartridge")
//-------------------------------------------------
// ROM( buscard2 )
//-------------------------------------------------
ROM_START( buscard2 )
ROM_REGION( 0x2000, "rom", 0 )
ROM_LOAD( "v2.12.bin", 0x0000, 0x2000, CRC(1c9b2edb) SHA1(04f0a248370281fd42389928e32d11aba597cf01) )
ROM_REGION( 0x200, "prom", 0 )
ROM_LOAD( "82s129.1", 0x000, 0x100, NO_DUMP )
ROM_LOAD( "82s129.2", 0x100, 0x100, NO_DUMP )
ROM_END
//-------------------------------------------------
// rom_region - device-specific ROM region
//-------------------------------------------------
const tiny_rom_entry *c64_buscard2_device::device_rom_region() const
{
return ROM_NAME( buscard2 );
}
//-------------------------------------------------
// INPUT_PORTS( buscard2 )
//-------------------------------------------------
static INPUT_PORTS_START( buscard2 )
PORT_START("S1")
PORT_DIPNAME( 0x03, 0x00, "Device #4" ) PORT_DIPLOCATION("S1:1,2")
PORT_DIPSETTING( 0x00, "Serial" )
PORT_DIPSETTING( 0x01, "Parallel w/conv." )
PORT_DIPSETTING( 0x02, "IEEE" )
PORT_DIPSETTING( 0x03, "Parallel" )
PORT_DIPNAME( 0x04, 0x04, "Device #5" ) PORT_DIPLOCATION("S1:3")
PORT_DIPSETTING( 0x00, "IEEE" )
PORT_DIPSETTING( 0x04, "Serial" )
PORT_DIPNAME( 0x08, 0x08, "Device #6" ) PORT_DIPLOCATION("S1:4")
PORT_DIPSETTING( 0x00, "IEEE" )
PORT_DIPSETTING( 0x08, "Serial" )
PORT_DIPNAME( 0x10, 0x10, "Device #7" ) PORT_DIPLOCATION("S1:5")
PORT_DIPSETTING( 0x00, "IEEE" )
PORT_DIPSETTING( 0x10, "Serial" )
PORT_DIPNAME( 0x20, 0x20, "Device #8" ) PORT_DIPLOCATION("S1:6")
PORT_DIPSETTING( 0x00, "IEEE" )
PORT_DIPSETTING( 0x20, "Serial" )
PORT_DIPNAME( 0x40, 0x40, "Device #9" ) PORT_DIPLOCATION("S1:7")
PORT_DIPSETTING( 0x00, "IEEE" )
PORT_DIPSETTING( 0x40, "Serial" )
PORT_DIPNAME( 0x80, 0x80, "Device #10" ) PORT_DIPLOCATION("S1:8")
PORT_DIPSETTING( 0x00, "IEEE" )
PORT_DIPSETTING( 0x80, "Serial" )
INPUT_PORTS_END
//-------------------------------------------------
// input_ports - device-specific input ports
//-------------------------------------------------
ioport_constructor c64_buscard2_device::device_input_ports() const
{
return INPUT_PORTS_NAME( buscard2 );
}
//-------------------------------------------------
// device_add_mconfig - add device configuration
//-------------------------------------------------
void c64_buscard2_device::device_add_mconfig(machine_config &config)
{
MOS6532(config, m_riot, 0);
PIA6821(config, m_pia);
IEEE488(config, m_bus, 0);
ieee488_slot_device::add_cbm_defaults(config, nullptr);
CENTRONICS(config, m_centronics, centronics_devices, nullptr);
m_centronics->busy_handler().set(FUNC(c64_buscard2_device::busy_w));
C64_EXPANSION_SLOT(config, m_exp, DERIVED_CLOCK(1, 1), c64_expansion_cards, nullptr);
m_exp->set_passthrough();
}
//**************************************************************************
// LIVE DEVICE
//**************************************************************************
//-------------------------------------------------
// c64_buscard2_device - constructor
//-------------------------------------------------
c64_buscard2_device::c64_buscard2_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
device_t(mconfig, C64_BUSCARD2, tag, owner, clock),
device_c64_expansion_card_interface(mconfig, *this),
m_riot(*this, "riot"),
m_pia(*this, "pia"),
m_bus(*this, IEEE488_TAG),
m_centronics(*this, "centronics"),
m_exp(*this, "exp"),
m_s1(*this, "S1"),
m_rom(*this, "rom"),
m_prom(*this, "prom"),
m_busy(1)
{
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void c64_buscard2_device::device_start()
{
// state saving
save_item(NAME(m_busy));
}
//-------------------------------------------------
// device_reset - device-specific reset
//-------------------------------------------------
void c64_buscard2_device::device_reset()
{
}
//-------------------------------------------------
// c64_cd_r - cartridge data read
//-------------------------------------------------
uint8_t c64_buscard2_device::c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
return m_exp->cd_r(offset, data, sphi2, ba, roml, romh, io1, io2);
}
//-------------------------------------------------
// c64_cd_w - cartridge data write
//-------------------------------------------------
void c64_buscard2_device::c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2)
{
m_exp->cd_w(offset, data, sphi2, ba, roml, romh, io1, io2);
}
//-------------------------------------------------
// c64_game_r - cartridge GAME read
//-------------------------------------------------
int c64_buscard2_device::c64_game_r(offs_t offset, int sphi2, int ba, int rw)
{
return m_exp->game_r(offset, sphi2, ba, rw, m_slot->loram(), m_slot->hiram());
}
//-------------------------------------------------
// c64_exrom_r - cartridge EXROM read
//-------------------------------------------------
int c64_buscard2_device::c64_exrom_r(offs_t offset, int sphi2, int ba, int rw)
{
return m_exp->exrom_r(offset, sphi2, ba, rw, m_slot->loram(), m_slot->hiram());
}