summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/bk/parallel.cpp
blob: c938456edb1328b73f6eeb2e212d03af0eb384b5 (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
// license:BSD-3-Clause
// copyright-holders:Sergey Svishchev
/***************************************************************************

    BK parallel slot with byte addressing mod

    Combines 16 input, 16 output bits (no readback) from register 177714
    and bitbanger tx/rx bits from register 177716 into a 64-pin connector.

    Bitbanger has software support only in bk0010 ROM (EMT 40..50), and
    is not implemented.

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

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


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

DEFINE_DEVICE_TYPE(BK_PARALLEL_SLOT, bk_parallel_slot_device, "bk_parallel_slot", "BK Parallel Slot")


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

//-------------------------------------------------
//  bk_parallel_slot_device - constructor
//-------------------------------------------------

bk_parallel_slot_device::bk_parallel_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
	: device_t(mconfig, BK_PARALLEL_SLOT, tag, owner, clock)
	, device_single_card_slot_interface<device_bk_parallel_interface>(mconfig, *this)
	, m_cart(nullptr)
	, m_irq2_handler(*this)
	, m_irq3_handler(*this)
{
}

//-------------------------------------------------
//  bk_parallel_slot_device - destructor
//-------------------------------------------------

bk_parallel_slot_device::~bk_parallel_slot_device()
{
}

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

void bk_parallel_slot_device::device_start()
{
	m_cart = get_card_device();
}


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

/*
 * Internal bus on the BK is derived from Q-Bus (active low signalling.)
 *
 * Invert data for convenience; bus drivers for the slot are not inverting.
 */
uint16_t bk_parallel_slot_device::read()
{
	if (m_cart)
		return m_cart->io_r() ^ 0xffff;
	else
		return 0;
}

void bk_parallel_slot_device::write(offs_t offset, uint16_t data, uint16_t mem_mask)
{
	if (m_cart)
		m_cart->io_w(data ^ 0xffff, mem_mask == 0xffff);
}

void bk_parallel_slot_device::init_w()
{
	if (m_cart)
		m_cart->init_w();
}


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

//-------------------------------------------------
//  device_bk_parallel_interface - constructor
//-------------------------------------------------

device_bk_parallel_interface::device_bk_parallel_interface(const machine_config &mconfig, device_t &device)
	: device_interface(device, "bkpar")
{
	m_slot = dynamic_cast<bk_parallel_slot_device *>(device.owner());
}

//-------------------------------------------------
//  ~device_bk_parallel_interface - destructor
//-------------------------------------------------

device_bk_parallel_interface::~device_bk_parallel_interface()
{
}