summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/pasopia/pac2.cpp
blob: 13955bba61f016826ba02585d1300908ad2f4535 (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
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
// license:BSD-3-Clause
// copyright-holders:AJR
/****************************************************************************

    Toshiba Pasopia PAC2 slot

    This is the smallest of the three Pasopia expansion connectors. Despite
    only providing access to a 4-by-8-bit space, this was mostly used for
    memory cartridges.

                                   ______
                       CDB 7   1  | .  . |  2   CDB 6
                         GND   3  | .  . |  4   CDB 5
                       CDB 4   5  | .  . |  6   CDB 3
                         GND   7  | .  . |  8   CDB 2
                       CDB 1   9  | .  . |  10  CDB 0
                      CDAD01  11  | .  . |  12  CDAD00
                         GND  13  | .  . |  14  CSELP2
                        CDRD  15  | .  . |  16  CDWR
                         GND  17  | .  . |  18  GND
                         +5V  19  | .  . |  20  +5V
                                   ------

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

#include "emu.h"
#include "pac2.h"

#include "pac2exp.h"
#include "rampac2.h"
#include "rompac2.h"

//**************************************************************************
//  GLOBAL VARIABLES
//**************************************************************************

// device type definition
DEFINE_DEVICE_TYPE(PASOPIA_PAC2, pasopia_pac2_slot_device, "pasopia_pac2", "Pasopia PAC2 Slot")

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

//-------------------------------------------------
//  pasopia_pac2_slot_device - construction
//-------------------------------------------------

pasopia_pac2_slot_device::pasopia_pac2_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
	: device_t(mconfig, PASOPIA_PAC2, tag, owner, clock)
	, device_single_card_slot_interface<pac2_card_interface>(mconfig, *this)
	, m_card(nullptr)
{
}


//-------------------------------------------------
//  device_resolve_objects - resolve objects that
//  may be needed for other devices to set
//  initial conditions at start time
//-------------------------------------------------

void pasopia_pac2_slot_device::device_resolve_objects()
{
	m_card = get_card_device();
	if (m_card != nullptr)
		m_card->m_slot = this;
}


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

void pasopia_pac2_slot_device::device_start()
{
}


//-------------------------------------------------
//  read - I/O read access
//-------------------------------------------------

u8 pasopia_pac2_slot_device::read(offs_t offset)
{
	if (m_card == nullptr)
	{
		if (!machine().side_effects_disabled())
			logerror("%s: Read from unconnected PAC2 (CDAD = %X)\n", machine().describe_context(), offset);
		return 0;
	}

	return m_card->pac2_read(offset);
}


//-------------------------------------------------
//  write - I/O write access
//-------------------------------------------------

void pasopia_pac2_slot_device::write(offs_t offset, u8 data)
{
	if (m_card != nullptr)
		m_card->pac2_write(offset, data);
}

//**************************************************************************
//  PAC2 CARD INTERFACE
//**************************************************************************

//-------------------------------------------------
//  pac2_card_interface - construction
//-------------------------------------------------

pac2_card_interface::pac2_card_interface(const machine_config &mconfig, device_t &device)
	: device_interface(device, "pac2card")
	, m_slot(nullptr)
{
}


//-------------------------------------------------
//  interface_pre_start - called before the
//  device's own start function
//-------------------------------------------------

void pac2_card_interface::interface_pre_start()
{
	if (!m_slot)
		throw device_missing_dependencies();
}


//-------------------------------------------------
//  pac2_subslot_devices - add standard options
//  for subslots
//-------------------------------------------------

void pac2_subslot_devices(device_slot_interface &device)
{
	//device.option_add("ram4k", PASOPIA_PA7241);
	device.option_add("ram16k", PASOPIA_PA7243);
	device.option_add("ram32k", PASOPIA_PA7245);
	device.option_add("kanji", PASOPIA_PA7246);
	//device.option_add("kanji2", PASOPIA_PA7247);
	device.option_add("ram64k", PASOPIA_PA7248);
	//device.option_add("joy", PASOPIA_PA7390);
}


//-------------------------------------------------
//  pac2_default_devices - add standard options
//  for main slots
//-------------------------------------------------

void pac2_default_devices(device_slot_interface &device)
{
	device.option_add("exp", PASOPIA_PA7234);
	pac2_subslot_devices(device);
}