Previous 199869 Revisions Next

r22823 Tuesday 14th May, 2013 at 20:48:27 UTC by Wilbert Pol
pic8259.c: Continue modernization. (nw)
[src/emu/machine]pic8259.c pic8259.h
[src/mame/drivers]calchase.c chihiro.c fruitpc.c funkball.c gamecstl.c gammagic.c magtouch.c mediagx.c midqslvr.c pcat_nit.c pcxt.c photoply.c pinball2k.c quakeat.c queen.c savquest.c su2000.c taitowlf.c voyager.c xtom3d.c
[src/mame/machine]pcshare.c
[src/mess/drivers]amstr_pc.c apc.c apricot.c apricotp.c at.c b2m.c bebox.c compis.c fmtowns.c iq151.c irisha.c m20.c multi16.c paso1600.c pasogo.c pc.c pc100.c pc1512.c pc88va.c pc9801.c qx10.c sage2.c tandy2k.c tsispch.c victor9k.c wangpc.c z100.c
[src/mess/includes]apollo.h b2m.h bebox.h fmtowns.h pc.h pk8020.h
[src/mess/machine]apollo.c at.c b2m.c bebox.c compis.c genpc.c mbc55x.c pc.c pc9801_118.c pc9801_26.c pc9801_86.c pk8020.c southbridge.c
[src/mess/video]fmtowns.c pc_t1t.c

