Previous 15994 Revisions Next

r2417 Saturday 19th April, 2008 at 19:24:46 UTC by Wilbert Pol
Converted the ppi8255 implementation to a device.
[src/emu/machine]8255ppi.c 8255ppi.h
[src/mess/audio]dai.c
[src/mess/drivers]amstrad.c atom.c bw2.c compis.c dai.c lviv.c mikro80.c mpf1.c msx.c mz700.c orion.c pc.c pc8801.c pmd85.c sg1000.c sord.c special.c ut88.c x68k.c
[src/mess/includes]atom.h compis.h dai.h lviv.h mikro80.h msx.h mz700.h orion.h pc8801.h pmd85.h special.h svi318.h ut88.h
[src/mess/machine]atom.c compis.c dai.c ibmpc.c lviv.c mikro80.c msx.c msx_slot.c mz700.c orion.c pc.c pc8801.c pmd85.c special.c svi318.c ut88.c
[src/mess/video]dai.c pc8801.c

src/emu/machine/8255ppi.c
r2416r2417
9191*********************************************************************/
9292
9393#include "driver.h"
94#include "deprecat.h"
9594#include "8255ppi.h"
96#include "memconv.h"
9795
96typedef struct _ppi8255 ppi8255_t;
9897
99static int num;
98struct _ppi8255
99{
100   const ppi8255_interface   *intf;
100101
101typedef struct
102{
103102   read8_machine_func port_read[3];
104103   write8_machine_func port_write[3];
105104
r2416r2417
124123   UINT8 read[3];      /* data read from ports */
125124   UINT8 latch[3];      /* data written to ports */
126125   UINT8 output[3];   /* actual output data */
127} ppi8255;
126};
128127
129static ppi8255 chips[MAX_8255];
130128
131static void set_mode(int which, int data, int call_handlers);
132static void ppi8255_write_port(ppi8255 *chip, int port);
129static void set_mode(const device_config *device, int data, int call_handlers);
130static void ppi8255_write_port(const device_config *device, int port);
133131
134132
135void ppi8255_init( const ppi8255_interface *intfce )
136{
137   int i;
138
139   num = intfce->num;
140
141   for (i = 0; i < num; i++)
142   {
143      ppi8255 *chip = &chips[i];
144
145      memset(chip, 0, sizeof(*chip));
146
147      chip->port_read[0] = intfce->portAread[i];
148      chip->port_read[1] = intfce->portBread[i];
149      chip->port_read[2] = intfce->portCread[i];
150      chip->port_write[0] = intfce->portAwrite[i];
151      chip->port_write[1] = intfce->portBwrite[i];
152      chip->port_write[2] = intfce->portCwrite[i];
153
154      set_mode(i, 0x1b, 0);   /* Mode 0, all ports set to input */
155
156      state_save_register_item("ppi8255", i, chip->groupA_mode);
157      state_save_register_item("ppi8255", i, chip->groupB_mode);
158      state_save_register_item("ppi8255", i, chip->portA_dir);
159      state_save_register_item("ppi8255", i, chip->portB_dir);
160      state_save_register_item("ppi8255", i, chip->portCH_dir);
161      state_save_register_item("ppi8255", i, chip->portCL_dir);
162      state_save_register_item("ppi8255", i, chip->obf_a);
163      state_save_register_item("ppi8255", i, chip->obf_b);
164      state_save_register_item("ppi8255", i, chip->ibf_a);
165      state_save_register_item("ppi8255", i, chip->ibf_b);
166      state_save_register_item("ppi8255", i, chip->inte_a);
167      state_save_register_item("ppi8255", i, chip->inte_b);
168      state_save_register_item_array("ppi8255", i, chip->in_mask);
169      state_save_register_item_array("ppi8255", i, chip->out_mask);
170      state_save_register_item_array("ppi8255", i, chip->read);
171      state_save_register_item_array("ppi8255", i, chip->latch);
172   }
133INLINE ppi8255_t *get_safe_token(const device_config *device) {
134   assert( device != NULL );
135   assert( device->token != NULL );
136   assert( device->type == DEVICE_GET_INFO_NAME(ppi8255) );
137   return ( ppi8255_t * ) device->token;
173138}
174139
175140
176
177static void ppi8255_get_handshake_signals(ppi8255 *chip, int is_read, UINT8 *result)
141INLINE void ppi8255_get_handshake_signals(ppi8255_t *ppi8255, int is_read, UINT8 *result)
178142{
179143   UINT8 handshake = 0x00;
180144   UINT8 mask = 0x00;
181145
182146   /* group A */
183   if (chip->groupA_mode == 1)
147   if (ppi8255->groupA_mode == 1)
184148   {
185      if (chip->portA_dir)
149      if (ppi8255->portA_dir)
186150      {
187         handshake |= chip->ibf_a ? 0x20 : 0x00;
188         handshake |= (chip->ibf_a && chip->inte_a) ? 0x08 : 0x00;
151         handshake |= ppi8255->ibf_a ? 0x20 : 0x00;
152         handshake |= (ppi8255->ibf_a && ppi8255->inte_a) ? 0x08 : 0x00;
189153         mask |= 0x28;
190154      }
191155      else
192156      {
193         handshake |= chip->obf_a ? 0x00 : 0x80;
194         handshake |= (chip->obf_a && chip->inte_a) ? 0x08 : 0x00;
157         handshake |= ppi8255->obf_a ? 0x00 : 0x80;
158         handshake |= (ppi8255->obf_a && ppi8255->inte_a) ? 0x08 : 0x00;
195159         mask |= 0x88;
196160      }
197161   }
198   else if (chip->groupA_mode == 2)
162   else if (ppi8255->groupA_mode == 2)
199163     {
200      handshake |= chip->inte_a ? 0x08 : 0x00;
201      handshake |= chip->obf_a ? 0x00 : 0x80;
202      handshake |= chip->ibf_a ? 0x20 : 0x00;
164      handshake |= ppi8255->inte_a ? 0x08 : 0x00;
165      handshake |= ppi8255->obf_a ? 0x00 : 0x80;
166      handshake |= ppi8255->ibf_a ? 0x20 : 0x00;
203167      mask |= 0xA8;
204168   }
205169
206170   /* group B */
207   if (chip->groupB_mode == 1)
171   if (ppi8255->groupB_mode == 1)
208172     {
209      if (chip->portA_dir)
173      if (ppi8255->portA_dir)
210174      {
211         handshake |= chip->ibf_b ? 0x02 : 0x00;
212         handshake |= (chip->ibf_b && chip->inte_b) ? 0x01 : 0x00;
175         handshake |= ppi8255->ibf_b ? 0x02 : 0x00;
176         handshake |= (ppi8255->ibf_b && ppi8255->inte_b) ? 0x01 : 0x00;
213177         mask |= 0x03;
214178        }
215179      else
216180        {
217         handshake |= chip->obf_b ? 0x00 : 0x02;
218         handshake |= (chip->obf_b && chip->inte_b) ? 0x01 : 0x00;
181         handshake |= ppi8255->obf_b ? 0x00 : 0x02;
182         handshake |= (ppi8255->obf_b && ppi8255->inte_b) ? 0x01 : 0x00;
219183         mask |= 0x03;
220184      }
221185     }
r2416r2417
226190
227191
228192
229static void ppi8255_input(ppi8255 *chip, int port, UINT8 data)
193static void ppi8255_input(const device_config *device, int port, UINT8 data)
230194{
195   ppi8255_t   *ppi8255 = get_safe_token(device);
231196   int changed = 0;
232197
233   chip->read[port] = data;
198   ppi8255->read[port] = data;
234199
235200   /* port C is special */
236201   if (port == 2)
237202   {
238      if (((chip->groupA_mode == 1) && (chip->portA_dir == 0)) || (chip->groupA_mode == 2))
203      if (((ppi8255->groupA_mode == 1) && (ppi8255->portA_dir == 0)) || (ppi8255->groupA_mode == 2))
239204      {
240205         /* is !ACKA asserted? */
241         if (chip->obf_a && !(data & 0x40))
206         if (ppi8255->obf_a && !(data & 0x40))
242207         {
243            chip->obf_a = 0;
208            ppi8255->obf_a = 0;
244209            changed = 1;
245210         }
246211      }
247212
248      if ((chip->groupB_mode == 1) && (chip->portB_dir == 0))
213      if ((ppi8255->groupB_mode == 1) && (ppi8255->portB_dir == 0))
249214      {
250215         /* is !ACKB asserted? */
251         if (chip->obf_b && !(data & 0x04))
216         if (ppi8255->obf_b && !(data & 0x04))
252217         {
253            chip->obf_b = 0;
218            ppi8255->obf_b = 0;
254219            changed = 1;
255220         }
256221      }
257222
258223      if (changed)
259         ppi8255_write_port(chip, 2);
224         ppi8255_write_port(device, 2);
260225   }
261226}
262227
263228
264229
265static UINT8 ppi8255_read_port(ppi8255 *chip, int port)
230static UINT8 ppi8255_read_port(const device_config *device, int port)
266231{
232   ppi8255_t   *ppi8255 = get_safe_token(device);
267233   UINT8 result = 0x00;
268234
269   if (chip->in_mask[port])
235   if (ppi8255->in_mask[port])
270236   {
271      if (chip->port_read[port])
272         ppi8255_input(chip, port, chip->port_read[port](Machine, 0));
237      if (ppi8255->port_read[port])
238         ppi8255_input(device, port, ppi8255->port_read[port](device->machine, 0));
273239
274      result |= chip->read[port] & chip->in_mask[port];
240      result |= ppi8255->read[port] & ppi8255->in_mask[port];
275241   }
276   result |= chip->latch[port] & chip->out_mask[port];
242   result |= ppi8255->latch[port] & ppi8255->out_mask[port];
277243
278244   /* read special port 2 signals */
279245   if (port == 2)
280      ppi8255_get_handshake_signals(chip, 1, &result);
246      ppi8255_get_handshake_signals(ppi8255, 1, &result);
281247
282248   return result;
283249}
284250
285251
286252
287UINT8 ppi8255_r(int which, offs_t offset)
253READ8_DEVICE_HANDLER( ppi8255_r )
288254{
289   ppi8255 *chip = &chips[which];
290255   UINT8 result = 0;
291256
292   /* some bounds checking */
293   if (which > num)
294   {
295      logerror("Attempting to access an unmapped 8255 chip.  PC: %04X\n", activecpu_get_pc());
296      return 0xff;
297   }
298
299257   offset %= 4;
300258
301259   switch(offset)
r2416r2417
303261      case 0: /* Port A read */
304262      case 1: /* Port B read */
305263      case 2: /* Port C read */
306         result = ppi8255_read_port(chip, offset);
264         result = ppi8255_read_port(device, offset);
307265         break;
308266
309267      case 3: /* Control word */
r2416r2417
316274
317275
318276
319static void ppi8255_write_port(ppi8255 *chip, int port)
277static void ppi8255_write_port(const device_config *device, int port)
320278{
279   ppi8255_t   *ppi8255 = get_safe_token(device);
321280   UINT8 write_data;
322281
323   write_data = chip->latch[port] & chip->out_mask[port];
324   write_data |= 0xFF & ~chip->out_mask[port];
282   write_data = ppi8255->latch[port] & ppi8255->out_mask[port];
283   write_data |= 0xFF & ~ppi8255->out_mask[port];
325284
326285   /* write out special port 2 signals */
327286   if (port == 2)
328      ppi8255_get_handshake_signals(chip, 0, &write_data);
287      ppi8255_get_handshake_signals(ppi8255, 0, &write_data);
329288
330   chip->output[port] = write_data;
331   if (chip->port_write[port])
332      chip->port_write[port](Machine, 0, write_data);
289   ppi8255->output[port] = write_data;
290   if (ppi8255->port_write[port])
291      ppi8255->port_write[port](device->machine, 0, write_data);
333292}
334293
335294
336295
337void ppi8255_w(int which, offs_t offset, UINT8 data)
296WRITE8_DEVICE_HANDLER( ppi8255_w )
338297{
339   ppi8255   *chip = &chips[which];
298   ppi8255_t   *ppi8255 = get_safe_token(device);
340299
341   /* Some bounds checking */
342   if (which > num)
343   {
344      logerror("Attempting to access an unmapped 8255 chip.  PC: %04X\n", activecpu_get_pc());
345      return;
346   }
347
348300   offset %= 4;
349301
350302     switch( offset )
r2416r2417
352304        case 0: /* Port A write */
353305      case 1: /* Port B write */
354306        case 2: /* Port C write */
355         chip->latch[offset] = data;
356         ppi8255_write_port(chip, offset);
307         ppi8255->latch[offset] = data;
308         ppi8255_write_port(device, offset);
357309
358310         switch(offset)
359311         {
360312            case 0:
361               if (!chip->portA_dir && (chip->groupA_mode != 0))
313               if (!ppi8255->portA_dir && (ppi8255->groupA_mode != 0))
362314               {
363                  chip->obf_a = 1;
364                  ppi8255_write_port(chip, 2);
315                  ppi8255->obf_a = 1;
316                  ppi8255_write_port(device, 2);
365317               }
366318               break;
367319
368320            case 1:
369               if (!chip->portB_dir && (chip->groupB_mode != 0))
321               if (!ppi8255->portB_dir && (ppi8255->groupB_mode != 0))
370322               {
371                  chip->obf_b = 1;
372                  ppi8255_write_port(chip, 2);
323                  ppi8255->obf_b = 1;
324                  ppi8255_write_port(device, 2);
373325               }
374326               break;
375327         }
r2416r2417
378330      case 3: /* Control word */
379331         if (data & 0x80)
380332         {
381            set_mode(which, data & 0x7f, 1);
333            set_mode(device, data & 0x7f, 1);
382334         }
383335         else
384336         {
r2416r2417
388340              bit = (data >> 1) & 0x07;
389341
390342              if (data & 1)
391               chip->latch[2] |= (1<<bit);      /* set bit */
343               ppi8255->latch[2] |= (1<<bit);      /* set bit */
392344              else
393               chip->latch[2] &= ~(1<<bit);   /* reset bit */
345               ppi8255->latch[2] &= ~(1<<bit);   /* reset bit */
394346
395            ppi8255_write_port(chip, 2);
347            ppi8255_write_port(device, 2);
396348         }
397349         break;
398350   }
399351}
400352
401#ifdef MESS
402UINT8 ppi8255_peek( int which, offs_t offset )
353
354void ppi8255_set_portAread(const device_config *device, read8_machine_func portAread)
403355{
404   ppi8255 *chip;
356   ppi8255_t   *ppi8255 = get_safe_token(device);
405357
358   ppi8255->port_read[0] = portAread;
359}
406360
407   /* Some bounds checking */
408   if (which > num)
409   {
410      logerror("Attempting to access an unmapped 8255 chip.  PC: %04X\n", activecpu_get_pc());
411      return 0xff;
412   }
361void ppi8255_set_portBread(const device_config *device, read8_machine_func portBread)
362{
363   ppi8255_t   *ppi8255 = get_safe_token(device);
413364
414   chip = &chips[which];
365   ppi8255->port_read[1] = portBread;
366}
415367
368void ppi8255_set_portCread(const device_config *device, read8_machine_func portCread)
369{
370   ppi8255_t   *ppi8255 = get_safe_token(device);
416371
417   if (offset > 2)
418   {
419      logerror("Attempting to access an invalid 8255 port.  PC: %04X\n", activecpu_get_pc());
420      return 0xff;
421   }
422
423
424   chip = &chips[which];
425
426   return chip->latch[offset];
372   ppi8255->port_read[2] = portCread;
427373}
428#endif
429374
430375
431void ppi8255_set_portAread(int which, read8_machine_func portAread)
376void ppi8255_set_portAwrite(const device_config *device, write8_machine_func portAwrite)
432377{
433   chips[which].port_read[0] = portAread;
434}
378   ppi8255_t   *ppi8255 = get_safe_token(device);
435379
436void ppi8255_set_portBread(int which, read8_machine_func portBread)
437{
438   chips[which].port_read[1] = portBread;
380   ppi8255->port_write[0] = portAwrite;
439381}
440382
441void ppi8255_set_portCread(int which, read8_machine_func portCread)
383void ppi8255_set_portBwrite(const device_config *device, write8_machine_func portBwrite)
442384{
443   chips[which].port_read[2] = portCread;
444}
385   ppi8255_t   *ppi8255 = get_safe_token(device);
445386
446
447void ppi8255_set_portAwrite(int which, write8_machine_func portAwrite)
448{
449   chips[which].port_write[0] = portAwrite;
387   ppi8255->port_write[1] = portBwrite;
450388}
451389
452void ppi8255_set_portBwrite(int which, write8_machine_func portBwrite)
390void ppi8255_set_portCwrite(const device_config *device, write8_machine_func portCwrite)
453391{
454   chips[which].port_write[1] = portBwrite;
455}
392   ppi8255_t   *ppi8255 = get_safe_token(device);
456393
457void ppi8255_set_portCwrite(int which, write8_machine_func portCwrite)
458{
459   chips[which].port_write[2] = portCwrite;
394   ppi8255->port_write[2] = portCwrite;
460395}
461396
462397
463static void set_mode(int which, int data, int call_handlers)
398static void set_mode(const device_config *device, int data, int call_handlers)
464399{
465   ppi8255 *chip = &chips[which];
400   ppi8255_t   *ppi8255 = get_safe_token(device);
466401   int i;
467402
468403   /* parse out mode */
469   chip->groupA_mode = (data >> 5) & 3;
470   chip->groupB_mode = (data >> 2) & 1;
471   chip->portA_dir = (data >> 4) & 1;
472   chip->portB_dir = (data >> 1) & 1;
473   chip->portCH_dir = (data >> 3) & 1;
474   chip->portCL_dir = (data >> 0) & 1;
404   ppi8255->groupA_mode = (data >> 5) & 3;
405   ppi8255->groupB_mode = (data >> 2) & 1;
406   ppi8255->portA_dir = (data >> 4) & 1;
407   ppi8255->portB_dir = (data >> 1) & 1;
408   ppi8255->portCH_dir = (data >> 3) & 1;
409   ppi8255->portCL_dir = (data >> 0) & 1;
475410
476411   /* normalize groupA_mode */
477   if (chip->groupA_mode == 3)
478      chip->groupA_mode = 2;
412   if (ppi8255->groupA_mode == 3)
413      ppi8255->groupA_mode = 2;
479414
480415     /* Port A direction */
481   if (chip->portA_dir)
482      chip->in_mask[0] = 0xFF, chip->out_mask[0] = 0x00;   /* input */
416   if (ppi8255->portA_dir)
417      ppi8255->in_mask[0] = 0xFF, ppi8255->out_mask[0] = 0x00;   /* input */
483418    else
484      chip->in_mask[0] = 0x00, chip->out_mask[0] = 0xFF;    /* output */
419      ppi8255->in_mask[0] = 0x00, ppi8255->out_mask[0] = 0xFF;    /* output */
485420
486421     /* Port B direction */
487   if (chip->portB_dir)
488      chip->in_mask[1] = 0xFF, chip->out_mask[1] = 0x00;   /* input */
422   if (ppi8255->portB_dir)
423      ppi8255->in_mask[1] = 0xFF, ppi8255->out_mask[1] = 0x00;   /* input */
489424   else
490      chip->in_mask[1] = 0x00, chip->out_mask[1] = 0xFF;    /* output */
425      ppi8255->in_mask[1] = 0x00, ppi8255->out_mask[1] = 0xFF;    /* output */
491426
492427   /* Port C upper direction */
493   if (chip->portCH_dir)
494      chip->in_mask[2] = 0xF0, chip->out_mask[2] = 0x00;   /* input */
428   if (ppi8255->portCH_dir)
429      ppi8255->in_mask[2] = 0xF0, ppi8255->out_mask[2] = 0x00;   /* input */
495430   else
496      chip->in_mask[2] = 0x00, chip->out_mask[2] = 0xF0;   /* output */
431      ppi8255->in_mask[2] = 0x00, ppi8255->out_mask[2] = 0xF0;   /* output */
497432
498433     /* Port C lower direction */
499   if (chip->portCL_dir)
500      chip->in_mask[2] |= 0x0F;   /* input */
434   if (ppi8255->portCL_dir)
435      ppi8255->in_mask[2] |= 0x0F;   /* input */
501436   else
502      chip->out_mask[2] |= 0x0F;   /* output */
437      ppi8255->out_mask[2] |= 0x0F;   /* output */
503438
504439   /* now depending on the group modes, certain Port C lines may be replaced
505440     * with varying control signals */
506   switch(chip->groupA_mode)
441   switch(ppi8255->groupA_mode)
507442   {
508443      case 0:   /* Group A mode 0 */
509444         /* no changes */
r2416r2417
511446
512447      case 1:   /* Group A mode 1 */
513448         /* bits 5-3 are reserved by Group A mode 1 */
514         chip->in_mask[2] &= ~0x38;
515         chip->out_mask[2] &= ~0x38;
449         ppi8255->in_mask[2] &= ~0x38;
450         ppi8255->out_mask[2] &= ~0x38;
516451         break;
517452
518453      case 2: /* Group A mode 2 */
519454         /* bits 7-3 are reserved by Group A mode 2 */
520         chip->in_mask[2] &= ~0xF8;
521         chip->out_mask[2] &= ~0xF8;
455         ppi8255->in_mask[2] &= ~0xF8;
456         ppi8255->out_mask[2] &= ~0xF8;
522457         break;
523458   }
524459
525   switch(chip->groupB_mode)
460   switch(ppi8255->groupB_mode)
526461   {
527462      case 0:   /* Group B mode 0 */
528463         /* no changes */
r2416r2417
530465
531466      case 1:   /* Group B mode 1 */
532467         /* bits 2-0 are reserved by Group B mode 1 */
533         chip->in_mask[2] &= ~0x07;
534         chip->out_mask[2] &= ~0x07;
468         ppi8255->in_mask[2] &= ~0x07;
469         ppi8255->out_mask[2] &= ~0x07;
535470         break;
536471      }
537472
538473   /* KT: 25-Dec-99 - 8255 resets latches when mode set */
539   chip->latch[0] = chip->latch[1] = chip->latch[2] = 0;
474   ppi8255->latch[0] = ppi8255->latch[1] = ppi8255->latch[2] = 0;
540475
541476   if (call_handlers)
542477   {
543478      for (i = 0; i < 3; i++)
544         ppi8255_write_port(chip, i);
479         ppi8255_write_port(device, i);
545480   }
546481}
547482
548483
549void ppi8255_set_portA( int which, UINT8 data ) { ppi8255_input(&chips[which], 0, data); }
550void ppi8255_set_portB( int which, UINT8 data ) { ppi8255_input(&chips[which], 1, data); }
551void ppi8255_set_portC( int which, UINT8 data ) { ppi8255_input(&chips[which], 2, data); }
484void ppi8255_set_portA( const device_config *device, UINT8 data ) { ppi8255_input(device, 0, data); }
485void ppi8255_set_portB( const device_config *device, UINT8 data ) { ppi8255_input(device, 1, data); }
486void ppi8255_set_portC( const device_config *device, UINT8 data ) { ppi8255_input(device, 2, data); }
552487
553UINT8 ppi8255_get_portA( int which ) { return chips[which].output[0]; }
554UINT8 ppi8255_get_portB( int which ) { return chips[which].output[1]; }
555UINT8 ppi8255_get_portC( int which ) { return chips[which].output[2]; }
488UINT8 ppi8255_get_portA( const device_config *device ) {
489   ppi8255_t   *ppi8255 = get_safe_token(device);
556490
557/* Helpers */
558READ8_HANDLER( ppi8255_0_r ) { return ppi8255_r( 0, offset ); }
559READ8_HANDLER( ppi8255_1_r ) { return ppi8255_r( 1, offset ); }
560READ8_HANDLER( ppi8255_2_r ) { return ppi8255_r( 2, offset ); }
561READ8_HANDLER( ppi8255_3_r ) { return ppi8255_r( 3, offset ); }
562READ8_HANDLER( ppi8255_4_r ) { return ppi8255_r( 4, offset ); }
563READ8_HANDLER( ppi8255_5_r ) { return ppi8255_r( 5, offset ); }
564READ8_HANDLER( ppi8255_6_r ) { return ppi8255_r( 6, offset ); }
565READ8_HANDLER( ppi8255_7_r ) { return ppi8255_r( 7, offset ); }
566WRITE8_HANDLER( ppi8255_0_w ) { ppi8255_w( 0, offset, data ); }
567WRITE8_HANDLER( ppi8255_1_w ) { ppi8255_w( 1, offset, data ); }
568WRITE8_HANDLER( ppi8255_2_w ) { ppi8255_w( 2, offset, data ); }
569WRITE8_HANDLER( ppi8255_3_w ) { ppi8255_w( 3, offset, data ); }
570WRITE8_HANDLER( ppi8255_4_w ) { ppi8255_w( 4, offset, data ); }
571WRITE8_HANDLER( ppi8255_5_w ) { ppi8255_w( 5, offset, data ); }
572WRITE8_HANDLER( ppi8255_6_w ) { ppi8255_w( 6, offset, data ); }
573WRITE8_HANDLER( ppi8255_7_w ) { ppi8255_w( 7, offset, data ); }
491   return ppi8255->output[0];
492}
574493
575READ16_HANDLER( ppi8255_16le_0_r ) { return read16le_with_read8_handler(ppi8255_0_r, machine, offset, mem_mask); }
576READ16_HANDLER( ppi8255_16le_1_r ) { return read16le_with_read8_handler(ppi8255_1_r, machine, offset, mem_mask); }
577READ16_HANDLER( ppi8255_16le_2_r ) { return read16le_with_read8_handler(ppi8255_2_r, machine, offset, mem_mask); }
578READ16_HANDLER( ppi8255_16le_3_r ) { return read16le_with_read8_handler(ppi8255_3_r, machine, offset, mem_mask); }
579READ16_HANDLER( ppi8255_16le_4_r ) { return read16le_with_read8_handler(ppi8255_4_r, machine, offset, mem_mask); }
580READ16_HANDLER( ppi8255_16le_5_r ) { return read16le_with_read8_handler(ppi8255_5_r, machine, offset, mem_mask); }
581READ16_HANDLER( ppi8255_16le_6_r ) { return read16le_with_read8_handler(ppi8255_6_r, machine, offset, mem_mask); }
582READ16_HANDLER( ppi8255_16le_7_r ) { return read16le_with_read8_handler(ppi8255_7_r, machine, offset, mem_mask); }
583WRITE16_HANDLER( ppi8255_16le_0_w ) { write16le_with_write8_handler(ppi8255_0_w, machine, offset, data, mem_mask); }
584WRITE16_HANDLER( ppi8255_16le_1_w ) { write16le_with_write8_handler(ppi8255_1_w, machine, offset, data, mem_mask); }
585WRITE16_HANDLER( ppi8255_16le_2_w ) { write16le_with_write8_handler(ppi8255_2_w, machine, offset, data, mem_mask); }
586WRITE16_HANDLER( ppi8255_16le_3_w ) { write16le_with_write8_handler(ppi8255_3_w, machine, offset, data, mem_mask); }
587WRITE16_HANDLER( ppi8255_16le_4_w ) { write16le_with_write8_handler(ppi8255_4_w, machine, offset, data, mem_mask); }
588WRITE16_HANDLER( ppi8255_16le_5_w ) { write16le_with_write8_handler(ppi8255_5_w, machine, offset, data, mem_mask); }
589WRITE16_HANDLER( ppi8255_16le_6_w ) { write16le_with_write8_handler(ppi8255_6_w, machine, offset, data, mem_mask); }
590WRITE16_HANDLER( ppi8255_16le_7_w ) { write16le_with_write8_handler(ppi8255_7_w, machine, offset, data, mem_mask); }
494UINT8 ppi8255_get_portB( const device_config *device ) {
495   ppi8255_t   *ppi8255 = get_safe_token(device);
496
497   return ppi8255->output[1];
498}
499
500UINT8 ppi8255_get_portC( const device_config *device ) {
501   ppi8255_t   *ppi8255 = get_safe_token(device);
502
503   return ppi8255->output[2];
504}
505
506
507static DEVICE_START( ppi8255 ) {
508   ppi8255_t   *ppi8255 = get_safe_token(device);
509   char      unique_tag[30];
510
511   ppi8255->intf = device->static_config;
512
513   ppi8255->port_read[0] = ppi8255->intf->portAread;
514   ppi8255->port_read[1] = ppi8255->intf->portBread;
515   ppi8255->port_read[2] = ppi8255->intf->portCread;
516
517   ppi8255->port_write[0] = ppi8255->intf->portAwrite;
518   ppi8255->port_write[1] = ppi8255->intf->portBwrite;
519   ppi8255->port_write[2] = ppi8255->intf->portCwrite;
520
521   /* register for state saving */
522   state_save_combine_module_and_tag(unique_tag, "ppi8255", device->tag);
523
524   state_save_register_item(unique_tag, 0, ppi8255->groupA_mode);
525   state_save_register_item(unique_tag, 0, ppi8255->groupB_mode);
526   state_save_register_item(unique_tag, 0, ppi8255->portA_dir);
527   state_save_register_item(unique_tag, 0, ppi8255->portB_dir);
528   state_save_register_item(unique_tag, 0, ppi8255->portCH_dir);
529   state_save_register_item(unique_tag, 0, ppi8255->portCL_dir);
530   state_save_register_item(unique_tag, 0, ppi8255->obf_a);
531   state_save_register_item(unique_tag, 0, ppi8255->obf_b);
532   state_save_register_item(unique_tag, 0, ppi8255->ibf_a);
533   state_save_register_item(unique_tag, 0, ppi8255->ibf_b);
534   state_save_register_item(unique_tag, 0, ppi8255->inte_a);
535   state_save_register_item(unique_tag, 0, ppi8255->inte_b);
536   state_save_register_item_array(unique_tag, 0, ppi8255->in_mask);
537   state_save_register_item_array(unique_tag, 0, ppi8255->out_mask);
538   state_save_register_item_array(unique_tag, 0, ppi8255->read);
539   state_save_register_item_array(unique_tag, 0, ppi8255->latch);
540}
541
542
543static DEVICE_RESET( ppi8255 ) {
544   ppi8255_t   *ppi8255 = get_safe_token(device);
545   int         i;
546
547   ppi8255->groupA_mode = 0;
548   ppi8255->groupB_mode = 0;
549   ppi8255->portA_dir = 0;
550   ppi8255->portB_dir = 0;
551   ppi8255->portCH_dir = 0;
552   ppi8255->portCL_dir = 0;
553   ppi8255->obf_a = ppi8255->ibf_a = ppi8255->inte_a = 0;
554   ppi8255->obf_b = ppi8255->ibf_b = ppi8255->inte_b = 0;
555
556   for ( i = 0; i < 3; i++ ) {
557      ppi8255->in_mask[i] = ppi8255->out_mask[i] = ppi8255->read[i] = ppi8255->latch[i] = ppi8255->output[i] = 0;
558   }
559
560   set_mode(device, 0x1b, 0);   /* Mode 0, all ports set to input */
561}
562
563
564static DEVICE_SET_INFO( ppi8255 ) {
565   switch ( state ) {
566      /* no parameters to set */
567   }
568}
569
570
571DEVICE_GET_INFO(ppi8255) {
572   switch ( state ) {
573      /* --- the following bits of info are returned as 64-bit signed integers --- */
574      case DEVINFO_INT_TOKEN_BYTES:            info->i = sizeof(ppi8255_t);            break;
575      case DEVINFO_INT_INLINE_CONFIG_BYTES:      info->i = 0;                        break;
576      case DEVINFO_INT_CLASS:                  info->i = DEVICE_CLASS_PERIPHERAL;         break;
577
578      /* --- the following bits of info are returned as pointers to data or functions --- */
579      case DEVINFO_FCT_SET_INFO:               info->set_info = DEVICE_SET_INFO_NAME(ppi8255);   break;
580      case DEVINFO_FCT_START:                  info->start = DEVICE_START_NAME(ppi8255);   break;
581      case DEVINFO_FCT_STOP:                  /* nothing */                        break;
582      case DEVINFO_FCT_RESET:                  info->reset = DEVICE_RESET_NAME(ppi8255);   break;
583
584      /* --- the following bits of info are returned as NULL-terminated strings --- */
585      case DEVINFO_STR_NAME:                  info->s = "Intel PPI8255";               break;
586      case DEVINFO_STR_FAMILY:               info->s = "PPI8255";                  break;
587      case DEVINFO_STR_VERSION:               info->s = "1.00";                     break;
588      case DEVINFO_STR_SOURCE_FILE:            info->s = __FILE__;                     break;
589      case DEVINFO_STR_CREDITS:               info->s = "Copyright the MAME and MESS Teams"; break;
590   }
591}
592
src/emu/machine/8255ppi.h
r2416r2417
66
77*********************************************************************/
88
9#ifndef _8255PPI_H_
10#define _8255PPI_H_
9#ifndef __8255PPI_H_
10#define __8255PPI_H_
1111
12#define MAX_8255 8
12#define PPI8255      DEVICE_GET_INFO_NAME(ppi8255)
1313
14
1415typedef struct
1516{
16   int num;                      /* number of PPIs to emulate */
17   read8_machine_func portAread[MAX_8255];
18   read8_machine_func portBread[MAX_8255];
19   read8_machine_func portCread[MAX_8255];
20   write8_machine_func portAwrite[MAX_8255];
21   write8_machine_func portBwrite[MAX_8255];
22   write8_machine_func portCwrite[MAX_8255];
17   read8_machine_func portAread;
18   read8_machine_func portBread;
19   read8_machine_func portCread;
20   write8_machine_func portAwrite;
21   write8_machine_func portBwrite;
22   write8_machine_func portCwrite;
2323} ppi8255_interface;
2424
2525
26/* Init */
27void ppi8255_init( const ppi8255_interface *intfce);
26/* device interface */
27DEVICE_GET_INFO(ppi8255);
2828
29/* Read/Write */
30UINT8 ppi8255_r ( int which, offs_t offset );
31void ppi8255_w( int which, offs_t offset, UINT8 data );
29READ8_DEVICE_HANDLER( ppi8255_r );
30WRITE8_DEVICE_HANDLER( ppi8255_w );
3231
33void ppi8255_set_portAread( int which, read8_machine_func portAread);
34void ppi8255_set_portBread( int which, read8_machine_func portBread);
35void ppi8255_set_portCread( int which, read8_machine_func portCread);
3632
37void ppi8255_set_portAwrite( int which, write8_machine_func portAwrite);
38void ppi8255_set_portBwrite( int which, write8_machine_func portBwrite);
39void ppi8255_set_portCwrite( int which, write8_machine_func portCwrite);
33void ppi8255_set_portAread( const device_config *device, read8_machine_func portAread );
34void ppi8255_set_portBread( const device_config *device, read8_machine_func portBread );
35void ppi8255_set_portCread( const device_config *device, read8_machine_func portCread );
4036
41void ppi8255_set_portA( int which, UINT8 data );
42void ppi8255_set_portB( int which, UINT8 data );
43void ppi8255_set_portC( int which, UINT8 data );
37void ppi8255_set_portAwrite( const device_config *device, write8_machine_func portAwrite );
38void ppi8255_set_portBwrite( const device_config *device, write8_machine_func portBwrite );
39void ppi8255_set_portCwrite( const device_config *device, write8_machine_func portCwrite );
4440
45UINT8 ppi8255_get_portA( int which );
46UINT8 ppi8255_get_portB( int which );
47UINT8 ppi8255_get_portC( int which );
41void ppi8255_set_portA( const device_config *device, UINT8 data );
42void ppi8255_set_portB( const device_config *device, UINT8 data );
43void ppi8255_set_portC( const device_config *device, UINT8 data );
4844
49/* Helpers */
50READ8_HANDLER( ppi8255_0_r );
51READ8_HANDLER( ppi8255_1_r );
52READ8_HANDLER( ppi8255_2_r );
53READ8_HANDLER( ppi8255_3_r );
54READ8_HANDLER( ppi8255_4_r );
55READ8_HANDLER( ppi8255_5_r );
56READ8_HANDLER( ppi8255_6_r );
57READ8_HANDLER( ppi8255_7_r );
58WRITE8_HANDLER( ppi8255_0_w );
59WRITE8_HANDLER( ppi8255_1_w );
60WRITE8_HANDLER( ppi8255_2_w );
61WRITE8_HANDLER( ppi8255_3_w );
62WRITE8_HANDLER( ppi8255_4_w );
63WRITE8_HANDLER( ppi8255_5_w );
64WRITE8_HANDLER( ppi8255_6_w );
65WRITE8_HANDLER( ppi8255_7_w );
45UINT8 ppi8255_get_portA( const device_config *device );
46UINT8 ppi8255_get_portB( const device_config *device );
47UINT8 ppi8255_get_portC( const device_config *device );
6648
67READ16_HANDLER( ppi8255_16le_0_r );
68READ16_HANDLER( ppi8255_16le_1_r );
69READ16_HANDLER( ppi8255_16le_2_r );
70READ16_HANDLER( ppi8255_16le_3_r );
71READ16_HANDLER( ppi8255_16le_4_r );
72READ16_HANDLER( ppi8255_16le_5_r );
73READ16_HANDLER( ppi8255_16le_6_r );
74READ16_HANDLER( ppi8255_16le_7_r );
75WRITE16_HANDLER( ppi8255_16le_0_w );
76WRITE16_HANDLER( ppi8255_16le_1_w );
77WRITE16_HANDLER( ppi8255_16le_2_w );
78WRITE16_HANDLER( ppi8255_16le_3_w );
79WRITE16_HANDLER( ppi8255_16le_4_w );
80WRITE16_HANDLER( ppi8255_16le_5_w );
81WRITE16_HANDLER( ppi8255_16le_6_w );
82WRITE16_HANDLER( ppi8255_16le_7_w );
83
84#ifdef MESS
85/* Peek at the ports */
86UINT8 ppi8255_peek( int which, offs_t offset );
87#endif
88
89#endif /* _8255PPI_H_ */
49#endif /* __8255PPI_H_ */
src/mess/audio/dai.c
r2416r2417
1111#include "driver.h"
1212#include "sound/custom.h"
1313#include "machine/pit8253.h"
14#include "machine/8255ppi.h"
1415#include "includes/dai.h"
1516#include "streams.h"
1617#include "deprecat.h"
src/mess/includes/compis.h
r2416r2417
1515
1616/*----------- defined in machine/compis.c -----------*/
1717
18extern const ppi8255_interface compis_ppi_interface;
1819extern const struct pit8253_config compis_pit8253_config;
1920extern const struct pit8253_config compis_pit8254_config;
2021extern const struct pic8259_interface compis_pic8259_master_config;
r2416r2417
2526INTERRUPT_GEN(compis_vblank_int);
2627
2728/* PPI 8255 */
28READ16_HANDLER (compis_ppi_r);
29WRITE16_HANDLER (compis_ppi_w);
29READ16_DEVICE_HANDLER (compis_ppi_r);
30WRITE16_DEVICE_HANDLER (compis_ppi_w);
3031
3132/* PIT 8253 */
3233READ16_DEVICE_HANDLER (compis_pit_r);
src/mess/includes/dai.h
r2416r2417
77#ifndef DAI_H_
88#define DAI_H_
99
10#include "machine/8255ppi.h"
1011
1112#define DAI_DEBUG   1
1213
r2416r2417
1415/*----------- defined in machine/dai.c -----------*/
1516
1617extern const struct pit8253_config dai_pit8253_intf;
18extern const ppi8255_interface dai_ppi82555_intf;
1719
1820MACHINE_START( dai );
1921READ8_HANDLER( dai_io_discrete_devices_r );
src/mess/includes/msx.h
r2416r2417
4646
4747/*----------- defined in machine/msx.c -----------*/
4848
49extern const ppi8255_interface msx_ppi8255_interface;
50
4951/* start/stop functions */
5052extern DRIVER_INIT( msx );
5153extern DRIVER_INIT( msx2 );
src/mess/includes/mz700.h
r2416r2417
1212#ifndef MZ700_H_
1313#define MZ700_H_
1414
15#include "machine/8255ppi.h"
1516
1617/*----------- defined in machine/mz700.c -----------*/
1718
1819extern const struct pit8253_config mz700_pit8253_config;
20extern const ppi8255_interface mz700_ppi8255_interface;
1921
2022DRIVER_INIT( mz700 );
2123MACHINE_RESET( mz700 );
src/mess/includes/pmd85.h
r2416r2417
77#ifndef PMD85_H_
88#define PMD85_H_
99
10#include "machine/8255ppi.h"
1011
1112/*----------- defined in machine/pmd85.c -----------*/
1213
1314extern const struct pit8253_config pmd85_pit8253_interface;
15extern const ppi8255_interface pmd85_ppi8255_interface[4];
16extern const ppi8255_interface alfa_ppi8255_interface[3];
17extern const ppi8255_interface mato_ppi8255_interface;
1418
1519 READ8_HANDLER ( pmd85_io_r );
1620WRITE8_HANDLER ( pmd85_io_w );
src/mess/includes/lviv.h
r2416r2417
88#define LVIV_H_
99
1010#include "devices/snapquik.h"
11#include "machine/8255ppi.h"
1112
12
1313/*----------- defined in machine/lviv.c -----------*/
1414
15extern const ppi8255_interface lviv_ppi8255_interface_0;
16extern const ppi8255_interface lviv_ppi8255_interface_1;
17
1518extern unsigned char * lviv_video_ram;
1619 READ8_HANDLER ( lviv_io_r );
1720WRITE8_HANDLER ( lviv_io_w );
src/mess/includes/pc8801.h
r2416r2417
1010
1111/*----------- defined in machine/pc8801.c -----------*/
1212
13extern const ppi8255_interface pc8801_8255_config_0;
14extern const ppi8255_interface pc8801_8255_config_1;
15
1316WRITE8_HANDLER(pc8801_write_interrupt_level);
1417WRITE8_HANDLER(pc8801_write_interrupt_mask);
1518 READ8_HANDLER(pc88sr_inport_30);
src/mess/includes/atom.h
r2416r2417
88#define ATOM_H_
99
1010#include "devices/snapquik.h"
11#include "machine/8255ppi.h"
1112
1213
1314/*----------- defined in machine/atom.c -----------*/
1415
16extern const ppi8255_interface atom_8255_int;
17
1518MACHINE_RESET( atom );
1619QUICKLOAD_LOAD( atom );
1720 READ8_HANDLER (atom_8255_porta_r);
src/mess/includes/orion.h
r2416r2417
1010
1111/*----------- defined in machine/orion.c -----------*/
1212
13extern const ppi8255_interface orion128_ppi8255_interface_1;
14extern const ppi8255_interface orion128_ppi8255_interface_2;
15
1316extern DRIVER_INIT( orion128 );
1417extern MACHINE_START( orion128 );
1518extern MACHINE_RESET( orion128 );
src/mess/includes/special.h
r2416r2417
77#ifndef SPECIAL_H_
88#define SPECIAL_H_
99
10#include "machine/8255ppi.h"
1011
1112/*----------- defined in machine/special.c -----------*/
1213
1314extern const struct pit8253_config specimx_pit8253_intf;
15extern const ppi8255_interface specialist_ppi8255_interface;
1416
1517extern DRIVER_INIT( special );
1618extern MACHINE_RESET( special );
src/mess/includes/mikro80.h
r2416r2417
1010
1111/*----------- defined in machine/mikro80.c -----------*/
1212
13extern const ppi8255_interface mikro80_ppi8255_interface;
14
1315extern DRIVER_INIT( mikro80 );
1416extern MACHINE_RESET( mikro80 );
15extern READ8_HANDLER( mikro80_keyboard_r );
16extern WRITE8_HANDLER( mikro80_keyboard_w );
17extern READ8_DEVICE_HANDLER( mikro80_keyboard_r );
18extern WRITE8_DEVICE_HANDLER( mikro80_keyboard_w );
1719extern READ8_HANDLER( mikro80_tape_r );
1820extern WRITE8_HANDLER( mikro80_tape_w );
1921
src/mess/includes/ut88.h
r2416r2417
77#ifndef UT88_H_
88#define UT88_H_
99
10#include "machine/8255ppi.h"
1011
1112/*----------- defined in machine/ut88.c -----------*/
13
14extern const ppi8255_interface ut88_ppi8255_interface;
15
1216extern DRIVER_INIT( ut88 );
1317extern MACHINE_RESET( ut88 );
14extern READ8_HANDLER( ut88_keyboard_r );
15extern WRITE8_HANDLER( ut88_keyboard_w );
18extern READ8_DEVICE_HANDLER( ut88_keyboard_r );
19extern WRITE8_DEVICE_HANDLER( ut88_keyboard_w );
1620extern WRITE8_HANDLER( ut88_sound_w );
1721extern READ8_HANDLER( ut88_tape_r );
1822
src/mess/includes/svi318.h
r2416r2417
99#ifndef SVI318_H_
1010#define SVI318_H_
1111
12#include "machine/8255ppi.h"
13
1214/*----------- defined in machine/svi318.c -----------*/
1315
16extern const ppi8255_interface svi318_ppi8255_interface;
17
1418DRIVER_INIT( svi318 );
1519MACHINE_START( svi318_pal );
1620MACHINE_START( svi318_ntsc );
r2416r2417
3135READ8_HANDLER( svi318_io_ext_r );
3236WRITE8_HANDLER( svi318_io_ext_w );
3337
34READ8_HANDLER( svi318_ppi_r );
35WRITE8_HANDLER( svi318_ppi_w );
38READ8_DEVICE_HANDLER( svi318_ppi_r );
39WRITE8_DEVICE_HANDLER( svi318_ppi_w );
3640
3741WRITE8_HANDLER( svi318_psg_port_b_w );
3842READ8_HANDLER( svi318_psg_port_a_r );
src/mess/video/dai.c
r2416r2417
1313***************************************************************************/
1414
1515#include "driver.h"
16#include "machine/8255ppi.h"
1617#include "includes/dai.h"
1718
1819#define DEBUG_DAI_VIDEO   0
src/mess/video/pc8801.c
r2416r2417
88   but the pen colours may be wrong. This needs to be tested. */
99
1010#include "driver.h"
11#include "machine/8255ppi.h"
1112#include "includes/pc8801.h"
1213
1314/* NPW 23-Oct-2001 - Adding this so that it compiles */
src/mess/machine/dai.c
r2416r2417
1414#include "deprecat.h"
1515#include "devices/cassette.h"
1616#include "cpu/i8085/i8085.h"
17#include "machine/8255ppi.h"
1718#include "includes/dai.h"
1819#include "machine/pit8253.h"
19#include "machine/8255ppi.h"
2020#include "machine/tms5501.h"
2121
2222#define DEBUG_DAI_PORTS   0
r2416r2417
9292   2000000.
9393};
9494
95static const ppi8255_interface dai_ppi82555_intf =
95const ppi8255_interface dai_ppi82555_intf =
9696{
97   1,          /* 1 chip */
98   { NULL, NULL },      /* Port A read */
99   { NULL, NULL },      /* Port B read */
100   { NULL, NULL },      /* Port C read */
97   NULL,   /* Port A read */
98   NULL,   /* Port B read */
99   NULL,   /* Port C read */
100   NULL,   /* Port A write */
101   NULL,   /* Port B write */
102   NULL   /* Port C write */
101103};
102104
103105const struct pit8253_config dai_pit8253_intf =
r2416r2417
129131   memory_configure_bank(2, 0, 4, memory_region(REGION_CPU1) + 0x010000, 0x1000);
130132
131133   tms5501_init(0, &dai_tms5501_init_param);
132   ppi8255_init(&dai_ppi82555_intf);
133134
134135   timer_set(attotime_zero, NULL, 0, dai_bootstrap_callback);
135136}
src/mess/machine/msx_slot.c
r2416r2417
1919
2020#include "driver.h"
2121#include "deprecat.h"
22#include "machine/8255ppi.h"
2223#include "includes/msx_slot.h"
2324#include "includes/msx.h"
2425#include "machine/wd17xx.h"
src/mess/machine/msx.c
r2416r2417
1313
1414#include "driver.h"
1515#include "deprecat.h"
16#include "machine/8255ppi.h"
1617#include "includes/msx_slot.h"
1718#include "includes/msx.h"
18#include "machine/8255ppi.h"
1919#include "machine/tc8521.h"
2020#include "machine/wd17xx.h"
2121#include "devices/basicdsk.h"
r2416r2417
327327static WRITE8_HANDLER ( msx_ppi_port_c_w );
328328static READ8_HANDLER (msx_ppi_port_b_r );
329329
330static const ppi8255_interface msx_ppi8255_interface =
330const ppi8255_interface msx_ppi8255_interface =
331331{
332   1,
333   {NULL},
334   {msx_ppi_port_b_r},
335   {NULL},
336   {msx_ppi_port_a_w},
337   {NULL},
338   {msx_ppi_port_c_w}
332   NULL,
333   msx_ppi_port_b_r,
334   NULL,
335   msx_ppi_port_a_w,
336   NULL,
337   msx_ppi_port_c_w
339338};
340339
341340static const struct tc8521_interface tc = { NULL };
r2416r2417
358357   }
359358
360359   cpunum_set_input_line_vector (0, 0, 0xff);
361   ppi8255_init (&msx_ppi8255_interface);
362360
363361   msx_memory_init (machine);
364362
r2416r2417
733731   UINT8 result = 0xff;
734732   int row, data;
735733
736   row = ppi8255_0_r(machine, 2) & 0x0f;
734   row = ppi8255_r( (device_config*)device_list_find_by_tag( machine->config->devicelist, PPI8255, "ppi8255" ), 2) & 0x0f;
737735   if (row <= 10)
738736   {
739737      data = input_port_read_indexed(machine, row/2);
src/mess/machine/mz700.c
r2416r2417
1111
1212/* Core includes */
1313#include "driver.h"
14#include "includes/mz700.h"
1514
1615/* Components */
1716#include "cpu/z80/z80.h"
r2416r2417
1918#include "machine/8255ppi.h"
2019#include "sound/beep.h"
2120
21#include "includes/mz700.h"
22
2223/* Devices */
2324#include "devices/cassette.h"
2425
r2416r2417
4445static WRITE8_HANDLER ( pio_port_b_w );
4546static WRITE8_HANDLER ( pio_port_c_w );
4647
47static const ppi8255_interface ppi8255 = {
48    1,
49   {pio_port_a_r},
50   {pio_port_b_r},
51   {pio_port_c_r},
52   {pio_port_a_w},
53   {pio_port_b_w},
54   {pio_port_c_w}
48const ppi8255_interface mz700_ppi8255_interface = {
49   pio_port_a_r,
50   pio_port_b_r,
51   pio_port_c_r,
52   pio_port_a_w,
53   pio_port_b_w,
54   pio_port_c_w
5555};
5656
5757static int pio_port_a_output;
r2416r2417
8181
8282DRIVER_INIT( mz700 )
8383{
84   ppi8255_init(&ppi8255);
85
8684   videoram_size = 0x5000;
8785   videoram = auto_malloc(videoram_size);
8886   colorram = auto_malloc(0x800);
r2416r2417
228226   {
229227   /* the first four ports are connected to a 8255 PPI */
230228    case 0: case 1: case 2: case 3:
231      data = ppi8255_r(0, offset & 3);
229      data = ppi8255_r((device_config*)device_list_find_by_tag( machine->config->devicelist, PPI8255, "ppi8255" ), offset & 3);
232230      break;
233231
234232   case 4: case 5: case 6: case 7:
r2416r2417
252250   {
253251   /* the first four ports are connected to a 8255 PPI */
254252    case 0: case 1: case 2: case 3:
255      ppi8255_w(0, offset & 3, data);
253      ppi8255_w((device_config*)device_list_find_by_tag( machine->config->devicelist, PPI8255, "ppi8255" ), offset & 3, data);
256254        break;
257255
258256   /* the next four ports are connected to a 8253 PIT */
r2416r2417
510508   {
511509   /* the first four ports are connected to a 8255 PPI */
512510    case 0: case 1: case 2: case 3:
513      data = ppi8255_r(0, offset & 3);
511      data = ppi8255_r((device_config*)device_list_find_by_tag( machine->config->devicelist, PPI8255, "ppi8255" ), offset & 3);
514512      break;
515513
516514   case 4: case 5: case 6: case 7:
src/mess/machine/pmd85.c
r2416r2417
1212#include "driver.h"
1313#include "devices/cassette.h"
1414#include "cpu/i8085/i8085.h"
15#include "machine/8255ppi.h"
1516#include "includes/pmd85.h"
16#include "machine/8255ppi.h"
1717#include "machine/msm8251.h"
1818#include "machine/pit8253.h"
1919#include "includes/serial.h"
r2416r2417
468468            switch (offset & 0x80)
469469            {
470470               case 0x80:   /* Motherboard 8255 */
471                     return ppi8255_0_r(machine, offset & 0x03);
471                     return ppi8255_r((device_config*)device_list_find_by_tag( machine->config->devicelist, PPI8255, "ppi8255_0" ), offset & 0x03);
472472            }
473473            break;
474474      case 0x08:   /* ROM module connector */
r2416r2417
483483                     switch (offset & 0x80)
484484                     {
485485                        case 0x80:   /* ROM module 8255 */
486                              return ppi8255_3_r(machine, offset & 0x03);
486                              return ppi8255_r((device_config*)device_list_find_by_tag( machine->config->devicelist, PPI8255, "ppi8255_3" ), offset & 0x03);
487487                     }
488488                  }
489489                  break;
r2416r2417
503503                              }
504504                              break;
505505                        case 0x40:      /* 8255 (GPIO/0, GPIO/1) */
506                              return ppi8255_1_r(machine, offset & 0x03);
506                              return ppi8255_r((device_config*)device_list_find_by_tag( machine->config->devicelist, PPI8255, "ppi8255_1" ), offset & 0x03);
507507                        case 0x50:   /* 8253 */
508508                              return pit8253_r( (device_config*)device_list_find_by_tag( machine->config->devicelist, PIT8253, "pit8253" ), offset & 0x03);
509509                        case 0x70:   /* 8255 (IMS-2) */
510                              return ppi8255_2_r(machine, offset & 0x03);
510                              return ppi8255_r((device_config*)device_list_find_by_tag( machine->config->devicelist, PPI8255, "ppi8255_2" ), offset & 0x03);
511511                     }
512512                     break;
513513               case 0x80:   /* external interfaces */
r2416r2417
534534            switch (offset & 0x80)
535535            {
536536               case 0x80:   /* Motherboard 8255 */
537                     ppi8255_0_w(machine, offset & 0x03, data);
537                     ppi8255_w((device_config*)device_list_find_by_tag( machine->config->devicelist, PPI8255, "ppi8255_0" ), offset & 0x03, data);
538538                     /* PMD-85.3 memory banking */
539539                     if ((offset & 0x03) == 0x03)
540540                     {
r2416r2417
556556                     switch (offset & 0x80)
557557                     {
558558                        case 0x80:   /* ROM module 8255 */
559                              ppi8255_3_w(machine, offset & 0x03, data);
559                              ppi8255_w((device_config*)device_list_find_by_tag( machine->config->devicelist, PPI8255, "ppi8255_3" ), offset & 0x03, data);
560560                              break;
561561                     }
562562                  }
r2416r2417
577577                              }
578578                              break;
579579                        case 0x40:      /* 8255 (GPIO/0, GPIO/0) */
580                              ppi8255_1_w(machine, offset & 0x03, data);
580                              ppi8255_w((device_config*)device_list_find_by_tag( machine->config->devicelist, PPI8255, "ppi8255_1" ), offset & 0x03, data);
581581                              break;
582582                        case 0x50:   /* 8253 */
583583                              pit8253_w((device_config*)device_list_find_by_tag( machine->config->devicelist, PIT8253, "pit8253" ), offset & 0x03, data);
584584                              logerror ("8253 writing. Address: %02x, Data: %02x\n", offset, data);
585585                              break;
586586                        case 0x70:   /* 8255 (IMS-2) */
587                              ppi8255_2_w(machine, offset & 0x03, data);
587                              ppi8255_w((device_config*)device_list_find_by_tag( machine->config->devicelist, PPI8255, "ppi8255_2" ), offset & 0x03, data);
588588                              break;
589589                     }
590590                     break;
r2416r2417
618618            switch (offset & 0x80)
619619            {
620620               case 0x80:   /* Motherboard 8255 */
621                     return ppi8255_0_r(machine, offset & 0x03);
621                     return ppi8255_r((device_config*)device_list_find_by_tag( machine->config->devicelist, PPI8255, "ppi8255_0" ), offset & 0x03);
622622            }
623623            break;
624624   }
r2416r2417
641641            switch (offset & 0x80)
642642            {
643643               case 0x80:   /* Motherboard 8255 */
644                     ppi8255_0_w(machine, offset & 0x03, data);
644                     ppi8255_w((device_config*)device_list_find_by_tag( machine->config->devicelist, PPI8255, "ppi8255_0" ), offset & 0x03, data);
645645                     break;
646646            }
647647            break;
648648   }
649649}
650650
651static const ppi8255_interface pmd85_ppi8255_interface =
651const ppi8255_interface pmd85_ppi8255_interface[4] =
652652{
653   4,
654   {pmd85_ppi_0_porta_r, pmd85_ppi_1_porta_r, pmd85_ppi_2_porta_r, pmd85_ppi_3_porta_r},
655   {pmd85_ppi_0_portb_r, pmd85_ppi_1_portb_r, pmd85_ppi_2_portb_r, pmd85_ppi_3_portb_r},
656   {pmd85_ppi_0_portc_r, pmd85_ppi_1_portc_r, pmd85_ppi_2_portc_r, pmd85_ppi_3_portc_r},
657   {pmd85_ppi_0_porta_w, pmd85_ppi_1_porta_w, pmd85_ppi_2_porta_w, pmd85_ppi_3_porta_w},
658   {pmd85_ppi_0_portb_w, pmd85_ppi_1_portb_w, pmd85_ppi_2_portb_w, pmd85_ppi_3_portb_w},
659   {pmd85_ppi_0_portc_w, pmd85_ppi_1_portc_w, pmd85_ppi_2_portc_w, pmd85_ppi_3_portc_w}
653   {
654      pmd85_ppi_0_porta_r,
655      pmd85_ppi_0_portb_r,
656      pmd85_ppi_0_portc_r,
657      pmd85_ppi_0_porta_w,
658      pmd85_ppi_0_portb_w,
659      pmd85_ppi_0_portc_w
660   },
661   {
662      pmd85_ppi_1_porta_r,
663      pmd85_ppi_1_portb_r,
664      pmd85_ppi_1_portc_r,
665      pmd85_ppi_1_porta_w,
666      pmd85_ppi_1_portb_w,
667      pmd85_ppi_1_portc_w
668   },
669   {
670      pmd85_ppi_2_porta_r,
671      pmd85_ppi_2_portb_r,
672      pmd85_ppi_2_portc_r,
673      pmd85_ppi_2_porta_w,
674      pmd85_ppi_2_portb_w,
675      pmd85_ppi_2_portc_w
676   },
677   {
678      pmd85_ppi_3_porta_r,
679      pmd85_ppi_3_portb_r,
680      pmd85_ppi_3_portc_r,
681      pmd85_ppi_3_porta_w,
682      pmd85_ppi_3_portb_w,
683      pmd85_ppi_3_portc_w
684   }
660685};
661686
662static const ppi8255_interface alfa_ppi8255_interface =
687const ppi8255_interface alfa_ppi8255_interface[3] =
663688{
664   3,
665   {pmd85_ppi_0_porta_r, pmd85_ppi_1_porta_r, pmd85_ppi_2_porta_r},
666   {pmd85_ppi_0_portb_r, pmd85_ppi_1_portb_r, pmd85_ppi_2_portb_r},
667   {pmd85_ppi_0_portc_r, pmd85_ppi_1_portc_r, pmd85_ppi_2_portc_r},
668   {pmd85_ppi_0_porta_w, pmd85_ppi_1_porta_w, pmd85_ppi_2_porta_w},
669   {pmd85_ppi_0_portb_w, pmd85_ppi_1_portb_w, pmd85_ppi_2_portb_w},
670   {pmd85_ppi_0_portc_w, pmd85_ppi_1_portc_w, pmd85_ppi_2_portc_w}
689   {
690      pmd85_ppi_0_porta_r,
691      pmd85_ppi_0_portb_r,
692      pmd85_ppi_0_portc_r,
693      pmd85_ppi_0_porta_w,
694      pmd85_ppi_0_portb_w,
695      pmd85_ppi_0_portc_w
696   },
697   {
698      pmd85_ppi_1_porta_r,
699      pmd85_ppi_1_portb_r,
700      pmd85_ppi_1_portc_r,
701      pmd85_ppi_1_porta_w,
702      pmd85_ppi_1_portb_w,
703      pmd85_ppi_1_portc_w
704   },
705   {
706      pmd85_ppi_2_porta_r,
707      pmd85_ppi_2_portb_r,
708      pmd85_ppi_2_portc_r,
709      pmd85_ppi_2_porta_w,
710      pmd85_ppi_2_portb_w,
711      pmd85_ppi_2_portc_w
712   }
671713};
672714
673static const ppi8255_interface mato_ppi8255_interface =
715const ppi8255_interface mato_ppi8255_interface =
674716{
675   1,
676   {pmd85_ppi_0_porta_r},
677   {mato_ppi_0_portb_r},
678   {mato_ppi_0_portc_r},
679   {pmd85_ppi_0_porta_w},
680   {pmd85_ppi_0_portb_w},
681   {mato_ppi_0_portc_w}
717   pmd85_ppi_0_porta_r,
718   mato_ppi_0_portb_r,
719   mato_ppi_0_portc_r,
720   pmd85_ppi_0_porta_w,
721   pmd85_ppi_0_portb_w,
722   mato_ppi_0_portc_w
682723};
683724
684725static struct serial_connection pmd85_cassette_serial_connection;
r2416r2417
790831{
791832   pmd85_model = PMD85_1;
792833   pmd85_update_memory = pmd851_update_memory;
793   ppi8255_init(&pmd85_ppi8255_interface);
794834   pmd85_common_driver_init(machine);
795835}
796836
r2416r2417
798838{
799839   pmd85_model = PMD85_2A;
800840   pmd85_update_memory = pmd852a_update_memory;
801   ppi8255_init(&pmd85_ppi8255_interface);
802841   pmd85_common_driver_init(machine);
803842}
804843
r2416r2417
806845{
807846   pmd85_model = PMD85_3;
808847   pmd85_update_memory = pmd853_update_memory;
809   ppi8255_init(&pmd85_ppi8255_interface);
810848   pmd85_common_driver_init(machine);
811849}
812850
r2416r2417
814852{
815853   pmd85_model = ALFA;
816854   pmd85_update_memory = alfa_update_memory;
817   ppi8255_init(&alfa_ppi8255_interface);
818855   pmd85_common_driver_init(machine);
819856}
820857
r2416r2417
822859{
823860   pmd85_model = MATO;
824861   pmd85_update_memory = mato_update_memory;
825   ppi8255_init(&mato_ppi8255_interface);
826862   memory_set_opbase_handler(0, mato_opbaseoverride);
827863}
828864
src/mess/machine/lviv.c
r2416r2417
1313#include "devices/cassette.h"
1414#include "devices/snapquik.h"
1515#include "cpu/i8085/i8085.h"
16#include "machine/8255ppi.h"
1617#include "includes/lviv.h"
17#include "machine/8255ppi.h"
1818#include "sound/speaker.h"
1919
2020
r2416r2417
141141      switch ((offset >> 4) & 0x3)
142142      {
143143      case 0:
144         return ppi8255_0_r(machine, offset & 3);
144         return ppi8255_r((device_config*)device_list_find_by_tag( machine->config->devicelist, PPI8255, "ppi8255_0" ), offset & 3);
145145         break;
146146
147147      case 1:
148         return ppi8255_1_r(machine, offset & 3);
148         return ppi8255_r((device_config*)device_list_find_by_tag( machine->config->devicelist, PPI8255, "ppi8255_1" ), offset & 3);
149149         break;
150150
151151      case 2:
r2416r2417
178178      switch ((offset >> 4) & 0x3)
179179      {
180180      case 0:
181         ppi8255_0_w(machine, offset & 3, data);
181         ppi8255_w((device_config*)device_list_find_by_tag( machine->config->devicelist, PPI8255, "ppi8255_0" ), offset & 3, data);
182182         break;
183183
184184      case 1:
185         ppi8255_1_w(machine, offset & 3, data);
185         ppi8255_w((device_config*)device_list_find_by_tag( machine->config->devicelist, PPI8255, "ppi8255_1" ), offset & 3, data);
186186         break;
187187
188188      case 2:
r2416r2417
194194}
195195
196196
197static const ppi8255_interface lviv_ppi8255_interface =
197const ppi8255_interface lviv_ppi8255_interface_0 =
198198{
199   2,
200   {lviv_ppi_0_porta_r, lviv_ppi_1_porta_r},
201   {lviv_ppi_0_portb_r, lviv_ppi_1_portb_r},
202   {lviv_ppi_0_portc_r, lviv_ppi_1_portc_r},
203   {lviv_ppi_0_porta_w, lviv_ppi_1_porta_w},
204   {lviv_ppi_0_portb_w, lviv_ppi_1_portb_w},
205   {lviv_ppi_0_portc_w, lviv_ppi_1_portc_w}
199   lviv_ppi_0_porta_r,
200   lviv_ppi_0_portb_r,
201   lviv_ppi_0_portc_r,
202   lviv_ppi_0_porta_w,
203   lviv_ppi_0_portb_w,
204   lviv_ppi_0_portc_w
206205};
207206
207const ppi8255_interface lviv_ppi8255_interface_1 =
208{
209   lviv_ppi_1_porta_r,
210   lviv_ppi_1_portb_r,
211   lviv_ppi_1_portc_r,
212   lviv_ppi_1_porta_w,
213   lviv_ppi_1_portb_w,
214   lviv_ppi_1_portc_w
215};
216
208217MACHINE_RESET( lviv )
209218{
210219   memory_set_opbase_handler(0, lviv_opbaseoverride);
211220
212   ppi8255_init(&lviv_ppi8255_interface);
213
214221   lviv_video_ram = mess_ram + 0xc000;
215222
216223   startup_mem_map = 1;
src/mess/machine/pc8801.c
r2416r2417
1717
1818#include "driver.h"
1919#include "deprecat.h"
20#include "machine/8255ppi.h"
2021#include "includes/pc8801.h"
21#include "machine/8255ppi.h"
2222#include "machine/nec765.h"
2323#include "sound/beep.h"
2424
r2416r2417
721721
722722/* 5 inch floppy drive */
723723
724static UINT8 load_8255_A(int chip)
724static UINT8 load_8255_A(running_machine *machine, int chip)
725725{
726   return use_5FD ? ppi8255_get_portB(1-chip) : 0xff;
726   return use_5FD ? ppi8255_get_portB((device_config*)device_list_find_by_tag( machine->config->devicelist, PPI8255, chip ? "ppi8255_0" : "ppi8255_1" ) ) : 0xff;
727727}
728728
729static UINT8 load_8255_B(int chip)
729static UINT8 load_8255_B(running_machine *machine, int chip)
730730{
731   return use_5FD ? ppi8255_get_portA(1-chip) : 0xff;
731   return use_5FD ? ppi8255_get_portA((device_config*)device_list_find_by_tag( machine->config->devicelist, PPI8255, chip ? "ppi8255_0" : "ppi8255_1" ) ) : 0xff;
732732}
733733
734static UINT8 load_8255_C(int chip)
734static UINT8 load_8255_C(running_machine *machine, int chip)
735735{
736736   UINT8 result = 0xFF;
737737   UINT8 port_c;
738738
739739   if (use_5FD)
740740   {
741      port_c = ppi8255_get_portC(1-chip);
741      port_c = ppi8255_get_portC((device_config*)device_list_find_by_tag( machine->config->devicelist, PPI8255, chip ? "ppi8255_0" : "ppi8255_1" ) );
742742      result = ((port_c >> 4) & 0x0F) | ((port_c << 4) & 0xF0);
743743   }
744744
r2416r2417
765765   return result;
766766}
767767
768static READ8_HANDLER( load_8255_chip0_A )   { return load_8255_A(0); }
769static READ8_HANDLER( load_8255_chip1_A )   { return load_8255_A(1); }
770static READ8_HANDLER( load_8255_chip0_B )   { return load_8255_B(0); }
771static READ8_HANDLER( load_8255_chip1_B )   { return load_8255_B(1); }
772static READ8_HANDLER( load_8255_chip0_C )   { return load_8255_C(0); }
773static READ8_HANDLER( load_8255_chip1_C )   { return load_8255_C(1); }
768static READ8_HANDLER( load_8255_chip0_A )   { return load_8255_A(machine, 0); }
769static READ8_HANDLER( load_8255_chip1_A )   { return load_8255_A(machine, 1); }
770static READ8_HANDLER( load_8255_chip0_B )   { return load_8255_B(machine, 0); }
771static READ8_HANDLER( load_8255_chip1_B )   { return load_8255_B(machine, 1); }
772static READ8_HANDLER( load_8255_chip0_C )   { return load_8255_C(machine, 0); }
773static READ8_HANDLER( load_8255_chip1_C )   { return load_8255_C(machine, 1); }
774774
775775
776static const ppi8255_interface pc8801_8255_config =
776const ppi8255_interface pc8801_8255_config_0 =
777777{
778   2,
779   { load_8255_chip0_A, load_8255_chip1_A },
780   { load_8255_chip0_B, load_8255_chip1_B },
781   { load_8255_chip0_C, load_8255_chip1_C },
782   { NULL, NULL },
783   { NULL, NULL },
784   { NULL, NULL },
778   load_8255_chip0_A,
779   load_8255_chip0_B,
780   load_8255_chip0_C,
781   NULL,
782   NULL,
783   NULL
785784};
786785
786const ppi8255_interface pc8801_8255_config_1 =
787{
788    load_8255_chip1_A,
789    load_8255_chip1_B,
790    load_8255_chip1_C,
791    NULL,
792    NULL,
793    NULL
794};
795
787796 READ8_HANDLER(pc8801fd_nec765_tc)
788797{
789798  nec765_set_tc_state(1);
r2416r2417
811820static void pc8801_init_5fd(void)
812821{
813822   use_5FD = (input_port_read_indexed(Machine, 18)&0x80)!=0x00;
814   ppi8255_init(&pc8801_8255_config);
815823   if (!use_5FD)
816824      cpunum_suspend(1, SUSPEND_REASON_DISABLE, 1);
817825   else
src/mess/machine/atom.c
r2416r2417
125125
126126
127127
128static const ppi8255_interface atom_8255_int =
128const ppi8255_interface atom_8255_int =
129129{
130   1,
131   {atom_8255_porta_r},
132   {atom_8255_portb_r},
133   {atom_8255_portc_r},
134   {atom_8255_porta_w},
135   {atom_8255_portb_w},
136   {atom_8255_portc_w},
130   atom_8255_porta_r,
131   atom_8255_portb_r,
132   atom_8255_portc_r,
133   atom_8255_porta_w,
134   atom_8255_portb_w,
135   atom_8255_portc_w,
137136};
138137
139138static int previous_i8271_int_state = 0;
r2416r2417
241240
242241MACHINE_RESET( atom )
243242{
244   ppi8255_init (&atom_8255_int);
245243   atom_8255_porta = 0xff;
246244   atom_8255_portb = 0xff;
247245   atom_8255_portc = 0xff;
src/mess/machine/orion.c
r2416r2417
7676   }   
7777}
7878
79static const ppi8255_interface orion128_ppi8255_interface =
79const ppi8255_interface orion128_ppi8255_interface_1 =
8080{
81   2,
82   {orion_romdisk_porta_r, NULL,                           },
83   {NULL,                           orion_keyboard_portb_r},
84   {NULL,                           orion_keyboard_portc_r},
85   {NULL,                           orion_keyboard_porta_w},
86   {orion_romdisk_portb_w, NULL,                           },
87   {orion_romdisk_portc_w, NULL,                           }
81   orion_romdisk_porta_r,
82   NULL,
83   NULL,
84   NULL,
85   orion_romdisk_portb_w,
86   orion_romdisk_portc_w
8887};
8988
89const ppi8255_interface orion128_ppi8255_interface_2 =
90{
91   NULL,
92   orion_keyboard_portb_r,
93   orion_keyboard_portc_r,
94   orion_keyboard_porta_w,
95   NULL,
96   NULL
97};
98
9099/* Driver initialization */
91100DRIVER_INIT( orion128 )
92101{
r2416r2417
102111
103112READ8_HANDLER ( orion128_system_r )
104113{
105   return ppi8255_1_r(machine, offset & 3);
114   return ppi8255_r((device_config*)device_list_find_by_tag( machine->config->devicelist, PPI8255, "ppi8255_2" ), offset & 3);
106115}
107116
108117WRITE8_HANDLER ( orion128_system_w )
109118{
110   ppi8255_1_w(machine, offset & 3, data);   
119   ppi8255_w((device_config*)device_list_find_by_tag( machine->config->devicelist, PPI8255, "ppi8255_2" ), offset & 3, data);   
111120}
112121
113122READ8_HANDLER ( orion128_romdisk_r )
114123{
115   return ppi8255_0_r(machine, offset & 3);   
124   return ppi8255_r((device_config*)device_list_find_by_tag( machine->config->devicelist, PPI8255, "ppi8255_1" ), offset & 3);   
116125}
117126
118127WRITE8_HANDLER ( orion128_romdisk_w )
119128{   
120   ppi8255_0_w(machine, offset & 3, data);   
129   ppi8255_w((device_config*)device_list_find_by_tag( machine->config->devicelist, PPI8255, "ppi8255_1" ), offset & 3, data);   
121130}
122131
123132void orion_set_video_mode(running_machine *machine, int width) {
r2416r2417
173182MACHINE_RESET ( orion128 )
174183{     
175184   wd17xx_reset();
176   ppi8255_init(&orion128_ppi8255_interface);
177185   orion_keyboard_line = 0;
178186   orion128_video_page = 0;
179187   orion128_video_mode = 0;
r2416r2417
383391   memory_set_bankptr(5, memory_region(REGION_CPU1) + 0xf800);     
384392   
385393   wd17xx_reset();
386   ppi8255_init(&orion128_ppi8255_interface);
387394   orion_keyboard_line = 0;
388395   orion128_video_page = 0;
389396   orion128_video_mode = 0;
src/mess/machine/ibmpc.c
r2416r2417
9090status information */
9191const ppi8255_interface pc_ppi8255_interface =
9292{
93   1,
94   {pc_ppi_porta_r},
95   {pc_ppi_portb_r},
96   {pc_ppi_portc_r},
97   {pc_ppi_porta_w},
98   {pc_ppi_portb_w},
99   {pc_ppi_portc_w}
93   pc_ppi_porta_r,
94   pc_ppi_portb_r,
95   pc_ppi_portc_r,
96   pc_ppi_porta_w,
97   pc_ppi_portb_w,
98   pc_ppi_portc_w
10099};
101100
102101static struct {
src/mess/machine/special.c
r2416r2417
104104   
105105}
106106
107static const ppi8255_interface specialist_ppi8255_interface =
107const ppi8255_interface specialist_ppi8255_interface =
108108{
109   1,
110   {specialist_8255_porta_r},
111   {specialist_8255_portb_r},
112   {specialist_8255_portc_r},
113   {specialist_8255_porta_w},
114   {specialist_8255_portb_w},
115   {specialist_8255_portc_w}
109   specialist_8255_porta_r,
110   specialist_8255_portb_r,
111   specialist_8255_portc_r,
112   specialist_8255_porta_w,
113   specialist_8255_portb_w,
114   specialist_8255_portc_w
116115};
117116
118117static TIMER_CALLBACK( special_reset )
r2416r2417
125124{
126125   timer_set(ATTOTIME_IN_USEC(10), NULL, 0, special_reset);
127126   memory_set_bank(1, 1);   
128
129   ppi8255_init(&specialist_ppi8255_interface);
130127}
131128
132129READ8_HANDLER( specialist_keyboard_r )
133130{   
134   return ppi8255_0_r(machine, (offset & 3));   
135   return 0;
131   return ppi8255_r((device_config*)device_list_find_by_tag( machine->config->devicelist, PPI8255, "ppi8255" ), (offset & 3));
136132}
137133
138134WRITE8_HANDLER( specialist_keyboard_w )
139135{   
140   ppi8255_0_w(machine, (offset & 3) , data );   
136   ppi8255_w((device_config*)device_list_find_by_tag( machine->config->devicelist, PPI8255, "ppi8255" ), (offset & 3) , data );
141137}
142138
143139
r2416r2417
243239
244240MACHINE_RESET( specimx )
245241{
246   ppi8255_init(&specialist_ppi8255_interface);
247242   specimx_set_bank(2,0x00); // Initiali load ROM disk
248243   specimx_color = 0x70;   
249244   wd17xx_reset();
r2416r2417
402397
403398MACHINE_RESET( erik )
404399{
405   ppi8255_init(&specialist_ppi8255_interface);
406400   wd17xx_reset();     
407401   
408402   RR_register = 0x00;   
src/mess/machine/mikro80.c
r2416r2417
4848   }   
4949}
5050
51static const ppi8255_interface mikro80_ppi8255_interface =
51const ppi8255_interface mikro80_ppi8255_interface =
5252{
53   1,
54   {NULL},
55   {mikro80_8255_portb_r},
56   {mikro80_8255_portc_r},
57   {mikro80_8255_porta_w},
58   {NULL},
59   {NULL},
53   NULL,
54   mikro80_8255_portb_r,
55   mikro80_8255_portc_r,
56   mikro80_8255_porta_w,
57   NULL,
58   NULL,
6059};
6160
6261static TIMER_CALLBACK( mikro80_reset )
r2416r2417
6867{
6968   timer_set(ATTOTIME_IN_USEC(10), NULL, 0, mikro80_reset);
7069   memory_set_bank(1, 1);   
71   ppi8255_init(&mikro80_ppi8255_interface);
7270   mikro80_keyboard_line = 0;
7371}
7472
7573
76READ8_HANDLER( mikro80_keyboard_r )
74READ8_DEVICE_HANDLER( mikro80_keyboard_r )
7775{
78   return ppi8255_0_r(machine, offset^0x03);   
76   return ppi8255_r(device, offset^0x03);   
7977}
8078
81WRITE8_HANDLER( mikro80_keyboard_w )
79WRITE8_DEVICE_HANDLER( mikro80_keyboard_w )
8280{
83   ppi8255_0_w(machine, offset^0x03, data);
81   ppi8255_w(device, offset^0x03, data);
8482}
8583
8684
src/mess/machine/ut88.c
r2416r2417
5050   ut88_8255_porta = data;   
5151}
5252
53static const ppi8255_interface ut88_ppi8255_interface =
53const ppi8255_interface ut88_ppi8255_interface =
5454{
55   1,
56   {NULL},
57   {ut88_8255_portb_r},
58   {ut88_8255_portc_r},
59   {ut88_8255_porta_w},
60   {NULL},
61   {NULL},
55   NULL,
56   ut88_8255_portb_r,
57   ut88_8255_portc_r,
58   ut88_8255_porta_w,
59   NULL,
60   NULL,
6261};
6362
6463static TIMER_CALLBACK( ut88_reset )
r2416r2417
7069{
7170   timer_set(ATTOTIME_IN_USEC(10), NULL, 0, ut88_reset);
7271   memory_set_bank(1, 1);   
73   ppi8255_init(&ut88_ppi8255_interface);
7472   ut88_8255_porta = 0;
7573}
7674
7775
78READ8_HANDLER( ut88_keyboard_r )
76READ8_DEVICE_HANDLER( ut88_keyboard_r )
7977{
80   return ppi8255_0_r(machine, offset^0x03);   
78   return ppi8255_r(device, offset^0x03);   
8179}
8280
8381
84WRITE8_HANDLER( ut88_keyboard_w )
82WRITE8_DEVICE_HANDLER( ut88_keyboard_w )
8583{
86   ppi8255_0_w(machine, offset^0x03, data);
84   ppi8255_w(device, offset^0x03, data);
8785}
8886
8987WRITE8_HANDLER( ut88_sound_w )
src/mess/machine/svi318.c
r2416r2417
246246   svi.keyboard_row = data & 0x0F;
247247}
248248
249static const ppi8255_interface svi318_ppi8255_interface =
249const ppi8255_interface svi318_ppi8255_interface =
250250{
251   1,
252   {svi318_ppi_port_a_r},
253   {svi318_ppi_port_b_r},
254   {NULL},
255   {NULL},
256   {NULL},
257   {svi318_ppi_port_c_w}
251   svi318_ppi_port_a_r,
252   svi318_ppi_port_b_r,
253   NULL,
254   NULL,
255   NULL,
256   svi318_ppi_port_c_w
258257};
259258
260READ8_HANDLER( svi318_ppi_r )
259READ8_DEVICE_HANDLER( svi318_ppi_r )
261260{
262   return ppi8255_0_r(machine, offset);
261   return ppi8255_r(device, offset);
263262}
264263
265WRITE8_HANDLER( svi318_ppi_w )
264WRITE8_DEVICE_HANDLER( svi318_ppi_w )
266265{
267   ppi8255_0_w(machine, offset + 2, data);
266   ppi8255_w(device, offset + 2, data);
268267}
269268
270269/* Printer port */
r2416r2417
592591   }
593592
594593   cpunum_set_input_line_vector (0, 0, 0xff);
595   ppi8255_init (&svi318_ppi8255_interface);
596594
597595   /* memory */
598596   svi.empty_bank = auto_malloc (0x8000);
r2416r2417
668666   /* video stuff */
669667   TMS9928A_reset();
670668
671   /* PPI */
672   ppi8255_0_w(machine, 3, 0x92);
673
674669   svi.bank_switch = 0xff;
675670   svi318_set_banks();
676671
src/mess/machine/pc.c
r2416r2417
383383DRIVER_INIT( pccga )
384384{
385385   mess_init_pc_common(PCCOMMON_KEYBOARD_PC, pc_set_keyb_int, pc_set_irq_line);
386   ppi8255_init(&pc_ppi8255_interface);
387386   pc_rtc_init();
388387   pc_turbo_setup(0, 3, 0x02, 4.77/12, 1);
389388}
r2416r2417
391390DRIVER_INIT( bondwell )
392391{
393392   mess_init_pc_common(PCCOMMON_KEYBOARD_PC, pc_set_keyb_int, pc_set_irq_line);
394   ppi8255_init(&pc_ppi8255_interface);
395393   pc_turbo_setup(0, 3, 0x02, 4.77/12, 1);
396394}
397395
398396DRIVER_INIT( pcmda )
399397{
400398   mess_init_pc_common(PCCOMMON_KEYBOARD_PC, pc_set_keyb_int, pc_set_irq_line);
401   ppi8255_init(&pc_ppi8255_interface);
402399   pc_turbo_setup(0, 3, 0x02, 4.77/12, 1);
403400}
404401
r2416r2417
547544DRIVER_INIT( pc_vga )
548545{
549546   mess_init_pc_common(PCCOMMON_KEYBOARD_PC, pc_set_keyb_int, pc_set_irq_line);
550   ppi8255_init(&pc_ppi8255_interface);
551547
552548   pc_vga_init(machine, &vga_interface, NULL);
553549}
src/mess/machine/compis.c
r2416r2417
447447   compis_fdc_tc((data & 0x80)?1:0);
448448}
449449
450static const ppi8255_interface compis_ppi_interface =
450const ppi8255_interface compis_ppi_interface =
451451{
452    1,
453    {NULL},
454    {compis_ppi_port_b_r},
455    {NULL},
456    {compis_ppi_port_a_w},
457    {NULL},
458    {compis_ppi_port_c_w}
452    NULL,
453    compis_ppi_port_b_r,
454    NULL,
455    compis_ppi_port_a_w,
456    NULL,
457    compis_ppi_port_c_w
459458};
460459
461READ16_HANDLER ( compis_ppi_r )
460READ16_DEVICE_HANDLER ( compis_ppi_r )
462461{
463   return ppi8255_0_r(machine, offset);
462   return ppi8255_r(device, offset);
464463}
465464
466WRITE16_HANDLER ( compis_ppi_w )
465WRITE16_DEVICE_HANDLER ( compis_ppi_w )
467466{
468   ppi8255_0_w(machine, offset, data);
467   ppi8255_w(device, offset, data);
469468}
470469
471470/*-------------------------------------------------------------------------*/
r2416r2417
16041603   /* CPU */
16051604   compis_cpu_init();
16061605
1607   /* PPI */
1608   ppi8255_init(&compis_ppi_interface);
1609
16101606   /* FDC */
16111607   nec765_init(&compis_fdc_interface, NEC765A, NEC765_RDY_PIN_CONNECTED);
16121608   compis_fdc_reset();
src/mess/drivers/dai.c
r2416r2417
6060
6161#include "driver.h"
6262#include "cpu/i8085/i8085.h"
63#include "machine/8255ppi.h"
6364#include "includes/dai.h"
6465#include "machine/pit8253.h"
65#include "machine/8255ppi.h"
6666#include "machine/tms5501.h"
6767#include "devices/cassette.h"
6868
r2416r2417
8181   AM_RANGE( 0xfb00, 0xfbff) AM_READWRITE( amd9511_r, amd9511_w )
8282   AM_RANGE( 0xfc00, 0xfcff) AM_DEVREADWRITE( PIT8253, "pit8253", pit8253_r, pit8253_w )
8383   AM_RANGE( 0xfd00, 0xfdff) AM_READWRITE( dai_io_discrete_devices_r, dai_io_discrete_devices_w )
84   AM_RANGE( 0xfe00, 0xfeff) AM_READWRITE( ppi8255_0_r, ppi8255_0_w )
84   AM_RANGE( 0xfe00, 0xfeff) AM_DEVREADWRITE( PPI8255, "ppi8255", ppi8255_r, ppi8255_w )
8585   AM_RANGE( 0xff00, 0xffff) AM_READWRITE( tms5501_0_r, tms5501_0_w )
8686ADDRESS_MAP_END
8787
r2416r2417
187187   MDRV_DEVICE_ADD( "pit8253", PIT8253 )
188188   MDRV_DEVICE_CONFIG( dai_pit8253_intf )
189189
190   MDRV_DEVICE_ADD( "ppi8255", PPI8255 )
191   MDRV_DEVICE_CONFIG( dai_ppi82555_intf )
192
190193   /* video hardware */
191194   MDRV_SCREEN_ADD("main", RASTER)
192195   MDRV_SCREEN_REFRESH_RATE(50)
src/mess/drivers/sord.c
r2416r2417
11/******************************************************************************
22
3    drivers/sorc.c
3    drivers/sord.c
44
55    Sord m5 system driver
66
r2416r2417
9393
9494   LOG(("fd5 0x010 r: %02x %04x\n",fd5_databus,activecpu_get_pc()));
9595
96   ppi8255_set_portC(0, 0x50);
97   ppi8255_set_portC(0, 0x10);
98   ppi8255_set_portC(0, 0x50);
96   ppi8255_set_portC((device_config*)device_list_find_by_tag( machine->config->devicelist, PPI8255, "ppi8255" ), 0x50);
97   ppi8255_set_portC((device_config*)device_list_find_by_tag( machine->config->devicelist, PPI8255, "ppi8255" ), 0x10);
98   ppi8255_set_portC((device_config*)device_list_find_by_tag( machine->config->devicelist, PPI8255, "ppi8255" ), 0x50);
9999
100100   return fd5_databus;
101101}
r2416r2417
107107   fd5_databus = data;
108108
109109   /* set stb on data write */
110   ppi8255_set_portC(0, 0x50);
111   ppi8255_set_portC(0, 0x40);
112   ppi8255_set_portC(0, 0x50);
110   ppi8255_set_portC((device_config*)device_list_find_by_tag( machine->config->devicelist, PPI8255, "ppi8255" ), 0x50);
111   ppi8255_set_portC((device_config*)device_list_find_by_tag( machine->config->devicelist, PPI8255, "ppi8255" ), 0x40);
112   ppi8255_set_portC((device_config*)device_list_find_by_tag( machine->config->devicelist, PPI8255, "ppi8255" ), 0x50);
113113
114114   cpu_yield();
115115}
r2416r2417
187187   floppy_drive_set_geometry(image_from_devtype_and_index(IO_FLOPPY, 1), FLOPPY_DRIVE_SS_40);
188188   sord_fd5_init();
189189   MACHINE_RESET_CALL(sord_m5);
190   ppi8255_set_portC(0, 0x50);
190   ppi8255_set_portC((device_config*)device_list_find_by_tag( machine->config->devicelist, PPI8255, "ppi8255" ), 0x50);
191191}
192192
193193
r2416r2417
287287
288288static const ppi8255_interface sord_ppi8255_interface =
289289{
290   1,
291   {sord_ppi_porta_r},
292   {sord_ppi_portb_r},
293   {sord_ppi_portc_r},
294   {sord_ppi_porta_w},
295   {sord_ppi_portb_w},
296   {sord_ppi_portc_w}
290   sord_ppi_porta_r,
291   sord_ppi_portb_r,
292   sord_ppi_portc_r,
293   sord_ppi_porta_w,
294   sord_ppi_portb_w,
295   sord_ppi_portc_w
297296};
298297
299298/*********************************************************************************************/
r2416r2417
439438   AM_RANGE(0x30, 0x3f)               AM_READ(sord_keyboard_r)
440439   AM_RANGE(0x40, 0x40)               AM_WRITE(                     sord_printer_w)
441440   AM_RANGE(0x50, 0x50)               AM_READWRITE(sord_sys_r,         sord_sys_w)
442   AM_RANGE(0x70, 0x73)               AM_READWRITE(ppi8255_0_r,         ppi8255_0_w)
441   AM_RANGE(0x70, 0x73)               AM_DEVREADWRITE(PPI8255, "ppi8255", ppi8255_r, ppi8255_w)
443442ADDRESS_MAP_END
444443
445444
r2416r2417
478477{
479478   z80ctc_init(0, &sord_m5_ctc_intf);
480479
481   /* PI-5 interface connected to Sord M5 */
482   ppi8255_init(&sord_ppi8255_interface);
483
484480//  cassette_timer = timer_pulse(TIME_IN_HZ(11025), NULL, 0, cassette_timer_callback);
485481   TMS9928A_reset ();
486482   z80ctc_reset(0);
r2416r2417
638634   MDRV_MACHINE_START( sord_m5 )
639635   MDRV_MACHINE_RESET( sord_m5 )
640636
637   MDRV_DEVICE_ADD( "ppi8255", PPI8255 )
638   MDRV_DEVICE_CONFIG( sord_ppi8255_interface )
639
641640   /* video hardware */
642641   MDRV_IMPORT_FROM(tms9928a)
643642   MDRV_SCREEN_MODIFY("main")
src/mess/drivers/msx.c
r2416r2417
4949   ADDRESS_MAP_GLOBAL_MASK(0xff)
5050   AM_RANGE( 0x90, 0x91) AM_READ( msx_printer_r )
5151   AM_RANGE( 0xa0, 0xa7) AM_READ( msx_psg_r )
52   AM_RANGE( 0xa8, 0xab) AM_READ( ppi8255_0_r )
52   AM_RANGE( 0xa8, 0xab) AM_DEVREAD( PPI8255, "ppi8255", ppi8255_r )
5353   AM_RANGE( 0x98, 0x98) AM_READ( TMS9928A_vram_r )
5454   AM_RANGE( 0x99, 0x99) AM_READ( TMS9928A_register_r )
5555   AM_RANGE( 0xd9, 0xd9) AM_READ( msx_kanji_r )
r2416r2417
6161   AM_RANGE( 0x7c, 0x7d) AM_WRITE( msx_fmpac_w )
6262   AM_RANGE( 0x90, 0x91) AM_WRITE( msx_printer_w )
6363   AM_RANGE( 0xa0, 0xa7) AM_WRITE( msx_psg_w )
64   AM_RANGE( 0xa8, 0xab) AM_WRITE( ppi8255_0_w )
64   AM_RANGE( 0xa8, 0xab) AM_DEVWRITE( PPI8255, "ppi8255", ppi8255_w )
6565   AM_RANGE( 0x98, 0x98) AM_WRITE( TMS9928A_vram_w )
6666   AM_RANGE( 0x99, 0x99) AM_WRITE( TMS9928A_register_w )
6767   AM_RANGE( 0xd8, 0xd9) AM_WRITE( msx_kanji_w )
r2416r2417
7272   ADDRESS_MAP_GLOBAL_MASK(0xff)
7373   AM_RANGE( 0x90, 0x91) AM_READ( msx_printer_r )
7474   AM_RANGE( 0xa0, 0xa7) AM_READ( msx_psg_r )
75   AM_RANGE( 0xa8, 0xab) AM_READ( ppi8255_0_r )
75   AM_RANGE( 0xa8, 0xab) AM_DEVREAD( PPI8255, "ppi8255", ppi8255_r )
7676   AM_RANGE( 0x98, 0x98) AM_READ( v9938_0_vram_r )
7777   AM_RANGE( 0x99, 0x99) AM_READ( v9938_0_status_r )
7878   AM_RANGE( 0xb5, 0xb5) AM_READ( msx_rtc_reg_r )
r2416r2417
8686   AM_RANGE( 0x7c, 0x7d) AM_WRITE( msx_fmpac_w )
8787   AM_RANGE( 0x90, 0x91) AM_WRITE( msx_printer_w )
8888   AM_RANGE( 0xa0, 0xa7) AM_WRITE( msx_psg_w )
89   AM_RANGE( 0xa8, 0xab) AM_WRITE( ppi8255_0_w )
89   AM_RANGE( 0xa8, 0xab) AM_DEVWRITE( PPI8255, "ppi8255", ppi8255_w )
9090   AM_RANGE( 0x98, 0x98) AM_WRITE( v9938_0_vram_w )
9191   AM_RANGE( 0x99, 0x99) AM_WRITE( v9938_0_command_w )
9292   AM_RANGE( 0x9a, 0x9a) AM_WRITE( v9938_0_palette_w )
r2416r2417
734734   MDRV_MACHINE_START( msx )
735735   MDRV_MACHINE_RESET( msx )
736736
737   MDRV_DEVICE_ADD( "ppi8255", PPI8255 )
738   MDRV_DEVICE_CONFIG( msx_ppi8255_interface )
739
737740   /* video hardware */
738741   MDRV_IMPORT_FROM(tms9928a)
739742   MDRV_SCREEN_MODIFY("main")
r2416r2417
785788   MDRV_MACHINE_START( msx2 )
786789   MDRV_MACHINE_RESET( msx2 )
787790
791   MDRV_DEVICE_ADD( "ppi8255", PPI8255 )
792   MDRV_DEVICE_CONFIG( msx_ppi8255_interface )
793
788794   /* video hardware */
789795   MDRV_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK)
790796   MDRV_SCREEN_ADD("main", RASTER)
src/mess/drivers/mz700.c
r2416r2417
6565
6666/* Core includes */
6767#include "driver.h"
68#include "machine/8255ppi.h"
6869#include "includes/mz700.h"
6970#include "machine/pit8253.h"
7071
r2416r2417
259260   MDRV_DEVICE_ADD( "pit8253", PIT8253 )
260261   MDRV_DEVICE_CONFIG( mz700_pit8253_config )
261262
263   MDRV_DEVICE_ADD( "ppi8255", PPI8255 )
264   MDRV_DEVICE_CONFIG( mz700_ppi8255_interface )
265
262266   /* video hardware - include overscan */
263267   MDRV_SCREEN_ADD("main", RASTER)
264268   MDRV_SCREEN_REFRESH_RATE(50)
r2416r2417
291295   MDRV_DEVICE_ADD( "pit8253", PIT8253 )
292296   MDRV_DEVICE_CONFIG( mz700_pit8253_config )
293297
298   MDRV_DEVICE_ADD( "ppi8255", PPI8255 )
299   MDRV_DEVICE_CONFIG( mz700_ppi8255_interface )
300
294301   /* video hardware - include overscan */
295302   MDRV_SCREEN_ADD("main", RASTER)
296303   MDRV_SCREEN_REFRESH_RATE(50)
src/mess/drivers/pmd85.c
r2416r2417
172172#include "driver.h"
173173#include "cpu/i8085/i8085.h"
174174#include "devices/cassette.h"
175#include "machine/8255ppi.h"
175176#include "includes/pmd85.h"
176177#include "machine/pit8253.h"
177178#include "formats/pmd_pmd.h"
r2416r2417
552553   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
553554MACHINE_DRIVER_END
554555
556static MACHINE_DRIVER_START( pmd851 )
557   MDRV_IMPORT_FROM( pmd85 )
558
559   MDRV_DEVICE_ADD( "ppi8255_0", PPI8255 )
560   MDRV_DEVICE_CONFIG( pmd85_ppi8255_interface[0] )
561
562   MDRV_DEVICE_ADD( "ppi8255_1", PPI8255 )
563   MDRV_DEVICE_CONFIG( pmd85_ppi8255_interface[1] )
564
565   MDRV_DEVICE_ADD( "ppi8255_2", PPI8255 )
566   MDRV_DEVICE_CONFIG( pmd85_ppi8255_interface[2] )
567
568   MDRV_DEVICE_ADD( "ppi8255_3", PPI8255 )
569   MDRV_DEVICE_CONFIG( pmd85_ppi8255_interface[3] )
570MACHINE_DRIVER_END
571
555572static MACHINE_DRIVER_START( pmd852a )
556   MDRV_IMPORT_FROM( pmd85 )
573   MDRV_IMPORT_FROM( pmd851 )
557574   MDRV_CPU_MODIFY("main")
558575   MDRV_CPU_PROGRAM_MAP(pmd852a_mem, 0)
559576MACHINE_DRIVER_END
560577
561578static MACHINE_DRIVER_START( pmd853 )
562   MDRV_IMPORT_FROM( pmd85 )
579   MDRV_IMPORT_FROM( pmd851 )
563580   MDRV_CPU_MODIFY("main")
564581   MDRV_CPU_PROGRAM_MAP(pmd853_mem, 0)
565582MACHINE_DRIVER_END
r2416r2417
568585   MDRV_IMPORT_FROM( pmd85 )
569586   MDRV_CPU_MODIFY("main")
570587   MDRV_CPU_PROGRAM_MAP(alfa_mem, 0)
588
589   MDRV_DEVICE_ADD( "ppi8255_0", PPI8255 )
590   MDRV_DEVICE_CONFIG( alfa_ppi8255_interface[0] )
591
592   MDRV_DEVICE_ADD( "ppi8255_1", PPI8255 )
593   MDRV_DEVICE_CONFIG( alfa_ppi8255_interface[1] )
594
595   MDRV_DEVICE_ADD( "ppi8255_2", PPI8255 )
596   MDRV_DEVICE_CONFIG( alfa_ppi8255_interface[1] )
597
571598MACHINE_DRIVER_END
572599
573600static MACHINE_DRIVER_START( mato )
r2416r2417
575602   MDRV_CPU_MODIFY("main")
576603   MDRV_CPU_PROGRAM_MAP(mato_mem, 0)
577604   MDRV_CPU_IO_MAP(mato_readport, mato_writeport)
605
606   MDRV_DEVICE_ADD( "ppi8255_0", PPI8255 )
607   MDRV_DEVICE_CONFIG( mato_ppi8255_interface )
608
578609MACHINE_DRIVER_END
579610
580611ROM_START(pmd851)
r2416r2417
660691
661692
662693/*    YEAR  NAME     PARENT  COMPAT MACHINE  INPUT  INIT      CONFIG COMPANY  FULLNAME */
663COMP( 1985, pmd851,  0,      0,      pmd85,   pmd85, pmd851,   pmd85, "Tesla", "PMD-85.1" , 0)
664COMP( 1985, pmd852,  pmd851, 0,      pmd85,   pmd85, pmd851,   pmd85, "Tesla", "PMD-85.2" , 0)
694COMP( 1985, pmd851,  0,      0,      pmd851,  pmd85, pmd851,   pmd85, "Tesla", "PMD-85.1" , 0)
695COMP( 1985, pmd852,  pmd851, 0,      pmd851,  pmd85, pmd851,   pmd85, "Tesla", "PMD-85.2" , 0)
665696COMP( 1985, pmd852a, pmd851, 0,      pmd852a, pmd85, pmd852a,  pmd85, "Tesla", "PMD-85.2A" , 0)
666697COMP( 1985, pmd852b, pmd851, 0,      pmd852a, pmd85, pmd852a,  pmd85, "Tesla", "PMD-85.2B" , 0)
667698COMP( 1988, pmd853,  pmd851, 0,      pmd853,  pmd85, pmd853,   pmd85, "Tesla", "PMD-85.3" , 0)
src/mess/drivers/x68k.c
r2416r2417
11361136}
11371137
11381138
1139static WRITE16_HANDLER( x68k_ppi_w )
1139static WRITE16_DEVICE_HANDLER( x68k_ppi_w )
11401140{
1141   ppi8255_w(0,offset & 0x03,data);
1141   ppi8255_w(device,offset & 0x03,data);
11421142}
11431143
1144static READ16_HANDLER( x68k_ppi_r )
1144static READ16_DEVICE_HANDLER( x68k_ppi_r )
11451145{
1146   return ppi8255_r(0,offset & 0x03);
1146   return ppi8255_r(device,offset & 0x03);
11471147}
11481148
11491149static READ16_HANDLER( x68k_rtc_r )
r2416r2417
15211521   AM_RANGE(0xe94000, 0xe95fff) AM_READWRITE(x68k_fdc_r, x68k_fdc_w)
15221522   AM_RANGE(0xe96000, 0xe97fff) AM_READWRITE(x68k_hdc_r, x68k_hdc_w)
15231523   AM_RANGE(0xe98000, 0xe99fff) AM_READWRITE(x68k_scc_r, x68k_scc_w)
1524   AM_RANGE(0xe9a000, 0xe9bfff) AM_READWRITE(x68k_ppi_r, x68k_ppi_w)
1524   AM_RANGE(0xe9a000, 0xe9bfff) AM_DEVREADWRITE(PPI8255, "ppi8255", x68k_ppi_r, x68k_ppi_w)
15251525   AM_RANGE(0xe9c000, 0xe9dfff) AM_READWRITE(x68k_ioc_r, x68k_ioc_w)
15261526   AM_RANGE(0xeafa00, 0xeafa1f) AM_READWRITE(x68k_exp_r, x68k_exp_w)
15271527   AM_RANGE(0xeafa80, 0xeafa89) AM_READWRITE(x68k_areaset_r, x68k_enh_areaset_w)
r2416r2417
15501550
15511551static const ppi8255_interface ppi_interface =
15521552{
1553   1,  // 1 PPI
1554   { ppi_port_a_r },
1555   { ppi_port_b_r },
1556   { ppi_port_c_r },
1557   { NULL },
1558   { NULL },
1559   { ppi_port_c_w }
1553   ppi_port_a_r,
1554   ppi_port_b_r,
1555   ppi_port_c_r,
1556   NULL,
1557   NULL,
1558   ppi_port_c_w
15601559};
15611560
15621561static const struct hd63450_interface dmac_interface =
r2416r2417
19831982
19841983   memset(&sys,0,sizeof(sys));
19851984
1986   ppi8255_init(&ppi_interface);
19871985   hd63450_init(&dmac_interface);
19881986   mfp_init();
19891987   scc_init(&scc_interface);
r2416r2417
20162014   MDRV_DEVICE_ADD("mfp", MC68901)
20172015   MDRV_DEVICE_CONFIG(mfp_interface)
20182016
2017   MDRV_DEVICE_ADD( "ppi8255", PPI8255 )
2018   MDRV_DEVICE_CONFIG( ppi_interface )
2019
20192020    /* video hardware */
20202021   MDRV_SCREEN_ADD("main", RASTER)
20212022   MDRV_SCREEN_REFRESH_RATE(55.45)
src/mess/drivers/mpf1.c
r2416r2417
197197   ADDRESS_MAP_GLOBAL_MASK(0xff)
198198
199199   // The 16 I/O port combinations for the 8255 (P8255A-5, 8628LLP, (c) 1981 AMD)
200   AM_RANGE(0x00, 0x03) AM_READWRITE(ppi8255_0_r, ppi8255_0_w) AM_MIRROR(0x3C)
200   AM_RANGE(0x00, 0x03) AM_DEVREADWRITE(PPI8255, "ppi8255", ppi8255_r, ppi8255_w) AM_MIRROR(0x3C)
201201
202202//  TODO: create drivers to emulate the following two chips
203203//  The 16 I/O port combinations for the CTC (Zilog, Z0843004PSC, Z80 CTC, 8644)
r2416r2417
510510
511511static const ppi8255_interface ppi8255_intf =
512512{
513   1,                /* 1 chip */
514   { mpf1_porta_r },   /* Port A read */
515   { mpf1_portb_r },   /* Port B read */
516   { mpf1_portc_r },   /* Port C read */
517   { mpf1_porta_w },   /* Port A write */
518   { mpf1_portb_w },   /* Port B write */
519   { mpf1_portc_w },   /* Port C write */
513   mpf1_porta_r,   /* Port A read */
514   mpf1_portb_r,   /* Port B read */
515   mpf1_portc_r,   /* Port C read */
516   mpf1_porta_w,   /* Port A write */
517   mpf1_portb_w,   /* Port B write */
518   mpf1_portc_w,   /* Port C write */
520519};
521520
522521/* Machine Initialization */
r2416r2417
531530/*  z80ctc_init(&ctc_intf);
532531    z80ctc_reset(0);*/
533532
534   // 8255
535   ppi8255_init(&ppi8255_intf);
536
537533   // leds
538534   for (lednum = 0; lednum < 6; lednum++)
539535      leddigit[lednum] = 0;
r2416r2417
552548
553549   MDRV_MACHINE_RESET( mpf1 )
554550
551   MDRV_DEVICE_ADD( "ppi8255", PPI8255 )
552   MDRV_DEVICE_CONFIG( ppi8255_intf )
553
555554   // video hardware
556555   MDRV_SCREEN_ADD("main", RASTER)
557556   MDRV_SCREEN_REFRESH_RATE(60)
src/mess/drivers/sg1000.c
r2416r2417
107107   AM_RANGE(0x7f, 0x7f) AM_WRITE(SN76496_0_w)
108108   AM_RANGE(0xbe, 0xbe) AM_READWRITE(TMS9928A_vram_r, TMS9928A_vram_w)
109109   AM_RANGE(0xbf, 0xbf) AM_READWRITE(TMS9928A_register_r, TMS9928A_register_w)
110   AM_RANGE(0xdc, 0xdf) AM_READWRITE(ppi8255_0_r, ppi8255_0_w)
110   AM_RANGE(0xdc, 0xdf) AM_DEVREADWRITE( PPI8255, "ppi8255", ppi8255_r, ppi8255_w)
111111ADDRESS_MAP_END
112112
113113// SF-7000
r2416r2417
122122   AM_RANGE(0x7f, 0x7f) AM_WRITE(SN76496_0_w)
123123   AM_RANGE(0xbe, 0xbe) AM_READWRITE(TMS9928A_vram_r, TMS9928A_vram_w)
124124   AM_RANGE(0xbf, 0xbf) AM_READWRITE(TMS9928A_register_r, TMS9928A_register_w)
125   AM_RANGE(0xdc, 0xdf) AM_READWRITE(ppi8255_0_r, ppi8255_0_w)
125   AM_RANGE(0xdc, 0xdf) AM_DEVREADWRITE( PPI8255, "ppi8255_0", ppi8255_r, ppi8255_w)
126126   AM_RANGE(0xe0, 0xe0) AM_READ(nec765_status_r)
127127   AM_RANGE(0xe1, 0xe1) AM_READWRITE(nec765_data_r, nec765_data_w)
128   AM_RANGE(0xe4, 0xe7) AM_READWRITE(ppi8255_1_r, ppi8255_1_w)
128   AM_RANGE(0xe4, 0xe7) AM_DEVREADWRITE( PPI8255, "ppi8255_1", ppi8255_r, ppi8255_w)
129129   AM_RANGE(0xe8, 0xe8) AM_READWRITE(msm8251_data_r, msm8251_data_w)
130130   AM_RANGE(0xe9, 0xe9) AM_READWRITE(msm8251_status_r, msm8251_control_w)
131131ADDRESS_MAP_END
r2416r2417
400400
401401static const ppi8255_interface sc3000_ppi8255_intf =
402402{
403   1,                   // 1 chip
404   { sc3000_ppi8255_a_r },   // Port A read
405   { sc3000_ppi8255_b_r },   // Port B read
406   { NULL },            // Port C read
407   { NULL },            // Port A write
408   { NULL },            // Port B write
409   { sc3000_ppi8255_c_w },   // Port C write
403   sc3000_ppi8255_a_r,   // Port A read
404   sc3000_ppi8255_b_r,   // Port B read
405   NULL,            // Port C read
406   NULL,            // Port A write
407   NULL,            // Port B write
408   sc3000_ppi8255_c_w,   // Port C write
410409};
411410
412411static MACHINE_START( sc3000 )
413412{
414413   TMS9928A_configure(&tms9928a_interface);
415   ppi8255_init(&sc3000_ppi8255_intf);
416414}
417415
418416// SF-7000
r2416r2417
494492   centronics_write_handshake(1, (data & 0x80) ? 0 : CENTRONICS_STROBE, CENTRONICS_STROBE);
495493}
496494
497static const ppi8255_interface sf7000_ppi8255_intf =
495static const ppi8255_interface sf7000_ppi8255_intf[2] =
498496{
499   2,                                  // 2 chips
500   { sc3000_ppi8255_a_r, sf7000_ppi8255_a_r },   // Port A read
501   { sc3000_ppi8255_b_r, NULL },            // Port B read
502   { NULL, NULL },                        // Port C read
503   { NULL, NULL },                        // Port A write
504   { NULL, sf7000_ppi8255_b_w },            // Port B write
505   { sc3000_ppi8255_c_w, sf7000_ppi8255_c_w },   // Port C write
497   {
498      sc3000_ppi8255_a_r,      // Port A read
499      sc3000_ppi8255_b_r,      // Port B read
500      NULL,               // Port C read
501      NULL,               // Port A write
502      NULL,               // Port B write
503      sc3000_ppi8255_c_w      // Port C write
504   },
505   {
506      sf7000_ppi8255_a_r,      // Port A read
507      NULL,               // Port B read
508      NULL,               // Port C read
509      NULL,               // Port A write
510      sf7000_ppi8255_b_w,      // Port B write
511      sf7000_ppi8255_c_w      // Port C write
512   }
506513};
507514
508515/* callback for /INT output from FDC */
r2416r2417
539546static MACHINE_START( sf7000 )
540547{
541548   TMS9928A_configure(&tms9928a_interface);
542   ppi8255_init(&sf7000_ppi8255_intf);
543549   nec765_init(&sf7000_nec765_interface, NEC765A, NEC765_RDY_PIN_CONNECTED);
544550   floppy_drive_set_index_pulse_callback(image_from_devtype_and_index(IO_FLOPPY, 0), sf7000_fdc_index_callback);
545551   msm8251_init(&sf7000_uart_interface);
r2416r2417
588594
589595   MDRV_MACHINE_START( sc3000 )
590596
597   MDRV_DEVICE_ADD( "ppi8255", PPI8255 )
598   MDRV_DEVICE_CONFIG( sc3000_ppi8255_intf )
599
591600    // video hardware
592601   MDRV_IMPORT_FROM(tms9928a)
593602   MDRV_SCREEN_MODIFY("main")
r2416r2417
613622   MDRV_MACHINE_START( sf7000 )
614623   MDRV_MACHINE_RESET( sf7000 )
615624
625   MDRV_DEVICE_ADD( "ppi8255_0", PPI8255 )
626   MDRV_DEVICE_CONFIG( sf7000_ppi8255_intf[0] )
627
628   MDRV_DEVICE_ADD( "ppi8255_1", PPI8255 )
629   MDRV_DEVICE_CONFIG( sf7000_ppi8255_intf[1] )
630
616631    // video hardware
617632   MDRV_IMPORT_FROM(tms9928a)
618633   MDRV_SCREEN_MODIFY("main")
src/mess/drivers/lviv.c
r2416r2417
423423   MDRV_CPU_ADD(8080, 2500000)
424424   MDRV_CPU_PROGRAM_MAP(lviv_mem, 0)
425425   MDRV_CPU_IO_MAP(lviv_readport, lviv_writeport)
426   MDRV_INTERLEAVE(1)
427
428   MDRV_MACHINE_RESET( lviv )
429
430   MDRV_DEVICE_ADD( "ppi8255_0", PPI8255 )
431   MDRV_DEVICE_CONFIG( lviv_ppi8255_interface_0 )
432
433   MDRV_DEVICE_ADD( "ppi8255_1", PPI8255 )
434   MDRV_DEVICE_CONFIG( lviv_ppi8255_interface_1 )
435
426436   MDRV_SCREEN_ADD("main", RASTER)
427437   MDRV_SCREEN_REFRESH_RATE(50)
428438   MDRV_SCREEN_VBLANK_TIME(0)
429   MDRV_INTERLEAVE(1)
430439
431   MDRV_MACHINE_RESET( lviv )
432
433440    /* video hardware */
434441   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
435442   MDRV_SCREEN_SIZE(256, 256)
src/mess/drivers/pc8801.c
r2416r2417
66
77#include "driver.h"
88#include "cpu/z80/z80.h"
9#include "machine/8255ppi.h"
910#include "includes/pc8801.h"
1011#include "machine/nec765.h"
11#include "machine/8255ppi.h"
1212#include "includes/d88.h"
1313#include "devices/basicdsk.h"
1414#include "sound/2203intf.h"
r2416r2417
438438   AM_RANGE(0xf3, 0xf3) AM_NOP /* DMA floppy (unknown -- not yet) */
439439   AM_RANGE(0xf4, 0xf7) AM_NOP /* DMA 5'floppy (may be not released) */
440440   AM_RANGE(0xf8, 0xfb) AM_NOP /* DMA 8'floppy (unknown -- not yet) */
441   AM_RANGE(0xfc, 0xff) AM_READWRITE( ppi8255_0_r, ppi8255_0_w )
441   AM_RANGE(0xfc, 0xff) AM_DEVREADWRITE( PPI8255, "ppi8255_0", ppi8255_r, ppi8255_w )
442442ADDRESS_MAP_END
443443
444444static INTERRUPT_GEN( pc8801fd_interrupt )
r2416r2417
455455   AM_RANGE(0xf8, 0xf8) AM_READ( pc8801fd_nec765_tc )
456456   AM_RANGE(0xfa, 0xfa) AM_READ( nec765_status_r )
457457   AM_RANGE(0xfb, 0xfb) AM_READWRITE( nec765_data_r, nec765_data_w )
458   AM_RANGE(0xfc, 0xff) AM_READWRITE( ppi8255_1_r, ppi8255_1_w )
458   AM_RANGE(0xfc, 0xff) AM_DEVREADWRITE( PPI8255, "ppi8255_1", ppi8255_r, ppi8255_w )
459459ADDRESS_MAP_END
460460
461461ROM_START (pc88srl)
r2416r2417
519519
520520   MDRV_MACHINE_RESET( pc88srl )
521521
522   MDRV_DEVICE_ADD( "ppi8255_0", PPI8255 )
523   MDRV_DEVICE_CONFIG( pc8801_8255_config_0 )
524
525   MDRV_DEVICE_ADD( "ppi8255_1", PPI8255 )
526   MDRV_DEVICE_CONFIG( pc8801_8255_config_1 )
527
522528    /* video hardware */
523529   MDRV_SCREEN_ADD("main", RASTER)
524530   MDRV_SCREEN_REFRESH_RATE(60)
src/mess/drivers/bw2.c
r2416r2417
381381
382382static const ppi8255_interface bw2_ppi8255_interface =
383383{
384   1,
385   { NULL },
386   { bw2_ppi8255_b_r },
387   { bw2_ppi8255_c_r },
388   { bw2_ppi8255_a_w },
389   { NULL },
390   { bw2_ppi8255_c_w },
384   NULL,
385   bw2_ppi8255_b_r,
386   bw2_ppi8255_c_r,
387   bw2_ppi8255_a_w,
388   NULL,
389   bw2_ppi8255_c_w,
391390};
392391
393392
r2416r2417
498497
499498   msm8251_init(&bw2_msm8251_interface);
500499
501   ppi8255_init(&bw2_ppi8255_interface);
502
503500   wd17xx_init(machine, WD_TYPE_2793, bw2_wd17xx_callback, NULL);
504501   wd17xx_set_density(DEN_MFM_LO);
505502
r2416r2417
536533static ADDRESS_MAP_START( bw2_io, ADDRESS_SPACE_IO, 8 )
537534   ADDRESS_MAP_UNMAP_HIGH
538535   ADDRESS_MAP_GLOBAL_MASK(0xff)
539   AM_RANGE( 0x00, 0x03 ) AM_READWRITE( ppi8255_0_r, ppi8255_0_w )
536   AM_RANGE( 0x00, 0x03 ) AM_DEVREADWRITE( PPI8255, "ppi8255", ppi8255_r, ppi8255_w )
540537   AM_RANGE( 0x10, 0x13 ) AM_DEVREADWRITE( PIT8253, "pit8253", pit8253_r, pit8253_w )
541538   AM_RANGE( 0x20, 0x21 ) AM_DEVREADWRITE( MSM6255, MSM6255_TAG, msm6255_register_r, msm6255_register_w )
542539//   AM_RANGE( 0x30, 0x3f ) SLOT
r2416r2417
714711   MDRV_DEVICE_ADD( "pit8253", PIT8253 )
715712   MDRV_DEVICE_CONFIG( bw2_pit8253_interface )
716713
714   MDRV_DEVICE_ADD( "ppi8255", PPI8255 )
715   MDRV_DEVICE_CONFIG( bw2_ppi8255_interface )
716
717717   /* video hardware */
718718   MDRV_SCREEN_ADD( SCREEN_TAG, LCD )
719719   MDRV_SCREEN_REFRESH_RATE( 60 )
src/mess/drivers/atom.c
r2416r2417
5959
6060/* Core includes */
6161#include "driver.h"
62#include "includes/atom.h"
6362
6463/* Components */
6564#include "machine/centroni.h"
r2416r2417
7574#include "devices/cassette.h"
7675#include "devices/snapquik.h"
7776
77#include "includes/atom.h"
7878
79
7980/* functions */
8081
8182/* port i/o functions */
r2416r2417
8889   AM_RANGE(0x0a05, 0x7fff) AM_RAM
8990   AM_RANGE(0x8000, 0x97ff) AM_RAM AM_BASE(&videoram) /* VDG 6847 */
9091   AM_RANGE(0x9800, 0x9fff) AM_RAM
91   AM_RANGE(0xb000, 0xb003) AM_READWRITE(ppi8255_0_r, ppi8255_0_w) /* PPIA 8255 */
92   AM_RANGE(0xb000, 0xb003) AM_DEVREADWRITE( PPI8255, "ppi8255", ppi8255_r, ppi8255_w) /* PPIA 8255 */
9293   AM_RANGE(0xb800, 0xbbff) AM_READWRITE(via_0_r, via_0_w)         /* VIA 6522 */
9394   AM_RANGE(0xc000, 0xcfff) AM_ROM
9495   AM_RANGE(0xd000, 0xdfff) AM_ROM
r2416r2417
104105   AM_RANGE(0x8000, 0x97ff) AM_RAM AM_BASE(&videoram) AM_SIZE(&videoram_size) /* VDG 6847 */
105106   AM_RANGE(0x9800, 0x9fff) AM_RAM
106107   AM_RANGE(0xa000, 0xafff) AM_READ(SMH_BANK1)   /* eprom data from eprom box */
107   AM_RANGE(0xb000, 0xb003) AM_READWRITE(ppi8255_0_r, ppi8255_0_w) /* PPIA 8255 */
108   AM_RANGE(0xb000, 0xb003) AM_DEVREADWRITE( PPI8255, "ppi8255", ppi8255_r, ppi8255_w) /* PPIA 8255 */
108109   AM_RANGE(0xb800, 0xbbff) AM_READWRITE(via_0_r, via_0_w)         /* VIA 6522 */
109110   AM_RANGE(0xbfff, 0xbfff) AM_READWRITE(atom_eprom_box_r, atom_eprom_box_w)
110111   AM_RANGE(0xc000, 0xcfff) AM_ROM
r2416r2417
254255   /* basic machine hardware */
255256   MDRV_CPU_ADD_TAG("main", M65C02, 1000000)        /* 0,894886 Mhz */
256257   MDRV_CPU_PROGRAM_MAP(atom_mem, 0)
257   MDRV_SCREEN_ADD("main", RASTER)
258   MDRV_SCREEN_REFRESH_RATE(M6847_PAL_FRAMES_PER_SECOND)
259258
260259   MDRV_MACHINE_RESET( atom )
261260
261   MDRV_DEVICE_ADD( "ppi8255", PPI8255 )
262   MDRV_DEVICE_CONFIG( atom_8255_int )
263
262264   /* video hardware */
265   MDRV_SCREEN_ADD("main", RASTER)
266   MDRV_SCREEN_REFRESH_RATE(M6847_PAL_FRAMES_PER_SECOND)
267
263268   MDRV_VIDEO_START(atom)
264269   MDRV_VIDEO_UPDATE(m6847)
265270   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
src/mess/drivers/orion.c
r2416r2417
99
1010#include "driver.h"
1111#include "cpu/i8085/i8085.h"
12#include "machine/8255ppi.h"
1213#include "includes/orion.h"
1314#include "machine/mc146818.h"
1415#include "devices/basicdsk.h"
r2416r2417
257258   
258259    MDRV_MACHINE_START( orion128 )
259260    MDRV_MACHINE_RESET( orion128 )
260       
261
262   MDRV_DEVICE_ADD( "ppi8255_1", PPI8255 )
263   MDRV_DEVICE_CONFIG( orion128_ppi8255_interface_1 )
264
265   MDRV_DEVICE_ADD( "ppi8255_2", PPI8255 )
266   MDRV_DEVICE_CONFIG( orion128_ppi8255_interface_2 )
267
261268    /* video hardware */       
262269      MDRV_SCREEN_ADD("main", RASTER)         
263270      MDRV_SCREEN_REFRESH_RATE(50)
src/mess/drivers/special.c
r2416r2417
321321   MDRV_DEVICE_ADD( "pit8253", PIT8253 )
322322   MDRV_DEVICE_CONFIG( specimx_pit8253_intf )
323323
324   MDRV_DEVICE_ADD( "ppi8255", PPI8255 )
325   MDRV_DEVICE_CONFIG( specialist_ppi8255_interface )
326
324327    /* video hardware */       
325328      MDRV_SCREEN_ADD("main", RASTER)         
326329      MDRV_SCREEN_REFRESH_RATE(50)
r2416r2417
382385    MDRV_CPU_ADD(Z80, 4000000)
383386    MDRV_CPU_PROGRAM_MAP(erik_mem, 0)
384387    MDRV_CPU_IO_MAP(erik_io_map, 0)
385   
388
386389    MDRV_MACHINE_RESET( erik )
387390    MDRV_MACHINE_START( erik )
388       
391
392   MDRV_DEVICE_ADD( "ppi8255", PPI8255 )
393   MDRV_DEVICE_CONFIG( specialist_ppi8255_interface )
394
389395    /* video hardware */       
390396      MDRV_SCREEN_ADD("main", RASTER)         
391397      MDRV_SCREEN_REFRESH_RATE(50)
src/mess/drivers/mikro80.c
r2416r2417
99
1010#include "driver.h"
1111#include "cpu/i8085/i8085.h"
12#include "machine/8255ppi.h"
1213#include "includes/mikro80.h"
1314#include "devices/cassette.h"
1415#include "formats/rk_cas.h"
r2416r2417
3031
3132static ADDRESS_MAP_START( mikro80_io , ADDRESS_SPACE_IO, 8)
3233   AM_RANGE( 0x01, 0x01) AM_READWRITE ( mikro80_tape_r, mikro80_tape_w )
33   AM_RANGE( 0x04, 0x07) AM_READWRITE ( mikro80_keyboard_r, mikro80_keyboard_w )
34   AM_RANGE( 0x04, 0x07) AM_DEVREADWRITE ( PPI8255, "ppi8255", mikro80_keyboard_r, mikro80_keyboard_w )
3435ADDRESS_MAP_END
3536
3637/* Input ports */
r2416r2417
128129    MDRV_CPU_PROGRAM_MAP(mikro80_mem, 0)
129130    MDRV_CPU_IO_MAP(mikro80_io, 0)
130131    MDRV_MACHINE_RESET( mikro80 )
131       
132
133   MDRV_DEVICE_ADD( "ppi8255", PPI8255 )
134   MDRV_DEVICE_CONFIG( mikro80_ppi8255_interface )
135
132136    /* video hardware */       
133137   MDRV_SCREEN_ADD("main", RASTER)         
134138   MDRV_SCREEN_REFRESH_RATE(50)
src/mess/drivers/amstrad.c
r2416r2417
423423   -----------------------------*/
424424static const ppi8255_interface amstrad_ppi8255_interface =
425425{
426   1,                       /* number of PPIs to emulate */
427   {amstrad_ppi_porta_r},   /* port A read */
428   {amstrad_ppi_portb_r},   /* port B read */
429   {NULL},                  /* port C read */
430   {amstrad_ppi_porta_w},   /* port A write */
431   {NULL},                  /* port B write */
432   {amstrad_ppi_portc_w}    /* port C write */
426   amstrad_ppi_porta_r,   /* port A read */
427   amstrad_ppi_portb_r,   /* port B read */
428   NULL,                  /* port C read */
429   amstrad_ppi_porta_w,   /* port A write */
430   NULL,                  /* port B write */
431   amstrad_ppi_portc_w    /* port C write */
433432};
434433
435434static void aleste_interrupt(int state)
r2416r2417
13001299   if ((offset & (1<<11)) == 0)
13011300   {
13021301      if (r1r0 < 0x03 )
1303         data = ppi8255_r(0, r1r0);
1302         data = ppi8255_r((device_config*)device_list_find_by_tag( machine->config->devicelist, PPI8255, "ppi8255" ), r1r0);
13041303   }
13051304/* if b10 = 0 : Expansion Peripherals Read selected
13061305
r2416r2417
14211420*/
14221421   if ((offset & (1<<11)) == 0) {
14231422      unsigned int Index = ((offset & 0x0300) >> 8);
1424      ppi8255_w(0, Index, data);
1423      ppi8255_w((device_config*)device_list_find_by_tag( machine->config->devicelist, PPI8255, "ppi8255" ), Index, data);
14251424   }
14261425/* if b10 = 0 : Expansion Peripherals Write selected */
14271426   if ((offset & (1<<10)) == 0) {
r2416r2417
20432042   else
20442043      cpunum_set_input_line_vector(0, 0,0x00);
20452044
2046   ppi8255_init(&amstrad_ppi8255_interface);
2047
20482045   if(amstrad_system_type != SYSTEM_GX4000)
20492046   {
20502047      nec765_init(&amstrad_nec765_interface,NEC765A/*?*/,NEC765_RDY_PIN_CONNECTED);
r2416r2417
29122909   MDRV_CPU_PROGRAM_MAP(amstrad_mem, 0)
29132910   MDRV_CPU_IO_MAP(amstrad_io, 0)
29142911
2915   MDRV_SCREEN_ADD("main", RASTER)
2916   MDRV_SCREEN_REFRESH_RATE(AMSTRAD_FPS)
29172912   MDRV_INTERLEAVE(1)
2918   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(19968))
29192913
29202914   MDRV_MACHINE_RESET( amstrad )
29212915
2916   MDRV_DEVICE_ADD( "ppi8255", PPI8255 )
2917   MDRV_DEVICE_CONFIG( amstrad_ppi8255_interface )
2918
29222919    /* video hardware */
2920   MDRV_SCREEN_ADD("main", RASTER)
2921   MDRV_SCREEN_REFRESH_RATE(AMSTRAD_FPS)
2922   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(19968))
29232923   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
29242924   MDRV_SCREEN_SIZE(800, 312)
29252925   /* Amstrad Monitor Visible AREA : 768x272 */
r2416r2417
29892989   MDRV_DEVICE_REMOVE("printer", PRINTER)
29902990MACHINE_DRIVER_END
29912991
2992
29922993static MACHINE_DRIVER_START( aleste )
29932994   MDRV_IMPORT_FROM(amstrad)
29942995   MDRV_MACHINE_RESET(aleste)
2996
29952997   MDRV_SOUND_REPLACE("ay", AY8910, 1000000)
29962998   MDRV_SOUND_CONFIG(ay8912_interface)
29972999   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
src/mess/drivers/ut88.c
r2416r2417
4343ADDRESS_MAP_END
4444
4545static ADDRESS_MAP_START( ut88_io , ADDRESS_SPACE_IO, 8)
46   AM_RANGE( 0x04, 0x07) AM_READWRITE ( ut88_keyboard_r, ut88_keyboard_w )
46   AM_RANGE( 0x04, 0x07) AM_DEVREADWRITE ( PPI8255, "ppi8255", ut88_keyboard_r, ut88_keyboard_w )
4747   AM_RANGE( 0xA1, 0xA1) AM_READWRITE ( ut88_tape_r,      ut88_sound_w     )
4848ADDRESS_MAP_END
4949
r2416r2417
163163    MDRV_CPU_PROGRAM_MAP(ut88_mem, 0)
164164    MDRV_CPU_IO_MAP(ut88_io, 0)
165165    MDRV_MACHINE_RESET( ut88 )
166       
166
167   MDRV_DEVICE_ADD( "ppi8255", PPI8255 )
168   MDRV_DEVICE_CONFIG( ut88_ppi8255_interface )
169
167170    /* video hardware */       
168171      MDRV_SCREEN_ADD("main", RASTER)         
169172      MDRV_SCREEN_REFRESH_RATE(50)
src/mess/drivers/pc.c
r2416r2417
163163   AM_RANGE(0x0000, 0x000f) AM_DEVREADWRITE(DMA8237, "dma8237", dma8237_r, dma8237_w)
164164   AM_RANGE(0x0020, 0x0021) AM_DEVREADWRITE(PIC8259, "pic8259_master", pic8259_r, pic8259_w)
165165   AM_RANGE(0x0040, 0x0043) AM_DEVREADWRITE(PIT8253, "pit8253", pit8253_r, pit8253_w)
166   AM_RANGE(0x0060, 0x0063) AM_READWRITE(ppi8255_0_r,         ppi8255_0_w)
166   AM_RANGE(0x0060, 0x0063) AM_DEVREADWRITE(PPI8255, "ppi8255", ppi8255_r, ppi8255_w)
167167   AM_RANGE(0x0080, 0x0087) AM_READWRITE(pc_page_r,         pc_page_w)
168168   AM_RANGE(0x0200, 0x0207) AM_READWRITE(pc_JOY_r,            pc_JOY_w)
169169#ifdef EXP_ON
r2416r2417
190190DEV_READWRITE8TO16LE_LSB( pc_pit8253_16le, pit8253_r, pit8253_w )
191191DEV_READWRITE8TO16LE( pc_dma8237_16le, dma8237_r, dma8237_w )
192192DEV_READWRITE8TO16LE( pc_pic8259_16le, pic8259_r, pic8259_w )
193DEV_READWRITE8TO16LE( pc_ppi8255_16le, ppi8255_r, ppi8255_w )
193194READ16_HANDLER(pc_page16le_r) { return read16le_with_read8_handler(pc_page_r, machine, offset, mem_mask); }
194195WRITE16_HANDLER(pc_page16le_w) { write16le_with_write8_handler(pc_page_w, machine, offset, data, mem_mask); }
195196
r2416r2417
198199   AM_RANGE(0x0000, 0x000f) AM_DEVREADWRITE(DMA8237, "dma8237", pc_dma8237_16le_r, pc_dma8237_16le_w)
199200   AM_RANGE(0x0020, 0x0021) AM_DEVREADWRITE(PIC8259, "pic8259_master", pc_pic8259_16le_r, pc_pic8259_16le_w)
200201   AM_RANGE(0x0040, 0x0043) AM_DEVREADWRITE(PIT8253, "pit8253", pc_pit8253_16le_r, pc_pit8253_16le_w)
201   AM_RANGE(0x0060, 0x0063) AM_READWRITE(ppi8255_16le_0_r,         ppi8255_16le_0_w)
202   AM_RANGE(0x0060, 0x0063) AM_DEVREADWRITE(PPI8255, "ppi8255", pc_ppi8255_16le_r, pc_ppi8255_16le_w)
202203   AM_RANGE(0x0080, 0x0087) AM_READWRITE(pc_page16le_r,         pc_page16le_w)
203204   AM_RANGE(0x0200, 0x0207) AM_READWRITE(pc16le_JOY_r,            pc16le_JOY_w)
204205#ifdef EXP_ON
r2416r2417
11641165   MDRV_DEVICE_ADD( "pic8259_slave", PIC8259 )
11651166   MDRV_DEVICE_CONFIG( pc_pic8259_slave_config )
11661167
1168   MDRV_DEVICE_ADD( "ppi8255", PPI8255 )
1169   MDRV_DEVICE_CONFIG( pc_ppi8255_interface )
1170
11671171   /* video hardware */
11681172   MDRV_IMPORT_FROM( pcvideo_mda )
11691173
r2416r2417
12111215   MDRV_DEVICE_ADD( "pic8259_slave", PIC8259 )
12121216   MDRV_DEVICE_CONFIG( pc_pic8259_slave_config )
12131217
1218   MDRV_DEVICE_ADD( "ppi8255", PPI8255 )
1219   MDRV_DEVICE_CONFIG( pc_ppi8255_interface )
1220
12141221   /* video hardware */
12151222   MDRV_IMPORT_FROM( pcvideo_hercules )
12161223
r2416r2417
12541261   MDRV_DEVICE_ADD( "pic8259_slave", PIC8259 )
12551262   MDRV_DEVICE_CONFIG( pc_pic8259_slave_config )
12561263
1264   MDRV_DEVICE_ADD( "ppi8255", PPI8255 )
1265   MDRV_DEVICE_CONFIG( pc_ppi8255_interface )
1266
12571267   /* video hardware */
12581268   MDRV_IMPORT_FROM( pcvideo_cga )
12591269
r2416r2417
12981308   MDRV_DEVICE_ADD( "pic8259_slave", PIC8259 )
12991309   MDRV_DEVICE_CONFIG( pc_pic8259_slave_config )
13001310
1311   MDRV_DEVICE_ADD( "ppi8255", PPI8255 )
1312   MDRV_DEVICE_CONFIG( pc_ppi8255_interface )
1313
13011314   /* video hardware */
13021315   MDRV_IMPORT_FROM( pcvideo_aga )
13031316
r2416r2417
13381351   MDRV_DEVICE_ADD( "pic8259_slave", PIC8259 )
13391352   MDRV_DEVICE_CONFIG( pc_pic8259_slave_config )
13401353
1354   MDRV_DEVICE_ADD( "ppi8255", PPI8255 )
1355   MDRV_DEVICE_CONFIG( pc_ppi8255_interface )
1356
13411357   /* video hardware */
13421358   MDRV_IMPORT_FROM( pcvideo_cga )
13431359
r2416r2417
13821398   MDRV_DEVICE_ADD( "pic8259_slave", PIC8259 )
13831399   MDRV_DEVICE_CONFIG( pc_pic8259_slave_config )
13841400
1401   MDRV_DEVICE_ADD( "ppi8255", PPI8255 )
1402   MDRV_DEVICE_CONFIG( pc_ppi8255_interface )
1403
13851404   /* video hardware */
13861405   MDRV_IMPORT_FROM( pcvideo_pc200 )
13871406
r2416r2417
14151434   MDRV_DEVICE_ADD( "pic8259_slave", PIC8259 )
14161435   MDRV_DEVICE_CONFIG( pc_pic8259_slave_config )
14171436
1437   MDRV_DEVICE_ADD( "ppi8255", PPI8255 )
1438   MDRV_DEVICE_CONFIG( pc_ppi8255_interface )
1439
14181440   /* video hardware */
14191441   MDRV_IMPORT_FROM( pcvideo_pc1512 )
14201442
r2416r2417
14501472   MDRV_DEVICE_ADD( "pic8259_slave", PIC8259 )
14511473   MDRV_DEVICE_CONFIG( pc_pic8259_slave_config )
14521474
1475   MDRV_DEVICE_ADD( "ppi8255", PPI8255 )
1476   MDRV_DEVICE_CONFIG( pc_ppi8255_interface )
1477
14531478   /* video hardware */
14541479   MDRV_IMPORT_FROM(pcvideo_pc1640)
14551480   MDRV_SCREEN_MODIFY("main")
r2416r2417
14881513   MDRV_DEVICE_ADD( "pic8259_slave", PIC8259 )
14891514   MDRV_DEVICE_CONFIG( pc_pic8259_slave_config )
14901515
1516   MDRV_DEVICE_ADD( "ppi8255", PPI8255 )
1517   MDRV_DEVICE_CONFIG( pc_ppi8255_interface )
1518
14911519   /* video hardware */
14921520   MDRV_IMPORT_FROM( pcvideo_vga )
14931521   MDRV_SCREEN_MODIFY("main")
r2416r2417
15321560   MDRV_DEVICE_ADD( "pic8259_slave", PIC8259 )
15331561   MDRV_DEVICE_CONFIG( pc_pic8259_slave_config )
15341562
1563   MDRV_DEVICE_ADD( "ppi8255", PPI8255 )
1564   MDRV_DEVICE_CONFIG( pc_ppi8255_interface )
1565
15351566   /* video hardware */
15361567   MDRV_IMPORT_FROM( pcvideo_t1000 )
15371568
src/mess/drivers/compis.c
r2416r2417
3333
3434#include "driver.h"
3535#include "devconv.h"
36#include "machine/8255ppi.h"
3637#include "includes/compis.h"
3738#include "video/i82720.h"
3839#include "devices/mflopimg.h"
r2416r2417
5657DEV_READWRITE8TO16LE( compis_pit8254, pit8253_r, pit8253_w )
5758
5859static ADDRESS_MAP_START( compis_io, ADDRESS_SPACE_IO, 16)
59   AM_RANGE( 0x0000, 0x0007) AM_READWRITE( compis_ppi_r, compis_ppi_w )   /* PPI 8255         */
60   AM_RANGE( 0x0000, 0x0007) AM_DEVREADWRITE(PPI8255, "ppi8255", compis_ppi_r, compis_ppi_w )   /* PPI 8255         */
6061   AM_RANGE( 0x0080, 0x0087) AM_DEVREADWRITE(PIT8253, "pit8253", compis_pit_r, compis_pit_w )   /* PIT 8253         */
6162   AM_RANGE( 0x0100, 0x011b) AM_READWRITE( compis_rtc_r, compis_rtc_w )    /* RTC 58174            */
6263   AM_RANGE( 0x0280, 0x0283) AM_DEVREADWRITE(PIC8259, "pic8259_master", compis_osp_pic_r, compis_osp_pic_w ) /* PIC 8259 (80150/80130)  */
r2416r2417
231232   MDRV_DEVICE_ADD( "pic8259_slave", PIC8259 )
232233   MDRV_DEVICE_CONFIG( compis_pic8259_slave_config )
233234
235   MDRV_DEVICE_ADD( "ppi8255", PPI8255 )
236   MDRV_DEVICE_CONFIG ( compis_ppi_interface )
237
234238   /* video hardware */
235239   MDRV_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK)
236240   MDRV_SCREEN_ADD("main", RASTER)

Previous 15994 Revisions Next


© 1998-2018 The MESS Team