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
|
// license:BSD-3-Clause
// copyright-holders:Nigel Barnes
/**********************************************************************
Electron RS423 Communications cartridge (Pace Micro Technology)
**********************************************************************/
#include "emu.h"
#include "rs423.h"
#include "bus/rs232/rs232.h"
//**************************************************************************
// DEVICE DEFINITIONS
//**************************************************************************
DEFINE_DEVICE_TYPE(ELECTRON_RS423, electron_rs423_device, "electron_rs423", "Pace RS423 Communications cartridge")
//-------------------------------------------------
// device_add_mconfig - add device configuration
//-------------------------------------------------
void electron_rs423_device::device_add_mconfig(machine_config &config)
{
SCN2681(config, m_duart, 3.6864_MHz_XTAL);
m_duart->irq_cb().set(DEVICE_SELF_OWNER, FUNC(electron_cartslot_device::irq_w));
m_duart->a_tx_cb().set("rs423", FUNC(rs232_port_device::write_txd));
m_duart->outport_cb().set("rs423", FUNC(rs232_port_device::write_rts)).bit(0);
rs232_port_device &rs232(RS232_PORT(config, "rs423", default_rs232_devices, "null_modem"));
rs232.rxd_handler().set(m_duart, FUNC(scn2681_device::rx_a_w));
rs232.cts_handler().set(m_duart, FUNC(scn2681_device::ip2_w));
}
//**************************************************************************
// LIVE DEVICE
//**************************************************************************
//-------------------------------------------------
// electron_rs423_device - constructor
//-------------------------------------------------
electron_rs423_device::electron_rs423_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, ELECTRON_RS423, tag, owner, clock)
, device_electron_cart_interface(mconfig, *this)
, m_duart(*this, "duart")
{
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void electron_rs423_device::device_start()
{
}
//-------------------------------------------------
// read - cartridge data read
//-------------------------------------------------
uint8_t electron_rs423_device::read(offs_t offset, int infc, int infd, int romqa, int oe, int oe2)
{
uint8_t data = 0xff;
if (infc)
{
if (offset >= 0x60 && offset < 0x70)
{
data = m_duart->read(offset & 0x0f);
}
}
else if (oe)
{
data = m_rom[offset & 0x3fff];
}
return data;
}
//-------------------------------------------------
// write - cartridge data write
//-------------------------------------------------
void electron_rs423_device::write(offs_t offset, uint8_t data, int infc, int infd, int romqa, int oe, int oe2)
{
if (infc)
{
if (offset >= 0x60 && offset < 0x70)
{
m_duart->write(offset & 0x0f, data);
}
}
}
|