Previous 15994 Revisions Next

r11280 Saturday 23rd April, 2011 at 15:34:44 UTC by Curt Coder
Refactored MM74C922 into a C++ device and moved to emu folder. (no whatsnew)
[src/emu]emu.mak
[src/emu/machine]mm74c922.c* mm74c922.h*
[src/mess]mess.mak
[src/mess/drivers]elf.c
[src/mess/includes]elf.h
[src/mess/machine]mm74c922.c mm74c922.h

src/emu/emu.mak
r11279r11280
194194   $(EMUMACHINE)/mc146818.o   \
195195   $(EMUMACHINE)/mc6852.o      \
196196   $(EMUMACHINE)/mc68901.o      \
197   $(EMUMACHINE)/mm74c922.o   \
198   $(EMUMACHINE)/microtch.o   \
199   $(EMUMACHINE)/mos6529.o      \
197200   $(EMUMACHINE)/msm5832.o   \
198201   $(EMUMACHINE)/msm58321.o   \
199   $(EMUMACHINE)/microtch.o   \
200   $(EMUMACHINE)/mos6529.o      \
201202   $(EMUMACHINE)/msm6242.o      \
202203   $(EMUMACHINE)/nmc9306.o      \
203204   $(EMUMACHINE)/nvram.o      \
src/emu/machine/mm74c922.c
r0r11280
1/**********************************************************************
2
3    MM74C922/MM74C923 16/20-Key Encoder emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#include "mm74c922.h"
11#include "machine/devhelpr.h"
12
13
14
15//**************************************************************************
16//  MACROS / CONSTANTS
17//**************************************************************************
18
19#define LOG 1
20
21
22
23//**************************************************************************
24//  DEVICE DEFINITIONS
25//**************************************************************************
26
27const device_type MM74C922 = mm74c922_device_config::static_alloc_device_config;
28const device_type MM74C923 = mm74c922_device_config::static_alloc_device_config;
29
30
31
32//**************************************************************************
33//  DEVICE CONFIGURATION
34//**************************************************************************
35
36GENERIC_DEVICE_CONFIG_SETUP(mm74c922, "MM74C922")
37
38
39//-------------------------------------------------
40//  device_config_complete - perform any
41//  operations now that the configuration is
42//  complete
43//-------------------------------------------------
44
45void mm74c922_device_config::device_config_complete()
46{
47   // inherit a copy of the static data
48   const mm74c922_interface *intf = reinterpret_cast<const mm74c922_interface *>(static_config());
49   if (intf != NULL)
50      *static_cast<mm74c922_interface *>(this) = *intf;
51
52   // or initialize to defaults if none provided
53   else
54   {
55      memset(&m_out_da_func, 0, sizeof(m_out_da_func));
56      memset(&m_in_x1_func, 0, sizeof(m_in_x1_func));
57      memset(&m_in_x2_func, 0, sizeof(m_in_x2_func));
58      memset(&m_in_x3_func, 0, sizeof(m_in_x3_func));
59      memset(&m_in_x4_func, 0, sizeof(m_in_x4_func));
60      memset(&m_in_x5_func, 0, sizeof(m_in_x5_func));
61   }
62}
63
64
65//-------------------------------------------------
66//  static_set_config - configuration helper
67//-------------------------------------------------
68
69void mm74c922_device_config::static_set_config(device_config *device, int max_y)
70{
71   mm74c922_device_config *mm74c922 = downcast<mm74c922_device_config *>(device);
72
73   mm74c922->m_max_y = max_y;
74}
75
76
77
78//**************************************************************************
79//  INLINE HELPERS
80//**************************************************************************
81
82//-------------------------------------------------
83//  change_output_lines -
84//-------------------------------------------------
85
86inline void mm74c922_device::change_output_lines()
87{
88   if (m_next_da != m_da)
89   {
90      m_da = m_next_da;
91
92      if (LOG) logerror("MM74C922 '%s' Data Available: %u\n", tag(), m_da);
93
94      devcb_call_write_line(&m_out_da_func, m_da);
95   }
96}
97
98
99//-------------------------------------------------
100//  clock_scan_counters -
101//-------------------------------------------------
102
103inline void mm74c922_device::clock_scan_counters()
104{
105   if (!m_inhibit)
106   {
107      m_x++;
108      m_x &= 0x03;
109   }
110}
111
112
113//-------------------------------------------------
114//  device_start - device-specific startup
115//-------------------------------------------------
116
117inline void mm74c922_device::detect_keypress()
118{
119   if (m_inhibit)
120   {
121      UINT8 data = devcb_call_read8(&m_in_x_func[m_x], 0);
122
123      if (BIT(data, m_y))
124      {
125         // key released
126         m_inhibit = 0;
127         m_next_da = 0;
128         m_data = 0xff; // high-Z
129
130         if (LOG) logerror("MM74C922 '%s' Key Released\n", tag());
131      }
132   }
133   else
134   {
135      UINT8 data = devcb_call_read8(&m_in_x_func[m_x], 0);
136
137      for (int y = 0; y < m_config.m_max_y; y++)
138      {
139         if (!BIT(data, y))
140         {
141            // key depressed
142            m_inhibit = 1;
143            m_next_da = 1;
144            m_y = y;
145
146            m_data = (y << 2) | m_x;
147
148            if (LOG) logerror("MM74C922 '%s' Key Depressed: X %u Y %u = %02x\n", tag(), m_x, y, m_data);
149            return;
150         }
151      }
152   }
153}
154
155
156//**************************************************************************
157//  LIVE DEVICE
158//**************************************************************************
159
160//-------------------------------------------------
161//  mm74c922_device - constructor
162//-------------------------------------------------
163
164mm74c922_device::mm74c922_device(running_machine &_machine, const mm74c922_device_config &config)
165    : device_t(_machine, config),
166     m_x(0),
167     m_y(0),
168     m_next_da(0),
169      m_config(config)
170{
171}
172
173
174//-------------------------------------------------
175//  device_start - device-specific startup
176//-------------------------------------------------
177
178void mm74c922_device::device_start()
179{
180   // resolve callbacks
181   devcb_resolve_write_line(&m_out_da_func, &m_config.m_out_da_func, this);
182   devcb_resolve_read8(&m_in_x_func[0], &m_config.m_in_x1_func, this);
183   devcb_resolve_read8(&m_in_x_func[1], &m_config.m_in_x2_func, this);
184   devcb_resolve_read8(&m_in_x_func[2], &m_config.m_in_x3_func, this);
185   devcb_resolve_read8(&m_in_x_func[3], &m_config.m_in_x4_func, this);
186   devcb_resolve_read8(&m_in_x_func[4], &m_config.m_in_x5_func, this);
187
188   // set initial values
189   change_output_lines();
190
191   // allocate timers
192   m_scan_timer = timer_alloc();
193   m_scan_timer->adjust(attotime::zero, 0, attotime::from_hz(50));
194
195   // register for state saving
196   save_item(NAME(m_inhibit));
197   save_item(NAME(m_x));
198   save_item(NAME(m_y));
199   save_item(NAME(m_data));
200   save_item(NAME(m_da));
201   save_item(NAME(m_next_da));
202}
203
204
205//-------------------------------------------------
206//  device_timer - handler timer events
207//-------------------------------------------------
208
209void mm74c922_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
210{
211   change_output_lines();
212   clock_scan_counters();
213   detect_keypress();
214}
215
216
217//-------------------------------------------------
218//  data_out_r -
219//-------------------------------------------------
220
221UINT8 mm74c922_device::data_out_r()
222{
223   if (LOG) logerror("MM74C922 '%s' Data Read: %02x\n", tag(), m_data);
224
225   return m_data;
226}
src/emu/machine/mm74c922.h
r0r11280
1/**********************************************************************
2
3    MM74C922/MM74C923 16/20-Key Encoder emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************
9                            _____   _____
10                ROW Y1   1 |*    \_/     | 18  Vcc
11                ROW Y2   2 |             | 17  DATA OUT A
12                ROW Y3   3 |             | 16  DATA OUT B
13                ROW Y4   4 |             | 15  DATA OUT C
14            OSCILLATOR   5 |  MM74C922   | 14  DATA OUT D
15        KEYBOUNCE MASK   6 |             | 13  _OUTPUT ENABLE
16             COLUMN X4   7 |             | 12  DATA AVAILABLE
17             COLUMN X3   8 |             | 11  COLUMN X1
18                   GND   9 |_____________| 10  COLUMN X2
19
20                            _____   _____
21                ROW Y1   1 |*    \_/     | 20  Vcc
22                ROW Y2   2 |             | 19  DATA OUT A
23                ROW Y3   3 |             | 18  DATA OUT B
24                ROW Y4   4 |             | 17  DATA OUT C
25                ROW Y5   5 |  MM74C923   | 16  DATA OUT D
26            OSCILLATOR   6 |             | 15  DATA OUT E
27        KEYBOUNCE MASK   7 |             | 14  _OUTPUT ENABLE
28             COLUMN X4   8 |             | 13  DATA AVAILABLE
29             COLUMN X3   9 |             | 12  COLUMN X1
30                   GND  10 |_____________| 11  COLUMN X2
31
32**********************************************************************/
33
34#pragma once
35
36#ifndef __MM74C922__
37#define __MM74C922__
38
39#include "emu.h"
40
41
42
43//**************************************************************************
44//  INTERFACE CONFIGURATION MACROS
45//**************************************************************************
46
47#define MCFG_MM74C922_ADD(_tag, _config) \
48   MCFG_DEVICE_ADD(_tag, MM74C922, 0) \
49   MCFG_DEVICE_CONFIG(_config) \
50   mm74c922_device_config::static_set_config(device, 4);
51
52
53#define MCFG_MM74C923_ADD(_tag, _config) \
54   MCFG_DEVICE_ADD(_tag, MM74C923, 0) \
55   MCFG_DEVICE_CONFIG(_config) \
56   mm74c922_device_config::static_set_config(device, 5);
57
58
59#define MM74C922_INTERFACE(name) \
60   const mm74c922_interface (name)=
61
62
63#define MM74C923_INTERFACE(name) \
64   const mm74c922_interface (name)=
65
66
67
68//**************************************************************************
69//  TYPE DEFINITIONS
70//**************************************************************************
71
72// ======================> mm74c922_interface
73
74struct mm74c922_interface
75{
76   double            m_cap_osc;
77   double            m_cap_debounce;
78
79   devcb_write_line   m_out_da_func;
80
81   devcb_read8         m_in_x1_func;
82   devcb_read8         m_in_x2_func;
83   devcb_read8         m_in_x3_func;
84   devcb_read8         m_in_x4_func;
85   devcb_read8         m_in_x5_func;
86};
87
88
89// ======================> mm74c922_device_config
90
91class mm74c922_device_config :   public device_config,
92                                 public mm74c922_interface
93{
94    friend class mm74c922_device;
95
96    // construction/destruction
97    mm74c922_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock);
98
99public:
100    // allocators
101    static device_config *static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock);
102    virtual device_t *alloc_device(running_machine &machine) const;
103
104   // inline configuration helpers
105   static void static_set_config(device_config *device, int max_y);
106
107protected:
108    // device_config overrides
109    virtual void device_config_complete();
110
111private:
112   int m_max_y;
113};
114
115
116// ======================> mm74c922_device
117
118class mm74c922_device :  public device_t
119{
120    friend class mm74c922_device_config;
121
122    // construction/destruction
123    mm74c922_device(running_machine &_machine, const mm74c922_device_config &_config);
124
125public:
126    UINT8 data_out_r();
127
128protected:
129    // device-level overrides
130    virtual void device_start();
131   virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
132
133private:
134   inline void change_output_lines();
135   inline void clock_scan_counters();
136   inline void detect_keypress();
137
138   devcb_resolved_write_line   m_out_da_func;
139   devcb_resolved_read8      m_in_x_func[5];
140
141   int m_inhibit;            // scan counter clock inhibit
142   int m_x;               // currently scanned column
143   int m_y;               // latched row
144
145   UINT8 m_data;            // data latch
146
147   int m_da;               // data available flag
148   int m_next_da;            // next value of data available flag
149
150   // timers
151   emu_timer *m_scan_timer;   // keyboard scan timer
152
153   const mm74c922_device_config &m_config;
154};
155
156
157// device type definition
158extern const device_type MM74C922;
159extern const device_type MM74C923;
160
161
162
163#endif
src/mess/machine/mm74c922.c
r11279r11280
1/**********************************************************************
2
3    Fairchild MM74C922/MM74C923 16/20-Key Encoder emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10/*
11
12    TODO:
13
14    - update frequency from interface capacitor value
15    - debounce from interface capacitor value
16
17*/
18
19#include "emu.h"
20#include "mm74c922.h"
21
22/***************************************************************************
23    PARAMETERS
24***************************************************************************/
25
26#define LOG 0
27
28/***************************************************************************
29    TYPE DEFINITIONS
30***************************************************************************/
31
32typedef struct _mm74c922_t mm74c922_t;
33struct _mm74c922_t
34{
35   devcb_resolved_read8      in_x_func[5];
36   devcb_resolved_write_line   out_da_func;
37
38   int inhibit;            /* scan counter clock inhibit */
39   int x;                  /* currently scanned column */
40   int y;                  /* latched row */
41   int max_y;               /* number of rows */
42
43   UINT8 data;               /* data latch */
44
45   int da;                  /* data available flag */
46   int next_da;            /* next value of data available flag */
47
48   /* timers */
49   emu_timer *scan_timer;      /* keyboard scan timer */
50};
51
52/***************************************************************************
53    INLINE FUNCTIONS
54***************************************************************************/
55
56INLINE mm74c922_t *get_safe_token(device_t *device)
57{
58   assert(device != NULL);
59   assert((device->type() == MM74C922) || (device->type() == MM74C923));
60
61   return (mm74c922_t *)downcast<legacy_device_base *>(device)->token();
62}
63
64INLINE const mm74c922_interface *get_interface(device_t *device)
65{
66   assert(device != NULL);
67   assert((device->type() == MM74C922) || (device->type() == MM74C923));
68
69   return (const mm74c922_interface *) device->baseconfig().static_config();
70}
71
72/***************************************************************************
73    IMPLEMENTATION
74***************************************************************************/
75
76/*-------------------------------------------------
77    change_output_lines - change output line
78    state
79-------------------------------------------------*/
80
81static void change_output_lines(device_t *device)
82{
83   mm74c922_t *mm74c922 = get_safe_token(device);
84
85   if (mm74c922->next_da != mm74c922->da)
86   {
87      mm74c922->da = mm74c922->next_da;
88
89      if (LOG) logerror("MM74C922 '%s' Data Available: %u\n", device->tag(), mm74c922->da);
90
91      devcb_call_write_line(&mm74c922->out_da_func, mm74c922->da);
92   }
93}
94
95/*-------------------------------------------------
96    clock_scan_counters - clock the keyboard
97    scan counters
98-------------------------------------------------*/
99
100static void clock_scan_counters(device_t *device)
101{
102   mm74c922_t *mm74c922 = get_safe_token(device);
103
104   if (!mm74c922->inhibit)
105   {
106      mm74c922->x++;
107      mm74c922->x &= 0x03;
108   }
109}
110
111/*-------------------------------------------------
112    detect_keypress - detect key press
113-------------------------------------------------*/
114
115static void detect_keypress(device_t *device)
116{
117   mm74c922_t *mm74c922 = get_safe_token(device);
118
119   if (mm74c922->inhibit)
120   {
121      UINT8 data = devcb_call_read8(&mm74c922->in_x_func[mm74c922->x], 0);
122
123      if (BIT(data, mm74c922->y))
124      {
125         /* key released */
126         mm74c922->inhibit = 0;
127         mm74c922->next_da = 0;
128         mm74c922->data = 0xff; // high-Z
129
130         if (LOG) logerror("MM74C922 '%s' Key Released\n", device->tag());
131      }
132   }
133   else
134   {
135      UINT8 data = devcb_call_read8(&mm74c922->in_x_func[mm74c922->x], 0);
136      int y;
137
138      for (y = 0; y < mm74c922->max_y; y++)
139      {
140         if (!BIT(data, y))
141         {
142            /* key depressed */
143            mm74c922->inhibit = 1;
144            mm74c922->next_da = 1;
145            mm74c922->y = y;
146
147            mm74c922->data = (y << 2) | mm74c922->x;
148
149            if (LOG) logerror("MM74C922 '%s' Key Depressed: X %u Y %u = %02x\n", device->tag(), mm74c922->x, y, mm74c922->data);
150            return;
151         }
152      }
153   }
154}
155
156/*-------------------------------------------------
157    TIMER_CALLBACK( mm74c922_scan_tick )
158-------------------------------------------------*/
159
160static TIMER_CALLBACK( mm74c922_scan_tick )
161{
162   device_t *device = (device_t *)ptr;
163
164   change_output_lines(device);
165   clock_scan_counters(device);
166   detect_keypress(device);
167}
168
169/*-------------------------------------------------
170    mm74c922_data_r - interface retrieving
171    keyboard data
172-------------------------------------------------*/
173
174READ8_DEVICE_HANDLER( mm74c922_r )
175{
176   mm74c922_t *mm74c922 = get_safe_token(device);
177
178   if (LOG) logerror("MM74C922 '%s' Data Read: %02x\n", device->tag(), mm74c922->data);
179
180   return mm74c922->data;
181}
182
183/*-------------------------------------------------
184    DEVICE_START( mm74c922 )
185-------------------------------------------------*/
186
187static DEVICE_START( mm74c922 )
188{
189   mm74c922_t *mm74c922 = get_safe_token(device);
190   const mm74c922_interface *intf = get_interface(device);
191
192   /* resolve callbacks */
193   devcb_resolve_read8(&mm74c922->in_x_func[0], &intf->in_x1_func, device);
194   devcb_resolve_read8(&mm74c922->in_x_func[1], &intf->in_x2_func, device);
195   devcb_resolve_read8(&mm74c922->in_x_func[2], &intf->in_x3_func, device);
196   devcb_resolve_read8(&mm74c922->in_x_func[3], &intf->in_x4_func, device);
197   devcb_resolve_read8(&mm74c922->in_x_func[4], &intf->in_x5_func, device);
198   devcb_resolve_write_line(&mm74c922->out_da_func, &intf->out_da_func, device);
199
200   /* set initial values */
201   mm74c922->next_da = 0;
202   change_output_lines(device);
203
204   if (device->type() == MM74C922)
205   {
206      mm74c922->max_y = 4;
207   }
208   else
209   {
210      mm74c922->max_y = 5;
211   }
212
213   /* create the timers */
214   mm74c922->scan_timer = device->machine().scheduler().timer_alloc(FUNC(mm74c922_scan_tick), (void *)device);
215   mm74c922->scan_timer->adjust(attotime::zero, 0, attotime::from_hz(50));
216
217   /* register for state saving */
218   device->save_item(NAME(mm74c922->inhibit));
219   device->save_item(NAME(mm74c922->x));
220   device->save_item(NAME(mm74c922->y));
221   device->save_item(NAME(mm74c922->max_y));
222   device->save_item(NAME(mm74c922->data));
223   device->save_item(NAME(mm74c922->da));
224   device->save_item(NAME(mm74c922->next_da));
225}
226
227/*-------------------------------------------------
228    DEVICE_GET_INFO( mm74c922 )
229-------------------------------------------------*/
230
231DEVICE_GET_INFO( mm74c922 )
232{
233   switch (state)
234   {
235      /* --- the following bits of info are returned as 64-bit signed integers --- */
236      case DEVINFO_INT_TOKEN_BYTES:               info->i = sizeof(mm74c922_t);            break;
237      case DEVINFO_INT_INLINE_CONFIG_BYTES:         info->i = 0;                        break;
238
239      /* --- the following bits of info are returned as pointers to data or functions --- */
240      case DEVINFO_FCT_START:                     info->start = DEVICE_START_NAME(mm74c922);   break;
241      case DEVINFO_FCT_STOP:                     /* Nothing */                        break;
242      case DEVINFO_FCT_RESET:                     /* Nothing */                        break;
243
244      /* --- the following bits of info are returned as NULL-terminated strings --- */
245      case DEVINFO_STR_NAME:                     strcpy(info->s, "Fairchild MM74C922");      break;
246      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "Fairchild MM74C922");      break;
247      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");                  break;
248      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);               break;
249      case DEVINFO_STR_CREDITS:                  strcpy(info->s, "Copyright MESS Team");      break;
250   }
251}
252
253/*-------------------------------------------------
254    DEVICE_GET_INFO( mm74c923 )
255-------------------------------------------------*/
256
257DEVICE_GET_INFO( mm74c923 )
258{
259   switch (state)
260   {
261      /* --- the following bits of info are returned as 64-bit signed integers --- */
262      case DEVINFO_INT_TOKEN_BYTES:               info->i = sizeof(mm74c922_t);            break;
263      case DEVINFO_INT_INLINE_CONFIG_BYTES:         info->i = 0;                        break;
264
265      /* --- the following bits of info are returned as pointers to data or functions --- */
266      case DEVINFO_FCT_START:                     info->start = DEVICE_START_NAME(mm74c922);   break;
267      case DEVINFO_FCT_STOP:                     /* Nothing */                        break;
268      case DEVINFO_FCT_RESET:                     /* Nothing */                        break;
269
270      /* --- the following bits of info are returned as NULL-terminated strings --- */
271      case DEVINFO_STR_NAME:                     strcpy(info->s, "Fairchild MM74C923");      break;
272      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "Fairchild MM74C922");      break;
273      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");                  break;
274      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);               break;
275      case DEVINFO_STR_CREDITS:                  strcpy(info->s, "Copyright MESS Team");      break;
276   }
277}
278
279DEFINE_LEGACY_DEVICE(MM74C922, mm74c922);
280DEFINE_LEGACY_DEVICE(MM74C923, mm74c923);
src/mess/machine/mm74c922.h
r11279r11280
1/**********************************************************************
2
3    Fairchild MM74C922/MM74C923 16/20-Key Encoder emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************
9                            _____   _____
10                ROW Y1   1 |*    \_/     | 18  Vcc
11                ROW Y2   2 |             | 17  DATA OUT A
12                ROW Y3   3 |             | 16  DATA OUT B
13                ROW Y4   4 |             | 15  DATA OUT C
14            OSCILLATOR   5 |  MM74C922   | 14  DATA OUT D
15        KEYBOUNCE MASK   6 |             | 13  _OUTPUT ENABLE
16             COLUMN X4   7 |             | 12  DATA AVAILABLE
17             COLUMN X3   8 |             | 11  COLUMN X1
18                   GND   9 |_____________| 10  COLUMN X2
19
20                            _____   _____
21                ROW Y1   1 |*    \_/     | 20  Vcc
22                ROW Y2   2 |             | 19  DATA OUT A
23                ROW Y3   3 |             | 18  DATA OUT B
24                ROW Y4   4 |             | 17  DATA OUT C
25                ROW Y5   5 |  MM74C923   | 16  DATA OUT D
26            OSCILLATOR   6 |             | 15  DATA OUT E
27        KEYBOUNCE MASK   7 |             | 14  _OUTPUT ENABLE
28             COLUMN X4   8 |             | 13  DATA AVAILABLE
29             COLUMN X3   9 |             | 12  COLUMN X1
30                   GND  10 |_____________| 11  COLUMN X2
31
32**********************************************************************/
33
34#ifndef __MM74C922__
35#define __MM74C922__
36
37#include "emu.h"
38#include "devcb.h"
39
40/***************************************************************************
41    MACROS / CONSTANTS
42***************************************************************************/
43
44DECLARE_LEGACY_DEVICE(MM74C922, mm74c922);
45DECLARE_LEGACY_DEVICE(MM74C923, mm74c923);
46
47#define MCFG_MM74C922_ADD(_tag, _intrf) \
48   MCFG_DEVICE_ADD(_tag, MM74C922, 0) \
49   MCFG_DEVICE_CONFIG(_intrf)
50
51#define MCFG_MM74C923_ADD(_tag, _intrf) \
52   MCFG_DEVICE_ADD(_tag, MM74C923, 0) \
53   MCFG_DEVICE_CONFIG(_intrf)
54
55#define MM74C922_INTERFACE(name) \
56   const mm74c922_interface (name)=
57
58#define MM74C923_INTERFACE(name) \
59   const mm74c922_interface (name)=
60
61/***************************************************************************
62    TYPE DEFINITIONS
63***************************************************************************/
64
65typedef struct _mm74c922_interface mm74c922_interface;
66struct _mm74c922_interface
67{
68   devcb_read8         in_x1_func;
69   devcb_read8         in_x2_func;
70   devcb_read8         in_x3_func;
71   devcb_read8         in_x4_func;
72   devcb_read8         in_x5_func;
73
74   devcb_write_line   out_da_func;
75
76   double            cap_osc;
77   double            cap_debounce;
78};
79
80/***************************************************************************
81    PROTOTYPES
82***************************************************************************/
83/* data read */
84READ8_DEVICE_HANDLER( mm74c922_r );
85
86#endif
src/mess/includes/elf.h
r11279r11280
3939
4040   required_device<cpu_device> m_maincpu;
4141   required_device<cdp1861_device> m_vdc;
42   required_device<device_t> m_kb;
42   required_device<mm74c922_device> m_kb;
4343   required_device<dm9368_device> m_led_l;
4444   required_device<dm9368_device> m_led_h;
4545   required_device<device_t> m_cassette;
src/mess/mess.mak
r11279r11280
521521   $(MESS_MACHINE)/mc6846.o   \
522522   $(MESS_MACHINE)/mc6854.o   \
523523   $(MESS_MACHINE)/mm58274c.o   \
524   $(MESS_MACHINE)/mm74c922.o   \
525524   $(MESS_MACHINE)/mpc105.o   \
526525   $(MESS_MACHINE)/msm8251.o   \
527526   $(MESS_MACHINE)/mos6530.o   \
src/mess/drivers/elf.c
r11279r11280
200200   {
201201      /* shift keyboard data to latch */
202202      m_data <<= 4;
203      m_data |= mm74c922_r(m_kb, 0) & 0x0f;
203      m_data |= m_kb->data_out_r() & 0x0f;
204204
205205      if (LOAD)
206206      {
r11279r11280
211211   }
212212}
213213
214static MM74C922_INTERFACE( keyboard_intf )
214static MM74C923_INTERFACE( keyboard_intf )
215215{
216   CAP_U(0.15),
217   CAP_U(1),
218   DEVCB_DRIVER_LINE_MEMBER(elf2_state, da_w),
216219   DEVCB_INPUT_PORT("X1"),
217220   DEVCB_INPUT_PORT("X2"),
218221   DEVCB_INPUT_PORT("X3"),
219222   DEVCB_INPUT_PORT("X4"),
220   DEVCB_NULL,
221   DEVCB_DRIVER_LINE_MEMBER(elf2_state, da_w),
222   CAP_U(0.15),
223   CAP_U(1)
223   DEVCB_NULL
224224};
225225
226226/* CDP1861 Interface */

Previous 15994 Revisions Next


© 1998-2018 The MESS Team