summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/samcoupe/drive/drive.cpp
blob: 564b2299fc2cf7b7bf6feac34183292d8f5ce02c (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
// license: GPL-2.0+
// copyright-holders: Dirk Best
/***************************************************************************

    SAM Coupe Drive Slot

    32-pin slot

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

#include "emu.h"
#include "drive.h"


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

DEFINE_DEVICE_TYPE(SAMCOUPE_DRIVE_PORT, samcoupe_drive_port_device, "samcoupe_drive_port", "SAM Coupe Drive Port")


//**************************************************************************
//  SLOT DEVICE
//**************************************************************************

//-------------------------------------------------
//  samcoupe_drive_port_device - constructor
//-------------------------------------------------

samcoupe_drive_port_device::samcoupe_drive_port_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
	device_t(mconfig, SAMCOUPE_DRIVE_PORT, tag, owner, clock),
	device_single_card_slot_interface<device_samcoupe_drive_interface>(mconfig, *this),
	m_module(nullptr)
{
}

//-------------------------------------------------
//  samcoupe_drive_port_device - destructor
//-------------------------------------------------

samcoupe_drive_port_device::~samcoupe_drive_port_device()
{
}

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

void samcoupe_drive_port_device::device_start()
{
	// get inserted module
	m_module = get_card_device();
}

//-------------------------------------------------
//  host to module interface
//-------------------------------------------------

uint8_t samcoupe_drive_port_device::read(offs_t offset)
{
	if (m_module)
		return m_module->read(offset);

	return 0xff;
}

void samcoupe_drive_port_device::write(offs_t offset, uint8_t data)
{
	if (m_module)
		m_module->write(offset, data);
}


//**************************************************************************
//  MODULE INTERFACE
//**************************************************************************

//-------------------------------------------------
//  device_samcoupe_drive_interface - constructor
//-------------------------------------------------

device_samcoupe_drive_interface::device_samcoupe_drive_interface(const machine_config &mconfig, device_t &device) :
	device_interface(device, "samcoupedrive")
{
	m_port = dynamic_cast<samcoupe_drive_port_device *>(device.owner());
}

//-------------------------------------------------
//  ~device_samcoupe_drive_interface - destructor
//-------------------------------------------------

device_samcoupe_drive_interface::~device_samcoupe_drive_interface()
{
}