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

    EACA Colour Genie Parallel Slot

    20-pin slot

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

#include "emu.h"
#include "parallel.h"


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

DEFINE_DEVICE_TYPE(CG_PARALLEL_SLOT, cg_parallel_slot_device, "cg_parallel_slot", "Colour Genie Parallel Slot")


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

//-------------------------------------------------
//  cg_parallel_slot_device - constructor
//-------------------------------------------------

cg_parallel_slot_device::cg_parallel_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
	device_t(mconfig, CG_PARALLEL_SLOT, tag, owner, clock),
	device_slot_interface(mconfig, *this),
	m_cart(nullptr)
{
}

//-------------------------------------------------
//  cg_parallel_slot_device - destructor
//-------------------------------------------------

cg_parallel_slot_device::~cg_parallel_slot_device()
{
}

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

void cg_parallel_slot_device::device_start()
{
	m_cart = dynamic_cast<device_cg_parallel_interface *>(get_card_device());
}

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

void cg_parallel_slot_device::device_reset()
{
}


//**************************************************************************
//  I/O PORTS
//**************************************************************************

READ8_MEMBER( cg_parallel_slot_device::pa_r )
{
	if (m_cart)
		return m_cart->pa_r();
	else
		return 0xff;
}

WRITE8_MEMBER( cg_parallel_slot_device::pa_w )
{
	if (m_cart)
		m_cart->pa_w(data);
}

READ8_MEMBER( cg_parallel_slot_device::pb_r )
{
	if (m_cart)
		return m_cart->pb_r();
	else
		return 0xff;
}

WRITE8_MEMBER( cg_parallel_slot_device::pb_w )
{
	if (m_cart)
		m_cart->pb_w(data);
}


//**************************************************************************
//  CARTRIDGE INTERFACE
//**************************************************************************

//-------------------------------------------------
//  device_cg_parallel_interface - constructor
//-------------------------------------------------

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

//-------------------------------------------------
//  ~device_cg_parallel_interface - destructor
//-------------------------------------------------

device_cg_parallel_interface::~device_cg_parallel_interface()
{
}