trunk/src/emu/machine/pic8259.c
r22822r22823
2020#define LOG_OCW     0
2121#define LOG_GENERAL  0
2222
23enum pic8259_state_t
24{
25   STATE_ICW1,
26   STATE_ICW2,
27   STATE_ICW3,
28   STATE_ICW4,
29   STATE_READY
30};
3123
32struct pic8259_t
24TIMER_CALLBACK_MEMBER( pic8259_device::timerproc )
3325{
34   devcb_resolved_write_line out_int_func;
35
36   devcb_resolved_read_line sp_en_func;
37
38   devcb_resolved_read8 read_slave_ack_func;
39
40   emu_timer *timer;
41
42   pic8259_state_t state;
43
44   UINT8 isr;
45   UINT8 irr;
46   UINT8 prio;
47   UINT8 imr;
48   UINT8 irq_lines;
49
50   UINT8 input;
51   UINT8 ocw3;
52
53   UINT8 master;
54   /* ICW1 state */
55   UINT32 level_trig_mode : 1;
56   UINT32 vector_size : 1;
57   UINT32 cascade : 1;
58   UINT32 icw4_needed : 1;
59   UINT32 vector_addr_low;
60   /* ICW2 state */
61   UINT8 base;
62   UINT8 vector_addr_high;
63
64   /* ICW3 state */
65   UINT8 slave;
66
67   /* ICW4 state */
68   UINT32 nested : 1;
69   UINT32 mode : 2;
70   UINT32 auto_eoi : 1;
71   UINT32 is_x86 : 1;
72};
73
74
75INLINE pic8259_t *get_safe_token(device_t *device) {
76   assert( device != NULL );
77   assert( device->type() == PIC8259 );
78   return ( pic8259_t *) downcast<pic8259_device *>(device)->token();
79}
80
81
82static TIMER_CALLBACK( pic8259_timerproc )
83{
84   device_t *device = (device_t *)ptr;
85   pic8259_t   *pic8259 = get_safe_token(device);
8626   int irq;
8727   UINT8 mask;
8828
r22822r22823
9232      mask = 1 << irq;
9333
9434      /* is this IRQ in service? */
95      if (pic8259->isr & mask)
35      if (m_isr & mask)
9636      {
9737         if (LOG_GENERAL)
38         {
9839            logerror("pic8259_timerproc(): PIC IRQ #%d still in service\n", irq);
40         }
9941         break;
10042      }
10143
10244      /* is this IRQ pending and enabled? */
103      if ((pic8259->state == STATE_READY) && (pic8259->irr & mask) && !(pic8259->imr & mask))
45      if ((m_state == STATE_READY) && (m_irr & mask) && !(m_imr & mask))
10446      {
10547         if (LOG_GENERAL)
48         {
10649            logerror("pic8259_timerproc(): PIC triggering IRQ #%d\n", irq);
107         if (!BIT(pic8259->ocw3, 2))
108            pic8259->out_int_func(1);
50         }
51         if (!BIT(m_ocw3, 2))
52         {
53            m_out_int_func(1);
54         }
10955         return;
11056      }
11157   }
112   if (!BIT(pic8259->ocw3, 2))
113      pic8259->out_int_func(0);
58   if (!BIT(m_ocw3, 2))
59   {
60      m_out_int_func(0);
61   }
11462}
11563
11664
117INLINE void pic8259_set_timer(pic8259_t *pic8259)
65void pic8259_device::set_irq_line(int irq, int state)
11866{
119   pic8259->timer->adjust(attotime::zero);
120}
121
122
123static void pic8259_set_irq_line(device_t *device, int irq, int state)
124{
125   pic8259_t   *pic8259 = get_safe_token(device);
12667   UINT8 mask = (1 << irq);
12768
12869   if (state)
r22822r22823
13172      if (LOG_GENERAL)
13273         logerror("pic8259_set_irq_line(): PIC set IRQ line #%d\n", irq);
13374
134      if(pic8259->level_trig_mode || (!pic8259->level_trig_mode && !(pic8259->irq_lines & mask)))
135         pic8259->irr |= mask;
136      pic8259->irq_lines |= mask;
75      if(m_level_trig_mode || (!m_level_trig_mode && !(m_irq_lines & mask)))
76      {
77         m_irr |= mask;
78      }
79      m_irq_lines |= mask;
13780   }
13881   else
13982   {
14083      /* clearing IRQ line */
14184      if (LOG_GENERAL)
142         logerror("pic8259_set_irq_line(): PIC cleared IRQ line #%d\n", irq);
85      {
86         logerror("pic8259_device::set_irq_line(): PIC cleared IRQ line #%d\n", irq);
87      }
14388
144      pic8259->irq_lines &= ~mask;
145      pic8259->irr &= ~mask;
89      m_irq_lines &= ~mask;
90      m_irr &= ~mask;
14691   }
147   pic8259_set_timer(pic8259);
92   set_timer();
14893}
14994
150WRITE_LINE_DEVICE_HANDLER( pic8259_ir0_w ) { pic8259_set_irq_line(device, 0, state); }
151WRITE_LINE_DEVICE_HANDLER( pic8259_ir1_w ) { pic8259_set_irq_line(device, 1, state); }
152WRITE_LINE_DEVICE_HANDLER( pic8259_ir2_w ) { pic8259_set_irq_line(device, 2, state); }
153WRITE_LINE_DEVICE_HANDLER( pic8259_ir3_w ) { pic8259_set_irq_line(device, 3, state); }
154WRITE_LINE_DEVICE_HANDLER( pic8259_ir4_w ) { pic8259_set_irq_line(device, 4, state); }
155WRITE_LINE_DEVICE_HANDLER( pic8259_ir5_w ) { pic8259_set_irq_line(device, 5, state); }
156WRITE_LINE_DEVICE_HANDLER( pic8259_ir6_w ) { pic8259_set_irq_line(device, 6, state); }
157WRITE_LINE_DEVICE_HANDLER( pic8259_ir7_w ) { pic8259_set_irq_line(device, 7, state); }
15895
159WRITE_LINE_MEMBER( pic8259_device::ir0_w ) { pic8259_set_irq_line(this, 0, state); }
160WRITE_LINE_MEMBER( pic8259_device::ir1_w ) { pic8259_set_irq_line(this, 1, state); }
161WRITE_LINE_MEMBER( pic8259_device::ir2_w ) { pic8259_set_irq_line(this, 2, state); }
162WRITE_LINE_MEMBER( pic8259_device::ir3_w ) { pic8259_set_irq_line(this, 3, state); }
163WRITE_LINE_MEMBER( pic8259_device::ir4_w ) { pic8259_set_irq_line(this, 4, state); }
164WRITE_LINE_MEMBER( pic8259_device::ir5_w ) { pic8259_set_irq_line(this, 5, state); }
165WRITE_LINE_MEMBER( pic8259_device::ir6_w ) { pic8259_set_irq_line(this, 6, state); }
166WRITE_LINE_MEMBER( pic8259_device::ir7_w ) { pic8259_set_irq_line(this, 7, state); }
167
168int pic8259_acknowledge(device_t *device)
96UINT32 pic8259_device::acknowledge()
16997{
170   pic8259_t   *pic8259 = get_safe_token(device);
17198   UINT8 mask;
17299   int irq;
173100
r22822r22823
176103      mask = 1 << irq;
177104
178105      /* is this IRQ pending and enabled? */
179      if ((pic8259->irr & mask) && !(pic8259->imr & mask))
106      if ((m_irr & mask) && !(m_imr & mask))
180107      {
181108         if (LOG_GENERAL)
109         {
182110            logerror("pic8259_acknowledge(): PIC acknowledge IRQ #%d\n", irq);
183         if (!pic8259->level_trig_mode)
184            pic8259->irr &= ~mask;
111         }
112         if (!m_level_trig_mode)
113         {
114            m_irr &= ~mask;
115         }
185116
186         if (!pic8259->auto_eoi)
187            pic8259->isr |= mask;
117         if (!m_auto_eoi)
118         {
119            m_isr |= mask;
120         }
188121
189         pic8259_set_timer(pic8259);
122         set_timer();
190123
191         if ((pic8259->cascade!=0) && (pic8259->master!=0) && (mask & pic8259->slave)) {
124         if ((m_cascade!=0) && (m_master!=0) && (mask & m_slave))
125         {
192126            // it's from slave device
193            return pic8259->read_slave_ack_func(irq);
194         } else {
195            if (pic8259->is_x86) {
127            return m_read_slave_ack_func(irq);
128         }
129         else
130         {
131            if (m_is_x86)
132            {
196133               /* For x86 mode*/
197               return irq + pic8259->base;
198            } else {
134               return irq + m_base;
135            }
136            else
137            {
199138               /* in case of 8080/85) */
200               return 0xcd0000 + (pic8259->vector_addr_high << 8) + pic8259->vector_addr_low + (irq << (3-pic8259->vector_size));
139               return 0xcd0000 + (m_vector_addr_high << 8) + m_vector_addr_low + (irq << (3-m_vector_size));
201140            }
202141         }
203142      }
r22822r22823
205144   return 0;
206145}
207146
147
208148UINT8 pic8259_device::inta_r()
209149{
210   return pic8259_acknowledge(this);
150   return acknowledge();
211151}
212152
213READ8_DEVICE_HANDLER( pic8259_r )
214{
215   pic8259_t   *pic8259 = get_safe_token(device);
216153
154READ8_MEMBER( pic8259_device::read )
155{
217156   /* NPW 18-May-2003 - Changing 0xFF to 0x00 as per Ruslan */
218157   UINT8 data = 0x00;
219158
220159   switch(offset)
221160   {
222161      case 0: /* PIC acknowledge IRQ */
223         if ( pic8259->ocw3 & 0x04 )
162         if ( m_ocw3 & 0x04 )
224163         {
225164            /* Polling mode */
226            if ( pic8259->isr & ~pic8259->imr )
227               pic8259_acknowledge( device );
165            if ( m_isr & ~m_imr )
166            {
167               acknowledge();
168            }
228169
229            if ( pic8259->irr & ~pic8259->imr )
170            if ( m_irr & ~m_imr )
230171            {
231172               int irq;
232173               for ( irq = 0; irq < IRQ_COUNT; irq++ )
233174               {
234                  if ( ( 1 << irq ) & pic8259->irr & ~pic8259->imr )
175                  if ( ( 1 << irq ) & m_irr & ~m_imr )
235176                  {
236177                     data = 0x80 | irq;
237178                     break;
r22822r22823
241182         }
242183         else
243184         {
244            switch ( pic8259->ocw3 & 0x03 )
185            switch ( m_ocw3 & 0x03 )
245186            {
246187            case 2:
247               data = pic8259->irr;
188               data = m_irr;
248189               break;
249190            case 3:
250               data = pic8259->isr & ~pic8259->imr;
191               data = m_isr & ~m_imr;
251192               break;
252193            default:
253194               data = 0x00;
r22822r22823
257198         break;
258199
259200      case 1: /* PIC mask register */
260         data = pic8259->imr;
201         data = m_imr;
261202         break;
262203   }
263204   return data;
264205}
265206
266207
267READ8_MEMBER( pic8259_device::read )
208WRITE8_MEMBER( pic8259_device::write )
268209{
269   return pic8259_r(this, space, offset);
270}
271
272
273WRITE8_DEVICE_HANDLER( pic8259_w )
274{
275   pic8259_t   *pic8259 = get_safe_token(device);
276
277210   switch(offset)
278211   {
279212      case 0:    /* PIC acknowledge IRQ */
r22822r22823
281214         {
282215            /* write ICW1 - this pretty much resets the chip */
283216            if (LOG_ICW)
284               logerror("pic8259_w(): ICW1; data=0x%02X\n", data);
217            {
218               logerror("pic8259_device::write(): ICW1; data=0x%02X\n", data);
219            }
285220
286            pic8259->imr                = 0x00;
287            pic8259->isr                = 0x00;
288            pic8259->irr                = 0x00;
289            pic8259->level_trig_mode    = (data & 0x08) ? 1 : 0;
290            pic8259->vector_size        = (data & 0x04) ? 1 : 0;
291            pic8259->cascade            = (data & 0x02) ? 0 : 1;
292            pic8259->icw4_needed        = (data & 0x01) ? 1 : 0;
293            pic8259->vector_addr_low    = (data & 0xe0);
294            pic8259->state          = STATE_ICW2;
295            pic8259->out_int_func(0);
221            m_imr                = 0x00;
222            m_isr                = 0x00;
223            m_irr                = 0x00;
224            m_level_trig_mode    = (data & 0x08) ? 1 : 0;
225            m_vector_size        = (data & 0x04) ? 1 : 0;
226            m_cascade            = (data & 0x02) ? 0 : 1;
227            m_icw4_needed        = (data & 0x01) ? 1 : 0;
228            m_vector_addr_low    = (data & 0xe0);
229            m_state          = STATE_ICW2;
230            m_out_int_func(0);
296231         }
297         else if (pic8259->state == STATE_READY)
232         else if (m_state == STATE_READY)
298233         {
299234            if ((data & 0x98) == 0x08)
300235            {
301236               /* write OCW3 */
302237               if (LOG_OCW)
303                  logerror("pic8259_w(): OCW3; data=0x%02X\n", data);
238               {
239                  logerror("pic8259_device::write(): OCW3; data=0x%02X\n", data);
240               }
304241
305               pic8259->ocw3 = data;
242               m_ocw3 = data;
306243            }
307244            else if ((data & 0x18) == 0x00)
308245            {
r22822r22823
311248
312249               /* write OCW2 */
313250               if (LOG_OCW)
314                  logerror("pic8259_w(): OCW2; data=0x%02X\n", data);
251               {
252                  logerror("pic8259_device::write(): OCW2; data=0x%02X\n", data);
253               }
315254
316255               switch (data & 0xe0)
317256               {
318257                  case 0x00:
319                     pic8259->prio = 0;
258                     m_prio = 0;
320259                     break;
321260                  case 0x20:
322                     for (n = 0, mask = 1<<pic8259->prio; n < 8; n++, mask = (mask<<1) | (mask>>7))
261                     for (n = 0, mask = 1<<m_prio; n < 8; n++, mask = (mask<<1) | (mask>>7))
323262                     {
324                        if (pic8259->isr & mask)
263                        if (m_isr & mask)
325264                        {
326                           pic8259->isr &= ~mask;
265                           m_isr &= ~mask;
327266                           break;
328267                        }
329268                     }
r22822r22823
331270                  case 0x40:
332271                     break;
333272                  case 0x60:
334                     if( pic8259->isr & mask )
273                     if( m_isr & mask )
335274                     {
336                        pic8259->isr &= ~mask;
275                        m_isr &= ~mask;
337276                     }
338277                     break;
339278                  case 0x80:
340                     pic8259->prio = (pic8259->prio + 1) & 7;
279                     m_prio = (m_prio + 1) & 7;
341280                     break;
342281                  case 0xa0:
343                     for (n = 0, mask = 1<<pic8259->prio; n < 8; n++, mask = (mask<<1) | (mask>>7))
282                     for (n = 0, mask = 1<<m_prio; n < 8; n++, mask = (mask<<1) | (mask>>7))
344283                     {
345                        if( pic8259->isr & mask )
284                        if( m_isr & mask )
346285                        {
347                           pic8259->isr &= ~mask;
348                           pic8259->prio = (pic8259->prio + 1) & 7;
286                           m_isr &= ~mask;
287                           m_prio = (m_prio + 1) & 7;
349288                           break;
350289                        }
351290                     }
352291                     break;
353292                  case 0xc0:
354                     pic8259->prio = n & 7;
293                     m_prio = n & 7;
355294                     break;
356295                  case 0xe0:
357                     if( pic8259->isr & mask )
296                     if( m_isr & mask )
358297                     {
359                        pic8259->isr &= ~mask;
360                        pic8259->prio = (pic8259->prio + 1) & 7;
298                        m_isr &= ~mask;
299                        m_prio = (m_prio + 1) & 7;
361300                     }
362301                     break;
363302               }
r22822r22823
366305         break;
367306
368307      case 1:
369         switch(pic8259->state)
308         switch(m_state)
370309         {
371310            case STATE_ICW1:
372311               break;
r22822r22823
374313            case STATE_ICW2:
375314               /* write ICW2 */
376315               if (LOG_ICW)
377                  logerror("pic8259_w(): ICW2; data=0x%02X\n", data);
316               {
317                  logerror("pic8259_device::write(): ICW2; data=0x%02X\n", data);
318               }
378319
379               pic8259->base = data & 0xf8;
380               pic8259->vector_addr_high = data ;
381               if (pic8259->cascade)
382                  pic8259->state = STATE_ICW3;
320               m_base = data & 0xf8;
321               m_vector_addr_high = data ;
322               if (m_cascade)
323               {
324                  m_state = STATE_ICW3;
325               }
383326               else
384                  pic8259->state = pic8259->icw4_needed ? STATE_ICW4 : STATE_READY;
327               {
328                  m_state = m_icw4_needed ? STATE_ICW4 : STATE_READY;
329               }
385330               break;
386331
387332            case STATE_ICW3:
388333               /* write ICW3 */
389334               if (LOG_ICW)
390                  logerror("pic8259_w(): ICW3; data=0x%02X\n", data);
335               {
336                  logerror("pic8259_device::write(): ICW3; data=0x%02X\n", data);
337               }
391338
392               pic8259->slave = data;
393               pic8259->state = pic8259->icw4_needed ? STATE_ICW4 : STATE_READY;
339               m_slave = data;
340               m_state = m_icw4_needed ? STATE_ICW4 : STATE_READY;
394341               break;
395342
396343            case STATE_ICW4:
397344               /* write ICW4 */
398345               if (LOG_ICW)
399                  logerror("pic8259_w(): ICW4; data=0x%02X\n", data);
346               {
347                  logerror("pic8259_device::write(): ICW4; data=0x%02X\n", data);
348               }
400349
401               pic8259->nested = (data & 0x10) ? 1 : 0;
402               pic8259->mode = (data >> 2) & 3;
403               pic8259->auto_eoi = (data & 0x02) ? 1 : 0;
404               pic8259->is_x86 = (data & 0x01) ? 1 : 0;
405               pic8259->state = STATE_READY;
350               m_nested = (data & 0x10) ? 1 : 0;
351               m_mode = (data >> 2) & 3;
352               m_auto_eoi = (data & 0x02) ? 1 : 0;
353               m_is_x86 = (data & 0x01) ? 1 : 0;
354               m_state = STATE_READY;
406355               break;
407356
408357            case STATE_READY:
409358               /* write OCW1 - set interrupt mask register */
410359               if (LOG_OCW)
411                  logerror("pic8259_w(): OCW1; data=0x%02X\n", data);
360               {
361                  logerror("pic8259_device::write(): OCW1; data=0x%02X\n", data);
362               }
412363
413               //printf("%s %02x\n",pic8259->master ? "master pic8259 mask" : "slave pic8259 mask",data);
414               pic8259->imr = data;
364               //printf("%s %02x\n",m_master ? "master pic8259 mask" : "slave pic8259 mask",data);
365               m_imr = data;
415366               break;
416367         }
417368         break;
418369   }
419   pic8259_set_timer(pic8259);
370   set_timer();
420371}
421372
422373
423WRITE8_MEMBER( pic8259_device::write )
424{
425   pic8259_w(this, space, offset, data);
426}
374//-------------------------------------------------
375//  device_start - device-specific startup
376//-------------------------------------------------
427377
428
429static DEVICE_START( pic8259 )
378void pic8259_device::device_start()
430379{
431   pic8259_t   *pic8259 = get_safe_token(device);
432   const struct pic8259_interface *intf = (const struct pic8259_interface *)device->static_config();
380   const struct pic8259_interface *intf = (const struct pic8259_interface *)this->static_config();
433381
434382   assert(intf != NULL);
435383
436   pic8259->timer = device->machine().scheduler().timer_alloc( FUNC(pic8259_timerproc), (void *)device );
384   m_timer = machine().scheduler().timer_alloc( timer_expired_delegate( FUNC(pic8259_device::timerproc), this) );
437385
438386   /* resolve callbacks */
439   pic8259->out_int_func.resolve(intf->out_int_func, *device);
440   pic8259->sp_en_func.resolve(intf->sp_en_func, *device);
441   pic8259->read_slave_ack_func.resolve(intf->read_slave_ack_func, *device);
387   m_out_int_func.resolve(intf->out_int_func, *this);
388   m_sp_en_func.resolve(intf->sp_en_func, *this);
389   m_read_slave_ack_func.resolve(intf->read_slave_ack_func, *this);
442390}
443391
444392
445static DEVICE_RESET( pic8259 ) {
446   pic8259_t   *pic8259 = get_safe_token(device);
393//-------------------------------------------------
394//  device_reset - device-specific reset
395//-------------------------------------------------
447396
448   pic8259->state = STATE_READY;
449   pic8259->isr = 0;
450   pic8259->irr = 0;
451   pic8259->irq_lines = 0;
452   pic8259->prio = 0;
453   pic8259->imr = 0;
454   pic8259->input = 0;
455   pic8259->ocw3 = 2;
456   pic8259->level_trig_mode = 0;
457   pic8259->vector_size = 0;
458   pic8259->cascade = 0;
459   pic8259->icw4_needed = 0;
460   pic8259->base = 0;
461   pic8259->slave = 0;
462   pic8259->nested = 0;
463   pic8259->mode = 0;
464   pic8259->auto_eoi = 0;
465   pic8259->is_x86 = 0;
466   pic8259->vector_addr_low = 0;
467   pic8259->vector_addr_high = 0;
397void pic8259_device::device_reset()
398{
399   m_state = STATE_READY;
400   m_isr = 0;
401   m_irr = 0;
402   m_irq_lines = 0;
403   m_prio = 0;
404   m_imr = 0;
405   m_input = 0;
406   m_ocw3 = 2;
407   m_level_trig_mode = 0;
408   m_vector_size = 0;
409   m_cascade = 0;
410   m_icw4_needed = 0;
411   m_base = 0;
412   m_slave = 0;
413   m_nested = 0;
414   m_mode = 0;
415   m_auto_eoi = 0;
416   m_is_x86 = 0;
417   m_vector_addr_low = 0;
418   m_vector_addr_high = 0;
468419
469   pic8259->master = pic8259->sp_en_func();
420   m_master = m_sp_en_func();
470421}
471422
472423const device_type PIC8259 = &device_creator<pic8259_device>;
r22822r22823
474425pic8259_device::pic8259_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
475426   : device_t(mconfig, PIC8259, "Intel PIC8259", tag, owner, clock)
476427{
477   m_token = global_alloc_clear(pic8259_t);
478428}
479429
480430//-------------------------------------------------
r22822r22823
487437{
488438}
489439
490//-------------------------------------------------
491//  device_start - device-specific startup
492//-------------------------------------------------
493
494void pic8259_device::device_start()
495{
496   DEVICE_START_NAME( pic8259 )(this);
497}
498
499//-------------------------------------------------
500//  device_reset - device-specific reset
501//-------------------------------------------------
502
503void pic8259_device::device_reset()
504{
505   DEVICE_RESET_NAME( pic8259 )(this);
506}
trunk/src/emu/machine/pic8259.h
r22822r22823
3232{
3333public:
3434   pic8259_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
35   ~pic8259_device() { global_free(m_token); }
3635
3736   DECLARE_READ8_MEMBER( read );
3837   DECLARE_WRITE8_MEMBER( write );
38   UINT32 acknowledge();
3939
40   DECLARE_WRITE_LINE_MEMBER( ir0_w );
41   DECLARE_WRITE_LINE_MEMBER( ir1_w );
42   DECLARE_WRITE_LINE_MEMBER( ir2_w );
43   DECLARE_WRITE_LINE_MEMBER( ir3_w );
44   DECLARE_WRITE_LINE_MEMBER( ir4_w );
45   DECLARE_WRITE_LINE_MEMBER( ir5_w );
46   DECLARE_WRITE_LINE_MEMBER( ir6_w );
47   DECLARE_WRITE_LINE_MEMBER( ir7_w );
40   DECLARE_WRITE_LINE_MEMBER( ir0_w ) { set_irq_line(0, state); }
41   DECLARE_WRITE_LINE_MEMBER( ir1_w ) { set_irq_line(1, state); }
42   DECLARE_WRITE_LINE_MEMBER( ir2_w ) { set_irq_line(2, state); }
43   DECLARE_WRITE_LINE_MEMBER( ir3_w ) { set_irq_line(3, state); }
44   DECLARE_WRITE_LINE_MEMBER( ir4_w ) { set_irq_line(4, state); }
45   DECLARE_WRITE_LINE_MEMBER( ir5_w ) { set_irq_line(5, state); }
46   DECLARE_WRITE_LINE_MEMBER( ir6_w ) { set_irq_line(6, state); }
47   DECLARE_WRITE_LINE_MEMBER( ir7_w ) { set_irq_line(7, state); }
4848
4949   UINT8 inta_r();
5050
51   // access to legacy token
52   void *token() const { assert(m_token != NULL); return m_token; }
51   TIMER_CALLBACK_MEMBER( timerproc );
52
5353protected:
5454   // device-level overrides
5555   virtual void device_config_complete();
5656   virtual void device_start();
5757   virtual void device_reset();
58
5859private:
59   // internal state
60   void *m_token;
60   inline void set_timer() { m_timer->adjust(attotime::zero); }
61   void set_irq_line(int irq, int state);
62
63
64   enum pic8259_state_t
65   {
66      STATE_ICW1,
67      STATE_ICW2,
68      STATE_ICW3,
69      STATE_ICW4,
70      STATE_READY
71   };
72
73   devcb_resolved_write_line m_out_int_func;
74   devcb_resolved_read_line m_sp_en_func;
75   devcb_resolved_read8 m_read_slave_ack_func;
76
77   emu_timer *m_timer;
78
79   pic8259_state_t m_state;
80
81   UINT8 m_isr;
82   UINT8 m_irr;
83   UINT8 m_prio;
84   UINT8 m_imr;
85   UINT8 m_irq_lines;
86
87   UINT8 m_input;
88   UINT8 m_ocw3;
89
90   UINT8 m_master;
91   /* ICW1 state */
92   UINT32 m_level_trig_mode : 1;
93   UINT32 m_vector_size : 1;
94   UINT32 m_cascade : 1;
95   UINT32 m_icw4_needed : 1;
96   UINT32 m_vector_addr_low;
97   /* ICW2 state */
98   UINT8 m_base;
99   UINT8 m_vector_addr_high;
100
101   /* ICW3 state */
102   UINT8 m_slave;
103
104   /* ICW4 state */
105   UINT32 m_nested : 1;
106   UINT32 m_mode : 2;
107   UINT32 m_auto_eoi : 1;
108   UINT32 m_is_x86 : 1;
61109};
62110
63111extern const device_type PIC8259;
r22822r22823
87135   MCFG_DEVICE_CONFIG(_intrf)
88136
89137
90/* device interface */
91DECLARE_READ8_DEVICE_HANDLER( pic8259_r );
92DECLARE_WRITE8_DEVICE_HANDLER( pic8259_w );
93int pic8259_acknowledge(device_t *device);
94
95/* interrupt requests */
96WRITE_LINE_DEVICE_HANDLER( pic8259_ir0_w );
97WRITE_LINE_DEVICE_HANDLER( pic8259_ir1_w );
98WRITE_LINE_DEVICE_HANDLER( pic8259_ir2_w );
99WRITE_LINE_DEVICE_HANDLER( pic8259_ir3_w );
100WRITE_LINE_DEVICE_HANDLER( pic8259_ir4_w );
101WRITE_LINE_DEVICE_HANDLER( pic8259_ir5_w );
102WRITE_LINE_DEVICE_HANDLER( pic8259_ir6_w );
103WRITE_LINE_DEVICE_HANDLER( pic8259_ir7_w );
104
105
106138#endif /* __PIC8259_H__ */
trunk/src/mess/machine/pc9801_86.c
r22822r22823
3838WRITE_LINE_MEMBER(pc9801_86_device::pc9801_sound_irq)
3939{
4040   /* TODO: seems to die very often */
41   pic8259_ir4_w(machine().device("pic8259_slave"), state);
41   machine().device<pic8259_device>(":pic8259_slave")->ir4_w(state);
4242}
4343
4444static const ay8910_interface ay8910_config =
trunk/src/mess/machine/at.c
r22822r22823
6666WRITE_LINE_MEMBER( at_state::at_pit8254_out0_changed )
6767{
6868   if (m_pic8259_master)
69      pic8259_ir0_w(m_pic8259_master, state);
69      m_pic8259_master->ir0_w(state);
7070}
7171
7272
trunk/src/mess/machine/b2m.c
r22822r22823
324324
325325void b2m_state::machine_start()
326326{
327   m_pic = machine().device("pic8259");
327   m_pic = machine().device<pic8259_device>("pic8259");
328328   m_fdc = machine().device<fd1793_t>("fd1793");
329329
330330   m_fdc->setup_drq_cb(fd1793_t::line_cb(FUNC(b2m_state::b2m_fdc_drq), this));
r22822r22823
347347
348348IRQ_CALLBACK_MEMBER(b2m_state::b2m_irq_callback)
349349{
350   return pic8259_acknowledge(m_pic);
350   return m_pic->acknowledge();
351351}
352352
353353const struct pic8259_interface b2m_pic8259_config =
r22822r22823
361361{
362362   m_vblank_state++;
363363   if (m_vblank_state>1) m_vblank_state=0;
364   pic8259_ir0_w(m_pic, m_vblank_state);
364   m_pic->ir0_w(m_vblank_state);
365365}
366366
367367void b2m_state::machine_reset()
trunk/src/mess/machine/compis.c
r22822r22823
12631263WRITE_LINE_MEMBER( compis_state::compis_pic8259_slave_set_int_line )
12641264{
12651265   if (m_8259m)
1266      pic8259_ir2_w(m_8259m, state);
1266      m_8259m->ir2_w(state);
12671267}
12681268
12691269READ8_MEMBER( compis_state::get_slave_ack )
trunk/src/mess/machine/bebox.c
r22822r22823
454454{
455455   bebox_set_irq_bit(machine(), 13, state);
456456   if ( m_devices.pic8259_master ) {
457      pic8259_ir6_w(m_devices.pic8259_master, state);
457      m_devices.pic8259_master->ir6_w(state);
458458   }
459459}
460460
r22822r22823
474474
475475READ64_MEMBER(bebox_state::bebox_interrupt_ack_r )
476476{
477   int result;
478   result = pic8259_acknowledge( m_devices.pic8259_master );
477   UINT32 result;
478   result = m_devices.pic8259_master->acknowledge();
479479   bebox_set_irq_bit(space.machine(), 5, 0);   /* HACK */
480480   return ((UINT64) result) << 56;
481481}
r22822r22823
495495WRITE_LINE_MEMBER(bebox_state::bebox_pic8259_slave_set_int_line)
496496{
497497   if (m_devices.pic8259_master)
498      pic8259_ir2_w(m_devices.pic8259_master, state);
498      m_devices.pic8259_master->ir2_w(state);
499499}
500500
501501READ8_MEMBER(bebox_state::get_slave_ack)
502502{
503503   if (offset==2) { // IRQ = 2
504      return pic8259_acknowledge(m_devices.pic8259_slave);
504      return m_devices.pic8259_slave->acknowledge();
505505   }
506506   return 0x00;
507507}
r22822r22823
558558{
559559   bebox_set_irq_bit(machine(), 7, state);
560560   if ( m_devices.pic8259_master ) {
561      pic8259_ir6_w(m_devices.pic8259_master, state);
561      m_devices.pic8259_master->ir6_w(state);
562562   }
563563}
564564
r22822r22823
787787WRITE_LINE_MEMBER(bebox_state::bebox_timer0_w)
788788{
789789   if (m_devices.pic8259_master)
790      pic8259_ir0_w(m_devices.pic8259_master, state);
790      m_devices.pic8259_master->ir0_w(state);
791791}
792792
793793
r22822r22823
969969
970970
971971TIMER_CALLBACK_MEMBER(bebox_state::bebox_get_devices){
972   m_devices.pic8259_master = machine().device("pic8259_master");
973   m_devices.pic8259_slave = machine().device("pic8259_slave");
972   m_devices.pic8259_master = machine().device<pic8259_device>("pic8259_master");
973   m_devices.pic8259_slave = machine().device<pic8259_device>("pic8259_slave");
974974   m_devices.dma8237_1 = machine().device<i8237_device>("dma8237_1");
975975   m_devices.dma8237_2 = machine().device<i8237_device>("dma8237_2");
976976}
trunk/src/mess/machine/mbc55x.c
r22822r22823
118118
119119READ8_MEMBER(mbc55x_state::mbcpic8259_r)
120120{
121   return pic8259_r(m_pic, space, offset>>1);
121   return m_pic->read(space, offset>>1);
122122}
123123
124124WRITE8_MEMBER(mbc55x_state::mbcpic8259_w)
125125{
126   pic8259_w(m_pic, space, offset>>1, data);
126   m_pic->write(space, offset>>1, data);
127127}
128128
129129IRQ_CALLBACK_MEMBER(mbc55x_state::mbc55x_irq_callback)
trunk/src/mess/machine/pc.c
r22822r22823
457457/* called when a interrupt is set/cleared from com hardware */
458458WRITE_LINE_MEMBER(pc_state::pc_com_interrupt_1)
459459{
460   pic8259_ir4_w(m_pic8259, state);
460   m_pic8259->ir4_w(state);
461461}
462462
463463WRITE_LINE_MEMBER(pc_state::pc_com_interrupt_2)
464464{
465   pic8259_ir3_w(m_pic8259, state);
465   m_pic8259->ir3_w(state);
466466}
467467
468468const ins8250_interface ibm5150_com_interface[4]=
r22822r22823
740740               m_ppi_shift_register = ( m_ppi_shift_register >> 1 ) | ( m_ppi_data_signal << 7 );
741741               if ( trigger_irq )
742742               {
743                  pic8259_ir1_w(m_pic8259, 1);
743                  m_pic8259->ir1_w(1);
744744                  m_ppi_shift_enable = 0;
745745                  m_ppi_clock_signal = 0;
746746                  m_pc_kbdc->clock_write_from_mb(m_ppi_clock_signal);
r22822r22823
832832   /* If PB7 is set clear the shift register and reset the IRQ line */
833833   if ( m_ppi_keyboard_clear )
834834   {
835      pic8259_ir1_w(m_pic8259, 0);
835      m_pic8259->ir1_w(0);
836836      m_ppi_shift_register = 0;
837837      m_ppi_shift_enable = 1;
838838   }
r22822r22823
945945   }
946946
947947   if (mc1502_keyb.pulsing) {
948      pic8259_ir1_w(m_pic8259, (mc1502_keyb.pulsing & 1));
948      m_pic8259->ir1_w(mc1502_keyb.pulsing & 1);
949949      mc1502_keyb.pulsing--;
950950   }
951951}
r22822r22823
962962   mc1502_keyb.latch = data;
963963   if (mc1502_keyb.pulsing)
964964      mc1502_keyb.pulsing--;
965   pic8259_ir1_w(m_pic8259, 0);
965   m_pic8259->ir1_w(0);
966966}
967967
968968WRITE8_MEMBER(pc_state::mc1502_ppi_portb_w)
r22822r22823
11461146{
11471147   if (m_pic8259)
11481148   {
1149      pic8259_ir6_w(m_pic8259, state);
1149      m_pic8259->ir6_w(state);
11501150   }
11511151}
11521152
r22822r22823
11611161
11621162   switch (irq)
11631163   {
1164   case 0: pic8259_ir0_w(st->m_pic8259, state); break;
1165   case 1: pic8259_ir1_w(st->m_pic8259, state); break;
1166   case 2: pic8259_ir2_w(st->m_pic8259, state); break;
1167   case 3: pic8259_ir3_w(st->m_pic8259, state); break;
1168   case 4: pic8259_ir4_w(st->m_pic8259, state); break;
1169   case 5: pic8259_ir5_w(st->m_pic8259, state); break;
1170   case 6: pic8259_ir6_w(st->m_pic8259, state); break;
1171   case 7: pic8259_ir7_w(st->m_pic8259, state); break;
1164   case 0: st->m_pic8259->ir0_w(state); break;
1165   case 1: st->m_pic8259->ir1_w(state); break;
1166   case 2: st->m_pic8259->ir2_w(state); break;
1167   case 3: st->m_pic8259->ir3_w(state); break;
1168   case 4: st->m_pic8259->ir4_w(state); break;
1169   case 5: st->m_pic8259->ir5_w(state); break;
1170   case 6: st->m_pic8259->ir6_w(state); break;
1171   case 7: st->m_pic8259->ir7_w(state); break;
11721172   }
11731173}
11741174
r22822r22823
14691469
14701470IRQ_CALLBACK_MEMBER(pc_state::pc_irq_callback)
14711471{
1472   return pic8259_acknowledge(m_pic8259);
1472   return m_pic8259->acknowledge();
14731473}
14741474
14751475
14761476MACHINE_START_MEMBER(pc_state,pc)
14771477{
1478   m_pic8259 = machine().device("pic8259");
1478   m_pic8259 = machine().device<pic8259_device>("pic8259");
14791479   m_pit8253 = machine().device("pit8253");
14801480   m_maincpu->set_irq_acknowledge_callback(device_irq_acknowledge_delegate(FUNC(pc_state::pc_irq_callback),this));
14811481
r22822r22823
15121512{
15131513   m_maincpu->set_irq_acknowledge_callback(device_irq_acknowledge_delegate(FUNC(pc_state::pc_irq_callback),this));
15141514
1515   m_pic8259 = machine().device("pic8259");
1515   m_pic8259 = machine().device<pic8259_device>("pic8259");
15161516   m_pit8253 = machine().device("pit8253");
15171517
15181518   /*
r22822r22823
15211521          40ms (check) for 20ms (check) until all keys are released.
15221522          Last pulse causes BIOS to write a 'break' scancode into port 60h.
15231523    */
1524   pic8259_ir1_w(m_pic8259, 1);
1524   m_pic8259->ir1_w(1);
15251525   memset(&mc1502_keyb, 0, sizeof(mc1502_keyb));
15261526   mc1502_keyb.keyb_signal_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pc_state::mc1502_keyb_signal_callback),this));
15271527   mc1502_keyb.keyb_signal_timer->adjust( attotime::from_msec(20), 0, attotime::from_msec(20) );
r22822r22823
15421542   machine().device<upd765a_device>("upd765")->set_ready_line_connected(false);
15431543
15441544
1545   m_pic8259 = machine().device("pic8259");
1545   m_pic8259 = machine().device<pic8259_device>("pic8259");
15461546   m_pit8253 = machine().device("pit8253");
15471547}
15481548
trunk/src/mess/machine/genpc.c
r22822r22823
323323               m_ppi_shift_register = ( m_ppi_shift_register >> 1 ) | ( m_ppi_data_signal << 7 );
324324               if ( trigger_irq )
325325               {
326                  pic8259_ir1_w(m_pic8259, 1);
326                  m_pic8259->ir1_w(1);
327327                  m_ppi_shift_enable = 0;
328328                  m_ppi_clock_signal = 0;
329329                  m_pc_kbdc->clock_write_from_mb(m_ppi_clock_signal);
r22822r22823
628628void ibm5160_mb_device::device_start()
629629{
630630   install_device(0x0000, 0x000f, 0, 0, read8_delegate(FUNC(am9517a_device::read), (am9517a_device*)m_dma8237), write8_delegate(FUNC(am9517a_device::write), (am9517a_device*)m_dma8237) );
631   install_device(m_pic8259, 0x0020, 0x0021, 0, 0, FUNC(pic8259_r), FUNC(pic8259_w) );
631   install_device(0x0020, 0x0021, 0, 0, read8_delegate(FUNC(pic8259_device::read), (pic8259_device*)m_pic8259), write8_delegate(FUNC(pic8259_device::write), (pic8259_device*)m_pic8259) );
632632   install_device(m_pit8253, 0x0040, 0x0043, 0, 0, FUNC(pit8253_r), FUNC(pit8253_w) );
633633
634634   //  install_device(m_ppi8255, 0x0060, 0x0063, 0, 0, FUNC(i8255a_r), FUNC(i8255a_w) );
trunk/src/mess/machine/pc9801_118.c
r22822r22823
3838WRITE_LINE_MEMBER(pc9801_118_device::pc9801_sound_irq)
3939{
4040   /* TODO: seems to die very often */
41   pic8259_ir4_w(machine().device("pic8259_slave"), state);
41   machine().device<pic8259_device>(":pic8259_slave")->ir4_w(state);
4242}
4343
4444static const ay8910_interface ay8910_config =
trunk/src/mess/machine/pk8020.c
r22822r22823
167167                  case 1 : return m_lan->status_r(space,0);
168168               }
169169               break;
170      case 0x28: return pic8259_r(m_pic8259,space, offset & 1);
170      case 0x28: return m_pic8259->read(space, offset & 1);
171171      case 0x30: return m_ppi8255_2->read(space,offset & 3);
172172      case 0x38: return m_ppi8255_1->read(space,offset & 3);
173173   }
r22822r22823
197197                  case 1 : m_lan->control_w(space,0,data); break;
198198               }
199199               break;
200      case 0x28: pic8259_w(m_pic8259,space, offset & 1,data);break;
200      case 0x28: m_pic8259->write(space, offset & 1,data);break;
201201      case 0x30: m_ppi8255_2->write(space,offset & 3,data); break;
202202      case 0x38: m_ppi8255_1->write(space,offset & 3,data); break;
203203   }
r22822r22823
955955
956956IRQ_CALLBACK_MEMBER(pk8020_state::pk8020_irq_callback)
957957{
958   return pic8259_acknowledge(m_pic8259);
958   return m_pic8259->acknowledge();
959959}
960960
961961void pk8020_state::machine_start()
r22822r22823
983983INTERRUPT_GEN_MEMBER(pk8020_state::pk8020_interrupt)
984984{
985985   m_takt ^= 1;
986   pic8259_ir4_w(m_pic8259, 1);
986   m_pic8259->ir4_w(1);
987987}
trunk/src/mess/machine/pc9801_26.c
r22822r22823
3838WRITE_LINE_MEMBER(pc9801_26_device::pc9801_sound_irq)
3939{
4040   /* TODO: seems to die very often */
41   pic8259_ir4_w(machine().device("pic8259_slave"), state);
41   machine().device<pic8259_device>(":pic8259_slave")->ir4_w(state);
4242}
4343
4444static const ay8910_interface ay8910_config =
trunk/src/mess/machine/southbridge.c
r22822r22823
194194   address_space& spaceio = machine().device(":maincpu")->memory().space(AS_IO);
195195
196196   spaceio.install_readwrite_handler(0x0000, 0x001f, read8_delegate(FUNC(am9517a_device::read),&(*m_dma8237_1)), write8_delegate(FUNC(am9517a_device::write),&(*m_dma8237_1)), 0xffffffff);
197   spaceio.install_legacy_readwrite_handler(*m_pic8259_master, 0x0020, 0x003f, FUNC(pic8259_r), FUNC(pic8259_w), 0xffffffff);
197   spaceio.install_readwrite_handler(0x0020, 0x003f, read8_delegate(FUNC(pic8259_device::read),&(*m_pic8259_master)), write8_delegate(FUNC(pic8259_device::write),&(*m_pic8259_master)), 0xffffffff);
198198   spaceio.install_legacy_readwrite_handler(*m_pit8254, 0x0040, 0x005f, FUNC(pit8253_r), FUNC(pit8253_w), 0xffffffff);
199199   spaceio.install_readwrite_handler(0x0060, 0x0063, read8_delegate(FUNC(southbridge_device::at_keybc_r),this), write8_delegate(FUNC(southbridge_device::at_keybc_w),this), 0xffffffff);
200200   spaceio.install_readwrite_handler(0x0064, 0x0067, read8_delegate(FUNC(at_keyboard_controller_device::status_r),&(*m_keybc)), write8_delegate(FUNC(at_keyboard_controller_device::command_w),&(*m_keybc)), 0xffffffff);
201201   spaceio.install_readwrite_handler(0x0070, 0x007f, read8_delegate(FUNC(mc146818_device::read),&(*m_mc146818)), write8_delegate(FUNC(mc146818_device::write),&(*m_mc146818)), 0xffffffff);
202202   spaceio.install_readwrite_handler(0x0080, 0x009f, read8_delegate(FUNC(southbridge_device::at_page8_r),this), write8_delegate(FUNC(southbridge_device::at_page8_w),this), 0xffffffff);
203   spaceio.install_legacy_readwrite_handler(*m_pic8259_slave, 0x00a0, 0x00bf, FUNC(pic8259_r), FUNC(pic8259_w), 0xffffffff);
203   spaceio.install_readwrite_handler(0x00a0, 0x00bf, read8_delegate(FUNC(pic8259_device::read),&(*m_pic8259_slave)), write8_delegate(FUNC(pic8259_device::write),&(*m_pic8259_slave)), 0xffffffff);
204204   spaceio.install_readwrite_handler(0x00c0, 0x00df, read8_delegate(FUNC(southbridge_device::at_dma8237_2_r),this), write8_delegate(FUNC(southbridge_device::at_dma8237_2_w),this), 0xffffffff);
205205   spaceio.nop_readwrite(0x00e0, 0x00ef);
206206
r22822r22823
460460
461461WRITE_LINE_MEMBER( southbridge_device::at_mc146818_irq )
462462{
463   pic8259_ir0_w(m_pic8259_slave, (state) ? 0 : 1);
463   m_pic8259_slave->ir0_w((state) ? 0 : 1);
464464}
465465
466466READ8_MEMBER( southbridge_device::at_dma8237_2_r )
trunk/src/mess/machine/apollo.c
r22822r22823
599599#undef VERBOSE
600600#define VERBOSE 0
601601
602INLINE device_t *get_pic8259_master(device_t *device) {
602INLINE pic8259_device *get_pic8259_master(device_t *device) {
603603   return device->machine().driver_data<apollo_state>()->pic8259_master;
604604}
605605
606INLINE device_t *get_pic8259_slave(device_t *device) {
606INLINE pic8259_device *get_pic8259_slave(device_t *device) {
607607   return device->machine().driver_data<apollo_state>()->pic8259_slave;
608608}
609609
r22822r22823
613613
614614WRITE8_DEVICE_HANDLER(apollo_pic8259_master_w ) {
615615   DLOG1(("writing %s at offset %X = %02x", device->tag(), offset, data));
616   pic8259_w(device, space, offset, data);
616   downcast<pic8259_device *>(device)->write(space, offset, data);
617617}
618618
619619READ8_DEVICE_HANDLER( apollo_pic8259_master_r ) {
620   UINT8 data = pic8259_r(device, space, offset);
620   UINT8 data = downcast<pic8259_device *>(device)->read(space, offset);
621621   DLOG1(("reading %s at offset %X = %02x", device->tag(), offset, data));
622622   return data;
623623}
r22822r22823
628628
629629WRITE8_DEVICE_HANDLER(apollo_pic8259_slave_w ) {
630630   DLOG1(("writing %s at offset %X = %02x", device->tag(), offset, data));
631   pic8259_w(device, space, offset, data);
631   downcast<pic8259_device *>(device)->write(space, offset, data);
632632}
633633
634634READ8_DEVICE_HANDLER( apollo_pic8259_slave_r ) {
635   UINT8 data = pic8259_r(device, space, offset);
635   UINT8 data = downcast<pic8259_device *>(device)->read(space, offset);
636636   DLOG1(("reading %s at offset %X = %02x", device->tag(), offset, data));
637637   return data;
638638}
r22822r22823
644644   }
645645
646646   switch (irq) {
647   case 0: pic8259_ir0_w(get_pic8259_master(device), state); break;
648   case 1: pic8259_ir1_w(get_pic8259_master(device), state); break;
649   case 2: pic8259_ir2_w(get_pic8259_master(device), state); break;
650   case 3: pic8259_ir3_w(get_pic8259_master(device), state); break;
651   case 4: pic8259_ir4_w(get_pic8259_master(device), state); break;
652   case 5: pic8259_ir5_w(get_pic8259_master(device), state); break;
653   case 6: pic8259_ir6_w(get_pic8259_master(device), state); break;
654   case 7: pic8259_ir7_w(get_pic8259_master(device), state); break;
647   case 0: get_pic8259_master(device)->ir0_w(state); break;
648   case 1: get_pic8259_master(device)->ir1_w(state); break;
649   case 2: get_pic8259_master(device)->ir2_w(state); break;
650   case 3: get_pic8259_master(device)->ir3_w(state); break;
651   case 4: get_pic8259_master(device)->ir4_w(state); break;
652   case 5: get_pic8259_master(device)->ir5_w(state); break;
653   case 6: get_pic8259_master(device)->ir6_w(state); break;
654   case 7: get_pic8259_master(device)->ir7_w(state); break;
655655
656   case 8: pic8259_ir0_w(get_pic8259_slave(device), state); break;
657   case 9: pic8259_ir1_w(get_pic8259_slave(device), state); break;
658   case 10: pic8259_ir2_w(get_pic8259_slave(device), state); break;
659   case 11: pic8259_ir3_w(get_pic8259_slave(device), state); break;
660   case 12: pic8259_ir4_w(get_pic8259_slave(device), state); break;
661   case 13: pic8259_ir5_w(get_pic8259_slave(device), state); break;
662   case 14: pic8259_ir6_w(get_pic8259_slave(device), state); break;
663   case 15: pic8259_ir7_w(get_pic8259_slave(device), state); break;
656   case 8: get_pic8259_slave(device)->ir0_w(state); break;
657   case 9: get_pic8259_slave(device)->ir1_w(state); break;
658   case 10: get_pic8259_slave(device)->ir2_w(state); break;
659   case 11: get_pic8259_slave(device)->ir3_w(state); break;
660   case 12: get_pic8259_slave(device)->ir4_w(state); break;
661   case 13: get_pic8259_slave(device)->ir5_w(state); break;
662   case 14: get_pic8259_slave(device)->ir6_w(state); break;
663   case 15: get_pic8259_slave(device)->ir7_w(state); break;
664664   }
665665}
666666
667667IRQ_CALLBACK_MEMBER(apollo_state::apollo_pic_acknowledge)
668668{
669   UINT32 vector = pic8259_acknowledge(get_pic8259_master(&device));
669   UINT32 vector = get_pic8259_master(&device)->acknowledge();
670670   if ((vector & 0x0f) == APOLLO_IRQ_PIC_SLAVE) {
671      vector = pic8259_acknowledge(get_pic8259_slave(&device));
671      vector = get_pic8259_slave(&device)->acknowledge();
672672   }
673673
674674   // don't log ptm interrupts
r22822r22823
14191419
14201420   dma8237_1 = machine().device<i8237_device>(APOLLO_DMA1_TAG);
14211421   dma8237_2 = machine().device<i8237_device>(APOLLO_DMA2_TAG);
1422   pic8259_master = machine().device(APOLLO_PIC1_TAG);
1423   pic8259_slave = machine().device(APOLLO_PIC2_TAG);
1422   pic8259_master = machine().device<pic8259_device>(APOLLO_PIC1_TAG);
1423   pic8259_slave = machine().device<pic8259_device>(APOLLO_PIC2_TAG);
14241424
14251425   // set configuration
14261426   apollo_csr_set_servicemode(apollo_config(APOLLO_CONF_SERVICE_MODE));
trunk/src/mess/includes/b2m.h
r22822r22823
4242
4343   /* devices */
4444   fd1793_t *m_fdc;
45   device_t *m_pic;
45   pic8259_device *m_pic;
4646   required_device<speaker_sound_device> m_speaker;
4747   required_device<ram_device> m_ram;
4848   DECLARE_READ8_MEMBER(b2m_keyboard_r);
trunk/src/mess/includes/pk8020.h
r22822r22823
8282   required_device<ram_device> m_ram;
8383   required_device<device_t> m_wd1793;
8484   required_device<device_t> m_pit8253;
85   required_device<device_t> m_pic8259;
85   required_device<pic8259_device> m_pic8259;
8686   required_device<device_t> m_speaker;
8787   required_memory_region m_region_maincpu;
8888   required_memory_region m_region_gfx1;
trunk/src/mess/includes/apollo.h
r22822r22823
2525#include "machine/68681.h"
2626#include "machine/pc_fdc.h"
2727#include "machine/8237dma.h"
28#include "machine/pic8259.h"
2829
2930#ifndef VERBOSE
3031#define VERBOSE 0
r22822r22823
123124
124125   i8237_device *dma8237_1;
125126   i8237_device *dma8237_2;
126   device_t *pic8259_master;
127   device_t *pic8259_slave;
127   pic8259_device *pic8259_master;
128   pic8259_device *pic8259_slave;
128129
129130   DECLARE_WRITE16_MEMBER(apollo_csr_status_register_w);
130131   DECLARE_READ16_MEMBER(apollo_csr_status_register_r);
trunk/src/mess/includes/pc.h
r22822r22823
1717#include "sound/speaker.h"
1818#include "imagedev/cassette.h"
1919#include "machine/ram.h"
20#include "machine/pic8259.h"
2021
2122class pc_state : public driver_device
2223{
r22822r22823
3132      m_ram(*this, RAM_TAG) { }
3233
3334   required_device<cpu_device> m_maincpu;
34   device_t *m_pic8259;
35   pic8259_device *m_pic8259;
3536   optional_device<am9517a_device> m_dma8237;
3637   device_t *m_pit8253;
3738   optional_device<pc_kbdc_device>  m_pc_kbdc;
trunk/src/mess/includes/bebox.h
r22822r22823
1515#include "machine/53c810.h"
1616#include "machine/upd765.h"
1717#include "machine/ram.h"
18#include "machine/pic8259.h"
1819
1920struct bebox_devices_t
2021{
21   device_t *pic8259_master;
22   device_t *pic8259_slave;
22   pic8259_device *pic8259_master;
23   pic8259_device *pic8259_slave;
2324   i8237_device *dma8237_1;
2425   i8237_device *dma8237_2;
2526};
trunk/src/mess/includes/fmtowns.h
r22822r22823
9090   device_t* m_dma_1;
9191   device_t* m_dma_2;
9292   device_t* m_fdc;
93   device_t* m_pic_master;
94   device_t* m_pic_slave;
93   pic8259_device* m_pic_master;
94   pic8259_device* m_pic_slave;
9595   device_t* m_pit;
9696   ram_device* m_messram;
9797   cdrom_image_device* m_cdrom;
trunk/src/mess/video/pc_t1t.c
r22822r22823
991991   {
992992      pcjr.pc_framecnt++;
993993   }
994   pic8259_ir5_w(device->machine().device("pic8259"), state);
994   device->machine().device<pic8259_device>("pic8259")->ir5_w(state);
995995}
996996
997997static VIDEO_START( pc_t1t )
trunk/src/mess/video/fmtowns.c
r22822r22823
466466
467467WRITE8_MEMBER(towns_state::towns_video_5c8_w)
468468{
469   device_t* dev = m_pic_slave;
469   pic8259_device* dev = m_pic_slave;
470470
471471   switch(offset)
472472   {
473473      case 0x02:  // 0x5ca - VSync clear?
474         pic8259_ir3_w(dev, 0);
474         dev->ir3_w(0);
475475         if(IRQ_LOG) logerror("PIC: IRQ11 (VSync) set low\n");
476476         //towns_vblank_flag = 0;
477477         break;
r22822r22823
17671767{
17681768   // here we'll clear the vsync signal, I presume it goes low on it's own eventually
17691769   device_t* dev = (device_t*)ptr;
1770   pic8259_ir3_w(dev, 0);  // IRQ11 = VSync
1770   downcast<pic8259_device *>(dev)->ir3_w(0);  // IRQ11 = VSync
17711771   if(IRQ_LOG) logerror("PIC: IRQ11 (VSync) set low\n");
17721772   m_video.towns_vblank_flag = 0;
17731773}
17741774
17751775INTERRUPT_GEN_MEMBER(towns_state::towns_vsync_irq)
17761776{
1777   device_t* dev = m_pic_slave;
1778   pic8259_ir3_w(dev, 1);  // IRQ11 = VSync
1777   pic8259_device* dev = m_pic_slave;
1778   dev->ir3_w(1);  // IRQ11 = VSync
17791779   if(IRQ_LOG) logerror("PIC: IRQ11 (VSync) set high\n");
17801780   m_video.towns_vblank_flag = 1;
17811781   machine().scheduler().timer_set(machine().primary_screen->time_until_vblank_end(), timer_expired_delegate(FUNC(towns_state::towns_vblank_end),this), 0, (void*)dev);
trunk/src/mess/drivers/pc9801.c
r22822r22823
960960      if(offset & 0x14)
961961         printf("Read to undefined port [%02x]\n",offset+0x00);
962962      else
963         return pic8259_r(machine().device((offset & 8) ? "pic8259_slave" : "pic8259_master"), space, (offset & 2) >> 1);
963         return machine().device<pic8259_device>((offset & 8) ? "pic8259_slave" : "pic8259_master")->read(space, (offset & 2) >> 1);
964964   }
965965   else // odd
966966   {
r22822r22823
977977      if(offset & 0x14)
978978         printf("Write to undefined port [%02x] <- %02x\n",offset+0x00,data);
979979      else
980         pic8259_w(machine().device((offset & 8) ? "pic8259_slave" : "pic8259_master"), space, (offset & 2) >> 1, data);
980         machine().device<pic8259_device>((offset & 8) ? "pic8259_slave" : "pic8259_master")->write(space, (offset & 2) >> 1, data);
981981   }
982982   else // odd
983983   {
r22822r22823
29252925READ8_MEMBER(pc9801_state::get_slave_ack)
29262926{
29272927   if (offset==7) { // IRQ = 7
2928      return pic8259_acknowledge( machine().device( "pic8259_slave" ));
2928      return machine().device<pic8259_device>( "pic8259_slave" )->acknowledge();
29292929   }
29302930   return 0x00;
29312931}
r22822r22823
29642964      {
29652965         MAIN_CLOCK_X1,              /* heartbeat IRQ */
29662966         DEVCB_NULL,
2967         DEVCB_DEVICE_LINE("pic8259_master", pic8259_ir0_w)
2967         DEVCB_DEVICE_LINE_MEMBER("pic8259_master", pic8259_device, ir0_w)
29682968      }, {
29692969         MAIN_CLOCK_X1,              /* Memory Refresh */
29702970         DEVCB_NULL,
r22822r22823
29832983      {
29842984         MAIN_CLOCK_X2,              /* heartbeat IRQ */
29852985         DEVCB_NULL,
2986         DEVCB_DEVICE_LINE("pic8259_master", pic8259_ir0_w)
2986         DEVCB_DEVICE_LINE_MEMBER("pic8259_master", pic8259_device, ir0_w)
29872987      }, {
29882988         MAIN_CLOCK_X2,              /* Memory Refresh */
29892989         DEVCB_NULL,
r22822r22823
32523252void pc9801_state::fdc_2hd_irq(bool state)
32533253{
32543254//  printf("IRQ 2HD %d\n",state);
3255   pic8259_ir3_w(machine().device("pic8259_slave"), state);
3255   machine().device<pic8259_device>("pic8259_slave")->ir3_w(state);
32563256}
32573257
32583258void pc9801_state::fdc_2hd_drq(bool state)
r22822r22823
32673267
32683268   if(m_fdc_2dd_ctrl & 8)
32693269   {
3270      pic8259_ir2_w(machine().device("pic8259_slave"), state);
3270      machine().device<pic8259_device>("pic8259_slave")->ir2_w(state);
32713271   }
32723272}
32733273
r22822r22823
32843284   //printf("%02x %d\n",m_fdc_ctrl,state);
32853285
32863286   if(m_fdc_ctrl & 1)
3287      pic8259_ir3_w(machine().device("pic8259_slave"), state);
3287      machine().device<pic8259_device>("pic8259_slave")->ir3_w(state);
32883288   else
3289      pic8259_ir2_w(machine().device("pic8259_slave"), state);
3289      machine().device<pic8259_device>("pic8259_slave")->ir2_w(state);
32903290}
32913291
32923292void pc9801_state::pc9801rs_fdc_drq(bool state)
r22822r22823
33373337
33383338IRQ_CALLBACK_MEMBER(pc9801_state::irq_callback)
33393339{
3340   return pic8259_acknowledge( machine().device( "pic8259_master" ));
3340   return machine().device<pic8259_device>( "pic8259_master" )->acknowledge();
33413341}
33423342
33433343MACHINE_START_MEMBER(pc9801_state,pc9801_common)
r22822r22823
34973497{
34983498   if(m_vrtc_irq_mask)
34993499   {
3500      pic8259_ir2_w(machine().device("pic8259_master"), 0);
3501      pic8259_ir2_w(machine().device("pic8259_master"), 1);
3500      machine().device<pic8259_device>("pic8259_master")->ir2_w(0);
3501      machine().device<pic8259_device>("pic8259_master")->ir2_w(1);
35023502      m_vrtc_irq_mask = 0; // TODO: this irq auto-masks?
35033503   }
35043504//  else
r22822r22823
35213521      {
35223522//          printf("irq %02x\n",m_mouse.freq_reg);
35233523         m_mouse.freq_index = 0;
3524         pic8259_ir5_w(machine().device("pic8259_slave"), 0);
3525         pic8259_ir5_w(machine().device("pic8259_slave"), 1);
3524         machine().device<pic8259_device>("pic8259_slave")->ir5_w(0);
3525         machine().device<pic8259_device>("pic8259_slave")->ir5_w(1);
35263526      }
35273527   }
35283528}
35293529
35303530WRITE_LINE_MEMBER( pc9801_state::keyboard_irq )
35313531{
3532   pic8259_ir1_w(machine().device("pic8259_master"), state);
3532   machine().device<pic8259_device>("pic8259_master")->ir1_w(state);
35333533}
35343534
35353535static PC9801_KBD_INTERFACE( pc9801_keyboard_intf )
trunk/src/mess/drivers/bebox.c
r22822r22823
4747   AM_RANGE(0x7FFFF4F0, 0x7FFFF4F7) AM_WRITE(bebox_processor_resets_w )
4848
4949   AM_RANGE(0x80000000, 0x8000001F) AM_DEVREADWRITE8("dma8237_1", i8237_device, i8237_r, i8237_w, U64(0xffffffffffffffff) )
50   AM_RANGE(0x80000020, 0x8000003F) AM_DEVREADWRITE8_LEGACY("pic8259_master", pic8259_r, pic8259_w, U64(0xffffffffffffffff) )
50   AM_RANGE(0x80000020, 0x8000003F) AM_DEVREADWRITE8("pic8259_master", pic8259_device, read, write, U64(0xffffffffffffffff) )
5151   AM_RANGE(0x80000040, 0x8000005f) AM_DEVREADWRITE8_LEGACY("pit8254", pit8253_r, pit8253_w, U64(0xffffffffffffffff) )
5252   AM_RANGE(0x80000060, 0x8000006F) AM_DEVREADWRITE8("kbdc", kbdc8042_device, data_r, data_w, U64(0xffffffffffffffff) )
5353   AM_RANGE(0x80000070, 0x8000007F) AM_DEVREADWRITE8("rtc", mc146818_device, read, write , U64(0xffffffffffffffff) )
5454   AM_RANGE(0x80000080, 0x8000009F) AM_READWRITE8(bebox_page_r, bebox_page_w, U64(0xffffffffffffffff) )
55   AM_RANGE(0x800000A0, 0x800000BF) AM_DEVREADWRITE8_LEGACY("pic8259_slave", pic8259_r, pic8259_w, U64(0xffffffffffffffff) )
55   AM_RANGE(0x800000A0, 0x800000BF) AM_DEVREADWRITE8("pic8259_slave", pic8259_device, read, write, U64(0xffffffffffffffff) )
5656   AM_RANGE(0x800000C0, 0x800000DF) AM_READWRITE8(at_dma8237_1_r, at_dma8237_1_w, U64(0xffffffffffffffff))
5757   AM_RANGE(0x800001F0, 0x800001F7) AM_READWRITE8(bebox_800001F0_r, bebox_800001F0_w, U64(0xffffffffffffffff) )
5858   AM_RANGE(0x800002F8, 0x800002FF) AM_DEVREADWRITE8( "ns16550_1", ns16550_device, ins8250_r, ins8250_w, U64(0xffffffffffffffff) )
r22822r22823
155155{
156156   bebox_set_irq_bit(machine(), 16, state);
157157   if ( m_devices.pic8259_master ) {
158      pic8259_ir1_w(m_devices.pic8259_master, state);
158      m_devices.pic8259_master->ir1_w(state);
159159   }
160160}
161161
trunk/src/mess/drivers/iq151.c
r22822r22823
213213   ADDRESS_MAP_GLOBAL_MASK(0xff)
214214   AM_RANGE( 0x80, 0x80 ) AM_WRITE(boot_bank_w)
215215   AM_RANGE( 0x84, 0x87 ) AM_DEVREADWRITE("ppi8255", i8255_device, read, write)
216   AM_RANGE( 0x88, 0x89 ) AM_DEVREADWRITE_LEGACY("pic8259", pic8259_r, pic8259_w )
216   AM_RANGE( 0x88, 0x89 ) AM_DEVREADWRITE("pic8259", pic8259_device, read, write)
217217
218218   AM_RANGE( 0x00, 0xff ) AM_READWRITE(cartslot_io_r, cartslot_io_w)
219219ADDRESS_MAP_END
trunk/src/mess/drivers/paso1600.c
r22822r22823
231231static ADDRESS_MAP_START(paso1600_io, AS_IO, 16, paso1600_state)
232232   ADDRESS_MAP_UNMAP_LOW
233233   AM_RANGE(0x0000,0x000f) AM_DEVREADWRITE8("8237dma", i8237_device, i8237_r, i8237_w, 0xffff)
234   AM_RANGE(0x0010,0x0011) AM_DEVREADWRITE8_LEGACY("pic8259", pic8259_r,pic8259_w, 0xffff) // i8259
234   AM_RANGE(0x0010,0x0011) AM_DEVREADWRITE8("pic8259", pic8259_device, read, write, 0xffff) // i8259
235235   AM_RANGE(0x001a,0x001b) AM_READ(test_hi_r) // causes RAM error otherwise?
236236   AM_RANGE(0x0030,0x0033) AM_READWRITE8(key_r,key_w,0xffff) //UART keyboard?
237237   AM_RANGE(0x0048,0x0049) AM_READ(test_hi_r)
r22822r22823
277277
278278IRQ_CALLBACK_MEMBER(paso1600_state::paso1600_irq_callback)
279279{
280   return pic8259_acknowledge( machine().device( "pic8259" ) );
280   return machine().device<pic8259_device>( "pic8259" )->acknowledge();
281281}
282282
283283WRITE_LINE_MEMBER( paso1600_state::paso1600_set_int_line )
trunk/src/mess/drivers/victor9k.c
r22822r22823
3636
3737static ADDRESS_MAP_START( victor9k_mem, AS_PROGRAM, 8, victor9k_state )
3838//  AM_RANGE(0x00000, 0xdffff) AM_RAM
39   AM_RANGE(0xe0000, 0xe0001) AM_DEVREADWRITE_LEGACY(I8259A_TAG, pic8259_r, pic8259_w)
39   AM_RANGE(0xe0000, 0xe0001) AM_DEVREADWRITE(I8259A_TAG, pic8259_device, read, write)
4040   AM_RANGE(0xe0020, 0xe0023) AM_DEVREADWRITE_LEGACY(I8253_TAG, pit8253_r, pit8253_w)
4141   AM_RANGE(0xe0040, 0xe0043) AM_DEVREADWRITE(UPD7201_TAG, upd7201_device, cd_ba_r, cd_ba_w)
4242   AM_RANGE(0xe8000, 0xe8000) AM_DEVREADWRITE(HD46505S_TAG, mc6845_device, status_r, address_w)
r22822r22823
180180
181181static UPD7201_INTERFACE( mpsc_intf )
182182{
183   DEVCB_DEVICE_LINE(I8259A_TAG, pic8259_ir1_w), // interrupt
183   DEVCB_DEVICE_LINE_MEMBER(I8259A_TAG, pic8259_device, ir1_w), // interrupt
184184   {
185185      {
186186         0,                  // receive clock
trunk/src/mess/drivers/at.c
r22822r22823
9595static ADDRESS_MAP_START( at16_io, AS_IO, 16, at_state )
9696   ADDRESS_MAP_UNMAP_HIGH
9797   AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE8("dma8237_1", am9517a_device, read, write, 0xffff)
98   AM_RANGE(0x0020, 0x003f) AM_DEVREADWRITE8_LEGACY("pic8259_master", pic8259_r, pic8259_w, 0xffff)
98   AM_RANGE(0x0020, 0x003f) AM_DEVREADWRITE8("pic8259_master", pic8259_device, read, write, 0xffff)
9999   AM_RANGE(0x0040, 0x005f) AM_DEVREADWRITE8_LEGACY("pit8254", pit8253_r, pit8253_w, 0xffff)
100100   AM_RANGE(0x0060, 0x0063) AM_READWRITE8(at_keybc_r, at_keybc_w, 0xffff)
101101   AM_RANGE(0x0064, 0x0067) AM_DEVREADWRITE8("keybc", at_keyboard_controller_device, status_r, command_w, 0xffff)
102102   AM_RANGE(0x0070, 0x007f) AM_DEVREAD8("rtc", mc146818_device, read, 0xffff) AM_WRITE8(write_rtc , 0xffff)
103103   AM_RANGE(0x0080, 0x009f) AM_READWRITE8(at_page8_r, at_page8_w, 0xffff)
104   AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE8_LEGACY("pic8259_slave", pic8259_r, pic8259_w, 0xffff)
104   AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE8("pic8259_slave", pic8259_device, read, write, 0xffff)
105105   AM_RANGE(0x00c0, 0x00df) AM_READWRITE8(at_dma8237_2_r, at_dma8237_2_w, 0xffff)
106106ADDRESS_MAP_END
107107
r22822r22823
126126static ADDRESS_MAP_START( neat_io, AS_IO, 16, at_state )
127127   ADDRESS_MAP_UNMAP_HIGH
128128   AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE8("dma8237_1", am9517a_device, read, write, 0xffff)
129   AM_RANGE(0x0020, 0x0021) AM_DEVREADWRITE8_LEGACY("pic8259_master", pic8259_r, pic8259_w, 0xffff)
129   AM_RANGE(0x0020, 0x0021) AM_DEVREADWRITE8("pic8259_master", pic8259_device, read, write, 0xffff)
130130   AM_RANGE(0x0022, 0x0023) AM_READWRITE(neat_chipset_r, neat_chipset_w)
131131   AM_RANGE(0x0040, 0x005f) AM_DEVREADWRITE8_LEGACY("pit8254", pit8253_r, pit8253_w, 0xffff)
132132   AM_RANGE(0x0060, 0x0063) AM_READWRITE8(at_keybc_r, at_keybc_w, 0xffff)
133133   AM_RANGE(0x0064, 0x0067) AM_DEVREADWRITE8("keybc", at_keyboard_controller_device, status_r, command_w, 0xffff)
134134   AM_RANGE(0x0070, 0x007f) AM_DEVREADWRITE8("rtc", mc146818_device, read, write , 0xffff)
135135   AM_RANGE(0x0080, 0x009f) AM_READWRITE8(at_page8_r, at_page8_w, 0xffff)
136   AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE8_LEGACY("pic8259_slave", pic8259_r, pic8259_w, 0xffff)
136   AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE8("pic8259_slave", pic8259_device, read, write, 0xffff)
137137   AM_RANGE(0x00c0, 0x00df) AM_READWRITE8(at_dma8237_2_r, at_dma8237_2_w, 0xffff)
138138ADDRESS_MAP_END
139139
140140static ADDRESS_MAP_START( at386_io, AS_IO, 32, at_state )
141141   ADDRESS_MAP_UNMAP_HIGH
142142   AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE8("dma8237_1", am9517a_device, read, write, 0xffffffff)
143   AM_RANGE(0x0020, 0x003f) AM_DEVREADWRITE8_LEGACY("pic8259_master", pic8259_r, pic8259_w, 0xffffffff)
143   AM_RANGE(0x0020, 0x003f) AM_DEVREADWRITE8("pic8259_master", pic8259_device, read, write, 0xffffffff)
144144   AM_RANGE(0x0040, 0x005f) AM_DEVREADWRITE8_LEGACY("pit8254", pit8253_r, pit8253_w, 0xffffffff)
145145   AM_RANGE(0x0060, 0x0063) AM_READWRITE8(at_keybc_r, at_keybc_w, 0xffff)
146146   AM_RANGE(0x0064, 0x0067) AM_DEVREADWRITE8("keybc", at_keyboard_controller_device, status_r, command_w, 0xffff)
147147   AM_RANGE(0x0070, 0x007f) AM_DEVREADWRITE8("rtc", mc146818_device, read, write , 0xffffffff)
148148   AM_RANGE(0x0080, 0x009f) AM_READWRITE8(at_page8_r, at_page8_w, 0xffffffff)
149   AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE8_LEGACY("pic8259_slave", pic8259_r, pic8259_w, 0xffffffff)
149   AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE8("pic8259_slave", pic8259_device, read, write, 0xffffffff)
150150   AM_RANGE(0x00c0, 0x00df) AM_READWRITE8(at_dma8237_2_r, at_dma8237_2_w, 0xffffffff)
151151ADDRESS_MAP_END
152152
r22822r22823
154154READ32_MEMBER( at_state::ct486_chipset_r )
155155{
156156   if (ACCESSING_BITS_0_7)
157      return pic8259_r(m_pic8259_master, space, 0);
157      return m_pic8259_master->read(space, 0);
158158
159159   if (ACCESSING_BITS_8_15)
160      return pic8259_r(m_pic8259_master, space, 1) << 8;
160      return m_pic8259_master->read(space, 1) << 8;
161161
162162   if (ACCESSING_BITS_24_31)
163163      return m_cs4031->data_r(space, 0, 0) << 24;
r22822r22823
168168WRITE32_MEMBER( at_state::ct486_chipset_w )
169169{
170170   if (ACCESSING_BITS_0_7)
171      pic8259_w(m_pic8259_master, space, 0, data);
171      m_pic8259_master->write(space, 0, data);
172172
173173   if (ACCESSING_BITS_8_15)
174      pic8259_w(m_pic8259_master, space, 1, data >> 8);
174      m_pic8259_master->write(space, 1, data >> 8);
175175
176176   if (ACCESSING_BITS_16_23)
177177      m_cs4031->address_w(space, 0, data >> 16, 0);
r22822r22823
189189   AM_RANGE(0x0064, 0x0067) AM_DEVREADWRITE8("keybc", at_keyboard_controller_device, status_r, command_w, 0xffff)
190190   AM_RANGE(0x0070, 0x007f) AM_DEVREADWRITE8("rtc", mc146818_device, read, write , 0xffffffff)
191191   AM_RANGE(0x0080, 0x009f) AM_READWRITE8(at_page8_r, at_page8_w, 0xffffffff)
192   AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE8_LEGACY("pic8259_slave", pic8259_r, pic8259_w, 0xffffffff)
192   AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE8("pic8259_slave", pic8259_device, read, write, 0xffffffff)
193193   AM_RANGE(0x00c0, 0x00df) AM_READWRITE8(at_dma8237_2_r, at_dma8237_2_w, 0xffffffff)
194194ADDRESS_MAP_END
195195
r22822r22823
202202static ADDRESS_MAP_START( megapc_io, AS_IO, 32, at_state )
203203   ADDRESS_MAP_UNMAP_HIGH
204204   AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE8("dma8237_1", am9517a_device, read, write, 0xffffffff)
205   AM_RANGE(0x0020, 0x003f) AM_DEVREADWRITE8_LEGACY("pic8259_master", pic8259_r, pic8259_w, 0xffffffff)
205   AM_RANGE(0x0020, 0x003f) AM_DEVREADWRITE8("pic8259_master", pic8259_device, read, write, 0xffffffff)
206206   AM_RANGE(0x0040, 0x005f) AM_DEVREADWRITE8_LEGACY("pit8254", pit8253_r, pit8253_w, 0xffffffff)
207207   AM_RANGE(0x0060, 0x0063) AM_READWRITE8(at_keybc_r, at_keybc_w, 0xffff) // TODO: is this the correct type?
208208   AM_RANGE(0x0064, 0x0067) AM_DEVREADWRITE8("keybc", at_keyboard_controller_device, status_r, command_w, 0xffff)
209209   AM_RANGE(0x0070, 0x007f) AM_DEVREADWRITE8("rtc", mc146818_device, read, write , 0xffffffff)
210210   AM_RANGE(0x0080, 0x009f) AM_READWRITE8(at_page8_r, at_page8_w, 0xffffffff)
211   AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE8_LEGACY("pic8259_slave", pic8259_r, pic8259_w, 0xffffffff)
211   AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE8("pic8259_slave", pic8259_device, read, write, 0xffffffff)
212212   AM_RANGE(0x00c0, 0x00df) AM_READWRITE8(at_dma8237_2_r, at_dma8237_2_w, 0xffffffff)
213213ADDRESS_MAP_END
214214
trunk/src/mess/drivers/compis.c
r22822r22823
163163   AM_RANGE( 0x0000, 0x0007) AM_DEVREADWRITE8("ppi8255", i8255_device, read, write, 0xff00)
164164   AM_RANGE( 0x0080, 0x0087) AM_DEVREADWRITE8_LEGACY("pit8253", pit8253_r, pit8253_w, 0xffff)
165165   AM_RANGE( 0x0100, 0x011b) AM_DEVREADWRITE8_LEGACY("mm58274c", mm58274c_r, mm58274c_w, 0xffff)
166   AM_RANGE( 0x0280, 0x0283) AM_DEVREADWRITE8_LEGACY("pic8259_master", pic8259_r, pic8259_w, 0xffff) /* 80150/80130 */
166   AM_RANGE( 0x0280, 0x0283) AM_DEVREADWRITE8("pic8259_master", pic8259_device, read, write, 0xffff) /* 80150/80130 */
167167   //AM_RANGE( 0x0288, 0x028f) AM_DEVREADWRITE_LEGACY("pit8254", compis_osp_pit_r, compis_osp_pit_w ) /* PIT 8254 (80150/80130)  */
168168   AM_RANGE( 0x0310, 0x031f) AM_READWRITE( compis_usart_r, compis_usart_w )    /* USART 8251 Keyboard      */
169169   AM_RANGE( 0x0330, 0x0333) AM_DEVREADWRITE8("upd7220", upd7220_device, read, write, 0x00ff) /* GDC 82720 PCS6:6     */
trunk/src/mess/drivers/apricot.c
r22822r22823
125125
126126WRITE_LINE_MEMBER(apricot_state::apricot_sio_irq_w)
127127{
128   pic8259_ir5_w(m_pic, state);
128   m_pic->ir5_w(state);
129129}
130130
131131static const z80sio_interface apricot_z80sio_intf =
r22822r22823
162162
163163WRITE_LINE_MEMBER( apricot_state::apricot_wd2793_intrq_w )
164164{
165   pic8259_ir4_w(m_pic, state);
165   m_pic->ir4_w(state);
166166//  i8089 external terminate channel 1
167167}
168168
r22822r22823
285285ADDRESS_MAP_END
286286
287287static ADDRESS_MAP_START( apricot_io, AS_IO, 16, apricot_state )
288   AM_RANGE(0x00, 0x03) AM_DEVREADWRITE8_LEGACY("ic31", pic8259_r, pic8259_w, 0x00ff)
288   AM_RANGE(0x00, 0x03) AM_DEVREADWRITE8("ic31", pic8259_device, read, write, 0x00ff)
289289   AM_RANGE(0x40, 0x47) AM_DEVREADWRITE8_LEGACY("ic68", wd17xx_r, wd17xx_w, 0x00ff)
290290   AM_RANGE(0x48, 0x4f) AM_DEVREADWRITE8("ic17", i8255_device, read, write, 0x00ff)
291291   AM_RANGE(0x50, 0x51) AM_MIRROR(0x06) AM_DEVWRITE8("ic7", sn76489_device, write, 0x00ff)
trunk/src/mess/drivers/z100.c
r22822r22823
409409//  AM_RANGE (0xe4, 0xe7) 8253 PIT
410410//  AM_RANGE (0xe8, 0xeb) First 2661-2 serial port (printer)
411411//  AM_RANGE (0xec, 0xef) Second 2661-2 serial port (modem)
412   AM_RANGE (0xf0, 0xf1) AM_DEVREADWRITE_LEGACY("pic8259_slave", pic8259_r, pic8259_w)
413   AM_RANGE (0xf2, 0xf3) AM_DEVREADWRITE_LEGACY("pic8259_master", pic8259_r, pic8259_w)
412   AM_RANGE (0xf0, 0xf1) AM_DEVREADWRITE("pic8259_slave", pic8259_device, read, write)
413   AM_RANGE (0xf2, 0xf3) AM_DEVREADWRITE("pic8259_master", pic8259_device, read, write)
414414   AM_RANGE (0xf4, 0xf4) AM_READ(keyb_data_r) // -> 8041 MCU
415415   AM_RANGE (0xf5, 0xf5) AM_READWRITE(keyb_status_r,keyb_command_w)
416416//  AM_RANGE (0xf6, 0xf6) expansion ROM is present (bit 0, active low)
trunk/src/mess/drivers/tsispch.c
r22822r22823
129129*****************************************************************************/
130130WRITE_LINE_MEMBER(tsispch_state::i8251_rxrdy_int)
131131{
132   pic8259_ir1_w(machine().device("pic8259"), state);
132   machine().device<pic8259_device>("pic8259")->ir1_w(state);
133133}
134134
135135WRITE_LINE_MEMBER(tsispch_state::i8251_txempty_int)
136136{
137   pic8259_ir2_w(machine().device("pic8259"), state);
137   machine().device<pic8259_device>("pic8259")->ir2_w(state);
138138}
139139
140140WRITE_LINE_MEMBER(tsispch_state::i8251_txrdy_int)
141141{
142   pic8259_ir3_w(machine().device("pic8259"), state);
142   machine().device<pic8259_device>("pic8259")->ir3_w(state);
143143}
144144
145145const i8251_interface i8251_config =
r22822r22823
182182
183183IRQ_CALLBACK_MEMBER(tsispch_state::irq_callback)
184184{
185   return pic8259_acknowledge(machine().device("pic8259"));
185   return machine().device<pic8259_device>("pic8259")->acknowledge();
186186}
187187
188188/*****************************************************************************
r22822r22823
347347   AM_RANGE(0x00000, 0x02FFF) AM_MIRROR(0x34000) AM_RAM // verified; 6264*2 sram, only first 3/4 used
348348   AM_RANGE(0x03000, 0x03001) AM_MIRROR(0x341FC) AM_DEVREADWRITE8("i8251a_u15", i8251_device, data_r, data_w, 0x00FF)
349349   AM_RANGE(0x03002, 0x03003) AM_MIRROR(0x341FC) AM_DEVREADWRITE8("i8251a_u15", i8251_device, status_r, control_w, 0x00FF)
350   AM_RANGE(0x03200, 0x03203) AM_MIRROR(0x341FC) AM_DEVREADWRITE8_LEGACY("pic8259", pic8259_r, pic8259_w, 0x00FF) // AMD P8259 PIC @ U5 (reads as 04 and 7c, upper byte is open bus)
350   AM_RANGE(0x03200, 0x03203) AM_MIRROR(0x341FC) AM_DEVREADWRITE8("pic8259", pic8259_device, read, write, 0x00FF) // AMD P8259 PIC @ U5 (reads as 04 and 7c, upper byte is open bus)
351351   AM_RANGE(0x03400, 0x03401) AM_MIRROR(0x341FE) AM_READ8(dsw_r, 0x00FF) // verified, read from dipswitch s4
352352   AM_RANGE(0x03400, 0x03401) AM_MIRROR(0x341FE) AM_WRITE8(peripheral_w, 0xFF00) // verified, write to the 4 leds, plus 4 control bits
353353   AM_RANGE(0x03600, 0x03601) AM_MIRROR(0x341FC) AM_READWRITE(dsp_data_r, dsp_data_w) // verified; UPD77P20 data reg r/w
trunk/src/mess/drivers/b2m.c
r22822r22823
3535   AM_RANGE(0x08, 0x0b) AM_DEVREADWRITE("ppi8255_1", i8255_device, read, write)
3636   AM_RANGE(0x0c, 0x0c) AM_READWRITE(b2m_localmachine_r,b2m_localmachine_w)
3737   AM_RANGE(0x10, 0x13) AM_READWRITE(b2m_palette_r,b2m_palette_w)
38   AM_RANGE(0x14, 0x15) AM_DEVREADWRITE_LEGACY("pic8259", pic8259_r, pic8259_w )
38   AM_RANGE(0x14, 0x15) AM_DEVREADWRITE("pic8259", pic8259_device, read, write )
3939   AM_RANGE(0x18, 0x18) AM_DEVREADWRITE("uart", i8251_device, data_r, data_w)
4040   AM_RANGE(0x19, 0x19) AM_DEVREADWRITE("uart", i8251_device, status_r, control_w)
4141   AM_RANGE(0x1c, 0x1f) AM_DEVREADWRITE("fd1793", fd1793_t, read, write)
r22822r22823
4848   AM_RANGE(0x08, 0x0b) AM_DEVREADWRITE("ppi8255_1", i8255_device, read, write)
4949   AM_RANGE(0x0c, 0x0c) AM_READWRITE(b2m_localmachine_r,b2m_localmachine_w)
5050   AM_RANGE(0x10, 0x13) AM_READWRITE(b2m_palette_r,b2m_palette_w)
51   AM_RANGE(0x14, 0x15) AM_DEVREADWRITE_LEGACY("pic8259", pic8259_r, pic8259_w )
51   AM_RANGE(0x14, 0x15) AM_DEVREADWRITE("pic8259", pic8259_device, read, write )
5252   AM_RANGE(0x18, 0x18) AM_DEVREADWRITE("uart", i8251_device, data_r, data_w)
5353   AM_RANGE(0x19, 0x19) AM_DEVREADWRITE("uart", i8251_device, status_r, control_w)
5454ADDRESS_MAP_END
trunk/src/mess/drivers/pc.c
r22822r22823
152152ADDRESS_MAP_END
153153
154154static ADDRESS_MAP_START(mc1502_io, AS_IO, 8, pc_state )
155   AM_RANGE(0x0020, 0x0021) AM_DEVREADWRITE_LEGACY("pic8259", pic8259_r, pic8259_w)
155   AM_RANGE(0x0020, 0x0021) AM_DEVREADWRITE("pic8259", pic8259_device, read, write)
156156   AM_RANGE(0x0028, 0x0028) AM_DEVREADWRITE("upd8251", i8251_device, data_r, data_w)   // not working yet
157157   AM_RANGE(0x0029, 0x0029) AM_DEVREADWRITE("upd8251", i8251_device, status_r, control_w)
158158   AM_RANGE(0x0040, 0x0043) AM_DEVREADWRITE_LEGACY("pit8253", pit8253_r, pit8253_w)
r22822r22823
190190static ADDRESS_MAP_START(pc8_io, AS_IO, 8, pc_state )
191191   ADDRESS_MAP_UNMAP_HIGH
192192   AM_RANGE(0x0000, 0x000f) AM_DEVREADWRITE("dma8237", am9517a_device, read, write)
193   AM_RANGE(0x0020, 0x0021) AM_DEVREADWRITE_LEGACY("pic8259", pic8259_r, pic8259_w)
193   AM_RANGE(0x0020, 0x0021) AM_DEVREADWRITE("pic8259", pic8259_device, read, write)
194194   AM_RANGE(0x0040, 0x0043) AM_DEVREADWRITE_LEGACY("pit8253", pit8253_r, pit8253_w)
195195   AM_RANGE(0x0060, 0x0063) AM_DEVREADWRITE("ppi8255", i8255_device, read, write)
196196   AM_RANGE(0x0080, 0x0087) AM_READWRITE(pc_page_r,            pc_page_w)
r22822r22823
215215static ADDRESS_MAP_START(pc16_io, AS_IO, 16, pc_state )
216216   ADDRESS_MAP_UNMAP_HIGH
217217   AM_RANGE(0x0000, 0x000f) AM_DEVREADWRITE8("dma8237", am9517a_device, read, write, 0xffff)
218   AM_RANGE(0x0020, 0x0021) AM_DEVREADWRITE8_LEGACY("pic8259", pic8259_r, pic8259_w, 0xffff)
218   AM_RANGE(0x0020, 0x0021) AM_DEVREADWRITE8("pic8259", pic8259_device, read, write, 0xffff)
219219   AM_RANGE(0x0040, 0x0043) AM_DEVREADWRITE8_LEGACY("pit8253", pit8253_r, pit8253_w, 0xffff)
220220   AM_RANGE(0x0060, 0x0063) AM_DEVREADWRITE8("ppi8255", i8255_device, read, write, 0xffff)
221221   AM_RANGE(0x0070, 0x007f) AM_RAM // needed for Poisk-2
r22822r22823
238238static ADDRESS_MAP_START(ec1841_io, AS_IO, 16, pc_state)
239239   ADDRESS_MAP_UNMAP_HIGH
240240   AM_RANGE(0x0000, 0x000f) AM_DEVREADWRITE8("dma8237", am9517a_device, read, write, 0xffff)
241   AM_RANGE(0x0020, 0x0021) AM_DEVREADWRITE8_LEGACY("pic8259", pic8259_r, pic8259_w, 0xffff)
241   AM_RANGE(0x0020, 0x0021) AM_DEVREADWRITE8("pic8259", pic8259_device, read, write, 0xffff)
242242   AM_RANGE(0x0040, 0x0043) AM_DEVREADWRITE8_LEGACY("pit8253", pit8253_r, pit8253_w, 0xffff)
243243   AM_RANGE(0x0060, 0x0063) AM_DEVREADWRITE8("ppi8255", i8255_device, read, write, 0xffff)
244244   AM_RANGE(0x0080, 0x0087) AM_READWRITE8(pc_page_r,               pc_page_w, 0xffff)
r22822r22823
259259static ADDRESS_MAP_START(iskr1031_io, AS_IO, 16, pc_state)
260260   ADDRESS_MAP_UNMAP_HIGH
261261   AM_RANGE(0x0000, 0x000f) AM_DEVREADWRITE8("dma8237", am9517a_device, read, write, 0xffff)
262   AM_RANGE(0x0020, 0x0021) AM_DEVREADWRITE8_LEGACY("pic8259", pic8259_r, pic8259_w, 0xffff)
262   AM_RANGE(0x0020, 0x0021) AM_DEVREADWRITE8("pic8259", pic8259_device, read, write, 0xffff)
263263   AM_RANGE(0x0040, 0x0043) AM_DEVREADWRITE8_LEGACY("pit8253", pit8253_r, pit8253_w, 0xffff)
264264   AM_RANGE(0x0060, 0x0063) AM_DEVREADWRITE8("ppi8255", i8255_device, read, write, 0xffff)
265265   AM_RANGE(0x0080, 0x0087) AM_READWRITE8(pc_page_r,               pc_page_w, 0xffff)
r22822r22823
277277
278278static ADDRESS_MAP_START(asst128_io, AS_IO, 16, pc_state)
279279   ADDRESS_MAP_UNMAP_HIGH
280   AM_RANGE(0x0020, 0x0021) AM_DEVREADWRITE8_LEGACY("pic8259", pic8259_r, pic8259_w, 0xffff)
280   AM_RANGE(0x0020, 0x0021) AM_DEVREADWRITE8("pic8259", pic8259_device, read, write, 0xffff)
281281   AM_RANGE(0x0040, 0x0043) AM_DEVREADWRITE8_LEGACY("pit8253", pit8253_r, pit8253_w, 0xffff)
282282   AM_RANGE(0x0060, 0x0063) AM_DEVREADWRITE8("ppi8255", i8255_device, read, write, 0xffff)
283283   AM_RANGE(0x0080, 0x0087) AM_READWRITE8(pc_page_r,               pc_page_w, 0xffff)
r22822r22823
309309static ADDRESS_MAP_START(ibm5550_io, AS_IO, 16, pc_state )
310310   ADDRESS_MAP_UNMAP_HIGH
311311   AM_RANGE(0x0000, 0x000f) AM_DEVREADWRITE8("dma8237", am9517a_device, read, write, 0xffff)
312   AM_RANGE(0x0020, 0x0021) AM_DEVREADWRITE8_LEGACY("pic8259", pic8259_r, pic8259_w, 0xffff)
312   AM_RANGE(0x0020, 0x0021) AM_DEVREADWRITE8("pic8259", pic8259_device, read, write, 0xffff)
313313   AM_RANGE(0x0040, 0x0043) AM_DEVREADWRITE8_LEGACY("pit8253", pit8253_r, pit8253_w, 0xffff)
314314   AM_RANGE(0x0060, 0x0063) AM_DEVREADWRITE8("ppi8255", i8255_device, read, write, 0xffff)
315315   AM_RANGE(0x0080, 0x0087) AM_READWRITE8(pc_page_r,               pc_page_w, 0xffff)
r22822r22823
341341
342342static ADDRESS_MAP_START(europc_io, AS_IO, 8, europc_pc_state )
343343   AM_RANGE(0x0000, 0x000f) AM_DEVREADWRITE("dma8237", am9517a_device, read, write)
344   AM_RANGE(0x0020, 0x0021) AM_DEVREADWRITE_LEGACY("pic8259", pic8259_r, pic8259_w)
344   AM_RANGE(0x0020, 0x0021) AM_DEVREADWRITE("pic8259", pic8259_device, read, write)
345345   AM_RANGE(0x0040, 0x0043) AM_DEVREADWRITE_LEGACY("pit8253", pit8253_r, pit8253_w)
346346   AM_RANGE(0x0060, 0x0063) AM_READWRITE(europc_pio_r,          europc_pio_w)
347347   AM_RANGE(0x0080, 0x0087) AM_READWRITE(pc_page_r,            pc_page_w)
r22822r22823
375375
376376static ADDRESS_MAP_START(tandy1000_io, AS_IO, 8, tandy_pc_state )
377377   AM_RANGE(0x0000, 0x000f) AM_DEVREADWRITE("dma8237", am9517a_device, read, write)
378   AM_RANGE(0x0020, 0x0021) AM_DEVREADWRITE_LEGACY("pic8259", pic8259_r, pic8259_w)
378   AM_RANGE(0x0020, 0x0021) AM_DEVREADWRITE("pic8259", pic8259_device, read, write)
379379   AM_RANGE(0x0040, 0x0043) AM_DEVREADWRITE_LEGACY("pit8253", pit8253_r, pit8253_w)
380380   AM_RANGE(0x0060, 0x0063) AM_READWRITE(tandy1000_pio_r,           tandy1000_pio_w)
381381   AM_RANGE(0x0080, 0x0087) AM_READWRITE(pc_page_r,                pc_page_w)
r22822r22823
405405
406406static ADDRESS_MAP_START(tandy1000_16_io, AS_IO, 16, tandy_pc_state )
407407   AM_RANGE(0x0000, 0x000f) AM_DEVREADWRITE8("dma8237", am9517a_device, read, write, 0xffff)
408   AM_RANGE(0x0020, 0x0021) AM_DEVREADWRITE8_LEGACY("pic8259", pic8259_r, pic8259_w, 0xffff)
408   AM_RANGE(0x0020, 0x0021) AM_DEVREADWRITE8("pic8259", pic8259_device, read, write, 0xffff)
409409   AM_RANGE(0x0040, 0x0043) AM_DEVREADWRITE8_LEGACY("pit8253", pit8253_r, pit8253_w, 0xffff)
410410   AM_RANGE(0x0060, 0x0063) AM_READWRITE8(tandy1000_pio_r,          tandy1000_pio_w, 0xffff)
411411   AM_RANGE(0x0080, 0x0087) AM_READWRITE8(pc_page_r,               pc_page_w, 0xffff)
r22822r22823
437437
438438static ADDRESS_MAP_START(tandy1000_286_io, AS_IO, 16, tandy_pc_state )
439439   AM_RANGE(0x0000, 0x000f) AM_DEVREADWRITE8("dma8237", am9517a_device, read, write, 0xffff)
440   AM_RANGE(0x0020, 0x0021) AM_DEVREADWRITE8_LEGACY("pic8259", pic8259_r, pic8259_w, 0xffff)
440   AM_RANGE(0x0020, 0x0021) AM_DEVREADWRITE8("pic8259", pic8259_device, read, write, 0xffff)
441441   AM_RANGE(0x0040, 0x0043) AM_DEVREADWRITE8_LEGACY("pit8253", pit8253_r, pit8253_w, 0xffff)
442442   AM_RANGE(0x0060, 0x0063) AM_READWRITE8(tandy1000_pio_r,         tandy1000_pio_w, 0xffff)
443443   AM_RANGE(0x0080, 0x0087) AM_READWRITE8(pc_page_r,               pc_page_w, 0xffff)
r22822r22823
466466
467467
468468static ADDRESS_MAP_START(ibmpcjr_io, AS_IO, 8, tandy_pc_state )
469   AM_RANGE(0x0020, 0x0021) AM_DEVREADWRITE_LEGACY("pic8259", pic8259_r, pic8259_w)
469   AM_RANGE(0x0020, 0x0021) AM_DEVREADWRITE("pic8259", pic8259_device, read, write)
470470   AM_RANGE(0x0040, 0x0043) AM_DEVREADWRITE_LEGACY("pit8253", pit8253_r, pit8253_w)
471471   AM_RANGE(0x0060, 0x0063) AM_DEVREADWRITE("ppi8255", i8255_device, read, write)
472472   AM_RANGE(0x0080, 0x0087) AM_READWRITE(pc_page_r,                pc_page_w)
trunk/src/mess/drivers/amstr_pc.c
r22822r22823
8080
8181static ADDRESS_MAP_START(ppc512_io, AS_IO, 16, amstrad_pc_state )
8282   AM_RANGE(0x0000, 0x000f) AM_DEVREADWRITE8("dma8237", am9517a_device, read, write, 0xffff)
83   AM_RANGE(0x0020, 0x0021) AM_DEVREADWRITE8_LEGACY("pic8259", pic8259_r, pic8259_w, 0xffff)
83   AM_RANGE(0x0020, 0x0021) AM_DEVREADWRITE8("pic8259", pic8259_device, read, write, 0xffff)
8484   AM_RANGE(0x0040, 0x0043) AM_DEVREADWRITE8_LEGACY("pit8253", pit8253_r, pit8253_w, 0xffff)
8585   AM_RANGE(0x0060, 0x0065) AM_READWRITE8(pc1640_port60_r, pc1640_port60_w, 0xffff)
8686   AM_RANGE(0x0070, 0x0071) AM_DEVREADWRITE8("rtc", mc146818_device, read, write, 0xffff)
r22822r22823
109109
110110static ADDRESS_MAP_START(pc200_io, AS_IO, 16, amstrad_pc_state )
111111   AM_RANGE(0x0000, 0x000f) AM_DEVREADWRITE8("dma8237", am9517a_device, read, write, 0xffff)
112   AM_RANGE(0x0020, 0x0021) AM_DEVREADWRITE8_LEGACY("pic8259", pic8259_r, pic8259_w, 0xffff)
112   AM_RANGE(0x0020, 0x0021) AM_DEVREADWRITE8("pic8259", pic8259_device, read, write, 0xffff)
113113   AM_RANGE(0x0040, 0x0043) AM_DEVREADWRITE8_LEGACY("pit8253", pit8253_r, pit8253_w, 0xffff)
114114   AM_RANGE(0x0060, 0x0065) AM_READWRITE8(pc1640_port60_r, pc1640_port60_w, 0xffff)
115115   AM_RANGE(0x0078, 0x0079) AM_READWRITE8(pc1640_mouse_x_r, pc1640_mouse_x_w, 0xffff)
trunk/src/mess/drivers/fmtowns.c
r22822r22823
487487{
488488   if(m_towns_fdc_irq6mask == 0)
489489      state = 0;
490   pic8259_ir6_w(m_pic_master, state);  // IRQ6 = FDC
490   m_pic_master->ir6_w(state);  // IRQ6 = FDC
491491   if(IRQ_LOG) logerror("PIC: IRQ6 (FDC) set to %i\n",state);
492492}
493493
r22822r22823
671671   m_towns_kb_status |= 0x01;
672672   if(m_towns_kb_irq1_enable)
673673   {
674      pic8259_ir1_w(m_pic_master, 1);
674      m_pic_master->ir1_w(1);
675675      if(IRQ_LOG) logerror("PIC: IRQ1 (keyboard) set high\n");
676676   }
677677   logerror("KB: sending scancode 0x%02x\n",scancode);
r22822r22823
712712      case 0:  // scancode output
713713         ret = m_towns_kb_output;
714714         //logerror("KB: read keyboard output port, returning %02x\n",ret);
715         pic8259_ir1_w(m_pic_master, 0);
715         m_pic_master->ir1_w(0);
716716         if(IRQ_LOG) logerror("PIC: IRQ1 (keyboard) set low\n");
717717         if(m_towns_kb_extend != 0xff)
718718         {
r22822r22823
793793
794794WRITE8_MEMBER(towns_state::towns_port60_w)
795795{
796   device_t* dev = m_pic_master;
796   //device_t* dev = m_pic_master;
797797
798798   if(data & 0x80)
799799   {
800800      //towns_pic_irq(dev,0);
801801      m_timer0 = 0;
802      pic8259_ir0_w(dev, m_timer0 || m_timer1);
802      m_pic_master->ir0_w(m_timer0 || m_timer1);
803803   }
804804   m_towns_timer_mask = data & 0x07;
805805
r22822r22823
859859         m_towns_pcm_irq_flag = 0;
860860         if(m_towns_fm_irq_flag == 0)
861861         {
862            pic8259_ir5_w(m_pic_slave, 0);
862            m_pic_slave->ir5_w(0);
863863            if(IRQ_LOG) logerror("PIC: IRQ13 (PCM) set low\n");
864864         }
865865         break;
r22822r22823
13211321//                  if(m_towns_cd.mpu_irq_enable)
13221322               {
13231323                  m_towns_cd.status |= 0x80;
1324                  pic8259_ir1_w(m_pic_slave, 1);
1324                  m_pic_slave->ir1_w(1);
13251325                  if(IRQ_LOG) logerror("PIC: IRQ9 (CD-ROM) set high\n");
13261326               }
13271327            }
r22822r22823
13311331         else
13321332         {
13331333            m_towns_cd.status &= ~0x80;
1334            pic8259_ir1_w(m_pic_slave, 0);
1334            m_pic_slave->ir1_w(0);
13351335            if(IRQ_LOG) logerror("PIC: IRQ9 (CD-ROM) set low\n");
13361336         }
13371337         break;
r22822r22823
13431343//                  if(m_towns_cd.dma_irq_enable)
13441344               {
13451345                  m_towns_cd.status |= 0x40;
1346                  pic8259_ir1_w(m_pic_slave, 1);
1346                  m_pic_slave->ir1_w(1);
13471347                  if(IRQ_LOG) logerror("PIC: IRQ9 (CD-ROM DMA) set high\n");
13481348               }
13491349            }
r22822r22823
13531353         else
13541354         {
13551355            m_towns_cd.status &= ~0x40;
1356            pic8259_ir1_w(m_pic_slave, 0);
1356            m_pic_slave->ir1_w(0);
13571357            if(IRQ_LOG) logerror("PIC: IRQ9 (CD-ROM DMA) set low\n");
13581358         }
13591359         break;
r22822r22823
19861986
19871987WRITE_LINE_MEMBER(towns_state::towns_scsi_irq)
19881988{
1989   pic8259_ir0_w(m_pic_slave, state);
1989   m_pic_slave->ir0_w(state);
19901990   if(IRQ_LOG)
19911991      logerror("PIC: IRQ8 (SCSI) set to %i\n",state);
19921992}
r22822r22823
20512051
20522052IRQ_CALLBACK_MEMBER(towns_state::towns_irq_callback)
20532053{
2054   return pic8259_acknowledge(m_pic_master);
2054   return m_pic_master->acknowledge();
20552055}
20562056
20572057// YM3438 interrupt (IRQ 13)
r22822r22823
20602060   if(state)
20612061   {
20622062      m_towns_fm_irq_flag = 1;
2063      pic8259_ir5_w(m_pic_slave, 1);
2063      m_pic_slave->ir5_w(1);
20642064      if(IRQ_LOG) logerror("PIC: IRQ13 (FM) set high\n");
20652065   }
20662066   else
r22822r22823
20682068      m_towns_fm_irq_flag = 0;
20692069      if(m_towns_pcm_irq_flag == 0)
20702070      {
2071         pic8259_ir5_w(m_pic_slave, 0);
2071         m_pic_slave->ir5_w(0);
20722072         if(IRQ_LOG) logerror("PIC: IRQ13 (FM) set low\n");
20732073      }
20742074   }
r22822r22823
20782078static void towns_pcm_irq(device_t* device, int channel)
20792079{
20802080   towns_state* state = device->machine().driver_data<towns_state>();
2081   device_t* pic = state->m_pic_slave;
2081   pic8259_device* pic = state->m_pic_slave;
20822082
20832083   if(state->m_towns_pcm_channel_mask & (1 << channel))
20842084   {
20852085      state->m_towns_pcm_irq_flag = 1;
20862086      state->m_towns_pcm_channel_flag |= (1 << channel);
2087      pic8259_ir5_w(pic, 1);
2087      pic->ir5_w(1);
20882088      if(IRQ_LOG) logerror("PIC: IRQ13 (PCM) set high (channel %i)\n",channel);
20892089   }
20902090}
r22822r22823
20972097
20982098WRITE_LINE_MEMBER(towns_state::towns_pit_out0_changed)
20992099{
2100   device_t* dev = m_pic_master;
2100   pic8259_device* dev = m_pic_master;
21012101
21022102   if(m_towns_timer_mask & 0x01)
21032103   {
r22822r22823
21072107   else
21082108      m_timer0 = 0;
21092109
2110   pic8259_ir0_w(dev, m_timer0 || m_timer1);
2110   dev->ir0_w(m_timer0 || m_timer1);
21112111}
21122112
21132113WRITE_LINE_MEMBER(towns_state::towns_pit_out1_changed)
21142114{
2115   device_t* dev = m_pic_master;
2115   pic8259_device* dev = m_pic_master;
21162116
21172117   if(m_towns_timer_mask & 0x02)
21182118   {
r22822r22823
21222122   else
21232123      m_timer1 = 0;
21242124
2125   pic8259_ir0_w(dev, m_timer0 || m_timer1);
2125   dev->ir0_w(m_timer0 || m_timer1);
21262126}
21272127
21282128WRITE_LINE_MEMBER( towns_state::pit_out2_changed )
r22822r22823
22132213   // I/O ports derived from FM Towns/Bochs, these are specific to the FM Towns
22142214   // System ports
22152215   ADDRESS_MAP_UNMAP_HIGH
2216   AM_RANGE(0x0000,0x0003) AM_DEVREADWRITE8_LEGACY("pic8259_master", pic8259_r, pic8259_w, 0x00ff00ff)
2217   AM_RANGE(0x0010,0x0013) AM_DEVREADWRITE8_LEGACY("pic8259_slave", pic8259_r, pic8259_w, 0x00ff00ff)
2216   AM_RANGE(0x0000,0x0003) AM_DEVREADWRITE8("pic8259_master", pic8259_device, read, write, 0x00ff00ff)
2217   AM_RANGE(0x0010,0x0013) AM_DEVREADWRITE8("pic8259_slave", pic8259_device, read, write, 0x00ff00ff)
22182218   AM_RANGE(0x0020,0x0033) AM_READWRITE8(towns_system_r,towns_system_w, 0xffffffff)
22192219   AM_RANGE(0x0040,0x0047) AM_DEVREADWRITE8_LEGACY("pit",pit8253_r, pit8253_w, 0x00ff00ff)
22202220   AM_RANGE(0x0050,0x0057) AM_DEVREADWRITE8_LEGACY("pit2",pit8253_r, pit8253_w, 0x00ff00ff)
r22822r22823
22652265static ADDRESS_MAP_START( towns16_io , AS_IO, 16, towns_state)  // for the 386SX based systems
22662266   // System ports
22672267   ADDRESS_MAP_UNMAP_HIGH
2268   AM_RANGE(0x0000,0x0003) AM_DEVREADWRITE8_LEGACY("pic8259_master", pic8259_r, pic8259_w, 0x00ff)
2269   AM_RANGE(0x0010,0x0013) AM_DEVREADWRITE8_LEGACY("pic8259_slave", pic8259_r, pic8259_w, 0x00ff)
2268   AM_RANGE(0x0000,0x0003) AM_DEVREADWRITE8("pic8259_master", pic8259_device, read, write, 0x00ff)
2269   AM_RANGE(0x0010,0x0013) AM_DEVREADWRITE8("pic8259_slave", pic8259_device, read, write, 0x00ff)
22702270   AM_RANGE(0x0020,0x0033) AM_READWRITE8(towns_system_r,towns_system_w, 0xffff)
22712271   AM_RANGE(0x0040,0x0047) AM_DEVREADWRITE8_LEGACY("pit",pit8253_r, pit8253_w, 0x00ff)
22722272   AM_RANGE(0x0050,0x0057) AM_DEVREADWRITE8_LEGACY("pit2",pit8253_r, pit8253_w, 0x00ff)
r22822r22823
25702570
25712571void towns_state::driver_start()
25722572{
2573   m_pic_master = machine().device("pic8259_master");
2574   m_pic_slave = machine().device("pic8259_slave");
2573   m_pic_master = machine().device<pic8259_device>("pic8259_master");
2574   m_pic_slave = machine().device<pic8259_device>("pic8259_slave");
25752575   m_towns_vram = auto_alloc_array(machine(),UINT32,0x20000);
25762576   m_towns_gfxvram = auto_alloc_array(machine(),UINT8,0x80000);
25772577   m_towns_txtvram = auto_alloc_array(machine(),UINT8,0x20000);
r22822r22823
26102610   m_dma_1 = machine().device("dma_1");
26112611   m_dma_2 = machine().device("dma_2");
26122612   m_fdc = machine().device("fdc");
2613   m_pic_master = machine().device("pic8259_master");
2614   m_pic_slave = machine().device("pic8259_slave");
2613   m_pic_master = machine().device<pic8259_device>("pic8259_master");
2614   m_pic_slave = machine().device<pic8259_device>("pic8259_slave");
26152615   m_pit = machine().device("pit");
26162616   m_messram = m_ram;
26172617   m_cdrom = machine().device<cdrom_image_device>("cdrom");
r22822r22823
26872687READ8_MEMBER(towns_state::get_slave_ack)
26882688{
26892689   if (offset==7) { // IRQ = 7
2690      return pic8259_acknowledge(m_pic_slave);
2690      return m_pic_slave->acknowledge();
26912691   }
26922692   return 0x00;
26932693}
r22822r22823
27012701
27022702static const struct pic8259_interface towns_pic8259_slave_config =
27032703{
2704   DEVCB_DEVICE_LINE("pic8259_master", pic8259_ir7_w),
2704   DEVCB_DEVICE_LINE_MEMBER("pic8259_master", pic8259_device, ir7_w),
27052705   DEVCB_LINE_GND,
27062706   DEVCB_NULL
27072707};
trunk/src/mess/drivers/pc88va.c
r22822r22823
10101010{
10111011   if(m_fdc_ctrl_2 & 4) // XTMASK
10121012   {
1013      pic8259_ir3_w(machine().device( "pic8259_slave"), 0);
1014      pic8259_ir3_w(machine().device( "pic8259_slave"), 1);
1013      machine().device<pic8259_device>( "pic8259_slave")->ir3_w(0);
1014      machine().device<pic8259_device>( "pic8259_slave")->ir3_w(1);
10151015   }
10161016}
10171017
r22822r22823
11421142{
11431143   if(m_timer3_io_reg & 0x80)
11441144   {
1145      pic8259_ir5_w(machine().device("pic8259_slave"), 0);
1146      pic8259_ir5_w(machine().device("pic8259_slave"), 1);
1145      machine().device<pic8259_device>("pic8259_slave")->ir5_w(0);
1146      machine().device<pic8259_device>("pic8259_slave")->ir5_w(1);
11471147      m_t3_mouse_timer->adjust(attotime::from_hz(120 >> (m_timer3_io_reg & 3)));
11481148   }
11491149}
r22822r22823
11601160      m_t3_mouse_timer->adjust(attotime::from_hz(120 >> (m_timer3_io_reg & 3)));
11611161   else
11621162   {
1163      pic8259_ir5_w(machine().device("pic8259_slave"), 0);
1163      machine().device<pic8259_device>("pic8259_slave")->ir5_w(0);
11641164      m_t3_mouse_timer->adjust(attotime::never);
11651165   }
11661166}
r22822r22823
12431243//  AM_RANGE(0x0158, 0x0159) Interruption Mode Modification
12441244//  AM_RANGE(0x015c, 0x015f) NMI mask port (strobe port)
12451245   AM_RANGE(0x0160, 0x016f) AM_DEVREADWRITE8_LEGACY("dmac", upd71071_r, upd71071_w,0xffff) // DMA Controller
1246   AM_RANGE(0x0184, 0x0187) AM_DEVREADWRITE8_LEGACY("pic8259_slave", pic8259_r, pic8259_w, 0x00ff)
1247   AM_RANGE(0x0188, 0x018b) AM_DEVREADWRITE8_LEGACY("pic8259_master", pic8259_r, pic8259_w, 0x00ff) // ICU, also controls 8214 emulation
1246   AM_RANGE(0x0184, 0x0187) AM_DEVREADWRITE8("pic8259_slave", pic8259_device, read, write, 0x00ff)
1247   AM_RANGE(0x0188, 0x018b) AM_DEVREADWRITE8("pic8259_master", pic8259_device, read, write, 0x00ff) // ICU, also controls 8214 emulation
12481248//  AM_RANGE(0x0190, 0x0191) System Port 5
12491249//  AM_RANGE(0x0196, 0x0197) Keyboard sub CPU command port
12501250   AM_RANGE(0x0198, 0x0199) AM_WRITE(backupram_wp_1_w) //Backup RAM write inhibit
r22822r22823
16201620
16211621IRQ_CALLBACK_MEMBER(pc88va_state::pc88va_irq_callback)
16221622{
1623   return pic8259_acknowledge( machine().device( "pic8259_master" ) );
1623   return machine().device<pic8259_device>( "pic8259_master" )->acknowledge();
16241624}
16251625
16261626WRITE_LINE_MEMBER(pc88va_state::pc88va_pic_irq)
r22822r22823
16321632READ8_MEMBER(pc88va_state::get_slave_ack)
16331633{
16341634   if (offset==7) { // IRQ = 7
1635      return pic8259_acknowledge(machine().device( "pic8259_slave"));
1635      return machine().device<pic8259_device>( "pic8259_slave")->acknowledge();
16361636   }
16371637   return 0x00;
16381638}
r22822r22823
17061706
17071707INTERRUPT_GEN_MEMBER(pc88va_state::pc88va_vrtc_irq)
17081708{
1709   pic8259_ir2_w(machine().device("pic8259_master"), 0);
1710   pic8259_ir2_w(machine().device("pic8259_master"), 1);
1709   machine().device<pic8259_device>("pic8259_master")->ir2_w(0);
1710   machine().device<pic8259_device>("pic8259_master")->ir2_w(1);
17111711}
17121712
17131713WRITE_LINE_MEMBER(pc88va_state::pc88va_pit_out0_changed)
17141714{
17151715   if(state)
17161716   {
1717      pic8259_ir0_w(machine().device("pic8259_master"), 0);
1718      pic8259_ir0_w(machine().device("pic8259_master"), 1);
1717      machine().device<pic8259_device>("pic8259_master")->ir0_w(0);
1718      machine().device<pic8259_device>("pic8259_master")->ir0_w(1);
17191719   }
17201720}
17211721
r22822r22823
17551755   if(m_fdc_mode && state)
17561756   {
17571757      //printf("%d\n",state);
1758      pic8259_ir3_w(machine().device( "pic8259_slave"), 0);
1759      pic8259_ir3_w(machine().device( "pic8259_slave"), 1);
1758      machine().device<pic8259_device>( "pic8259_slave")->ir3_w(0);
1759      machine().device<pic8259_device>( "pic8259_slave")->ir3_w(1);
17601760   }
17611761   #if TEST_SUBFDC
17621762   else
trunk/src/mess/drivers/pc1512.c
r22822r22823
530530static ADDRESS_MAP_START( pc1512_io, AS_IO, 16, pc1512_state )
531531   ADDRESS_MAP_GLOBAL_MASK(0x3ff)
532532   AM_RANGE(0x000, 0x00f) AM_DEVREADWRITE8(I8237A5_TAG, am9517a_device, read, write, 0xffff)
533   AM_RANGE(0x020, 0x021) AM_DEVREADWRITE8_LEGACY(I8259A2_TAG, pic8259_r, pic8259_w, 0xffff)
533   AM_RANGE(0x020, 0x021) AM_DEVREADWRITE8(I8259A2_TAG, pic8259_device, read, write, 0xffff)
534534   AM_RANGE(0x040, 0x043) AM_DEVREADWRITE8_LEGACY(I8253_TAG, pit8253_r, pit8253_w, 0xffff)
535535   AM_RANGE(0x060, 0x06f) AM_READWRITE8(system_r, system_w, 0xffff)
536536   AM_RANGE(0x070, 0x071) AM_MIRROR(0x02) AM_DEVREADWRITE8(MC146818_TAG, mc146818_device, read, write, 0xffff)
r22822r22823
567567   // Mirrored over to 10000 for indirect reads through io_r
568568
569569   AM_RANGE(0x000, 0x00f) AM_MIRROR(0x10000) AM_DEVWRITE8(I8237A5_TAG, am9517a_device, write, 0xffff)
570   AM_RANGE(0x020, 0x021) AM_MIRROR(0x10000) AM_DEVWRITE8_LEGACY(I8259A2_TAG, pic8259_w, 0xffff)
570   AM_RANGE(0x020, 0x021) AM_MIRROR(0x10000) AM_DEVWRITE8(I8259A2_TAG, pic8259_device, write, 0xffff)
571571   AM_RANGE(0x040, 0x043) AM_MIRROR(0x10000) AM_DEVWRITE8_LEGACY(I8253_TAG, pit8253_w, 0xffff)
572572   AM_RANGE(0x060, 0x06f) AM_MIRROR(0x10000) AM_WRITE8(system_w, 0xffff)
573573   AM_RANGE(0x070, 0x071) AM_MIRROR(0x10000) AM_MIRROR(0x02) AM_DEVWRITE8(MC146818_TAG, mc146818_device, write, 0xffff)
trunk/src/mess/drivers/apc.c
r22822r22823
296296         res = 0xff;
297297      }
298298      else
299         res = pic8259_r(machine().device("pic8259_slave"), space, (offset & 2) >> 1);
299         res = machine().device<pic8259_device>("pic8259_slave")->read(space, (offset & 2) >> 1);
300300   }
301301
302302   return res;
r22822r22823
311311      if(offset & 4)
312312         printf("Write undefined port %02x\n",offset+0x28);
313313      else
314         pic8259_w(machine().device("pic8259_slave"), space, (offset & 2) >> 1, data);
314         machine().device<pic8259_device>("pic8259_slave")->write(space, (offset & 2) >> 1, data);
315315   }
316316}
317317
r22822r22823
342342
343343   switch(offset & 3)
344344   {
345      case 0: res = m_keyb.data; pic8259_ir4_w(machine().device("pic8259_master"), 0); break; // according to the source, reading there acks the irq
345      case 0: res = m_keyb.data; machine().device<pic8259_device>("pic8259_master")->ir4_w(0); break; // according to the source, reading there acks the irq
346346      case 1: res = m_keyb.status; break;
347347      case 2: res = m_keyb.sig; break; // bit 0: CTRL bit 1: function key (or reversed)
348348      case 3: res = ioport("KEY_MOD")->read() & 0xff; break; // sh
r22822r22823
410410       ---x CRT
411411   */
412412   if(data & 4)
413      pic8259_ir3_w(machine().device("pic8259_master"), 0);
413      machine().device<pic8259_device>("pic8259_master")->ir3_w(0);
414414
415415   if(data & ~4)
416416      logerror("IRQ ACK %02x\n",data);
r22822r22823
475475static ADDRESS_MAP_START( apc_io, AS_IO, 16, apc_state )
476476//  ADDRESS_MAP_GLOBAL_MASK(0xff)
477477   AM_RANGE(0x00, 0x1f) AM_READWRITE8(apc_dma_r, apc_dma_w,0xff00)
478   AM_RANGE(0x20, 0x23) AM_DEVREADWRITE8_LEGACY("pic8259_master", pic8259_r, pic8259_w, 0x00ff) // i8259
478   AM_RANGE(0x20, 0x23) AM_DEVREADWRITE8("pic8259_master", pic8259_device, read, write, 0x00ff) // i8259
479479   AM_RANGE(0x28, 0x2f) AM_READWRITE8(apc_port_28_r, apc_port_28_w, 0xffff) // i8259 (even) / pit8253 (odd)
480480//  0x30, 0x37 serial port 0/1 (i8251) (even/odd)
481481   AM_RANGE(0x38, 0x3f) AM_WRITE8(apc_dma_segments_w,0x00ff)
r22822r22823
503503   {
504504      m_keyb.data = (UINT8)(FPTR)(param) & 0xff;
505505      //m_keyb.status &= ~1;
506      pic8259_ir4_w(machine().device("pic8259_master"), 1);
506      machine().device<pic8259_device>("pic8259_master")->ir4_w(1);
507507   }
508508
509509   if(oldval && !newval)
r22822r22823
744744void apc_state::fdc_irq(bool state)
745745{
746746//  printf("IRQ %d\n",state);
747   pic8259_ir4_w(machine().device("pic8259_slave"), state);
747   machine().device<pic8259_device>("pic8259_slave")->ir4_w(state);
748748}
749749
750750IRQ_CALLBACK_MEMBER(apc_state::irq_callback)
751751{
752   return pic8259_acknowledge( machine().device( "pic8259_master" ));
752   return machine().device<pic8259_device>( "pic8259_master" )->acknowledge();
753753}
754754
755755void apc_state::machine_start()
r22822r22823
845845      {
846846         MAIN_CLOCK,              /* heartbeat IRQ */
847847         DEVCB_NULL,
848         DEVCB_DEVICE_LINE("pic8259_master", pic8259_ir3_w)
848         DEVCB_DEVICE_LINE_MEMBER("pic8259_master", pic8259_device, ir3_w)
849849      }, {
850850         MAIN_CLOCK,              /* Memory Refresh */
851851         DEVCB_NULL,
r22822r22823
893893READ8_MEMBER(apc_state::get_slave_ack)
894894{
895895   if (offset==7) { // IRQ = 7
896      return pic8259_acknowledge( machine().device( "pic8259_slave" ));
896      return machine().device<pic8259_device>( "pic8259_slave" )->acknowledge();
897897   }
898898   return 0x00;
899899}
r22822r22823
907907
908908static const struct pic8259_interface pic8259_slave_config =
909909{
910   DEVCB_DEVICE_LINE("pic8259_master", pic8259_ir7_w), //TODO: check me
910   DEVCB_DEVICE_LINE_MEMBER("pic8259_master", pic8259_device, ir7_w), //TODO: check me
911911   DEVCB_LINE_GND,
912912   DEVCB_NULL
913913};
trunk/src/mess/drivers/tandy2k.c
r22822r22823
276276   AM_RANGE(0x00040, 0x00047) AM_DEVREADWRITE8_LEGACY(I8253_TAG, pit8253_r, pit8253_w, 0x00ff)
277277   AM_RANGE(0x00052, 0x00053) AM_READ8(kbint_clr_r, 0x00ff)
278278   AM_RANGE(0x00050, 0x00057) AM_DEVREADWRITE8(I8255A_TAG, i8255_device, read, write, 0x00ff)
279   AM_RANGE(0x00060, 0x00063) AM_DEVREADWRITE8_LEGACY(I8259A_0_TAG, pic8259_r, pic8259_w, 0x00ff)
280   AM_RANGE(0x00070, 0x00073) AM_DEVREADWRITE8_LEGACY(I8259A_1_TAG, pic8259_r, pic8259_w, 0x00ff)
279   AM_RANGE(0x00060, 0x00063) AM_DEVREADWRITE8(I8259A_0_TAG, pic8259_device, read, write, 0x00ff)
280   AM_RANGE(0x00070, 0x00073) AM_DEVREADWRITE8(I8259A_1_TAG, pic8259_device, read, write, 0x00ff)
281281   AM_RANGE(0x00080, 0x00081) AM_DEVREADWRITE8(I8272A_TAG, i8272a_device, mdma_r, mdma_w, 0x00ff)
282282//  AM_RANGE(0x00100, 0x0017f) AM_DEVREADWRITE8(CRT9007_TAG, crt9007_device, read, write, 0x00ff) AM_WRITE8(addr_ctrl_w, 0xff00)
283283   AM_RANGE(0x00100, 0x0017f) AM_READWRITE(vpac_r, vpac_w)
trunk/src/mess/drivers/irisha.c
r22822r22823
2020   AM_RANGE( 0x06, 0x06) AM_DEVREADWRITE("uart",i8251_device, data_r, data_w)
2121   AM_RANGE( 0x07, 0x07) AM_DEVREADWRITE("uart", i8251_device, status_r, control_w)
2222   AM_RANGE( 0x08, 0x0B) AM_DEVREADWRITE_LEGACY("pit8253", pit8253_r, pit8253_w )
23   AM_RANGE( 0x0C, 0x0F) AM_DEVREADWRITE_LEGACY("pic8259", pic8259_r, pic8259_w ) AM_MASK( 0x01 )
23   AM_RANGE( 0x0C, 0x0F) AM_DEVREADWRITE("pic8259", pic8259_device, read, write ) AM_MASK( 0x01 )
2424   AM_RANGE( 0x10, 0x13) AM_DEVREADWRITE("ppi8255", i8255_device, read, write)
2525ADDRESS_MAP_END
2626
trunk/src/mess/drivers/pc100.c
r22822r22823
287287/* everything is 8-bit bus wide */
288288static ADDRESS_MAP_START(pc100_io, AS_IO, 16, pc100_state)
289289   ADDRESS_MAP_GLOBAL_MASK(0xff)
290   AM_RANGE(0x00, 0x03) AM_DEVREADWRITE8_LEGACY("pic8259", pic8259_r, pic8259_w, 0x00ff) // i8259
290   AM_RANGE(0x00, 0x03) AM_DEVREADWRITE8("pic8259", pic8259_device, read, write, 0x00ff) // i8259
291291//  AM_RANGE(0x04, 0x07) i8237?
292292   AM_RANGE(0x08, 0x0b) AM_DEVICE8("upd765", upd765a_device, map, 0x00ff ) // upd765
293293   AM_RANGE(0x10, 0x17) AM_DEVREADWRITE8("ppi8255_1", i8255_device, read, write,0x00ff) // i8255 #1
r22822r22823
405405
406406IRQ_CALLBACK_MEMBER(pc100_state::pc100_irq_callback)
407407{
408   return pic8259_acknowledge( device.machine().device( "pic8259" ) );
408   return device.machine().device<pic8259_device>( "pic8259" )->acknowledge();
409409}
410410
411411WRITE_LINE_MEMBER( pc100_state::pc100_set_int_line )
r22822r22823
436436
437437INTERRUPT_GEN_MEMBER(pc100_state::pc100_vblank_irq)
438438{
439   pic8259_ir4_w(machine().device("pic8259"), 0);
440   pic8259_ir4_w(machine().device("pic8259"), 1);
439   machine().device<pic8259_device>("pic8259")->ir4_w(0);
440   machine().device<pic8259_device>("pic8259")->ir4_w(1);
441441}
442442
443443TIMER_DEVICE_CALLBACK_MEMBER(pc100_state::pc100_600hz_irq)
444444{
445445   if(m_timer_mode == 0)
446446   {
447      pic8259_ir2_w(machine().device("pic8259"), 0);
448      pic8259_ir2_w(machine().device("pic8259"), 1);
447      machine().device<pic8259_device>("pic8259")->ir2_w(0);
448      machine().device<pic8259_device>("pic8259")->ir2_w(1);
449449   }
450450}
451451
r22822r22823
453453{
454454   if(m_timer_mode == 1)
455455   {
456      pic8259_ir2_w(machine().device("pic8259"), 0);
457      pic8259_ir2_w(machine().device("pic8259"), 1);
456      machine().device<pic8259_device>("pic8259")->ir2_w(0);
457      machine().device<pic8259_device>("pic8259")->ir2_w(1);
458458   }
459459}
460460
r22822r22823
462462{
463463   if(m_timer_mode == 2)
464464   {
465      pic8259_ir2_w(machine().device("pic8259"), 0);
466      pic8259_ir2_w(machine().device("pic8259"), 1);
465      machine().device<pic8259_device>("pic8259")->ir2_w(0);
466      machine().device<pic8259_device>("pic8259")->ir2_w(1);
467467   }
468468}
469469
r22822r22823
471471{
472472   if(m_timer_mode == 3)
473473   {
474      pic8259_ir2_w(machine().device("pic8259"), 0);
475      pic8259_ir2_w(machine().device("pic8259"), 1);
474      machine().device<pic8259_device>("pic8259")->ir2_w(0);
475      machine().device<pic8259_device>("pic8259")->ir2_w(1);
476476   }
477477}
478478
trunk/src/mess/drivers/wangpc.c
r22822r22823
558558   AM_RANGE(0x1020, 0x1027) AM_DEVREADWRITE8(I8255A_TAG, i8255_device, read, write, 0x00ff)
559559   AM_RANGE(0x1028, 0x1029) //AM_WRITE(?)
560560   AM_RANGE(0x1040, 0x1047) AM_DEVREADWRITE8_LEGACY(I8253_TAG, pit8253_r, pit8253_w, 0x00ff)
561   AM_RANGE(0x1060, 0x1063) AM_DEVREADWRITE8_LEGACY(I8259A_TAG, pic8259_r, pic8259_w, 0x00ff)
561   AM_RANGE(0x1060, 0x1063) AM_DEVREADWRITE8(I8259A_TAG, pic8259_device, read, write, 0x00ff)
562562   AM_RANGE(0x1080, 0x1087) AM_DEVREAD8(SCN2661_TAG, mc2661_device, read, 0x00ff)
563563   AM_RANGE(0x1088, 0x108f) AM_DEVWRITE8(SCN2661_TAG, mc2661_device, write, 0x00ff)
564564   AM_RANGE(0x10a0, 0x10bf) AM_DEVREADWRITE8(AM9517A_TAG, am9517a_device, read, write, 0x00ff)
trunk/src/mess/drivers/apricotp.c
r22822r22823
356356   AM_RANGE(0x02a, 0x02b) AM_WRITE8(palette_w, 0x00ff)
357357   AM_RANGE(0x02e, 0x02f) AM_WRITE(video_w)
358358   AM_RANGE(0x040, 0x05f) AM_DEVREADWRITE8(I8237_TAG, am9517a_device, read, write, 0x00ff)
359   AM_RANGE(0x068, 0x06b) AM_DEVREADWRITE8_LEGACY(I8259A_TAG, pic8259_r, pic8259_w, 0x00ff)
359   AM_RANGE(0x068, 0x06b) AM_DEVREADWRITE8(I8259A_TAG, pic8259_device, read, write, 0x00ff)
360360   AM_RANGE(0x06c, 0x06d) AM_DEVWRITE8(MC6845_TAG, mc6845_device, address_w, 0x00ff)
361361   AM_RANGE(0x06e, 0x06f) AM_DEVREADWRITE8(MC6845_TAG, mc6845_device, register_r, register_w, 0x00ff)
362362ADDRESS_MAP_END
trunk/src/mess/drivers/pasogo.c
r22822r22823
356356
357357static ADDRESS_MAP_START(pasogo_io, AS_IO, 8, pasogo_state)
358358//  ADDRESS_MAP_GLOBAL_MASK(0xfFFF)
359   AM_RANGE(0x0020, 0x0021) AM_DEVREADWRITE_LEGACY("pic8259", pic8259_r, pic8259_w)
359   AM_RANGE(0x0020, 0x0021) AM_DEVREADWRITE("pic8259", pic8259_device, read, write)
360360   AM_RANGE(0x26, 0x27) AM_READWRITE(vg230_io_r, vg230_io_w )
361361   AM_RANGE(0x0040, 0x0043) AM_DEVREADWRITE_LEGACY("pit8254", pit8253_r, pit8253_w)
362362   AM_RANGE(0x6c, 0x6f) AM_READWRITE(ems_r, ems_w )
r22822r22823
460460
461461IRQ_CALLBACK_MEMBER(pasogo_state::pasogo_irq_callback)
462462{
463   return pic8259_acknowledge( machine().device("pic8259"));
463   return machine().device<pic8259_device>("pic8259")->acknowledge();
464464}
465465
466466void pasogo_state::machine_reset()
trunk/src/mess/drivers/sage2.c
r22822r22823
8888   AM_RANGE(0xffc020, 0xffc027) AM_DEVREADWRITE8(I8255A_0_TAG, i8255_device, read, write, 0x00ff) // i8255, DIPs + Floppy ctrl port
8989   AM_RANGE(0xffc030, 0xffc031) AM_DEVREADWRITE8(I8251_1_TAG, i8251_device, data_r, data_w, 0x00ff)
9090   AM_RANGE(0xffc032, 0xffc033) AM_DEVREADWRITE8(I8251_1_TAG, i8251_device, status_r, control_w, 0x00ff)
91   AM_RANGE(0xffc040, 0xffc043) AM_DEVREADWRITE8_LEGACY(I8259_TAG, pic8259_r, pic8259_w, 0x00ff)
91   AM_RANGE(0xffc040, 0xffc043) AM_DEVREADWRITE8(I8259_TAG, pic8259_device, read, write, 0x00ff)
9292   AM_RANGE(0xffc050, 0xffc053) AM_DEVICE8(UPD765_TAG, upd765a_device, map, 0x00ff)
9393   AM_RANGE(0xffc060, 0xffc067) AM_DEVREADWRITE8(I8255A_0_TAG, i8255_device, read, write, 0x00ff) // i8255, Printer
9494   AM_RANGE(0xffc070, 0xffc071) AM_DEVREAD8(I8251_0_TAG, i8251_device, data_r, 0x00ff) AM_DEVWRITE8(TERMINAL_TAG, generic_terminal_device, write, 0x00ff)
trunk/src/mess/drivers/qx10.c
r22822r22823
593593
594594IRQ_CALLBACK_MEMBER(qx10_state::irq_callback)
595595{
596   return pic8259_acknowledge(m_pic_m);
596   return m_pic_m->acknowledge();
597597}
598598
599599READ8_MEMBER( qx10_state::upd7201_r )
r22822r22823
688688   ADDRESS_MAP_GLOBAL_MASK(0xff)
689689   AM_RANGE(0x00, 0x03) AM_DEVREADWRITE_LEGACY("pit8253_1", pit8253_r, pit8253_w)
690690   AM_RANGE(0x04, 0x07) AM_DEVREADWRITE_LEGACY("pit8253_2", pit8253_r, pit8253_w)
691   AM_RANGE(0x08, 0x09) AM_DEVREADWRITE_LEGACY("pic8259_master", pic8259_r, pic8259_w)
692   AM_RANGE(0x0c, 0x0d) AM_DEVREADWRITE_LEGACY("pic8259_slave", pic8259_r, pic8259_w)
691   AM_RANGE(0x08, 0x09) AM_DEVREADWRITE("pic8259_master", pic8259_device, read, write)
692   AM_RANGE(0x0c, 0x0d) AM_DEVREADWRITE("pic8259_slave", pic8259_device, read, write)
693693   AM_RANGE(0x10, 0x13) AM_READWRITE(upd7201_r, upd7201_w) //AM_DEVREADWRITE("upd7201", upd7201_device, cd_ba_r, cd_ba_w)
694694   AM_RANGE(0x14, 0x17) AM_DEVREADWRITE("i8255", i8255_device, read, write)
695695   AM_RANGE(0x18, 0x1b) AM_READ_PORT("DSW") AM_WRITE(qx10_18_w)
trunk/src/mess/drivers/multi16.c
r22822r22823
108108
109109static ADDRESS_MAP_START(multi16_io, AS_IO, 16, multi16_state)
110110   ADDRESS_MAP_UNMAP_HIGH
111   AM_RANGE(0x02, 0x03) AM_DEVREADWRITE8_LEGACY("pic8259", pic8259_r, pic8259_w, 0xffff) // i8259
111   AM_RANGE(0x02, 0x03) AM_DEVREADWRITE8("pic8259", pic8259_device, read, write, 0xffff) // i8259
112112   AM_RANGE(0x40, 0x41) AM_WRITE8(multi16_6845_address_w, 0x00ff)
113113   AM_RANGE(0x40, 0x41) AM_WRITE8(multi16_6845_data_w, 0xff00)
114114ADDRESS_MAP_END
r22822r22823
119119
120120IRQ_CALLBACK_MEMBER(multi16_state::multi16_irq_callback)
121121{
122   return pic8259_acknowledge( machine().device("pic8259") );
122   return machine().device<pic8259_device>("pic8259")->acknowledge();
123123}
124124
125125WRITE_LINE_MEMBER( multi16_state::multi16_set_int_line )
trunk/src/mess/drivers/m20.c
r22822r22823
240240
241241READ16_MEMBER(m20_state::m20_i8259_r)
242242{
243   return pic8259_r(m_i8259, space, offset)<<1;
243   return m_i8259->read(space, offset)<<1;
244244}
245245
246246WRITE16_MEMBER(m20_state::m20_i8259_w)
247247{
248   pic8259_w(m_i8259, space, offset, (data>>1));
248   m_i8259->write(space, offset, (data>>1));
249249}
250250
251251WRITE_LINE_MEMBER( m20_state::pic_irq_line_w )
r22822r22823
804804   if (! irqline)
805805      return 0xff; // NVI, value ignored
806806   else
807      return pic8259_acknowledge(machine().device("i8259"));
807      return m_i8259->acknowledge();
808808}
809809
810810void m20_state::machine_start()
r22822r22823
860860
861861WRITE_LINE_MEMBER(m20_state::kbd_rxrdy_int)
862862{
863   pic8259_ir4_w(machine().device("i8259"), state);
863   m_i8259->ir4_w(state);
864864}
865865
866866void m20_state::fdc_intrq_w(bool state)
867867{
868   pic8259_ir0_w(machine().device("i8259"), state);
868   m_i8259->ir0_w(state);
869869}
870870
871871static const i8251_interface kbd_i8251_intf =
trunk/src/mame/drivers/xtom3d.c
r22822r22823
538538
539539static ADDRESS_MAP_START(xtom3d_io, AS_IO, 32, xtom3d_state)
540540   AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE8("dma8237_1", i8237_device, i8237_r, i8237_w, 0xffffffff)
541   AM_RANGE(0x0020, 0x003f) AM_DEVREADWRITE8_LEGACY("pic8259_1", pic8259_r, pic8259_w, 0xffffffff)
541   AM_RANGE(0x0020, 0x003f) AM_DEVREADWRITE8("pic8259_1", pic8259_device, read, write, 0xffffffff)
542542   AM_RANGE(0x0040, 0x005f) AM_DEVREADWRITE8_LEGACY("pit8254", pit8253_r, pit8253_w, 0xffffffff)
543543   AM_RANGE(0x0060, 0x006f) AM_DEVREADWRITE8("kbdc", kbdc8042_device, data_r, data_w, 0xffffffff)
544544   AM_RANGE(0x0070, 0x007f) AM_DEVREADWRITE8("rtc", mc146818_device, read, write, 0xffffffff) /* todo: nvram (CMOS Setup Save)*/
545545   AM_RANGE(0x0080, 0x009f) AM_READWRITE8(at_page8_r,  at_page8_w, 0xffffffff)
546   AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE8_LEGACY("pic8259_2", pic8259_r, pic8259_w, 0xffffffff)
546   AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE8("pic8259_2", pic8259_device, read, write, 0xffffffff)
547547   AM_RANGE(0x00c0, 0x00df) AM_READWRITE8(at_dma8237_2_r, at_dma8237_2_w, 0xffffffff)
548548   AM_RANGE(0x00e8, 0x00ef) AM_NOP
549549
r22822r22823
563563      {
564564         4772720/4,              /* heartbeat IRQ */
565565         DEVCB_NULL,
566         DEVCB_DEVICE_LINE("pic8259_1", pic8259_ir0_w)
566         DEVCB_DEVICE_LINE_MEMBER("pic8259_1", pic8259_device, ir0_w)
567567      }, {
568568         4772720/4,              /* dram refresh */
569569         DEVCB_NULL,
r22822r22823
585585{
586586   if (offset==2) { // IRQ = 2
587587      logerror("pic8259_slave_ACK!\n");
588      return pic8259_acknowledge(m_pic8259_2);
588      return m_pic8259_2->acknowledge();
589589   }
590590   return 0x00;
591591}
r22822r22823
599599
600600static const struct pic8259_interface xtom3d_pic8259_2_config =
601601{
602   DEVCB_DEVICE_LINE("pic8259_1", pic8259_ir2_w),
602   DEVCB_DEVICE_LINE_MEMBER("pic8259_1", pic8259_device, ir2_w),
603603   DEVCB_LINE_GND,
604604   DEVCB_NULL
605605};
r22822r22823
623623
624624IRQ_CALLBACK_MEMBER(xtom3d_state::irq_callback)
625625{
626   return pic8259_acknowledge(m_pic8259_1);
626   return m_pic8259_1->acknowledge();
627627}
628628
629629void xtom3d_state::machine_start()
trunk/src/mame/drivers/quakeat.c
r22822r22823
7171      : driver_device(mconfig, type, tag),
7272      m_maincpu(*this, "maincpu") { }
7373
74   device_t    *m_pic8259_1;
75   device_t    *m_pic8259_2;
74   pic8259_device    *m_pic8259_1;
75   pic8259_device    *m_pic8259_2;
7676   DECLARE_WRITE_LINE_MEMBER(quakeat_pic8259_1_set_int_line);
7777   DECLARE_READ8_MEMBER(get_slave_ack);
7878   virtual void machine_start();
r22822r22823
9898
9999static ADDRESS_MAP_START( quake_io, AS_IO, 32, quakeat_state )
100100//  AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE8_LEGACY("dma8237_1", dma8237_r, dma8237_w, 0xffffffff)
101   AM_RANGE(0x0020, 0x003f) AM_DEVREADWRITE8_LEGACY("pic8259_1", pic8259_r, pic8259_w, 0xffffffff)
101   AM_RANGE(0x0020, 0x003f) AM_DEVREADWRITE8("pic8259_1", pic8259_device, read, write, 0xffffffff)
102102//  AM_RANGE(0x0040, 0x005f) AM_DEVREADWRITE8_LEGACY("pit8254", pit8253_r, pit8253_w, 0xffffffff)
103103//  AM_RANGE(0x0060, 0x006f) AM_READWRITE(kbdc8042_32le_r,          kbdc8042_32le_w)
104104//  AM_RANGE(0x0070, 0x007f) AM_DEVREADWRITE8("rtc", mc146818_device, read, write, 0xffffffff)
105105//  AM_RANGE(0x0080, 0x009f) AM_READWRITE(at_page32_r,              at_page32_w)
106   AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE8_LEGACY("pic8259_2", pic8259_r, pic8259_w, 0xffffffff)
106   AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE8("pic8259_2", pic8259_device, read, write, 0xffffffff)
107107//  AM_RANGE(0x00c0, 0x00df) AM_DEVREADWRITE_LEGACY("dma8237_2", at32_dma8237_2_r, at32_dma8237_2_w)
108108   AM_RANGE(0x00e8, 0x00eb) AM_NOP
109109//  AM_RANGE(0x01f0, 0x01f7) AM_DEVREADWRITE_LEGACY("ide", ide_r, ide_w)
r22822r22823
129129READ8_MEMBER(quakeat_state::get_slave_ack)
130130{
131131   if (offset==2) { // IRQ = 2
132      return pic8259_acknowledge(m_pic8259_2);
132      return m_pic8259_2->acknowledge();
133133   }
134134   return 0x00;
135135}
r22822r22823
143143
144144static const struct pic8259_interface quakeat_pic8259_2_config =
145145{
146   DEVCB_DEVICE_LINE("pic8259_1", pic8259_ir2_w),
146   DEVCB_DEVICE_LINE_MEMBER("pic8259_1", pic8259_device, ir2_w),
147147   DEVCB_LINE_GND,
148148   DEVCB_NULL
149149};
r22822r22823
157157
158158IRQ_CALLBACK_MEMBER(quakeat_state::irq_callback)
159159{
160   return pic8259_acknowledge(m_pic8259_1);
160   return m_pic8259_1->acknowledge();
161161}
162162
163163void quakeat_state::machine_start()
164164{
165165   m_maincpu->set_irq_acknowledge_callback(device_irq_acknowledge_delegate(FUNC(quakeat_state::irq_callback),this));
166166
167   m_pic8259_1 = machine().device( "pic8259_1" );
168   m_pic8259_2 = machine().device( "pic8259_2" );
167   m_pic8259_1 = machine().device<pic8259_device>( "pic8259_1" );
168   m_pic8259_2 = machine().device<pic8259_device>( "pic8259_2" );
169169}
170170/*************************************************************/
171171
trunk/src/mame/drivers/pcxt.c
r22822r22823
272272      {
273273         XTAL_14_31818MHz/12,                /* heartbeat IRQ */
274274         DEVCB_NULL,
275         DEVCB_DEVICE_LINE("pic8259_1", pic8259_ir0_w)
275         DEVCB_DEVICE_LINE_MEMBER("pic8259_1", pic8259_device, ir0_w)
276276      }, {
277277         XTAL_14_31818MHz/12,                /* dram refresh */
278278         DEVCB_NULL,
r22822r22823
415415WRITE8_MEMBER(pcxt_state::drive_selection_w)
416416{
417417   /* TODO: properly hook-up upd765 FDC there */
418   pic8259_ir6_w(machine().device("pic8259_1"), 1);
418   machine().device<pic8259_device>("pic8259_1")->ir6_w(1);
419419}
420420
421421/******************
r22822r22823
525525READ8_MEMBER(pcxt_state::get_slave_ack)
526526{
527527   if (offset==2) { // IRQ = 2
528      return pic8259_acknowledge(m_pic8259_2);
528      return m_pic8259_2->acknowledge();
529529   }
530530   return 0x00;
531531}
r22822r22823
539539
540540static const struct pic8259_interface pic8259_2_config =
541541{
542   DEVCB_DEVICE_LINE("pic8259_1", pic8259_ir2_w),
542   DEVCB_DEVICE_LINE_MEMBER("pic8259_1", pic8259_device, ir2_w),
543543   DEVCB_LINE_GND,
544544   DEVCB_NULL
545545};
546546
547547IRQ_CALLBACK_MEMBER(pcxt_state::irq_callback)
548548{
549   return pic8259_acknowledge(m_pic8259_1);
549   return m_pic8259_1->acknowledge();
550550}
551551
552552static ADDRESS_MAP_START( filetto_map, AS_PROGRAM, 8, pcxt_state )
r22822r22823
560560static ADDRESS_MAP_START( pcxt_io_common, AS_IO, 8, pcxt_state )
561561   ADDRESS_MAP_GLOBAL_MASK(0x3ff)
562562   AM_RANGE(0x0000, 0x000f) AM_DEVREADWRITE("dma8237_1", i8237_device, i8237_r, i8237_w ) //8237 DMA Controller
563   AM_RANGE(0x0020, 0x002f) AM_DEVREADWRITE_LEGACY("pic8259_1", pic8259_r, pic8259_w ) //8259 Interrupt control
563   AM_RANGE(0x0020, 0x002f) AM_DEVREADWRITE("pic8259_1", pic8259_device, read, write ) //8259 Interrupt control
564564   AM_RANGE(0x0040, 0x0043) AM_DEVREADWRITE_LEGACY("pit8253", pit8253_r, pit8253_w)    //8253 PIT
565565   AM_RANGE(0x0060, 0x0063) AM_DEVREADWRITE("ppi8255_0", i8255_device, read, write)  //PPI 8255
566566   AM_RANGE(0x0064, 0x0066) AM_DEVREADWRITE("ppi8255_1", i8255_device, read, write)  //PPI 8255
567567   AM_RANGE(0x0070, 0x007f) AM_DEVREADWRITE("rtc", mc146818_device, read, write)
568568   AM_RANGE(0x0080, 0x0087) AM_READWRITE(dma_page_select_r,dma_page_select_w)
569   AM_RANGE(0x00a0, 0x00af) AM_DEVREADWRITE_LEGACY("pic8259_2", pic8259_r, pic8259_w )
569   AM_RANGE(0x00a0, 0x00af) AM_DEVREADWRITE("pic8259_2", pic8259_device, read, write )
570570   AM_RANGE(0x0278, 0x027f) AM_RAM //printer (parallel) port latch
571571   AM_RANGE(0x02f8, 0x02ff) AM_RAM //Modem port
572572   AM_RANGE(0x0378, 0x037f) AM_RAM //printer (parallel) port
trunk/src/mame/drivers/savquest.c
r22822r22823
505505
506506static ADDRESS_MAP_START(savquest_io, AS_IO, 32, savquest_state)
507507   AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE8("dma8237_1", i8237_device, i8237_r, i8237_w, 0xffffffff)
508   AM_RANGE(0x0020, 0x003f) AM_DEVREADWRITE8_LEGACY("pic8259_1", pic8259_r, pic8259_w, 0xffffffff)
508   AM_RANGE(0x0020, 0x003f) AM_DEVREADWRITE8("pic8259_1", pic8259_device, read, write, 0xffffffff)
509509   AM_RANGE(0x0040, 0x005f) AM_DEVREADWRITE8_LEGACY("pit8254", pit8253_r, pit8253_w, 0xffffffff)
510510   AM_RANGE(0x0060, 0x006f) AM_DEVREADWRITE8("kbdc", kbdc8042_device, data_r, data_w, 0xffffffff)
511511   AM_RANGE(0x0070, 0x007f) AM_DEVREADWRITE8("rtc", mc146818_device, read, write, 0xffffffff) /* todo: nvram (CMOS Setup Save)*/
512512   AM_RANGE(0x0080, 0x009f) AM_READWRITE8(at_page8_r, at_page8_w, 0xffffffff)
513   AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE8_LEGACY("pic8259_2", pic8259_r, pic8259_w, 0xffffffff)
513   AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE8("pic8259_2", pic8259_device, read, write, 0xffffffff)
514514   AM_RANGE(0x00c0, 0x00df) AM_READWRITE8(at_dma8237_2_r, at_dma8237_2_w, 0xffffffff)
515515   AM_RANGE(0x00e8, 0x00ef) AM_NOP
516516
r22822r22823
534534      {
535535         4772720/4,              /* heartbeat IRQ */
536536         DEVCB_NULL,
537         DEVCB_DEVICE_LINE("pic8259_1", pic8259_ir0_w)
537         DEVCB_DEVICE_LINE_MEMBER("pic8259_1", pic8259_device, ir0_w)
538538      }, {
539539         4772720/4,              /* dram refresh */
540540         DEVCB_NULL,
r22822r22823
556556{
557557   if (offset==2) { // IRQ = 2
558558      logerror("pic8259_slave_ACK!\n");
559      return pic8259_acknowledge(m_pic8259_2);
559      return m_pic8259_2->acknowledge();
560560   }
561561   return 0x00;
562562}
r22822r22823
570570
571571static const struct pic8259_interface savquest_pic8259_2_config =
572572{
573   DEVCB_DEVICE_LINE("pic8259_1", pic8259_ir2_w),
573   DEVCB_DEVICE_LINE_MEMBER("pic8259_1", pic8259_device, ir2_w),
574574   DEVCB_LINE_GND,
575575   DEVCB_NULL
576576};
r22822r22823
594594
595595IRQ_CALLBACK_MEMBER(savquest_state::irq_callback)
596596{
597   return pic8259_acknowledge(m_pic8259_1);
597   return m_pic8259_1->acknowledge();
598598}
599599
600600void savquest_state::machine_start()
trunk/src/mame/drivers/photoply.c
r22822r22823
3434   UINT8 m_vga_address;
3535
3636   device_t    *m_pit8253;
37   device_t    *m_pic8259_1;
38   device_t    *m_pic8259_2;
37   pic8259_device  *m_pic8259_1;
38   pic8259_device  *m_pic8259_2;
3939   i8237_device    *m_dma8237_1;
4040   i8237_device    *m_dma8237_2;
4141   DECLARE_READ32_MEMBER(ide_r);
r22822r22823
210210READ8_MEMBER(photoply_state::get_slave_ack)
211211{
212212   if (offset==2) { // IRQ = 2
213      return pic8259_acknowledge(m_pic8259_2);
213      return m_pic8259_2->acknowledge();
214214   }
215215   return 0x00;
216216}
r22822r22823
224224
225225static const struct pic8259_interface pic8259_2_config =
226226{
227   DEVCB_DEVICE_LINE("pic8259_1", pic8259_ir2_w),
227   DEVCB_DEVICE_LINE_MEMBER("pic8259_1", pic8259_device, ir2_w),
228228   DEVCB_LINE_GND,
229229   DEVCB_NULL
230230};
231231
232232IRQ_CALLBACK_MEMBER(photoply_state::irq_callback)
233233{
234   return pic8259_acknowledge(m_pic8259_1);
234   return m_pic8259_1->acknowledge();
235235}
236236
237237WRITE_LINE_MEMBER(photoply_state::at_pit8254_out0_changed)
238238{
239239   if ( m_pic8259_1 )
240240   {
241      pic8259_ir0_w(m_pic8259_1, state);
241      m_pic8259_1->ir0_w(state);
242242   }
243243}
244244
r22822r22823
282282
283283static ADDRESS_MAP_START( photoply_io, AS_IO, 32, photoply_state )
284284   AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE8("dma8237_1", i8237_device, i8237_r, i8237_w, 0xffffffff)
285   AM_RANGE(0x0020, 0x003f) AM_DEVREADWRITE8_LEGACY("pic8259_1", pic8259_r, pic8259_w, 0xffffffff)
285   AM_RANGE(0x0020, 0x003f) AM_DEVREADWRITE8("pic8259_1", pic8259_device, read, write, 0xffffffff)
286286   AM_RANGE(0x0040, 0x005f) AM_DEVREADWRITE8_LEGACY("pit8254", pit8253_r, pit8253_w, 0xffffffff)
287287   AM_RANGE(0x0060, 0x006f) AM_DEVREADWRITE8("kbdc", kbdc8042_device, data_r, data_w, 0xffffffff)
288288   AM_RANGE(0x0070, 0x007f) AM_RAM//DEVREADWRITE8("rtc", mc146818_device, read, write, 0xffffffff)
289289   AM_RANGE(0x0080, 0x009f) AM_READWRITE8(dma_page_select_r,dma_page_select_w, 0xffffffff)//TODO
290   AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE8_LEGACY("pic8259_2", pic8259_r, pic8259_w, 0xffffffff)
290   AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE8("pic8259_2", pic8259_device, read, write, 0xffffffff)
291291   AM_RANGE(0x00c0, 0x00df) AM_DEVREADWRITE8("dma8237_2", i8237_device, i8237_r, i8237_w, 0xffff)
292292   AM_RANGE(0x00e8, 0x00eb) AM_NOP
293293   AM_RANGE(0x01f0, 0x01f7) AM_READWRITE(ide_r, ide_w)
r22822r22823
355355{
356356   m_maincpu->set_irq_acknowledge_callback(device_irq_acknowledge_delegate(FUNC(photoply_state::irq_callback),this));
357357   m_pit8253 = machine().device( "pit8254" );
358   m_pic8259_1 = machine().device( "pic8259_1" );
359   m_pic8259_2 = machine().device( "pic8259_2" );
358   m_pic8259_1 = machine().device<pic8259_device>( "pic8259_1" );
359   m_pic8259_2 = machine().device<pic8259_device>( "pic8259_2" );
360360   m_dma8237_1 = machine().device<i8237_device>( "dma8237_1" );
361361   m_dma8237_2 = machine().device<i8237_device>( "dma8237_2" );
362362}
trunk/src/mame/drivers/midqslvr.c
r22822r22823
547547
548548static ADDRESS_MAP_START(midqslvr_io, AS_IO, 32, midqslvr_state)
549549   AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE8("dma8237_1", i8237_device, i8237_r, i8237_w, 0xffffffff)
550   AM_RANGE(0x0020, 0x003f) AM_DEVREADWRITE8_LEGACY("pic8259_1", pic8259_r, pic8259_w, 0xffffffff)
550   AM_RANGE(0x0020, 0x003f) AM_DEVREADWRITE8("pic8259_1", pic8259_device, read, write, 0xffffffff)
551551   AM_RANGE(0x0040, 0x005f) AM_DEVREADWRITE8_LEGACY("pit8254", pit8253_r, pit8253_w, 0xffffffff)
552552   AM_RANGE(0x0060, 0x006f) AM_DEVREADWRITE8("kbdc", kbdc8042_device, data_r, data_w, 0xffffffff)
553553   AM_RANGE(0x0070, 0x007f) AM_DEVREADWRITE8("rtc", mc146818_device, read, write, 0xffffffff) /* todo: nvram (CMOS Setup Save)*/
554554   AM_RANGE(0x0080, 0x009f) AM_READWRITE8(at_page8_r,at_page8_w,0xffffffff)
555   AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE8_LEGACY("pic8259_2", pic8259_r, pic8259_w, 0xffffffff)
555   AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE8("pic8259_2", pic8259_device, read, write, 0xffffffff)
556556   AM_RANGE(0x00c0, 0x00df) AM_READWRITE8(at_dma8237_2_r, at_dma8237_2_w, 0xffffffff)
557557   AM_RANGE(0x00e8, 0x00ef) AM_NOP
558558
r22822r22823
571571      {
572572         4772720/4,              /* heartbeat IRQ */
573573         DEVCB_NULL,
574         DEVCB_DEVICE_LINE("pic8259_1", pic8259_ir0_w)
574         DEVCB_DEVICE_LINE_MEMBER("pic8259_1", pic8259_device, ir0_w)
575575      }, {
576576         4772720/4,              /* dram refresh */
577577         DEVCB_NULL,
r22822r22823
593593{
594594   if (offset==2) { // IRQ = 2
595595      logerror("pic8259_slave_ACK!\n");
596      return pic8259_acknowledge(m_pic8259_2);
596      return m_pic8259_2->acknowledge();
597597   }
598598   return 0x00;
599599}
r22822r22823
607607
608608static const struct pic8259_interface midqslvr_pic8259_2_config =
609609{
610   DEVCB_DEVICE_LINE("pic8259_1", pic8259_ir2_w),
610   DEVCB_DEVICE_LINE_MEMBER("pic8259_1", pic8259_device, ir2_w),
611611   DEVCB_LINE_GND,
612612   DEVCB_NULL
613613};
r22822r22823
631631
632632IRQ_CALLBACK_MEMBER(midqslvr_state::irq_callback)
633633{
634   return pic8259_acknowledge(m_pic8259_1);
634   return m_pic8259_1->acknowledge();
635635}
636636
637637void midqslvr_state::machine_start()
trunk/src/mame/drivers/calchase.c
r22822r22823
144144   UINT8 m_piix4_config_reg[4][256];
145145
146146   device_t    *m_pit8254;
147   device_t    *m_pic8259_1;
148   device_t    *m_pic8259_2;
147   pic8259_device  *m_pic8259_1;
148   pic8259_device  *m_pic8259_2;
149149   i8237_device    *m_dma8237_1;
150150   i8237_device    *m_dma8237_2;
151151
r22822r22823
580580
581581static ADDRESS_MAP_START( calchase_io, AS_IO, 32, calchase_state )
582582   AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE8("dma8237_1", i8237_device, i8237_r, i8237_w, 0xffffffff)
583   AM_RANGE(0x0020, 0x003f) AM_DEVREADWRITE8_LEGACY("pic8259_1", pic8259_r, pic8259_w, 0xffffffff)
583   AM_RANGE(0x0020, 0x003f) AM_DEVREADWRITE8("pic8259_1", pic8259_device, read, write, 0xffffffff)
584584   AM_RANGE(0x0040, 0x005f) AM_DEVREADWRITE8_LEGACY("pit8254", pit8253_r, pit8253_w, 0xffffffff)
585585   AM_RANGE(0x0060, 0x006f) AM_DEVREADWRITE8("kbdc", kbdc8042_device, data_r, data_w, 0xffffffff)
586586   AM_RANGE(0x0070, 0x007f) AM_DEVREADWRITE8("rtc", mc146818_device, read, write, 0xffffffff) /* todo: nvram (CMOS Setup Save)*/
587587   AM_RANGE(0x0080, 0x009f) AM_READWRITE8(at_page8_r, at_page8_w, 0xffffffff)
588   AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE8_LEGACY("pic8259_2", pic8259_r, pic8259_w, 0xffffffff)
588   AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE8("pic8259_2", pic8259_device, read, write, 0xffffffff)
589589   AM_RANGE(0x00c0, 0x00df) AM_READWRITE8(at_dma8237_2_r, at_dma8237_2_w, 0xffffffff)
590590   //AM_RANGE(0x00e8, 0x00eb) AM_NOP
591591   AM_RANGE(0x00e8, 0x00ef) AM_NOP //AMI BIOS write to this ports as delays between I/O ports operations sending al value -> NEWIODELAY
r22822r22823
806806
807807IRQ_CALLBACK_MEMBER(calchase_state::irq_callback)
808808{
809   return pic8259_acknowledge(m_pic8259_1);
809   return m_pic8259_1->acknowledge();
810810}
811811
812812void calchase_state::machine_start()
r22822r22823
817817   m_maincpu->set_irq_acknowledge_callback(device_irq_acknowledge_delegate(FUNC(calchase_state::irq_callback),this));
818818
819819   m_pit8254 = machine().device( "pit8254" );
820   m_pic8259_1 = machine().device( "pic8259_1" );
821   m_pic8259_2 = machine().device( "pic8259_2" );
820   m_pic8259_1 = machine().device<pic8259_device>( "pic8259_1" );
821   m_pic8259_2 = machine().device<pic8259_device>( "pic8259_2" );
822822   m_dma8237_1 = machine().device<i8237_device>( "dma8237_1" );
823823   m_dma8237_2 = machine().device<i8237_device>( "dma8237_2" );
824824}
r22822r22823
837837READ8_MEMBER(calchase_state::get_slave_ack)
838838{
839839   if (offset==2) {
840      return pic8259_acknowledge(m_pic8259_2);
840      return m_pic8259_2->acknowledge();
841841   }
842842   return 0x00;
843843}
r22822r22823
851851
852852static const struct pic8259_interface calchase_pic8259_2_config =
853853{
854   DEVCB_DEVICE_LINE("pic8259_1", pic8259_ir2_w),
854   DEVCB_DEVICE_LINE_MEMBER("pic8259_1", pic8259_device, ir2_w),
855855   DEVCB_LINE_GND,
856856   DEVCB_NULL
857857};
r22822r22823
871871      {
872872         4772720/4,              /* heartbeat IRQ */
873873         DEVCB_NULL,
874         DEVCB_DEVICE_LINE("pic8259_1", pic8259_ir0_w)
874         DEVCB_DEVICE_LINE_MEMBER("pic8259_1", pic8259_device, ir0_w)
875875      }, {
876876         4772720/4,              /* dram refresh */
877877         DEVCB_NULL,
trunk/src/mame/drivers/pcat_nit.c
r22822r22823
126126
127127WRITE_LINE_MEMBER(pcat_nit_state::at_com_interrupt_1)
128128{
129   pic8259_ir4_w(machine().device("pic8259_1"), state);
129   machine().device<pic8259_device>("pic8259_1")->ir4_w(state);
130130}
131131
132132static const ins8250_interface pcat_nit_com0_interface =
trunk/src/mame/drivers/magtouch.c
r22822r22823
123123
124124WRITE_LINE_MEMBER(magtouch_state::at_com_interrupt_1)
125125{
126   pic8259_ir4_w(machine().device("pic8259_1"), state);
126   machine().device<pic8259_device>("pic8259_1")->ir4_w(state);
127127}
128128
129129static const ins8250_interface magtouch_com0_interface =
trunk/src/mame/drivers/queen.c
r22822r22823
411411
412412static ADDRESS_MAP_START( queen_io, AS_IO, 32, queen_state )
413413   AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE8("dma8237_1", i8237_device, i8237_r, i8237_w, 0xffffffff)
414   AM_RANGE(0x0020, 0x003f) AM_DEVREADWRITE8_LEGACY("pic8259_1", pic8259_r, pic8259_w, 0xffffffff)
414   AM_RANGE(0x0020, 0x003f) AM_DEVREADWRITE8("pic8259_1", pic8259_device, read, write, 0xffffffff)
415415   AM_RANGE(0x0040, 0x005f) AM_DEVREADWRITE8_LEGACY("pit8254", pit8253_r, pit8253_w, 0xffffffff)
416416   AM_RANGE(0x0060, 0x006f) AM_DEVREADWRITE8("kbdc", kbdc8042_device, data_r, data_w, 0xffffffff)
417417   AM_RANGE(0x0070, 0x007f) AM_DEVREADWRITE8("rtc", mc146818_device, read, write, 0xffffffff) /* todo: nvram (CMOS Setup Save)*/
418418   AM_RANGE(0x0080, 0x009f) AM_READWRITE8(at_page8_r,  at_page8_w, 0xffffffff)
419   AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE8_LEGACY("pic8259_2", pic8259_r, pic8259_w, 0xffffffff)
419   AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE8("pic8259_2", pic8259_device, read, write, 0xffffffff)
420420   AM_RANGE(0x00c0, 0x00df) AM_READWRITE8(at_dma8237_2_r, at_dma8237_2_w, 0xffffffff)
421421   AM_RANGE(0x00e8, 0x00ef) AM_NOP
422422
r22822r22823
435435      {
436436         4772720/4,              /* heartbeat IRQ */
437437         DEVCB_NULL,
438         DEVCB_DEVICE_LINE("pic8259_1", pic8259_ir0_w)
438         DEVCB_DEVICE_LINE_MEMBER("pic8259_1", pic8259_device, ir0_w)
439439      }, {
440440         4772720/4,              /* dram refresh */
441441         DEVCB_NULL,
r22822r22823
457457{
458458   if (offset==2) { // IRQ = 2
459459      logerror("pic8259_slave_ACK!\n");
460      return pic8259_acknowledge(m_pic8259_2);
460      return m_pic8259_2->acknowledge();
461461   }
462462   return 0x00;
463463}
r22822r22823
471471
472472static const struct pic8259_interface queen_pic8259_2_config =
473473{
474   DEVCB_DEVICE_LINE("pic8259_1", pic8259_ir2_w),
474   DEVCB_DEVICE_LINE_MEMBER("pic8259_1", pic8259_device, ir2_w),
475475   DEVCB_LINE_GND,
476476   DEVCB_NULL
477477};
r22822r22823
495495
496496IRQ_CALLBACK_MEMBER(queen_state::irq_callback)
497497{
498   return pic8259_acknowledge(m_pic8259_1);
498   return m_pic8259_1->acknowledge();
499499}
500500
501501void queen_state::machine_start()
trunk/src/mame/drivers/su2000.c
r22822r22823
7171      : pcat_base_state(mconfig, type, tag){ }
7272
7373   device_t    *m_pit8254;
74   device_t    *m_pic8259_1;
75   device_t    *m_pic8259_2;
74   pic8259_device  *m_pic8259_1;
75   pic8259_device  *m_pic8259_2;
7676   device_t    *m_dma8237_1;
7777   device_t    *m_dma8237_2;
7878
r22822r22823
145145   {
146146      // IRQ = 2
147147      logerror("pic8259_slave_ACK!\n");
148      return pic8259_acknowledge(m_pic8259_2);
148      return m_pic8259_2->acknowledge();
149149   }
150150   return 0x00;
151151}
r22822r22823
159159
160160static const struct pic8259_interface su2000_pic8259_2_config =
161161{
162   DEVCB_DEVICE_LINE("pic8259_1", pic8259_ir2_w),
162   DEVCB_DEVICE_LINE_MEMBER("pic8259_1", pic8259_device, ir2_w),
163163   DEVCB_LINE_GND,
164164   DEVCB_NULL
165165};
r22822r22823
177177      {
178178         4772720/4,              /* Heartbeat IRQ */
179179         DEVCB_NULL,
180         DEVCB_DEVICE_LINE("pic8259_1", pic8259_ir0_w)
180         DEVCB_DEVICE_LINE_MEMBER("pic8259_1", pic8259_device, ir0_w)
181181      }, {
182182         4772720/4,              /* DRAM refresh */
183183         DEVCB_NULL,
r22822r22823
201201   address_space &space = m_maincpu->space(AS_PROGRAM);
202202
203203   m_pit8254 = machine().device("pit8254");
204   m_pic8259_1 = machine().device("pic8259_1");
205   m_pic8259_2 = machine().device("pic8259_2");
204   m_pic8259_1 = machine().device<pic8259_device>("pic8259_1");
205   m_pic8259_2 = machine().device<pic8259_device>("pic8259_2");
206206   m_dma8237_1 = machine().device("dma8237_1");
207207   m_dma8237_2 = machine().device("dma8237_2");
208208
trunk/src/mame/drivers/mediagx.c
r22822r22823
565565
566566READ8_MEMBER(mediagx_state::io20_r)
567567{
568   device_t *device = machine().device("pic8259_master");
568   pic8259_device *device = machine().device<pic8259_device>("pic8259_master");
569569   UINT8 r = 0;
570570
571571   // 0x22, 0x23, Cyrix configuration registers
r22822r22823
578578   }
579579   else
580580   {
581      r = pic8259_r(device, space, offset);
581      r = device->read(space, offset);
582582   }
583583   return r;
584584}
585585
586586WRITE8_MEMBER(mediagx_state::io20_w)
587587{
588   device_t *device = machine().device("pic8259_master");
588   pic8259_device *device = machine().device<pic8259_device>("pic8259_master");
589589
590590   // 0x22, 0x23, Cyrix configuration registers
591591   if (offset == 0x02)
r22822r22823
598598   }
599599   else
600600   {
601      pic8259_w(device, space, offset, data);
601      device->write(space, offset, data);
602602   }
603603}
604604
r22822r22823
963963   AM_RANGE(0x0060, 0x006f) AM_DEVREADWRITE8("kbdc", kbdc8042_device, data_r, data_w, 0xffffffff)
964964   AM_RANGE(0x0070, 0x007f) AM_DEVREADWRITE8("rtc", mc146818_device, read, write, 0xffffffff)
965965   AM_RANGE(0x0080, 0x009f) AM_READWRITE8(at_page8_r,              at_page8_w, 0xffffffff)
966   AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE8_LEGACY("pic8259_slave", pic8259_r, pic8259_w, 0xffffffff)
966   AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE8("pic8259_slave", pic8259_device, read, write, 0xffffffff)
967967   AM_RANGE(0x00c0, 0x00df) AM_READWRITE8(at_dma8237_2_r, at_dma8237_2_w, 0xffffffff)
968968   AM_RANGE(0x00e8, 0x00eb) AM_NOP     // I/O delay port
969969   AM_RANGE(0x01f0, 0x01f7) AM_READWRITE(ide_r, ide_w)
r22822r22823
10551055
10561056IRQ_CALLBACK_MEMBER(mediagx_state::irq_callback)
10571057{
1058   return pic8259_acknowledge(m_pic8259_1);
1058   return m_pic8259_1->acknowledge();
10591059}
10601060
10611061void mediagx_state::machine_start()
r22822r22823
11021102READ8_MEMBER(mediagx_state::get_slave_ack)
11031103{
11041104   if (offset==2) { // IRQ = 2
1105      return pic8259_acknowledge(m_pic8259_2);
1105      return m_pic8259_2->acknowledge();
11061106   }
11071107   return 0x00;
11081108}
r22822r22823
11161116
11171117static const struct pic8259_interface mediagx_pic8259_2_config =
11181118{
1119   DEVCB_DEVICE_LINE("pic8259_master", pic8259_ir2_w),
1119   DEVCB_DEVICE_LINE_MEMBER("pic8259_master", pic8259_device, ir2_w),
11201120   DEVCB_LINE_GND,
11211121   DEVCB_NULL
11221122};
r22822r22823
11341134      {
11351135         4772720/4,              /* heartbeat IRQ */
11361136         DEVCB_NULL,
1137         DEVCB_DEVICE_LINE("pic8259_master", pic8259_ir0_w)
1137         DEVCB_DEVICE_LINE_MEMBER("pic8259_master", pic8259_device, ir0_w)
11381138      }, {
11391139         4772720/4,              /* dram refresh */
11401140         DEVCB_NULL,
trunk/src/mame/drivers/taitowlf.c
r22822r22823
6363
6464   required_device<cpu_device> m_maincpu;
6565   required_device<device_t> m_pit8254;
66   required_device<device_t> m_pic8259_1;
67   required_device<device_t> m_pic8259_2;
66   required_device<pic8259_device> m_pic8259_1;
67   required_device<pic8259_device> m_pic8259_2;
6868   required_device<i8237_device> m_dma8237_1;
6969   required_device<i8237_device> m_dma8237_2;
7070   required_memory_region m_region_user1;
r22822r22823
487487
488488static ADDRESS_MAP_START(taitowlf_io, AS_IO, 32, taitowlf_state )
489489   AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE8("dma8237_1", i8237_device, i8237_r, i8237_w, 0xffffffff)
490   AM_RANGE(0x0020, 0x003f) AM_DEVREADWRITE8_LEGACY("pic8259_1", pic8259_r, pic8259_w, 0xffffffff)
490   AM_RANGE(0x0020, 0x003f) AM_DEVREADWRITE8("pic8259_1", pic8259_device, read, write, 0xffffffff)
491491   AM_RANGE(0x0040, 0x005f) AM_DEVREADWRITE8_LEGACY("pit8254", pit8253_r, pit8253_w, 0xffffffff)
492492   AM_RANGE(0x0060, 0x006f) AM_DEVREADWRITE8("kbdc", kbdc8042_device, data_r, data_w, 0xffffffff)
493493   AM_RANGE(0x0070, 0x007f) AM_DEVREADWRITE8("rtc", mc146818_device, read, write, 0xffffffff)
494494   AM_RANGE(0x0080, 0x009f) AM_READWRITE8(at_page8_r,              at_page8_w, 0xffffffff)
495   AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE8_LEGACY("pic8259_2", pic8259_r, pic8259_w, 0xffffffff)
495   AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE8("pic8259_2", pic8259_device, read, write, 0xffffffff)
496496   AM_RANGE(0x00c0, 0x00df) AM_READWRITE8(at_dma8237_2_r, at_dma8237_2_w, 0xffffffff)
497497   AM_RANGE(0x00e8, 0x00eb) AM_NOP
498498   AM_RANGE(0x01f0, 0x01f7) AM_READWRITE(ide_r, ide_w)
r22822r22823
549549
550550IRQ_CALLBACK_MEMBER(taitowlf_state::irq_callback)
551551{
552   return pic8259_acknowledge(m_pic8259_1);
552   return m_pic8259_1->acknowledge();
553553}
554554
555555void taitowlf_state::machine_start()
r22822r22823
577577READ8_MEMBER(taitowlf_state::get_slave_ack)
578578{
579579   if (offset==2) { // IRQ = 2
580      return pic8259_acknowledge(m_pic8259_2);
580      return m_pic8259_2->acknowledge();
581581   }
582582   return 0x00;
583583}
r22822r22823
591591
592592static const struct pic8259_interface taitowlf_pic8259_2_config =
593593{
594   DEVCB_DEVICE_LINE("pic8259_1", pic8259_ir2_w),
594   DEVCB_DEVICE_LINE_MEMBER("pic8259_1", pic8259_device, ir2_w),
595595   DEVCB_LINE_GND,
596596   DEVCB_NULL
597597};
r22822r22823
609609      {
610610         4772720/4,              /* heartbeat IRQ */
611611         DEVCB_NULL,
612         DEVCB_DEVICE_LINE("pic8259_1", pic8259_ir0_w)
612         DEVCB_DEVICE_LINE_MEMBER("pic8259_1", pic8259_device, ir0_w)
613613      }, {
614614         4772720/4,              /* dram refresh */
615615         DEVCB_NULL,
trunk/src/mame/drivers/funkball.c
r22822r22823
422422
423423READ8_MEMBER(funkball_state::io20_r)
424424{
425   device_t *device = machine().device("pic8259_1");
425   pic8259_device *device = machine().device<pic8259_device>("pic8259_1");
426426   UINT8 r = 0;
427427
428428   // 0x22, 0x23, Cyrix configuration registers
r22822r22823
435435   }
436436   else
437437   {
438      r = pic8259_r(device, space, offset);
438      r = device->read(space, offset);
439439   }
440440   return r;
441441}
442442
443443WRITE8_MEMBER(funkball_state::io20_w)
444444{
445   device_t *device = machine().device("pic8259_1");
445   pic8259_device *device = machine().device<pic8259_device>("pic8259_1");
446446
447447   // 0x22, 0x23, Cyrix configuration registers
448448   if (offset == 0x02)
r22822r22823
455455   }
456456   else
457457   {
458      pic8259_w(device, space, offset, data);
458      device->write(space, offset, data);
459459   }
460460}
461461
r22822r22823
592592   AM_RANGE(0x0060, 0x006f) AM_DEVREADWRITE8("kbdc", kbdc8042_device, data_r, data_w, 0xffffffff)
593593   AM_RANGE(0x0070, 0x007f) AM_DEVREADWRITE8("rtc", mc146818_device, read, write, 0xffffffff) /* todo: nvram (CMOS Setup Save)*/
594594   AM_RANGE(0x0080, 0x009f) AM_READWRITE8(at_page8_r,at_page8_w, 0xffffffff)
595   AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE8_LEGACY("pic8259_2", pic8259_r, pic8259_w, 0xffffffff)
595   AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE8("pic8259_2", pic8259_device, read, write, 0xffffffff)
596596   AM_RANGE(0x00c0, 0x00df) AM_READWRITE8(at_dma8237_2_r, at_dma8237_2_w, 0xffffffff)
597597   AM_RANGE(0x00e8, 0x00ef) AM_NOP
598598
r22822r22823
10181018      {
10191019         4772720/4,              /* heartbeat IRQ */
10201020         DEVCB_NULL,
1021         DEVCB_DEVICE_LINE("pic8259_1", pic8259_ir0_w)
1021         DEVCB_DEVICE_LINE_MEMBER("pic8259_1", pic8259_device, ir0_w)
10221022      }, {
10231023         4772720/4,              /* dram refresh */
10241024         DEVCB_NULL,
r22822r22823
10401040{
10411041   if (offset==2) { // IRQ = 2
10421042      logerror("pic8259_slave_ACK!\n");
1043      return pic8259_acknowledge(m_pic8259_2);
1043      return m_pic8259_2->acknowledge();
10441044   }
10451045   return 0x00;
10461046}
r22822r22823
10541054
10551055static const struct pic8259_interface funkball_pic8259_2_config =
10561056{
1057   DEVCB_DEVICE_LINE("pic8259_1", pic8259_ir2_w),
1057   DEVCB_DEVICE_LINE_MEMBER("pic8259_1", pic8259_device, ir2_w),
10581058   DEVCB_LINE_GND,
10591059   DEVCB_NULL
10601060};
r22822r22823
10781078
10791079IRQ_CALLBACK_MEMBER(funkball_state::irq_callback)
10801080{
1081   return pic8259_acknowledge(m_pic8259_1);
1081   return m_pic8259_1->acknowledge();
10821082}
10831083
10841084void funkball_state::machine_start()
trunk/src/mame/drivers/gamecstl.c
r22822r22823
9191   UINT8 m_at_pages[0x10];
9292
9393   device_t    *m_pit8254;
94   device_t    *m_pic8259_1;
95   device_t    *m_pic8259_2;
94   pic8259_device  *m_pic8259_1;
95   pic8259_device  *m_pic8259_2;
9696   i8237_device    *m_dma8237_1;
9797   i8237_device    *m_dma8237_2;
9898   DECLARE_WRITE32_MEMBER(pnp_config_w);
r22822r22823
528528
529529static ADDRESS_MAP_START(gamecstl_io, AS_IO, 32, gamecstl_state )
530530   AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE8("dma8237_1", i8237_device, i8237_r, i8237_w, 0xffffffff)
531   AM_RANGE(0x0020, 0x003f) AM_DEVREADWRITE8_LEGACY("pic8259_1", pic8259_r, pic8259_w, 0xffffffff)
531   AM_RANGE(0x0020, 0x003f) AM_DEVREADWRITE8("pic8259_1", pic8259_device, read, write, 0xffffffff)
532532   AM_RANGE(0x0040, 0x005f) AM_DEVREADWRITE8_LEGACY("pit8254", pit8253_r, pit8253_w, 0xffffffff)
533533   AM_RANGE(0x0060, 0x006f) AM_DEVREADWRITE8("kbdc", kbdc8042_device, data_r, data_w, 0xffffffff)
534534   AM_RANGE(0x0070, 0x007f) AM_DEVREADWRITE8("rtc", mc146818_device, read, write, 0xffffffff)
535535   AM_RANGE(0x0080, 0x009f) AM_READWRITE8(at_page8_r,at_page8_w, 0xffffffff)
536   AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE8_LEGACY("pic8259_2", pic8259_r, pic8259_w, 0xffffffff)
536   AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE8("pic8259_2", pic8259_device, read, write, 0xffffffff)
537537   AM_RANGE(0x00c0, 0x00df) AM_READWRITE8(at_dma8237_2_r, at_dma8237_2_w, 0xffffffff)
538538   AM_RANGE(0x00e8, 0x00eb) AM_NOP
539539   AM_RANGE(0x00ec, 0x00ef) AM_NOP
r22822r22823
606606
607607IRQ_CALLBACK_MEMBER(gamecstl_state::irq_callback)
608608{
609   return pic8259_acknowledge(m_pic8259_1);
609   return m_pic8259_1->acknowledge();
610610}
611611
612612void gamecstl_state::machine_start()
613613{
614614   m_pit8254 = machine().device( "pit8254" );
615   m_pic8259_1 = machine().device( "pic8259_1" );
616   m_pic8259_2 = machine().device( "pic8259_2" );
615   m_pic8259_1 = machine().device<pic8259_device>( "pic8259_1" );
616   m_pic8259_2 = machine().device<pic8259_device>( "pic8259_2" );
617617   m_dma8237_1 = machine().device<i8237_device>( "dma8237_1" );
618618   m_dma8237_2 = machine().device<i8237_device>( "dma8237_2" );
619619}
r22822r22823
640640READ8_MEMBER(gamecstl_state::get_slave_ack)
641641{
642642   if (offset==2) { // IRQ = 2
643      return pic8259_acknowledge(m_pic8259_2);
643      return m_pic8259_2->acknowledge();
644644   }
645645   return 0x00;
646646}
r22822r22823
654654
655655static const struct pic8259_interface gamecstl_pic8259_2_config =
656656{
657   DEVCB_DEVICE_LINE("pic8259_1", pic8259_ir2_w),
657   DEVCB_DEVICE_LINE_MEMBER("pic8259_1", pic8259_device, ir2_w),
658658   DEVCB_LINE_GND,
659659   DEVCB_NULL
660660};
r22822r22823
672672      {
673673         4772720/4,              /* heartbeat IRQ */
674674         DEVCB_NULL,
675         DEVCB_DEVICE_LINE("pic8259_1", pic8259_ir0_w)
675         DEVCB_DEVICE_LINE_MEMBER("pic8259_1", pic8259_device, ir0_w)
676676      }, {
677677         4772720/4,              /* dram refresh */
678678         DEVCB_NULL,
trunk/src/mame/drivers/fruitpc.c
r22822r22823
3636   UINT8 m_at_pages[0x10];
3737
3838   device_t    *m_pit8254;
39   device_t    *m_pic8259_1;
40   device_t    *m_pic8259_2;
39   pic8259_device  *m_pic8259_1;
40   pic8259_device  *m_pic8259_2;
4141   i8237_device    *m_dma8237_1;
4242   i8237_device    *m_dma8237_2;
4343
r22822r22823
218218
219219static ADDRESS_MAP_START( fruitpc_io, AS_IO, 32, fruitpc_state )
220220   AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE8("dma8237_1", i8237_device, i8237_r, i8237_w, 0xffffffff)
221   AM_RANGE(0x0020, 0x003f) AM_DEVREADWRITE8_LEGACY("pic8259_1", pic8259_r, pic8259_w, 0xffffffff)
221   AM_RANGE(0x0020, 0x003f) AM_DEVREADWRITE8("pic8259_1", pic8259_device, read, write, 0xffffffff)
222222   AM_RANGE(0x0040, 0x005f) AM_DEVREADWRITE8_LEGACY("pit8254", pit8253_r, pit8253_w, 0xffffffff)
223223   AM_RANGE(0x0060, 0x006f) AM_DEVREADWRITE8("kbdc", kbdc8042_device, data_r, data_w, 0xffffffff)
224224   AM_RANGE(0x0070, 0x007f) AM_DEVREADWRITE8("rtc", mc146818_device, read, write, 0xffffffff) /* todo: nvram (CMOS Setup Save)*/
225225   AM_RANGE(0x0080, 0x009f) AM_READWRITE8(at_page8_r, at_page8_w, 0xffffffff)
226   AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE8_LEGACY("pic8259_2", pic8259_r, pic8259_w, 0xffffffff)
226   AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE8("pic8259_2", pic8259_device, read, write, 0xffffffff)
227227   AM_RANGE(0x00c0, 0x00df) AM_READWRITE8(at_dma8237_2_r, at_dma8237_2_w, 0xffffffff)
228228   //AM_RANGE(0x00e8, 0x00eb) AM_NOP
229229   AM_RANGE(0x00e8, 0x00ef) AM_NOP //AMI BIOS write to this ports as delays between I/O ports operations sending al value -> NEWIODELAY
r22822r22823
443443
444444IRQ_CALLBACK_MEMBER(fruitpc_state::irq_callback)
445445{
446   return pic8259_acknowledge(m_pic8259_1);
446   return m_pic8259_1->acknowledge();
447447}
448448
449449void fruitpc_state::machine_start()
r22822r22823
451451   m_maincpu->set_irq_acknowledge_callback(device_irq_acknowledge_delegate(FUNC(fruitpc_state::irq_callback),this));
452452
453453   m_pit8254 = machine().device( "pit8254" );
454   m_pic8259_1 = machine().device( "pic8259_1" );
455   m_pic8259_2 = machine().device( "pic8259_2" );
454   m_pic8259_1 = machine().device<pic8259_device>( "pic8259_1" );
455   m_pic8259_2 = machine().device<pic8259_device>( "pic8259_2" );
456456   m_dma8237_1 = machine().device<i8237_device>( "dma8237_1" );
457457   m_dma8237_2 = machine().device<i8237_device>( "dma8237_2" );
458458}
r22822r22823
471471READ8_MEMBER(fruitpc_state::get_slave_ack)
472472{
473473   if (offset==2) {
474      return pic8259_acknowledge(m_pic8259_2);
474      return m_pic8259_2->acknowledge();
475475   }
476476   return 0x00;
477477}
r22822r22823
485485
486486static const struct pic8259_interface fruitpc_pic8259_2_config =
487487{
488   DEVCB_DEVICE_LINE("pic8259_1", pic8259_ir2_w),
488   DEVCB_DEVICE_LINE_MEMBER("pic8259_1", pic8259_device, ir2_w),
489489   DEVCB_LINE_GND,
490490   DEVCB_NULL
491491};
r22822r22823
505505      {
506506         4772720/4,              /* heartbeat IRQ */
507507         DEVCB_NULL,
508         DEVCB_DEVICE_LINE("pic8259_1", pic8259_ir0_w)
508         DEVCB_DEVICE_LINE_MEMBER("pic8259_1", pic8259_device, ir0_w)
509509      }, {
510510         4772720/4,              /* dram refresh */
511511         DEVCB_NULL,
trunk/src/mame/drivers/gammagic.c
r22822r22823
8888   UINT8 m_at_pages[0x10];
8989
9090   required_device<device_t> m_pit8254;
91   required_device<device_t> m_pic8259_1;
92   required_device<device_t> m_pic8259_2;
91   required_device<pic8259_device> m_pic8259_1;
92   required_device<pic8259_device> m_pic8259_2;
9393   required_device<i8237_device> m_dma8237_1;
9494   required_device<i8237_device> m_dma8237_2;
9595
r22822r22823
572572
573573static ADDRESS_MAP_START( gammagic_io, AS_IO, 32, gammagic_state)
574574   AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE8("dma8237_1", i8237_device, i8237_r, i8237_w, 0xffffffff)
575   AM_RANGE(0x0020, 0x003f) AM_DEVREADWRITE8_LEGACY("pic8259_1", pic8259_r, pic8259_w, 0xffffffff)
575   AM_RANGE(0x0020, 0x003f) AM_DEVREADWRITE8("pic8259_1", pic8259_device, read, write, 0xffffffff)
576576   AM_RANGE(0x0040, 0x005f) AM_DEVREADWRITE8_LEGACY("pit8254", pit8253_r, pit8253_w, 0xffffffff)
577577   AM_RANGE(0x0060, 0x006f) AM_DEVREADWRITE8("kbdc", kbdc8042_device, data_r, data_w, 0xffffffff)
578578   AM_RANGE(0x0070, 0x007f) AM_DEVREADWRITE8("rtc", mc146818_device, read, write, 0xffffffff)
579579   AM_RANGE(0x0080, 0x009f) AM_READWRITE8(at_page8_r, at_page8_w, 0xffffffff)
580   AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE8_LEGACY("pic8259_2", pic8259_r, pic8259_w, 0xffffffff)
580   AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE8("pic8259_2", pic8259_device, read, write, 0xffffffff)
581581   AM_RANGE(0x00c0, 0x00df) AM_READWRITE8(at_dma8237_2_r, at_dma8237_2_w, 0xffffffff)
582582   AM_RANGE(0x00e8, 0x00ef) AM_NOP
583583   AM_RANGE(0x00f0, 0x01ef) AM_NOP
r22822r22823
644644
645645IRQ_CALLBACK_MEMBER(gammagic_state::irq_callback)
646646{
647   return pic8259_acknowledge(m_pic8259_1);
647   return m_pic8259_1->acknowledge();
648648}
649649
650650void gammagic_state::machine_start()
r22822r22823
703703READ8_MEMBER(gammagic_state::get_slave_ack)
704704{
705705   if (offset==2) {
706      return pic8259_acknowledge(m_pic8259_2);
706      return m_pic8259_2->acknowledge();
707707   }
708708   return 0x00;
709709}
r22822r22823
717717
718718static const struct pic8259_interface gammagic_pic8259_2_config =
719719{
720   DEVCB_DEVICE_LINE("pic8259_1", pic8259_ir2_w),
720   DEVCB_DEVICE_LINE_MEMBER("pic8259_1", pic8259_device, ir2_w),
721721   DEVCB_LINE_GND,
722722   DEVCB_NULL
723723};
r22822r22823
734734      {
735735         4772720/4,              /* heartbeat IRQ */
736736         DEVCB_NULL,
737         DEVCB_DEVICE_LINE("pic8259_1", pic8259_ir0_w)
737         DEVCB_DEVICE_LINE_MEMBER("pic8259_1", pic8259_device, ir0_w)
738738      }, {
739739         4772720/4,              /* dram refresh */
740740         DEVCB_NULL,
trunk/src/mame/drivers/voyager.c
r22822r22823
4040   UINT8 m_piix4_config_reg[4][256];
4141
4242   device_t    *m_pit8254;
43   device_t    *m_pic8259_1;
44   device_t    *m_pic8259_2;
43   pic8259_device  *m_pic8259_1;
44   pic8259_device  *m_pic8259_2;
4545   i8237_device    *m_dma8237_1;
4646   i8237_device    *m_dma8237_2;
4747
r22822r22823
419419
420420static ADDRESS_MAP_START( voyager_io, AS_IO, 32, voyager_state )
421421   AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE8("dma8237_1", i8237_device, i8237_r, i8237_w, 0xffffffff)
422   AM_RANGE(0x0020, 0x003f) AM_DEVREADWRITE8_LEGACY("pic8259_1", pic8259_r, pic8259_w, 0xffffffff)
422   AM_RANGE(0x0020, 0x003f) AM_DEVREADWRITE8("pic8259_1", pic8259_device, read, write, 0xffffffff)
423423   AM_RANGE(0x0040, 0x005f) AM_DEVREADWRITE8_LEGACY("pit8254", pit8253_r, pit8253_w, 0xffffffff)
424424   AM_RANGE(0x0060, 0x006f) AM_DEVREADWRITE8("kbdc", kbdc8042_device, data_r, data_w, 0xffffffff)
425425   AM_RANGE(0x0070, 0x007f) AM_DEVREADWRITE8("rtc", mc146818_device, read, write, 0xffffffff) /* todo: nvram (CMOS Setup Save)*/
426426   AM_RANGE(0x0080, 0x009f) AM_READWRITE8(at_page8_r, at_page8_w, 0xffffffff)
427   AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE8_LEGACY("pic8259_2", pic8259_r, pic8259_w, 0xffffffff)
427   AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE8("pic8259_2", pic8259_device, read, write, 0xffffffff)
428428   AM_RANGE(0x00c0, 0x00df) AM_READWRITE8(at_dma8237_2_r, at_dma8237_2_w, 0xffffffff)
429429   //AM_RANGE(0x00e8, 0x00eb) AM_NOP
430430   AM_RANGE(0x00e8, 0x00ef) AM_NOP //AMI BIOS write to this ports as delays between I/O ports operations sending al value -> NEWIODELAY
r22822r22823
645645
646646IRQ_CALLBACK_MEMBER(voyager_state::irq_callback)
647647{
648   return pic8259_acknowledge(m_pic8259_1);
648   return m_pic8259_1->acknowledge();
649649}
650650
651651void voyager_state::machine_start()
r22822r22823
653653   m_maincpu->set_irq_acknowledge_callback(device_irq_acknowledge_delegate(FUNC(voyager_state::irq_callback),this));
654654
655655   m_pit8254 = machine().device( "pit8254" );
656   m_pic8259_1 = machine().device( "pic8259_1" );
657   m_pic8259_2 = machine().device( "pic8259_2" );
656   m_pic8259_1 = machine().device<pic8259_device>( "pic8259_1" );
657   m_pic8259_2 = machine().device<pic8259_device>( "pic8259_2" );
658658   m_dma8237_1 = machine().device<i8237_device>( "dma8237_1" );
659659   m_dma8237_2 = machine().device<i8237_device>( "dma8237_2" );
660660}
r22822r22823
673673READ8_MEMBER(voyager_state::get_slave_ack)
674674{
675675   if (offset==2) {
676      return pic8259_acknowledge(m_pic8259_2);
676      return m_pic8259_2->acknowledge();
677677   }
678678   return 0x00;
679679}
r22822r22823
687687
688688static const struct pic8259_interface voyager_pic8259_2_config =
689689{
690   DEVCB_DEVICE_LINE("pic8259_1", pic8259_ir2_w),
690   DEVCB_DEVICE_LINE_MEMBER("pic8259_1", pic8259_device, ir2_w),
691691   DEVCB_LINE_GND,
692692   DEVCB_NULL
693693};
r22822r22823
707707      {
708708         4772720/4,              /* heartbeat IRQ */
709709         DEVCB_NULL,
710         DEVCB_DEVICE_LINE("pic8259_1", pic8259_ir0_w)
710         DEVCB_DEVICE_LINE_MEMBER("pic8259_1", pic8259_device, ir0_w)
711711      }, {
712712         4772720/4,              /* dram refresh */
713713         DEVCB_NULL,
trunk/src/mame/drivers/chihiro.c
r22822r22823
410410   UINT32 screen_update_callback(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
411411
412412   struct chihiro_devices {
413      device_t    *pic8259_1;
414      device_t    *pic8259_2;
413      pic8259_device    *pic8259_1;
414      pic8259_device    *pic8259_2;
415415      device_t    *ide;
416416   } chihiro_devs;
417417
r22822r22823
23172317      pmc[0x100/4] &= ~0x1000000;
23182318   if ((pmc[0x100/4] != 0) && (pmc[0x140/4] != 0)) {
23192319      // send interrupt
2320      pic8259_ir3_w(chst->chihiro_devs.pic8259_1, 1); // IRQ 3
2320      chst->chihiro_devs.pic8259_1->ir3_w(1); // IRQ 3
23212321   } else
2322      pic8259_ir3_w(chst->chihiro_devs.pic8259_1, 0); // IRQ 3
2322      chst->chihiro_devs.pic8259_1->ir3_w(0); // IRQ 3
23232323}
23242324
23252325UINT32 nv2a_renderer::screen_update_callback(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
r22822r22823
27842784READ8_MEMBER(chihiro_state::get_slave_ack)
27852785{
27862786   if (offset==2) { // IRQ = 2
2787      return pic8259_acknowledge(chihiro_devs.pic8259_2);
2787      return chihiro_devs.pic8259_2->acknowledge();
27882788   }
27892789   return 0x00;
27902790}
r22822r22823
27982798
27992799static const struct pic8259_interface chihiro_pic8259_2_config =
28002800{
2801   DEVCB_DEVICE_LINE("pic8259_1", pic8259_ir2_w),
2801   DEVCB_DEVICE_LINE_MEMBER("pic8259_1", pic8259_device, ir2_w),
28022802   DEVCB_LINE_GND,
28032803   DEVCB_NULL
28042804};
r22822r22823
28062806IRQ_CALLBACK_MEMBER(chihiro_state::irq_callback)
28072807{
28082808   int r = 0;
2809   r = pic8259_acknowledge(chihiro_devs.pic8259_2);
2809   r = chihiro_devs.pic8259_2->acknowledge();
28102810   if (r==0)
28112811   {
2812      r = pic8259_acknowledge(chihiro_devs.pic8259_1);
2812      r = chihiro_devs.pic8259_1->acknowledge();
28132813   }
28142814   return r;
28152815}
28162816
28172817WRITE_LINE_MEMBER(chihiro_state::chihiro_pit8254_out0_changed)
28182818{
2819   if ( machine().device("pic8259_1") )
2819   if ( machine().device<pic8259_device>("pic8259_1") )
28202820   {
2821      pic8259_ir0_w(machine().device("pic8259_1"), state);
2821      machine().device<pic8259_device>("pic8259_1")->ir0_w(state);
28222822   }
28232823}
28242824
r22822r22823
29612961   if ((offset == 0) && (mem_mask == 0xff)) // 0 smbus status
29622962   {
29632963      if (!((smbusst.status ^ data) & 0x10)) // clearing interrupt
2964         pic8259_ir3_w(chihiro_devs.pic8259_2, 0); // IRQ 11
2964         chihiro_devs.pic8259_2->ir3_w(0); // IRQ 11
29652965      smbusst.status &= ~data;
29662966   }
29672967   if ((offset == 0) && (mem_mask == 0xff0000)) // 2 smbus control
r22822r22823
29822982            smbusst.status |= 0x10;
29832983            if (smbusst.control & 0x10)
29842984            {
2985               pic8259_ir3_w(chihiro_devs.pic8259_2, 1); // IRQ 11
2985               chihiro_devs.pic8259_2->ir3_w(1); // IRQ 11
29862986            }
29872987         }
29882988      }
r22822r22823
30103010ADDRESS_MAP_END
30113011
30123012static ADDRESS_MAP_START(xbox_map_io, AS_IO, 32, chihiro_state )
3013   AM_RANGE(0x0020, 0x0023) AM_DEVREADWRITE8_LEGACY("pic8259_1", pic8259_r, pic8259_w, 0xffffffff)
3013   AM_RANGE(0x0020, 0x0023) AM_DEVREADWRITE8("pic8259_1", pic8259_device, read, write, 0xffffffff)
30143014   AM_RANGE(0x0040, 0x0043) AM_DEVREADWRITE8_LEGACY("pit8254", pit8253_r, pit8253_w, 0xffffffff)
3015   AM_RANGE(0x00a0, 0x00a3) AM_DEVREADWRITE8_LEGACY("pic8259_2", pic8259_r, pic8259_w, 0xffffffff)
3015   AM_RANGE(0x00a0, 0x00a3) AM_DEVREADWRITE8("pic8259_2", pic8259_device, read, write, 0xffffffff)
30163016   AM_RANGE(0x01f0, 0x01f7) AM_READWRITE(ide_r, ide_w)
30173017   AM_RANGE(0x0cf8, 0x0cff) AM_DEVREADWRITE("pcibus", pci_bus_legacy_device, read, write)
30183018   AM_RANGE(0x8000, 0x80ff) AM_READWRITE(dummy_r, dummy_w)
r22822r22823
30333033   smbus_register_device(0x45,smbus_callback_cx25871);
30343034   smbus_register_device(0x54,smbus_callback_eeprom);
30353035   m_maincpu->set_irq_acknowledge_callback(device_irq_acknowledge_delegate(FUNC(chihiro_state::irq_callback),this));
3036   chihiro_devs.pic8259_1 = machine().device( "pic8259_1" );
3037   chihiro_devs.pic8259_2 = machine().device( "pic8259_2" );
3036   chihiro_devs.pic8259_1 = machine().device<pic8259_device>( "pic8259_1" );
3037   chihiro_devs.pic8259_2 = machine().device<pic8259_device>( "pic8259_2" );
30383038   chihiro_devs.ide = machine().device( "ide" );
30393039   if (machine().debug_flags & DEBUG_FLAG_ENABLED)
30403040      debug_console_register_command(machine(),"chihiro",CMDFLAG_NONE,0,1,4,chihiro_debug_commands);
trunk/src/mame/drivers/pinball2k.c
r22822r22823
471471
472472READ8_MEMBER(pinball2k_state::io20_r)
473473{
474   device_t *device = machine().device("pic8259_master");
474   pic8259_device *device = machine().device<pic8259_device>("pic8259_master");
475475   UINT8 r = 0;
476476
477477   // 0x22, 0x23, Cyrix configuration registers
r22822r22823
484484   }
485485   else
486486   {
487      r = pic8259_r(device, space, offset);
487      r = device->read(space, offset);
488488   }
489489   return r;
490490}
491491
492492WRITE8_MEMBER(pinball2k_state::io20_w)
493493{
494   device_t *device = machine().device("pic8259_master");
494   pic8259_device *device = machine().device<pic8259_device>("pic8259_master");
495495
496496   // 0x22, 0x23, Cyrix configuration registers
497497   if (offset == 0x02)
r22822r22823
504504   }
505505   else
506506   {
507      pic8259_w(device, space, offset, data);
507      device->write(space, offset, data);
508508   }
509509}
510510
r22822r22823
675675   AM_RANGE(0x0060, 0x006f) AM_DEVREADWRITE8("kbdc", kbdc8042_device, data_r, data_w, 0xffffffff)
676676   AM_RANGE(0x0070, 0x007f) AM_DEVREADWRITE8("rtc", mc146818_device, read, write, 0xffffffff)
677677   AM_RANGE(0x0080, 0x009f) AM_READWRITE8(at_page8_r,              at_page8_w, 0xffffffff)
678   AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE8_LEGACY("pic8259_slave", pic8259_r, pic8259_w, 0xffffffff)
678   AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE8("pic8259_slave", pic8259_device, read, write, 0xffffffff)
679679   AM_RANGE(0x00c0, 0x00df) AM_READWRITE8(at_dma8237_2_r, at_dma8237_2_w, 0xffffffff)
680680   AM_RANGE(0x00e8, 0x00eb) AM_NOP     // I/O delay port
681681   AM_RANGE(0x01f0, 0x01f7) AM_READWRITE(ide_r, ide_w)
r22822r22823
766766
767767IRQ_CALLBACK_MEMBER(pinball2k_state::irq_callback)
768768{
769   return pic8259_acknowledge(m_pic8259_1);
769   return m_pic8259_1->acknowledge();
770770}
771771
772772void pinball2k_state::machine_start()
r22822r22823
804804READ8_MEMBER(pinball2k_state::get_slave_ack)
805805{
806806   if (offset==2) { // IRQ = 2
807      return pic8259_acknowledge(m_pic8259_2);
807      return m_pic8259_2->acknowledge();
808808   }
809809   return 0x00;
810810}
r22822r22823
818818
819819static const struct pic8259_interface mediagx_pic8259_2_config =
820820{
821   DEVCB_DEVICE_LINE("pic8259_master", pic8259_ir2_w),
821   DEVCB_DEVICE_LINE_MEMBER("pic8259_master", pic8259_device, ir2_w),
822822   DEVCB_LINE_GND,
823823   DEVCB_NULL
824824};
r22822r22823
836836      {
837837         4772720/4,              /* heartbeat IRQ */
838838         DEVCB_NULL,
839         DEVCB_DEVICE_LINE("pic8259_master", pic8259_ir0_w)
839         DEVCB_DEVICE_LINE_MEMBER("pic8259_master", pic8259_device, ir0_w)
840840      }, {
841841         4772720/4,              /* dram refresh */
842842         DEVCB_NULL,
trunk/src/mame/machine/pcshare.c
r22822r22823
146146READ8_MEMBER( pcat_base_state::get_slave_ack )
147147{
148148   if (offset==2) { // IRQ = 2
149      return pic8259_acknowledge(m_pic8259_2);
149      return m_pic8259_2->acknowledge();
150150   }
151151   return 0x00;
152152}
r22822r22823
160160
161161static const struct pic8259_interface pic8259_2_config =
162162{
163   DEVCB_DEVICE_LINE("pic8259_1", pic8259_ir2_w),
163   DEVCB_DEVICE_LINE_MEMBER("pic8259_1", pic8259_device, ir2_w),
164164   DEVCB_LINE_GND,
165165   DEVCB_NULL
166166};
167167
168168IRQ_CALLBACK_MEMBER(pcat_base_state::irq_callback)
169169{
170   return pic8259_acknowledge(m_pic8259_1);
170   return m_pic8259_1->acknowledge();
171171}
172172
173173WRITE_LINE_MEMBER( pcat_base_state::at_pit8254_out0_changed )
174174{
175175   if (m_pic8259_1 )
176176   {
177      pic8259_ir0_w(m_pic8259_1, state);
177      m_pic8259_1->ir0_w(state);
178178   }
179179}
180180
r22822r22823
230230
231231ADDRESS_MAP_START( pcat32_io_common, AS_IO, 32, pcat_base_state )
232232   AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE8("dma8237_1", i8237_device, i8237_r, i8237_w, 0xffffffff)
233   AM_RANGE(0x0020, 0x003f) AM_DEVREADWRITE8_LEGACY("pic8259_1", pic8259_r, pic8259_w, 0xffffffff)
233   AM_RANGE(0x0020, 0x003f) AM_DEVREADWRITE8("pic8259_1", pic8259_device, read, write, 0xffffffff)
234234   AM_RANGE(0x0040, 0x005f) AM_DEVREADWRITE8_LEGACY("pit8254", pit8253_r, pit8253_w, 0xffffffff)
235235   AM_RANGE(0x0060, 0x006f) AM_DEVREADWRITE8("kbdc", kbdc8042_device, data_r, data_w, 0xffffffff)
236236   AM_RANGE(0x0070, 0x007f) AM_RAM //AM_DEVREADWRITE8("rtc", mc146818_device, read, write, 0xffffffff)
237237   AM_RANGE(0x0080, 0x009f) AM_READWRITE8(dma_page_select_r,dma_page_select_w, 0xffffffff)//TODO
238   AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE8_LEGACY("pic8259_2", pic8259_r, pic8259_w, 0xffffffff)
238   AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE8("pic8259_2", pic8259_device, read, write, 0xffffffff)
239239   AM_RANGE(0x00c0, 0x00df) AM_DEVREADWRITE8("dma8237_2", i8237_device, i8237_r, i8237_w, 0xffff)
240240ADDRESS_MAP_END
241241

Previous 199869 Revisions Next


© 1997-2024 The MAME Team