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
|
// 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
//**************************************************************************
DEFINE_DEVICE_TYPE(POFO_HPC101, pofo_hpc101_device, "pofo_hpc101", "Atari Portfolio HPC-101")
//-------------------------------------------------
// device_add_mconfig - add device configuration
//-------------------------------------------------
void pofo_hpc101_device::device_add_mconfig(machine_config &config)
{
I8255A(config, m_ppi);
m_ppi->out_pa_callback().set("cent_data_out", FUNC(output_latch_device::write));
m_ppi->out_pb_callback().set("cent_ctrl_out", FUNC(output_latch_device::write));
m_ppi->in_pc_callback().set("cent_status_in", FUNC(input_buffer_device::read));
centronics_device ¢ronics(CENTRONICS(config, CENTRONICS_TAG, centronics_devices, "printer"));
centronics.ack_handler().set("cent_status_in", FUNC(input_buffer_device::write_bit5));
centronics.busy_handler().set("cent_status_in", FUNC(input_buffer_device::write_bit4));
centronics.fault_handler().set("cent_status_in", FUNC(input_buffer_device::write_bit3));
centronics.select_handler().set("cent_status_in", FUNC(input_buffer_device::write_bit1));
centronics.perror_handler().set("cent_status_in", FUNC(input_buffer_device::write_bit0));
output_latch_device ¢_data_out(OUTPUT_LATCH(config, "cent_data_out"));
centronics.set_output_latch(cent_data_out);
INPUT_BUFFER(config, "cent_status_in");
output_latch_device ¢_ctrl_out(OUTPUT_LATCH(config, "cent_ctrl_out"));
cent_ctrl_out.bit_handler<0>().set(CENTRONICS_TAG, FUNC(centronics_device::write_strobe));
cent_ctrl_out.bit_handler<1>().set(CENTRONICS_TAG, FUNC(centronics_device::write_autofd));
cent_ctrl_out.bit_handler<2>().set(CENTRONICS_TAG, FUNC(centronics_device::write_init));
cent_ctrl_out.bit_handler<3>().set(CENTRONICS_TAG, FUNC(centronics_device::write_select_in));
}
//**************************************************************************
// LIVE DEVICE
//**************************************************************************
//-------------------------------------------------
// pofo_hpc101_device - constructor
//-------------------------------------------------
pofo_hpc101_device::pofo_hpc101_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
device_t(mconfig, POFO_HPC101, tag, owner, clock),
device_portfolio_expansion_slot_interface(mconfig, *this),
m_ppi(*this, M82C55A_TAG)
{
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void pofo_hpc101_device::device_start()
{
}
//-------------------------------------------------
// device_reset - device-specific reset
//-------------------------------------------------
void pofo_hpc101_device::device_reset()
{
m_ppi->reset();
}
//-------------------------------------------------
// nrdi_r - read
//-------------------------------------------------
uint8_t pofo_hpc101_device::nrdi_r(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(offset & 0x03);
}
}
return data;
}
//-------------------------------------------------
// nwri_w - write
//-------------------------------------------------
void pofo_hpc101_device::nwri_w(offs_t offset, uint8_t data, bool iom, bool bcom, bool ncc1)
{
if (!bcom)
{
if ((offset & 0x0c) == 0x08)
{
m_ppi->write(offset & 0x03, data);
}
}
}
|