Previous 15994 Revisions Next

r2377 Saturday 12th April, 2008 at 19:17:38 UTC by Wilbert Pol
Changed the pic8259 implementation into a device.
[src/emu/machine]pic8259.c pic8259.h
[src/mame/drivers]gamecstl.c mediagx.c taitowlf.c
[src/mame/machine]pcshare.c pcshare.h
[src/mess/drivers]at.c bebox.c compis.c ip22.c pasogo.c pc.c
[src/mess/includes]at.h bebox.h compis.h pc.h
[src/mess/machine]at.c bebox.c compis.c pc.c pc_hdc.c pc_hdc.h

src/mame/machine/pcshare.c
r2376r2377
2121***************************************************************************/
2222
2323#include "driver.h"
24#include "deprecat.h"
25#include "memconv.h"
26#include "machine/8255ppi.h"
27
28#include "machine/pic8259.h"
29#include "machine/pit8253.h"
30#include "machine/mc146818.h"
3124#include "machine/pcshare.h"
32
33#include "machine/8237dma.h"
3425#include "machine/pckeybrd.h"
3526
3627#define VERBOSE_DBG 0       /* general debug messages */
r2376r2377
4334
4435
4536static emu_timer *pc_keyboard_timer;
46
37static void (*set_keyb_int)(int);
4738static TIMER_CALLBACK( pc_keyb_timer );
4839
4940
50/* ----------------------------------------------------------------------- */
51
52static void pc_pic_set_int_line(int which, int interrupt)
41void init_pc_common(UINT32 flags, void (*set_keyb_int_func)(int))
5342{
54   switch(which)
55   {
56      case 0:
57         /* Master */
58         cpunum_set_input_line(Machine, 0, 0, interrupt ? HOLD_LINE : CLEAR_LINE);
59         break;
60
61      case 1:
62         /* Slave */
63         pic8259_set_irq_line(0, 2, interrupt);
64         break;
65   }
66}
67
68
69
70void init_pc_common(UINT32 flags)
71{
7243   /* PC-XT keyboard */
7344   if (flags & PCCOMMON_KEYBOARD_AT)
7445      at_keyboard_init(AT_KEYBOARD_TYPE_AT);
r2376r2377
7647      at_keyboard_init(AT_KEYBOARD_TYPE_PC);
7748   at_keyboard_set_scan_code_set(1);
7849
79   /* PIC */
80   pic8259_init(2, pc_pic_set_int_line);
50   set_keyb_int = set_keyb_int_func;
8151
8252   pc_keyboard_timer = timer_alloc(pc_keyb_timer, NULL);
8353}
r2376r2377
140110void pc_keyb_clear(void)
141111{
142112   pc_keyb.data = 0;
143   pic8259_set_irq_line(0, 1, 0);
113   if ( set_keyb_int ) {
114      set_keyb_int(0);
115   }
144116}
145117
146118void pc_keyboard(void)
r2376r2377
154126      if ( (data=at_keyboard_read())!=-1) {
155127         pc_keyb.data = data;
156128         DBG_LOG(1,"KB_scancode",("$%02x\n", pc_keyb.data));
157         pic8259_set_irq_line(0, 1, 1);
129         if ( set_keyb_int ) {
130            set_keyb_int(1);
131         }
158132         pc_keyb.self_test = 0;
159133      }
160134   }
src/mame/machine/pcshare.h
r2376r2377
44#define PCCOMMON_KEYBOARD_PC   0
55#define PCCOMMON_KEYBOARD_AT   1
66
7void init_pc_common(UINT32 flags);
7void init_pc_common(UINT32 flags, void (*set_keyb_int_func)(int));
88
99void pc_keyboard(void);
1010UINT8 pc_keyb_read(void);
src/mame/drivers/mediagx.c
r2376r2377
119119static UINT32 ad1847_sample_counter = 0;
120120static UINT32 ad1847_sample_rate;
121121
122static struct {
123   const device_config   *pit8254;
124   const device_config   *pic8259_1;
125   const device_config   *pic8259_2;
126   const device_config   *dma8237_1;
127   const device_config   *dma8237_2;
128} mediagx_devices;
122129
130
123131// Display controller registers
124132#define DC_UNLOCK            0x00/4
125133#define DC_GENERAL_CFG         0x04/4
r2376r2377
468476   // 0x20 - 0x21, PIC
469477   if (ACCESSING_BITS_0_15)
470478   {
471      r |= pic8259_32le_0_r(machine, offset, mem_mask);
479      r |= read32le_with_read8_device_handler( pic8259_r, (device_config*)mediagx_devices.pic8259_1, offset, mem_mask);
472480   }
473481
474482   // 0x22, 0x23, Cyrix configuration registers
r2376r2377
488496   // 0x20 - 0x21, PIC
489497   if (ACCESSING_BITS_0_15)
490498   {
491      pic8259_32le_0_w(machine, offset, data, mem_mask);
499      write32le_with_write8_device_handler( pic8259_w, (device_config*)mediagx_devices.pic8259_1, offset, data, mem_mask);
492500   }
493501
494502   // 0x22, 0x23, Cyrix configuration registers
r2376r2377
839847
840848DEV_READWRITE8TO32LE( mediagx_pit8254_32le, pit8253_r, pit8253_w )
841849DEV_READWRITE8TO32LE( mediagx_dma8237_32le, dma8237_r, dma8237_w )
850DEV_READWRITE8TO32LE( mediagx_pic8259_32le, pic8259_r, pic8259_w )
842851
843852
844853/*****************************************************************************/
r2376r2377
863872   AM_RANGE(0x0060, 0x006f) AM_READWRITE(kbdc8042_32le_r,         kbdc8042_32le_w)
864873   AM_RANGE(0x0070, 0x007f) AM_READWRITE(mc146818_port32le_r,      mc146818_port32le_w)
865874   AM_RANGE(0x0080, 0x009f) AM_READWRITE(at_page32_r,            at_page32_w)
866   AM_RANGE(0x00a0, 0x00af) AM_READWRITE(pic8259_32le_1_r,         pic8259_32le_1_w)
875   AM_RANGE(0x00a0, 0x00af) AM_DEVREADWRITE(PIC8259, "pic8259_2", mediagx_pic8259_32le_r, mediagx_pic8259_32le_w)
867876   AM_RANGE(0x00c0, 0x00cf) AM_DEVREADWRITE(DMA8237, "dma8237_2", at32_dma8237_2_r, at32_dma8237_2_w)
868877   AM_RANGE(0x00e8, 0x00eb) AM_NOP      // I/O delay port
869878   AM_RANGE(0x01f0, 0x01f7) AM_READWRITE(ide0_r, ide0_w)
r2376r2377
956965static IRQ_CALLBACK(irq_callback)
957966{
958967   int r;
959   r = pic8259_acknowledge(1);
968   r = pic8259_acknowledge( mediagx_devices.pic8259_2);
960969   if (r==0)
961970   {
962      r = pic8259_acknowledge(0);
971      r = pic8259_acknowledge( mediagx_devices.pic8259_1);
963972   }
964973   return r;
965974}
r2376r2377
980989
981990   dmadac_enable(0, 2, 1);
982991   ide_controller_reset(0);
992
993   mediagx_devices.pit8254 = (device_config*)device_list_find_by_tag( machine->config->devicelist, PIT8254, "pit8254" );
994   mediagx_devices.pic8259_1 = (device_config*)device_list_find_by_tag( machine->config->devicelist, PIC8259, "pic8259_1" );
995   mediagx_devices.pic8259_2 = (device_config*)device_list_find_by_tag( machine->config->devicelist, PIC8259, "pic8259_2" );
996   mediagx_devices.dma8237_1 = (device_config*)device_list_find_by_tag( machine->config->devicelist, DMA8237, "dma8237_1" );
997   mediagx_devices.dma8237_2 = (device_config*)device_list_find_by_tag( machine->config->devicelist, DMA8237, "dma8237_2" );
983998}
984999
1000/*************************************************************
1001 *
1002 * pic8259 configuration
1003 *
1004 *************************************************************/
1005
1006static PIC8259_SET_INT_LINE( mediagx_pic8259_1_set_int_line ) {
1007   cpunum_set_input_line(device->machine, 0, 0, interrupt ? HOLD_LINE : CLEAR_LINE);
1008}
1009
1010
1011static PIC8259_SET_INT_LINE( mediagx_pic8259_2_set_int_line ) {
1012   pic8259_set_irq_line( mediagx_devices.pic8259_1, 2, interrupt);
1013}
1014
1015
1016static const struct pic8259_interface mediagx_pic8259_1_config = {
1017   mediagx_pic8259_1_set_int_line
1018};
1019
1020
1021static const struct pic8259_interface mediagx_pic8259_2_config = {
1022   mediagx_pic8259_2_set_int_line
1023};
1024
1025
1026/*************************************************************
1027 *
1028 * pit8254 configuration
1029 *
1030 *************************************************************/
1031
9851032static PIT8253_OUTPUT_CHANGED( pc_timer0_w )
9861033{
987   pic8259_set_irq_line(0, 0, state);
1034   pic8259_set_irq_line( mediagx_devices.pic8259_1, 0, state);
9881035}
9891036
9901037
r2376r2377
10261073   MDRV_DEVICE_ADD( "dma8237_2", DMA8237 )
10271074   MDRV_DEVICE_CONFIG( dma8237_2_config )
10281075
1076   MDRV_DEVICE_ADD( "pic8259_1", PIC8259 )
1077   MDRV_DEVICE_CONFIG( mediagx_pic8259_1_config )
1078
1079   MDRV_DEVICE_ADD( "pic8259_2", PIC8259 )
1080   MDRV_DEVICE_CONFIG( mediagx_pic8259_2_config )
1081
10291082   MDRV_NVRAM_HANDLER( mc146818 )
10301083
10311084    /* video hardware */
r2376r2377
10581111
10591112static void keyboard_interrupt(int state)
10601113{
1061   pic8259_set_irq_line(0, 1, state);
1114   pic8259_set_irq_line(mediagx_devices.pic8259_1, 1, state);
10621115}
10631116
10641117static void ide_interrupt(int state)
10651118{
1066   pic8259_set_irq_line(1, 6, state);
1119   pic8259_set_irq_line(mediagx_devices.pic8259_2, 6, state);
10671120}
10681121
10691122static int mediagx_get_out2(running_machine *machine) {
1070   return pit8253_get_output((device_config*)device_list_find_by_tag( machine->config->devicelist, PIT8254, "pit8254" ), 2 );
1123   return pit8253_get_output( mediagx_devices.pit8254, 2 );
10711124}
10721125
10731126static const struct kbdc8042_interface at8042 =
r2376r2377
10861139   cx5510_pci_w
10871140};
10881141
1142static void mediagx_set_keyb_int(int state) {
1143   pic8259_set_irq_line(mediagx_devices.pic8259_1, 1, state);
1144}
1145
10891146static void init_mediagx(running_machine *machine)
10901147{
1091   init_pc_common(PCCOMMON_KEYBOARD_AT);
1148   init_pc_common(PCCOMMON_KEYBOARD_AT,mediagx_set_keyb_int);
10921149   mc146818_init(MC146818_STANDARD);
10931150
10941151   pci_init();
src/mame/drivers/taitowlf.c
r2376r2377
2121static UINT32 *cga_ram;
2222static UINT32 *bios_ram;
2323
24static struct {
25   const device_config   *pit8254;
26   const device_config   *pic8259_1;
27   const device_config   *pic8259_2;
28   const device_config   *dma8237_1;
29   const device_config   *dma8237_2;
30} taitowlf_devices;
31
32
2433static const rgb_t cga_palette[16] =
2534{
2635   MAKE_RGB( 0x00, 0x00, 0x00 ), MAKE_RGB( 0x00, 0x00, 0xaa ), MAKE_RGB( 0x00, 0xaa, 0x00 ), MAKE_RGB( 0x00, 0xaa, 0xaa ),
r2376r2377
419428
420429DEV_READWRITE8TO32LE( taitowlf_pit8254_32le, pit8253_r, pit8253_w )
421430DEV_READWRITE8TO32LE( taitowlf_dma8237_32le, dma8237_r, dma8237_w )
431DEV_READWRITE8TO32LE( taitowlf_pic8259_32le, pic8259_r, pic8259_w )
422432
423433
424434/*****************************************************************************/
r2376r2377
436446
437447static ADDRESS_MAP_START(taitowlf_io, ADDRESS_SPACE_IO, 32)
438448   AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE(DMA8237, "dma8237_1", taitowlf_dma8237_32le_r, taitowlf_dma8237_32le_w)
439   AM_RANGE(0x0020, 0x003f) AM_READWRITE(pic8259_32le_0_r,         pic8259_32le_0_w)
449   AM_RANGE(0x0020, 0x003f) AM_DEVREADWRITE(PIC8259, "pic8259_1", taitowlf_pic8259_32le_r, taitowlf_pic8259_32le_w)
440450   AM_RANGE(0x0040, 0x005f) AM_DEVREADWRITE(PIT8254, "pit8254", taitowlf_pit8254_32le_r, taitowlf_pit8254_32le_w)
441451   AM_RANGE(0x0060, 0x006f) AM_READWRITE(kbdc8042_32le_r,         kbdc8042_32le_w)
442452   AM_RANGE(0x0070, 0x007f) AM_READWRITE(mc146818_port32le_r,      mc146818_port32le_w)
443453   AM_RANGE(0x0080, 0x009f) AM_READWRITE(at_page32_r,            at_page32_w)
444   AM_RANGE(0x00a0, 0x00bf) AM_READWRITE(pic8259_32le_1_r,         pic8259_32le_1_w)
454   AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE(PIC8259, "pic8259_2", taitowlf_pic8259_32le_r, taitowlf_pic8259_32le_w)
445455   AM_RANGE(0x00c0, 0x00df) AM_DEVREADWRITE(DMA8237, "dma8237_2", at32_dma8237_2_r, at32_dma8237_2_w)
446456   AM_RANGE(0x00e8, 0x00eb) AM_NOP
447457   AM_RANGE(0x01f0, 0x01f7) AM_READWRITE(ide0_r, ide0_w)
r2376r2377
514524static IRQ_CALLBACK(irq_callback)
515525{
516526   int r = 0;
517   r = pic8259_acknowledge(1);
527   r = pic8259_acknowledge( taitowlf_devices.pic8259_2);
518528   if (r==0)
519529   {
520      r = pic8259_acknowledge(0);
530      r = pic8259_acknowledge( taitowlf_devices.pic8259_1);
521531   }
522532   return r;
523533}
r2376r2377
527537   memory_set_bankptr(1, memory_region(REGION_USER1) + 0x30000);
528538
529539   cpunum_set_irq_callback(0, irq_callback);
540
541   taitowlf_devices.pit8254 = (device_config*)device_list_find_by_tag( machine->config->devicelist, PIT8254, "pit8254" );
542   taitowlf_devices.pic8259_1 = (device_config*)device_list_find_by_tag( machine->config->devicelist, PIC8259, "pic8259_1" );
543   taitowlf_devices.pic8259_2 = (device_config*)device_list_find_by_tag( machine->config->devicelist, PIC8259, "pic8259_2" );
544   taitowlf_devices.dma8237_1 = (device_config*)device_list_find_by_tag( machine->config->devicelist, DMA8237, "dma8237_1" );
545   taitowlf_devices.dma8237_2 = (device_config*)device_list_find_by_tag( machine->config->devicelist, DMA8237, "dma8237_2" );
530546}
531547
548
549/*************************************************************
550 *
551 * pic8259 configuration
552 *
553 *************************************************************/
554
555static PIC8259_SET_INT_LINE( taitowlf_pic8259_1_set_int_line ) {
556   cpunum_set_input_line(device->machine, 0, 0, interrupt ? HOLD_LINE : CLEAR_LINE);
557}
558
559
560static PIC8259_SET_INT_LINE( taitowlf_pic8259_2_set_int_line ) {
561   pic8259_set_irq_line( taitowlf_devices.pic8259_1, 2, interrupt);
562}
563
564
565static const struct pic8259_interface taitowlf_pic8259_1_config = {
566   taitowlf_pic8259_1_set_int_line
567};
568
569
570static const struct pic8259_interface taitowlf_pic8259_2_config = {
571   taitowlf_pic8259_2_set_int_line
572};
573
574
575/*************************************************************
576 *
577 * pit8254 configuration
578 *
579 *************************************************************/
580
532581static PIT8253_OUTPUT_CHANGED( pc_timer0_w )
533582{
534   pic8259_set_irq_line(0, 0, state);
583   pic8259_set_irq_line(taitowlf_devices.pic8259_1, 0, state);
535584}
536585
537586static const struct pit8253_config taitowlf_pit8254_config =
r2376r2377
571620   MDRV_DEVICE_ADD( "dma8237_2", DMA8237 )
572621   MDRV_DEVICE_CONFIG( dma8237_2_config )
573622
623   MDRV_DEVICE_ADD( "pic8259_1", PIC8259 )
624   MDRV_DEVICE_CONFIG( taitowlf_pic8259_1_config )
625
626   MDRV_DEVICE_ADD( "pic8259_2", PIC8259 )
627   MDRV_DEVICE_CONFIG( taitowlf_pic8259_2_config )
628
574629   MDRV_NVRAM_HANDLER( mc146818 )
575630
576631    /* video hardware */
r2376r2377
608663
609664static void keyboard_interrupt(int state)
610665{
611   pic8259_set_irq_line(0, 1, state);
666   pic8259_set_irq_line(taitowlf_devices.pic8259_1, 1, state);
612667}
613668
614669static void ide_interrupt(int state)
615670{
616   pic8259_set_irq_line(1, 6, state);
671   pic8259_set_irq_line(taitowlf_devices.pic8259_2, 6, state);
617672}
618673
619674static int taitowlf_get_out2(running_machine *machine) {
620   return pit8253_get_output((device_config*)device_list_find_by_tag( machine->config->devicelist, PIT8254, "pit8254" ), 2 );
675   return pit8253_get_output(taitowlf_devices.pit8254, 2 );
621676}
622677
623678static const struct kbdc8042_interface at8042 =
r2376r2377
630685   ide_interrupt
631686};
632687
688static void taitowlf_set_keyb_int(int state) {
689   pic8259_set_irq_line(taitowlf_devices.pic8259_1, 1, state);
690}
691
633692static DRIVER_INIT( taitowlf )
634693{
635694   bios_ram = auto_malloc(0x10000);
636695
637   init_pc_common(PCCOMMON_KEYBOARD_AT);
696   init_pc_common(PCCOMMON_KEYBOARD_AT, taitowlf_set_keyb_int);
638697   mc146818_init(MC146818_STANDARD);
639698
640699   intel82439tx_init();
src/mame/drivers/gamecstl.c
r2376r2377
5656static UINT32 *cga_ram;
5757static UINT32 *bios_ram;
5858
59static struct {
60   const device_config   *pit8254;
61   const device_config   *pic8259_1;
62   const device_config   *pic8259_2;
63   const device_config   *dma8237_1;
64   const device_config   *dma8237_2;
65} gamecstl_devices;
66
67
5968static const rgb_t cga_palette[16] =
6069{
6170   MAKE_RGB( 0x00, 0x00, 0x00 ), MAKE_RGB( 0x00, 0x00, 0xaa ), MAKE_RGB( 0x00, 0xaa, 0x00 ), MAKE_RGB( 0x00, 0xaa, 0xaa ),
r2376r2377
453462
454463DEV_READWRITE8TO32LE( gamecstl_pit8254_32le, pit8253_r, pit8253_w )
455464DEV_READWRITE8TO32LE( gamecstl_dma8237_32le, dma8237_r, dma8237_w )
465DEV_READWRITE8TO32LE( gamecstl_pic8259_32le, pic8259_r, pic8259_w )
456466
457467
458468/*****************************************************************************/
r2376r2377
470480
471481static ADDRESS_MAP_START(gamecstl_io, ADDRESS_SPACE_IO, 32)
472482   AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE(DMA8237, "dma8237_1", gamecstl_dma8237_32le_r, gamecstl_dma8237_32le_w)
473   AM_RANGE(0x0020, 0x003f) AM_READWRITE(pic8259_32le_0_r,         pic8259_32le_0_w)
483   AM_RANGE(0x0020, 0x003f) AM_DEVREADWRITE(PIC8259, "pic8259_1", gamecstl_pic8259_32le_r, gamecstl_pic8259_32le_w)
474484   AM_RANGE(0x0040, 0x005f) AM_DEVREADWRITE(PIT8254, "pit8254", gamecstl_pit8254_32le_r, gamecstl_pit8254_32le_w)
475485   AM_RANGE(0x0060, 0x006f) AM_READWRITE(kbdc8042_32le_r,         kbdc8042_32le_w)
476486   AM_RANGE(0x0070, 0x007f) AM_READWRITE(mc146818_port32le_r,      mc146818_port32le_w)
477487   AM_RANGE(0x0080, 0x009f) AM_READWRITE(at_page32_r,            at_page32_w)
478   AM_RANGE(0x00a0, 0x00bf) AM_READWRITE(pic8259_32le_1_r,         pic8259_32le_1_w)
488   AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE(PIC8259, "pic8259_2", gamecstl_pic8259_32le_r, gamecstl_pic8259_32le_w)
479489   AM_RANGE(0x00c0, 0x00df) AM_DEVREADWRITE(DMA8237, "dma8237_2", at32_dma8237_2_r, at32_dma8237_2_w)
480490   AM_RANGE(0x00e8, 0x00eb) AM_NOP
481491   AM_RANGE(0x01f0, 0x01f7) AM_READWRITE(ide0_r, ide0_w)
r2376r2377
548558static IRQ_CALLBACK(irq_callback)
549559{
550560   int r = 0;
551   r = pic8259_acknowledge(1);
561   r = pic8259_acknowledge(gamecstl_devices.pic8259_2);
552562   if (r==0)
553563   {
554      r = pic8259_acknowledge(0);
564      r = pic8259_acknowledge(gamecstl_devices.pic8259_1);
555565   }
556566   return r;
557567}
r2376r2377
561571   memory_set_bankptr(1, memory_region(REGION_USER1) + 0x30000);
562572
563573   cpunum_set_irq_callback(0, irq_callback);
574
575   gamecstl_devices.pit8254 = (device_config*)device_list_find_by_tag( machine->config->devicelist, PIT8254, "pit8254" );
576   gamecstl_devices.pic8259_1 = (device_config*)device_list_find_by_tag( machine->config->devicelist, PIC8259, "pic8259_1" );
577   gamecstl_devices.pic8259_2 = (device_config*)device_list_find_by_tag( machine->config->devicelist, PIC8259, "pic8259_2" );
578   gamecstl_devices.dma8237_1 = (device_config*)device_list_find_by_tag( machine->config->devicelist, DMA8237, "dma8237_1" );
579   gamecstl_devices.dma8237_2 = (device_config*)device_list_find_by_tag( machine->config->devicelist, DMA8237, "dma8237_2" );
564580}
565581
582
583/*************************************************************
584 *
585 * pic8259 configuration
586 *
587 *************************************************************/
588
589static PIC8259_SET_INT_LINE( gamecstl_pic8259_1_set_int_line ) {
590   cpunum_set_input_line(device->machine, 0, 0, interrupt ? HOLD_LINE : CLEAR_LINE);
591}
592
593
594static PIC8259_SET_INT_LINE( gamecstl_pic8259_2_set_int_line ) {
595   pic8259_set_irq_line( gamecstl_devices.pic8259_1, 2, interrupt);
596}
597
598
599static const struct pic8259_interface gamecstl_pic8259_1_config = {
600   gamecstl_pic8259_1_set_int_line
601};
602
603
604static const struct pic8259_interface gamecstl_pic8259_2_config = {
605   gamecstl_pic8259_2_set_int_line
606};
607
608
609/*************************************************************
610 *
611 * pit8254 configuration
612 *
613 *************************************************************/
614
566615static PIT8253_OUTPUT_CHANGED( pc_timer0_w )
567616{
568    pic8259_set_irq_line(0, 0, state);
617    pic8259_set_irq_line(gamecstl_devices.pic8259_1, 0, state);
569618}
570619
571620static const struct pit8253_config gamecstl_pit8254_config =
r2376r2377
605654   MDRV_DEVICE_ADD( "dma8237_2", DMA8237 )
606655   MDRV_DEVICE_CONFIG( dma8237_2_config )
607656
657   MDRV_DEVICE_ADD( "pic8259_1", PIC8259 )
658   MDRV_DEVICE_CONFIG( gamecstl_pic8259_1_config )
659
660   MDRV_DEVICE_ADD( "pic8259_2", PIC8259 )
661   MDRV_DEVICE_CONFIG( gamecstl_pic8259_2_config )
662
608663   MDRV_NVRAM_HANDLER( mc146818 )
609664
610665    /* video hardware */
r2376r2377
642697
643698static void keyboard_interrupt(int state)
644699{
645   pic8259_set_irq_line(0, 1, state);
700   pic8259_set_irq_line( gamecstl_devices.pic8259_1, 1, state);
646701}
647702
648703static void ide_interrupt(int state)
649704{
650   pic8259_set_irq_line(1, 6, state);
705   pic8259_set_irq_line( gamecstl_devices.pic8259_2, 6, state);
651706}
652707
653708static int gamecstl_get_out2(running_machine *machine) {
654   return pit8253_get_output((device_config*)device_list_find_by_tag( machine->config->devicelist, PIT8254, "pit8254" ), 2 );
709   return pit8253_get_output( gamecstl_devices.pit8254, 2 );
655710}
656711
657712static const struct kbdc8042_interface at8042 =
r2376r2377
664719   ide_interrupt
665720};
666721
722static void gamecstl_set_keyb_int(int state) {
723   pic8259_set_irq_line(gamecstl_devices.pic8259_1, 1, state);
724}
725
667726static DRIVER_INIT( gamecstl )
668727{
669728   bios_ram = auto_malloc(0x10000);
670729
671   init_pc_common(PCCOMMON_KEYBOARD_AT);
730   init_pc_common(PCCOMMON_KEYBOARD_AT, gamecstl_set_keyb_int);
672731   mc146818_init(MC146818_STANDARD);
673732
674733   intel82439tx_init();
src/emu/machine/pic8259.c
r2376r2377
3030   STATE_READY
3131} pic8259_state_t;
3232
33typedef struct pic8259   pic8259_t;
34
3335struct pic8259
3436{
37   const struct pic8259_interface   *intf;
38
3539   emu_timer *timer;
36   void (*set_int_line)(int which, int interrupt);
3740
3841   pic8259_state_t state;
3942
r2376r2377
6568   UINT32 is_x86 : 1;
6669};
6770
68static struct pic8259 *pic;
6971
70static TIMER_CALLBACK( pic8259_timerproc );
71
72
73/* initializer */
74int pic8259_init(int count, void (*set_int_line)(int which, int interrupt))
75{
76   int i;
77
78   /* allocate pic structures */
79   pic = auto_malloc(count * sizeof(struct pic8259));
80   memset(pic, 0, count * sizeof(struct pic8259));
81
82   for (i = 0; i < count; i++)
83   {
84      pic[i].timer = timer_alloc(pic8259_timerproc, NULL);
85      pic[i].set_int_line = set_int_line;
86   }
87
88   return 0;
72INLINE pic8259_t *get_safe_token(const device_config *device) {
73   assert( device != NULL );
74   assert( device->token != NULL );
75   assert( device->type == DEVICE_GET_INFO_NAME(pic8259) );
76   return ( pic8259_t *) device->token;
8977}
9078
9179
92
9380static TIMER_CALLBACK( pic8259_timerproc )
9481{
95   int which = param;
96   struct pic8259 *p = &pic[which];
82   const device_config *device = ptr;
83   pic8259_t   *pic8259 = get_safe_token(device);
9784   int irq;
9885   UINT8 mask;
9986
r2376r2377
10390      mask = 1 << irq;
10491
10592      /* is this IRQ in service? */
106      if (p->in_service & mask)
93      if (pic8259->in_service & mask)
10794      {
10895         if (LOG_GENERAL)
109            logerror("pic8259_timerproc(): PIC #%d IRQ #%d still in service\n", which, irq);
96            logerror("pic8259_timerproc(): PIC IRQ #%d still in service\n", irq);
11097         return;
11198      }
11299
113100      /* is this IRQ pending and enabled? */
114      if ((p->state == STATE_READY) && (p->pending & mask) && !(p->interrupt_mask & mask))
101      if ((pic8259->state == STATE_READY) && (pic8259->pending & mask) && !(pic8259->interrupt_mask & mask))
115102      {
116103         if (LOG_GENERAL)
117            logerror("pic8259_timerproc(): PIC #%d triggering IRQ #%d\n", which, irq);
118         if (p->set_int_line)
119            p->set_int_line(which, 1);
104            logerror("pic8259_timerproc(): PIC triggering IRQ #%d\n", irq);
105         if (pic8259->intf->set_int_line)
106            pic8259->intf->set_int_line(device, 1);
120107         return;
121108      }
122109   }
123   if (p->set_int_line)
124      p->set_int_line(which, 0);
110   if (pic8259->intf->set_int_line)
111      pic8259->intf->set_int_line(device, 0);
125112}
126113
127114
128
129static void pic8259_set_timer(int which)
115INLINE void pic8259_set_timer(pic8259_t *pic8259)
130116{
131   timer_adjust_oneshot(pic[which].timer, attotime_zero, which);
117   timer_adjust_oneshot(pic8259->timer, attotime_zero, 0);
132118}
133119
134120
121void pic8259_set_irq_line(const device_config *device, int irq, int state)
122{
123   pic8259_t   *pic8259 = get_safe_token(device);
135124
136void pic8259_set_irq_line(int which, int irq, int state)
137{
138125   if (state)
139126   {
140127      /* setting IRQ line */
141      if (!(pic[which].irq_lines & (1 << irq)))
128      if (!(pic8259->irq_lines & (1 << irq)))
142129      {
143130         if (LOG_GENERAL)
144            logerror("pic8259_set_irq_line(): PIC #%d set IRQ line #%d\n", which, irq);
131            logerror("pic8259_set_irq_line(): PIC set IRQ line #%d\n", irq);
145132
146         pic[which].irq_lines |= 1 << irq;
147         pic[which].pending |= 1 << irq;
148         pic8259_set_timer(which);
133         pic8259->irq_lines |= 1 << irq;
134         pic8259->pending |= 1 << irq;
135         pic8259_set_timer(pic8259);
149136      }
150137   }
151138   else
152139   {
153140      /* clearing IRQ line */
154      if (pic[which].irq_lines & (1 << irq))
141      if (pic8259->irq_lines & (1 << irq))
155142      {
156143         if (LOG_GENERAL)
157            logerror("pic8259_set_irq_line(): PIC #%d cleared IRQ line #%d\n", which, irq);
144            logerror("pic8259_set_irq_line(): PIC cleared IRQ line #%d\n", irq);
158145
159         pic[which].irq_lines &= ~(1 << irq);
160         pic8259_set_timer(which);
146         pic8259->irq_lines &= ~(1 << irq);
147         pic8259_set_timer(pic8259);
161148      }
162149   }
163150}
164151
165152
166153
167int pic8259_acknowledge(int which)
154int pic8259_acknowledge(const device_config *device)
168155{
169   struct pic8259 *p = &pic[which];
156   pic8259_t   *pic8259 = get_safe_token(device);
170157   UINT8 mask;
171158   int irq;
172159
r2376r2377
175162      mask = 1 << irq;
176163
177164      /* is this IRQ pending and enabled? */
178      if ((p->pending & mask) && !(p->interrupt_mask & mask))
165      if ((pic8259->pending & mask) && !(pic8259->interrupt_mask & mask))
179166      {
180167         if (LOG_GENERAL)
181            logerror("pic8259_acknowledge(): PIC #%d acknowledge IRQ #%d\n", which, irq);
168            logerror("pic8259_acknowledge(): PIC acknowledge IRQ #%d\n", irq);
182169
183         p->pending &= ~mask;
184         if (!p->auto_eoi)
185            p->in_service |= mask;
170         pic8259->pending &= ~mask;
171         if (!pic8259->auto_eoi)
172            pic8259->in_service |= mask;
186173
187         return irq + p->base;
174         return irq + pic8259->base;
188175      }
189176   }
190177   return 0;
r2376r2377
192179
193180
194181
195static UINT8 pic8259_read(int which, offs_t offset)
182READ8_DEVICE_HANDLER( pic8259_r )
196183{
197   struct pic8259 *p = &pic[which];
184   pic8259_t   *pic8259 = get_safe_token(device);
198185
199186   /* NPW 18-May-2003 - Changing 0xFF to 0x00 as per Ruslan */
200187   UINT8 data = 0x00;
r2376r2377
202189   switch(offset)
203190   {
204191      case 0: /* PIC acknowledge IRQ */
205         if (p->special)
192         if (pic8259->special)
206193         {
207            p->special = 0;
208            data = p->input;
194            pic8259->special = 0;
195            data = pic8259->input;
209196         }
210197         break;
211198
212199      case 1: /* PIC mask register */
213         data = p->interrupt_mask;
200         data = pic8259->interrupt_mask;
214201         break;
215202   }
216203   return data;
r2376r2377
218205
219206
220207
221static void pic8259_write(int which, offs_t offset, UINT8 data )
208WRITE8_DEVICE_HANDLER( pic8259_w )
222209{
223   struct pic8259 *p = &pic[which];
210   pic8259_t   *pic8259 = get_safe_token(device);
224211
225212   switch(offset)
226213   {
r2376r2377
229216         {
230217            /* write ICW1 - this pretty much resets the chip */
231218            if (LOG_ICW)
232               logerror("pic8259_write(): ICW1; which=%d data=0x%02X\n", which, data);
219               logerror("pic8259_w(): ICW1; data=0x%02X\n", data);
233220
234            p->interrupt_mask   = 0x00;
235            p->level_trig_mode   = (data & 0x08) ? 1 : 0;
236            p->vector_size      = (data & 0x04) ? 1 : 0;
237            p->cascade         = (data & 0x02) ? 0 : 1;
238            p->icw4_needed      = (data & 0x01) ? 1 : 0;
239            p->state         = STATE_ICW2;
221            pic8259->interrupt_mask   = 0x00;
222            pic8259->level_trig_mode   = (data & 0x08) ? 1 : 0;
223            pic8259->vector_size      = (data & 0x04) ? 1 : 0;
224            pic8259->cascade         = (data & 0x02) ? 0 : 1;
225            pic8259->icw4_needed      = (data & 0x01) ? 1 : 0;
226            pic8259->state         = STATE_ICW2;
240227         }
241         else if (p->state == STATE_READY)
228         else if (pic8259->state == STATE_READY)
242229         {
243230            if ((data & 0x98) == 0x08)
244231            {
245232               /* write OCW3 */
246233               if (LOG_OCW)
247                  logerror("pic8259_write(): OCW3; which=%d data=0x%02X\n", which, data);
234                  logerror("pic8259_w(): OCW3; data=0x%02X\n", data);
248235
249236               switch (data & 0x03)
250237               {
251238                  case 0x02:
252                     p->special = 1;
253                     p->input = p->pending;
239                     pic8259->special = 1;
240                     pic8259->input = pic8259->pending;
254241                     break;
255242                  case 0x03:
256                     p->special = 1;
257                     p->input = p->in_service & ~p->interrupt_mask;
243                     pic8259->special = 1;
244                     pic8259->input = pic8259->in_service & ~pic8259->interrupt_mask;
258245                     break;
259246               }
260247            }
r2376r2377
265252
266253               /* write OCW2 */
267254               if (LOG_OCW)
268                  logerror("pic8259_write(): OCW2; which=%d data=0x%02X\n", which, data);
255                  logerror("pic8259_w(): OCW2; data=0x%02X\n", data);
269256
270257               switch (data & 0xe0)
271258               {
272259                  case 0x00:
273                     p->prio = 0;
260                     pic8259->prio = 0;
274261                     break;
275262                  case 0x20:
276                     for (n = 0, mask = 1<<p->prio; n < 8; n++, mask = (mask<<1) | (mask>>7))
263                     for (n = 0, mask = 1<<pic8259->prio; n < 8; n++, mask = (mask<<1) | (mask>>7))
277264                     {
278                        if (p->in_service & mask)
265                        if (pic8259->in_service & mask)
279266                        {
280                           p->in_service &= ~mask;
267                           pic8259->in_service &= ~mask;
281268                           break;
282269                        }
283270                     }
r2376r2377
285272                  case 0x40:
286273                     break;
287274                  case 0x60:
288                     if( p->in_service & mask )
275                     if( pic8259->in_service & mask )
289276                     {
290                        p->in_service &= ~mask;
277                        pic8259->in_service &= ~mask;
291278                     }
292279                     break;
293280                  case 0x80:
294                     p->prio = ++p->prio & 7;
281                     pic8259->prio = ++pic8259->prio & 7;
295282                     break;
296283                  case 0xa0:
297                     for (n = 0, mask = 1<<p->prio; n < 8; n++, mask = (mask<<1) | (mask>>7))
284                     for (n = 0, mask = 1<<pic8259->prio; n < 8; n++, mask = (mask<<1) | (mask>>7))
298285                     {
299                        if( p->in_service & mask )
286                        if( pic8259->in_service & mask )
300287                        {
301                           p->in_service &= ~mask;
302                           p->prio = ++p->prio & 7;
288                           pic8259->in_service &= ~mask;
289                           pic8259->prio = ++pic8259->prio & 7;
303290                           break;
304291                        }
305292                     }
306293                     break;
307294                  case 0xc0:
308                     p->prio = n & 7;
295                     pic8259->prio = n & 7;
309296                     break;
310297                  case 0xe0:
311                     if( p->in_service & mask )
298                     if( pic8259->in_service & mask )
312299                     {
313                        p->in_service &= ~mask;
314                        p->pending &= ~mask;
315                        p->prio = ++p->prio & 7;
300                        pic8259->in_service &= ~mask;
301                        pic8259->pending &= ~mask;
302                        pic8259->prio = ++pic8259->prio & 7;
316303                     }
317304                     break;
318305               }
r2376r2377
321308         break;
322309
323310      case 1:
324         switch(p->state)
311         switch(pic8259->state)
325312         {
326313            case STATE_ICW1:
327314               break;
r2376r2377
329316            case STATE_ICW2:
330317               /* write ICW2 */
331318               if (LOG_ICW)
332                  logerror("pic8259_write(): ICW2; which=%d data=0x%02X\n", which, data);
319                  logerror("pic8259_w(): ICW2; data=0x%02X\n", data);
333320
334               p->base = data & 0xf8;
335               if (p->cascade)
336                  p->state = STATE_ICW3;
321               pic8259->base = data & 0xf8;
322               if (pic8259->cascade)
323                  pic8259->state = STATE_ICW3;
337324               else
338                  p->state = p->icw4_needed ? STATE_ICW4 : STATE_READY;
325                  pic8259->state = pic8259->icw4_needed ? STATE_ICW4 : STATE_READY;
339326               break;
340327
341328            case STATE_ICW3:
342329               /* write ICW3 */
343330               if (LOG_ICW)
344                  logerror("pic8259_write(): ICW3; which=%d data=0x%02X\n", which, data);
331                  logerror("pic8259_w(): ICW3; data=0x%02X\n", data);
345332
346               p->slave = data;
347               p->state = p->icw4_needed ? STATE_ICW4 : STATE_READY;
333               pic8259->slave = data;
334               pic8259->state = pic8259->icw4_needed ? STATE_ICW4 : STATE_READY;
348335               break;
349336
350337            case STATE_ICW4:
351338               /* write ICW4 */
352339               if (LOG_ICW)
353                  logerror("pic8259_write(): ICW4; which=%d data=0x%02X\n", which, data);
340                  logerror("pic8259_w(): ICW4; data=0x%02X\n", data);
354341
355               p->nested   = (data & 0x10) ? 1 : 0;
356               p->mode = (data >> 2) & 3;
357               p->auto_eoi = (data & 0x02) ? 1 : 0;
358               p->is_x86 = (data & 0x01) ? 1 : 0;
359               p->state = STATE_READY;
342               pic8259->nested   = (data & 0x10) ? 1 : 0;
343               pic8259->mode = (data >> 2) & 3;
344               pic8259->auto_eoi = (data & 0x02) ? 1 : 0;
345               pic8259->is_x86 = (data & 0x01) ? 1 : 0;
346               pic8259->state = STATE_READY;
360347               break;
361348
362349            case STATE_READY:
363350               /* write OCW1 - set interrupt mask register */
364351               if (LOG_OCW)
365                  logerror("pic8259_write(): OCW1; which=%d data=0x%02X\n", which, data);
352                  logerror("pic8259_w(): OCW1; data=0x%02X\n", data);
366353
367               p->interrupt_mask = data;
354               pic8259->interrupt_mask = data;
368355               break;
369356         }
370357         break;
371358    }
372   pic8259_set_timer(which);
359   pic8259_set_timer(pic8259);
373360}
374361
375362
376363
377/* ----------------------------------------------------------------------- */
364static DEVICE_START( pic8259 ) {
365   pic8259_t   *pic8259 = get_safe_token(device);
378366
379READ8_HANDLER ( pic8259_0_r )   { return pic8259_read(0, offset); }
380READ8_HANDLER ( pic8259_1_r )   { return pic8259_read(1, offset); }
381WRITE8_HANDLER ( pic8259_0_w )   { pic8259_write(0, offset, data); }
382WRITE8_HANDLER ( pic8259_1_w )   { pic8259_write(1, offset, data); }
367   pic8259->intf = device->static_config;
368}
383369
384READ16_HANDLER ( pic8259_16le_0_r ) { return read16le_with_read8_handler(pic8259_0_r, machine, offset, mem_mask); }
385READ16_HANDLER ( pic8259_16le_1_r ) { return read16le_with_read8_handler(pic8259_1_r, machine, offset, mem_mask); }
386WRITE16_HANDLER ( pic8259_16le_0_w ) { write16le_with_write8_handler(pic8259_0_w, machine, offset, data, mem_mask); }
387WRITE16_HANDLER ( pic8259_16le_1_w ) { write16le_with_write8_handler(pic8259_1_w, machine, offset, data, mem_mask); }
388370
389READ32_HANDLER ( pic8259_32le_0_r ) { return read32le_with_read8_handler(pic8259_0_r, machine, offset, mem_mask); }
390READ32_HANDLER ( pic8259_32le_1_r ) { return read32le_with_read8_handler(pic8259_1_r, machine, offset, mem_mask); }
391WRITE32_HANDLER ( pic8259_32le_0_w ) { write32le_with_write8_handler(pic8259_0_w, machine, offset, data, mem_mask); }
392WRITE32_HANDLER ( pic8259_32le_1_w ) { write32le_with_write8_handler(pic8259_1_w, machine, offset, data, mem_mask); }
371static DEVICE_RESET( pic8259 ) {
372   pic8259_t   *pic8259 = get_safe_token(device);
393373
394READ64_HANDLER ( pic8259_64be_0_r ) { return read64be_with_read8_handler(pic8259_0_r, machine, offset, mem_mask); }
395READ64_HANDLER ( pic8259_64be_1_r ) { return read64be_with_read8_handler(pic8259_1_r, machine, offset, mem_mask); }
396WRITE64_HANDLER ( pic8259_64be_0_w ) { write64be_with_write8_handler(pic8259_0_w, machine, offset, data, mem_mask); }
397WRITE64_HANDLER ( pic8259_64be_1_w ) { write64be_with_write8_handler(pic8259_1_w, machine, offset, data, mem_mask); }
374   pic8259->timer = timer_alloc( pic8259_timerproc, (void *)device );
375
376   pic8259->state = STATE_ICW1;   /* It is unclear from the original code whether this is correct */
377   pic8259->irq_lines = 0;
378   pic8259->in_service = 0;
379   pic8259->pending = 0;
380   pic8259->prio = 0;
381   pic8259->interrupt_mask = 0;
382   pic8259->input = 0;
383   pic8259->special = 0;
384   pic8259->level_trig_mode = 0;
385   pic8259->vector_size = 0;
386   pic8259->cascade = 0;
387   pic8259->icw4_needed = 0;
388   pic8259->base = 0;
389   pic8259->slave = 0;
390   pic8259->nested = 0;
391   pic8259->mode = 0;
392   pic8259->auto_eoi = 0;
393   pic8259->is_x86 = 0;
394}
395
396
397static DEVICE_SET_INFO( pic8259 ) {
398   switch ( state ) {
399      /* no parameters to set */
400   }
401}
402
403
404DEVICE_GET_INFO( pic8259 ) {
405   switch ( state ) {
406      /* --- the following bits of info are returned as 64-bit signed integers --- */
407      case DEVINFO_INT_TOKEN_BYTES:            info->i = sizeof(pic8259_t);            break;
408      case DEVINFO_INT_INLINE_CONFIG_BYTES:      info->i = 0;                        break;
409      case DEVINFO_INT_CLASS:                  info->i = DEVICE_CLASS_PERIPHERAL;         break;
410
411      /* --- the following bits of info are returned as pointers to data or functions --- */
412      case DEVINFO_FCT_SET_INFO:               info->set_info = DEVICE_SET_INFO_NAME(pic8259);   break;
413      case DEVINFO_FCT_START:                  info->start = DEVICE_START_NAME(pic8259);   break;
414      case DEVINFO_FCT_STOP:                  /* nothing */                        break;
415      case DEVINFO_FCT_RESET:                  info->reset = DEVICE_RESET_NAME(pic8259);   break;
416
417      /* --- the following bits of info are returned as NULL-terminated strings --- */
418      case DEVINFO_STR_NAME:                  info->s = "Intel PIC8259";               break;
419      case DEVINFO_STR_FAMILY:               info->s = "PIC8259";                  break;
420      case DEVINFO_STR_VERSION:               info->s = "1.00";                     break;
421      case DEVINFO_STR_SOURCE_FILE:            info->s = __FILE__;                     break;
422      case DEVINFO_STR_CREDITS:               info->s = "Copyright the MAME and MESS Teams";   break;
423   }
424}
425
src/emu/machine/pic8259.h
r2376r2377
44
55**********************************************************************/
66
7#ifndef PIC8259_H
8#define PIC8259_H
7#ifndef __PIC8259_H_
8#define __PIC8259_H_
99
10int pic8259_init(int count, void (*set_int_line)(int which, int interrupt));
11int pic8259_acknowledge(int which);
12void pic8259_set_irq_line(int which, int irq, int state);
10#define PIC8259   DEVICE_GET_INFO_NAME(pic8259)
1311
14READ8_HANDLER ( pic8259_0_r );
15READ8_HANDLER ( pic8259_1_r );
16WRITE8_HANDLER ( pic8259_0_w );
17WRITE8_HANDLER ( pic8259_1_w );
12typedef void (*pic8259_set_int_line_func)(const device_config *device, int interrupt);
13#define PIC8259_SET_INT_LINE(name)   void name(const device_config *device, int interrupt)
1814
19READ16_HANDLER ( pic8259_16le_0_r );
20READ16_HANDLER ( pic8259_16le_1_r );
21WRITE16_HANDLER ( pic8259_16le_0_w );
22WRITE16_HANDLER ( pic8259_16le_1_w );
15struct pic8259_interface {
16   /* Called when int line changes */
17   pic8259_set_int_line_func   set_int_line;
18};
2319
24READ32_HANDLER ( pic8259_32le_0_r );
25READ32_HANDLER ( pic8259_32le_1_r );
26WRITE32_HANDLER ( pic8259_32le_0_w );
27WRITE32_HANDLER ( pic8259_32le_1_w );
20DEVICE_GET_INFO(pic8259);
21READ8_DEVICE_HANDLER( pic8259_r );
22WRITE8_DEVICE_HANDLER( pic8259_w );
23int pic8259_acknowledge(const device_config *device);
24void pic8259_set_irq_line(const device_config *device, int irq, int state);
2825
29READ64_HANDLER ( pic8259_64be_0_r );
30READ64_HANDLER ( pic8259_64be_1_r );
31WRITE64_HANDLER ( pic8259_64be_0_w );
32WRITE64_HANDLER ( pic8259_64be_1_w );
33
34#endif /* PIC8259_H */
26#endif /* __PIC8259_H_ */
src/mess/includes/compis.h
r2376r2377
1717
1818extern const struct pit8253_config compis_pit8253_config;
1919extern const struct pit8253_config compis_pit8254_config;
20extern const struct pic8259_interface compis_pic8259_master_config;
21extern const struct pic8259_interface compis_pic8259_slave_config;
2022
2123DRIVER_INIT(compis);
2224MACHINE_RESET(compis);
r2376r2377
3133WRITE16_DEVICE_HANDLER (compis_pit_w);
3234
3335/* PIC 8259 (80150/80130) */
34READ16_HANDLER (compis_osp_pic_r);
35WRITE16_HANDLER (compis_osp_pic_w);
36READ16_DEVICE_HANDLER (compis_osp_pic_r);
37WRITE16_DEVICE_HANDLER (compis_osp_pic_w);
3638
3739/* PIT 8254 (80150/80130) */
3840READ16_DEVICE_HANDLER (compis_osp_pit_r);
src/mess/includes/at.h
r2376r2377
1212
1313/*----------- defined in machine/at.c -----------*/
1414
15extern const struct pic8259_interface at_pic8259_master_config;
16extern const struct pic8259_interface at_pic8259_slave_config;
17extern const struct pit8253_config at_pit8254_config;
1518extern const struct dma8237_interface at_dma8237_1_config;
1619extern const struct dma8237_interface at_dma8237_2_config;
1720
src/mess/includes/bebox.h
r2376r2377
1515extern const struct pit8253_config bebox_pit8254_config;
1616extern const struct dma8237_interface bebox_dma8237_1_config;
1717extern const struct dma8237_interface bebox_dma8237_2_config;
18extern const struct pic8259_interface bebox_pic8259_master_config;
19extern const struct pic8259_interface bebox_pic8259_slave_config;
1820
1921MACHINE_START( bebox );
2022MACHINE_RESET( bebox );
src/mess/includes/pc.h
r2376r2377
1010/*----------- defined in machine/pc.c -----------*/
1111
1212extern const struct dma8237_interface pc_dma8237_config;
13extern const struct pit8253_config pc_pit8253_config;
14extern const struct pic8259_interface pc_pic8259_master_config;
15extern const struct pic8259_interface pc_pic8259_slave_config;
1316
14void mess_init_pc_common(UINT32 flags);
17void mess_init_pc_common(UINT32 flags, void (*set_keyb_int_func)(int), void (*set_hdc_int_func)(int,int));
1518
1619READ8_HANDLER( pc_page_r );
1720WRITE8_HANDLER( pc_page_w );
src/mess/machine/at.c
r2376r2377
2323#include "includes/pc.h"
2424#include "includes/at.h"
2525#include "machine/pckeybrd.h"
26#include "audio/pc.h"
2627#include "audio/sblaster.h"
2728#include "machine/i82439tx.h"
2829
r2376r2377
3132
3233#define LOG_PORT80 0
3334
35static struct {
36   const device_config   *pic8259_master;
37   const device_config   *pic8259_slave;
38   const device_config *dma8237_1;
39   const device_config *dma8237_2;
40} at_devices;
41
3442static const SOUNDBLASTER_CONFIG soundblaster = { 1,5, {1,0} };
3543
3644
45/*************************************************************
46 *
47 * pic8259 configuration
48 *
49 *************************************************************/
3750
51static PIC8259_SET_INT_LINE( at_pic8259_master_set_int_line ) {
52   cpunum_set_input_line(device->machine, 0, 0, interrupt ? HOLD_LINE : CLEAR_LINE);
53}
54
55
56static PIC8259_SET_INT_LINE( at_pic8259_slave_set_int_line ) {
57   pic8259_set_irq_line( at_devices.pic8259_master, 2, interrupt);
58}
59
60
61const struct pic8259_interface at_pic8259_master_config = {
62   at_pic8259_master_set_int_line
63};
64
65
66const struct pic8259_interface at_pic8259_slave_config = {
67   at_pic8259_slave_set_int_line
68};
69
70
71
72/*************************************************************
73 *
74 * pit8254 configuration
75 *
76 *************************************************************/
77
78static PIT8253_OUTPUT_CHANGED( pc_timer0_w )
79{
80   if ( at_devices.pic8259_master ) {
81      pic8259_set_irq_line(at_devices.pic8259_master, 0, state);
82   }
83}
84
85
86const struct pit8253_config at_pit8254_config =
87{
88   {
89      {
90         4772720/4,            /* heartbeat IRQ */
91         pc_timer0_w,
92         NULL
93      }, {
94         4772720/4,            /* dram refresh */
95         NULL,
96         NULL
97      }, {
98         4772720/4,            /* pio port c pin 4, and speaker polling enough */
99         NULL,
100         pc_sh_speaker_change_clock
101      }
102   }
103};
104
105
38106static void at_set_gate_a20(int a20)
39107{
40108   /* set the CPU's A20 line */
r2376r2377
42110}
43111
44112
113static void at_set_irq_line(int irq, int state) {
114   pic8259_set_irq_line(at_devices.pic8259_master, irq, state);
115}
45116
117
118static void at_set_keyb_int(int state) {
119   pic8259_set_irq_line(at_devices.pic8259_master, 1, state);
120}
121
122
46123static void init_at_common(const struct kbdc8042_interface *at8042)
47124{
48   mess_init_pc_common(PCCOMMON_KEYBOARD_AT);
125   mess_init_pc_common(PCCOMMON_KEYBOARD_AT, at_set_keyb_int, at_set_irq_line);
49126   mc146818_init(MC146818_STANDARD);
50127   soundblaster_config(&soundblaster);
51128   kbdc8042_init(at8042);
r2376r2377
63140
64141static void at_keyboard_interrupt(int state)
65142{
66   pic8259_set_irq_line(0, 1, state);
143   pic8259_set_irq_line(at_devices.pic8259_master, 1, state);
67144}
68145
69146
r2376r2377
213290
214291static void at_fdc_interrupt(int state)
215292{
216   pic8259_set_irq_line(0, 6, state);
293   pic8259_set_irq_line(at_devices.pic8259_master, 6, state);
217294}
218295
219296
r2376r2377
326403
327404static IRQ_CALLBACK(at_irq_callback)
328405{
329   return pic8259_acknowledge(0);
406   return pic8259_acknowledge( at_devices.pic8259_master);
330407}
331408
332409
r2376r2377
341418
342419MACHINE_RESET( at )
343420{
421   at_devices.pic8259_master = (device_config*)device_list_find_by_tag( machine->config->devicelist, PIC8259, "pic8259_master" );
422   at_devices.pic8259_slave = (device_config*)device_list_find_by_tag( machine->config->devicelist, PIC8259, "pic8259_slave" );
423   at_devices.dma8237_1 = (device_config*)device_list_find_by_tag( machine->config->devicelist, DMA8237, "dma8237_1" );
424   at_devices.dma8237_2 = (device_config*)device_list_find_by_tag( machine->config->devicelist, DMA8237, "dma8237_2" );
344425}
345426
src/mess/machine/pc_hdc.c
r2376r2377
101101static UINT8 *buffer;               /* data buffer */
102102static UINT8 *ptr = 0;               /* data pointer */
103103static UINT8 hdc_control;
104static void (*hdc_set_irq)(int,int);
104105
105106static const char *const hdc_command_names[] =
106107{
r2376r2377
165166
166167static TIMER_CALLBACK(pc_hdc_command);
167168
168int pc_hdc_setup(void)
169int pc_hdc_setup(void (*hdc_set_irq_func)(int,int))
169170{
170171   int i;
171172
172173   hdc_control = 0;
174   hdc_set_irq = hdc_set_irq_func;
173175
174176   buffer = auto_malloc(17*4*512);
175177
r2376r2377
205207   /* dip switch selected INT 5 or 2 */
206208   irq = (dip[n] & 0x40) ? 5 : 2;
207209
208   pic8259_set_irq_line(0, irq, 1);
209   pic8259_set_irq_line(0, irq, 0);
210   if ( hdc_set_irq ) {
211      hdc_set_irq( irq, 1 );
212      hdc_set_irq( irq, 0 );
213   }
210214
211215   if (LOG_HDC_STATUS)
212216      logerror("pc_hdc_result(): $%02x to $%04x\n", csb[n], data_cnt);
src/mess/machine/pc_hdc.h
r2376r2377
33
44#include "driver.h"
55
6int pc_hdc_setup(void);
6int pc_hdc_setup(void (*hdc_set_irq_func)(int,int));
77
88READ8_HANDLER  ( pc_HDC1_r );
99WRITE8_HANDLER ( pc_HDC1_w );
src/mess/machine/bebox.c
r2376r2377
119119static UINT32 bebox_interrupts;
120120static UINT32 bebox_crossproc_interrupts;
121121
122static struct {
123   const device_config   *pic8259_master;
124   const device_config   *pic8259_slave;
125   const device_config *dma8237_1;
126   const device_config *dma8237_2;
127} bebox_devices;
122128
129
123130/*************************************
124131 *
125132 *   Interrupts and Motherboard Registers
r2376r2377
370377static void bebox_fdc_interrupt(int state)
371378{
372379   bebox_set_irq_bit(Machine, 13, state);
373   pic8259_set_irq_line(0, 6, state);
380   if ( bebox_devices.pic8259_master ) {
381      pic8259_set_irq_line(bebox_devices.pic8259_master, 6, state);
382   }
374383}
375384
376385
377386static void bebox_fdc_dma_drq(int state, int read_)
378387{
379   dma8237_drq_write(0, FDC_DMA, state);
388   if ( bebox_devices.dma8237_1 ) {
389      dma8237_drq_write(bebox_devices.dma8237_1, FDC_DMA, state);
390   }
380391}
381392
382393
r2376r2377
407418READ64_HANDLER( bebox_interrupt_ack_r )
408419{
409420   int result;
410   result = pic8259_acknowledge(0);
421   result = pic8259_acknowledge( bebox_devices.pic8259_master );
411422   if (result == 2)
412      result = pic8259_acknowledge(1);
423      result = pic8259_acknowledge( bebox_devices.pic8259_slave );
413424   bebox_set_irq_bit(machine, 5, 0);   /* HACK */
414425   return ((UINT64) result) << 56;
415426}
416427
417428
429/*************************************************************
430 *
431 * pic8259 configuration
432 *
433 *************************************************************/
434 
435static PIC8259_SET_INT_LINE( bebox_pic8259_master_set_int_line ) {
436   bebox_set_irq_bit(device->machine, 5, interrupt);
437}
418438
419static void bebox_pic_set_int_line(int which, int interrupt)
420{
421   switch(which)
422   {
423      case 0:
424         /* Master */
425         bebox_set_irq_bit(Machine, 5, interrupt);
426         break;
427439
428      case 1:
429         /* Slave */
430         pic8259_set_irq_line(0, 2, interrupt);
431         break;
440static PIC8259_SET_INT_LINE( bebox_pic8259_slave_set_int_line ) {
441   if ( bebox_devices.pic8259_master ) {
442      pic8259_set_irq_line( bebox_devices.pic8259_master, 2, interrupt );
432443   }
433444}
434445
435446
447const struct pic8259_interface bebox_pic8259_master_config = {
448   bebox_pic8259_master_set_int_line
449};
436450
451
452const struct pic8259_interface bebox_pic8259_slave_config = {
453   bebox_pic8259_slave_set_int_line
454};
455
456
437457/*************************************
438458 *
439459 *   Floppy/IDE/ATA
r2376r2377
481501static void bebox_ide_interrupt(int state)
482502{
483503   bebox_set_irq_bit(Machine, 7, state);
484   pic8259_set_irq_line(1, 6, state);
504   if ( bebox_devices.pic8259_master ) {
505      pic8259_set_irq_line( bebox_devices.pic8259_master, 6, state);
506   }
485507}
486508
487509
r2376r2377
729751
730752static void bebox_timer0_w(const device_config *device, int state)
731753{
732   pic8259_set_irq_line(0, 0, state);
754   if ( bebox_devices.pic8259_master ) {
755      pic8259_set_irq_line(bebox_devices.pic8259_master, 0, state);
756   }
733757}
734758
735759
r2376r2377
796820static void bebox_keyboard_interrupt(int state)
797821{
798822   bebox_set_irq_bit(Machine, 16, state);
799   pic8259_set_irq_line(0, 1, state);
823   if ( bebox_devices.pic8259_master ) {
824      pic8259_set_irq_line( bebox_devices.pic8259_master, 1, state);
825   }
800826}
801827
802828static int bebox_get_out2(running_machine *machine) {
r2376r2377
9931019};
9941020
9951021
1022static TIMER_CALLBACK( bebox_get_devices ) {
1023   bebox_devices.pic8259_master = (device_config*)device_list_find_by_tag( machine->config->devicelist, PIC8259, "pic8259_master" );
1024   bebox_devices.pic8259_slave = (device_config*)device_list_find_by_tag( machine->config->devicelist, PIC8259, "pic8259_slave" );
1025   bebox_devices.dma8237_1 = (device_config*)device_list_find_by_tag( machine->config->devicelist, DMA8237, "dma8237_1" );
1026   bebox_devices.dma8237_2 = (device_config*)device_list_find_by_tag( machine->config->devicelist, DMA8237, "dma8237_2" );
1027}
1028
1029
9961030/*************************************
9971031 *
9981032 *   Driver main
r2376r2377
10061040
10071041MACHINE_RESET( bebox )
10081042{
1043   bebox_devices.pic8259_master = NULL;
1044   bebox_devices.pic8259_slave = NULL;
1045   bebox_devices.dma8237_1 = NULL;
1046   bebox_devices.dma8237_2 = NULL;
1047
1048   timer_set( attotime_zero, NULL, 0, bebox_get_devices );
1049
10091050   cpunum_set_input_line(machine, 0, INPUT_LINE_RESET, CLEAR_LINE);
10101051   cpunum_set_input_line(machine, 1, INPUT_LINE_RESET, ASSERT_LINE);
10111052   ide_controller_reset(0);
r2376r2377
10521093
10531094//   pc_fdc_init(&bebox_fdc_interface);
10541095   mc146818_init(MC146818_STANDARD);
1055   pic8259_init(2, bebox_pic_set_int_line);
10561096   ide_controller_init_custom(0, &bebox_ide_interface, NULL);
10571097   pc_vga_init(machine, &bebox_vga_interface, &cirrus_svga_interface);
10581098   kbdc8042_init(&bebox_8042_interface);
src/mess/machine/pc.c
r2376r2377
4848#include "machine/8237dma.h"
4949
5050
51static struct {
52   const device_config *pic8259_master;
53   const device_config *pic8259_slave;
54   const device_config *dma8237_1;
55   const device_config *dma8237_2;
56} pc_devices;
57
5158/*************************************************************************
5259 *
5360 *      PC DMA stuff
r2376r2377
143150};
144151
145152
153/*************************************************************
154 *
155 * pic8259 configuration
156 *
157 *************************************************************/
158
159static PIC8259_SET_INT_LINE( pc_pic8259_master_set_int_line ) {
160   cpunum_set_input_line(device->machine, 0, 0, interrupt ? HOLD_LINE : CLEAR_LINE);
161}
162
163
164static PIC8259_SET_INT_LINE( pc_pic8259_slave_set_int_line ) {
165   pic8259_set_irq_line( pc_devices.pic8259_master, 2, interrupt);
166}
167
168
169const struct pic8259_interface pc_pic8259_master_config = {
170   pc_pic8259_master_set_int_line
171};
172
173
174const struct pic8259_interface pc_pic8259_slave_config = {
175   pc_pic8259_slave_set_int_line
176};
177
178
179/*************************************************************
180 *
181 * pit8253 configuration
182 *
183 *************************************************************/
184
185static PIT8253_OUTPUT_CHANGED( pc_timer0_w )
186{
187   pic8259_set_irq_line(pc_devices.pic8259_master, 0, state);
188}
189 
190
191const struct pit8253_config pc_pit8253_config =
192{
193   {
194      {
195         4772720/4,            /* heartbeat IRQ */
196         pc_timer0_w,
197         NULL
198      }, {
199         4772720/4,            /* dram refresh */
200         NULL,
201         NULL
202      }, {
203         4772720/4,            /* pio port c pin 4, and speaker polling enough */
204         NULL,
205         pc_sh_speaker_change_clock
206      }
207   }
208};
209
210
146211/**********************************************************
147212 *
148213 * COM hardware
r2376r2377
155220   static const int irq[4] = {4, 3, 4, 3};
156221
157222   /* issue COM1/3 IRQ4, COM2/4 IRQ3 */
158   pic8259_set_irq_line(0, irq[nr], state);
223   pic8259_set_irq_line(pc_devices.pic8259_master, irq[nr], state);
159224}
160225
161226/* called when com registers read/written - used to update peripherals that
r2376r2377
253318
254319static void pc_fdc_interrupt(int state)
255320{
256   pic8259_set_irq_line(0, 6, state);
321   if ( pc_devices.pic8259_master ) {
322      pic8259_set_irq_line(pc_devices.pic8259_master, 6, state);
323   }
257324}
258325
259326static void pc_fdc_dma_drq(int state, int read_)
r2376r2377
270337   pc_fdc_dma_drq,
271338};
272339
340static void pc_set_irq_line(int irq, int state) {
341   pic8259_set_irq_line(pc_devices.pic8259_master, irq, state);
342}
273343
274void mess_init_pc_common(UINT32 flags) {
275   init_pc_common(flags);
344static void pc_set_keyb_int(int state) {
345   pc_set_irq_line( 1, state );
346}
276347
348void mess_init_pc_common(UINT32 flags, void (*set_keyb_int_func)(int), void (*set_hdc_int_func)(int,int)) {
349   init_pc_common(flags, set_keyb_int_func);
350
277351   /* MESS managed RAM */
278352   if ( mess_ram )
279353      memory_set_bankptr( 10, mess_ram );
280354
281355   /* FDC/HDC hardware */
282   pc_hdc_setup();
356   pc_hdc_setup(set_hdc_int_func);
283357
284358   /* com hardware */
285359   uart8250_init(0, com_interface);
r2376r2377
308382
309383DRIVER_INIT( pccga )
310384{
311   mess_init_pc_common(PCCOMMON_KEYBOARD_PC);
385   mess_init_pc_common(PCCOMMON_KEYBOARD_PC, pc_set_keyb_int, pc_set_irq_line);
312386   ppi8255_init(&pc_ppi8255_interface);
313387   pc_rtc_init();
314388   pc_turbo_setup(0, 3, 0x02, 4.77/12, 1);
r2376r2377
316390
317391DRIVER_INIT( bondwell )
318392{
319   mess_init_pc_common(PCCOMMON_KEYBOARD_PC);
393   mess_init_pc_common(PCCOMMON_KEYBOARD_PC, pc_set_keyb_int, pc_set_irq_line);
320394   ppi8255_init(&pc_ppi8255_interface);
321395   pc_turbo_setup(0, 3, 0x02, 4.77/12, 1);
322396}
323397
324398DRIVER_INIT( pcmda )
325399{
326   mess_init_pc_common(PCCOMMON_KEYBOARD_PC);
400   mess_init_pc_common(PCCOMMON_KEYBOARD_PC, pc_set_keyb_int, pc_set_irq_line);
327401   ppi8255_init(&pc_ppi8255_interface);
328402   pc_turbo_setup(0, 3, 0x02, 4.77/12, 1);
329403}
r2376r2377
349423      rom[0xfffff]=256-a;
350424   }
351425
352   mess_init_pc_common(PCCOMMON_KEYBOARD_PC);
426   mess_init_pc_common(PCCOMMON_KEYBOARD_PC, pc_set_keyb_int, pc_set_irq_line);
353427
354428   europc_rtc_init();
355429//   europc_rtc_set_time(machine);
r2376r2377
362436    /* just a plain bit pattern for graphics data generation */
363437    for (i = 0; i < 256; i++)
364438      gfx[i] = i;
365   mess_init_pc_common(PCCOMMON_KEYBOARD_PC);
439   mess_init_pc_common(PCCOMMON_KEYBOARD_PC, pc_set_keyb_int, pc_set_irq_line);
366440   pc_turbo_setup(0, 3, 0x02, 4.77/12, 1);
367441}
368442
r2376r2377
381455   videoram=memory_region(REGION_CPU1)+0xb0000;
382456   memory_install_read16_handler(0, ADDRESS_SPACE_IO, 0x278, 0x27b, 0, 0, pc200_16le_port378_r );
383457
384   mess_init_pc_common(PCCOMMON_KEYBOARD_PC);
458   mess_init_pc_common(PCCOMMON_KEYBOARD_PC, pc_set_keyb_int, pc_set_irq_line);
385459}
386460
387461DRIVER_INIT( pc1512 )
r2376r2377
402476   memory_install_read16_handler(0, ADDRESS_SPACE_IO, 0x278, 0x27b, 0, 0, pc16le_parallelport2_r );
403477
404478
405   mess_init_pc_common(PCCOMMON_KEYBOARD_PC);
479   mess_init_pc_common(PCCOMMON_KEYBOARD_PC, pc_set_keyb_int, pc_set_irq_line);
406480   mc146818_init(MC146818_IGNORE_CENTURY);
407481}
408482
r2376r2377
465539   memory_install_read16_handler(0, ADDRESS_SPACE_IO, 0x278, 0x27b, 0, 0, pc1640_16le_port278_r );
466540   memory_install_read16_handler(0, ADDRESS_SPACE_IO, 0x4278, 0x427b, 0, 0, pc1640_16le_port4278_r );
467541
468   mess_init_pc_common(PCCOMMON_KEYBOARD_PC);
542   mess_init_pc_common(PCCOMMON_KEYBOARD_PC, pc_set_keyb_int, pc_set_irq_line);
469543
470544   mc146818_init(MC146818_IGNORE_CENTURY);
471545}
472546
473547DRIVER_INIT( pc_vga )
474548{
475   mess_init_pc_common(PCCOMMON_KEYBOARD_PC);
549   mess_init_pc_common(PCCOMMON_KEYBOARD_PC, pc_set_keyb_int, pc_set_irq_line);
476550   ppi8255_init(&pc_ppi8255_interface);
477551
478552   pc_vga_init(machine, &vga_interface, NULL);
r2376r2377
480554
481555static IRQ_CALLBACK(pc_irq_callback)
482556{
483   return pic8259_acknowledge(0);
557   return pic8259_acknowledge( pc_devices.pic8259_master );
484558}
485559
486560
r2376r2377
492566MACHINE_RESET( pc )
493567{
494568   cpunum_set_irq_callback(0, pc_irq_callback);
569
570   pc_devices.pic8259_master = (device_config*)device_list_find_by_tag( machine->config->devicelist, PIC8259, "pic8259_master" );
571   pc_devices.pic8259_slave = (device_config*)device_list_find_by_tag( machine->config->devicelist, PIC8259, "pic8259_slave" );
572   pc_devices.dma8237_1 = (device_config*)device_list_find_by_tag( machine->config->devicelist, DMA8237, "dma8237_1" );
573   pc_devices.dma8237_2 = (device_config*)device_list_find_by_tag( machine->config->devicelist, DMA8237, "dma8237_2" );
495574}
496575
497576
src/mess/machine/compis.c
r2376r2377
9393   struct mem_state   mem;
9494} i186;
9595
96static struct {
97   const device_config   *pic8259_master;
98   const device_config   *pic8259_slave;
99} compis_devices;
100
96101/* Keyboard */
97102static const UINT8 compis_keyb_codes[6][16] = {
98103{0x39, 0x32, 0x29, 0x20, 0x17, 0x0e, 0x05, 0x56, 0x4d, 0x44, 0x08, 0x57, 0x59, 0x4e, 0x43, 0x3a},
r2376r2377
198203
199204static void compis_osp_pic_irq(UINT8 irq)
200205{
201   pic8259_set_irq_line(0, irq, 1);
202   pic8259_set_irq_line(0, irq, 0);
206   if ( compis_devices.pic8259_master ) {
207      pic8259_set_irq_line(compis_devices.pic8259_master, irq, 1);
208      pic8259_set_irq_line(compis_devices.pic8259_master, irq, 0);
209   }
203210}
204211
205READ16_HANDLER ( compis_osp_pic_r )
212READ16_DEVICE_HANDLER ( compis_osp_pic_r )
206213{
207   return pic8259_0_r(machine, offset);
214   return pic8259_r(device, offset);
208215}
209216
210WRITE16_HANDLER ( compis_osp_pic_w )
217WRITE16_DEVICE_HANDLER ( compis_osp_pic_w )
211218{
212   pic8259_0_w(machine, offset, data);
219   pic8259_w(device, offset, data);
213220}
214221
215222/*-------------------------------------------------------------------------*/
r2376r2377
15401547/* Name: compis                                                            */
15411548/* Desc: Driver - Init                                                     */
15421549/*-------------------------------------------------------------------------*/
1543static void compis_pic_set_int_line(int which, int interrupt)
1544{
1545   switch(which)
1546   {
1547      case 0:
1548         /* Master */
1549         cpunum_set_input_line(Machine, 0, 0, interrupt ? HOLD_LINE : CLEAR_LINE);
1550         break;
15511550
1552      case 1:
1553         /* Slave */
1554         pic8259_set_irq_line(0, 2, interrupt);
1555         break;
1551/*************************************************************
1552 *
1553 * pic8259 configuration
1554 *
1555 *************************************************************/
1556 
1557static PIC8259_SET_INT_LINE( compis_pic8259_master_set_int_line ) {
1558   cpunum_set_input_line(device->machine, 0, 0, interrupt ? HOLD_LINE : CLEAR_LINE);
1559}
1560
1561
1562static PIC8259_SET_INT_LINE( compis_pic8259_slave_set_int_line ) {
1563   if ( compis_devices.pic8259_master ) {
1564      pic8259_set_irq_line( compis_devices.pic8259_master, 2, interrupt);
15561565   }
15571566}
15581567
1568
1569const struct pic8259_interface compis_pic8259_master_config = {
1570   compis_pic8259_master_set_int_line
1571};
1572
1573
1574const struct pic8259_interface compis_pic8259_slave_config = {
1575   compis_pic8259_slave_set_int_line
1576};
1577
1578
15591579static IRQ_CALLBACK(compis_irq_callback)
15601580{
1561   return pic8259_acknowledge(0);
1581   return pic8259_acknowledge( compis_devices.pic8259_master);
15621582}
15631583
15641584static const compis_gdc_interface i82720_interface =
r2376r2377
15671587   0x8000
15681588};
15691589
1590
15701591DRIVER_INIT( compis )
15711592{
15721593   compis_init( &i82720_interface );
15731594   cpunum_set_irq_callback(0, compis_irq_callback);
1574   pic8259_init(2, compis_pic_set_int_line);
15751595   memset (&compis, 0, sizeof (compis) );
15761596}
15771597
r2376r2377
16021622
16031623   /* OSP PIC 8259 */
16041624   cpunum_set_irq_callback(0, compis_irq_callback);
1625
1626   compis_devices.pic8259_master = (device_config*)device_list_find_by_tag( machine->config->devicelist, PIC8259, "pic8259_master" );
1627   compis_devices.pic8259_slave = (device_config*)device_list_find_by_tag( machine->config->devicelist, PIC8259, "pic8259_slave" );
16051628}
16061629
16071630/*-------------------------------------------------------------------------*/
src/mess/drivers/pasogo.c
r2376r2377
294294
295295static ADDRESS_MAP_START(pasogo_io, ADDRESS_SPACE_IO, 8)
296296//   ADDRESS_MAP_GLOBAL_MASK(0xfFFF)
297   AM_RANGE(0x0020, 0x0021) AM_READWRITE(pic8259_0_r,         pic8259_0_w)
297   AM_RANGE(0x0020, 0x0021) AM_DEVREADWRITE(PIC8259, "pic8259", pic8259_r, pic8259_w)
298298     AM_RANGE(0x26, 0x27) AM_READWRITE(vg230_io_r, vg230_io_w )
299299   AM_RANGE(0x0040, 0x0043) AM_DEVREADWRITE(PIT8254, "pit8254", pit8253_r, pit8253_w)
300300     AM_RANGE(0x6c, 0x6f) AM_READWRITE(ems_r, ems_w )
r2376r2377
394394
395395static IRQ_CALLBACK(pasogo_irq_callback)
396396{
397   return pic8259_acknowledge(0);
397   return pic8259_acknowledge( (device_config*)device_list_find_by_tag( machine->config->devicelist, PIC8259, "pic8259"));
398398}
399399
400400static MACHINE_RESET( pasogo )
r2376r2377
406406
407407static PIT8253_OUTPUT_CHANGED( pc_timer0_w )
408408{
409   pic8259_set_irq_line(0, 0, state);
409   pic8259_set_irq_line((device_config*)device_list_find_by_tag( device->machine->config->devicelist, PIC8259, "pic8259"), 0, state);
410410}
411411
412412static const struct pit8253_config pc_pit8254_config =
r2376r2377
428428   }
429429};
430430
431
432static PIC8259_SET_INT_LINE( pasogo_pic8259_set_int_line ) {
433   cpunum_set_input_line(device->machine, 0, 0, interrupt ? HOLD_LINE : CLEAR_LINE);
434}
435
436
437static const struct pic8259_interface pasogo_pic8259_config = {
438   pasogo_pic8259_set_int_line
439};
440
441
431442static MACHINE_DRIVER_START( pasogo )
432443     MDRV_CPU_ADD_TAG("main", I80188/*V30HL in vadem vg230*/, 10000000/*?*/)
433444MDRV_CPU_PROGRAM_MAP(pasogo_mem, 0)
r2376r2377
439450   MDRV_DEVICE_ADD( "pit8254", PIT8254 )
440451   MDRV_DEVICE_CONFIG( pc_pit8254_config )
441452
453   MDRV_DEVICE_ADD( "pic8259", PIC8259 )
454   MDRV_DEVICE_CONFIG( pasogo_pic8259_config )
455
442456     MDRV_SCREEN_ADD("main", LCD)
443457     MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
444458     MDRV_SCREEN_REFRESH_RATE(60)
r2376r2377
463477   ROM_REGION(0x100000,REGION_USER1, 0)
464478ROM_END
465479
466static void pasogo_pic_set_int_line(int which, int interrupt)
467{
468  cpunum_set_input_line(Machine, 0, 0, interrupt ? HOLD_LINE : CLEAR_LINE);
469}
470480
471481static DRIVER_INIT( pasogo )
472482{
r2376r2377
474484  memset(&ems, 0, sizeof(ems));
475485  memory_set_bankptr( 27, memory_region(REGION_USER1) + 0x00000 );
476486  memory_set_bankptr( 28, memory_region(REGION_CPU1) + 0xb8000/*?*/ );
477  pic8259_init(1, pasogo_pic_set_int_line);
478487}
479488
480489
src/mess/drivers/ip22.c
r2376r2377
14561456
14571457   // IP22 uses 2 pieces of PC-compatible hardware: the 8042 PS/2 keyboard/mouse
14581458   // interface and the 8254 PIT.  Both are licensed cores embedded in the IOC custom chip.
1459   init_pc_common(PCCOMMON_KEYBOARD_AT);
1459   init_pc_common(PCCOMMON_KEYBOARD_AT, NULL);
14601460   kbdc8042_init(&at8042);
14611461
14621462   // SCSI init
src/mess/drivers/at.c
r2376r2377
104104
105105
106106
107static READ8_HANDLER(at_dma8237_1_r)
107static READ8_DEVICE_HANDLER(at_dma8237_1_r)
108108{
109   return dma8237_r( (device_config*)device_list_find_by_tag( machine->config->devicelist, DMA8237, "dma8237_2" ), offset / 2);
109   return dma8237_r( device, offset / 2);
110110}
111111
112static WRITE8_HANDLER(at_dma8237_1_w)
112static WRITE8_DEVICE_HANDLER(at_dma8237_1_w)
113113{
114   dma8237_w( (device_config*)device_list_find_by_tag( machine->config->devicelist, DMA8237, "dma8237_2" ), offset / 2, data);
114   dma8237_w( device, offset / 2, data);
115115}
116116
117static READ32_HANDLER(at32_dma8237_1_r)
118{
119   return read32le_with_read8_handler(at_dma8237_1_r, machine, offset, mem_mask);
120}
121
122static WRITE32_HANDLER(at32_dma8237_1_w)
123{
124   write32le_with_write8_handler(at_dma8237_1_w, machine, offset, data, mem_mask);
125}
126
127117DEV_READWRITE8TO32LE_LSB( at_pit8254_32le, pit8253_r, pit8253_w )
128118DEV_READWRITE8TO32LE_LSB( at_dma8237_32le, dma8237_r, dma8237_w )
119DEV_READWRITE8TO32LE( at_pic8259_32le, pic8259_r, pic8259_w )
120DEV_READWRITE8TO32LE( at_dma8237_1_32le, at_dma8237_1_r, at_dma8237_1_w )
129121
130122
131123static ADDRESS_MAP_START(at_io, ADDRESS_SPACE_IO, 8)
132124   AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE(DMA8237, "dma8237_1", dma8237_r, dma8237_w)
133   AM_RANGE(0x0020, 0x003f) AM_READWRITE(pic8259_0_r,            pic8259_0_w)
125   AM_RANGE(0x0020, 0x003f) AM_DEVREADWRITE(PIC8259, "pic8259_master", pic8259_r, pic8259_w)
134126   AM_RANGE(0x0040, 0x005f) AM_DEVREADWRITE(PIT8254, AT_PIT8254, pit8253_r, pit8253_w)
135127   AM_RANGE(0x0060, 0x006f) AM_READWRITE(kbdc8042_8_r,            kbdc8042_8_w)
136128   AM_RANGE(0x0070, 0x007f) AM_READWRITE(mc146818_port_r,         mc146818_port_w)
137129   AM_RANGE(0x0080, 0x009f) AM_READWRITE(at_page8_r,            at_page8_w)
138   AM_RANGE(0x00a0, 0x00bf) AM_READWRITE(pic8259_1_r,            pic8259_1_w)
139   AM_RANGE(0x00c0, 0x00df) AM_READWRITE(at_dma8237_1_r,         at_dma8237_1_w)
130   AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE(PIC8259, "pic8259_slave", pic8259_r, pic8259_w)
131   AM_RANGE(0x00c0, 0x00df) AM_DEVREADWRITE(DMA8237, "dma8237_2", at_dma8237_1_r, at_dma8237_1_w)
140132   AM_RANGE(0x01f0, 0x01f7) AM_READWRITE(at_mfm_0_r,            at_mfm_0_w)
141133   AM_RANGE(0x0200, 0x0207) AM_READWRITE(pc_JOY_r,               pc_JOY_w)
142134   AM_RANGE(0x0220, 0x022f) AM_READWRITE(soundblaster_r,         soundblaster_w)
r2376r2377
171163
172164static ADDRESS_MAP_START(at386_io, ADDRESS_SPACE_IO, 32)
173165   AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE(DMA8237, "dma8237_1", at_dma8237_32le_r, at_dma8237_32le_w)
174   AM_RANGE(0x0020, 0x003f) AM_READWRITE(pic8259_32le_0_r,         pic8259_32le_0_w)
166   AM_RANGE(0x0020, 0x003f) AM_DEVREADWRITE(PIC8259, "pic8259_master", at_pic8259_32le_r, at_pic8259_32le_w)
175167   AM_RANGE(0x0040, 0x005f) AM_DEVREADWRITE(PIT8254, AT_PIT8254, at_pit8254_32le_r, at_pit8254_32le_w)
176168   AM_RANGE(0x0060, 0x006f) AM_READWRITE(kbdc8042_32le_r,         kbdc8042_32le_w)
177169   AM_RANGE(0x0070, 0x007f) AM_READWRITE(mc146818_port32le_r,      mc146818_port32le_w)
178170   AM_RANGE(0x0080, 0x009f) AM_READWRITE(at_page32_r,            at_page32_w)
179   AM_RANGE(0x00a0, 0x00bf) AM_READWRITE(pic8259_32le_1_r,         pic8259_32le_1_w)
180   AM_RANGE(0x00c0, 0x00df) AM_READWRITE(at32_dma8237_1_r,         at32_dma8237_1_w)
171   AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE(PIC8259, "pic8259_slave", at_pic8259_32le_r, at_pic8259_32le_w)
172   AM_RANGE(0x00c0, 0x00df) AM_DEVREADWRITE(DMA8237, "dma8237_2", at_dma8237_1_32le_r, at_dma8237_1_32le_w)
181173   AM_RANGE(0x0278, 0x027f) AM_READWRITE(pc32le_parallelport2_r,   pc32le_parallelport2_w)
182174   AM_RANGE(0x02e8, 0x02ef) AM_READWRITE(uart8250_32le_3_r,      uart8250_32le_3_w)
183175   AM_RANGE(0x02f8, 0x02ff) AM_READWRITE(uart8250_32le_1_r,      uart8250_32le_1_w)
r2376r2377
193185
194186static ADDRESS_MAP_START(at586_io, ADDRESS_SPACE_IO, 32)
195187   AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE(DMA8237, "dma8237_1", at_dma8237_32le_r, at_dma8237_32le_w)
196   AM_RANGE(0x0020, 0x003f) AM_READWRITE(pic8259_32le_0_r,         pic8259_32le_0_w)
188   AM_RANGE(0x0020, 0x003f) AM_DEVREADWRITE(PIC8259, "pic8259_master", at_pic8259_32le_r, at_pic8259_32le_w)
197189   AM_RANGE(0x0040, 0x005f) AM_DEVREADWRITE(PIT8254, AT_PIT8254, at_pit8254_32le_r, at_pit8254_32le_w)
198190   AM_RANGE(0x0060, 0x006f) AM_READWRITE(kbdc8042_32le_r,         kbdc8042_32le_w)
199191   AM_RANGE(0x0070, 0x007f) AM_READWRITE(mc146818_port32le_r,      mc146818_port32le_w)
200192   AM_RANGE(0x0080, 0x009f) AM_READWRITE(at_page32_r,            at_page32_w)
201   AM_RANGE(0x00a0, 0x00bf) AM_READWRITE(pic8259_32le_1_r,         pic8259_32le_1_w)
202   AM_RANGE(0x00c0, 0x00df) AM_READWRITE(at32_dma8237_1_r,         at32_dma8237_1_w)
193   AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE(PIC8259, "pic8259_slave", at_pic8259_32le_r, at_pic8259_32le_w)
194   AM_RANGE(0x00c0, 0x00df) AM_DEVREADWRITE(DMA8237, "dma8237_2", at_dma8237_1_32le_r, at_dma8237_1_32le_w)
203195   AM_RANGE(0x0278, 0x027f) AM_READWRITE(pc32le_parallelport2_r,      pc32le_parallelport2_w)
204196   AM_RANGE(0x02e8, 0x02ef) AM_READWRITE(uart8250_32le_3_r,      uart8250_32le_3_w)
205197   AM_RANGE(0x02f8, 0x02ff) AM_READWRITE(uart8250_32le_1_r,      uart8250_32le_1_w)
r2376r2377
420412#endif
421413
422414
423static PIT8253_OUTPUT_CHANGED( pc_timer0_w )
424{
425   pic8259_set_irq_line(0, 0, state);
426}
427
428
429static const struct pit8253_config at_pit8254_config =
430{
431   {
432      {
433         4772720/4,            /* heartbeat IRQ */
434         pc_timer0_w,
435         NULL
436      }, {
437         4772720/4,            /* dram refresh */
438         NULL,
439         NULL
440      }, {
441         4772720/4,            /* pio port c pin 4, and speaker polling enough */
442         NULL,
443         pc_sh_speaker_change_clock
444      }
445   }
446};
447
448
449
450415#define MDRV_CPU_ATPC(mem, port, type, clock)   \
451416   MDRV_CPU_ADD_TAG("main", type, clock)               \
452417   MDRV_CPU_PROGRAM_MAP(mem##_map, 0)            \
r2376r2377
466431   MDRV_DEVICE_ADD( "dma8237_2", DMA8237 )
467432   MDRV_DEVICE_CONFIG( at_dma8237_2_config )
468433
434   MDRV_DEVICE_ADD( "pic8259_master", PIC8259 )
435   MDRV_DEVICE_CONFIG( at_pic8259_master_config )
436
437   MDRV_DEVICE_ADD( "pic8259_slave", PIC8259 )
438   MDRV_DEVICE_CONFIG( at_pic8259_slave_config )
439
469440   MDRV_MACHINE_START( at )
470441   MDRV_MACHINE_RESET( at )
471442
r2376r2377
510481   MDRV_DEVICE_ADD( "dma8237_2", DMA8237 )
511482   MDRV_DEVICE_CONFIG( at_dma8237_2_config )
512483
484   MDRV_DEVICE_ADD( "pic8259_master", PIC8259 )
485   MDRV_DEVICE_CONFIG( at_pic8259_master_config )
486
487   MDRV_DEVICE_ADD( "pic8259_slave", PIC8259 )
488   MDRV_DEVICE_CONFIG( at_pic8259_slave_config )
489
490   MDRV_MACHINE_START( at )
491   MDRV_MACHINE_RESET( at )
492
513493   MDRV_IMPORT_FROM( pcvideo_vga )
514494
515495   MDRV_SCREEN_MODIFY("main")
r2376r2377
555535   MDRV_DEVICE_ADD( "dma8237_2", DMA8237 )
556536   MDRV_DEVICE_CONFIG( at_dma8237_2_config )
557537
538   MDRV_DEVICE_ADD( "pic8259_master", PIC8259 )
539   MDRV_DEVICE_CONFIG( at_pic8259_master_config )
540
541   MDRV_DEVICE_ADD( "pic8259_slave", PIC8259 )
542   MDRV_DEVICE_CONFIG( at_pic8259_slave_config )
543
558544   MDRV_IMPORT_FROM( pcvideo_vga )
559545
560546   MDRV_SCREEN_MODIFY("main")
r2376r2377
609595   MDRV_DEVICE_ADD( "dma8237_2", DMA8237 )
610596   MDRV_DEVICE_CONFIG( at_dma8237_2_config )
611597
598   MDRV_DEVICE_ADD( "pic8259_master", PIC8259 )
599   MDRV_DEVICE_CONFIG( at_pic8259_master_config )
600
601   MDRV_DEVICE_ADD( "pic8259_slave", PIC8259 )
602   MDRV_DEVICE_CONFIG( at_pic8259_slave_config )
603
612604   MDRV_IMPORT_FROM( pcvideo_cga )
613605
614606   /* sound hardware */
src/mess/drivers/bebox.c
r2376r2377
4949
5050DEV_READWRITE8TO64BE( bebox_pit8254_64be, pit8253_r, pit8253_w )
5151DEV_READWRITE8TO64BE( bebox_dma8237_64be, dma8237_r, dma8237_w )
52DEV_READWRITE8TO64BE( bebox_pic8259_64be, pic8259_r, pic8259_w )
5253
5354
5455static ADDRESS_MAP_START( bebox_mem, ADDRESS_SPACE_PROGRAM, 64 )
r2376r2377
5960   AM_RANGE(0x7FFFF4F0, 0x7FFFF4F7) AM_WRITE( bebox_processor_resets_w )
6061
6162   AM_RANGE(0x80000000, 0x8000001F) AM_DEVREADWRITE( DMA8237, "dma8237_1", bebox_dma8237_64be_r, bebox_dma8237_64be_w )
62   AM_RANGE(0x80000020, 0x8000003F) AM_READWRITE( pic8259_64be_0_r, pic8259_64be_0_w )
63   AM_RANGE(0x80000020, 0x8000003F) AM_DEVREADWRITE( PIC8259, "pic8259_master", bebox_pic8259_64be_r, bebox_pic8259_64be_w )
6364   AM_RANGE(0x80000040, 0x8000005f) AM_DEVREADWRITE(PIT8254, "pit8254", bebox_pit8254_64be_r, bebox_pit8254_64be_w)
6465   AM_RANGE(0x80000060, 0x8000006F) AM_READWRITE( kbdc8042_64be_r, kbdc8042_64be_w )
6566   AM_RANGE(0x80000070, 0x8000007F) AM_READWRITE( mc146818_port64be_r, mc146818_port64be_w )
6667   AM_RANGE(0x80000080, 0x8000009F) AM_READWRITE( bebox_page_r, bebox_page_w)
67   AM_RANGE(0x800000A0, 0x800000BF) AM_READWRITE( pic8259_64be_1_r, pic8259_64be_1_w )
68   AM_RANGE(0x800000A0, 0x800000BF) AM_DEVREADWRITE( PIC8259, "pic8259_slave", bebox_pic8259_64be_r, bebox_pic8259_64be_w )
6869   AM_RANGE(0x800000C0, 0x800000DF) AM_READWRITE( bebox_dma8237_1_r, bebox_dma8237_1_w)
6970   AM_RANGE(0x800001F0, 0x800001F7) AM_READWRITE( bebox_800001F0_r, bebox_800001F0_w )
7071   AM_RANGE(0x800002F8, 0x800002FF) AM_READWRITE( uart8250_64be_1_r, uart8250_64be_1_w )
r2376r2377
119120   MDRV_DEVICE_ADD( "dma8237_2", DMA8237 )
120121   MDRV_DEVICE_CONFIG( bebox_dma8237_2_config )
121122
123   MDRV_DEVICE_ADD( "pic8259_master", PIC8259 )
124   MDRV_DEVICE_CONFIG( bebox_pic8259_master_config )
125
126   MDRV_DEVICE_ADD( "pic8259_slave", PIC8259 )
127   MDRV_DEVICE_CONFIG( bebox_pic8259_slave_config )
128
122129   /* video hardware */
123130   MDRV_IMPORT_FROM( pcvideo_vga )
124131   MDRV_SCREEN_MODIFY("main")
src/mess/drivers/pc.c
r2376r2377
161161
162162static ADDRESS_MAP_START(pc8_io, ADDRESS_SPACE_IO, 8)
163163   AM_RANGE(0x0000, 0x000f) AM_DEVREADWRITE(DMA8237, "dma8237", dma8237_r, dma8237_w)
164   AM_RANGE(0x0020, 0x0021) AM_READWRITE(pic8259_0_r,         pic8259_0_w)
164   AM_RANGE(0x0020, 0x0021) AM_DEVREADWRITE(PIC8259, "pic8259_master", pic8259_r, pic8259_w)
165165   AM_RANGE(0x0040, 0x0043) AM_DEVREADWRITE(PIT8253, "pit8253", pit8253_r, pit8253_w)
166166   AM_RANGE(0x0060, 0x0063) AM_READWRITE(ppi8255_0_r,         ppi8255_0_w)
167167   AM_RANGE(0x0080, 0x0087) AM_READWRITE(pc_page_r,         pc_page_w)
r2376r2377
189189
190190DEV_READWRITE8TO16LE_LSB( pc_pit8253_16le, pit8253_r, pit8253_w )
191191DEV_READWRITE8TO16LE( pc_dma8237_16le, dma8237_r, dma8237_w )
192DEV_READWRITE8TO16LE( pc_pic8259_16le, pic8259_r, pic8259_w )
192193READ16_HANDLER(pc_page16le_r) { return read16le_with_read8_handler(pc_page_r, machine, offset, mem_mask); }
193194WRITE16_HANDLER(pc_page16le_w) { write16le_with_write8_handler(pc_page_w, machine, offset, data, mem_mask); }
194195
195196
196197static ADDRESS_MAP_START(pc16_io, ADDRESS_SPACE_IO, 16)
197198   AM_RANGE(0x0000, 0x000f) AM_DEVREADWRITE(DMA8237, "dma8237", pc_dma8237_16le_r, pc_dma8237_16le_w)
198   AM_RANGE(0x0020, 0x0021) AM_READWRITE(pic8259_16le_0_r,         pic8259_16le_0_w)
199   AM_RANGE(0x0020, 0x0021) AM_DEVREADWRITE(PIC8259, "pic8259_master", pc_pic8259_16le_r, pc_pic8259_16le_w)
199200   AM_RANGE(0x0040, 0x0043) AM_DEVREADWRITE(PIT8253, "pit8253", pc_pit8253_16le_r, pc_pit8253_16le_w)
200201   AM_RANGE(0x0060, 0x0063) AM_READWRITE(ppi8255_16le_0_r,         ppi8255_16le_0_w)
201202   AM_RANGE(0x0080, 0x0087) AM_READWRITE(pc_page16le_r,         pc_page16le_w)
r2376r2377
236237
237238static ADDRESS_MAP_START(europc_io, ADDRESS_SPACE_IO, 8)
238239   AM_RANGE(0x0000, 0x000f) AM_DEVREADWRITE(DMA8237, "dma8237", dma8237_r, dma8237_w)
239   AM_RANGE(0x0020, 0x0021) AM_READWRITE(pic8259_0_r,         pic8259_0_w)
240   AM_RANGE(0x0020, 0x0021) AM_DEVREADWRITE(PIC8259, "pic8259_master", pic8259_r, pic8259_w)
240241   AM_RANGE(0x0040, 0x0043) AM_DEVREADWRITE(PIT8253, "pit8253", pit8253_r, pit8253_w)
241242   AM_RANGE(0x0060, 0x0063) AM_READWRITE(europc_pio_r,         europc_pio_w)
242243   AM_RANGE(0x0080, 0x0087) AM_READWRITE(pc_page_r,         pc_page_w)
r2376r2377
276277
277278static ADDRESS_MAP_START(tandy1000_io, ADDRESS_SPACE_IO, 8)
278279   AM_RANGE(0x0000, 0x000f) AM_DEVREADWRITE(DMA8237, "dma8237", dma8237_r, dma8237_w)
279   AM_RANGE(0x0020, 0x0021) AM_READWRITE(pic8259_0_r,            pic8259_0_w)
280   AM_RANGE(0x0020, 0x0021) AM_DEVREADWRITE(PIC8259, "pic8259_master", pic8259_r, pic8259_w)
280281   AM_RANGE(0x0040, 0x0043) AM_DEVREADWRITE(PIT8253, "pit8253", pit8253_r, pit8253_w)
281282   AM_RANGE(0x0060, 0x0063) AM_READWRITE(tandy1000_pio_r,         tandy1000_pio_w)
282283   AM_RANGE(0x0080, 0x0087) AM_READWRITE(pc_page_r,            pc_page_w)
r2376r2377
296297
297298static ADDRESS_MAP_START(pc200_io, ADDRESS_SPACE_IO, 16)
298299   AM_RANGE(0x0000, 0x000f) AM_DEVREADWRITE(DMA8237, "dma8237", pc_dma8237_16le_r, pc_dma8237_16le_w)
299   AM_RANGE(0x0020, 0x0021) AM_READWRITE(pic8259_16le_0_r,            pic8259_16le_0_w)
300   AM_RANGE(0x0020, 0x0021) AM_DEVREADWRITE(PIC8259, "pic8259_master", pc_pic8259_16le_r, pc_pic8259_16le_w)
300301   AM_RANGE(0x0040, 0x0043) AM_DEVREADWRITE(PIT8253, "pit8253", pc_pit8253_16le_r, pc_pit8253_16le_w)
301302   AM_RANGE(0x0060, 0x0065) AM_READWRITE(pc1640_16le_port60_r,         pc1640_16le_port60_w)
302303   AM_RANGE(0x0078, 0x0079) AM_READWRITE(pc1640_16le_mouse_x_r,         pc1640_16le_mouse_x_w)
r2376r2377
329330
330331static ADDRESS_MAP_START(pc1640_io, ADDRESS_SPACE_IO, 16)
331332   AM_RANGE(0x0000, 0x000f) AM_DEVREADWRITE(DMA8237, "dma8237", pc_dma8237_16le_r, pc_dma8237_16le_w)
332   AM_RANGE(0x0020, 0x0021) AM_READWRITE(pic8259_16le_0_r,         pic8259_16le_0_w)
333   AM_RANGE(0x0020, 0x0021) AM_DEVREADWRITE(PIC8259, "pic8259_master", pc_pic8259_16le_r, pc_pic8259_16le_w)
333334   AM_RANGE(0x0040, 0x0043) AM_DEVREADWRITE(PIT8253, "pit8253", pc_pit8253_16le_r, pc_pit8253_16le_w)
334335   AM_RANGE(0x0060, 0x0065) AM_READWRITE(pc1640_16le_port60_r,         pc1640_16le_port60_w)
335336   AM_RANGE(0x0070, 0x0071) AM_READWRITE(mc146818_port16le_r,      mc146818_port16le_w)
r2376r2377
11321133};
11331134#endif
11341135
1135static PIT8253_OUTPUT_CHANGED( pc_timer0_w )
1136{
1137   pic8259_set_irq_line(0, 0, state);
1138}
1139 
11401136
1141static const struct pit8253_config pc_pit8253_config =
1142{
1143   {
1144      {
1145         4772720/4,            /* heartbeat IRQ */
1146         pc_timer0_w,
1147         NULL
1148      }, {
1149         4772720/4,            /* dram refresh */
1150         NULL,
1151         NULL
1152      }, {
1153         4772720/4,            /* pio port c pin 4, and speaker polling enough */
1154         NULL,
1155         pc_sh_speaker_change_clock
1156      }
1157   }
1158};
1159
1160
11611137#define MDRV_CPU_PC(mem, port, type, clock, vblankfunc)   \
11621138   MDRV_CPU_ADD_TAG("main", type, clock)            \
11631139   MDRV_CPU_PROGRAM_MAP(mem##_map, 0)         \
r2376r2377
11821158   MDRV_DEVICE_ADD( "dma8237", DMA8237 )
11831159   MDRV_DEVICE_CONFIG( pc_dma8237_config )
11841160
1161   MDRV_DEVICE_ADD( "pic8259_master", PIC8259 )
1162   MDRV_DEVICE_CONFIG( pc_pic8259_master_config )
1163
1164   MDRV_DEVICE_ADD( "pic8259_slave", PIC8259 )
1165   MDRV_DEVICE_CONFIG( pc_pic8259_slave_config )
1166
11851167   /* video hardware */
11861168   MDRV_IMPORT_FROM( pcvideo_mda )
11871169
r2376r2377
12231205   MDRV_DEVICE_ADD( "dma8237", DMA8237 )
12241206   MDRV_DEVICE_CONFIG( pc_dma8237_config )
12251207
1208   MDRV_DEVICE_ADD( "pic8259_master", PIC8259 )
1209   MDRV_DEVICE_CONFIG( pc_pic8259_master_config )
1210
1211   MDRV_DEVICE_ADD( "pic8259_slave", PIC8259 )
1212   MDRV_DEVICE_CONFIG( pc_pic8259_slave_config )
1213
12261214   /* video hardware */
12271215   MDRV_IMPORT_FROM( pcvideo_hercules )
12281216
r2376r2377
12601248   MDRV_DEVICE_ADD( "dma8237", DMA8237 )
12611249   MDRV_DEVICE_CONFIG( pc_dma8237_config )
12621250
1251   MDRV_DEVICE_ADD( "pic8259_master", PIC8259 )
1252   MDRV_DEVICE_CONFIG( pc_pic8259_master_config )
1253
1254   MDRV_DEVICE_ADD( "pic8259_slave", PIC8259 )
1255   MDRV_DEVICE_CONFIG( pc_pic8259_slave_config )
1256
12631257   /* video hardware */
12641258   MDRV_IMPORT_FROM( pcvideo_cga )
12651259
r2376r2377
12981292   MDRV_DEVICE_ADD( "dma8237", DMA8237 )
12991293   MDRV_DEVICE_CONFIG( pc_dma8237_config )
13001294
1295   MDRV_DEVICE_ADD( "pic8259_master", PIC8259 )
1296   MDRV_DEVICE_CONFIG( pc_pic8259_master_config )
1297
1298   MDRV_DEVICE_ADD( "pic8259_slave", PIC8259 )
1299   MDRV_DEVICE_CONFIG( pc_pic8259_slave_config )
1300
13011301   /* video hardware */
13021302   MDRV_IMPORT_FROM( pcvideo_aga )
13031303
r2376r2377
13321332   MDRV_DEVICE_ADD( "dma8237", DMA8237 )
13331333   MDRV_DEVICE_CONFIG( pc_dma8237_config )
13341334
1335   MDRV_DEVICE_ADD( "pic8259_master", PIC8259 )
1336   MDRV_DEVICE_CONFIG( pc_pic8259_master_config )
1337
1338   MDRV_DEVICE_ADD( "pic8259_slave", PIC8259 )
1339   MDRV_DEVICE_CONFIG( pc_pic8259_slave_config )
1340
13351341   /* video hardware */
13361342   MDRV_IMPORT_FROM( pcvideo_cga )
13371343
r2376r2377
13701376   MDRV_DEVICE_ADD( "dma8237", DMA8237 )
13711377   MDRV_DEVICE_CONFIG( pc_dma8237_config )
13721378
1379   MDRV_DEVICE_ADD( "pic8259_master", PIC8259 )
1380   MDRV_DEVICE_CONFIG( pc_pic8259_master_config )
1381
1382   MDRV_DEVICE_ADD( "pic8259_slave", PIC8259 )
1383   MDRV_DEVICE_CONFIG( pc_pic8259_slave_config )
1384
13731385   /* video hardware */
13741386   MDRV_IMPORT_FROM( pcvideo_pc200 )
13751387
r2376r2377
13971409   MDRV_DEVICE_ADD( "dma8237", DMA8237 )
13981410   MDRV_DEVICE_CONFIG( pc_dma8237_config )
13991411
1412   MDRV_DEVICE_ADD( "pic8259_master", PIC8259 )
1413   MDRV_DEVICE_CONFIG( pc_pic8259_master_config )
1414
1415   MDRV_DEVICE_ADD( "pic8259_slave", PIC8259 )
1416   MDRV_DEVICE_CONFIG( pc_pic8259_slave_config )
1417
14001418   /* video hardware */
14011419   MDRV_IMPORT_FROM( pcvideo_pc1512 )
14021420
r2376r2377
14261444   MDRV_DEVICE_ADD( "dma8237", DMA8237 )
14271445   MDRV_DEVICE_CONFIG( pc_dma8237_config )
14281446
1447   MDRV_DEVICE_ADD( "pic8259_master", PIC8259 )
1448   MDRV_DEVICE_CONFIG( pc_pic8259_master_config )
1449
1450   MDRV_DEVICE_ADD( "pic8259_slave", PIC8259 )
1451   MDRV_DEVICE_CONFIG( pc_pic8259_slave_config )
1452
14291453   /* video hardware */
14301454   MDRV_IMPORT_FROM(pcvideo_pc1640)
14311455   MDRV_SCREEN_MODIFY("main")
r2376r2377
14581482   MDRV_DEVICE_ADD( "dma8237", DMA8237 )
14591483   MDRV_DEVICE_CONFIG( pc_dma8237_config )
14601484
1485   MDRV_DEVICE_ADD( "pic8259_master", PIC8259 )
1486   MDRV_DEVICE_CONFIG( pc_pic8259_master_config )
1487
1488   MDRV_DEVICE_ADD( "pic8259_slave", PIC8259 )
1489   MDRV_DEVICE_CONFIG( pc_pic8259_slave_config )
1490
14611491   /* video hardware */
14621492   MDRV_IMPORT_FROM( pcvideo_vga )
14631493   MDRV_SCREEN_MODIFY("main")
r2376r2377
14961526   MDRV_DEVICE_ADD( "dma8237", DMA8237 )
14971527   MDRV_DEVICE_CONFIG( pc_dma8237_config )
14981528
1529   MDRV_DEVICE_ADD( "pic8259_master", PIC8259 )
1530   MDRV_DEVICE_CONFIG( pc_pic8259_master_config )
1531
1532   MDRV_DEVICE_ADD( "pic8259_slave", PIC8259 )
1533   MDRV_DEVICE_CONFIG( pc_pic8259_slave_config )
1534
14991535   /* video hardware */
15001536   MDRV_IMPORT_FROM( pcvideo_t1000 )
15011537
src/mess/drivers/compis.c
r2376r2377
3838#include "devices/mflopimg.h"
3939#include "devices/printer.h"
4040#include "machine/pit8253.h"
41#include "machine/pic8259.h"
4142#include "formats/cpis_dsk.h"
4243
4344
r2376r2377
5859   AM_RANGE( 0x0000, 0x0007) AM_READWRITE( compis_ppi_r, compis_ppi_w )   /* PPI 8255         */
5960   AM_RANGE( 0x0080, 0x0087) AM_DEVREADWRITE(PIT8253, "pit8253", compis_pit_r, compis_pit_w )   /* PIT 8253         */
6061   AM_RANGE( 0x0100, 0x011b) AM_READWRITE( compis_rtc_r, compis_rtc_w )    /* RTC 58174            */
61   AM_RANGE( 0x0280, 0x0283) AM_READWRITE( compis_osp_pic_r, compis_osp_pic_w ) /* PIC 8259 (80150/80130)  */
62   AM_RANGE( 0x0280, 0x0283) AM_DEVREADWRITE(PIC8259, "pic8259_master", compis_osp_pic_r, compis_osp_pic_w ) /* PIC 8259 (80150/80130)  */
6263//  AM_RANGE( 0x0288, 0x028e) AM_DEVREADWRITE(PIT8254, "pit8254", compis_osp_pit_r, compis_osp_pit_w ) /* PIT 8254 (80150/80130)  */
6364   AM_RANGE( 0x0310, 0x031f) AM_READWRITE( compis_usart_r, compis_usart_w )   /* USART 8251 Keyboard      */
6465   AM_RANGE( 0x0330, 0x033f) AM_READWRITE( compis_gdc_r, compis_gdc_w )   /* GDC 82720 PCS6:6     */
r2376r2377
224225   MDRV_DEVICE_ADD( "pit8254", PIT8254 )
225226   MDRV_DEVICE_CONFIG( compis_pit8254_config )
226227
228   MDRV_DEVICE_ADD( "pic8259_master", PIC8259 )
229   MDRV_DEVICE_CONFIG( compis_pic8259_master_config )
230
231   MDRV_DEVICE_ADD( "pic8259_slave", PIC8259 )
232   MDRV_DEVICE_CONFIG( compis_pic8259_slave_config )
233
227234   /* video hardware */
228235   MDRV_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK)
229236   MDRV_SCREEN_ADD("main", RASTER)

Previous 15994 Revisions Next


© 1998-2018 The MESS Team