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:R. Belmont
/*********************************************************************
a2diskii.c
Implementation of the Apple II Disk II controller card
*********************************************************************/
#include "emu.h"
#include "imagedev/floppy.h"
#include "formats/ap2_dsk.h"
#include "a2diskiing.h"
/***************************************************************************
PARAMETERS
***************************************************************************/
//**************************************************************************
// GLOBAL VARIABLES
//**************************************************************************
const device_type A2BUS_DISKIING = &device_creator<a2bus_diskiing_device>;
#define WOZFDC_TAG "wozfdc"
#define DISKII_ROM_REGION "diskii_rom"
static SLOT_INTERFACE_START( a2_floppies )
SLOT_INTERFACE( "525", FLOPPY_525_SD )
SLOT_INTERFACE_END
static MACHINE_CONFIG_FRAGMENT( diskiing )
MCFG_DEVICE_ADD(WOZFDC_TAG, DISKII_FDC, 1021800*2)
MCFG_FLOPPY_DRIVE_ADD("0", a2_floppies, "525", a2bus_diskiing_device::floppy_formats)
MCFG_FLOPPY_DRIVE_ADD("1", a2_floppies, "525", a2bus_diskiing_device::floppy_formats)
MACHINE_CONFIG_END
ROM_START( diskiing )
ROM_REGION(0x100, DISKII_ROM_REGION, 0)
ROM_LOAD( "341-0027-a.p5", 0x0000, 0x0100, CRC(ce7144f6) SHA1(d4181c9f046aafc3fb326b381baac809d9e38d16) ) /* 341-0027-a: 16-sector disk drive (older version), PROM P5 */
ROM_END
FLOPPY_FORMATS_MEMBER( a2bus_diskiing_device::floppy_formats )
FLOPPY_A216S_FORMAT, FLOPPY_RWTS18_FORMAT, FLOPPY_EDD_FORMAT
FLOPPY_FORMATS_END
//-------------------------------------------------
// machine_config_additions - device-specific
// machine configurations
//-------------------------------------------------
machine_config_constructor a2bus_diskiing_device::device_mconfig_additions() const
{
return MACHINE_CONFIG_NAME( diskiing );
}
//-------------------------------------------------
// rom_region - device-specific ROM region
//-------------------------------------------------
const tiny_rom_entry *a2bus_diskiing_device::device_rom_region() const
{
return ROM_NAME( diskiing );
}
//**************************************************************************
// LIVE DEVICE
//**************************************************************************
a2bus_diskiing_device::a2bus_diskiing_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
device_t(mconfig, A2BUS_DISKIING, "Apple Disk II NG controller", tag, owner, clock, "a2diskiing", __FILE__),
device_a2bus_card_interface(mconfig, *this),
m_wozfdc(*this, WOZFDC_TAG),
floppy0(*this, "0"),
floppy1(*this, "1"), m_rom(nullptr)
{
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void a2bus_diskiing_device::device_start()
{
// set_a2bus_device makes m_slot valid
set_a2bus_device();
m_rom = device().machine().root_device().memregion(this->subtag(DISKII_ROM_REGION).c_str())->base();
}
void a2bus_diskiing_device::device_reset()
{
m_wozfdc->set_floppies(floppy0, floppy1);
}
/*-------------------------------------------------
read_c0nx - called for reads from this card's c0nx space
-------------------------------------------------*/
uint8_t a2bus_diskiing_device::read_c0nx(address_space &space, uint8_t offset)
{
return m_wozfdc->read(space, offset);
}
/*-------------------------------------------------
write_c0nx - called for writes to this card's c0nx space
-------------------------------------------------*/
void a2bus_diskiing_device::write_c0nx(address_space &space, uint8_t offset, uint8_t data)
{
m_wozfdc->write(space, offset, data);
}
/*-------------------------------------------------
read_cnxx - called for reads from this card's cnxx space
-------------------------------------------------*/
uint8_t a2bus_diskiing_device::read_cnxx(address_space &space, uint8_t offset)
{
return m_rom[offset];
}
|