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
|
// license:BSD-3-Clause
// copyright-holders:Nigel Barnes
/***************************************************************************
Peaksoft Prestel Module
Also known as the New Era Interface from Peaksoft/Harry Whitehouse, which
includes a through port for DOS cartridges.
TODO:
- RX/TX rate set by dipswitches (default 100001/001001?), for use with a 1200/75 modem.
- add throughport, not known how CTS/SCS lines are switched between slots.
***************************************************************************/
#include "emu.h"
#include "dragon_serial.h"
#include "machine/clock.h"
#include "bus/rs232/rs232.h"
//-------------------------------------------------
// ROM( dragon_serial )
//-------------------------------------------------
ROM_START(dragon_serial)
ROM_REGION(0x2000, "eprom", 0)
ROM_LOAD("comron_peaksoft.rom", 0x0000, 0x2000, CRC(9d18cf46) SHA1(14124dfb4bd78d1907e80d779cd7f3bae30564c9))
ROM_END
//**************************************************************************
// GLOBAL VARIABLES
//**************************************************************************
DEFINE_DEVICE_TYPE(DRAGON_SERIAL, dragon_serial_device, "dragon_serial", "Dragon Peaksoft Prestel Module")
//**************************************************************************
// LIVE DEVICE
//**************************************************************************
//-------------------------------------------------
// dragon_serial_device - constructor
//-------------------------------------------------
dragon_serial_device::dragon_serial_device(const machine_config &mconfig, const char *tag, device_t *owner, const XTAL &clock)
: device_t(mconfig, DRAGON_SERIAL, tag, owner, clock)
, device_cococart_interface(mconfig, *this )
, m_eprom(*this, "eprom")
, m_acia(*this, "acia")
{
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void dragon_serial_device::device_start()
{
set_line_value(line::CART, line_value::Q);
}
//-------------------------------------------------
// dragon_serial_device::get_cart_base
//-------------------------------------------------
u8 *dragon_serial_device::get_cart_base()
{
return m_eprom->base();
}
//-------------------------------------------------
// dragon_serial_device::get_cart_memregion
//-------------------------------------------------
memory_region *dragon_serial_device::get_cart_memregion()
{
return m_eprom;
}
//-------------------------------------------------
// device_add_mconfig - add device configuration
//-------------------------------------------------
void dragon_serial_device::device_add_mconfig(machine_config &config)
{
ACIA6850(config, m_acia);
m_acia->txd_handler().set("rs232", FUNC(rs232_port_device::write_txd));
m_acia->rts_handler().set("rs232", FUNC(rs232_port_device::write_rts));
m_acia->irq_handler().set([this](int state) { set_line_value(line::NMI, state); });
clock_device &acia_clock(CLOCK(config, "acia_clock", 2.4576_MHz_XTAL));
acia_clock.signal_handler().set(FUNC(dragon_serial_device::write_acia_clock));
rs232_port_device &rs232(RS232_PORT(config, "rs232", default_rs232_devices, "null_modem"));
rs232.rxd_handler().set(m_acia, FUNC(acia6850_device::write_rxd));
rs232.cts_handler().set(m_acia, FUNC(acia6850_device::write_cts));
rs232.dcd_handler().set(m_acia, FUNC(acia6850_device::write_dcd));
}
//-------------------------------------------------
// rom_region - device-specific ROM region
//-------------------------------------------------
const tiny_rom_entry *dragon_serial_device::device_rom_region() const
{
return ROM_NAME( dragon_serial );
}
//-------------------------------------------------
// cts_read
//-------------------------------------------------
u8 dragon_serial_device::cts_read(offs_t offset)
{
return m_eprom->base()[offset & 0x1fff];
}
//-------------------------------------------------
// scs_read
//-------------------------------------------------
u8 dragon_serial_device::scs_read(offs_t offset)
{
uint8_t result = 0x00;
switch (offset)
{
case 0x14: case 0x15:
result = m_acia->read(offset & 1);
break;
}
return result;
}
//-------------------------------------------------
// scs_write
//-------------------------------------------------
void dragon_serial_device::scs_write(offs_t offset, u8 data)
{
switch (offset)
{
case 0x14: case 0x15:
m_acia->write(offset & 1, data);
break;
}
}
WRITE_LINE_MEMBER(dragon_serial_device::write_acia_clock)
{
m_acia->write_txc(state);
m_acia->write_rxc(state);
}
|