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
|
// license:BSD-3-Clause
// copyright-holders:Curt Coder
/**********************************************************************
Atari Portfolio HPC-101 parallel interface emulation
**********************************************************************/
#include "emu.h"
#include "hpc101.h"
//**************************************************************************
// MACROS / CONSTANTS
//**************************************************************************
#define LOG 0
#define M82C55A_TAG "u1"
#define CENTRONICS_TAG "centronics"
//**************************************************************************
// DEVICE DEFINITIONS
//**************************************************************************
const device_type HPC101 = &device_creator<hpc101_t>;
//-------------------------------------------------
// MACHINE_CONFIG_FRAGMENT( hpc101 )
//-------------------------------------------------
static MACHINE_CONFIG_FRAGMENT( hpc101 )
MCFG_DEVICE_ADD(M82C55A_TAG, I8255A, 0)
MCFG_I8255_OUT_PORTA_CB(DEVWRITE8("cent_data_out", output_latch_device, write))
MCFG_I8255_OUT_PORTB_CB(DEVWRITE8("cent_ctrl_out", output_latch_device, write))
MCFG_I8255_IN_PORTC_CB(DEVREAD8("cent_status_in", input_buffer_device, read))
MCFG_CENTRONICS_ADD(CENTRONICS_TAG, centronics_devices, "printer")
MCFG_CENTRONICS_ACK_HANDLER(DEVWRITELINE("cent_status_in", input_buffer_device, write_bit5))
MCFG_CENTRONICS_BUSY_HANDLER(DEVWRITELINE("cent_status_in", input_buffer_device, write_bit4))
MCFG_CENTRONICS_FAULT_HANDLER(DEVWRITELINE("cent_status_in", input_buffer_device, write_bit3))
MCFG_CENTRONICS_SELECT_HANDLER(DEVWRITELINE("cent_status_in", input_buffer_device, write_bit1))
MCFG_CENTRONICS_PERROR_HANDLER(DEVWRITELINE("cent_status_in", input_buffer_device, write_bit0))
MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", CENTRONICS_TAG)
MCFG_DEVICE_ADD("cent_status_in", INPUT_BUFFER, 0)
MCFG_DEVICE_ADD("cent_ctrl_out", OUTPUT_LATCH, 0)
MCFG_OUTPUT_LATCH_BIT0_HANDLER(DEVWRITELINE(CENTRONICS_TAG, centronics_device, write_strobe))
MCFG_OUTPUT_LATCH_BIT1_HANDLER(DEVWRITELINE(CENTRONICS_TAG, centronics_device, write_autofd))
MCFG_OUTPUT_LATCH_BIT2_HANDLER(DEVWRITELINE(CENTRONICS_TAG, centronics_device, write_init))
MCFG_OUTPUT_LATCH_BIT3_HANDLER(DEVWRITELINE(CENTRONICS_TAG, centronics_device, write_select_in))
MACHINE_CONFIG_END
//-------------------------------------------------
// machine_config_additions - device-specific
// machine configurations
//-------------------------------------------------
machine_config_constructor hpc101_t::device_mconfig_additions() const
{
return MACHINE_CONFIG_NAME( hpc101 );
}
//**************************************************************************
// LIVE DEVICE
//**************************************************************************
//-------------------------------------------------
// hpc101_t - constructor
//-------------------------------------------------
hpc101_t::hpc101_t(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
device_t(mconfig, HPC101, "Atari Portfolio HPC-101", tag, owner, clock, "hpc101", __FILE__),
device_portfolio_expansion_slot_interface(mconfig, *this),
m_ppi(*this, M82C55A_TAG)
{
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void hpc101_t::device_start()
{
}
//-------------------------------------------------
// device_reset - device-specific reset
//-------------------------------------------------
void hpc101_t::device_reset()
{
m_ppi->reset();
}
//-------------------------------------------------
// nrdi_r - read
//-------------------------------------------------
uint8_t hpc101_t::nrdi_r(address_space &space, offs_t offset, uint8_t data, bool iom, bool bcom, bool ncc1)
{
if (!bcom)
{
if ((offset & 0x0f) == 0x0f)
{
data = 0x02;
}
if ((offset & 0x0c) == 0x08)
{
data = m_ppi->read(space, offset & 0x03);
}
}
return data;
}
//-------------------------------------------------
// nwri_w - write
//-------------------------------------------------
void hpc101_t::nwri_w(address_space &space, offs_t offset, uint8_t data, bool iom, bool bcom, bool ncc1)
{
if (!bcom)
{
if ((offset & 0x0c) == 0x08)
{
m_ppi->write(space, offset & 0x03, data);
}
}
}
|