summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/bbc/fdc/fdc.cpp
blob: 58bbfc416e36f90ffb0cd2b5143c7f9c128b789f (plain) (blame)
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
// license:BSD-3-Clause
// copyright-holders:Nigel Barnes
/**********************************************************************

        BBC Micro Floppy Disc Controller slot emulation

**********************************************************************/

#include "emu.h"
#include "fdc.h"


//**************************************************************************
//  DEVICE DEFINITIONS
//**************************************************************************

const device_type BBC_FDC_SLOT = device_creator<bbc_fdc_slot_device>;


//**************************************************************************
//  DEVICE BBC_FDC CARD INTERFACE
//**************************************************************************

//-------------------------------------------------
//  device_bbc_fdc_interface - constructor
//-------------------------------------------------

device_bbc_fdc_interface::device_bbc_fdc_interface(const machine_config &mconfig, device_t &device)
	: device_slot_card_interface(mconfig, device)
{
	m_slot = dynamic_cast<bbc_fdc_slot_device *>(device.owner());
}


//-------------------------------------------------
//  ~device_bbc_fdc_interface - destructor
//-------------------------------------------------

device_bbc_fdc_interface::~device_bbc_fdc_interface()
{
}


//**************************************************************************
//  LIVE DEVICE
//**************************************************************************

//-------------------------------------------------
//  bbc_fdc_slot_device - constructor
//-------------------------------------------------

bbc_fdc_slot_device::bbc_fdc_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
		device_t(mconfig, BBC_FDC_SLOT, "BBC Micro FDC slot", tag, owner, clock, "bbc_fdc_slot", __FILE__),
		device_slot_interface(mconfig, *this),
	m_card(nullptr),
	m_intrq_handler(*this),
	m_drq_handler(*this)
{
}


//-------------------------------------------------
//  bbc_fdc_slot_device - destructor
//-------------------------------------------------

bbc_fdc_slot_device::~bbc_fdc_slot_device()
{
}


//-------------------------------------------------
//  device_start - device-specific startup
//-------------------------------------------------

void bbc_fdc_slot_device::device_start()
{
	m_card = dynamic_cast<device_bbc_fdc_interface *>(get_card_device());

	// resolve callbacks
	m_intrq_handler.resolve_safe();
	m_drq_handler.resolve_safe();
}

//-------------------------------------------------
//  device_reset - device-specific reset
//-------------------------------------------------

void bbc_fdc_slot_device::device_reset()
{
	if (get_card_device())
	{
		get_card_device()->reset();
	}
}


//-------------------------------------------------
//  SLOT_INTERFACE( bbc_fdc_devices )
//-------------------------------------------------


// slot devices
#include "acorn.h"
#include "cumana.h"
#include "opus.h"
#include "watford.h"


SLOT_INTERFACE_START( bbc_fdc_devices )
	SLOT_INTERFACE("acorn8271", BBC_ACORN8271)
	SLOT_INTERFACE("acorn1770", BBC_ACORN1770)
	SLOT_INTERFACE("cumana1",   BBC_CUMANA1)
	SLOT_INTERFACE("cumana2",   BBC_CUMANA2)
	SLOT_INTERFACE("opus2791",  BBC_OPUS2791)
	SLOT_INTERFACE("opus2793",  BBC_OPUS2793)
	SLOT_INTERFACE("opus1770",  BBC_OPUS1770)
	SLOT_INTERFACE("weddb2",    BBC_WEDDB2)
	SLOT_INTERFACE("weddb3",    BBC_WEDDB3)
SLOT_INTERFACE_END