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
|
// license:BSD-3-Clause
// copyright-holders:Nathan Woods
/***************************************************************************
coco_232.c
Code for emulating the CoCo RS-232 PAK
***************************************************************************/
#include "emu.h"
#include "coco_232.h"
/***************************************************************************
CONSTANTS
***************************************************************************/
#define UART_TAG "uart"
/***************************************************************************
IMPLEMENTATION
***************************************************************************/
static MACHINE_CONFIG_START(coco_rs232)
MCFG_DEVICE_ADD(UART_TAG, MOS6551, 0)
MCFG_MOS6551_XTAL(XTAL_1_8432MHz)
MACHINE_CONFIG_END
//**************************************************************************
// GLOBAL VARIABLES
//**************************************************************************
DEFINE_DEVICE_TYPE(COCO_232, coco_232_device, "coco_232", "CoCo RS-232 PAK")
//**************************************************************************
// LIVE DEVICE
//**************************************************************************
//-------------------------------------------------
// coco_232_device - constructor
//-------------------------------------------------
coco_232_device::coco_232_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, COCO_232, tag, owner, clock)
, device_cococart_interface(mconfig, *this)
, m_uart(*this, UART_TAG)
{
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void coco_232_device::device_start()
{
}
//-------------------------------------------------
// machine_config_additions - device-specific
// machine configurations
//-------------------------------------------------
machine_config_constructor coco_232_device::device_mconfig_additions() const
{
return MACHINE_CONFIG_NAME( coco_rs232 );
}
/*-------------------------------------------------
read
-------------------------------------------------*/
READ8_MEMBER(coco_232_device::read)
{
uint8_t result = 0x00;
if ((offset >= 0x28) && (offset <= 0x2F))
result = m_uart->read(space, offset - 0x28);
return result;
}
/*-------------------------------------------------
write
-------------------------------------------------*/
WRITE8_MEMBER(coco_232_device::write)
{
if ((offset >= 0x28) && (offset <= 0x2F))
m_uart->write(space, offset - 0x28, data);
}
|