~ubuntu-branches/debian/wheezy/mame/wheezy

« back to all changes in this revision

Viewing changes to src/emu/machine/cdp1871.h

  • Committer: Bazaar Package Importer
  • Author(s): Jordi Mallach, Emmanuel Kasper, Félix Arreola Rodríguez, Jordi Mallach
  • Date: 2011-05-11 21:06:50 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20110511210650-jizvh8a6x117y9hr
Tags: 0.142-1
[ Emmanuel Kasper ]
* New upstream release
* Set NOWERROR=1 to allow compiling with gcc-4.6
* Remove fix_powerpc_build.patch, as upstream has taken it in this release
* Add gnome-video-arcade front end as a suggested package

[ Félix Arreola Rodríguez ]
* Add kfreebsd-build.patch to quilt series, to fix build on kfreebsd

[ Jordi Mallach ]
* Remove unneeded and bogus addition of --with-quilt to the dh invocation.
* Add Cesare Falco (long time Ubuntu maintainer) to Uploaders, and wrap
  them into multiple lines.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**********************************************************************
 
2
 
 
3
    RCA CDP1871 Keyboard Encoder emulation
 
4
 
 
5
    Copyright MESS Team.
 
6
    Visit http://mamedev.org for licensing and usage restrictions.
 
7
 
 
8
**********************************************************************
 
9
                            _____   _____
 
10
                    D1   1 |*    \_/     | 40  Vdd
 
11
                    D2   2 |             | 39  SHIFT
 
12
                    D3   3 |             | 38  CONTROL
 
13
                    D4   4 |             | 37  ALPHA
 
14
                    D5   5 |             | 36  DEBOUNCE
 
15
                    D6   6 |             | 35  _RTP
 
16
                    D7   7 |             | 34  TPB
 
17
                    D8   8 |             | 33  _DA
 
18
                    D9   9 |             | 32  BUS 7
 
19
                   D10  10 |   CDP1871   | 31  BUS 6
 
20
                   D11  11 |             | 30  BUS 5
 
21
                    S1  12 |             | 29  BUS 4
 
22
                    S2  13 |             | 28  BUS 3
 
23
                    S3  14 |             | 27  BUS 2
 
24
                    S4  15 |             | 26  BUS 1
 
25
                    S5  16 |             | 25  BUS 0
 
26
                    S6  17 |             | 24  CS4
 
27
                    S7  18 |             | 23  CS3
 
28
                    S8  19 |             | 22  CS2
 
29
                   Vss  20 |_____________| 21  _CS1
 
30
 
 
31
**********************************************************************/
 
32
 
 
33
#pragma once
 
34
 
 
35
#ifndef __CDP1871__
 
36
#define __CDP1871__
 
37
 
 
38
#include "emu.h"
 
39
 
 
40
 
 
41
 
 
42
//**************************************************************************
 
43
//  MACROS / CONSTANTS
 
44
//**************************************************************************
 
45
 
 
46
 
 
47
 
 
48
 
 
49
//**************************************************************************
 
50
//  INTERFACE CONFIGURATION MACROS
 
51
//**************************************************************************
 
52
 
 
53
#define MCFG_CDP1871_ADD(_tag, _intrf, _clock) \
 
54
        MCFG_DEVICE_ADD(_tag, CDP1871, _clock) \
 
55
        MCFG_DEVICE_CONFIG(_intrf)
 
56
 
 
57
#define CDP1871_INTERFACE(name) \
 
58
        const cdp1871_interface (name)=
 
59
 
 
60
 
 
61
 
 
62
//**************************************************************************
 
63
//  TYPE DEFINITIONS
 
64
//**************************************************************************
 
65
 
 
66
// ======================> cdp1871_interface
 
67
 
 
68
struct cdp1871_interface
 
69
{
 
70
        devcb_read8                     in_d1_func;
 
71
        devcb_read8                     in_d2_func;
 
72
        devcb_read8                     in_d3_func;
 
73
        devcb_read8                     in_d4_func;
 
74
        devcb_read8                     in_d5_func;
 
75
        devcb_read8                     in_d6_func;
 
76
        devcb_read8                     in_d7_func;
 
77
        devcb_read8                     in_d8_func;
 
78
        devcb_read8                     in_d9_func;
 
79
        devcb_read8                     in_d10_func;
 
80
        devcb_read8                     in_d11_func;
 
81
 
 
82
        devcb_read_line         in_shift_func;
 
83
        devcb_read_line         in_control_func;
 
84
        devcb_read_line         in_alpha_func;
 
85
 
 
86
        // this gets called for every change of the DA pin (pin 33)
 
87
        devcb_write_line        out_da_func;
 
88
 
 
89
        // this gets called for every change of the RPT pin (pin 35)
 
90
        devcb_write_line        out_rpt_func;
 
91
};
 
92
 
 
93
 
 
94
// ======================> cdp1871_device_config
 
95
 
 
96
class cdp1871_device_config :   public device_config,
 
97
                                public cdp1871_interface
 
98
{
 
99
    friend class cdp1871_device;
 
100
 
 
101
    // construction/destruction
 
102
    cdp1871_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock);
 
103
 
 
104
public:
 
105
    // allocators
 
106
    static device_config *static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock);
 
107
    virtual device_t *alloc_device(running_machine &machine) const;
 
108
 
 
109
protected:
 
110
    // device_config overrides
 
111
    virtual void device_config_complete();
 
112
};
 
113
 
 
114
 
 
115
// ======================> cdp1871_device
 
116
 
 
117
class cdp1871_device :  public device_t
 
118
{
 
119
    friend class cdp1871_device_config;
 
120
 
 
121
    // construction/destruction
 
122
    cdp1871_device(running_machine &_machine, const cdp1871_device_config &_config);
 
123
 
 
124
public:
 
125
    DECLARE_READ8_MEMBER( data_r );
 
126
 
 
127
        DECLARE_READ_LINE_MEMBER( da_r );
 
128
        DECLARE_READ_LINE_MEMBER( rpt_r );
 
129
 
 
130
protected:
 
131
    // device-level overrides
 
132
    virtual void device_start();
 
133
        virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
 
134
 
 
135
        void change_output_lines();
 
136
        void clock_scan_counters();
 
137
        void detect_keypress();
 
138
 
 
139
private:
 
140
        devcb_resolved_write_line               m_out_da_func;
 
141
        devcb_resolved_write_line               m_out_rpt_func;
 
142
        devcb_resolved_read8                    m_in_d_func[11];
 
143
        devcb_resolved_read_line                m_in_shift_func;
 
144
        devcb_resolved_read_line                m_in_control_func;
 
145
        devcb_resolved_read_line                m_in_alpha_func;
 
146
 
 
147
        bool m_inhibit;                                 // scan counter clock inhibit
 
148
        int m_sense;                                    // sense input scan counter
 
149
        int m_drive;                                    // modifier inputs
 
150
 
 
151
        int m_shift;                                    // latched shift modifier
 
152
        int m_control;                                  // latched control modifier
 
153
 
 
154
        int m_da;                                               // data available flag
 
155
        int m_next_da;                                  // next value of data available flag
 
156
        int m_rpt;                                              // repeat flag
 
157
        int m_next_rpt;                                 // next value of repeat flag
 
158
 
 
159
        // timers
 
160
        emu_timer *m_scan_timer;                // keyboard scan timer
 
161
 
 
162
        const cdp1871_device_config &m_config;
 
163
};
 
164
 
 
165
 
 
166
// device type definition
 
167
extern const device_type CDP1871;
 
168
 
 
169
 
 
170
 
 
171
#endif