Previous 15994 Revisions Next

r5191 Thursday 9th July, 2009 at 15:43:27 UTC by Curt Coder
[PIO8155] Renamed to I8155.
[src/mess]mess.mak
[src/mess/drivers]kyocera.c
[src/mess/includes]kyocera.h
[src/mess/machine]8155pio.c 8155pio.h i8155.c* i8155.h*

src/mess/includes/kyocera.h
r5190r5191
44#define SCREEN_TAG      "screen"
55
66#define I8085_TAG      "m19"
7#define PIO8155_TAG      "m25"
7#define I8155_TAG      "m25"
88#define UPD1990A_TAG   "m18"
99#define IM6402_TAG      "m22"
1010#define MC14412_TAG      "m31"
1111
1212//#define I8085_TAG      "m19"
13//#define PIO8155_TAG   "m12"
13//#define I8155_TAG   "m12"
1414//#define MC14412_TAG   "m8"
1515#define RP5C01A_TAG      "m301"
1616#define TCM5089_TAG      "m11"
src/mess/machine/8155pio.c
r5190r5191
1/**********************************************************************
2
3    8155 - 2048-Bit Static MOS RAM with I/O Ports and Timer 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   - strobed mode
15
16*/
17
18#include "8155pio.h"
19
20/***************************************************************************
21    PARAMETERS
22***************************************************************************/
23
24#define LOG 0
25
26enum
27{
28   PIO8155_REGISTER_COMMAND = 0,
29   PIO8155_REGISTER_STATUS = 0,
30   PIO8155_REGISTER_PORT_A,
31   PIO8155_REGISTER_PORT_B,
32   PIO8155_REGISTER_PORT_C,
33   PIO8155_REGISTER_TIMER_LOW,
34   PIO8155_REGISTER_TIMER_HIGH
35};
36
37enum
38{
39   PIO8155_PORT_A = 0,
40   PIO8155_PORT_B,
41   PIO8155_PORT_C,
42   PIO8155_PORT_COUNT
43};
44
45enum
46{
47   PIO8155_PORT_MODE_INPUT = 0,
48   PIO8155_PORT_MODE_OUTPUT,
49   PIO8155_PORT_MODE_STROBED_PORT_A,   /* not supported */
50   PIO8155_PORT_MODE_STROBED         /* not supported */
51};
52
53#define PIO8155_COMMAND_PA               0x01
54#define PIO8155_COMMAND_PB               0x02
55#define PIO8155_COMMAND_PC_MASK            0x0c
56#define PIO8155_COMMAND_PC_ALT_1         0x00
57#define PIO8155_COMMAND_PC_ALT_2         0x0c
58#define PIO8155_COMMAND_PC_ALT_3         0x04   /* not supported */
59#define PIO8155_COMMAND_PC_ALT_4         0x08   /* not supported */
60#define PIO8155_COMMAND_IEA               0x10   /* not supported */
61#define PIO8155_COMMAND_IEB               0x20   /* not supported */
62#define PIO8155_COMMAND_TM_MASK            0xc0
63#define PIO8155_COMMAND_TM_NOP            0x00
64#define PIO8155_COMMAND_TM_STOP            0x40
65#define PIO8155_COMMAND_TM_STOP_AFTER_TC   0x80
66#define PIO8155_COMMAND_TM_START         0xc0
67
68#define PIO8155_STATUS_INTR_A            0x01   /* not supported */
69#define PIO8155_STATUS_A_BF               0x02   /* not supported */
70#define PIO8155_STATUS_INTE_A            0x04   /* not supported */
71#define PIO8155_STATUS_INTR_B            0x08   /* not supported */
72#define PIO8155_STATUS_B_BF               0x10   /* not supported */
73#define PIO8155_STATUS_INTE_B            0x20   /* not supported */
74#define PIO8155_STATUS_TIMER            0x40
75
76#define PIO8155_TIMER_MODE_MASK            0xc0
77#define PIO8155_TIMER_MODE_LOW            0x00
78#define PIO8155_TIMER_MODE_SQUARE_WAVE      0x40
79#define PIO8155_TIMER_MODE_SINGLE_PULSE      0x80
80#define PIO8155_TIMER_MODE_AUTOMATIC_RELOAD   0xc0
81
82/***************************************************************************
83    TYPE DEFINITIONS
84***************************************************************************/
85
86typedef struct _pio8155_t pio8155_t;
87struct _pio8155_t
88{
89   devcb_resolved_read8      in_port_func[PIO8155_PORT_COUNT];
90   devcb_resolved_write8      out_port_func[PIO8155_PORT_COUNT];
91   devcb_resolved_write_line   out_to_func;
92
93   /* memory */
94   UINT8 ram[256];            /* RAM */
95
96   /* registers */
97   UINT8 command;            /* command register */
98   UINT8 status;            /* status register */
99   UINT8 output[3];         /* output latches */
100
101   /* counter */
102   UINT16 count_length;      /* count length register */
103   UINT16 counter;            /* counter register */
104   int to;                  /* timer output */
105
106   /* timers */
107   emu_timer *timer;         /* counter timer */
108};
109
110/***************************************************************************
111    INLINE FUNCTIONS
112***************************************************************************/
113
114INLINE pio8155_t *get_safe_token(const device_config *device)
115{
116   assert(device != NULL);
117   assert(device->token != NULL);
118   return (pio8155_t *)device->token;
119}
120
121INLINE const pio8155_interface *get_interface(const device_config *device)
122{
123   assert(device != NULL);
124   assert(device->type == PIO8155);
125   return (const pio8155_interface *) device->static_config;
126}
127
128INLINE UINT8 get_timer_mode(pio8155_t *pio8155)
129{
130   return (pio8155->count_length >> 8) & PIO8155_TIMER_MODE_MASK;
131}
132
133INLINE void timer_output(pio8155_t *pio8155)
134{
135   devcb_call_write_line(&pio8155->out_to_func, pio8155->to);
136
137   if (LOG) logerror("8155 Timer Output: %u\n", pio8155->to);
138}
139
140INLINE void pulse_timer_output(pio8155_t *pio8155)
141{
142   pio8155->to = 0; timer_output(pio8155);
143   pio8155->to = 1; timer_output(pio8155);
144}
145
146INLINE int get_port_mode(pio8155_t *pio8155, int port)
147{
148   int mode = -1;
149
150   switch (port)
151   {
152   case PIO8155_PORT_A:
153      mode = (pio8155->command & PIO8155_COMMAND_PA) ? PIO8155_PORT_MODE_OUTPUT : PIO8155_PORT_MODE_INPUT;
154      break;
155
156   case PIO8155_PORT_B:
157      mode = (pio8155->command & PIO8155_COMMAND_PB) ? PIO8155_PORT_MODE_OUTPUT : PIO8155_PORT_MODE_INPUT;
158      break;
159
160   case PIO8155_PORT_C:
161      switch (pio8155->command & PIO8155_COMMAND_PC_MASK)
162      {
163      case PIO8155_COMMAND_PC_ALT_1: mode = PIO8155_PORT_MODE_INPUT;         break;
164      case PIO8155_COMMAND_PC_ALT_2: mode = PIO8155_PORT_MODE_OUTPUT;         break;
165      case PIO8155_COMMAND_PC_ALT_3: mode = PIO8155_PORT_MODE_STROBED_PORT_A; break;
166      case PIO8155_COMMAND_PC_ALT_4: mode = PIO8155_PORT_MODE_STROBED;      break;
167      }
168      break;
169   }
170
171   return mode;
172}
173
174INLINE UINT8 read_port(pio8155_t *pio8155, int port)
175{
176   UINT8 data = 0;
177
178   switch (port)
179   {
180   case PIO8155_PORT_A:
181   case PIO8155_PORT_B:
182      switch (get_port_mode(pio8155, port))
183      {
184      case PIO8155_PORT_MODE_INPUT:
185         data = devcb_call_read8(&pio8155->in_port_func[port], 0);
186         break;
187
188      case PIO8155_PORT_MODE_OUTPUT:
189         data = pio8155->output[port];
190         break;
191      }
192      break;
193
194   case PIO8155_PORT_C:
195      switch (get_port_mode(pio8155, PIO8155_PORT_C))
196      {
197      case PIO8155_PORT_MODE_INPUT:
198         data = devcb_call_read8(&pio8155->in_port_func[port], 0) & 0x3f;
199         break;
200
201      case PIO8155_PORT_MODE_OUTPUT:
202         data = pio8155->output[port] & 0x3f;
203         break;
204
205      default:
206         logerror("8155 Unsupported Port C mode!\n");
207      }
208      break;
209   }
210
211   return data;
212}
213
214INLINE void write_port(pio8155_t *pio8155, int port, UINT8 data)
215{
216   switch (get_port_mode(pio8155, port))
217   {
218   case PIO8155_PORT_MODE_OUTPUT:
219      pio8155->output[port] = data;
220      devcb_call_write8(&pio8155->out_port_func[port], 0, pio8155->output[port]);
221      break;
222   }
223}
224
225/***************************************************************************
226    IMPLEMENTATION
227***************************************************************************/
228
229/*-------------------------------------------------
230    TIMER_CALLBACK( counter_tick )
231-------------------------------------------------*/
232
233static TIMER_CALLBACK( counter_tick )
234{
235   const device_config *device = ptr;
236   pio8155_t *pio8155 = get_safe_token(device);
237
238   /* count down */
239   pio8155->counter--;
240
241   if (get_timer_mode(pio8155) == PIO8155_TIMER_MODE_LOW)
242   {
243      /* pulse on every count */
244      pulse_timer_output(pio8155);
245   }
246
247   if (pio8155->counter == 0)
248   {
249      if (LOG) logerror("8155 Timer Count Reached\n");
250
251      switch (pio8155->command & PIO8155_COMMAND_TM_MASK)
252      {
253      case PIO8155_COMMAND_TM_STOP_AFTER_TC:
254         /* stop timer */
255         timer_enable(pio8155->timer, 0);
256
257         if (LOG) logerror("8155 Timer Stopped\n");
258         break;
259      }
260
261      switch (get_timer_mode(pio8155))
262      {
263      case PIO8155_TIMER_MODE_SQUARE_WAVE:
264         /* toggle timer output */
265         pio8155->to = !pio8155->to;
266         timer_output(pio8155);
267         break;
268
269      case PIO8155_TIMER_MODE_SINGLE_PULSE:
270         /* single pulse upon TC being reached */
271         pulse_timer_output(pio8155);
272
273         /* clear timer mode setting */
274         pio8155->command &= ~PIO8155_COMMAND_TM_MASK;
275         break;
276
277      case PIO8155_TIMER_MODE_AUTOMATIC_RELOAD:
278         /* automatic reload, i.e. single pulse every time TC is reached */
279         pulse_timer_output(pio8155);
280         break;
281      }
282
283      /* set timer flag */
284      pio8155->status |= PIO8155_STATUS_TIMER;
285
286      /* reload timer counter */
287      pio8155->counter = pio8155->count_length & 0x3fff;
288   }
289}
290
291/*-------------------------------------------------
292    pio8155_register_r - register read
293-------------------------------------------------*/
294
295READ8_DEVICE_HANDLER( pio8155_r )
296{
297   pio8155_t *pio8155 = get_safe_token(device);
298
299   UINT8 data = 0;
300
301   switch (offset & 0x03)
302   {
303   case PIO8155_REGISTER_STATUS:
304      data = pio8155->status;
305
306      /* clear timer flag */
307      pio8155->status &= ~PIO8155_STATUS_TIMER;
308      break;
309
310   case PIO8155_REGISTER_PORT_A:
311      data = read_port(pio8155, PIO8155_PORT_A);
312      break;
313
314   case PIO8155_REGISTER_PORT_B:
315      data = read_port(pio8155, PIO8155_PORT_B);
316      break;
317
318   case PIO8155_REGISTER_PORT_C:
319      data = read_port(pio8155, PIO8155_PORT_C);
320      break;
321   }
322
323   return data;
324}
325
326/*-------------------------------------------------
327    pio8155_register_w - register write
328-------------------------------------------------*/
329
330WRITE8_DEVICE_HANDLER( pio8155_w )
331{
332   pio8155_t *pio8155 = get_safe_token(device);
333   
334   switch (offset & 0x07)
335   {
336   case PIO8155_REGISTER_COMMAND:
337      pio8155->command = data;
338
339      if (LOG) logerror("8155 Port A Mode: %s\n", (data & PIO8155_COMMAND_PA) ? "output" : "input");
340      if (LOG) logerror("8155 Port B Mode: %s\n", (data & PIO8155_COMMAND_PB) ? "output" : "input");
341
342      if (LOG) logerror("8155 Port A Interrupt: %s\n", (data & PIO8155_COMMAND_IEA) ? "enabled" : "disabled");
343      if (LOG) logerror("8155 Port B Interrupt: %s\n", (data & PIO8155_COMMAND_IEB) ? "enabled" : "disabled");
344
345      switch (data & PIO8155_COMMAND_PC_MASK)
346      {
347      case PIO8155_COMMAND_PC_ALT_1:
348         if (LOG) logerror("8155 Port C Mode: Alt 1\n");
349         break;
350
351      case PIO8155_COMMAND_PC_ALT_2:
352         if (LOG) logerror("8155 Port C Mode: Alt 2\n");
353         break;
354
355      case PIO8155_COMMAND_PC_ALT_3:
356         if (LOG) logerror("8155 Port C Mode: Alt 3\n");
357         break;
358
359      case PIO8155_COMMAND_PC_ALT_4:
360         if (LOG) logerror("8155 Port C Mode: Alt 4\n");
361         break;
362      }
363
364      switch (data & PIO8155_COMMAND_TM_MASK)
365      {
366      case PIO8155_COMMAND_TM_NOP:
367         /* do not affect counter operation */
368         break;
369
370      case PIO8155_COMMAND_TM_STOP:
371         /* NOP if timer has not started, stop counting if the timer is running */
372         if (LOG) logerror("8155 Timer Command: Stop\n");
373         timer_enable(pio8155->timer, 0);
374         break;
375
376      case PIO8155_COMMAND_TM_STOP_AFTER_TC:
377         /* stop immediately after present TC is reached (NOP if timer has not started) */
378         if (LOG) logerror("8155 Timer Command: Stop after TC\n");
379         break;
380
381      case PIO8155_COMMAND_TM_START:
382         if (LOG) logerror("8155 Timer Command: Start\n");
383
384         if (timer_enabled(pio8155->timer))
385         {
386            /* if timer is running, start the new mode and CNT length immediately after present TC is reached */
387         }
388         else
389         {
390            /* load mode and CNT length and start immediately after loading (if timer is not running) */
391            pio8155->counter = pio8155->count_length;
392            timer_adjust_periodic(pio8155->timer, attotime_zero, 0, ATTOTIME_IN_HZ(device->clock));
393         }
394         break;
395      }
396      break;
397
398   case PIO8155_REGISTER_PORT_A:
399      write_port(pio8155, PIO8155_PORT_A, data);
400      break;
401
402   case PIO8155_REGISTER_PORT_B:
403      write_port(pio8155, PIO8155_PORT_B, data);
404      break;
405
406   case PIO8155_REGISTER_PORT_C:
407      write_port(pio8155, PIO8155_PORT_C, data);
408      break;
409
410   case PIO8155_REGISTER_TIMER_LOW:
411      pio8155->count_length = (pio8155->count_length & 0xff00) | data;
412      if (LOG) logerror("8155 Count Length Low: %04x\n", pio8155->count_length);
413      break;
414
415   case PIO8155_REGISTER_TIMER_HIGH:
416      pio8155->count_length = (data << 8) | (pio8155->count_length & 0xff);
417      if (LOG) logerror("8155 Count Length High: %04x\n", pio8155->count_length);
418
419      switch (data & PIO8155_TIMER_MODE_MASK)
420      {
421      case PIO8155_TIMER_MODE_LOW:
422         /* puts out LOW during second half of count */
423         if (LOG) logerror("8155 Timer Mode: LOW\n");
424         break;
425
426      case PIO8155_TIMER_MODE_SQUARE_WAVE:
427         /* square wave, i.e. the period of the square wave equals the count length programmed with automatic reload at terminal count */
428         if (LOG) logerror("8155 Timer Mode: Square wave\n");
429         break;
430
431      case PIO8155_TIMER_MODE_SINGLE_PULSE:
432         /* single pulse upon TC being reached */
433         if (LOG) logerror("8155 Timer Mode: Single pulse\n");
434         break;
435
436      case PIO8155_TIMER_MODE_AUTOMATIC_RELOAD:
437         /* automatic reload, i.e. single pulse every time TC is reached */
438         if (LOG) logerror("8155 Timer Mode: Automatic reload\n");
439         break;
440      }
441      break;
442   }
443}
444
445/*-------------------------------------------------
446    pio8155_ram_r - memory read
447-------------------------------------------------*/
448
449READ8_DEVICE_HANDLER( pio8155_ram_r )
450{
451   pio8155_t *pio8155 = get_safe_token(device);
452
453   return pio8155->ram[offset & 0xff];
454}
455
456/*-------------------------------------------------
457    pio8155_ram_w - memory write
458-------------------------------------------------*/
459
460WRITE8_DEVICE_HANDLER( pio8155_ram_w )
461{
462   pio8155_t *pio8155 = get_safe_token(device);
463
464   pio8155->ram[offset & 0xff] = data;
465}
466
467/*-------------------------------------------------
468    DEVICE_START( pio8155 )
469-------------------------------------------------*/
470
471static DEVICE_START( pio8155 )
472{
473   pio8155_t *pio8155 = device->token;
474   const pio8155_interface *intf = get_interface(device);
475
476   /* resolve callbacks */
477   devcb_resolve_read8(&pio8155->in_port_func[0], &intf->in_pa_func, device);
478   devcb_resolve_read8(&pio8155->in_port_func[1], &intf->in_pb_func, device);
479   devcb_resolve_read8(&pio8155->in_port_func[2], &intf->in_pc_func, device);
480   devcb_resolve_write8(&pio8155->out_port_func[0], &intf->out_pa_func, device);
481   devcb_resolve_write8(&pio8155->out_port_func[1], &intf->out_pb_func, device);
482   devcb_resolve_write8(&pio8155->out_port_func[2], &intf->out_pc_func, device);
483   devcb_resolve_write_line(&pio8155->out_to_func, &intf->out_to_func, device);
484
485   /* create the timers */
486   pio8155->timer = timer_alloc(device->machine, counter_tick, (void *)device);
487
488   /* register for state saving */
489   state_save_register_device_item(device, 0, pio8155->command);
490   state_save_register_device_item(device, 0, pio8155->status);
491   state_save_register_device_item_array(device, 0, pio8155->output);
492   state_save_register_device_item(device, 0, pio8155->count_length);
493   state_save_register_device_item(device, 0, pio8155->counter);
494   state_save_register_device_item_array(device, 0, pio8155->ram);
495   state_save_register_device_item(device, 0, pio8155->to);
496}
497
498/*-------------------------------------------------
499    DEVICE_RESET( pio8155 )
500-------------------------------------------------*/
501
502static DEVICE_RESET( pio8155 )
503{
504   pio8155_t *pio8155 = device->token;
505
506   /* clear output registers */
507   pio8155->output[PIO8155_PORT_A] = 0;
508   pio8155->output[PIO8155_PORT_B] = 0;
509   pio8155->output[PIO8155_PORT_C] = 0;
510
511   /* set ports to input mode */
512   pio8155_w(device, PIO8155_REGISTER_COMMAND, pio8155->command & ~(PIO8155_COMMAND_PA | PIO8155_COMMAND_PB | PIO8155_COMMAND_PC_MASK));
513
514   /* clear timer flag */
515   pio8155->status &= ~PIO8155_STATUS_TIMER;
516
517   /* stop counting */
518   timer_enable(pio8155->timer, 0);
519
520   /* clear timer output */
521   pio8155->to = 1;
522   timer_output(pio8155);
523}
524
525/*-------------------------------------------------
526    DEVICE_GET_INFO( pio8155 )
527-------------------------------------------------*/
528
529DEVICE_GET_INFO( pio8155 )
530{
531   switch (state)
532   {
533      /* --- the following bits of info are returned as 64-bit signed integers --- */
534      case DEVINFO_INT_INLINE_CONFIG_BYTES:         info->i = 0;                        break;
535      case DEVINFO_INT_CLASS:                     info->i = DEVICE_CLASS_PERIPHERAL;         break;
536      case DEVINFO_INT_TOKEN_BYTES:               info->i = sizeof(pio8155_t);            break;
537
538      /* --- the following bits of info are returned as pointers to data or functions --- */
539      case DEVINFO_FCT_START:                     info->start = DEVICE_START_NAME(pio8155);   break;
540      case DEVINFO_FCT_STOP:                     /* Nothing */                        break;
541      case DEVINFO_FCT_RESET:                     info->reset = DEVICE_RESET_NAME(pio8155);   break;
542
543      /* --- the following bits of info are returned as NULL-terminated strings --- */
544      case DEVINFO_STR_NAME:                     strcpy(info->s, "OKI MSM81C55");         break;
545      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "8155");               break;
546      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");                  break;
547      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);               break;
548      case DEVINFO_STR_CREDITS:                  strcpy(info->s, "Copyright the MESS Team");   break;
549   }
550}
src/mess/machine/8155pio.h
r5190r5191
1/**********************************************************************
2
3    8155 - 2048-Bit Static MOS RAM with I/O Ports and Timer emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************
9                     _____   _____
10               PC3   1 |*    \_/     | 40  Vcc
11               PC4   2 |          | 39  PC2
12           TIMER IN   3 |          | 38  PC1
13             RESET   4 |          | 37  PC0
14               PC5   5 |          | 36  PB7
15         _TIMER OUT   6 |          | 35  PB6
16             IO/_M   7 |          | 34  PB5
17          CE or _CE   8 |          | 33  PB4
18               _RD   9 |          | 32  PB3
19               _WR  10 |   8155    | 31  PB2
20               ALE  11 |   8156    | 30  PB1
21               AD0  12 |          | 29  PB0
22               AD1  13 |          | 28  PA7
23               AD2  14 |          | 27  PA6
24               AD3  15 |          | 26  PA5
25               AD4  16 |          | 25  PA4
26               AD5  17 |          | 24  PA3
27               AD6  18 |          | 23  PA2
28               AD7  19 |          | 22  PA1
29               Vss  20 |_____________| 21  PA0
30
31**********************************************************************/
32
33#ifndef __PIO8155__
34#define __PIO8155__
35
36#include "driver.h"
37#include "devcb.h"
38
39/***************************************************************************
40    MACROS / CONSTANTS
41***************************************************************************/
42
43#define PIO8155 DEVICE_GET_INFO_NAME( pio8155 )
44
45#define MDRV_PIO8155_ADD(_tag, _clock, _config) \
46   MDRV_DEVICE_ADD((_tag), PIO8155, _clock)   \
47   MDRV_DEVICE_CONFIG(_config)
48
49#define PIO8155_INTERFACE(name) \
50   const pio8155_interface (name) =
51
52/***************************************************************************
53    TYPE DEFINITIONS
54***************************************************************************/
55
56typedef struct _pio8155_interface pio8155_interface;
57struct _pio8155_interface
58{
59   devcb_read8            in_pa_func;
60   devcb_read8            in_pb_func;
61   devcb_read8            in_pc_func;
62
63   devcb_write8         out_pa_func;
64   devcb_write8         out_pb_func;
65   devcb_write8         out_pc_func;
66
67   /* this gets called for each change of the TIMER OUT pin (pin 6) */
68   devcb_write_line      out_to_func;
69};
70
71/***************************************************************************
72    PROTOTYPES
73***************************************************************************/
74
75/* device interface */
76DEVICE_GET_INFO( pio8155 );
77
78/* register access */
79READ8_DEVICE_HANDLER( pio8155_r );
80WRITE8_DEVICE_HANDLER( pio8155_w );
81
82/* memory access */
83READ8_DEVICE_HANDLER( pio8155_ram_r );
84WRITE8_DEVICE_HANDLER( pio8155_ram_w );
85
86#endif
src/mess/machine/i8155.c
r0r5191
1/**********************************************************************
2
3    Intel 8155 - 2048-Bit Static MOS RAM with I/O Ports and Timer 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   - strobed mode
15
16*/
17
18#include "i8155.h"
19
20/***************************************************************************
21    PARAMETERS
22***************************************************************************/
23
24#define LOG 0
25
26enum
27{
28   I8155_REGISTER_COMMAND = 0,
29   I8155_REGISTER_STATUS = 0,
30   I8155_REGISTER_PORT_A,
31   I8155_REGISTER_PORT_B,
32   I8155_REGISTER_PORT_C,
33   I8155_REGISTER_TIMER_LOW,
34   I8155_REGISTER_TIMER_HIGH
35};
36
37enum
38{
39   I8155_PORT_A = 0,
40   I8155_PORT_B,
41   I8155_PORT_C,
42   I8155_PORT_COUNT
43};
44
45enum
46{
47   I8155_PORT_MODE_INPUT = 0,
48   I8155_PORT_MODE_OUTPUT,
49   I8155_PORT_MODE_STROBED_PORT_A,   /* not supported */
50   I8155_PORT_MODE_STROBED         /* not supported */
51};
52
53#define I8155_COMMAND_PA               0x01
54#define I8155_COMMAND_PB               0x02
55#define I8155_COMMAND_PC_MASK            0x0c
56#define I8155_COMMAND_PC_ALT_1            0x00
57#define I8155_COMMAND_PC_ALT_2            0x0c
58#define I8155_COMMAND_PC_ALT_3            0x04   /* not supported */
59#define I8155_COMMAND_PC_ALT_4            0x08   /* not supported */
60#define I8155_COMMAND_IEA               0x10   /* not supported */
61#define I8155_COMMAND_IEB               0x20   /* not supported */
62#define I8155_COMMAND_TM_MASK            0xc0
63#define I8155_COMMAND_TM_NOP            0x00
64#define I8155_COMMAND_TM_STOP            0x40
65#define I8155_COMMAND_TM_STOP_AFTER_TC      0x80
66#define I8155_COMMAND_TM_START            0xc0
67
68#define I8155_STATUS_INTR_A               0x01   /* not supported */
69#define I8155_STATUS_A_BF               0x02   /* not supported */
70#define I8155_STATUS_INTE_A               0x04   /* not supported */
71#define I8155_STATUS_INTR_B               0x08   /* not supported */
72#define I8155_STATUS_B_BF               0x10   /* not supported */
73#define I8155_STATUS_INTE_B               0x20   /* not supported */
74#define I8155_STATUS_TIMER               0x40
75
76#define I8155_TIMER_MODE_MASK            0xc0
77#define I8155_TIMER_MODE_LOW            0x00
78#define I8155_TIMER_MODE_SQUARE_WAVE      0x40
79#define I8155_TIMER_MODE_SINGLE_PULSE      0x80
80#define I8155_TIMER_MODE_AUTOMATIC_RELOAD   0xc0
81
82/***************************************************************************
83    TYPE DEFINITIONS
84***************************************************************************/
85
86typedef struct _i8155_t i8155_t;
87struct _i8155_t
88{
89   devcb_resolved_read8      in_port_func[I8155_PORT_COUNT];
90   devcb_resolved_write8      out_port_func[I8155_PORT_COUNT];
91   devcb_resolved_write_line   out_to_func;
92
93   /* memory */
94   UINT8 ram[256];            /* RAM */
95
96   /* registers */
97   UINT8 command;            /* command register */
98   UINT8 status;            /* status register */
99   UINT8 output[3];         /* output latches */
100
101   /* counter */
102   UINT16 count_length;      /* count length register */
103   UINT16 counter;            /* counter register */
104   int to;                  /* timer output */
105
106   /* timers */
107   emu_timer *timer;         /* counter timer */
108};
109
110/***************************************************************************
111    INLINE FUNCTIONS
112***************************************************************************/
113
114INLINE i8155_t *get_safe_token(const device_config *device)
115{
116   assert(device != NULL);
117   assert(device->token != NULL);
118   return (i8155_t *)device->token;
119}
120
121INLINE const i8155_interface *get_interface(const device_config *device)
122{
123   assert(device != NULL);
124   assert(device->type == I8155);
125   return (const i8155_interface *) device->static_config;
126}
127
128INLINE UINT8 get_timer_mode(i8155_t *i8155)
129{
130   return (i8155->count_length >> 8) & I8155_TIMER_MODE_MASK;
131}
132
133INLINE void timer_output(i8155_t *i8155)
134{
135   devcb_call_write_line(&i8155->out_to_func, i8155->to);
136
137   if (LOG) logerror("8155 Timer Output: %u\n", i8155->to);
138}
139
140INLINE void pulse_timer_output(i8155_t *i8155)
141{
142   i8155->to = 0; timer_output(i8155);
143   i8155->to = 1; timer_output(i8155);
144}
145
146INLINE int get_port_mode(i8155_t *i8155, int port)
147{
148   int mode = -1;
149
150   switch (port)
151   {
152   case I8155_PORT_A:
153      mode = (i8155->command & I8155_COMMAND_PA) ? I8155_PORT_MODE_OUTPUT : I8155_PORT_MODE_INPUT;
154      break;
155
156   case I8155_PORT_B:
157      mode = (i8155->command & I8155_COMMAND_PB) ? I8155_PORT_MODE_OUTPUT : I8155_PORT_MODE_INPUT;
158      break;
159
160   case I8155_PORT_C:
161      switch (i8155->command & I8155_COMMAND_PC_MASK)
162      {
163      case I8155_COMMAND_PC_ALT_1: mode = I8155_PORT_MODE_INPUT;         break;
164      case I8155_COMMAND_PC_ALT_2: mode = I8155_PORT_MODE_OUTPUT;         break;
165      case I8155_COMMAND_PC_ALT_3: mode = I8155_PORT_MODE_STROBED_PORT_A; break;
166      case I8155_COMMAND_PC_ALT_4: mode = I8155_PORT_MODE_STROBED;      break;
167      }
168      break;
169   }
170
171   return mode;
172}
173
174INLINE UINT8 read_port(i8155_t *i8155, int port)
175{
176   UINT8 data = 0;
177
178   switch (port)
179   {
180   case I8155_PORT_A:
181   case I8155_PORT_B:
182      switch (get_port_mode(i8155, port))
183      {
184      case I8155_PORT_MODE_INPUT:
185         data = devcb_call_read8(&i8155->in_port_func[port], 0);
186         break;
187
188      case I8155_PORT_MODE_OUTPUT:
189         data = i8155->output[port];
190         break;
191      }
192      break;
193
194   case I8155_PORT_C:
195      switch (get_port_mode(i8155, I8155_PORT_C))
196      {
197      case I8155_PORT_MODE_INPUT:
198         data = devcb_call_read8(&i8155->in_port_func[port], 0) & 0x3f;
199         break;
200
201      case I8155_PORT_MODE_OUTPUT:
202         data = i8155->output[port] & 0x3f;
203         break;
204
205      default:
206         logerror("8155 Unsupported Port C mode!\n");
207      }
208      break;
209   }
210
211   return data;
212}
213
214INLINE void write_port(i8155_t *i8155, int port, UINT8 data)
215{
216   switch (get_port_mode(i8155, port))
217   {
218   case I8155_PORT_MODE_OUTPUT:
219      i8155->output[port] = data;
220      devcb_call_write8(&i8155->out_port_func[port], 0, i8155->output[port]);
221      break;
222   }
223}
224
225/***************************************************************************
226    IMPLEMENTATION
227***************************************************************************/
228
229/*-------------------------------------------------
230    TIMER_CALLBACK( counter_tick )
231-------------------------------------------------*/
232
233static TIMER_CALLBACK( counter_tick )
234{
235   const device_config *device = ptr;
236   i8155_t *i8155 = get_safe_token(device);
237
238   /* count down */
239   i8155->counter--;
240
241   if (get_timer_mode(i8155) == I8155_TIMER_MODE_LOW)
242   {
243      /* pulse on every count */
244      pulse_timer_output(i8155);
245   }
246
247   if (i8155->counter == 0)
248   {
249      if (LOG) logerror("8155 Timer Count Reached\n");
250
251      switch (i8155->command & I8155_COMMAND_TM_MASK)
252      {
253      case I8155_COMMAND_TM_STOP_AFTER_TC:
254         /* stop timer */
255         timer_enable(i8155->timer, 0);
256
257         if (LOG) logerror("8155 Timer Stopped\n");
258         break;
259      }
260
261      switch (get_timer_mode(i8155))
262      {
263      case I8155_TIMER_MODE_SQUARE_WAVE:
264         /* toggle timer output */
265         i8155->to = !i8155->to;
266         timer_output(i8155);
267         break;
268
269      case I8155_TIMER_MODE_SINGLE_PULSE:
270         /* single pulse upon TC being reached */
271         pulse_timer_output(i8155);
272
273         /* clear timer mode setting */
274         i8155->command &= ~I8155_COMMAND_TM_MASK;
275         break;
276
277      case I8155_TIMER_MODE_AUTOMATIC_RELOAD:
278         /* automatic reload, i.e. single pulse every time TC is reached */
279         pulse_timer_output(i8155);
280         break;
281      }
282
283      /* set timer flag */
284      i8155->status |= I8155_STATUS_TIMER;
285
286      /* reload timer counter */
287      i8155->counter = i8155->count_length & 0x3fff;
288   }
289}
290
291/*-------------------------------------------------
292    i8155_register_r - register read
293-------------------------------------------------*/
294
295READ8_DEVICE_HANDLER( i8155_r )
296{
297   i8155_t *i8155 = get_safe_token(device);
298
299   UINT8 data = 0;
300
301   switch (offset & 0x03)
302   {
303   case I8155_REGISTER_STATUS:
304      data = i8155->status;
305
306      /* clear timer flag */
307      i8155->status &= ~I8155_STATUS_TIMER;
308      break;
309
310   case I8155_REGISTER_PORT_A:
311      data = read_port(i8155, I8155_PORT_A);
312      break;
313
314   case I8155_REGISTER_PORT_B:
315      data = read_port(i8155, I8155_PORT_B);
316      break;
317
318   case I8155_REGISTER_PORT_C:
319      data = read_port(i8155, I8155_PORT_C);
320      break;
321   }
322
323   return data;
324}
325
326/*-------------------------------------------------
327    i8155_register_w - register write
328-------------------------------------------------*/
329
330WRITE8_DEVICE_HANDLER( i8155_w )
331{
332   i8155_t *i8155 = get_safe_token(device);
333   
334   switch (offset & 0x07)
335   {
336   case I8155_REGISTER_COMMAND:
337      i8155->command = data;
338
339      if (LOG) logerror("8155 Port A Mode: %s\n", (data & I8155_COMMAND_PA) ? "output" : "input");
340      if (LOG) logerror("8155 Port B Mode: %s\n", (data & I8155_COMMAND_PB) ? "output" : "input");
341
342      if (LOG) logerror("8155 Port A Interrupt: %s\n", (data & I8155_COMMAND_IEA) ? "enabled" : "disabled");
343      if (LOG) logerror("8155 Port B Interrupt: %s\n", (data & I8155_COMMAND_IEB) ? "enabled" : "disabled");
344
345      switch (data & I8155_COMMAND_PC_MASK)
346      {
347      case I8155_COMMAND_PC_ALT_1:
348         if (LOG) logerror("8155 Port C Mode: Alt 1\n");
349         break;
350
351      case I8155_COMMAND_PC_ALT_2:
352         if (LOG) logerror("8155 Port C Mode: Alt 2\n");
353         break;
354
355      case I8155_COMMAND_PC_ALT_3:
356         if (LOG) logerror("8155 Port C Mode: Alt 3\n");
357         break;
358
359      case I8155_COMMAND_PC_ALT_4:
360         if (LOG) logerror("8155 Port C Mode: Alt 4\n");
361         break;
362      }
363
364      switch (data & I8155_COMMAND_TM_MASK)
365      {
366      case I8155_COMMAND_TM_NOP:
367         /* do not affect counter operation */
368         break;
369
370      case I8155_COMMAND_TM_STOP:
371         /* NOP if timer has not started, stop counting if the timer is running */
372         if (LOG) logerror("8155 Timer Command: Stop\n");
373         timer_enable(i8155->timer, 0);
374         break;
375
376      case I8155_COMMAND_TM_STOP_AFTER_TC:
377         /* stop immediately after present TC is reached (NOP if timer has not started) */
378         if (LOG) logerror("8155 Timer Command: Stop after TC\n");
379         break;
380
381      case I8155_COMMAND_TM_START:
382         if (LOG) logerror("8155 Timer Command: Start\n");
383
384         if (timer_enabled(i8155->timer))
385         {
386            /* if timer is running, start the new mode and CNT length immediately after present TC is reached */
387         }
388         else
389         {
390            /* load mode and CNT length and start immediately after loading (if timer is not running) */
391            i8155->counter = i8155->count_length;
392            timer_adjust_periodic(i8155->timer, attotime_zero, 0, ATTOTIME_IN_HZ(device->clock));
393         }
394         break;
395      }
396      break;
397
398   case I8155_REGISTER_PORT_A:
399      write_port(i8155, I8155_PORT_A, data);
400      break;
401
402   case I8155_REGISTER_PORT_B:
403      write_port(i8155, I8155_PORT_B, data);
404      break;
405
406   case I8155_REGISTER_PORT_C:
407      write_port(i8155, I8155_PORT_C, data);
408      break;
409
410   case I8155_REGISTER_TIMER_LOW:
411      i8155->count_length = (i8155->count_length & 0xff00) | data;
412      if (LOG) logerror("8155 Count Length Low: %04x\n", i8155->count_length);
413      break;
414
415   case I8155_REGISTER_TIMER_HIGH:
416      i8155->count_length = (data << 8) | (i8155->count_length & 0xff);
417      if (LOG) logerror("8155 Count Length High: %04x\n", i8155->count_length);
418
419      switch (data & I8155_TIMER_MODE_MASK)
420      {
421      case I8155_TIMER_MODE_LOW:
422         /* puts out LOW during second half of count */
423         if (LOG) logerror("8155 Timer Mode: LOW\n");
424         break;
425
426      case I8155_TIMER_MODE_SQUARE_WAVE:
427         /* square wave, i.e. the period of the square wave equals the count length programmed with automatic reload at terminal count */
428         if (LOG) logerror("8155 Timer Mode: Square wave\n");
429         break;
430
431      case I8155_TIMER_MODE_SINGLE_PULSE:
432         /* single pulse upon TC being reached */
433         if (LOG) logerror("8155 Timer Mode: Single pulse\n");
434         break;
435
436      case I8155_TIMER_MODE_AUTOMATIC_RELOAD:
437         /* automatic reload, i.e. single pulse every time TC is reached */
438         if (LOG) logerror("8155 Timer Mode: Automatic reload\n");
439         break;
440      }
441      break;
442   }
443}
444
445/*-------------------------------------------------
446    i8155_ram_r - memory read
447-------------------------------------------------*/
448
449READ8_DEVICE_HANDLER( i8155_ram_r )
450{
451   i8155_t *i8155 = get_safe_token(device);
452
453   return i8155->ram[offset & 0xff];
454}
455
456/*-------------------------------------------------
457    i8155_ram_w - memory write
458-------------------------------------------------*/
459
460WRITE8_DEVICE_HANDLER( i8155_ram_w )
461{
462   i8155_t *i8155 = get_safe_token(device);
463
464   i8155->ram[offset & 0xff] = data;
465}
466
467/*-------------------------------------------------
468    DEVICE_START( i8155 )
469-------------------------------------------------*/
470
471static DEVICE_START( i8155 )
472{
473   i8155_t *i8155 = device->token;
474   const i8155_interface *intf = get_interface(device);
475
476   /* resolve callbacks */
477   devcb_resolve_read8(&i8155->in_port_func[0], &intf->in_pa_func, device);
478   devcb_resolve_read8(&i8155->in_port_func[1], &intf->in_pb_func, device);
479   devcb_resolve_read8(&i8155->in_port_func[2], &intf->in_pc_func, device);
480   devcb_resolve_write8(&i8155->out_port_func[0], &intf->out_pa_func, device);
481   devcb_resolve_write8(&i8155->out_port_func[1], &intf->out_pb_func, device);
482   devcb_resolve_write8(&i8155->out_port_func[2], &intf->out_pc_func, device);
483   devcb_resolve_write_line(&i8155->out_to_func, &intf->out_to_func, device);
484
485   /* create the timers */
486   i8155->timer = timer_alloc(device->machine, counter_tick, (void *)device);
487
488   /* register for state saving */
489   state_save_register_device_item(device, 0, i8155->command);
490   state_save_register_device_item(device, 0, i8155->status);
491   state_save_register_device_item_array(device, 0, i8155->output);
492   state_save_register_device_item(device, 0, i8155->count_length);
493   state_save_register_device_item(device, 0, i8155->counter);
494   state_save_register_device_item_array(device, 0, i8155->ram);
495   state_save_register_device_item(device, 0, i8155->to);
496}
497
498/*-------------------------------------------------
499    DEVICE_RESET( i8155 )
500-------------------------------------------------*/
501
502static DEVICE_RESET( i8155 )
503{
504   i8155_t *i8155 = device->token;
505
506   /* clear output registers */
507   i8155->output[I8155_PORT_A] = 0;
508   i8155->output[I8155_PORT_B] = 0;
509   i8155->output[I8155_PORT_C] = 0;
510
511   /* set ports to input mode */
512   i8155_w(device, I8155_REGISTER_COMMAND, i8155->command & ~(I8155_COMMAND_PA | I8155_COMMAND_PB | I8155_COMMAND_PC_MASK));
513
514   /* clear timer flag */
515   i8155->status &= ~I8155_STATUS_TIMER;
516
517   /* stop counting */
518   timer_enable(i8155->timer, 0);
519
520   /* clear timer output */
521   i8155->to = 1;
522   timer_output(i8155);
523}
524
525/*-------------------------------------------------
526    DEVICE_GET_INFO( i8155 )
527-------------------------------------------------*/
528
529DEVICE_GET_INFO( i8155 )
530{
531   switch (state)
532   {
533      /* --- the following bits of info are returned as 64-bit signed integers --- */
534      case DEVINFO_INT_INLINE_CONFIG_BYTES:         info->i = 0;                        break;
535      case DEVINFO_INT_CLASS:                     info->i = DEVICE_CLASS_PERIPHERAL;         break;
536      case DEVINFO_INT_TOKEN_BYTES:               info->i = sizeof(i8155_t);            break;
537
538      /* --- the following bits of info are returned as pointers to data or functions --- */
539      case DEVINFO_FCT_START:                     info->start = DEVICE_START_NAME(i8155);   break;
540      case DEVINFO_FCT_STOP:                     /* Nothing */                        break;
541      case DEVINFO_FCT_RESET:                     info->reset = DEVICE_RESET_NAME(i8155);   break;
542
543      /* --- the following bits of info are returned as NULL-terminated strings --- */
544      case DEVINFO_STR_NAME:                     strcpy(info->s, "Intel 8155");            break;
545      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "Intel 8085");            break;
546      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");                  break;
547      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);               break;
548      case DEVINFO_STR_CREDITS:                  strcpy(info->s, "Copyright the MESS Team");   break;
549   }
550}
src/mess/machine/i8155.h
r0r5191
1/**********************************************************************
2
3    Intel 8155 - 2048-Bit Static MOS RAM with I/O Ports and Timer emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************
9                     _____   _____
10               PC3   1 |*    \_/     | 40  Vcc
11               PC4   2 |          | 39  PC2
12           TIMER IN   3 |          | 38  PC1
13             RESET   4 |          | 37  PC0
14               PC5   5 |          | 36  PB7
15         _TIMER OUT   6 |          | 35  PB6
16             IO/_M   7 |          | 34  PB5
17          CE or _CE   8 |          | 33  PB4
18               _RD   9 |          | 32  PB3
19               _WR  10 |   8155    | 31  PB2
20               ALE  11 |   8156    | 30  PB1
21               AD0  12 |          | 29  PB0
22               AD1  13 |          | 28  PA7
23               AD2  14 |          | 27  PA6
24               AD3  15 |          | 26  PA5
25               AD4  16 |          | 25  PA4
26               AD5  17 |          | 24  PA3
27               AD6  18 |          | 23  PA2
28               AD7  19 |          | 22  PA1
29               Vss  20 |_____________| 21  PA0
30
31**********************************************************************/
32
33#ifndef __I8155__
34#define __I8155__
35
36#include "driver.h"
37#include "devcb.h"
38
39/***************************************************************************
40    MACROS / CONSTANTS
41***************************************************************************/
42
43#define I8155 DEVICE_GET_INFO_NAME( i8155 )
44
45#define MDRV_I8155_ADD(_tag, _clock, _config) \
46   MDRV_DEVICE_ADD((_tag), I8155, _clock)   \
47   MDRV_DEVICE_CONFIG(_config)
48
49#define I8155_INTERFACE(name) \
50   const i8155_interface (name) =
51
52/***************************************************************************
53    TYPE DEFINITIONS
54***************************************************************************/
55
56typedef struct _i8155_interface i8155_interface;
57struct _i8155_interface
58{
59   devcb_read8            in_pa_func;
60   devcb_read8            in_pb_func;
61   devcb_read8            in_pc_func;
62
63   devcb_write8         out_pa_func;
64   devcb_write8         out_pb_func;
65   devcb_write8         out_pc_func;
66
67   /* this gets called for each change of the TIMER OUT pin (pin 6) */
68   devcb_write_line      out_to_func;
69};
70
71/***************************************************************************
72    PROTOTYPES
73***************************************************************************/
74
75/* device interface */
76DEVICE_GET_INFO( i8155 );
77
78/* register access */
79READ8_DEVICE_HANDLER( i8155_r );
80WRITE8_DEVICE_HANDLER( i8155_w );
81
82/* memory access */
83READ8_DEVICE_HANDLER( i8155_ram_r );
84WRITE8_DEVICE_HANDLER( i8155_ram_w );
85
86#endif
src/mess/mess.mak
r5190r5191
413413   $(MESS_MACHINE)/6551.o      \
414414   $(MESS_MACHINE)/68901mfp.o   \
415415   $(MESS_MACHINE)/74145.o      \
416   $(MESS_MACHINE)/8155pio.o   \
417416   $(MESS_MACHINE)/8530scc.o   \
418417   $(MESS_MACHINE)/adc080x.o   \
419418   $(MESS_MACHINE)/at29040.o   \
r5190r5191
425424   $(MESS_MACHINE)/d88.o      \
426425   $(MESS_MACHINE)/e0516.o      \
427426   $(MESS_MACHINE)/hd63450.o   \
427   $(MESS_MACHINE)/i8155.o      \
428428   $(MESS_MACHINE)/i82439tx.o   \
429429   $(MESS_MACHINE)/i8271.o      \
430430   $(MESS_MACHINE)/ins8154.o   \
src/mess/drivers/kyocera.c
r5190r5191
7575#include "devices/cassette.h"
7676#include "machine/ctronics.h"
7777#include "machine/upd1990a.h"
78#include "machine/8155pio.h"
78#include "machine/i8155.h"
7979#include "machine/rp5c01a.h"
8080#include "machine/msm8251.h"
8181#include "video/hd61830.h"
r5190r5191
499499//   AM_RANGE(0x80, 0x80) AM_MIRROR(0x0f) optional I/O controller unit
500500//   AM_RANGE(0x90, 0x90) AM_MIRROR(0x0f) optional answering telephone unit
501501//   AM_RANGE(0xa0, 0xa0) AM_MIRROR(0x0f) optional modem
502   AM_RANGE(0xb0, 0xb7) AM_MIRROR(0x08) AM_DEVREADWRITE(PIO8155_TAG, pio8155_r, pio8155_w)
502   AM_RANGE(0xb0, 0xb7) AM_MIRROR(0x08) AM_DEVREADWRITE(I8155_TAG, i8155_r, i8155_w)
503503//   AM_RANGE(0xc0, 0xc0) AM_MIRROR(0x0f) AM_DEVREADWRITE(IM6402_TAG, im6402_data_r, im6402_data_w)
504504   AM_RANGE(0xd0, 0xd0) AM_MIRROR(0x0f) AM_READWRITE(uart_status_r, uart_ctrl_w)
505505   AM_RANGE(0xe0, 0xe0) AM_MIRROR(0x0f) AM_READWRITE(keyboard_r, kc85_ctrl_w)
r5190r5191
513513//   AM_RANGE(0x80, 0x80) AM_MIRROR(0x0f) optional I/O controller unit
514514//   AM_RANGE(0x90, 0x90) AM_MIRROR(0x0f) optional answering telephone unit
515515   AM_RANGE(0xa0, 0xa0) AM_MIRROR(0x0f) AM_WRITE(modem_w)
516   AM_RANGE(0xb0, 0xb7) AM_MIRROR(0x08) AM_DEVREADWRITE(PIO8155_TAG, pio8155_r, pio8155_w)
516   AM_RANGE(0xb0, 0xb7) AM_MIRROR(0x08) AM_DEVREADWRITE(I8155_TAG, i8155_r, i8155_w)
517517//   AM_RANGE(0xc0, 0xc0) AM_MIRROR(0x0f) AM_DEVREADWRITE(IM6402_TAG, im6402_data_r, im6402_data_w)
518518   AM_RANGE(0xd0, 0xd0) AM_MIRROR(0x0f) AM_READWRITE(uart_status_r, uart_ctrl_w)
519519   AM_RANGE(0xe0, 0xe0) AM_MIRROR(0x0f) AM_READWRITE(keyboard_r, kc85_ctrl_w)
r5190r5191
527527//   AM_RANGE(0x80, 0x80) AM_MIRROR(0x0f) optional 128K ROM cartridge
528528   AM_RANGE(0x90, 0x90) AM_MIRROR(0x0f) AM_WRITE(pc8201_ctrl_w)
529529   AM_RANGE(0xa0, 0xa0) AM_MIRROR(0x0f) AM_READWRITE(pc8201_bank_r, pc8201_bank_w)
530   AM_RANGE(0xb0, 0xb7) AM_MIRROR(0x08) AM_DEVREADWRITE(PIO8155_TAG, pio8155_r, pio8155_w )
530   AM_RANGE(0xb0, 0xb7) AM_MIRROR(0x08) AM_DEVREADWRITE(I8155_TAG, i8155_r, i8155_w )
531531//   AM_RANGE(0xc0, 0xc0) AM_MIRROR(0x0f) AM_DEVREADWRITE(IM6402_TAG, im6402_data_r, im6402_data_w)
532532   AM_RANGE(0xd0, 0xd0) AM_MIRROR(0x0f) AM_READWRITE(pc8201_uart_status_r, uart_ctrl_w)
533533   AM_RANGE(0xe0, 0xe0) AM_MIRROR(0x0f) AM_READ(keyboard_r)
r5190r5191
539539   ADDRESS_MAP_UNMAP_HIGH
540540   AM_RANGE(0x90, 0x9f) AM_DEVREADWRITE(RP5C01A_TAG, rp5c01a_r, rp5c01a_w)
541541//   AM_RANGE(0xa0, 0xa0) AM_MIRROR(0x0f) AM_DEVWRITE(TCM5089_TAG, tcm5089_w)
542   AM_RANGE(0xb0, 0xb7) AM_MIRROR(0x08) AM_DEVREADWRITE(PIO8155_TAG, pio8155_r, pio8155_w)
542   AM_RANGE(0xb0, 0xb7) AM_MIRROR(0x08) AM_DEVREADWRITE(I8155_TAG, i8155_r, i8155_w)
543543   AM_RANGE(0xc0, 0xc0) AM_MIRROR(0x0e) AM_DEVREADWRITE(MSM8251_TAG, msm8251_data_r, msm8251_data_w)
544544   AM_RANGE(0xc1, 0xc1) AM_MIRROR(0x0e) AM_DEVREADWRITE(MSM8251_TAG, msm8251_status_r, msm8251_control_w)
545545   AM_RANGE(0xd0, 0xd0) AM_MIRROR(0x0f) AM_READWRITE(tandy200_bank_r, tandy200_bank_w)
r5190r5191
921921   }
922922}
923923
924static PIO8155_INTERFACE( kc85_8155_intf )
924static I8155_INTERFACE( kc85_8155_intf )
925925{
926926   DEVCB_NULL,                        /* port A read */
927927   DEVCB_NULL,                        /* port B read */
r5190r5191
991991   if (state->buzzer) speaker_level_w(state->speaker, state->bell);
992992}
993993
994static PIO8155_INTERFACE( pc8201_8155_intf )
994static I8155_INTERFACE( pc8201_8155_intf )
995995{
996996   DEVCB_NULL,                        /* port A read */
997997   DEVCB_NULL,                        /* port B read */
r5190r5191
10901090   }
10911091}
10921092
1093static PIO8155_INTERFACE( tandy200_8155_intf )
1093static I8155_INTERFACE( tandy200_8155_intf )
10941094{
10951095   DEVCB_NULL,                        /* port A read */
10961096   DEVCB_NULL,                        /* port B read */
r5190r5191
13261326   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
13271327
13281328   /* devices */
1329   MDRV_PIO8155_ADD(PIO8155_TAG, XTAL_4_9152MHz/2, kc85_8155_intf)
1329   MDRV_I8155_ADD(I8155_TAG, XTAL_4_9152MHz/2, kc85_8155_intf)
13301330   MDRV_UPD1990A_ADD(UPD1990A_TAG, XTAL_32_768kHz, kc85_upd1990a_intf)
13311331
13321332   /* printer */
r5190r5191
13611361   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
13621362
13631363   /* devices */
1364   MDRV_PIO8155_ADD(PIO8155_TAG, XTAL_4_9152MHz/2, pc8201_8155_intf)
1364   MDRV_I8155_ADD(I8155_TAG, XTAL_4_9152MHz/2, pc8201_8155_intf)
13651365   MDRV_UPD1990A_ADD(UPD1990A_TAG, XTAL_32_768kHz, kc85_upd1990a_intf)
13661366
13671367   /* printer */
r5190r5191
14131413//   MDRV_TCM5089_ADD(TCM5089_TAG, XTAL_3_579545MHz)
14141414
14151415   /* devices */
1416   MDRV_PIO8155_ADD(PIO8155_TAG, XTAL_4_9152MHz/2, tandy200_8155_intf)
1416   MDRV_I8155_ADD(I8155_TAG, XTAL_4_9152MHz/2, tandy200_8155_intf)
14171417   MDRV_RP5C01A_ADD(RP5C01A_TAG, XTAL_32_768kHz, tandy200_rp5c01a_intf)
14181418   MDRV_MSM8251_ADD(MSM8251_TAG, /*XTAL_4_9152MHz/2,*/ tandy200_msm8251_interface)
14191419//   MDRV_MC14412_ADD(MC14412_TAG, XTAL_1MHz)

Previous 15994 Revisions Next


© 1998-2018 The MESS Team