blob: 6ddf7eaf8aa32bd3bd236cdb8c4ddc368e17943d (
plain) (
blame)
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
|
/**********************************************************************
RCA CDP1852 Byte-Wide Input/Output Port emulation
Copyright MESS Team.
Visit http://mamedev.org for licensing and usage restrictions.
**********************************************************************
_____ _____
CSI/_CSI 1 |* \_/ | 24 Vdd
MODE 2 | | 23 _SR/SR
DI0 3 | | 22 DI7
DO0 4 | | 21 DO7
DI1 5 | | 20 DI6
DO1 6 | CDP1852 | 19 DO6
DI2 7 | | 18 DI5
DO2 8 | | 17 DO5
DI3 9 | | 16 DI4
DO3 10 | | 15 DO4
CLOCK 11 | | 14 _CLEAR
Vss 12 |_____________| 13 CS2
**********************************************************************/
#pragma once
#ifndef __CDP1852__
#define __CDP1852__
#include "emu.h"
//**************************************************************************
// MACROS / CONSTANTS
//**************************************************************************
#define CDP1852_CLOCK_HIGH 0
#define CDP1852_MODE_INPUT \
DEVCB_LINE_GND
#define CDP1852_MODE_OUTPUT \
DEVCB_LINE_VCC
//**************************************************************************
// INTERFACE CONFIGURATION MACROS
//**************************************************************************
#define MCFG_CDP1852_ADD(_tag, _clock, _config) \
MCFG_DEVICE_ADD(_tag, CDP1852, _clock) \
MCFG_DEVICE_CONFIG(_config)
#define CDP1852_INTERFACE(name) \
const cdp1852_interface (name)=
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
// ======================> cdp1852_interface
struct cdp1852_interface
{
devcb_read_line m_in_mode_cb;
devcb_read8 m_in_data_cb;
devcb_write8 m_out_data_cb;
devcb_write_line m_out_sr_cb;
};
// ======================> cdp1852_device
class cdp1852_device : public device_t,
public cdp1852_interface
{
public:
// construction/destruction
cdp1852_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
DECLARE_READ8_MEMBER( read );
DECLARE_WRITE8_MEMBER( write );
protected:
// device-level overrides
virtual void device_config_complete();
virtual void device_start();
virtual void device_reset();
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
private:
int get_mode();
inline void set_sr_line(int state);
devcb_resolved_read_line m_in_mode_func;
devcb_resolved_write_line m_out_sr_func;
devcb_resolved_read8 m_in_data_func;
devcb_resolved_write8 m_out_data_func;
int m_new_data; // new data written
UINT8 m_data; // data latch
UINT8 m_next_data; // next data
int m_sr; // service request flag
int m_next_sr; // next value of service request flag
// timers
emu_timer *m_scan_timer;
};
// device type definition
extern const device_type CDP1852;
#endif
|