Previous 15994 Revisions Next

r2943 Friday 11th July, 2008 at 20:26:45 UTC by Wilbert Pol
[IBM5170] Added support for the 8042 keyboard controller dumped by Kevtris.
[IBM5162] Driver for IBM PC/XT-286.
Updated pit8253 implementation to use timers internally.
[docs]messnew.txt
[src/emu/machine]pit8253.c pit8253.h
[src/mame/drivers]filetto.c gamecstl.c mediagx.c taitowlf.c
[src/mame/machine]vertigo.c
[src/mess]mess.mak messdriv.c
[src/mess/audio]dai.c pc.c pc.h special.c
[src/mess/drivers]at.c bw2.c ip22.c mz700.c pasogo.c pc.c
[src/mess/includes]at.h dai.h pc.h special.h
[src/mess/machine]amstr_pc.c amstrad.c at.c b2m.c bebox.c compis.c dai.c europc.c ibmpc.c mz700.c pc.c pmd85.c special.c tandy1t.c

src/mame/machine/vertigo.c
r2942r2943
4848   {
4949      {
5050         240000,
51         v_irq4_w,
52         NULL
51         v_irq4_w
5352      }, {
5453         240000,
55         v_irq3_w,
56         NULL
54         v_irq3_w
5755      }, {
5856         240000,
59         NULL,
6057         NULL
6158      }
6259   }
src/mame/drivers/mediagx.c
r2942r2943
10171017   {
10181018      {
10191019         4772720/4,            /* heartbeat IRQ */
1020         pc_timer0_w,
1021         NULL
1020         pc_timer0_w
10221021      }, {
10231022         4772720/4,            /* dram refresh */
1024         NULL,
10251023         NULL
10261024      }, {
10271025         4772720/4,            /* pio port c pin 4, and speaker polling enough */
1028         NULL,
10291026         NULL
10301027      }
10311028   }
src/mame/drivers/filetto.c
r2942r2943
395395   {
396396      {
397397         4772720/4,            /* heartbeat IRQ */
398         pc_timer0_w,
399         NULL
398         pc_timer0_w
400399      }, {
401400         4772720/4,            /* dram refresh */
402         NULL,
403401         NULL
404402      }, {
405403         4772720/4,            /* pio port c pin 4, and speaker polling enough */
406         NULL,
407404         NULL
408405      }
409406   }
src/mame/drivers/taitowlf.c
r2942r2943
428428}
429429
430430
431DEV_READWRITE8TO32LE( taitowlf_pit8254_32le, pit8253_r, pit8253_w )
432DEV_READWRITE8TO32LE( taitowlf_dma8237_32le, dma8237_r, dma8237_w )
433DEV_READWRITE8TO32LE( taitowlf_pic8259_32le, pic8259_r, pic8259_w )
434
435
436431/*****************************************************************************/
437432
438433static ADDRESS_MAP_START( taitowlf_map, ADDRESS_SPACE_PROGRAM, 32 )
r2942r2943
447442ADDRESS_MAP_END
448443
449444static ADDRESS_MAP_START(taitowlf_io, ADDRESS_SPACE_IO, 32)
450   AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE(DMA8237, "dma8237_1", taitowlf_dma8237_32le_r, taitowlf_dma8237_32le_w)
451   AM_RANGE(0x0020, 0x003f) AM_DEVREADWRITE(PIC8259, "pic8259_1", taitowlf_pic8259_32le_r, taitowlf_pic8259_32le_w)
452   AM_RANGE(0x0040, 0x005f) AM_DEVREADWRITE(PIT8254, "pit8254", taitowlf_pit8254_32le_r, taitowlf_pit8254_32le_w)
445   AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE8(DMA8237, "dma8237_1", dma8237_r, dma8237_w, 0xffffffff)
446   AM_RANGE(0x0020, 0x003f) AM_DEVREADWRITE8(PIC8259, "pic8259_1", pic8259_r, pic8259_w, 0xffffffff)
447   AM_RANGE(0x0040, 0x005f) AM_DEVREADWRITE8(PIT8254, "pit8254", pit8253_r, pit8253_w, 0xffffffff)
453448   AM_RANGE(0x0060, 0x006f) AM_READWRITE(kbdc8042_32le_r,         kbdc8042_32le_w)
454449   AM_RANGE(0x0070, 0x007f) AM_READWRITE(mc146818_port32le_r,      mc146818_port32le_w)
455450   AM_RANGE(0x0080, 0x009f) AM_READWRITE(at_page32_r,            at_page32_w)
456   AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE(PIC8259, "pic8259_2", taitowlf_pic8259_32le_r, taitowlf_pic8259_32le_w)
451   AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE8(PIC8259, "pic8259_2", pic8259_r, pic8259_w, 0xffffffff)
457452   AM_RANGE(0x00c0, 0x00df) AM_DEVREADWRITE(DMA8237, "dma8237_2", at32_dma8237_2_r, at32_dma8237_2_w)
458453   AM_RANGE(0x00e8, 0x00eb) AM_NOP
459454   AM_RANGE(0x01f0, 0x01f7) AM_DEVREADWRITE(IDE_CONTROLLER, "ide", ide_r, ide_w)
r2942r2943
590585   {
591586      {
592587         4772720/4,            /* heartbeat IRQ */
593         pc_timer0_w,
594         NULL
588         pc_timer0_w
595589      }, {
596590         4772720/4,            /* dram refresh */
597         NULL,
598591         NULL
599592      }, {
600593         4772720/4,            /* pio port c pin 4, and speaker polling enough */
601         NULL,
602594         NULL
603595      }
604596   }
src/mame/drivers/gamecstl.c
r2942r2943
462462}
463463
464464
465DEV_READWRITE8TO32LE( gamecstl_pit8254_32le, pit8253_r, pit8253_w )
466DEV_READWRITE8TO32LE( gamecstl_dma8237_32le, dma8237_r, dma8237_w )
467DEV_READWRITE8TO32LE( gamecstl_pic8259_32le, pic8259_r, pic8259_w )
468
469
470465/*****************************************************************************/
471466
472467static ADDRESS_MAP_START( gamecstl_map, ADDRESS_SPACE_PROGRAM, 32 )
r2942r2943
481476ADDRESS_MAP_END
482477
483478static ADDRESS_MAP_START(gamecstl_io, ADDRESS_SPACE_IO, 32)
484   AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE(DMA8237, "dma8237_1", gamecstl_dma8237_32le_r, gamecstl_dma8237_32le_w)
485   AM_RANGE(0x0020, 0x003f) AM_DEVREADWRITE(PIC8259, "pic8259_1", gamecstl_pic8259_32le_r, gamecstl_pic8259_32le_w)
486   AM_RANGE(0x0040, 0x005f) AM_DEVREADWRITE(PIT8254, "pit8254", gamecstl_pit8254_32le_r, gamecstl_pit8254_32le_w)
479   AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE8(DMA8237, "dma8237_1", dma8237_r, dma8237_w, 0xffffffff)
480   AM_RANGE(0x0020, 0x003f) AM_DEVREADWRITE8(PIC8259, "pic8259_1", pic8259_r, pic8259_w, 0xffffffff)
481   AM_RANGE(0x0040, 0x005f) AM_DEVREADWRITE8(PIT8254, "pit8254", pit8253_r, pit8253_w, 0xffffffff)
487482   AM_RANGE(0x0060, 0x006f) AM_READWRITE(kbdc8042_32le_r,         kbdc8042_32le_w)
488483   AM_RANGE(0x0070, 0x007f) AM_READWRITE(mc146818_port32le_r,      mc146818_port32le_w)
489484   AM_RANGE(0x0080, 0x009f) AM_READWRITE(at_page32_r,            at_page32_w)
490   AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE(PIC8259, "pic8259_2", gamecstl_pic8259_32le_r, gamecstl_pic8259_32le_w)
485   AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE8(PIC8259, "pic8259_2", pic8259_r, pic8259_w, 0xffffffff)
491486   AM_RANGE(0x00c0, 0x00df) AM_DEVREADWRITE(DMA8237, "dma8237_2", at32_dma8237_2_r, at32_dma8237_2_w)
492487   AM_RANGE(0x00e8, 0x00eb) AM_NOP
493488   AM_RANGE(0x01f0, 0x01f7) AM_DEVREADWRITE(IDE_CONTROLLER, "ide", ide_r, ide_w)
r2942r2943
624619   {
625620      {
626621         4772720/4,            /* heartbeat IRQ */
627         pc_timer0_w,
628         NULL
622         pc_timer0_w
629623      }, {
630624         4772720/4,            /* dram refresh */
631         NULL,
632625         NULL
633626      }, {
634627         4772720/4,            /* pio port c pin 4, and speaker polling enough */
635         NULL,
636628         NULL
637629      }
638630   }
src/emu/machine/pit8253.c
r2942r2943
1818 *
1919 *****************************************************************************/
2020
21#include <math.h>
2221#include "driver.h"
23#include "devconv.h"
2422#include "machine/pit8253.h"
2523
2624
r2942r2943
3735#define   LOG1(msg)      do { if (VERBOSE >= 1) logerror msg; } while (0)
3836#define   LOG2(msg)      do { if (VERBOSE >= 2) logerror msg; } while (0)
3937
40
41#define   TIMER_TIME_NEVER ((UINT64) -1)
42
4338#define   CYCLES_NEVER ((UINT32) -1)
4439
4540/* device types */
r2942r2943
5752
5853struct pit8253_timer
5954{
55   int index;                  /* index number of the timer */
6056   double clockin;               /* input clock frequency in Hz */
57   int clock;                  /* clock signal when clockin is 0 */
6158
6259   pit8253_output_changed_func      output_changed;   /* callback function for when output changes */
63   pit8253_frequency_changed_func   frequency_changed;   /* callback function for when output frequency changes */
6460
6561   attotime last_updated;         /* time when last updated */
6662
67   emu_timer *outputtimer;      /* MAME timer for output change callback */
68   emu_timer *freqtimer;         /* MAME timer for output frequency change callback */
63   emu_timer *updatetimer;         /* MAME timer to process updates */
6964
65   UINT8 programmed;            /* Has this counter been programmed by writing to the control word */
7066   UINT16 value;               /* current counter value ("CE" in Intel docs) */
7167   UINT16 latch;               /* latched counter value ("OL" in Intel docs) */
7268   UINT16 count;               /* new counter value ("CR" in Intel docs) */
r2942r2943
8480   INT32 phase;                  /* see phase definition tables in simulate2(), below */
8581
8682   UINT32 cycles_to_output;      /* cycles until output callback called */
87   UINT32 cycles_to_freq;         /* cycles until frequency callback called */
88   UINT32 freq_count;            /* counter period for periodic modes, 0 if counter non-periodic */
8983};
9084
9185typedef struct _pit8253_t   pit8253_t;
r2942r2943
211205}
212206
213207
214static double get_frequency(struct pit8253_timer *timer)
208/* Counter loading: transfer of a count from the CR to the CE */
209static void load_counter_value(const device_config *device, struct pit8253_timer *timer)
215210{
216   LOG2(("pit8253: get_frequency() : %lf\n",(double)(timer->freq_count == 0 ? 0 : timer->clockin / timer->freq_count)));
217   return timer->freq_count ==   0 ?   0 :   timer->clockin / timer->freq_count;
218}
219
220
221/* Call the frequency callback in "cycles" cycles */
222static void   freq_callback_in(struct   pit8253_timer *timer,UINT32   cycles)
223{
224   LOG2(("pit8253: freq_callback_in(): %d cycles\n",cycles));
225
226   if (timer->frequency_changed == NULL)
227   {
228      return;
229   }
230
231   if (timer->clockin == 0   || cycles == CYCLES_NEVER)
232   {
233      timer_reset(timer->freqtimer,attotime_never);
234   }
235   else
236   {
237      timer_reset(timer->freqtimer,double_to_attotime(cycles / timer->clockin));
238   }
239   timer->cycles_to_freq =   cycles;
240}
241
242
243static void   set_freq_count(const device_config *device, struct pit8253_timer *timer)
244{
245   int   mode = CTRL_MODE(timer->control);
246   UINT32 freq_count;
247
248   if ((mode == 2 || mode == 3) &&   timer->gate   != 0 &&   timer->phase !=   0)
249   {
250      freq_count = adjusted_count(CTRL_BCD(timer->control),timer->count);
251   }
252   else
253   {
254      freq_count = 0;
255   }
256
257   if (freq_count != timer->freq_count)
258   {
259      timer->freq_count =   freq_count;
260      if (timer->frequency_changed != NULL)
261      {
262         timer->frequency_changed(device, get_frequency(timer));
263         freq_callback_in(timer,CYCLES_NEVER);
264      }
265   }
266
267   LOG2(("pit8253: set_freq_count() : %d\n",freq_count));
268}
269
270
271/* Call the output callback in "cycles" cycles */
272static void   trigger_countdown(const device_config *device, struct pit8253_timer *timer)
273{
274   LOG2(("pit8253: trigger_countdown()\n"));
275
276   timer->phase = 1;
277211   timer->value = timer->count;
278   if (CTRL_MODE(timer->control) == 3 && timer->output   == 0)
279      timer->value &=   0xfffe;
280
281   set_freq_count(device, timer);
212   timer->null_count = 1;
213   if ( CTRL_MODE(timer->control) == 3 && timer->output == 0)
214      timer->value &= 0xfffe;
282215}
283216
284217
r2942r2943
297230
298231/* This emulates timer "timer" for "elapsed_cycles" cycles and assumes no
299232   callbacks occur during that time. */
300static void   simulate2(const device_config *device, struct pit8253_timer *timer,UINT64 elapsed_cycles)
233static void   simulate2(const device_config *device, struct pit8253_timer *timer, INT64 elapsed_cycles)
301234{
302235   UINT32 adjusted_value;
303236   int   bcd   = CTRL_BCD(timer->control);
304237   int   mode = CTRL_MODE(timer->control);
305238   int   cycles_to_output = 0;
306239
307   if (timer->cycles_to_freq != CYCLES_NEVER)
308   {
309      timer->cycles_to_freq -= elapsed_cycles;
310   }
240   LOG2(("pit8253: simulate2(): simulating %d cycles for %d in mode %d, bcd = %d, phase = %d, gate = %d, output %d, value = 0x%04x\n",
241        (int)elapsed_cycles,timer->index,mode,bcd,timer->phase,timer->gate,timer->output,timer->value));
311242
312   LOG2(("pit8253: simulate2(): simulating %d cycles in mode %d, bcd = %d, phase = %d, gate = %d, value = 0x%04x\n",
313        (int)elapsed_cycles,mode,bcd,timer->phase,timer->gate,timer->value));
314
315243   switch (mode) {
316244   case 0:
317245      /* Mode 0: (Interrupt on Terminal Count)
r2942r2943
333261
334262        Gate level sensitive only. Low disables counting, high enables it. */
335263
336      if (timer->gate   == 0 ||   timer->phase ==   0)
264      if (timer->phase ==   0)
337265      {
338266         cycles_to_output = CYCLES_NEVER;
339267      }
r2942r2943
341269      {
342270         if (elapsed_cycles > 0 && timer->phase == 1)
343271         {
272            /* Counter load cycle */
344273            --elapsed_cycles;
345274            timer->phase = 2;
275            load_counter_value( device, timer );
346276         }
347277
348         if (timer->phase ==   2)
278         if ( timer->gate == 0 )
349279         {
350            adjusted_value = adjusted_count(bcd,timer->value);
351            if (elapsed_cycles < adjusted_value)
280            cycles_to_output = CYCLES_NEVER;
281         }
282         else
283         {
284            if (timer->phase ==   2)
352285            {
353               /* Counter didn't wrap */
354               decrease_counter_value(timer,elapsed_cycles);
286               adjusted_value = adjusted_count(bcd,timer->value);
287               if (elapsed_cycles >= adjusted_value)
288               {
289                  /* Counter wrapped, output goes high */
290                  elapsed_cycles -= adjusted_value;
291                  timer->phase = 3;
292                  timer->value = 0;
293                  set_output( device, timer, 1 );
294               }
355295            }
356            else
296
297            decrease_counter_value(timer,elapsed_cycles);
298
299            switch( timer->phase )
357300            {
358               /* Counter wrapped, output goes high */
359               elapsed_cycles -= adjusted_value;
360               timer->phase = 3;
361               timer->value = 0;
301            case 1:      cycles_to_output = 1; break;
302            case 2:      cycles_to_output = adjusted_count( bcd, timer->value ); break;
303            case 3:      cycles_to_output = adjusted_count( bcd, timer->value ); break;
362304            }
363305         }
364
365         if (timer->phase ==   3)
366         {
367            decrease_counter_value(timer,elapsed_cycles);
368            cycles_to_output = CYCLES_NEVER;
369         }
370         else
371         {
372            cycles_to_output = adjusted_count(bcd,timer->value)   + (timer->phase   == 1 ? 1 : 0);
373         }
374306      }
375
376      set_output(device, timer, timer->phase == 3 ? 1 : 0);
377307      break;
378308
379309
380310   case 1:
381311      /* Mode 1: (Hardware Retriggerable One-Shot a.k.a. Programmable One-Shot)
382312
383        --+       +------------------
384          |       |
385          +-------+
386          <-  n  ->
313        -----+       +------------------
314             |       |
315             +-------+
316             <-  n  ->
387317
388318          ^
389319          +- trigger
390320
391321        phase|output|length  |value|next|comment
392322        -----+------+--------+-----+----+----------------------------------
393            0|high  |infinity|0..1 |1   |counting down
394            1|low   |n       |n..1 |0   |counting down
323            0|high  |infinity|     |1   |counting down
324            1|high  |1       |     |2   |internal delay to load counter
325            2|low   |n       |n..1 |3   |counting down
326            3|high  |infinity|0..1 |3   |counting down
395327
396328        Gate rising-edge sensitive only.
397329        Rising edge initiates counting and resets output after next clock. */
398330
399      adjusted_value = adjusted_count(bcd,timer->value);
400      if (elapsed_cycles < adjusted_value)
331      if ( elapsed_cycles > 0 && timer->phase == 1 )
401332      {
402         /* Counter didn't wrap */
403         decrease_counter_value(timer,elapsed_cycles);
404         cycles_to_output = (timer->phase ==   0 ?   CYCLES_NEVER : adjusted_count(bcd,timer->value));
333         /* Counter load cycle, output goes low */
334         --elapsed_cycles;
335         timer->phase = 2;
336         load_counter_value( device, timer );
337         set_output( device, timer, 0 );
405338      }
406      else
339
340      if ( timer->phase == 2 )
407341      {
408         /* Counter wrapped, output goes high */
409         elapsed_cycles -= adjusted_value;
410         timer->phase = 0;
411         timer->value = 0;
412         decrease_counter_value(timer,elapsed_cycles);
413         cycles_to_output = CYCLES_NEVER;
342         adjusted_value = adjusted_count( bcd, timer->value );
343         if ( elapsed_cycles >= adjusted_value )
344         {
345            /* Counter wrapped, output goes high */
346            timer->phase = 3;
347            set_output( device, timer, 1 );
348         }
414349      }
415      set_output(device, timer, timer->phase == 0 ? 1 : 0);
350
351      decrease_counter_value( timer, elapsed_cycles );
352
353      switch( timer->phase )
354      {
355      case 1:      cycles_to_output = 1; break;
356      case 2:      cycles_to_output = adjusted_count( bcd, timer->value ); break;
357      default:   cycles_to_output = CYCLES_NEVER; break;
358      }
416359      break;
417360
418361
r2942r2943
422365        --------------+ +---------+ +----
423366                      | |         | |
424367                      +-+         +-+
425            <-    n    -X-    n    ->
368           <-    n    -X-    n    ->
426369                      <1>
427            ^
428            +- counter load or trigger
370        ^
371        +- counter load or trigger
429372
430373        phase|output|length  |value|next|comment
431374        -----+------+--------+-----+----+----------------------------------
432375            0|high  |infinity|     |1   |waiting for count
433            1|v!=1  |n       |n..1 |1   |counting down
376          1|high  |1       |     |2   |internal delay to load counter
377            2|high  |n       |n..2 |3   |counting down
378          3|low   |1       |1    |2   |reload counter
434379
435380        Counter rewrite has no effect until repeated
436381
r2942r2943
447392      }
448393      else
449394      {
450         adjusted_value = adjusted_count(bcd,timer->value);
451         if (elapsed_cycles < adjusted_value)
395         if ( elapsed_cycles > 0 && timer->phase == 1 )
452396         {
453            /* Counter didn't wrap */
454            decrease_counter_value(timer,elapsed_cycles);
397            --elapsed_cycles;
398            timer->phase = 2;
399            load_counter_value( device, timer );
455400         }
456         else
401
402         adjusted_value = adjusted_count( bcd, timer->value );
403
404         do
457405         {
458            /* Counter wrapped around one or more times */
459            elapsed_cycles -= adjusted_value;
460            trigger_countdown(device, timer);
461            decrease_counter_value(timer,elapsed_cycles   % adjusted_count(bcd,timer->count));
406            if ( timer->phase == 2 )
407            {
408               if ( elapsed_cycles + 1 >= adjusted_value )
409               {
410                  /* Coounter hits 1, output goes low */
411                  timer->phase = 3;
412                  set_output( device, timer, 0 );
413               }
414            }
415
416            if ( elapsed_cycles > 0 && timer->phase == 3 )
417            {
418               /* Reload counter, output goes high */
419               --elapsed_cycles;
420               timer->phase = 2;
421               load_counter_value( device, timer );
422               adjusted_value = adjusted_count( bcd, timer->value );
423               set_output( device, timer, 1 );
424            }
462425         }
463         cycles_to_output = (timer->value ==   1 ?   1 :   (adjusted_count(bcd,timer->value) -   1));
426         while( elapsed_cycles >= adjusted_value );
464427
465         set_output(device, timer, timer->value != 1 ? 1 : 0);
428         /* Calculate counter value */
429         decrease_counter_value(timer,elapsed_cycles);
430
431         switch( timer->phase )
432         {
433         case 1:      cycles_to_output = 1; break;
434         default:   cycles_to_output = (timer->value ==   1 ?   1 :   (adjusted_count(bcd,timer->value) -   1));
435         }
466436      }
467437      break;
468438
r2942r2943
470440   case 3:
471441      /* Mode 3: (Square Wave Generator)
472442
473        ----------------+           +-----------+           +----
474                        |           |           |           |
475                        +-----------+           +-----------+
476            <- (n+1)/2 -X-   n/2   ->
477            ^
478            +- counter load or trigger
443      ----------------+           +-----------+           +----
444                      |           |           |           |
445                      +-----------+           +-----------+
446          <- (n+1)/2 -X-   n/2   ->
447       ^
448       +- counter load or trigger
479449
480450        phase|output|length  |value|next|comment
481        -----+------+--------+-----+----+----------------------------------
482            0|high  |infinity|     |1   |waiting for count
483            1|      |infinity|n..0 |1   |counting down double speed
451      -----+------+--------+-----+----+----------------------------------
452          0|high  |infinity|     |1   |waiting for count
453          1|high  |1       |     |2   |internal delay to load counter
454          2|high  |n/2(+1) |n..0 |3   |counting down double speed, reload counter
455          3|low   |n/2     |n..0 |2   |counting down double speed, reload counter
484456
485        Counter rewrite has no effect until repeated (output falling or rising)
457      Counter rewrite has no effect until repeated (output falling or rising)
486458
487        Gate rising-edge and level sensitive.
488        Gate low disables counting and sets output immediately high.
489        Rising-edge reloads count and initiates counting
490        Gate high enables counting. */
459      Gate rising-edge and level sensitive.
460      Gate low disables counting and sets output immediately high.
461      Rising-edge reloads count and initiates counting
462      Gate high enables counting. */
491463
492464      if (timer->gate   == 0 ||   timer->phase ==   0)
493465      {
r2942r2943
497469      }
498470      else
499471      {
500         adjusted_value = adjusted_count(bcd,timer->value);
501         if ((elapsed_cycles<<1)   < adjusted_value)
472         if ( elapsed_cycles > 0 && timer->phase == 1 )
502473         {
503            /* Counter didn't wrap around */
504            decrease_counter_value(timer,elapsed_cycles<<1);
474            --elapsed_cycles;
475            timer->phase = 2;
476            load_counter_value( device, timer );
505477         }
506         else
507         {
508            /* Counter wrapped around one or more times */
509            elapsed_cycles -= ((adjusted_value+1)>>1);
510478
511            set_output(device, timer, 1 - timer->output);
512            trigger_countdown(device, timer);
479         adjusted_value = adjusted_count( bcd, timer->value );
513480
514            elapsed_cycles %= adjusted_count(bcd,timer->count);
515            adjusted_value = adjusted_count(bcd,timer->value);
516            if ((elapsed_cycles<<1)   >= adjusted_value)
481         do
482         {
483            if ( timer->phase == 2 && elapsed_cycles >= ( ( adjusted_value + 1 ) >> 1 ) )
517484            {
518               /* Counter wrapped around an even number of times */
519               elapsed_cycles -= ((adjusted_value+1)>>1);
485               /* High phase expired, output goes low */
486               elapsed_cycles -= ( ( adjusted_value + 1 ) >> 1 );
487               timer->phase = 3;
488               load_counter_value( device, timer );
489               adjusted_value = adjusted_count( bcd, timer->value );
490               set_output( device, timer, 0 );
491            }
520492
521               set_output(device, timer, 1 - timer->output);
522               trigger_countdown(device, timer);
493            if ( timer->phase == 3 && elapsed_cycles >= ( adjusted_value >> 1 ) )
494            {
495               /* Low phase expired, output goes high */
496               elapsed_cycles -= ( adjusted_value >> 1 );
497               timer->phase = 2;
498               load_counter_value( device, timer );
499               adjusted_value = adjusted_count( bcd, timer->value );
500               set_output( device, timer, 1 );
523501            }
524            decrease_counter_value(timer,elapsed_cycles<<1);
525502         }
526         cycles_to_output = (adjusted_count(bcd,timer->value) + 1) >> 1;
503         while( ( timer->phase == 2 && elapsed_cycles >= ( ( adjusted_value + 1 ) >> 1 ) ) ||
504                ( timer->phase == 3 && elapsed_cycles >= ( adjusted_value >> 1 ) ) );
505
506         decrease_counter_value(timer,elapsed_cycles<<1);
507
508         switch( timer->phase )
509         {
510         case 1:      cycles_to_output = 1; break;
511         case 2:      cycles_to_output = ( adjusted_count( bcd, timer->value ) + 1 ) >> 1; break;
512         case 3:      cycles_to_output = adjusted_count( bcd, timer->value ) >> 1; break;
513         }
527514      }
528515      break;
529516
r2942r2943
531518   case 4:
532519   case 5:
533520      /* Mode 4: (Software Trigger Strobe)
534           Mode 5: (Hardware Trigger Strobe)
521         Mode 5: (Hardware Trigger Strobe)
535522
536        --------------+ +--------------------
537                      | |
538                      +-+
539            <-  n+1  ->
540            ^         <1>
541            +- counter load (mode 4) or trigger (mode 5)
523      --------------+ +--------------------
524                    | |
525                    +-+
526          <-  n+1  ->
527          ^         <1>
528          +- counter load (mode 4) or trigger (mode 5)
542529
543        phase|output|length  |value|next|comment
544        -----+------+--------+-----+----+----------------------------------
545            0|high  |infinity|0..1 |0   |waiting for count
546            1|high  |1       |     |2   |internal delay when counter loaded
547            2|high  |n       |n..1 |3   |counting down
548            3|low   |1       |0    |0   |strobe
530      phase|output|length  |value|next|comment
531      -----+------+--------+-----+----+----------------------------------
532          0|high  |infinity|0..1 |0   |waiting for count/counting down
533          1|high  |1       |     |2   |internal delay when counter loaded
534          2|high  |n       |n..1 |3   |counting down
535          3|low   |1       |0    |0   |strobe
549536
550        Mode 4 only: counter rewrite loads new counter
551        Mode 5 only: count not reloaded immediately.
552        Mode control write doesn't stop count but sets output high
537      Mode 4 only: counter rewrite loads new counter
538      Mode 5 only: count not reloaded immediately.
539      Mode control write doesn't stop count but sets output high
553540
554        Mode 4 only: Gate level sensitive only. Low disables counting, high enables it.
555        Mode 5 only: Gate rising-edge sensitive only. Rising edge initiates counting */
541      Mode 4 only: Gate level sensitive only. Low disables counting, high enables it.
542      Mode 5 only: Gate rising-edge sensitive only. Rising edge initiates counting */
556543
557544      if (timer->gate   == 0 &&   mode ==   4)
558545      {
r2942r2943
564551         {
565552            --elapsed_cycles;
566553            timer->phase = 2;
554            load_counter_value( device, timer );
567555         }
568556
557         if ( timer->value == 0 && timer->phase == 2 )
558            adjusted_value = 0;
559         else
560            adjusted_value = adjusted_count( bcd, timer->value );
561
562         if ( timer->phase == 2 && elapsed_cycles >= adjusted_value )
563         {
564            /* Counter has hit zero, set output to low */
565            elapsed_cycles -= adjusted_value;
566            timer->phase = 3;
567            timer->value = 0;
568            set_output( device, timer, 0 );
569         }
570
569571         if (elapsed_cycles > 0 && timer->phase == 3)
570572         {
571573            --elapsed_cycles;
572574            timer->phase = 0;
573575            decrease_counter_value(timer,1);
576            set_output( device, timer, 1 );
574577         }
575578
576         if (timer->value ==   0 && timer->phase == 2)
577            adjusted_value = 0;
578         else
579            adjusted_value = adjusted_count(bcd,timer->value);
579         decrease_counter_value(timer,elapsed_cycles);
580580
581         if (elapsed_cycles < adjusted_value)
581         switch( timer->phase )
582582         {
583            /* Counter didn't wrap */
584            decrease_counter_value(timer,elapsed_cycles);
583         case 1:      cycles_to_output = 1; break;
584         case 2:      cycles_to_output = adjusted_count( bcd, timer->value ); break;
585         case 3:      cycles_to_output = 1; break;
585586         }
586         else
587         {
588            elapsed_cycles -= adjusted_value;
589            timer->value = 0;
590            if (elapsed_cycles == 0)
591            {
592               /* We hit the strobe cycle */
593               timer->phase = 3;
594            }
595            else
596            {
597               decrease_counter_value(timer,elapsed_cycles);
598               timer->phase = 0;
599            }
600         }
601         switch(timer->phase) {
602         case 0:
603            cycles_to_output = CYCLES_NEVER;
604            break;
605         case 1:
606            cycles_to_output = adjusted_count(bcd,timer->value)   + 1;
607            break;
608         case 2:
609            cycles_to_output = adjusted_count(bcd,timer->value);
610            break;
611         case 3:
612            cycles_to_output = 1;
613            break;
614         }
615587      }
616      set_output(device, timer, timer->phase != 3 ? 1 : 0);
617588      break;
618589   }
619590
620   if (timer->output_changed != NULL)
591   timer->cycles_to_output   = cycles_to_output;
592   if (cycles_to_output ==   CYCLES_NEVER ||   timer->clockin == 0)
621593   {
622      timer->cycles_to_output   = cycles_to_output;
623      if (cycles_to_output ==   CYCLES_NEVER ||   timer->clockin == 0)
624      {
625         timer_reset(timer->outputtimer,attotime_never);
626      }
627      else
628      {
629         timer_reset(timer->outputtimer,
630            double_to_attotime(cycles_to_output / timer->clockin));
631      }
594      timer_adjust_oneshot(timer->updatetimer, attotime_never, timer->index);
632595   }
596   else
597   {
598      attotime next_fire_time = attotime_add( timer->last_updated, double_to_attotime( cycles_to_output / timer->clockin ) );
633599
634   if (timer->cycles_to_freq == 0)
635      timer->cycles_to_freq =   CYCLES_NEVER;
600      timer_adjust_oneshot(timer->updatetimer, attotime_sub( next_fire_time, timer_get_time() ), timer->index );
601   }
602
603    LOG2(("pit8253: simulate2(): simulating %d cycles for %d in mode %d, bcd = %d, phase = %d, gate = %d, output %d, value = 0x%04x, cycles_to_output = %04x\n",
604          (int)elapsed_cycles,timer->index,mode,bcd,timer->phase,timer->gate,timer->output,timer->value,cycles_to_output));
636605}
637606
638607
r2942r2943
653622   inaccurate by more than one cycle, and the output changed multiple
654623   times during the discrepancy. In practice updates should still be O(1).
655624*/
656static void   simulate(const device_config *device, struct pit8253_timer *timer,UINT64 elapsed_cycles)
625static void   simulate(const device_config *device, struct pit8253_timer *timer, INT64 elapsed_cycles)
657626{
658   while ((timer->cycles_to_output   != CYCLES_NEVER   &&
659         timer->cycles_to_output   <= elapsed_cycles) ||
660         (timer->cycles_to_freq != CYCLES_NEVER &&
661         timer->cycles_to_freq <= elapsed_cycles))
662   {
663      UINT32 cycles_to_callback;
664
665      if (timer->cycles_to_output   < timer->cycles_to_freq   &&
666         timer->cycles_to_output   != CYCLES_NEVER)
667      {
668         cycles_to_callback = timer->cycles_to_output;
669      }
670      else
671      {
672         cycles_to_callback = timer->cycles_to_freq;
673      }
674
675      simulate2(device, timer, cycles_to_callback);
676      elapsed_cycles -= cycles_to_callback;
677   }
678   simulate2(device, timer, elapsed_cycles);
627   if ( elapsed_cycles > 0 )
628      simulate2(device, timer, elapsed_cycles);
629   else
630      if ( timer->clockin )
631         timer_adjust_oneshot(timer->updatetimer, double_to_attotime( 1 / timer->clockin ), timer->index );
679632}
680633
681634
r2942r2943
686639       years of time. Should be enough for now. */
687640   attotime now =   timer_get_time();
688641   attotime elapsed_time = attotime_sub(now,timer->last_updated);
689   INT64 elapsed_cycles =   attotime_to_double(elapsed_time) *   timer->clockin;
642   INT64 elapsed_cycles =   attotime_to_double(elapsed_time) * timer->clockin;
690643
691   timer->last_updated   = attotime_add(timer->last_updated,double_to_attotime(elapsed_cycles/timer->clockin));
644   LOG1(("pit8253: update(): timer %d, %lld elapsed_cycles\n", timer->index, elapsed_cycles));
692645
693   simulate(device, timer,elapsed_cycles);
694}
646   if ( timer->clockin )
647   {
648      timer->last_updated   = attotime_add(timer->last_updated,double_to_attotime(elapsed_cycles/timer->clockin));
649   }
650   else
651   {
652      timer->last_updated = now;
653   }
695654
696
697static TIMER_CALLBACK( frequency_changed )
698{
699   const device_config *device = ptr;
700   pit8253_t   *pit8253 = get_safe_token(device);
701   struct pit8253_timer *timer = get_timer(pit8253,param);
702   INT64 cycles =   timer->cycles_to_freq;
703   double t;
704
705   LOG2(("pit8253: frequency_changed(): timer %d, %d cycles\n",param,(UINT32)cycles));
706
707   simulate(device, timer,cycles);
708
709   t = cycles / timer->clockin;
710
711   timer->last_updated   = attotime_add(timer->last_updated, double_to_attotime(t));
655   if ( timer->programmed )
656      simulate(device, timer, elapsed_cycles);
712657}
713658
714659
715static TIMER_CALLBACK( output_changed )
660static TIMER_CALLBACK( update_timer_cb )
716661{
717662   const device_config *device = ptr;
718663   pit8253_t   *pit8253 = get_safe_token(device);
719664   struct pit8253_timer *timer = get_timer(pit8253,param);
720   INT64 cycles =   timer->cycles_to_output;
721   double t;
722665
723   LOG2(("pit8253: output_changed(): timer %d, %d cycles\n",param,(UINT32)cycles));
666   LOG2(("pit8253: output_changed(): timer %d\n",param));
724667
725   simulate(device, timer,cycles);
726
727   t = cycles / timer->clockin;
728
729   timer->last_updated   = attotime_add(timer->last_updated, double_to_attotime(t));
668   update( device, timer );
730669}
731670
732671
r2942r2943
834773         newcount = 0;
835774   }
836775   timer->count = newcount;
837   timer->null_count =   1;
838776   if (mode ==   2 || mode == 3)
839777   {
840778      if (timer->phase ==   0)
841779      {
842         trigger_countdown(device, timer);
780         timer->phase = 1;
843781      }
844      else
845      {
846         int   bcd   = CTRL_BCD(timer->control);
847         if (mode ==   2)
848         {
849            freq_callback_in(timer,adjusted_count(bcd,timer->value));
850         }
851         else
852         {
853            freq_callback_in(timer,(adjusted_count(bcd,timer->value) + 1) >> 1);
854         }
855      }
856782   }
857783   else
858784   {
859785      if (mode ==   0 || mode == 4)
860786      {
861         trigger_countdown(device, timer);
787         timer->phase = 1;
862788      }
863789   }
864790}
r2942r2943
960886      else {
961887         LOG1(("pit8253_write(): timer=%d bytes=%d mode=%d bcd=%d\n", (data >> 6) & 3, (data >> 4) & 3, (data >> 1) & 7,data & 1));
962888
963         timer->control = (data & 0x3f);
964         timer->null_count =   1;
965         timer->wmsb   = timer->rmsb =   0;
966         /* Phase 0 is always the phase after a mode control write */
967         timer->phase = 0;
968         set_output(device, timer, 1);
969         set_freq_count(device, timer);
889         if ( ( CTRL_MODE(timer->control) != CTRL_MODE(data) ) || ! timer->programmed )
890         {
891            timer->control = (data & 0x3f);
892            timer->null_count =   1;
893            timer->wmsb   = timer->rmsb =   0;
894            /* Phase 0 is always the phase after a mode control write */
895            timer->phase = 0;
896            set_output(device, timer, CTRL_MODE(timer->control) ? 1 : 0);
897            timer->programmed = 1;
898         }
970899      }
971900   }
972901   else
973902   {
903      int   middle_of_a_cycle = 0;
904
974905      update(device, timer);
975906
907      if ( attotime_compare( timer_get_time(), timer->last_updated ) > 0 && timer->clockin != 0 )
908      {
909         middle_of_a_cycle = 1;
910      }
911
976912      switch(CTRL_ACCESS(timer->control))   {
977913      case 0:
978914         /* This should never happen */
r2942r2943
980916
981917      case 1:
982918         /* read/write counter bits 0-7 only */
919
920         /* check if we should compensate for not being on a cycle boundary */
921         if ( middle_of_a_cycle )
922            timer->last_updated = attotime_add(timer->last_updated,double_to_attotime(1/timer->clockin));
923
983924         load_count(device, timer, data);
925         simulate2(device, timer, 0 );
926         if ( CTRL_MODE(timer->control) == 0 )
927         {
928            set_output( device, timer, 0 );
929         }
984930         break;
985931
986932      case 2:
987933         /* read/write counter bits 8-15 only */
934
935         /* check if we should compensate for not being on a cycle boundary */
936         if ( middle_of_a_cycle )
937            timer->last_updated = attotime_add(timer->last_updated,double_to_attotime(1/timer->clockin));
938
988939         load_count(device, timer, data << 8);
940         simulate2(device, timer, 0 );
989941         break;
990942
991943      case 3:
992944         /* read/write bits 0-7 first, then 8-15 */
993945         if (timer->wmsb   != 0)
994946         {
947            /* check if we should compensate for not being on a cycle boundary */
948            if ( middle_of_a_cycle )
949               timer->last_updated = attotime_add(timer->last_updated,double_to_attotime(1/timer->clockin));
950
995951            load_count(device, timer,timer->lowcount | (data << 8));
952            simulate2(device, timer, 0 );
996953         }
997954         else
998955         {
r2942r2943
1003960                       2 won't stop the count, but this was experimentally
1004961                       determined to be false. */
1005962               timer->phase = 0;
963               set_output( device, timer, 0 );
1006964            }
1007965         }
1008966         timer->wmsb   = 1   - timer->wmsb;
1009967         break;
1010968      }
1011969   }
1012   update(device, timer);
1013970}
1014971
1015972
r2942r2943
1031988   {
1032989      update(device, timer);
1033990      timer->gate   = gate;
1034      set_freq_count(device, timer);
1035      if (gate !=   0 &&
1036         (mode == 1 || mode == 5   ||
1037          (timer->phase == 1   && (mode ==   2 || mode == 3))))
991      if (gate !=   0 && ( mode == 1 || mode == 2 || mode == 5 ))
1038992      {
1039         trigger_countdown(device, timer);
993         timer->phase = 1;
1040994      }
1041995      update(device, timer);
1042996   }
r2942r2943
10461000
10471001/* ----------------------------------------------------------------------- */
10481002
1049int   pit8253_get_frequency(const device_config *device, int timerno)
1050{
1051   pit8253_t   *pit8253 = get_safe_token(device);
1052   struct pit8253_timer *timer   = get_timer(pit8253,timerno);
1053
1054   update(device, timer);
1055   return get_frequency(timer);
1056}
1057
1058
1059
10601003int   pit8253_get_output(const device_config *device, int timerno)
10611004{
10621005   pit8253_t   *pit8253 = get_safe_token(device);
r2942r2943
10811024   update(device, timer);
10821025   timer->clockin = new_clockin;
10831026   update(device, timer);
1027}
10841028
1085   if (timer->frequency_changed != NULL)
1029
1030void pit8253_set_clock_signal(const device_config *device, int timerno, int state)
1031{
1032   pit8253_t   *pit8253 = get_safe_token(device);
1033   struct pit8253_timer *timer = get_timer(pit8253,timerno);
1034
1035   LOG2(("pit8253_set_clock_signal(): PIT timer=%d, state = %d\n", timerno, state));
1036
1037   /* Trigger on low to high transition */
1038   if ( !timer->clock && state )
10861039   {
1087      timer->frequency_changed(device, get_frequency(timer));
1088      if (timer->cycles_to_freq != CYCLES_NEVER)
1089      {
1090         freq_callback_in(timer,timer->cycles_to_freq);
1091      }
1040      /* Advance a cycle */
1041      simulate2(device, timer, 1);
10921042   }
1043   timer->clock = state;
10931044}
10941045
10951046
r2942r2943
11101061
11111062      timer->clockin = pit8253->config->timer[timerno].clockin;
11121063      timer->output_changed = pit8253->config->timer[timerno].output_changed;
1113      timer->frequency_changed = pit8253->config->timer[timerno].frequency_changed;
11141064
1115      if (timer->output_changed == NULL)
1116         timer->outputtimer = NULL;
1117      else
1118      {
1119         timer->outputtimer = timer_alloc(output_changed, (void *)device);
1120         timer_adjust_oneshot(timer->outputtimer, attotime_never, timerno);
1121      }
1122      if (timer->frequency_changed == NULL)
1123         timer->freqtimer = NULL;
1124      else
1125      {
1126         timer->freqtimer = timer_alloc(frequency_changed, (void *)device);
1127         timer_adjust_oneshot(timer->freqtimer,  attotime_never, timerno);
1128      }
1065      timer->updatetimer = timer_alloc(update_timer_cb, (void *)device);
1066      timer_adjust_oneshot(timer->updatetimer, attotime_never, timerno);
11291067
11301068      /* set up state save values */
11311069      state_save_register_item(unique_tag, timerno, timer->clockin);
r2942r2943
11441082      state_save_register_item(unique_tag, timerno, timer->null_count);
11451083      state_save_register_item(unique_tag, timerno, timer->phase);
11461084      state_save_register_item(unique_tag, timerno, timer->cycles_to_output);
1147      state_save_register_item(unique_tag, timerno, timer->cycles_to_freq);
1148      state_save_register_item(unique_tag, timerno, timer->freq_count);
11491085      state_save_register_item(unique_tag, timerno, timer->last_updated.seconds);
11501086      state_save_register_item(unique_tag, timerno, timer->last_updated.attoseconds);
1087      state_save_register_item(unique_tag, timerno, timer->programmed);
1088      state_save_register_item(unique_tag, timerno, timer->clock);
11511089   }
11521090}
11531091
r2942r2943
11721110      /* According to Intel's 8254 docs, the state of a timer is undefined
11731111           until the first mode control word is written. Here we define this
11741112           undefined behaviour */
1113      timer->index = i;
11751114      timer->control = timer->status = 0x30;
11761115      timer->rmsb = timer->wmsb = 0;
11771116      timer->count = timer->value = timer->latch = 0;
r2942r2943
11811120      timer->latched_count = 0;
11821121      timer->latched_status = 0;
11831122      timer->null_count = 1;
1184      timer->cycles_to_output = timer->cycles_to_freq = CYCLES_NEVER;
1123      timer->cycles_to_output = CYCLES_NEVER;
11851124
11861125      timer->last_updated = timer_get_time();
11871126
src/emu/machine/pit8253.h
r2942r2943
1414typedef void (*pit8253_output_changed_func)(const device_config *device, int state);
1515#define PIT8253_OUTPUT_CHANGED(name)   void name(const device_config *device, int state )
1616
17typedef void (*pit8253_frequency_changed_func)(const device_config *device, double frequency);
18#define PIT8253_FREQUENCY_CHANGED(name)   void name(const device_config *device, double frequency)
1917
20
2118struct pit8253_config
2219{
2320   struct
r2942r2943
2825      /* If specified, this gets called whenever the output for this timer changes */
2926      pit8253_output_changed_func         output_changed;
3027
31      /* If specified, this gets called whenever the frequency of the output for this
32           timer changes. */
33      pit8253_frequency_changed_func      frequency_changed;
3428   } timer[3];
3529};
3630
r2942r2943
4539WRITE8_DEVICE_HANDLER( pit8253_gate_w );
4640
4741
48int pit8253_get_frequency(const device_config *device, int timer);
42/* In the 8253/8254 the CLKx input lines can be attached to a regular clock
43   signal. Another option is to use the output from one timer as the input
44   clock to another timer.
45
46   The functions below should supply both functionalities. If the signal is
47   a regular clock signal, use the pit8253_set_clockin function. If the
48   CLKx input signal is the output of the different source, set the new_clockin
49   to 0 with pit8253_set_clockin and call pit8253_set_clock_signal to change
50   the state of the input CLKx signal.
51 */
4952int pit8253_get_output(const device_config *device, int timer);
5053void pit8253_set_clockin(const device_config *device, int timer, double new_clockin);
54void pit8253_set_clock_signal(const device_config *device, int timer, int state);
5155
5256
5357#endif   /* __PIT8253_H_ */
src/mess/audio/pc.c
r2942r2943
3030
3131static sound_stream *channel;
3232static int speaker_gate = 0;
33static int baseclock;
33static int input_state;
3434
3535
3636
r2942r2943
4343static int pc_sh_start(void)
4444{
4545   logerror("pc_sh_start\n");
46   speaker_gate = 0;
47   input_state = 0;
4648   channel = stream_create(0, 1, Machine->sample_rate, 0, pc_sh_update);
47   baseclock = 4772720/4;
4849    return 0;
4950}
5051
r2942r2943
9192    }
9293}
9394
94void pc_sh_speaker_change_clock(const device_config *device, double pc_clock)
95
96void pc_sh_speaker_set_input(const device_config *device, int state)
9597{
96    stream_update(channel);
97   baseclock = pit8253_get_frequency( device, 2 );
98   stream_update(channel);
99   input_state = state;
98100}
99101
100102
101
102103/*************************************
103104 *
104105 *   Sound handler update
r2942r2943
107108
108109void pc_sh_update(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int length)
109110{
110   static INT16 signal = 0x7fff;
111   INT16 signal = input_state ? 0x7fff : -0x7fff;
111112   stream_sample_t *buffer = outputs[0];
112   static int incr = 0;
113113   stream_sample_t *sample = buffer;
114   int rate = Machine->sample_rate / 2;
115114
116115   switch( speaker_gate ) {
117116   case 0:
r2942r2943
127126      break;
128127
129128   case 2:
130      /* speaker gate tone from PIT channel #2 */
131      if (baseclock > rate)
132      {
133         /* if the tone is too high to play, don't play it */
134         while( length-- > 0 )
135            *sample++ = 0;
136      }
137      else
138      {
139         while( length-- > 0 )
140         {
141            *sample++ = signal;
142            incr -= baseclock;
143            while( incr < 0 )
144            {
145               incr += rate;
146               signal = -signal;
147            }
148         }
149      }
129      while( length-- > 0 )
130         *sample++ = signal;
150131      break;
151132   }
152133}
src/mess/audio/pc.h
r2942r2943
1919void pc_sh_update(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int samples);
2020void pc_sh_speaker(running_machine *machine, int mode);
2121
22void pc_sh_speaker_change_clock(const device_config *device, double pc_clock);
22void pc_sh_speaker_set_input(const device_config *device, int state);
2323
2424#endif /* __AUDIO_PC_H__ */
src/mess/audio/special.c
r2942r2943
1919static void specimx_sh_update(void *param,stream_sample_t **inputs, stream_sample_t **_buffer,int length);
2020
2121static sound_stream *mixer_channel;
22static int specimx_input[3];
2223
2324const struct CustomSound_interface specimx_sound_interface =
2425{
r2942r2943
2930
3031static void *specimx_sh_start(int clock, const struct CustomSound_interface *config)
3132{
33   specimx_input[0] = specimx_input[1] = specimx_input[2] = 0;
3234   mixer_channel = stream_create(0, 2, Machine->sample_rate, 0, specimx_sh_update);
3335   return (void *) ~0;
3436}
3537
3638static void specimx_sh_update(void *param,stream_sample_t **inputs, stream_sample_t **buffer,int length)
3739{
38   device_config *pit8253 = (device_config*)device_list_find_by_tag( Machine->config->devicelist, PIT8253, "pit8253" );
3940   INT16 channel_0_signal;
4041   INT16 channel_1_signal;
4142   INT16 channel_2_signal;
42   static int channel_0_incr = 0;
43   static int channel_1_incr = 0;
44   static int channel_2_incr = 0;
45   int channel_0_baseclock;
46   int channel_1_baseclock;
47   int channel_2_baseclock;
4843
49   int rate = Machine->sample_rate / 2;
50
5144   stream_sample_t *sample_left = buffer[0];
5245   stream_sample_t *sample_right = buffer[1];
5346
54   channel_0_baseclock = pit8253_get_frequency(pit8253, 0);
55   channel_1_baseclock = pit8253_get_frequency(pit8253, 1);
56   channel_2_baseclock = pit8253_get_frequency(pit8253, 2);
47   channel_0_signal = specimx_input[0] ? 3000 : -3000;
48   channel_1_signal = specimx_input[1] ? 3000 : -3000;
49   channel_2_signal = specimx_input[2] ? 3000 : -3000;
5750
58   channel_0_signal = pit8253_get_output (pit8253,0) ? 3000 : -3000;
59   channel_1_signal = pit8253_get_output (pit8253,1) ? 3000 : -3000;
60   channel_2_signal = pit8253_get_output (pit8253,2) ? 3000 : -3000;
61
62
6351   while (length--)
6452   {
6553      *sample_left = 0;
6654      *sample_right = 0;
6755
6856      /* music channel 0 */
69
7057      *sample_left += channel_0_signal;
71      channel_0_incr -= channel_0_baseclock;
72      while( channel_0_incr < 0 )
73      {
74         channel_0_incr += rate;
75         channel_0_signal = -channel_0_signal;
76      }
7758
78
7959      /* music channel 1 */
80
8160      *sample_left += channel_1_signal;
82      channel_1_incr -= channel_1_baseclock;
83      while( channel_1_incr < 0 )
84      {
85         channel_1_incr += rate;
86         channel_1_signal = -channel_1_signal;
87      }
8861
8962      /* music channel 2 */
90
9163      *sample_left += channel_2_signal;
92      channel_2_incr -= channel_2_baseclock;
93      while( channel_2_incr < 0 )
94      {
95         channel_2_incr += rate;
96         channel_2_signal = -channel_2_signal;
97      }
98     
64
9965      sample_left++;
10066      sample_right++;
10167   }
10268}
10369
104void specimx_sh_change_clock(double clock)
70void specimx_set_input(int index, int state)
10571{
106   stream_update(mixer_channel);
72   stream_update( mixer_channel );
73   specimx_input[index] = state;
10774}
75
76
src/mess/audio/dai.c
r2942r2943
2121
2222static sound_stream *mixer_channel;
2323
24static int dai_input[3];
25
2426static const UINT16 dai_osc_volume_table[] = {
2527                  0,  500, 1000, 1500,
2628               2000, 2500, 3000, 3500,
r2942r2943
4042   NULL
4143};
4244
45
46void dai_set_input(int index, int state)
47{
48   stream_update( mixer_channel );
49
50   dai_input[index] = state;
51}
52
53
4354static void *dai_sh_start(int clock, const struct CustomSound_interface *config)
4455{
45   mixer_channel = stream_create(0, 2, Machine->sample_rate, 0, dai_sh_update);
56   dai_input[0] = dai_input[1] = dai_input[2] = 0;
4657
58   mixer_channel = stream_create(0, 2, Machine->sample_rate, 0, dai_sh_update);
59   
4760   logerror ("sample rate: %d\n", Machine->sample_rate);
4861
4962   return (void *) ~0;
r2942r2943
5164
5265static void dai_sh_update(void *param,stream_sample_t **inputs, stream_sample_t **buffer,int length)
5366{
54   device_config *pit8253 = (device_config*)device_list_find_by_tag( Machine->config->devicelist, PIT8253, "pit8253" );
5567   INT16 channel_0_signal;
5668   INT16 channel_1_signal;
5769   INT16 channel_2_signal;
58   static int channel_0_incr = 0;
59   static int channel_1_incr = 0;
60   static int channel_2_incr = 0;
61   int channel_0_baseclock;
62   int channel_1_baseclock;
63   int channel_2_baseclock;
6470
65   int rate = Machine->sample_rate / 2;
66
6771   stream_sample_t *sample_left = buffer[0];
6872   stream_sample_t *sample_right = buffer[1];
6973
70   channel_0_baseclock = pit8253_get_frequency(pit8253, 0);
71   channel_1_baseclock = pit8253_get_frequency(pit8253, 1);
72   channel_2_baseclock = pit8253_get_frequency(pit8253, 2);
74   channel_0_signal = dai_input[0] ? dai_osc_volume_table[dai_osc_volume[0]] : -dai_osc_volume_table[dai_osc_volume[0]];
75   channel_1_signal = dai_input[1] ? dai_osc_volume_table[dai_osc_volume[1]] : -dai_osc_volume_table[dai_osc_volume[1]];
76   channel_2_signal = dai_input[2] ? dai_osc_volume_table[dai_osc_volume[2]] : -dai_osc_volume_table[dai_osc_volume[2]];
7377
74   channel_0_signal = pit8253_get_output (pit8253,0) ? dai_osc_volume_table[dai_osc_volume[0]] : -dai_osc_volume_table[dai_osc_volume[0]];
75   channel_1_signal = pit8253_get_output (pit8253,1) ? dai_osc_volume_table[dai_osc_volume[1]] : -dai_osc_volume_table[dai_osc_volume[1]];
76   channel_2_signal = pit8253_get_output (pit8253,2) ? dai_osc_volume_table[dai_osc_volume[2]] : -dai_osc_volume_table[dai_osc_volume[2]];
77
78
7978   while (length--)
8079   {
8180      *sample_left = 0;
r2942r2943
8483      /* music channel 0 */
8584
8685      *sample_left += channel_0_signal;
87      channel_0_incr -= channel_0_baseclock;
88      while( channel_0_incr < 0 )
89      {
90         channel_0_incr += rate;
91         channel_0_signal = -channel_0_signal;
92      }
9386
94
9587      /* music channel 1 */
9688
9789      *sample_left += channel_1_signal;
98      channel_1_incr -= channel_1_baseclock;
99      while( channel_1_incr < 0 )
100      {
101         channel_1_incr += rate;
102         channel_1_signal = -channel_1_signal;
103      }
10490
10591      /* music channel 2 */
10692
10793      *sample_left += channel_2_signal;
108      channel_2_incr -= channel_2_baseclock;
109      while( channel_2_incr < 0 )
110      {
111         channel_2_incr += rate;
112         channel_2_signal = -channel_2_signal;
113      }
11494
11595      /* noise channel */
11696
r2942r2943
121101   }
122102}
123103
124void dai_sh_change_clock(const device_config *device, double clock)
125{
126   stream_update(mixer_channel);
127}
src/mess/includes/dai.h
r2942r2943
3939/*----------- defined in audio/dai.c -----------*/
4040
4141extern const struct CustomSound_interface dai_sound_interface;
42void dai_sh_change_clock(const device_config *,double);
42void dai_set_input(int index, int state);
4343
4444
4545#endif /* DAI_H_ */
src/mess/includes/at.h
r2942r2943
2323READ8_HANDLER( at_page8_r );
2424WRITE8_HANDLER( at_page8_w );
2525
26MACHINE_DRIVER_EXTERN( at_kbdc8042 );
27MACHINE_DRIVER_EXTERN( keytronic_keyboard );
28
29READ8_HANDLER(at_kbdc8042_r);
30WRITE8_HANDLER(at_kbdc8042_w);
31
2632DRIVER_INIT( atcga );
2733DRIVER_INIT( atega );
2834DRIVER_INIT( at386 );
r2942r2943
3440MACHINE_START( at );
3541MACHINE_RESET( at );
3642
37
3843#endif /* AT_H_ */
src/mess/includes/special.h
r2942r2943
7676/*----------- defined in audio/special.c -----------*/
7777
7878extern const struct CustomSound_interface specimx_sound_interface;
79extern void specimx_sh_change_clock(double);
79void specimx_set_input(int index, int state);
8080
8181#endif /* SPECIAL_H_ */
src/mess/includes/pc.h
r2942r2943
1212
1313/*----------- defined in machine/pc.c -----------*/
1414
15extern const struct dma8237_interface pc_dma8237_config;
16extern const struct pit8253_config pc_pit8253_config;
15extern const struct dma8237_interface ibm5150_dma8237_config;
16extern const struct pit8253_config ibm5150_pit8253_config;
1717extern const struct pit8253_config pcjr_pit8253_config;
18extern const struct pic8259_interface pc_pic8259_master_config;
19extern const struct pic8259_interface pc_pic8259_slave_config;
18extern const struct pic8259_interface ibm5150_pic8259_master_config;
19extern const struct pic8259_interface ibm5150_pic8259_slave_config;
2020extern const struct pic8259_interface pcjr_pic8259_master_config;
21extern const ins8250_interface ibmpc_com_interface[4];
22extern const ppi8255_interface pc_ppi8255_interface;
21extern const ins8250_interface ibm5150_com_interface[4];
22extern const ppi8255_interface ibm5150_ppi8255_interface;
23extern const ppi8255_interface ibm5160_ppi8255_interface;
2324extern const ppi8255_interface pcjr_ppi8255_interface;
2425
26UINT8 pc_speaker_get_spk(void);
27void pc_speaker_set_spkrdata(UINT8 data);
28void pc_speaker_set_input(UINT8 data);
29
2530void mess_init_pc_common( running_machine *machine, UINT32 flags, void (*set_keyb_int_func)(int), void (*set_hdc_int_func)(int,int));
2631
2732WRITE8_HANDLER( pc_nmi_enable_w );
src/mess/messdriv.c
r2942r2943
395395
396396   /* xt */
397397   DRIVER( ibm5160 )   /* 1982   IBM XT 5160                           */
398   DRIVER( ibm5162 )   /* 1986 IBM XT 5162 (XT w/80286)               */
398399   DRIVER( pc200 )      /* 1988 Sinclair PC200                        */
399400   DRIVER( pc20 )      /* 1988 Amstrad PC20                        */
400401TESTDRIVER( ppc512 )   /* 1987 Amstrad PPC512                        */
src/mess/machine/dai.c
r2942r2943
106106   NULL   /* Port C write */
107107};
108108
109static PIT8253_OUTPUT_CHANGED(dai_pit_out0)
110{
111   dai_set_input(0, state);
112}
113
114
115static PIT8253_OUTPUT_CHANGED(dai_pit_out1)
116{
117   dai_set_input(1, state);
118}
119
120
121static PIT8253_OUTPUT_CHANGED(dai_pit_out2)
122{
123   dai_set_input(2, state);
124}
125
126
109127const struct pit8253_config dai_pit8253_intf =
110128{
111129   {
112130      {
113131         2000000,
114         NULL,
115         dai_sh_change_clock
132         dai_pit_out0
116133      },
117134      {
118135         2000000,
119         NULL,
120         dai_sh_change_clock
136         dai_pit_out1
121137      },
122138      {
123139         2000000,
124         NULL,
125         dai_sh_change_clock
140         dai_pit_out2
126141      }
127142   }
128143};
src/mess/machine/b2m.c
r2942r2943
3535static UINT8 b2m_color[4];
3636static UINT8 b2m_localmachine;
3737
38static int   b2m_sound_input;
39static sound_stream *mixer_channel;
40
41
3842static READ8_HANDLER (b2m_keyboard_r )
3943{     
4044   UINT8 key = 0x00;
r2942r2943
153157                  break;
154158   }
155159}
156static PIT8253_FREQUENCY_CHANGED(bm2_pit_clk)
157{
158   pit8253_set_clockin((device_config*)device_list_find_by_tag( device->machine->config->devicelist, PIT8253, "pit8253"), 0, frequency);
159}
160160
161
161162static PIT8253_OUTPUT_CHANGED(bm2_pit_irq)
162163{
163164   pic8259_set_irq_line((device_config*)device_list_find_by_tag( device->machine->config->devicelist, PIC8259, "pic8259"),1,state);   
164165}
165166
166167
168static PIT8253_OUTPUT_CHANGED(bm2_pit_out1)
169{
170   stream_update( mixer_channel );
171   b2m_sound_input = state;
172}
173
174
175static PIT8253_OUTPUT_CHANGED(bm2_pit_out2)
176{
177   pit8253_set_clock_signal((device_config*)device_list_find_by_tag(device->machine->config->devicelist, PIT8253, "pit8253"),0,state);
178}
179
180
167181const struct pit8253_config b2m_pit8253_intf =
168182{
169183   {
170184      {
171185         2000000,
172         bm2_pit_irq,
173         NULL
186         bm2_pit_irq
174187      },
175188      {
176189         2000000,
177         NULL,
178         NULL
190         bm2_pit_out1
179191      },
180192      {
181193         2000000,
182         NULL,
183         bm2_pit_clk
194         bm2_pit_out2
184195      }
185196   }
186197};
r2942r2943
448459   return INIT_PASS;
449460}
450461
451static sound_stream *mixer_channel;
452462static void *b2m_sh_start(int clock, const struct CustomSound_interface *config);
453463static void b2m_sh_update(void *param,stream_sample_t **inputs, stream_sample_t **_buffer,int length);
454464
r2942r2943
461471
462472static void *b2m_sh_start(int clock, const struct CustomSound_interface *config)
463473{
474   b2m_sound_input = 0;
464475   mixer_channel = stream_create(0, 2, Machine->sample_rate, 0, b2m_sh_update);
465476   return (void *) ~0;
466477}
467478
468479static void b2m_sh_update(void *param,stream_sample_t **inputs, stream_sample_t **buffer,int length)
469480{
470   device_config *pit8253 = (device_config*)device_list_find_by_tag( Machine->config->devicelist, PIT8253, "pit8253" );
471481   INT16 channel_1_signal;
472   static int channel_1_incr = 0;
473   int channel_1_baseclock;
474482
475   int rate = Machine->sample_rate / 2;
476
477483   stream_sample_t *sample_left = buffer[0];
478484   stream_sample_t *sample_right = buffer[1];
479485
480   channel_1_baseclock = pit8253_get_frequency(pit8253, 1);
486   channel_1_signal = b2m_sound_input ? 3000 : -3000;
481487
482   channel_1_signal = pit8253_get_output (pit8253,1) ? 3000 : -3000;
483
484
485488   while (length--)
486489   {
487490      *sample_left = 0;
r2942r2943
490493      /* music channel 1 */
491494
492495      *sample_left = channel_1_signal;
493      channel_1_incr -= channel_1_baseclock;
494      while( channel_1_incr < 0 )
495      {
496         channel_1_incr += rate;
497         channel_1_signal = -channel_1_signal;
498      }
499
500496     
501497      sample_left++;
502498      sample_right++;
src/mess/machine/pmd85.c
r2942r2943
394394const struct pit8253_config pmd85_pit8253_interface =
395395{
396396   {
397      { 0,      NULL,   NULL },
398      { 2000000,   NULL,   NULL },
399      { 1,      NULL,   NULL }
397      { 0,      NULL },
398      { 2000000,   NULL },
399      { 1,      NULL }
400400   }
401401};
402402
src/mess/machine/europc.c
r2942r2943
11#include "driver.h"
22#include "includes/europc.h"
3#include "includes/pc.h"
34#include "machine/pcshare.h"
45#include "machine/pit8253.h"
56#include "video/pc_aga.h"
6#include "audio/pc.h"
77
88
99/*
r2942r2943
171171//      if (data==0x30) pc1640.port62=(pc1640.port65&0x10)>>4;
172172//      else if (data==0x34) pc1640.port62=pc1640.port65&0xf;
173173      pit8253_gate_w( (device_config*)device_list_find_by_tag( machine->config->devicelist, PIT8253, "pit8253" ), 2, data & 1);
174      pc_sh_speaker(machine, data&3);
174      pc_speaker_set_spkrdata( data & 0x02 );
175175      pc_keyb_set_clock(data&0x40);
176176      break;
177177   }
src/mess/machine/at.c
r2942r2943
88#include "deprecat.h"
99
1010#include "cpu/i386/i386.h"
11#include "cpu/i8x41/i8x41.h"
1112
1213#include "machine/pic8259.h"
1314#include "machine/8237dma.h"
r2942r2943
2324#include "includes/pc.h"
2425#include "includes/at.h"
2526#include "machine/pckeybrd.h"
26#include "audio/pc.h"
27#include "sound/speaker.h"
2728#include "audio/sblaster.h"
2829#include "machine/i82439tx.h"
2930
r2942r2943
3132#include "machine/pc_hdc.h"
3233#include "includes/pc_mouse.h"
3334
34#define LOG_PORT80 1
35#include "cpu/i8051/i8051.h"
3536
37#define LOG_PORT80   0
38#define LOG_KBDC   0
39
3640static struct {
3741   const device_config   *pic8259_master;
3842   const device_config   *pic8259_slave;
3943   const device_config   *dma8237_1;
4044   const device_config   *dma8237_2;
45   const device_config   *pit8254;
4146} at_devices;
4247
4348static const SOUNDBLASTER_CONFIG soundblaster = { 1,5, {1,0} };
r2942r2943
7075
7176
7277
78/*************************************************************************
79 *
80 *      PC Speaker related
81 *
82 *************************************************************************/
83
84static UINT8 at_spkrdata = 0;
85static UINT8 at_speaker_input = 0;
86
87static UINT8 at_speaker_get_spk(void)
88{
89   return at_spkrdata & at_speaker_input;
90}
91
92
93static void at_speaker_set_spkrdata(UINT8 data)
94{
95   at_spkrdata = data ? 1 : 0;
96   speaker_level_w( 0, at_speaker_get_spk() );
97}
98
99
100static void at_speaker_set_input(UINT8 data)
101{
102   at_speaker_input = data ? 1 : 0;
103   speaker_level_w( 0, at_speaker_get_spk() );
104}
105
106
107
73108/*************************************************************
74109 *
75110 * pit8254 configuration
76111 *
77112 *************************************************************/
78113
79static PIT8253_OUTPUT_CHANGED( pc_timer0_w )
114static PIT8253_OUTPUT_CHANGED( at_pit8254_out0_changed )
80115{
81116   if ( at_devices.pic8259_master ) {
82117      pic8259_set_irq_line(at_devices.pic8259_master, 0, state);
r2942r2943
84119}
85120
86121
122static PIT8253_OUTPUT_CHANGED( at_pit8254_out2_changed )
123{
124   at_speaker_set_input( state ? 1 : 0 );
125}
126
127
87128const struct pit8253_config at_pit8254_config =
88129{
89130   {
90131      {
91132         4772720/4,            /* heartbeat IRQ */
92         pc_timer0_w,
93         NULL
133         at_pit8254_out0_changed
94134      }, {
95135         4772720/4,            /* dram refresh */
96         NULL,
97136         NULL
98137      }, {
99138         4772720/4,            /* pio port c pin 4, and speaker polling enough */
100         NULL,
101         pc_sh_speaker_change_clock
139         at_pit8254_out2_changed
102140      }
103141   }
104142};
r2942r2943
183221   at_pages[offset % 0x10] = data;
184222
185223   if (LOG_PORT80 && (offset == 0))
224   {
186225      logerror(" at_page8_w(): Port 80h <== 0x%02x (PC=0x%08x)\n", data, (unsigned) activecpu_get_reg(REG_PC));
226   }
187227
188228   switch(offset % 8) {
189229   case 1:
r2942r2943
266306};
267307
268308
269/* TODO: How is still hooked up in the actual machine? */
309/* TODO: How is this hooked up in the actual machine? */
270310const struct dma8237_interface at_dma8237_2_config =
271311{
272312   0,
273313   1.0e-6, // 1us
274314
275   NULL,
276   NULL,
315   pc_dma_read_byte,
316   pc_dma_write_byte,
277317
278318   { NULL, NULL, NULL, NULL },
279319   { NULL, NULL, NULL, NULL },
r2942r2943
358398static void at_fdc_interrupt(int state)
359399{
360400   pic8259_set_irq_line(at_devices.pic8259_master, 6, state);
401//if ( mess_ram[0x0490] == 0x74 )
402//   mess_ram[0x0490] = 0x54;
361403}
362404
363405
364406static void at_fdc_dma_drq(int state, int read_)
365407{
366   dma8237_drq_write((device_config*)device_list_find_by_tag( Machine->config->devicelist, DMA8237, "dma8237_1" ), FDC_DMA, state);
408   dma8237_drq_write( at_devices.dma8237_1, FDC_DMA, state);
367409}
368410
369411static const struct pc_fdc_interface fdc_interface =
370412{
371413   NEC765A,
372   NEC765_RDY_PIN_CONNECTED,
414   NEC765_RDY_PIN_NOT_CONNECTED,
373415   at_fdc_interrupt,
374416   at_fdc_dma_drq,
375417};
376418
377419
378420static int at_get_out2(running_machine *machine) {
379   return pit8253_get_output((device_config*)device_list_find_by_tag( machine->config->devicelist, PIT8254, "at_pit8254" ), 2 );
421   return pit8253_get_output(at_devices.pit8254, 2 );
380422}
381423
382424
425/**********************************************************
426 *
427 * 8042 keyboard controller interface
428 *
429 * Things connected to the 8042 I/O ports:
430 *
431 *  AT compatible
432 *  =============
433 *
434 *  Port 1 (Input port)
435 *  0 - P10 - Undefined
436 *  1 - P11 - Undefined
437 *  2 - P12 - Undefined
438 *  3 - P13 - Undefined
439 *  4 - P14 - External RAM ( 1 = Enable external RAM, 0 = Disable external RAM )
440 *  5 - P15 - Manufacturing setting ( 1 = Setting enabled, 0 = Setting disabled )
441 *  6 - P16 - Display type switch ( 1 = Color display, 0 = Monochrome display )
442 *  7 - P17 - Keyboard inhibit switch ( 1 = Keyboard enabled, 0 = Keyboard inhibited )
443 *
444 *  Port 2 (Output port)
445 *  0 - P20 - System Reset ( 1 = Normal, 0 = Reset comupter )
446 *  1 - P21 - Gate A20
447 *  2 - P22 - Undefined
448 *  3 - P23 - Undefined
449 *  4 - P24 - Input Buffer Full
450 *  5 - P25 - Output Buffer Empty
451 *  6 - P26 - Keyboard Clock ( 1 = Pull Clock low, 0 = High-Z )
452 *  7 - P27 - Keyboard Data ( 1 = Pull Data low, 0 = High-Z )
453 *
454 *  Test Pins (input)
455 *  0 - T0 - Keyboard Clock input
456 *  1 - T1 - Keyboard Data input
457 *
458 **********************************************************/
459
460static UINT8   kbdc8042_speaker;
461static UINT8   kbdc8042_offset1 = 0xFF;
462static UINT8   keyboard_clock;
463static UINT8   keyboard_data;
464
465
466static READ8_HANDLER( at_kbdc8042_p1_r )
467{
468   logerror("%04x: reading P1\n", activecpu_get_pc() );
469   return 0xFF;
470}
471
472
473static READ8_HANDLER( at_kbdc8042_p2_r )
474{
475   return 0xFF;
476}
477
478
479static WRITE8_HANDLER( at_kbdc8042_p2_w )
480{
481   logerror("%04x: writing $%02x to P2\n", activecpu_get_pc(), data );
482
483   at_set_gate_a20( ( data & 0x02 ) ? 1 : 0 );
484   
485   cpunum_set_input_line(machine, 0, INPUT_LINE_RESET, ( data & 0x01 ) ? CLEAR_LINE : ASSERT_LINE );
486
487   keyboard_clock = ( data & 0x40 ) ? 1 : 0;
488   cpunum_set_input_line( machine, 2, I8051_INT0_LINE, (data & 0x40 ) ? HOLD_LINE : CLEAR_LINE );
489
490   keyboard_data = ( data & 0x80 ) ? 1 : 0;
491   cpunum_set_input_line( machine, 2, I8051_T0_LINE, ( data & 0x80 ) ? HOLD_LINE : CLEAR_LINE );
492}
493
494
495static READ8_HANDLER( at_kbdc8042_t0_r )
496{
497   return keyboard_clock;
498}
499
500
501static READ8_HANDLER( at_kbdc8042_t1_r )
502{
503   return keyboard_data;
504}
505
506
507static ADDRESS_MAP_START( kbdc8042_mem, ADDRESS_SPACE_PROGRAM, 8 )
508   AM_RANGE( 0x0000, 0x07FF )  AM_ROM
509   AM_RANGE( 0x0800, 0x08FF )  AM_RAM
510ADDRESS_MAP_END
511
512
513static ADDRESS_MAP_START( kbdc8042_io, ADDRESS_SPACE_IO, 8 )
514   AM_RANGE( I8X41_t0, I8X41_t0 )   AM_READ( at_kbdc8042_t0_r )
515   AM_RANGE( I8X41_t1, I8X41_t1 )   AM_READ( at_kbdc8042_t1_r )
516   AM_RANGE( I8X41_p1, I8X41_p1 )  AM_READ( at_kbdc8042_p1_r )
517   AM_RANGE( I8X41_p2, I8X41_p2 )  AM_READWRITE( at_kbdc8042_p2_r, at_kbdc8042_p2_w )
518ADDRESS_MAP_END
519
520
521static const i8x41_config i8042_config = { TYPE_I8X42 };
522
523
524MACHINE_DRIVER_START( at_kbdc8042 )
525   MDRV_CPU_ADD_TAG("kbdc8042", I8X41, 4772720 )   /* Frequency is a wild guess */
526   MDRV_CPU_PROGRAM_MAP( kbdc8042_mem, 0 )
527   MDRV_CPU_IO_MAP( kbdc8042_io, 0 )
528   MDRV_CPU_CONFIG( i8042_config )
529MACHINE_DRIVER_END
530
531
532READ8_HANDLER(at_kbdc8042_r)
533{
534   static int poll_delay = 4;
535    UINT8 data = 0;
536
537   switch ( offset )
538   {
539   case 0:
540      data = cpunum_get_reg( 1, I8X41_DATA );
541      break;
542
543   case 1:
544      data = kbdc8042_speaker;
545      data &= ~0xc0; /* AT BIOS don't likes this being set */
546
547      /* This needs fixing/updating not sure what this is meant to fix */
548      if ( --poll_delay < 0 )
549      {
550         poll_delay = 3;
551         kbdc8042_offset1 ^= 0x10;
552      }
553      data = (data & ~0x10) | ( kbdc8042_offset1 & 0x10 );
554
555      if ( pit8253_get_output(at_devices.pit8254, 2 ) )
556         data |= 0x20;
557      else
558         data &= ~0x20; /* ps2m30 wants this */
559      break;
560
561   case 2:
562      if (at_get_out2(machine))
563         data |= 0x20;
564      else
565         data &= ~0x20;
566      break;
567
568   case 4:
569      data = cpunum_get_reg( 1, I8X41_STAT );
570      break;
571   }
572
573   if (LOG_KBDC)
574      logerror("kbdc8042_8_r(): offset=%d data=0x%02x\n", offset, (unsigned) data);
575   return data;
576}
577
578
579WRITE8_HANDLER(at_kbdc8042_w)
580{
581   if (LOG_KBDC)
582      logerror("kbdc8042_8_w(): ofset=%d data=0x%02x\n", offset, data);
583
584   switch (offset) {
585   case 0:
586      cpunum_set_reg( 1, I8X41_DATA, data );
587      break;
588
589   case 1:
590      kbdc8042_speaker = data;
591      pit8253_gate_w( at_devices.pit8254, 2, data & 1);
592      at_speaker_set_spkrdata( data & 0x02 );
593      break;
594
595   case 4:
596      cpunum_set_reg( 1, I8X41_CMND, data );
597      break;
598    }
599}
600
601
602/**********************************************************
603 *
604 * Keytronic keyboard interface
605 *
606 **********************************************************/
607
608
609static UINT8   keytronic_p1;
610static UINT8   keytronic_p2;
611static UINT8   keytronic_p3;
612
613
614static READ8_HANDLER( keytronic_p1_r )
615{
616   UINT8 data = keytronic_p1;
617
618   return data;
619}
620
621
622static WRITE8_HANDLER( keytronic_p1_w )
623{
624   logerror("keytronic_p1_w(): write %02x\n", data );
625
626   keytronic_p1 = data;
627}
628
629
630static READ8_HANDLER( keytronic_p2_r )
631{
632   UINT8 data = keytronic_p2;
633
634   return data;
635}
636
637
638static WRITE8_HANDLER( keytronic_p2_w )
639{
640   logerror("keytronic_p2_w(): write %02x\n", data );
641
642   keytronic_p2 = data;
643}
644
645
646static READ8_HANDLER( keytronic_p3_r )
647{
648   UINT8 data = keytronic_p3;
649
650   return data;
651}
652
653
654static WRITE8_HANDLER( keytronic_p3_w )
655{
656   logerror("keytronic_p3_w(): write %02x\n", data );
657
658   keytronic_p3 = data;
659}
660
661
662static READ8_HANDLER( keytronic_data_r )
663{
664   logerror("keytronic_data_r(): read from %04x\n", offset );
665   return 0xFF;
666}
667
668
669static WRITE8_HANDLER( keytronic_data_w )
670{
671   keyboard_data = ( offset & 0x0100 ) ? 1 : 0;
672   keyboard_clock = ( offset & 0x0200 ) ? 1 : 0;
673}
674
675
676static ADDRESS_MAP_START( keytronic_program, ADDRESS_SPACE_PROGRAM, 8 )
677   AM_RANGE( 0x0000, 0x0FFF )   AM_ROM
678ADDRESS_MAP_END
679
680
681static ADDRESS_MAP_START( keytronic_data, ADDRESS_SPACE_DATA, 8 )
682   AM_RANGE( 0x0000, 0xFFFF ) AM_READWRITE( keytronic_data_r, keytronic_data_w )
683ADDRESS_MAP_END
684
685
686static ADDRESS_MAP_START( keytronic_io, ADDRESS_SPACE_IO, 8 )
687   AM_RANGE( 0x01, 0x01 )   AM_READWRITE( keytronic_p1_r, keytronic_p1_w )
688   AM_RANGE( 0x02, 0x02 )   AM_READWRITE( keytronic_p2_r, keytronic_p2_w )
689   AM_RANGE( 0x03, 0x03 )   AM_READWRITE( keytronic_p3_r, keytronic_p3_w )
690ADDRESS_MAP_END
691
692
693MACHINE_DRIVER_START( keytronic_keyboard )
694   MDRV_CPU_ADD_TAG( "keytronic_keyboard", I8051, 11060250 )
695   MDRV_CPU_PROGRAM_MAP( keytronic_program, 0 )
696   MDRV_CPU_DATA_MAP( keytronic_data, 0 )
697   MDRV_CPU_IO_MAP( keytronic_io, 0 )
698MACHINE_DRIVER_END
699
700
701/**********************************************************
702 *
703 * Init functions
704 *
705 **********************************************************/
706
707
383708DRIVER_INIT( atcga )
384709{
385710   static const struct kbdc8042_interface at8042 =
r2942r2943
505830
506831MACHINE_RESET( at )
507832{
508   at_devices.pic8259_master = (device_config*)device_list_find_by_tag( machine->config->devicelist, PIC8259, "pic8259_master" );
509   at_devices.pic8259_slave = (device_config*)device_list_find_by_tag( machine->config->devicelist, PIC8259, "pic8259_slave" );
510   at_devices.dma8237_1 = (device_config*)device_list_find_by_tag( machine->config->devicelist, DMA8237, "dma8237_1" );
511   at_devices.dma8237_2 = (device_config*)device_list_find_by_tag( machine->config->devicelist, DMA8237, "dma8237_2" );
833   at_devices.pic8259_master = device_list_find_by_tag( machine->config->devicelist, PIC8259, "pic8259_master" );
834   at_devices.pic8259_slave = device_list_find_by_tag( machine->config->devicelist, PIC8259, "pic8259_slave" );
835   at_devices.dma8237_1 = device_list_find_by_tag( machine->config->devicelist, DMA8237, "dma8237_1" );
836   at_devices.dma8237_2 = device_list_find_by_tag( machine->config->devicelist, DMA8237, "dma8237_2" );
837   at_devices.pit8254 = device_list_find_by_tag( machine->config->devicelist, PIT8254, "pit8254" );
512838   pc_mouse_set_serial_port( device_list_find_by_tag( machine->config->devicelist, NS16450, "ns16450_0" ) );
513839}
514840
src/mess/machine/amstrad.c
r2942r2943
135135   AmstradCPC_SetUpperRom(machine, pSnapshot[0x055]);
136136
137137   /* PPI */
138   ppi8255_w(0,3,pSnapshot[0x059] & 0x0ff);
138   ppi8255_w((device_config*)device_list_find_by_tag( machine->config->devicelist, PPI8255, "ppi8255" ),3,pSnapshot[0x059] & 0x0ff);
139139
140   ppi8255_w(0,0,pSnapshot[0x056] & 0x0ff);
141   ppi8255_w(0,1,pSnapshot[0x057] & 0x0ff);
142   ppi8255_w(0,2,pSnapshot[0x058] & 0x0ff);
140   ppi8255_w((device_config*)device_list_find_by_tag( machine->config->devicelist, PPI8255, "ppi8255" ),0,pSnapshot[0x056] & 0x0ff);
141   ppi8255_w((device_config*)device_list_find_by_tag( machine->config->devicelist, PPI8255, "ppi8255" ),1,pSnapshot[0x057] & 0x0ff);
142   ppi8255_w((device_config*)device_list_find_by_tag( machine->config->devicelist, PPI8255, "ppi8255" ),2,pSnapshot[0x058] & 0x0ff);
143143
144144   /* PSG */
145145   for (i=0; i<16; i++)
src/mess/machine/tandy1t.c
r2942r2943
33#include "machine/pckeybrd.h"
44
55#include "machine/pcshare.h"
6#include "includes/pc.h"
67#include "machine/pit8253.h"
7#include "audio/pc.h"
88#include "includes/tandy1t.h"
99
1010
r2942r2943
185185   case 1:
186186      tandy_ppi.portb = data;
187187      pit8253_gate_w( (device_config*)device_list_find_by_tag( machine->config->devicelist, PIT8253, "pit8253" ), 2, data & 1);
188      pc_sh_speaker(machine, data&3);
188      pc_speaker_set_spkrdata( data & 0x02 );
189189      pc_keyb_set_clock(data&0x40);
190190      if ( data & 0x80 ) {
191191         pc_keyb_clear();
src/mess/machine/amstr_pc.c
r2942r2943
44#include "machine/pcshare.h"
55#include "includes/amstr_pc.h"
66#include "includes/pclpt.h"
7#include "includes/pc.h"
78#include "video/pc_vga.h"
89#include "memconv.h"
9#include "audio/pc.h"
1010
1111
1212/* pc20 (v2)
r2942r2943
155155      if (data==0x30) pc1640.port62=(pc1640.port65&0x10)>>4;
156156      else if (data==0x34) pc1640.port62=pc1640.port65&0xf;
157157      pit8253_gate_w( (device_config*)device_list_find_by_tag( machine->config->devicelist, PIT8253, "pit8253" ), 2, data & 1);
158      pc_sh_speaker(machine, data&3);
158      pc_speaker_set_spkrdata( data & 0x02 );
159159      pc_keyb_set_clock(data&0x40);
160160      break;
161161   case 4:
src/mess/machine/compis.c
r2942r2943
477477{
478478   {
479479      /* Timer0 */
480      {4770000/4, NULL, NULL },
480      {4770000/4, NULL },
481481      /* Timer1 */
482      {4770000/4, NULL, NULL },
482      {4770000/4, NULL },
483483      /* Timer2 */
484      {4770000/4, NULL, NULL }
484      {4770000/4, NULL }
485485   }
486486};
487487
r2942r2943
489489{
490490   {
491491      /* Timer0 */
492      {4770000/4, NULL, NULL },
492      {4770000/4, NULL },
493493      /* Timer1 */
494      {4770000/4, NULL, NULL },
494      {4770000/4, NULL },
495495      /* Timer2 */
496      {4770000/4, NULL, NULL }
496      {4770000/4, NULL }
497497   }
498498};
499499
src/mess/machine/mz700.c
r2942r2943
1616#include "cpu/z80/z80.h"
1717#include "machine/pit8253.h"
1818#include "machine/8255ppi.h"
19#include "sound/beep.h"
19#include "sound/speaker.h"
2020
2121#include "includes/mz700.h"
2222
r2942r2943
5757static int pio_port_a_output;
5858static int pio_port_c_output;
5959
60static PIT8253_FREQUENCY_CHANGED( pit_clk_0 );
61static PIT8253_FREQUENCY_CHANGED( pit_clk_1 );
60static PIT8253_OUTPUT_CHANGED( pit_out0_changed );
61static PIT8253_OUTPUT_CHANGED( pit_out1_changed );
6262static PIT8253_OUTPUT_CHANGED( pit_irq_2 );
6363
6464const struct pit8253_config mz700_pit8253_config =
6565{
6666   {
67      /* clockin     irq callback    clock change callback */
68      { 1108800.0,  NULL,        pit_clk_0    },
69      {   15611.0,  NULL,        pit_clk_1    },
70      {      1.0,  pit_irq_2,    NULL       },
67      /* clockin     irq callback     */
68      { 1108800.0,  pit_out0_changed },
69      {   15611.0,  pit_out1_changed },
70      {        0,  pit_irq_2        },
7171   }
7272};
7373
r2942r2943
103103
104104/************************ PIT ************************************************/
105105
106/* timer 0 is the clock for the speaker output */
107static PIT8253_FREQUENCY_CHANGED( pit_clk_0 )
106/* Timer 0 is the clock for the speaker output */
107static PIT8253_OUTPUT_CHANGED( pit_out0_changed )
108108{
109   beep_set_state(0, 1);
110    beep_set_frequency(0, frequency);
109   speaker_level_w( 0, state ? 1 : 0 );
111110}
112111
113/* timer 1 is the clock for timer 2 clock input */
114static PIT8253_FREQUENCY_CHANGED( pit_clk_1 )
112
113/* Timer 1 is the clock for timer 2 clock input */
114static PIT8253_OUTPUT_CHANGED( pit_out1_changed )
115115{
116   pit8253_set_clockin(0, 2, frequency);
116   pit8253_set_clock_signal( device, 2, state );
117117}
118118
119
119120/* timer 2 is the AM/PM (12 hour) interrupt */
120121static PIT8253_OUTPUT_CHANGED( pit_irq_2 )
121122{
src/mess/machine/ibmpc.c
r2942r2943
55#include "machine/pit8253.h"
66
77#include "machine/pcshare.h"
8#include "audio/pc.h"
98
109#define VERBOSE_PIO 0      /* PIO (keyboard controller) */
1110
src/mess/machine/bebox.c
r2942r2943
789789   {
790790      {
791791         4772720/4,            /* heartbeat IRQ */
792         bebox_timer0_w,
793         NULL
792         bebox_timer0_w
794793      },
795794      {
796795         4772720/4,            /* dram refresh */
797         NULL,
798796         NULL
799797      },
800798      {
801799         4772720/4,            /* pio port c pin 4, and speaker polling enough */
802         NULL,
803800         NULL
804801      }
805802   }
src/mess/machine/special.c
r2942r2943
204204   memset(mess_ram,0,128*1024);
205205}
206206
207static PIT8253_OUTPUT_CHANGED(specimx_pit8253_out0_changed)
208{
209   specimx_set_input( 0, state );
210}
211
212
213
214static PIT8253_OUTPUT_CHANGED(specimx_pit8253_out1_changed)
215{
216   specimx_set_input( 1, state );
217}
218
219
220
221static PIT8253_OUTPUT_CHANGED(specimx_pit8253_out2_changed)
222{
223   specimx_set_input( 2, state );
224}
225
226
227
207228const struct pit8253_config specimx_pit8253_intf =
208229{
209230   {
210231      {
211232         2000000,
212         NULL,
213         NULL
233         specimx_pit8253_out0_changed
214234      },
215235      {
216236         2000000,
217         NULL,
218         NULL
237         specimx_pit8253_out1_changed
219238      },
220239      {
221240         2000000,
222         NULL,
223         NULL
241         specimx_pit8253_out2_changed
224242      }
225243   }
226244};
src/mess/machine/pc.c
r2942r2943
4444#include "includes/ibmpc.h"
4545#include "machine/pcshare.h"
4646#include "devices/cassette.h"
47#include "audio/pc.h"
47#include "sound/speaker.h"
4848
4949#include "machine/8237dma.h"
5050
r2942r2943
5858   const device_config   *pic8259_master;
5959   const device_config   *pic8259_slave;
6060   const device_config   *dma8237;
61   const device_config   *pit8253;
6162} pc_devices;
6263
6364/*************************************************************************
r2942r2943
147148}
148149
149150
150const struct dma8237_interface pc_dma8237_config =
151const struct dma8237_interface ibm5150_dma8237_config =
151152{
152153   0,
153154   1.0e-6, // 1us
r2942r2943
179180}
180181
181182
182const struct pic8259_interface pc_pic8259_master_config =
183const struct pic8259_interface ibm5150_pic8259_master_config =
183184{
184185   pc_pic8259_master_set_int_line
185186};
186187
187188
188const struct pic8259_interface pc_pic8259_slave_config =
189const struct pic8259_interface ibm5150_pic8259_slave_config =
189190{
190191   pc_pic8259_slave_set_int_line
191192};
r2942r2943
234235};
235236
236237
238/*************************************************************************
239 *
240 *      PC Speaker related
241 *
242 *************************************************************************/
243
244static UINT8 pc_spkrdata = 0;
245static UINT8 pc_input = 0;
246
247UINT8 pc_speaker_get_spk(void)
248{
249   return pc_spkrdata & pc_input;
250}
251
252
253void pc_speaker_set_spkrdata(UINT8 data)
254{
255   pc_spkrdata = data ? 1 : 0;
256   speaker_level_w( 0, pc_speaker_get_spk() );
257}
258
259
260void pc_speaker_set_input(UINT8 data)
261{
262   pc_input = data ? 1 : 0;
263   speaker_level_w( 0, pc_speaker_get_spk() );
264}
265
266
237267/*************************************************************
238268 *
239269 * pit8253 configuration
240270 *
241271 *************************************************************/
242272
243static PIT8253_OUTPUT_CHANGED( pc_timer0_w )
273static PIT8253_OUTPUT_CHANGED( ibm5150_timer0_w )
244274{
245275   pic8259_set_irq_line(pc_devices.pic8259_master, 0, state);
246276}
247277 
248278
249const struct pit8253_config pc_pit8253_config =
279static PIT8253_OUTPUT_CHANGED( ibm5150_pit8253_out1_changed )
250280{
281   /* Trigger DMA channel #0 */
282}
283
284
285static PIT8253_OUTPUT_CHANGED( ibm5150_pit8253_out2_changed )
286{
287   pc_speaker_set_input( state );
288}
289
290
291const struct pit8253_config ibm5150_pit8253_config =
292{
251293   {
252294      {
253295         4772720/4,            /* heartbeat IRQ */
254         pc_timer0_w,
255         NULL
296         ibm5150_timer0_w
256297      }, {
257298         4772720/4,            /* dram refresh */
258         NULL,
259         NULL
299         ibm5150_pit8253_out1_changed
260300      }, {
261301         4772720/4,            /* pio port c pin 4, and speaker polling enough */
262         NULL,
263         pc_sh_speaker_change_clock
302         ibm5150_pit8253_out2_changed
264303      }
265304   }
266305};
r2942r2943
277316   {
278317      {
279318         4772720/4,              /* heartbeat IRQ */
280         pc_timer0_w,
281         NULL
319         ibm5150_timer0_w
282320      }, {
283321         4772720/4,              /* dram refresh */
284         NULL,
285322         NULL
286323      }, {
287324         4772720/4,              /* pio port c pin 4, and speaker polling enough */
288         NULL,
289         NULL               /* TIMER AUDIO signal */
325         ibm5150_pit8253_out2_changed
290326      }
291327   }
292328};
r2942r2943
324360
325361/* PC interface to PC-com hardware. Done this way because PCW16 also
326362uses PC-com hardware and doesn't have the same setup! */
327const ins8250_interface ibmpc_com_interface[4]=
363const ins8250_interface ibm5150_com_interface[4]=
328364{
329365   {
330366      1843200,
r2942r2943
544580 *
545581 * PPI8255 interface
546582 *
583 *
584 * PORT A (input)
585 *
586 * Directly attached to shift register which stores data
587 * received from the keyboard.
588 *
589 * PORT B (output)
590 * 0 - PB0 - TIM2GATESPK - Enable/disable counting on timer 2 of the 8253
591 * 1 - PB1 - SPKRDATA    - Speaker data
592 * 2 - PB2 -             - Enable receiving data from the keyboard when keyboard is not locked.
593 * 3 - PB3 -             - Dipsswitch set selector
594 * 4 - PB4 - ENBRAMPCK   - Enable ram parity check
595 * 5 - PB5 - ENABLEI/OCK - Enable expansion I/O check
596 * 6 - PB6 -             - Connected to keyboard clock signal
597 * 7 - PB7 -             - Clear/disable shift register and IRQ1 line
598 *
599 * PORT C
600 * 0 - PC0 -         - Dipswitch 0/4
601 * 1 - PC1 -         - Dipswitch 1/5
602 * 2 - PC2 -         - Dipswitch 2/6
603 * 3 - PC3 -         - Dipswitch 3/7
604 * 4 - PC4 - SPK     - Speaker/cassette data
605 * 5 - PC5 - I/OCHCK - Expansion I/O check result
606 * 6 - PC6 - T/C2OUT - Output of 8253 timer 2
607 * 7 - PC7 - PCK     - Parity check result
608 *
547609 **********************************************************/
548610
549611static struct {
r2942r2943
597659
598660static READ8_HANDLER ( pc_ppi_portc_r )
599661{
600   int timer2_output = pit8253_get_output( device_list_find_by_tag( machine->config->devicelist, PIT8253, "pit8253" ), 2 );
662   int timer2_output = pit8253_get_output( pc_devices.pit8253, 2 );
601663   int data=0xff;
602664
603665   data&=~0x80; // no parity error
r2942r2943
657719   pc_ppi.portc_switch_high = data & 0x08;
658720   pc_ppi.keyboard_disabled = data & 0x80;
659721   pc_ppi.keyb_clock = data & 0x40;
660   pit8253_gate_w( device_list_find_by_tag( machine->config->devicelist, PIT8253, "pit8253" ), 2, data & 1);
661   pc_sh_speaker(machine, data & 0x03);
722   pit8253_gate_w( pc_devices.pit8253, 2, data & 1);
723   pc_speaker_set_spkrdata( data & 0x02 );
662724   pc_keyb_set_clock( pc_ppi.keyb_clock );
663725
664726   cassette_change_state( image_from_devtype_and_index( IO_CASSETTE, 0 ), ( data & 0x08 ) ? CASSETTE_MOTOR_DISABLED : CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR);
r2942r2943
675737}
676738
677739
678/* PC-XT has a 8255 which is connected to keyboard and other
740/* IBM PC has a 8255 which is connected to keyboard and other
679741status information */
680const ppi8255_interface pc_ppi8255_interface =
742const ppi8255_interface ibm5150_ppi8255_interface =
681743{
682744   pc_ppi_porta_r,
683745   pc_ppi_portb_r,
r2942r2943
688750};
689751
690752
753static READ8_HANDLER ( ibm5160_ppi_portc_r )
754{
755   int timer2_output = pit8253_get_output( pc_devices.pit8253, 2 );
756   int data=0xff;
757
758   data&=~0x80; // no parity error
759   data&=~0x40; // no error on expansion board
760   /* KB port C: equipment flags */
761//   if (pc_port[0x61] & 0x08)
762   if (pc_ppi.portc_switch_high)
763   {
764      /* read hi nibble of S2 */
765      data = (data & 0xf0) | ((input_port_read(machine, "DSW0") >> 4) & 0x0f);
766      PIO_LOG(1,"PIO_C_r (hi)",("$%02x\n", data));
767   }
768   else
769   {
770      /* read lo nibble of S2 */
771      data = (data & 0xf0) | (input_port_read(machine, "DSW0") & 0x0f);
772      PIO_LOG(1,"PIO_C_r (lo)",("$%02x\n", data));
773   }
774
775   if ( pc_ppi.portb & 0x01 )
776   {
777      data = ( data & ~0x10 ) | ( timer2_output ? 0x10 : 0x00 );
778   }
779   data = ( data & ~0x20 ) | ( timer2_output ? 0x20 : 0x00 );
780
781   return data;
782}
783
784
785static WRITE8_HANDLER( ibm5160_ppi_portb_w )
786{
787   pc_ppi.portb = data;
788   pc_ppi.portc_switch_high = data & 0x08;
789   pc_ppi.keyboard_disabled = data & 0x80;
790   pc_ppi.keyb_clock = data & 0x40;
791   pit8253_gate_w( pc_devices.pit8253, 2, data & 0x01 );
792   pc_speaker_set_spkrdata( data & 0x02 );
793   pc_keyb_set_clock( pc_ppi.keyb_clock );
794
795   if ( data & 0x80 )
796      pc_keyb_clear();
797}
798
799
800const ppi8255_interface ibm5160_ppi8255_interface =
801{
802   pc_ppi_porta_r,
803   pc_ppi_portb_r,
804   ibm5160_ppi_portc_r,
805   pc_ppi_porta_w,
806   ibm5160_ppi_portb_w,
807   pc_ppi_portc_w
808};
809
810
691811static WRITE8_HANDLER ( pcjr_ppi_portb_w )
692812{
693813   /* KB controller port B */
694814   pc_ppi.portb = data;
695815   pc_ppi.portc_switch_high = data & 0x08;
696816   pit8253_gate_w( device_list_find_by_tag( machine->config->devicelist, PIT8253, "pit8253" ), 2, data & 1);
697   pc_sh_speaker(machine, data & 0x03);
817   pc_speaker_set_spkrdata( data & 0x02 );
698818
699819   cassette_change_state( image_from_devtype_and_index( IO_CASSETTE, 0 ), ( data & 0x08 ) ? CASSETTE_MOTOR_DISABLED : CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR);
700820}
r2942r2943
807927   pc_set_irq_line( 1, state );
808928}
809929
930
931/**********************************************************
932 *
933 * Initialization code
934 *
935 **********************************************************/
936
810937void mess_init_pc_common(running_machine *machine, UINT32 flags, void (*set_keyb_int_func)(int), void (*set_hdc_int_func)(int,int))
811938{
812939   init_pc_common(machine, flags, set_keyb_int_func);
r2942r2943
10181145   pc_devices.pic8259_master = device_list_find_by_tag( machine->config->devicelist, PIC8259, "pic8259_master" );
10191146   pc_devices.pic8259_slave = device_list_find_by_tag( machine->config->devicelist, PIC8259, "pic8259_slave" );
10201147   pc_devices.dma8237 = device_list_find_by_tag( machine->config->devicelist, DMA8237, "dma8237" );
1148   pc_devices.pit8253 = device_list_find_by_tag( machine->config->devicelist, PIT8253, "pit8253" );
10211149   pc_mouse_set_serial_port( device_list_find_by_tag( machine->config->devicelist, INS8250, "ins8250_0" ) );
10221150   pc_hdc_set_dma8237_device( pc_devices.dma8237 );
1151   speaker_level_w( 0, 0 );
10231152}
10241153
10251154
src/mess/mess.mak
r2942r2943
7676#CPUS += N7751
7777#CPUS += MB8884
7878#CPUS += M58715
79#CPUS += I8X41
80#CPUS += I8051
79CPUS += I8X41
80CPUS += I8051
8181#CPUS += I8052
8282#CPUS += I8751
8383#CPUS += I8752
src/mess/drivers/mz700.c
r2942r2943
286286   MDRV_SPEAKER_STANDARD_MONO("mono")
287287   MDRV_SOUND_ADD(WAVE, 0)
288288   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
289   MDRV_SOUND_ADD(BEEP, 0)
289   MDRV_SOUND_ADD(SPEAKER, 0)
290290   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
291291MACHINE_DRIVER_END
292292
r2942r2943
321321   MDRV_SPEAKER_STANDARD_MONO("mono")
322322   MDRV_SOUND_ADD(WAVE, 0)
323323   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
324   MDRV_SOUND_ADD(BEEP, 0)
324   MDRV_SOUND_ADD(SPEAKER, 0)
325325   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
326326MACHINE_DRIVER_END
327327
src/mess/drivers/pasogo.c
r2942r2943
413413   {
414414      {
415415         4772720/4,            /* heartbeat IRQ */
416         pc_timer0_w,
417         NULL
416         pc_timer0_w
418417      }, {
419418         4772720/4,            /* dram refresh */
420         NULL,
421419         NULL
422420      }, {
423421         4772720/4,            /* pio port c pin 4, and speaker polling enough */
424         NULL,
425         //      pc_sh_speaker_change_clock
422         NULL
426423      }
427424   }
428425};
src/mess/drivers/ip22.c
r2942r2943
8383   {
8484      {
8585         1000000,            /* Timer 0: 1MHz */
86         NULL,
8786         NULL
8887      }, {
8988         1000000,            /* Timer 1: 1MHz */
90         NULL,
9189         NULL
9290      }, {
9391         1000000,            /* Timer 2: 1MHz */
94         NULL,
9592         NULL
9693      }
9794   }
src/mess/drivers/bw2.c
r2942r2943
529529   {
530530      {
531531         XTAL_4MHz,   /* 8251 USART TXC, RXC */
532         bw2_timer0_w,
533         NULL
532         bw2_timer0_w
534533      },
535534      {
536535         11000,      /* LCD controller */
537         NULL,
538536         NULL
539537      },
540538      {
541539         3,      /* Floppy /MTRON */
542         bw2_timer2_w,
543         NULL
540         bw2_timer2_w
544541      }
545542   }
546543};
src/mess/drivers/at.c
r2942r2943
3434#include "includes/ps2.h"
3535
3636#include "machine/pcshare.h"
37#include "audio/pc.h"
3837
3938#include "devices/mflopimg.h"
4039#include "devices/harddriv.h"
r2942r2943
4645/* window resizing with dirtybuffering traping in xmess window */
4746
4847#define ym3812_StdClock 3579545
49#define AT_PIT8254   "at_pit8254"
5048
5149/*
5250  adlib (YM3812/OPL2 chip), part of many many soundcards (soundblaster)
r2942r2943
7775   AM_RANGE(0x0c8000, 0x0cffff) AM_ROM
7876   AM_RANGE(0x0d0000, 0x0effff) AM_RAM
7977   AM_RANGE(0x0f0000, 0x0fffff) AM_ROM
78   AM_RANGE(0xff0000, 0xffffff) AM_ROM AM_REGION(REGION_CPU1, 0x0f0000)
8079ADDRESS_MAP_END
8180
8281
r2942r2943
133132static ADDRESS_MAP_START(at16_io, ADDRESS_SPACE_IO, 16)
134133   AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE8(DMA8237, "dma8237_1", dma8237_r, dma8237_w, 0xffff)
135134   AM_RANGE(0x0020, 0x003f) AM_DEVREADWRITE8(PIC8259, "pic8259_master", pic8259_r, pic8259_w, 0xffff)
136   AM_RANGE(0x0040, 0x005f) AM_DEVREADWRITE8(PIT8254, AT_PIT8254, pit8253_r, pit8253_w, 0xffff)
137   AM_RANGE(0x0060, 0x006f) AM_READWRITE8(kbdc8042_8_r,             kbdc8042_8_w, 0xffff)
135   AM_RANGE(0x0040, 0x005f) AM_DEVREADWRITE8(PIT8254, "pit8254", pit8253_r, pit8253_w, 0xffff)
136   AM_RANGE(0x0060, 0x006f) AM_READWRITE8(at_kbdc8042_r,            at_kbdc8042_w, 0xffff)
138137   AM_RANGE(0x0070, 0x007f) AM_READWRITE8(mc146818_port_r,          mc146818_port_w, 0xffff)
139138   AM_RANGE(0x0080, 0x009f) AM_READWRITE8(at_page8_r,               at_page8_w, 0xffff)
140139   AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE8(PIC8259, "pic8259_slave", pic8259_r, pic8259_w, 0xffff)
r2942r2943
145144   AM_RANGE(0x0278, 0x027f) AM_READWRITE8(pc_parallelport2_r,       pc_parallelport2_w, 0xffff)
146145   AM_RANGE(0x02e8, 0x02ef) AM_DEVREADWRITE8(NS16450, "ns16450_3", ins8250_r, ins8250_w, 0xffff)
147146   AM_RANGE(0x02f8, 0x02ff) AM_DEVREADWRITE8(NS16450, "ns16450_1", ins8250_r, ins8250_w, 0xffff)
148   AM_RANGE(0x0320, 0x0323) AM_READWRITE8(pc_HDC1_r,                pc_HDC1_w, 0xffff)
149   AM_RANGE(0x0324, 0x0327) AM_READWRITE8(pc_HDC2_r,                pc_HDC2_w, 0xffff)
147//   AM_RANGE(0x0320, 0x0323) AM_READWRITE8(pc_HDC1_r,                pc_HDC1_w, 0xffff)
148//   AM_RANGE(0x0324, 0x0327) AM_READWRITE8(pc_HDC2_r,                pc_HDC2_w, 0xffff)
150149   AM_RANGE(0x0378, 0x037f) AM_READWRITE8(pc_parallelport1_r,       pc_parallelport1_w, 0xffff)
151150#ifdef ADLIB
152151   AM_RANGE(0x0388, 0x0389) AM_READWRITE8(at_adlib_r,               at_adlib_w, 0xffff)
r2942r2943
161160static ADDRESS_MAP_START(at386_io, ADDRESS_SPACE_IO, 32)
162161   AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE8(DMA8237, "dma8237_1", dma8237_r, dma8237_w, 0xffffffff)
163162   AM_RANGE(0x0020, 0x003f) AM_DEVREADWRITE8(PIC8259, "pic8259_master", pic8259_r, pic8259_w, 0xffffffff)
164   AM_RANGE(0x0040, 0x005f) AM_DEVREADWRITE8(PIT8254, AT_PIT8254, pit8253_r, pit8253_w, 0xffffffff)
163   AM_RANGE(0x0040, 0x005f) AM_DEVREADWRITE8(PIT8254, "pit8254", pit8253_r, pit8253_w, 0xffffffff)
165164   AM_RANGE(0x0060, 0x006f) AM_READWRITE(kbdc8042_32le_r,         kbdc8042_32le_w)
166165   AM_RANGE(0x0070, 0x007f) AM_READWRITE(mc146818_port32le_r,      mc146818_port32le_w)
167166   AM_RANGE(0x0080, 0x009f) AM_READWRITE8(at_page8_r,            at_page8_w, 0xffffffff)
r2942r2943
183182static ADDRESS_MAP_START(at586_io, ADDRESS_SPACE_IO, 32)
184183   AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE8(DMA8237, "dma8237_1", dma8237_r, dma8237_w, 0xffffffff)
185184   AM_RANGE(0x0020, 0x003f) AM_DEVREADWRITE8(PIC8259, "pic8259_master", pic8259_r, pic8259_w, 0xffffffff)
186   AM_RANGE(0x0040, 0x005f) AM_DEVREADWRITE8(PIT8254, AT_PIT8254, pit8253_r, pit8253_w, 0xffffffff)
185   AM_RANGE(0x0040, 0x005f) AM_DEVREADWRITE8(PIT8254, "pit8254", pit8253_r, pit8253_w, 0xffffffff)
187186   AM_RANGE(0x0060, 0x006f) AM_READWRITE(kbdc8042_32le_r,         kbdc8042_32le_w)
188187   AM_RANGE(0x0070, 0x007f) AM_READWRITE(mc146818_port32le_r,      mc146818_port32le_w)
189188   AM_RANGE(0x0080, 0x009f) AM_READWRITE8(at_page8_r,            at_page8_w, 0xffffffff)
r2942r2943
417416
418417static MACHINE_DRIVER_START( ibm5170 )
419418   /* basic machine hardware */
420   MDRV_CPU_ATPC(at16, at16, I80286, 12000000 /*6000000*/)
419   MDRV_CPU_ATPC(at16, at16, I80286, 6000000 /*6000000*/)
421420
422   MDRV_DEVICE_ADD( AT_PIT8254, PIT8254 )
421   MDRV_INTERLEAVE(1)
422
423   MDRV_DEVICE_ADD( "pit8254", PIT8254 )
423424   MDRV_DEVICE_CONFIG( at_pit8254_config )
424425
425426   MDRV_DEVICE_ADD( "dma8237_1", DMA8237 )
r2942r2943
453454
454455   /* sound hardware */
455456   MDRV_SPEAKER_STANDARD_MONO("mono")
456   MDRV_SOUND_ADD(CUSTOM, 0)
457   MDRV_SOUND_CONFIG(pc_sound_interface)
457   MDRV_SOUND_ADD(SPEAKER, 0)
458458   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
459459#ifdef ADLIB
460460   MDRV_SOUND_ADD(YM3812, ym3812_StdClock)
r2942r2943
467467   MDRV_SOUND_ADD(SAA1099, 8000000)
468468   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
469469#endif
470   MDRV_IMPORT_FROM( at_kbdc8042 )
470471
471472   MDRV_NVRAM_HANDLER( mc146818 )
472473
r2942r2943
482483   MDRV_CPU_REPLACE("main", I80286, 8000000)
483484MACHINE_DRIVER_END
484485
486
487static MACHINE_DRIVER_START( ibm5162 )
488   /* basic machine hardware */
489   MDRV_CPU_ATPC(at16, at16, I80286, 6000000 /*6000000*/)
490
491   MDRV_INTERLEAVE(1)
492
493   MDRV_DEVICE_ADD( "pit8254", PIT8254 )
494   MDRV_DEVICE_CONFIG( at_pit8254_config )
495
496   MDRV_DEVICE_ADD( "dma8237_1", DMA8237 )
497   MDRV_DEVICE_CONFIG( at_dma8237_1_config )
498
499   MDRV_DEVICE_ADD( "dma8237_2", DMA8237 )
500   MDRV_DEVICE_CONFIG( at_dma8237_2_config )
501
502   MDRV_DEVICE_ADD( "pic8259_master", PIC8259 )
503   MDRV_DEVICE_CONFIG( at_pic8259_master_config )
504
505   MDRV_DEVICE_ADD( "pic8259_slave", PIC8259 )
506   MDRV_DEVICE_CONFIG( at_pic8259_slave_config )
507
508   MDRV_DEVICE_ADD( "ns16450_0", NS16450 )         /* TODO: verify model */
509   MDRV_DEVICE_CONFIG( ibm5170_com_interface[0] )
510
511   MDRV_DEVICE_ADD( "ns16450_1", NS16450 )         /* TODO: verify model */
512   MDRV_DEVICE_CONFIG( ibm5170_com_interface[1] )
513
514   MDRV_DEVICE_ADD( "ns16450_2", NS16450 )         /* TODO: verify model */
515   MDRV_DEVICE_CONFIG( ibm5170_com_interface[2] )
516
517   MDRV_DEVICE_ADD( "ns16450_3", NS16450 )         /* TODO: verify model */
518   MDRV_DEVICE_CONFIG( ibm5170_com_interface[3] )
519
520   MDRV_MACHINE_START( at )
521   MDRV_MACHINE_RESET( at )
522
523   MDRV_IMPORT_FROM( pcvideo_cga )
524
525   /* sound hardware */
526   MDRV_SPEAKER_STANDARD_MONO("mono")
527   MDRV_SOUND_ADD(SPEAKER, 0)
528   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
529
530   MDRV_IMPORT_FROM( at_kbdc8042 )
531
532   MDRV_IMPORT_FROM( keytronic_keyboard )
533
534   MDRV_NVRAM_HANDLER( mc146818 )
535
536   /* printers */
537   MDRV_DEVICE_ADD("printer1", PRINTER)
538   MDRV_DEVICE_ADD("printer2", PRINTER)
539   MDRV_DEVICE_ADD("printer3", PRINTER)
540MACHINE_DRIVER_END
541
542
485543static MACHINE_DRIVER_START( ps2m30286 )
486544   /* basic machine hardware */
487545   MDRV_CPU_ATPC(at16, at16, I80286, 12000000)
488546
489   MDRV_DEVICE_ADD( AT_PIT8254, PIT8254 )
547   MDRV_DEVICE_ADD( "pit8254", PIT8254 )
490548   MDRV_DEVICE_CONFIG( at_pit8254_config )
491549
492550   MDRV_DEVICE_ADD( "dma8237_1", DMA8237 )
r2942r2943
524582
525583   /* sound hardware */
526584   MDRV_SPEAKER_STANDARD_MONO("mono")
527   MDRV_SOUND_ADD(CUSTOM, 0)
528   MDRV_SOUND_CONFIG(pc_sound_interface)
585   MDRV_SOUND_ADD(SPEAKER, 0)
529586   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
530587#ifdef ADLIB
531588   MDRV_SOUND_ADD(YM3812, ym3812_StdClock)
r2942r2943
552609   /* basic machine hardware */
553610   MDRV_CPU_ATPC(at16, at16, I80286, 12000000)
554611
555   MDRV_DEVICE_ADD( AT_PIT8254, PIT8254 )
612   MDRV_DEVICE_ADD( "pit8254", PIT8254 )
556613   MDRV_DEVICE_CONFIG( at_pit8254_config )
557614
558615   MDRV_DEVICE_ADD( "dma8237_1", DMA8237 )
r2942r2943
590647
591648   /* sound hardware */
592649   MDRV_SPEAKER_STANDARD_MONO("mono")
593   MDRV_SOUND_ADD(CUSTOM, 0)
594   MDRV_SOUND_CONFIG(pc_sound_interface)
650   MDRV_SOUND_ADD(SPEAKER, 0)
595651   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
596652#ifdef ADLIB
597653   MDRV_SOUND_ADD(YM3812, ym3812_StdClock)
r2942r2943
624680   MDRV_MACHINE_START( at )
625681   MDRV_MACHINE_RESET( at )
626682
627   MDRV_DEVICE_ADD( AT_PIT8254, PIT8254 )
683   MDRV_DEVICE_ADD( "pit8254", PIT8254 )
628684   MDRV_DEVICE_CONFIG( at_pit8254_config )
629685
630686   MDRV_DEVICE_ADD( "dma8237_1", DMA8237 )
r2942r2943
655711
656712   /* sound hardware */
657713   MDRV_SPEAKER_STANDARD_MONO("mono")
658   MDRV_SOUND_ADD(CUSTOM, 0)
659   MDRV_SOUND_CONFIG(pc_sound_interface)
714   MDRV_SOUND_ADD(SPEAKER, 0)
660715   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
661716#ifdef ADLIB
662717   MDRV_SOUND_ADD(YM3812, ym3812_StdClock)
r2942r2943
727782#endif
728783
729784ROM_START( ibm5170 )
730   ROM_REGION(0x1000000,REGION_CPU1, 0)
785   ROM_REGION(0x100000,REGION_CPU1, 0)
731786
732787   ROM_SYSTEM_BIOS( 0, "rev1", "IBM PC/AT 5170 01/10/84")
733788   ROMX_LOAD("t6181028.u27", 0xf0000, 0x8000, CRC(f6573f2a) SHA1(3e52cfa6a6a62b4e8576f4fe076c858c220e6c1a), ROM_SKIP(1) | ROM_BIOS(1))
734   ROMX_LOAD("t6181028.u27", 0xff0000, 0x8000, CRC(f6573f2a) SHA1(3e52cfa6a6a62b4e8576f4fe076c858c220e6c1a), ROM_SKIP(1) | ROM_BIOS(1))
735789   ROMX_LOAD("t6181029.u47", 0xf0001, 0x8000, CRC(7075fbb2) SHA1(a7b885cfd38710c9bc509da1e3ba9b543a2760be), ROM_SKIP(1) | ROM_BIOS(1))
736   ROMX_LOAD("t6181029.u47", 0xff0001, 0x8000, CRC(7075fbb2) SHA1(a7b885cfd38710c9bc509da1e3ba9b543a2760be), ROM_SKIP(1) | ROM_BIOS(1))
737790
738791   ROM_SYSTEM_BIOS( 1, "rev2", "IBM PC/AT 5170 06/10/85")   /* Another verifaction of these crcs would be nice */
739792   ROMX_LOAD("6480090.u27", 0xf0000, 0x8000, CRC(99703aa9) SHA1(18022e93a0412c8477e58f8c61a87718a0b9ab0e), ROM_SKIP(1) | ROM_BIOS(2))
740   ROMX_LOAD("6480090.u27", 0xff0000, 0x8000, CRC(99703aa9) SHA1(18022e93a0412c8477e58f8c61a87718a0b9ab0e), ROM_SKIP(1) | ROM_BIOS(2))
741793   ROMX_LOAD("6480091.u47", 0xf0001, 0x8000, CRC(013ef44b) SHA1(bfa15d2180a1902cb6d38c6eed3740f5617afd16), ROM_SKIP(1) | ROM_BIOS(2))
742   ROMX_LOAD("6480091.u47", 0xff0001, 0x8000, CRC(013ef44b) SHA1(bfa15d2180a1902cb6d38c6eed3740f5617afd16), ROM_SKIP(1) | ROM_BIOS(2))
743794
795   ROM_SYSTEM_BIOS( 2, "atdiag", "IBM PC/AT 5170 w/Super Diagnostics")
796   ROMX_LOAD("atdiage.bin", 0xf8000, 0x4000, CRC(e8855d0c) SHA1(c9d53e61c08da0a64f43d691bf6cadae5393843a), ROM_SKIP(1) | ROM_BIOS(3))
797   ROMX_LOAD("atdiago.bin", 0xf8001, 0x4000, CRC(606fa71d) SHA1(165e45bae7ae2da274f1e645c763c5bfcbde027b), ROM_SKIP(1) | ROM_BIOS(3))
798
744799   ROM_REGION(0x08100, REGION_GFX1, 0)
745800   ROM_LOAD("cga.chr",     0x00000, 0x01000, CRC(42009069) SHA1(ed08559ce2d7f97f68b9f540bddad5b6295294dd))
746801
r2942r2943
749804   /* This region holds the original EGA Video bios */
750805   ROM_REGION(0x4000, REGION_USER1, 0)
751806   ROM_LOAD("6277356.u44", 0x0000, 0x4000, CRC(dc146448) SHA1(dc0794499b3e499c5777b3aa39554bbf0f2cc19b))
807
808   /* 8042 keyboard controller */
809   ROM_REGION( 0x0800, REGION_CPU2, 0 )
810   ROM_LOAD("1503033.bin", 0x0000, 0x0800, CRC(5a81c0d2) SHA1(0100f8789fb4de74706ae7f9473a12ec2b9bd729))
752811ROM_END
753812
754813
755814ROM_START( ibm5170a )
756   ROM_REGION(0x1000000,REGION_CPU1, 0)
815   ROM_REGION(0x100000,REGION_CPU1, 0)
757816//    ROM_LOAD("wdbios.rom",  0xc8000, 0x02000, CRC(8e9e2bd4) SHA1(601d7ceab282394ebab50763c267e915a6a2166a))
758817   ROM_LOAD16_BYTE("at111585.0", 0xf0000, 0x8000, CRC(4995be7a) SHA1(8e8e5c863ae3b8c55fd394e345d8cca48b6e575c))
759   ROM_RELOAD(0xff0000,0x8000)
760818   ROM_LOAD16_BYTE("at111585.1", 0xf0001, 0x8000, CRC(c32713e4) SHA1(22ed4e2be9f948682891e2fd056a97dbea01203c))
761   ROM_RELOAD(0xff0001,0x8000)
762819   ROM_REGION(0x08100, REGION_GFX1, 0)
763820   ROM_LOAD("cga.chr",     0x00000, 0x01000, CRC(42009069) SHA1(ed08559ce2d7f97f68b9f540bddad5b6295294dd))
764821
765822   /* This region holds the original EGA Video bios */
766823   ROM_REGION(0x4000, REGION_USER1, 0)
767824   ROM_LOAD("6277356.u44", 0x0000, 0x4000, CRC(dc146448) SHA1(dc0794499b3e499c5777b3aa39554bbf0f2cc19b))
825
826   /* 8042 keyboard controller */
827   ROM_REGION( 0x0800, REGION_CPU2, 0 )
828   ROM_LOAD("1503033.bin", 0x0000, 0x0800, CRC(5a81c0d2) SHA1(0100f8789fb4de74706ae7f9473a12ec2b9bd729))
768829ROM_END
769830
770831
832ROM_START( ibm5162 )
833   ROM_REGION16_LE(0x1000000,REGION_CPU1, 0)
834   ROM_LOAD("wdbios.rom",  0xc8000, 0x02000, CRC(8e9e2bd4) SHA1(601d7ceab282394ebab50763c267e915a6a2166a))
835
836   ROM_LOAD16_BYTE("78x7460.u34", 0xf0000, 0x8000, CRC(1db4bd8f) SHA1(7be669fbb998d8b4626fefa7cd1208d3b2a88c31))
837   ROM_LOAD16_BYTE("78x7461.u35", 0xf0001, 0x8000, CRC(be14b453) SHA1(ec7c10087dbd53f9c6d1174e8f14212e2aec1818))
838
839   /* Character rom */
840   ROM_REGION(0x2000,REGION_GFX1, 0)
841   ROM_LOAD("5788005.u33", 0x00000, 0x2000, CRC(0bf56d70) SHA1(c2a8b10808bf51a3c123ba3eb1e9dd608231916f))
842
843   /* 8042 keyboard controller */
844   ROM_REGION( 0x0800, REGION_CPU2, 0 )
845   ROM_LOAD("1503033.bin", 0x0000, 0x0800, CRC(5a81c0d2) SHA1(0100f8789fb4de74706ae7f9473a12ec2b9bd729))
846
847   /* 8051 keytronic keyboard controller */
848   ROM_REGION( 0x2000, REGION_CPU3, 0 )
849   ROM_LOAD("14166.bin", 0x0000, 0x2000, CRC(1aea1b53) SHA1(b75b6d4509036406052157bc34159f7039cdc72e))
850ROM_END
851
852
771853ROM_START( i8530286 )
772854    ROM_REGION(0x1000000,REGION_CPU1, 0)
773855    ROM_LOAD("wdbios.rom",  0xc8000, 0x02000, CRC(8e9e2bd4) SHA1(601d7ceab282394ebab50763c267e915a6a2166a))
r2942r2943
788870   ROM_RELOAD(0xff0000,0x8000)
789871   ROM_REGION(0x08100, REGION_GFX1, 0)
790872    ROM_LOAD("cga.chr",     0x00000, 0x01000, CRC(42009069) SHA1(ed08559ce2d7f97f68b9f540bddad5b6295294dd))
873
874   /* 8042 keyboard controller */
875   ROM_REGION( 0x0800, REGION_CPU2, 0 )
876   ROM_LOAD("1503033.bin", 0x0000, 0x0800, CRC(5a81c0d2) SHA1(0100f8789fb4de74706ae7f9473a12ec2b9bd729))
791877ROM_END
792878
793879
r2942r2943
893979/*     YEAR  NAME      PARENT   COMPAT   MACHINE    INPUT       INIT        CONFIG   COMPANY     FULLNAME */
894980COMP ( 1984, ibm5170,  0,       ibm5160, ibm5170,   atcga,      atega,       ibmat,   "International Business Machines",  "IBM PC/AT 5170", GAME_NOT_WORKING )
895981COMP ( 1985, ibm5170a, ibm5170, 0,       ibm5170a,  atcga,      atega,      ibmat,   "International Business Machines",  "IBM PC/AT 5170 8MHz", GAME_NOT_WORKING )
982COMP ( 1985, ibm5162,  ibm5170, 0,       ibm5162,   atcga,      atcga,      ibmat,   "International Business Machines",  "IBM PC/XT 5162", GAME_NOT_WORKING )
896983COMP ( 1988, i8530286, ibm5170, 0,       ps2m30286, atvga,      ps2m30286,   ibmat,   "International Business Machines",  "IBM PS2 Model 30 286", GAME_NOT_WORKING )
897984COMP ( 1987, at,       ibm5170, 0,       ibm5170a,  atcga,      atcga,       ibmat,   "",  "PC/AT (CGA, MF2 Keyboard)", GAME_NOT_WORKING )
898985COMP ( 1989, neat,     ibm5170, 0,       ibm5170a,  atcga,      atcga,       ibmat,   "",  "NEAT (CGA, MF2 Keyboard)", GAME_NOT_WORKING )
src/mess/drivers/pc.c
r2942r2943
22
33    drivers/pc.c
44
5Driver file for IBM PC, IBM PC XT, and related machines.
6
57    PC-XT memory map
68
79    00000-9FFFF   RAM
r2942r2943
1517    F0000-FDFFF   NOP       or ROM Basic + other Extensions
1618    FE000-FFFFF   ROM
1719
20IBM PC 5150
21===========
1822
23IBM PC-JR
24=========
25
26IBM PC-XT 5160
27==============
28
1929Tandy 1000 (8086/8088) variations:
20301000            128KB-640KB RAM      4.77 MHz      v01.00.00, v01.01.00
21311000A/1000HD      128KB-640KB RAM      4.77 MHz      v01.01.00
r2942r2943
7686#include "includes/ibmpc.h"
7787
7888#include "machine/pcshare.h"
79#include "audio/pc.h"
8089#include "includes/pc.h"
8190
8291#include "machine/pc_hdc.h"
r2942r2943
11961205   MDRV_MACHINE_RESET(pc)
11971206
11981207   MDRV_DEVICE_ADD( "pit8253", PIT8253 )
1199   MDRV_DEVICE_CONFIG( pc_pit8253_config )
1208   MDRV_DEVICE_CONFIG( ibm5150_pit8253_config )
12001209
12011210   MDRV_DEVICE_ADD( "dma8237", DMA8237 )
1202   MDRV_DEVICE_CONFIG( pc_dma8237_config )
1211   MDRV_DEVICE_CONFIG( ibm5150_dma8237_config )
12031212
12041213   MDRV_DEVICE_ADD( "pic8259_master", PIC8259 )
1205   MDRV_DEVICE_CONFIG( pc_pic8259_master_config )
1214   MDRV_DEVICE_CONFIG( ibm5150_pic8259_master_config )
12061215
12071216   MDRV_DEVICE_ADD( "pic8259_slave", PIC8259 )
1208   MDRV_DEVICE_CONFIG( pc_pic8259_slave_config )
1217   MDRV_DEVICE_CONFIG( ibm5150_pic8259_slave_config )
12091218
12101219   MDRV_DEVICE_ADD( "ppi8255", PPI8255 )
1211   MDRV_DEVICE_CONFIG( pc_ppi8255_interface )
1220   MDRV_DEVICE_CONFIG( ibm5150_ppi8255_interface )
12121221
12131222   MDRV_DEVICE_ADD( "ins8250_0", INS8250 )         /* TODO: Verify model */
1214   MDRV_DEVICE_CONFIG( ibmpc_com_interface[0] )
1223   MDRV_DEVICE_CONFIG( ibm5150_com_interface[0] )
12151224
12161225   MDRV_DEVICE_ADD( "ins8250_1", INS8250 )         /* TODO: Verify model */
1217   MDRV_DEVICE_CONFIG( ibmpc_com_interface[1] )
1226   MDRV_DEVICE_CONFIG( ibm5150_com_interface[1] )
12181227
12191228   MDRV_DEVICE_ADD( "ins8250_2", INS8250 )         /* TODO: Verify model */
1220   MDRV_DEVICE_CONFIG( ibmpc_com_interface[2] )
1229   MDRV_DEVICE_CONFIG( ibm5150_com_interface[2] )
12211230
12221231   MDRV_DEVICE_ADD( "ins8250_3", INS8250 )         /* TODO: Verify model */
1223   MDRV_DEVICE_CONFIG( ibmpc_com_interface[3] )
1232   MDRV_DEVICE_CONFIG( ibm5150_com_interface[3] )
12241233
12251234   /* video hardware */
12261235   MDRV_IMPORT_FROM( pcvideo_mda )
12271236
12281237    /* sound hardware */
12291238   MDRV_SPEAKER_STANDARD_MONO("mono")
1230   MDRV_SOUND_ADD(CUSTOM, 0)
1231   MDRV_SOUND_CONFIG(pc_sound_interface)
1239   MDRV_SOUND_ADD(SPEAKER, 0)
12321240   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
12331241#ifdef ADLIB
12341242   MDRV_SOUND_ADD(YM3812, ym3812_StdClock)
r2942r2943
12601268   MDRV_MACHINE_RESET(pc)
12611269
12621270   MDRV_DEVICE_ADD( "pit8253", PIT8253 )
1263   MDRV_DEVICE_CONFIG( pc_pit8253_config )
1271   MDRV_DEVICE_CONFIG( ibm5150_pit8253_config )
12641272
12651273   MDRV_DEVICE_ADD( "dma8237", DMA8237 )
1266   MDRV_DEVICE_CONFIG( pc_dma8237_config )
1274   MDRV_DEVICE_CONFIG( ibm5150_dma8237_config )
12671275
12681276   MDRV_DEVICE_ADD( "pic8259_master", PIC8259 )
1269   MDRV_DEVICE_CONFIG( pc_pic8259_master_config )
1277   MDRV_DEVICE_CONFIG( ibm5150_pic8259_master_config )
12701278
12711279   MDRV_DEVICE_ADD( "pic8259_slave", PIC8259 )
1272   MDRV_DEVICE_CONFIG( pc_pic8259_slave_config )
1280   MDRV_DEVICE_CONFIG( ibm5150_pic8259_slave_config )
12731281
12741282   MDRV_DEVICE_ADD( "ppi8255", PPI8255 )
1275   MDRV_DEVICE_CONFIG( pc_ppi8255_interface )
1283   MDRV_DEVICE_CONFIG( ibm5150_ppi8255_interface )
12761284
12771285   MDRV_DEVICE_ADD( "ins8250_0", INS8250 )         /* TODO: Verify model */
1278   MDRV_DEVICE_CONFIG( ibmpc_com_interface[0] )
1286   MDRV_DEVICE_CONFIG( ibm5150_com_interface[0] )
12791287
12801288   MDRV_DEVICE_ADD( "ins8250_1", INS8250 )         /* TODO: Verify model */
1281   MDRV_DEVICE_CONFIG( ibmpc_com_interface[1] )
1289   MDRV_DEVICE_CONFIG( ibm5150_com_interface[1] )
12821290
12831291   MDRV_DEVICE_ADD( "ins8250_2", INS8250 )         /* TODO: Verify model */
1284   MDRV_DEVICE_CONFIG( ibmpc_com_interface[2] )
1292   MDRV_DEVICE_CONFIG( ibm5150_com_interface[2] )
12851293
12861294   MDRV_DEVICE_ADD( "ins8250_3", INS8250 )         /* TODO: Verify model */
1287   MDRV_DEVICE_CONFIG( ibmpc_com_interface[3] )
1295   MDRV_DEVICE_CONFIG( ibm5150_com_interface[3] )
12881296
12891297   /* video hardware */
12901298   MDRV_IMPORT_FROM( pcvideo_hercules )
12911299
12921300   /* sound hardware */
12931301   MDRV_SPEAKER_STANDARD_MONO("mono")
1294   MDRV_SOUND_ADD(CUSTOM, 0)
1295   MDRV_SOUND_CONFIG(pc_sound_interface)
1302   MDRV_SOUND_ADD(SPEAKER, 0)
12961303   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
12971304#ifdef ADLIB
12981305   MDRV_SOUND_ADD(YM3812, ym3812_StdClock)
r2942r2943
13201327   MDRV_MACHINE_RESET(pc)
13211328
13221329   MDRV_DEVICE_ADD( "pit8253", PIT8253 )
1323   MDRV_DEVICE_CONFIG( pc_pit8253_config )
1330   MDRV_DEVICE_CONFIG( ibm5150_pit8253_config )
13241331
13251332   MDRV_DEVICE_ADD( "dma8237", DMA8237 )
1326   MDRV_DEVICE_CONFIG( pc_dma8237_config )
1333   MDRV_DEVICE_CONFIG( ibm5150_dma8237_config )
13271334
13281335   MDRV_DEVICE_ADD( "pic8259_master", PIC8259 )
1329   MDRV_DEVICE_CONFIG( pc_pic8259_master_config )
1336   MDRV_DEVICE_CONFIG( ibm5150_pic8259_master_config )
13301337
13311338   MDRV_DEVICE_ADD( "pic8259_slave", PIC8259 )
1332   MDRV_DEVICE_CONFIG( pc_pic8259_slave_config )
1339   MDRV_DEVICE_CONFIG( ibm5150_pic8259_slave_config )
13331340
13341341   MDRV_DEVICE_ADD( "ppi8255", PPI8255 )
1335   MDRV_DEVICE_CONFIG( pc_ppi8255_interface )
1342   MDRV_DEVICE_CONFIG( ibm5150_ppi8255_interface )
13361343
13371344   MDRV_DEVICE_ADD( "ins8250_0", INS8250 )         /* TODO: Verify model */
1338   MDRV_DEVICE_CONFIG( ibmpc_com_interface[0] )
1345   MDRV_DEVICE_CONFIG( ibm5150_com_interface[0] )
13391346
13401347   MDRV_DEVICE_ADD( "ins8250_1", INS8250 )         /* TODO: Verify model */
1341   MDRV_DEVICE_CONFIG( ibmpc_com_interface[1] )
1348   MDRV_DEVICE_CONFIG( ibm5150_com_interface[1] )
13421349
13431350   MDRV_DEVICE_ADD( "ins8250_2", INS8250 )         /* TODO: Verify model */
1344   MDRV_DEVICE_CONFIG( ibmpc_com_interface[2] )
1351   MDRV_DEVICE_CONFIG( ibm5150_com_interface[2] )
13451352
13461353   MDRV_DEVICE_ADD( "ins8250_3", INS8250 )         /* TODO: Verify model */
1347   MDRV_DEVICE_CONFIG( ibmpc_com_interface[3] )
1354   MDRV_DEVICE_CONFIG( ibm5150_com_interface[3] )
13481355
13491356   /* video hardware */
13501357   MDRV_IMPORT_FROM( pcvideo_cga )
13511358
13521359    /* sound hardware */
13531360   MDRV_SPEAKER_STANDARD_MONO("mono")
1354   MDRV_SOUND_ADD(CUSTOM, 0)
1355   MDRV_SOUND_CONFIG(pc_sound_interface)
1361   MDRV_SOUND_ADD(SPEAKER, 0)
13561362   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
13571363#ifdef ADLIB
13581364   MDRV_SOUND_ADD(YM3812, ym3812_StdClock)
r2942r2943
13811387   MDRV_MACHINE_RESET(pc)
13821388
13831389   MDRV_DEVICE_ADD( "pit8253", PIT8253 )
1384   MDRV_DEVICE_CONFIG( pc_pit8253_config )
1390   MDRV_DEVICE_CONFIG( ibm5150_pit8253_config )
13851391
13861392   MDRV_DEVICE_ADD( "dma8237", DMA8237 )
1387   MDRV_DEVICE_CONFIG( pc_dma8237_config )
1393   MDRV_DEVICE_CONFIG( ibm5150_dma8237_config )
13881394
13891395   MDRV_DEVICE_ADD( "pic8259_master", PIC8259 )
1390   MDRV_DEVICE_CONFIG( pc_pic8259_master_config )
1396   MDRV_DEVICE_CONFIG( ibm5150_pic8259_master_config )
13911397
13921398   MDRV_DEVICE_ADD( "pic8259_slave", PIC8259 )
1393   MDRV_DEVICE_CONFIG( pc_pic8259_slave_config )
1399   MDRV_DEVICE_CONFIG( ibm5150_pic8259_slave_config )
13941400
13951401   MDRV_DEVICE_ADD( "ppi8255", PPI8255 )
1396   MDRV_DEVICE_CONFIG( pc_ppi8255_interface )
1402   MDRV_DEVICE_CONFIG( ibm5150_ppi8255_interface )
13971403
13981404   MDRV_DEVICE_ADD( "ins8250_0", INS8250 )         /* TODO: Verify model */
1399   MDRV_DEVICE_CONFIG( ibmpc_com_interface[0] )
1405   MDRV_DEVICE_CONFIG( ibm5150_com_interface[0] )
14001406
14011407   MDRV_DEVICE_ADD( "ins8250_1", INS8250 )         /* TODO: Verify model */
1402   MDRV_DEVICE_CONFIG( ibmpc_com_interface[1] )
1408   MDRV_DEVICE_CONFIG( ibm5150_com_interface[1] )
14031409
14041410   MDRV_DEVICE_ADD( "ins8250_2", INS8250 )         /* TODO: Verify model */
1405   MDRV_DEVICE_CONFIG( ibmpc_com_interface[2] )
1411   MDRV_DEVICE_CONFIG( ibm5150_com_interface[2] )
14061412
14071413   MDRV_DEVICE_ADD( "ins8250_3", INS8250 )         /* TODO: Verify model */
1408   MDRV_DEVICE_CONFIG( ibmpc_com_interface[3] )
1414   MDRV_DEVICE_CONFIG( ibm5150_com_interface[3] )
14091415
14101416   /* video hardware */
14111417   MDRV_IMPORT_FROM( pcvideo_aga )
14121418
14131419    /* sound hardware */
14141420   MDRV_SPEAKER_STANDARD_MONO("mono")
1415   MDRV_SOUND_ADD(CUSTOM, 0)
1416   MDRV_SOUND_CONFIG(pc_sound_interface)
1421   MDRV_SOUND_ADD(SPEAKER, 0)
14171422   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
14181423#ifdef ADLIB
14191424   MDRV_SOUND_ADD(YM3812, ym3812_StdClock)
r2942r2943
14381443   MDRV_MACHINE_RESET(pc)
14391444
14401445   MDRV_DEVICE_ADD( "pit8253", PIT8253 )
1441   MDRV_DEVICE_CONFIG( pc_pit8253_config )
1446   MDRV_DEVICE_CONFIG( ibm5150_pit8253_config )
14421447
14431448   MDRV_DEVICE_ADD( "dma8237", DMA8237 )
1444   MDRV_DEVICE_CONFIG( pc_dma8237_config )
1449   MDRV_DEVICE_CONFIG( ibm5150_dma8237_config )
14451450
14461451   MDRV_DEVICE_ADD( "pic8259_master", PIC8259 )
1447   MDRV_DEVICE_CONFIG( pc_pic8259_master_config )
1452   MDRV_DEVICE_CONFIG( ibm5150_pic8259_master_config )
14481453
14491454   MDRV_DEVICE_ADD( "pic8259_slave", PIC8259 )
1450   MDRV_DEVICE_CONFIG( pc_pic8259_slave_config )
1455   MDRV_DEVICE_CONFIG( ibm5150_pic8259_slave_config )
14511456
14521457   MDRV_DEVICE_ADD( "ppi8255", PPI8255 )
1453   MDRV_DEVICE_CONFIG( pc_ppi8255_interface )
1458   MDRV_DEVICE_CONFIG( ibm5160_ppi8255_interface )
14541459
14551460   MDRV_DEVICE_ADD( "ins8250_0", INS8250 )         /* TODO: Verify model */
1456   MDRV_DEVICE_CONFIG( ibmpc_com_interface[0] )
1461   MDRV_DEVICE_CONFIG( ibm5150_com_interface[0] )
14571462
14581463   MDRV_DEVICE_ADD( "ins8250_1", INS8250 )         /* TODO: Verify model */
1459   MDRV_DEVICE_CONFIG( ibmpc_com_interface[1] )
1464   MDRV_DEVICE_CONFIG( ibm5150_com_interface[1] )
14601465
14611466   MDRV_DEVICE_ADD( "ins8250_2", INS8250 )         /* TODO: Verify model */
1462   MDRV_DEVICE_CONFIG( ibmpc_com_interface[2] )
1467   MDRV_DEVICE_CONFIG( ibm5150_com_interface[2] )
14631468
14641469   MDRV_DEVICE_ADD( "ins8250_3", INS8250 )         /* TODO: Verify model */
1465   MDRV_DEVICE_CONFIG( ibmpc_com_interface[3] )
1470   MDRV_DEVICE_CONFIG( ibm5150_com_interface[3] )
14661471
14671472   /* video hardware */
14681473   MDRV_IMPORT_FROM( pcvideo_cga )
14691474
14701475    /* sound hardware */
14711476   MDRV_SPEAKER_STANDARD_MONO("mono")
1472   MDRV_SOUND_ADD(CUSTOM, 0)
1473   MDRV_SOUND_CONFIG(pc_sound_interface)
1477   MDRV_SOUND_ADD(SPEAKER, 0)
14741478   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
14751479#ifdef ADLIB
14761480   MDRV_SOUND_ADD(YM3812, ym3812_StdClock)
r2942r2943
14991503   MDRV_MACHINE_RESET(pc)
15001504
15011505   MDRV_DEVICE_ADD( "pit8253", PIT8253 )
1502   MDRV_DEVICE_CONFIG( pc_pit8253_config )
1506   MDRV_DEVICE_CONFIG( ibm5150_pit8253_config )
15031507
15041508   MDRV_DEVICE_ADD( "dma8237", DMA8237 )
1505   MDRV_DEVICE_CONFIG( pc_dma8237_config )
1509   MDRV_DEVICE_CONFIG( ibm5150_dma8237_config )
15061510
15071511   MDRV_DEVICE_ADD( "pic8259_master", PIC8259 )
1508   MDRV_DEVICE_CONFIG( pc_pic8259_master_config )
1512   MDRV_DEVICE_CONFIG( ibm5150_pic8259_master_config )
15091513
15101514   MDRV_DEVICE_ADD( "pic8259_slave", PIC8259 )
1511   MDRV_DEVICE_CONFIG( pc_pic8259_slave_config )
1515   MDRV_DEVICE_CONFIG( ibm5150_pic8259_slave_config )
15121516
15131517   MDRV_DEVICE_ADD( "ppi8255", PPI8255 )
1514   MDRV_DEVICE_CONFIG( pc_ppi8255_interface )
1518   MDRV_DEVICE_CONFIG( ibm5150_ppi8255_interface )
15151519
15161520   MDRV_DEVICE_ADD( "ins8250_0", INS8250 )         /* TODO: Verify model */
1517   MDRV_DEVICE_CONFIG( ibmpc_com_interface[0] )
1521   MDRV_DEVICE_CONFIG( ibm5150_com_interface[0] )
15181522
15191523   MDRV_DEVICE_ADD( "ins8250_1", INS8250 )         /* TODO: Verify model */
1520   MDRV_DEVICE_CONFIG( ibmpc_com_interface[1] )
1524   MDRV_DEVICE_CONFIG( ibm5150_com_interface[1] )
15211525
15221526   MDRV_DEVICE_ADD( "ins8250_2", INS8250 )         /* TODO: Verify model */
1523   MDRV_DEVICE_CONFIG( ibmpc_com_interface[2] )
1527   MDRV_DEVICE_CONFIG( ibm5150_com_interface[2] )
15241528
15251529   MDRV_DEVICE_ADD( "ins8250_3", INS8250 )         /* TODO: Verify model */
1526   MDRV_DEVICE_CONFIG( ibmpc_com_interface[3] )
1530   MDRV_DEVICE_CONFIG( ibm5150_com_interface[3] )
15271531
15281532   /* video hardware */
15291533   MDRV_IMPORT_FROM( pcvideo_pc200 )
15301534
15311535    /* sound hardware */
15321536   MDRV_SPEAKER_STANDARD_MONO("mono")
1533   MDRV_SOUND_ADD(CUSTOM, 0)
1534   MDRV_SOUND_CONFIG(pc_sound_interface)
1537   MDRV_SOUND_ADD(SPEAKER, 0)
15351538   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
15361539
15371540   /* printer */
r2942r2943
15491552   MDRV_MACHINE_RESET(pc)
15501553
15511554   MDRV_DEVICE_ADD( "pit8253", PIT8253 )
1552   MDRV_DEVICE_CONFIG( pc_pit8253_config )
1555   MDRV_DEVICE_CONFIG( ibm5150_pit8253_config )
15531556
15541557   MDRV_DEVICE_ADD( "dma8237", DMA8237 )
1555   MDRV_DEVICE_CONFIG( pc_dma8237_config )
1558   MDRV_DEVICE_CONFIG( ibm5150_dma8237_config )
15561559
15571560   MDRV_DEVICE_ADD( "pic8259_master", PIC8259 )
1558   MDRV_DEVICE_CONFIG( pc_pic8259_master_config )
1561   MDRV_DEVICE_CONFIG( ibm5150_pic8259_master_config )
15591562
15601563   MDRV_DEVICE_ADD( "pic8259_slave", PIC8259 )
1561   MDRV_DEVICE_CONFIG( pc_pic8259_slave_config )
1564   MDRV_DEVICE_CONFIG( ibm5150_pic8259_slave_config )
15621565
15631566   MDRV_DEVICE_ADD( "ppi8255", PPI8255 )
1564   MDRV_DEVICE_CONFIG( pc_ppi8255_interface )
1567   MDRV_DEVICE_CONFIG( ibm5150_ppi8255_interface )
15651568
15661569   MDRV_DEVICE_ADD( "ins8250_0", INS8250 )         /* TODO: Verify model */
1567   MDRV_DEVICE_CONFIG( ibmpc_com_interface[0] )
1570   MDRV_DEVICE_CONFIG( ibm5150_com_interface[0] )
15681571
15691572   MDRV_DEVICE_ADD( "ins8250_1", INS8250 )         /* TODO: Verify model */
1570   MDRV_DEVICE_CONFIG( ibmpc_com_interface[1] )
1573   MDRV_DEVICE_CONFIG( ibm5150_com_interface[1] )
15711574
15721575   MDRV_DEVICE_ADD( "ins8250_2", INS8250 )         /* TODO: Verify model */
1573   MDRV_DEVICE_CONFIG( ibmpc_com_interface[2] )
1576   MDRV_DEVICE_CONFIG( ibm5150_com_interface[2] )
15741577
15751578   MDRV_DEVICE_ADD( "ins8250_3", INS8250 )         /* TODO: Verify model */
1576   MDRV_DEVICE_CONFIG( ibmpc_com_interface[3] )
1579   MDRV_DEVICE_CONFIG( ibm5150_com_interface[3] )
15771580
15781581   /* video hardware */
15791582   MDRV_IMPORT_FROM( pcvideo_pc1512 )
15801583
15811584    /* sound hardware */
15821585   MDRV_SPEAKER_STANDARD_MONO("mono")
1583   MDRV_SOUND_ADD(CUSTOM, 0)
1584   MDRV_SOUND_CONFIG(pc_sound_interface)
1586   MDRV_SOUND_ADD(SPEAKER, 0)
15851587   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
15861588
15871589   MDRV_NVRAM_HANDLER( mc146818 )
r2942r2943
16011603   MDRV_MACHINE_RESET(pc)
16021604
16031605   MDRV_DEVICE_ADD( "pit8253", PIT8253 )
1604   MDRV_DEVICE_CONFIG( pc_pit8253_config )
1606   MDRV_DEVICE_CONFIG( ibm5150_pit8253_config )
16051607
16061608   MDRV_DEVICE_ADD( "dma8237", DMA8237 )
1607   MDRV_DEVICE_CONFIG( pc_dma8237_config )
1609   MDRV_DEVICE_CONFIG( ibm5150_dma8237_config )
16081610
16091611   MDRV_DEVICE_ADD( "pic8259_master", PIC8259 )
1610   MDRV_DEVICE_CONFIG( pc_pic8259_master_config )
1612   MDRV_DEVICE_CONFIG( ibm5150_pic8259_master_config )
16111613
16121614   MDRV_DEVICE_ADD( "pic8259_slave", PIC8259 )
1613   MDRV_DEVICE_CONFIG( pc_pic8259_slave_config )
1615   MDRV_DEVICE_CONFIG( ibm5150_pic8259_slave_config )
16141616
16151617   MDRV_DEVICE_ADD( "ppi8255", PPI8255 )
1616   MDRV_DEVICE_CONFIG( pc_ppi8255_interface )
1618   MDRV_DEVICE_CONFIG( ibm5150_ppi8255_interface )
16171619
16181620   MDRV_DEVICE_ADD( "ins8250_0", INS8250 )         /* TODO: Verify model */
1619   MDRV_DEVICE_CONFIG( ibmpc_com_interface[0] )
1621   MDRV_DEVICE_CONFIG( ibm5150_com_interface[0] )
16201622
16211623   MDRV_DEVICE_ADD( "ins8250_1", INS8250 )         /* TODO: Verify model */
1622   MDRV_DEVICE_CONFIG( ibmpc_com_interface[1] )
1624   MDRV_DEVICE_CONFIG( ibm5150_com_interface[1] )
16231625
16241626   MDRV_DEVICE_ADD( "ins8250_2", INS8250 )         /* TODO: Verify model */
1625   MDRV_DEVICE_CONFIG( ibmpc_com_interface[2] )
1627   MDRV_DEVICE_CONFIG( ibm5150_com_interface[2] )
16261628
16271629   MDRV_DEVICE_ADD( "ins8250_3", INS8250 )         /* TODO: Verify model */
1628   MDRV_DEVICE_CONFIG( ibmpc_com_interface[3] )
1630   MDRV_DEVICE_CONFIG( ibm5150_com_interface[3] )
16291631
16301632   /* video hardware */
16311633   MDRV_IMPORT_FROM(pcvideo_pc1640)
r2942r2943
16351637
16361638    /* sound hardware */
16371639   MDRV_SPEAKER_STANDARD_MONO("mono")
1638   MDRV_SOUND_ADD(CUSTOM, 0)
1639   MDRV_SOUND_CONFIG(pc_sound_interface)
1640   MDRV_SOUND_ADD(SPEAKER, 0)
16401641   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
16411642
16421643   MDRV_NVRAM_HANDLER( mc146818 )
r2942r2943
16561657   MDRV_MACHINE_RESET(pc)
16571658
16581659   MDRV_DEVICE_ADD( "pit8253", PIT8253 )
1659   MDRV_DEVICE_CONFIG( pc_pit8253_config )
1660   MDRV_DEVICE_CONFIG( ibm5150_pit8253_config )
16601661
16611662   MDRV_DEVICE_ADD( "dma8237", DMA8237 )
1662   MDRV_DEVICE_CONFIG( pc_dma8237_config )
1663   MDRV_DEVICE_CONFIG( ibm5150_dma8237_config )
16631664
16641665   MDRV_DEVICE_ADD( "pic8259_master", PIC8259 )
1665   MDRV_DEVICE_CONFIG( pc_pic8259_master_config )
1666   MDRV_DEVICE_CONFIG( ibm5150_pic8259_master_config )
16661667
16671668   MDRV_DEVICE_ADD( "pic8259_slave", PIC8259 )
1668   MDRV_DEVICE_CONFIG( pc_pic8259_slave_config )
1669   MDRV_DEVICE_CONFIG( ibm5150_pic8259_slave_config )
16691670
16701671   MDRV_DEVICE_ADD( "ppi8255", PPI8255 )
1671   MDRV_DEVICE_CONFIG( pc_ppi8255_interface )
1672   MDRV_DEVICE_CONFIG( ibm5150_ppi8255_interface )
16721673
16731674   MDRV_DEVICE_ADD( "ins8250_0", INS8250 )         /* TODO: Verify model */
1674   MDRV_DEVICE_CONFIG( ibmpc_com_interface[0] )
1675   MDRV_DEVICE_CONFIG( ibm5150_com_interface[0] )
16751676
16761677   MDRV_DEVICE_ADD( "ins8250_1", INS8250 )         /* TODO: Verify model */
1677   MDRV_DEVICE_CONFIG( ibmpc_com_interface[1] )
1678   MDRV_DEVICE_CONFIG( ibm5150_com_interface[1] )
16781679
16791680   MDRV_DEVICE_ADD( "ins8250_2", INS8250 )         /* TODO: Verify model */
1680   MDRV_DEVICE_CONFIG( ibmpc_com_interface[2] )
1681   MDRV_DEVICE_CONFIG( ibm5150_com_interface[2] )
16811682
16821683   MDRV_DEVICE_ADD( "ins8250_3", INS8250 )         /* TODO: Verify model */
1683   MDRV_DEVICE_CONFIG( ibmpc_com_interface[3] )
1684   MDRV_DEVICE_CONFIG( ibm5150_com_interface[3] )
16841685
16851686   /* video hardware */
16861687   MDRV_IMPORT_FROM( pcvideo_vga )
r2942r2943
16901691
16911692    /* sound hardware */
16921693   MDRV_SPEAKER_STANDARD_MONO("mono")
1693   MDRV_SOUND_ADD(CUSTOM, 0)
1694   MDRV_SOUND_CONFIG(pc_sound_interface)
1694   MDRV_SOUND_ADD(SPEAKER, 0)
16951695   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
16961696#ifdef ADLIB
16971697   MDRV_SOUND_ADD(YM3812, ym3812_StdClock)
r2942r2943
17151715   MDRV_MACHINE_RESET(pc)
17161716
17171717   MDRV_DEVICE_ADD( "pit8253", PIT8253 )
1718   MDRV_DEVICE_CONFIG( pc_pit8253_config )
1718   MDRV_DEVICE_CONFIG( ibm5150_pit8253_config )
17191719
17201720   MDRV_DEVICE_ADD( "dma8237", DMA8237 )
1721   MDRV_DEVICE_CONFIG( pc_dma8237_config )
1721   MDRV_DEVICE_CONFIG( ibm5150_dma8237_config )
17221722
17231723   MDRV_DEVICE_ADD( "pic8259_master", PIC8259 )
1724   MDRV_DEVICE_CONFIG( pc_pic8259_master_config )
1724   MDRV_DEVICE_CONFIG( ibm5150_pic8259_master_config )
17251725
17261726   MDRV_DEVICE_ADD( "pic8259_slave", PIC8259 )
1727   MDRV_DEVICE_CONFIG( pc_pic8259_slave_config )
1727   MDRV_DEVICE_CONFIG( ibm5150_pic8259_slave_config )
17281728
17291729   MDRV_DEVICE_ADD( "ppi8255", PPI8255 )
1730   MDRV_DEVICE_CONFIG( pc_ppi8255_interface )
1730   MDRV_DEVICE_CONFIG( ibm5150_ppi8255_interface )
17311731
17321732   MDRV_DEVICE_ADD( "ins8250_0", INS8250 )         /* TODO: Verify model */
1733   MDRV_DEVICE_CONFIG( ibmpc_com_interface[0] )
1733   MDRV_DEVICE_CONFIG( ibm5150_com_interface[0] )
17341734
17351735   MDRV_DEVICE_ADD( "ins8250_1", INS8250 )         /* TODO: Verify model */
1736   MDRV_DEVICE_CONFIG( ibmpc_com_interface[1] )
1736   MDRV_DEVICE_CONFIG( ibm5150_com_interface[1] )
17371737
17381738   /* video hardware */
17391739   MDRV_IMPORT_FROM( pcvideo_t1000 )
17401740
17411741    /* sound hardware */
17421742   MDRV_SPEAKER_STANDARD_MONO("mono")
1743   MDRV_SOUND_ADD(CUSTOM, 0)
1744   MDRV_SOUND_CONFIG(pc_sound_interface)
1743   MDRV_SOUND_ADD(SPEAKER, 0)
17451744   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
17461745   MDRV_SOUND_ADD(SN76496, 2386360)
17471746   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
r2942r2943
17661765   MDRV_DEVICE_CONFIG( pcjr_pit8253_config )
17671766
17681767   MDRV_DEVICE_ADD( "dma8237", DMA8237 )
1769   MDRV_DEVICE_CONFIG( pc_dma8237_config )
1768   MDRV_DEVICE_CONFIG( ibm5150_dma8237_config )
17701769
17711770   MDRV_DEVICE_ADD( "pic8259_master", PIC8259 )
17721771   MDRV_DEVICE_CONFIG( pcjr_pic8259_master_config )
17731772
17741773   MDRV_DEVICE_ADD( "pic8259_slave", PIC8259 )
1775   MDRV_DEVICE_CONFIG( pc_pic8259_slave_config )
1774   MDRV_DEVICE_CONFIG( ibm5150_pic8259_slave_config )
17761775
17771776   MDRV_DEVICE_ADD( "ppi8255", PPI8255 )
17781777   MDRV_DEVICE_CONFIG( pcjr_ppi8255_interface )
17791778
17801779   MDRV_DEVICE_ADD( "ins8250_0", INS8250 )         /* TODO: Verify model */
1781   MDRV_DEVICE_CONFIG( ibmpc_com_interface[0] )
1780   MDRV_DEVICE_CONFIG( ibm5150_com_interface[0] )
17821781
17831782   MDRV_DEVICE_ADD( "ins8250_1", INS8250 )         /* TODO: Verify model */
1784   MDRV_DEVICE_CONFIG( ibmpc_com_interface[1] )
1783   MDRV_DEVICE_CONFIG( ibm5150_com_interface[1] )
17851784
17861785   /* video hardware */
17871786   MDRV_IMPORT_FROM( pcvideo_pcjr )
17881787
17891788    /* sound hardware */
17901789   MDRV_SPEAKER_STANDARD_MONO("mono")
1791   MDRV_SOUND_ADD(CUSTOM, 0)
1792   MDRV_SOUND_CONFIG(pc_sound_interface)
1790   MDRV_SOUND_ADD(SPEAKER, 0)
17931791   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
17941792   MDRV_SOUND_ADD(SN76496, 2386360)
17951793   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
r2942r2943
20952093   ROMX_LOAD("68x4370.u19", 0xf0000, 0x8000, CRC(758ff036) SHA1(045e27a70407d89b7956ecae4d275bd2f6b0f8e2), ROM_BIOS(4))
20962094   ROMX_LOAD("62x0890.u18", 0xf8000, 0x8000, CRC(4f417635) SHA1(daa61762d3afdd7262e34edf1a3d2df9a05bcebb), ROM_BIOS(4))
20972095
2098//   ROM_SYSTEM_BIOS( 4, "xtdiag", "IBM XT 5160 w/Supersoft Diagnostics" )    /* ROMs marked as BAD_DUMP for now. We expect the data to be in a different ROM chip layout */
2099//   ROMX_LOAD("basicc11.f6", 0xf6000, 0x2000, BAD_DUMP CRC(80d3cf5d) SHA1(64769b7a8b60ffeefa04e4afbec778069a2840c9), ROM_BIOS(5) )
2100//   ROMX_LOAD("basicc11.f8", 0xf8000, 0x2000, BAD_DUMP CRC(673a4acc) SHA1(082ae803994048e225150f771794ca305f73d731), ROM_BIOS(5) )
2101//   ROMX_LOAD("basicc11.fa", 0xfa000, 0x2000, BAD_DUMP CRC(aac3fc37) SHA1(c9e0529470edf04da093bb8c8ae2536c688c1a74), ROM_BIOS(5) )
2102//   ROMX_LOAD("basicc11.fc", 0xfc000, 0x2000, BAD_DUMP CRC(3062b3fc) SHA1(5134dd64721cbf093d059ee5d3fd09c7f86604c7), ROM_BIOS(5) )
2103//   ROMX_LOAD("xtdiag.bin", 0xfe000, 0x2000, CRC(4e89a4d8) SHA1(39a28fb2fe9f1aeea24ed2c0255cebca76e37ed7), ROM_BIOS(5) )
2096   ROM_SYSTEM_BIOS( 4, "xtdiag", "IBM XT 5160 w/Supersoft Diagnostics" )    /* ROMs marked as BAD_DUMP for now. We expect the data to be in a different ROM chip layout */
2097   ROMX_LOAD("basicc11.f6", 0xf6000, 0x2000, BAD_DUMP CRC(80d3cf5d) SHA1(64769b7a8b60ffeefa04e4afbec778069a2840c9), ROM_BIOS(5) )
2098   ROMX_LOAD("basicc11.f8", 0xf8000, 0x2000, BAD_DUMP CRC(673a4acc) SHA1(082ae803994048e225150f771794ca305f73d731), ROM_BIOS(5) )
2099   ROMX_LOAD("basicc11.fa", 0xfa000, 0x2000, BAD_DUMP CRC(aac3fc37) SHA1(c9e0529470edf04da093bb8c8ae2536c688c1a74), ROM_BIOS(5) )
2100   ROMX_LOAD("basicc11.fc", 0xfc000, 0x2000, BAD_DUMP CRC(3062b3fc) SHA1(5134dd64721cbf093d059ee5d3fd09c7f86604c7), ROM_BIOS(5) )
2101   ROMX_LOAD("xtdiag.bin", 0xfe000, 0x2000, CRC(4e89a4d8) SHA1(39a28fb2fe9f1aeea24ed2c0255cebca76e37ed7), ROM_BIOS(5) )
21042102
21052103   /* Character rom */
21062104   ROM_REGION(0x2000,REGION_GFX1, 0)
21072105   ROM_LOAD("5788005.u33", 0x00000, 0x2000, CRC(0bf56d70) SHA1(c2a8b10808bf51a3c123ba3eb1e9dd608231916f))
21082106ROM_END
21092107
2108
21102109ROM_START( xtvga )
21112110    ROM_REGION(0x100000,REGION_CPU1, 0)
21122111    ROM_LOAD("et4000.bin", 0xc0000, 0x8000, CRC(f01e4be0) SHA1(95d75ff41bcb765e50bd87a8da01835fd0aa01d5))
r2942r2943
22692268   CONFIG_DEVICE(ibmpc_harddisk_getinfo)
22702269SYSTEM_CONFIG_END
22712270
2271
2272static SYSTEM_CONFIG_START(ibm5160)
2273   CONFIG_RAM_DEFAULT( 640 * 1024 )
2274   CONFIG_DEVICE(ibmpc_floppy_getinfo)
2275   CONFIG_DEVICE(ibmpc_harddisk_getinfo)
2276SYSTEM_CONFIG_END
2277
2278
22722279static SYSTEM_CONFIG_START(pcjr)
22732280   CONFIG_RAM_DEFAULT( 640 * 1024 )
22742281   CONFIG_DEVICE(ibmpc_cassette_getinfo)
r2942r2943
22952302COMP(  1987,   t1000sx,   ibm5150,   0,      t1000hx,    tandy1t,   t1000hx,   ibmpc,   "Tandy Radio Shack",  "Tandy 1000SX", 0)
22962303
22972304// xt class (pc but 8086)
2298COMP(  1982,   ibm5160,   ibm5150,   0,      ibm5160,    xtcga,      pccga,      ibmpc,   "International Business Machines",  "IBM XT 5160" , 0)
2305COMP(  1982,   ibm5160,   ibm5150,   0,      ibm5160,    xtcga,      pccga,      ibm5160,   "International Business Machines",  "IBM XT 5160" , 0)
22992306COMP(  1988,   pc200,      ibm5150,   0,      pc200,      pc200,      pc200,      ibmpc,   "Sinclair Research",  "PC200 Professional Series", GAME_NOT_WORKING)
23002307COMP(  1988,   pc20,      ibm5150,   0,      pc200,      pc200,      pc200,      ibmpc,   "Amstrad plc",  "Amstrad PC20" , GAME_NOT_WORKING)
23012308COMP(  1987,   ppc512,      ibm5150,   0,      pc200,      pc200,      pc200,      ibmpc,   "Amstrad plc",  "Amstrad PPC512", 0)
docs/messnew.txt
r2942r2943
22
33New System Drivers Supported (in no particular order):
44------------------------------------------------------
5(none)
5- IBM PC/XT-286 [Wilbert Pol]
66
77
88
99System Driver Changes:
1010----------------------
11(none)
11- [IBM5170] Added support for the 8042 keybaord controller dumped
12  by Kevtris.  [Wilbert Pol]
1213
1314
1415

Previous 15994 Revisions Next


© 1998-2018 The MESS Team