Previous 199869 Revisions Next

r18258 Wednesday 3rd October, 2012 at 09:27:22 UTC by Miodrag Milanović
Replace some *_DEVICE_HANDLER with _MEMBER calls in MESS section (no whatsnew)
[src/mess/drivers]ace.c adam.c amstrad.c apple2.c apple2gs.c bbc.c bullet.c bw12.c cgenie.c coleco.c einstein.c enterp.c fm7.c fmtowns.c huebler.c kaypro.c kyocera.c m5.c msx.c mtx.c nascom1.c nc.c nes.c ob68k1a.c osi.c pc.c pce.c pcw.c pcw16.c pes.c pet.c pokemini.c portfoli.c ql.c rmnimbus.c samcoupe.c sg1000.c sms.c ssystem3.c super6.c svi318.c tandy2k.c tsispch.c v1050.c victor9k.c x1.c x68k.c xerox820.c xor100.c z80ne.c
[src/mess/includes]a7800.h ac1.h ace.h adam.h amstrad.h apple1.h apple2.h apple2gs.h apple3.h b2m.h bbc.h bebox.h bullet.h bw12.h c64_legacy.h c65.h cgenie.h coleco.h concept.h dgn_beta.h einstein.h enterp.h fm7.h fmtowns.h huebler.h irisha.h kaypro.h kramermc.h kyocera.h lisa.h lviv.h m5.h mac.h macpci.h mc80.h microtan.h msx.h mtx.h mz700.h nascom1.h nc.h nes.h ob68k1a.h oric.h orion.h osi.h partner.h pc.h pce.h pcw.h pcw16.h pecom.h pes.h pet.h pk8020.h pmd85.h pokemini.h poly88.h portfoli.h pp01.h ql.h radio86.h rmnimbus.h samcoupe.h sg1000.h sms.h ssystem3.h super6.h super80.h svi318.h sym1.h tandy2k.h trs80.h tsispch.h v1050.h victor9k.h x1.h x68k.h xerox820.h xor100.h z80ne.h
[src/mess/machine]a7800.c ac1.c amstrad.c apple1.c apple3.c b2m.c bbc.c bebox.c c64.c c65.c cgenie.c concept.c dgn_beta.c irisha.c kaypro.c kramermc.c lisa.c lviv.c mac.c macpci.c mc80.c microtan.c msx.c mtx.c mz700.c nascom1.c oric.c orion.c partner.c pc.c pecom.c pet.c pk8020.c pmd85.c pokemini.c poly88.c pp01.c radio86.c rmnimbus.c samcoupe.c sms.c super80.c svi318.c sym1.c trs80.c z80ne.c
[src/mess/video]bbc.c dgn_beta.c pecom.c pet.c

trunk/src/mess/machine/microtan.c
r18257r18258
161161/**************************************************************
162162 * VIA callback functions for VIA #0
163163 **************************************************************/
164static READ8_DEVICE_HANDLER (via_0_in_a )
164READ8_MEMBER(microtan_state::via_0_in_a)
165165{
166    int data = space.machine().root_device().ioport("JOY")->read();
166    int data = machine().root_device().ioport("JOY")->read();
167167    LOG(("microtan_via_0_in_a %02X\n", data));
168168    return data;
169169}
170170
171static READ8_DEVICE_HANDLER ( via_0_in_b )
171READ8_MEMBER(microtan_state::via_0_in_b)
172172{
173173    int data = 0xff;
174174    LOG(("microtan_via_0_in_b %02X\n", data));
175175    return data;
176176}
177177
178static READ8_DEVICE_HANDLER ( via_0_in_ca1 )
178READ8_MEMBER(microtan_state::via_0_in_ca1)
179179{
180180    int data = 1;
181181    LOG(("microtan_via_0_in_ca1 %d\n", data));
182182    return data;
183183}
184184
185static READ8_DEVICE_HANDLER ( via_0_in_cb1 )
185READ8_MEMBER(microtan_state::via_0_in_cb1)
186186{
187187    int data = 1;
188188    LOG(("microtan_via_0_in_cb1 %d\n", data));
189189    return data;
190190}
191191
192static READ8_DEVICE_HANDLER ( via_0_in_ca2 )
192READ8_MEMBER(microtan_state::via_0_in_ca2)
193193{
194194    int data = 1;
195195    LOG(("microtan_via_0_in_ca2 %d\n", data));
196196    return data;
197197}
198198
199static READ8_DEVICE_HANDLER ( via_0_in_cb2 )
199READ8_MEMBER(microtan_state::via_0_in_cb2)
200200{
201201    int data = 1;
202202    LOG(("microtan_via_0_in_cb2 %d\n", data));
203203    return data;
204204}
205205
206static WRITE8_DEVICE_HANDLER ( via_0_out_a )
206WRITE8_MEMBER(microtan_state::via_0_out_a)
207207{
208208    LOG(("microtan_via_0_out_a %02X\n", data));
209209}
210210
211static WRITE8_DEVICE_HANDLER (via_0_out_b )
211WRITE8_MEMBER(microtan_state::via_0_out_b)
212212{
213213    LOG(("microtan_via_0_out_b %02X\n", data));
214214    /* bit #7 is the cassette output signal */
215    cassette_device_image(space.machine())->output(data & 0x80 ? +1.0 : -1.0);
215    cassette_device_image(machine())->output(data & 0x80 ? +1.0 : -1.0);
216216}
217217
218static WRITE8_DEVICE_HANDLER ( via_0_out_ca2 )
218WRITE8_MEMBER(microtan_state::via_0_out_ca2)
219219{
220220    LOG(("microtan_via_0_out_ca2 %d\n", data));
221221}
222222
223static WRITE8_DEVICE_HANDLER (via_0_out_cb2 )
223WRITE8_MEMBER(microtan_state::via_0_out_cb2)
224224{
225225    LOG(("microtan_via_0_out_cb2 %d\n", data));
226226}
r18257r18258
236236/**************************************************************
237237 * VIA callback functions for VIA #1
238238 **************************************************************/
239static READ8_DEVICE_HANDLER ( via_1_in_a )
239READ8_MEMBER(microtan_state::via_1_in_a)
240240{
241241    int data = 0xff;
242242    LOG(("microtan_via_1_in_a %02X\n", data));
243243    return data;
244244}
245245
246static READ8_DEVICE_HANDLER ( via_1_in_b )
246READ8_MEMBER(microtan_state::via_1_in_b)
247247{
248248    int data = 0xff;
249249    LOG(("microtan_via_1_in_b %02X\n", data));
250250    return data;
251251}
252252
253static READ8_DEVICE_HANDLER ( via_1_in_ca1 )
253READ8_MEMBER(microtan_state::via_1_in_ca1)
254254{
255255    int data = 1;
256256    LOG(("microtan_via_1_in_ca1 %d\n", data));
257257    return data;
258258}
259259
260static READ8_DEVICE_HANDLER ( via_1_in_cb1 )
260READ8_MEMBER(microtan_state::via_1_in_cb1)
261261{
262262    int data = 1;
263263    LOG(("microtan_via_1_in_cb1 %d\n", data));
264264    return data;
265265}
266266
267static READ8_DEVICE_HANDLER ( via_1_in_ca2 )
267READ8_MEMBER(microtan_state::via_1_in_ca2)
268268{
269269    int data = 1;
270270    LOG(("microtan_via_1_in_ca2 %d\n", data));
271271    return data;
272272}
273273
274static READ8_DEVICE_HANDLER ( via_1_in_cb2 )
274READ8_MEMBER(microtan_state::via_1_in_cb2)
275275{
276276    int data = 1;
277277    LOG(("microtan_via_1_in_cb2 %d\n", data));
278278    return data;
279279}
280280
281static WRITE8_DEVICE_HANDLER ( via_1_out_a )
281WRITE8_MEMBER(microtan_state::via_1_out_a)
282282{
283283    LOG(("microtan_via_1_out_a %02X\n", data));
284284}
285285
286static WRITE8_DEVICE_HANDLER ( via_1_out_b )
286WRITE8_MEMBER(microtan_state::via_1_out_b)
287287{
288288    LOG(("microtan_via_1_out_b %02X\n", data));
289289}
290290
291static WRITE8_DEVICE_HANDLER (via_1_out_ca2 )
291WRITE8_MEMBER(microtan_state::via_1_out_ca2)
292292{
293293    LOG(("microtan_via_1_out_ca2 %d\n", data));
294294}
295295
296static WRITE8_DEVICE_HANDLER ( via_1_out_cb2 )
296WRITE8_MEMBER(microtan_state::via_1_out_cb2)
297297{
298298    LOG(("microtan_via_1_out_cb2 %d\n", data));
299299}
r18257r18258
312312const via6522_interface microtan_via6522_0 =
313313{
314314   /* VIA#1 at bfc0-bfcf*/
315   DEVCB_HANDLER(via_0_in_a),   DEVCB_HANDLER(via_0_in_b),
316   DEVCB_HANDLER(via_0_in_ca1), DEVCB_HANDLER(via_0_in_cb1),
317   DEVCB_HANDLER(via_0_in_ca2), DEVCB_HANDLER(via_0_in_cb2),
318   DEVCB_HANDLER(via_0_out_a),  DEVCB_HANDLER(via_0_out_b),
315   DEVCB_DRIVER_MEMBER(microtan_state,via_0_in_a),   DEVCB_DRIVER_MEMBER(microtan_state,via_0_in_b),
316   DEVCB_DRIVER_MEMBER(microtan_state,via_0_in_ca1), DEVCB_DRIVER_MEMBER(microtan_state,via_0_in_cb1),
317   DEVCB_DRIVER_MEMBER(microtan_state,via_0_in_ca2), DEVCB_DRIVER_MEMBER(microtan_state,via_0_in_cb2),
318   DEVCB_DRIVER_MEMBER(microtan_state,via_0_out_a),  DEVCB_DRIVER_MEMBER(microtan_state,via_0_out_b),
319319   DEVCB_NULL, DEVCB_NULL,
320   DEVCB_HANDLER(via_0_out_ca2),DEVCB_HANDLER(via_0_out_cb2),
320   DEVCB_DRIVER_MEMBER(microtan_state,via_0_out_ca2),DEVCB_DRIVER_MEMBER(microtan_state,via_0_out_cb2),
321321   DEVCB_LINE(via_0_irq)
322322};
323323
324324const via6522_interface microtan_via6522_1 =
325325{
326326   /* VIA#1 at bfe0-bfef*/
327   DEVCB_HANDLER(via_1_in_a),   DEVCB_HANDLER(via_1_in_b),
328   DEVCB_HANDLER(via_1_in_ca1), DEVCB_HANDLER(via_1_in_cb1),
329   DEVCB_HANDLER(via_1_in_ca2), DEVCB_HANDLER(via_1_in_cb2),
330   DEVCB_HANDLER(via_1_out_a),  DEVCB_HANDLER(via_1_out_b),
327   DEVCB_DRIVER_MEMBER(microtan_state,via_1_in_a),   DEVCB_DRIVER_MEMBER(microtan_state,via_1_in_b),
328   DEVCB_DRIVER_MEMBER(microtan_state,via_1_in_ca1), DEVCB_DRIVER_MEMBER(microtan_state,via_1_in_cb1),
329   DEVCB_DRIVER_MEMBER(microtan_state,via_1_in_ca2), DEVCB_DRIVER_MEMBER(microtan_state,via_1_in_cb2),
330   DEVCB_DRIVER_MEMBER(microtan_state,via_1_out_a),  DEVCB_DRIVER_MEMBER(microtan_state,via_1_out_b),
331331   DEVCB_NULL, DEVCB_NULL,
332   DEVCB_HANDLER(via_1_out_ca2),DEVCB_HANDLER(via_1_out_cb2),
332   DEVCB_DRIVER_MEMBER(microtan_state,via_1_out_ca2),DEVCB_DRIVER_MEMBER(microtan_state,via_1_out_cb2),
333333   DEVCB_LINE(via_1_irq)
334334};
335335
trunk/src/mess/machine/pmd85.c
r18257r18258
238238
239239*******************************************************************************/
240240
241static  READ8_DEVICE_HANDLER ( pmd85_ppi_0_porta_r )
241READ8_MEMBER(pmd85_state::pmd85_ppi_0_porta_r)
242242{
243243   return 0xff;
244244}
245245
246static  READ8_DEVICE_HANDLER ( pmd85_ppi_0_portb_r )
246READ8_MEMBER(pmd85_state::pmd85_ppi_0_portb_r)
247247{
248   pmd85_state *state = device->machine().driver_data<pmd85_state>();
249248   static const char *const keynames[] = {
250249      "KEY0", "KEY1", "KEY2", "KEY3", "KEY4", "KEY5", "KEY6", "KEY7",
251250      "KEY8", "KEY9", "KEY10", "KEY11", "KEY12", "KEY13", "KEY14", "KEY15"
252251   };
253252
254   return device->machine().root_device().ioport(keynames[(state->m_ppi_port_outputs[0][0] & 0x0f)])->read() & device->machine().root_device().ioport("KEY15")->read();
253   return machine().root_device().ioport(keynames[(m_ppi_port_outputs[0][0] & 0x0f)])->read() & machine().root_device().ioport("KEY15")->read();
255254}
256255
257static  READ8_DEVICE_HANDLER ( pmd85_ppi_0_portc_r )
256READ8_MEMBER(pmd85_state::pmd85_ppi_0_portc_r)
258257{
259258   return 0xff;
260259}
261260
262static WRITE8_DEVICE_HANDLER ( pmd85_ppi_0_porta_w )
261WRITE8_MEMBER(pmd85_state::pmd85_ppi_0_porta_w)
263262{
264   pmd85_state *state = space.machine().driver_data<pmd85_state>();
265   state->m_ppi_port_outputs[0][0] = data;
263   m_ppi_port_outputs[0][0] = data;
266264}
267265
268static WRITE8_DEVICE_HANDLER ( pmd85_ppi_0_portb_w )
266WRITE8_MEMBER(pmd85_state::pmd85_ppi_0_portb_w)
269267{
270   pmd85_state *state = space.machine().driver_data<pmd85_state>();
271   state->m_ppi_port_outputs[0][1] = data;
268   m_ppi_port_outputs[0][1] = data;
272269}
273270
274static WRITE8_DEVICE_HANDLER ( pmd85_ppi_0_portc_w )
271WRITE8_MEMBER(pmd85_state::pmd85_ppi_0_portc_w)
275272{
276   pmd85_state *state = space.machine().driver_data<pmd85_state>();
277   state->m_ppi_port_outputs[0][2] = data;
278   set_led_status(space.machine(), PMD85_LED_2, (data & 0x08) ? 1 : 0);
279   set_led_status(space.machine(), PMD85_LED_3, (data & 0x04) ? 1 : 0);
273   m_ppi_port_outputs[0][2] = data;
274   set_led_status(machine(), PMD85_LED_2, (data & 0x08) ? 1 : 0);
275   set_led_status(machine(), PMD85_LED_3, (data & 0x04) ? 1 : 0);
280276}
281277
282278/*******************************************************************************
r18257r18258
287283
288284*******************************************************************************/
289285
290static  READ8_DEVICE_HANDLER ( mato_ppi_0_portb_r )
286READ8_MEMBER(pmd85_state::mato_ppi_0_portb_r)
291287{
292   pmd85_state *state = device->machine().driver_data<pmd85_state>();
293288   int i;
294289   UINT8 data = 0xff;
295290   static const char *const keynames[] = { "KEY0", "KEY1", "KEY2", "KEY3", "KEY4", "KEY5", "KEY6", "KEY7" };
296291
297292   for (i = 0; i < 8; i++)
298293   {
299      if (!BIT(state->m_ppi_port_outputs[0][0], i))
300         data &= device->machine().root_device().ioport(keynames[i])->read();
294      if (!BIT(m_ppi_port_outputs[0][0], i))
295         data &= machine().root_device().ioport(keynames[i])->read();
301296   }
302297   return data;
303298}
304299
305static  READ8_DEVICE_HANDLER ( mato_ppi_0_portc_r )
300READ8_MEMBER(pmd85_state::mato_ppi_0_portc_r)
306301{
307   return device->machine().root_device().ioport("KEY8")->read() | 0x8f;
302   return machine().root_device().ioport("KEY8")->read() | 0x8f;
308303}
309304
310static WRITE8_DEVICE_HANDLER ( mato_ppi_0_portc_w )
305WRITE8_MEMBER(pmd85_state::mato_ppi_0_portc_w)
311306{
312   pmd85_state *state = space.machine().driver_data<pmd85_state>();
313   state->m_ppi_port_outputs[0][2] = data;
314   set_led_status(space.machine(), PMD85_LED_2, BIT(data, 3));
315   set_led_status(space.machine(), PMD85_LED_3, BIT(data, 2));
307   m_ppi_port_outputs[0][2] = data;
308   set_led_status(machine(), PMD85_LED_2, BIT(data, 3));
309   set_led_status(machine(), PMD85_LED_3, BIT(data, 2));
316310}
317311
318312/*******************************************************************************
r18257r18258
323317
324318*******************************************************************************/
325319
326static READ8_DEVICE_HANDLER ( pmd85_ppi_1_porta_r )
320READ8_MEMBER(pmd85_state::pmd85_ppi_1_porta_r)
327321{
328322   return 0xff;
329323}
330324
331static READ8_DEVICE_HANDLER ( pmd85_ppi_1_portb_r )
325READ8_MEMBER(pmd85_state::pmd85_ppi_1_portb_r)
332326{
333327   return 0xff;
334328}
335329
336static READ8_DEVICE_HANDLER ( pmd85_ppi_1_portc_r )
330READ8_MEMBER(pmd85_state::pmd85_ppi_1_portc_r)
337331{
338332   return 0xff;
339333}
340334
341static WRITE8_DEVICE_HANDLER ( pmd85_ppi_1_porta_w )
335WRITE8_MEMBER(pmd85_state::pmd85_ppi_1_porta_w)
342336{
343   pmd85_state *state = space.machine().driver_data<pmd85_state>();
344   state->m_ppi_port_outputs[1][0] = data;
337   m_ppi_port_outputs[1][0] = data;
345338}
346339
347static WRITE8_DEVICE_HANDLER ( pmd85_ppi_1_portb_w )
340WRITE8_MEMBER(pmd85_state::pmd85_ppi_1_portb_w)
348341{
349   pmd85_state *state = space.machine().driver_data<pmd85_state>();
350   state->m_ppi_port_outputs[1][1] = data;
342   m_ppi_port_outputs[1][1] = data;
351343}
352344
353static WRITE8_DEVICE_HANDLER ( pmd85_ppi_1_portc_w )
345WRITE8_MEMBER(pmd85_state::pmd85_ppi_1_portc_w)
354346{
355   pmd85_state *state = space.machine().driver_data<pmd85_state>();
356   state->m_ppi_port_outputs[1][2] = data;
347   m_ppi_port_outputs[1][2] = data;
357348}
358349
359350/*******************************************************************************
r18257r18258
368359
369360*******************************************************************************/
370361
371static READ8_DEVICE_HANDLER ( pmd85_ppi_2_porta_r )
362READ8_MEMBER(pmd85_state::pmd85_ppi_2_porta_r)
372363{
373364   return 0xff;
374365}
375366
376static READ8_DEVICE_HANDLER ( pmd85_ppi_2_portb_r )
367READ8_MEMBER(pmd85_state::pmd85_ppi_2_portb_r)
377368{
378369   return 0xff;
379370}
380371
381static READ8_DEVICE_HANDLER ( pmd85_ppi_2_portc_r )
372READ8_MEMBER(pmd85_state::pmd85_ppi_2_portc_r)
382373{
383374   return 0xff;
384375}
385376
386static WRITE8_DEVICE_HANDLER ( pmd85_ppi_2_porta_w )
377WRITE8_MEMBER(pmd85_state::pmd85_ppi_2_porta_w)
387378{
388   pmd85_state *state = space.machine().driver_data<pmd85_state>();
389   state->m_ppi_port_outputs[2][0] = data;
379   m_ppi_port_outputs[2][0] = data;
390380}
391381
392static WRITE8_DEVICE_HANDLER ( pmd85_ppi_2_portb_w )
382WRITE8_MEMBER(pmd85_state::pmd85_ppi_2_portb_w)
393383{
394   pmd85_state *state = space.machine().driver_data<pmd85_state>();
395   state->m_ppi_port_outputs[2][1] = data;
384   m_ppi_port_outputs[2][1] = data;
396385}
397386
398static WRITE8_DEVICE_HANDLER ( pmd85_ppi_2_portc_w )
387WRITE8_MEMBER(pmd85_state::pmd85_ppi_2_portc_w)
399388{
400   pmd85_state *state = space.machine().driver_data<pmd85_state>();
401   state->m_ppi_port_outputs[2][2] = data;
389   m_ppi_port_outputs[2][2] = data;
402390}
403391
404392/*******************************************************************************
r18257r18258
456444
457445*******************************************************************************/
458446
459static READ8_DEVICE_HANDLER ( pmd85_ppi_3_porta_r )
447READ8_MEMBER(pmd85_state::pmd85_ppi_3_porta_r)
460448{
461   pmd85_state *state = space.machine().driver_data<pmd85_state>();
462   if (state->memregion("user1")->base() != NULL)
463      return state->memregion("user1")->base()[state->m_ppi_port_outputs[3][1] | (state->m_ppi_port_outputs[3][2] << 8)];
449   if (memregion("user1")->base() != NULL)
450      return memregion("user1")->base()[m_ppi_port_outputs[3][1] | (m_ppi_port_outputs[3][2] << 8)];
464451   else
465452      return 0;
466453}
467454
468static READ8_DEVICE_HANDLER ( pmd85_ppi_3_portb_r )
455READ8_MEMBER(pmd85_state::pmd85_ppi_3_portb_r)
469456{
470457   return 0xff;
471458}
472459
473static READ8_DEVICE_HANDLER ( pmd85_ppi_3_portc_r )
460READ8_MEMBER(pmd85_state::pmd85_ppi_3_portc_r)
474461{
475462   return 0xff;
476463}
477464
478static WRITE8_DEVICE_HANDLER ( pmd85_ppi_3_porta_w )
465WRITE8_MEMBER(pmd85_state::pmd85_ppi_3_porta_w)
479466{
480   pmd85_state *state = space.machine().driver_data<pmd85_state>();
481   state->m_ppi_port_outputs[3][0] = data;
467   m_ppi_port_outputs[3][0] = data;
482468}
483469
484static WRITE8_DEVICE_HANDLER ( pmd85_ppi_3_portb_w )
470WRITE8_MEMBER(pmd85_state::pmd85_ppi_3_portb_w)
485471{
486   pmd85_state *state = space.machine().driver_data<pmd85_state>();
487   state->m_ppi_port_outputs[3][1] = data;
472   m_ppi_port_outputs[3][1] = data;
488473}
489474
490static WRITE8_DEVICE_HANDLER ( pmd85_ppi_3_portc_w )
475WRITE8_MEMBER(pmd85_state::pmd85_ppi_3_portc_w)
491476{
492   pmd85_state *state = space.machine().driver_data<pmd85_state>();
493   state->m_ppi_port_outputs[3][2] = data;
477   m_ppi_port_outputs[3][2] = data;
494478}
495479
496480/*******************************************************************************
r18257r18258
715699const i8255_interface pmd85_ppi8255_interface[4] =
716700{
717701   {
718      DEVCB_HANDLER(pmd85_ppi_0_porta_r),
719      DEVCB_HANDLER(pmd85_ppi_0_porta_w),
720      DEVCB_HANDLER(pmd85_ppi_0_portb_r),
721      DEVCB_HANDLER(pmd85_ppi_0_portb_w),
722      DEVCB_HANDLER(pmd85_ppi_0_portc_r),
723      DEVCB_HANDLER(pmd85_ppi_0_portc_w)
702      DEVCB_DRIVER_MEMBER(pmd85_state,pmd85_ppi_0_porta_r),
703      DEVCB_DRIVER_MEMBER(pmd85_state,pmd85_ppi_0_porta_w),
704      DEVCB_DRIVER_MEMBER(pmd85_state,pmd85_ppi_0_portb_r),
705      DEVCB_DRIVER_MEMBER(pmd85_state,pmd85_ppi_0_portb_w),
706      DEVCB_DRIVER_MEMBER(pmd85_state,pmd85_ppi_0_portc_r),
707      DEVCB_DRIVER_MEMBER(pmd85_state,pmd85_ppi_0_portc_w)
724708   },
725709   {
726      DEVCB_HANDLER(pmd85_ppi_1_porta_r),
727      DEVCB_HANDLER(pmd85_ppi_1_porta_w),
728      DEVCB_HANDLER(pmd85_ppi_1_portb_r),
729      DEVCB_HANDLER(pmd85_ppi_1_portb_w),
730      DEVCB_HANDLER(pmd85_ppi_1_portc_r),
731      DEVCB_HANDLER(pmd85_ppi_1_portc_w)
710      DEVCB_DRIVER_MEMBER(pmd85_state,pmd85_ppi_1_porta_r),
711      DEVCB_DRIVER_MEMBER(pmd85_state,pmd85_ppi_1_porta_w),
712      DEVCB_DRIVER_MEMBER(pmd85_state,pmd85_ppi_1_portb_r),
713      DEVCB_DRIVER_MEMBER(pmd85_state,pmd85_ppi_1_portb_w),
714      DEVCB_DRIVER_MEMBER(pmd85_state,pmd85_ppi_1_portc_r),
715      DEVCB_DRIVER_MEMBER(pmd85_state,pmd85_ppi_1_portc_w)
732716   },
733717   {
734      DEVCB_HANDLER(pmd85_ppi_2_porta_r),
735      DEVCB_HANDLER(pmd85_ppi_2_porta_w),
736      DEVCB_HANDLER(pmd85_ppi_2_portb_r),
737      DEVCB_HANDLER(pmd85_ppi_2_portb_w),
738      DEVCB_HANDLER(pmd85_ppi_2_portc_r),
739      DEVCB_HANDLER(pmd85_ppi_2_portc_w)
718      DEVCB_DRIVER_MEMBER(pmd85_state,pmd85_ppi_2_porta_r),
719      DEVCB_DRIVER_MEMBER(pmd85_state,pmd85_ppi_2_porta_w),
720      DEVCB_DRIVER_MEMBER(pmd85_state,pmd85_ppi_2_portb_r),
721      DEVCB_DRIVER_MEMBER(pmd85_state,pmd85_ppi_2_portb_w),
722      DEVCB_DRIVER_MEMBER(pmd85_state,pmd85_ppi_2_portc_r),
723      DEVCB_DRIVER_MEMBER(pmd85_state,pmd85_ppi_2_portc_w)
740724   },
741725   {
742      DEVCB_HANDLER(pmd85_ppi_3_porta_r),
743      DEVCB_HANDLER(pmd85_ppi_3_porta_w),
744      DEVCB_HANDLER(pmd85_ppi_3_portb_r),
745      DEVCB_HANDLER(pmd85_ppi_3_portb_w),
746      DEVCB_HANDLER(pmd85_ppi_3_portc_r),
747      DEVCB_HANDLER(pmd85_ppi_3_portc_w)
726      DEVCB_DRIVER_MEMBER(pmd85_state,pmd85_ppi_3_porta_r),
727      DEVCB_DRIVER_MEMBER(pmd85_state,pmd85_ppi_3_porta_w),
728      DEVCB_DRIVER_MEMBER(pmd85_state,pmd85_ppi_3_portb_r),
729      DEVCB_DRIVER_MEMBER(pmd85_state,pmd85_ppi_3_portb_w),
730      DEVCB_DRIVER_MEMBER(pmd85_state,pmd85_ppi_3_portc_r),
731      DEVCB_DRIVER_MEMBER(pmd85_state,pmd85_ppi_3_portc_w)
748732   }
749733};
750734
751735const i8255_interface alfa_ppi8255_interface[3] =
752736{
753737   {
754      DEVCB_HANDLER(pmd85_ppi_0_porta_r),
755      DEVCB_HANDLER(pmd85_ppi_0_porta_w),
756      DEVCB_HANDLER(pmd85_ppi_0_portb_r),
757      DEVCB_HANDLER(pmd85_ppi_0_portb_w),
758      DEVCB_HANDLER(pmd85_ppi_0_portc_r),
759      DEVCB_HANDLER(pmd85_ppi_0_portc_w)
738      DEVCB_DRIVER_MEMBER(pmd85_state,pmd85_ppi_0_porta_r),
739      DEVCB_DRIVER_MEMBER(pmd85_state,pmd85_ppi_0_porta_w),
740      DEVCB_DRIVER_MEMBER(pmd85_state,pmd85_ppi_0_portb_r),
741      DEVCB_DRIVER_MEMBER(pmd85_state,pmd85_ppi_0_portb_w),
742      DEVCB_DRIVER_MEMBER(pmd85_state,pmd85_ppi_0_portc_r),
743      DEVCB_DRIVER_MEMBER(pmd85_state,pmd85_ppi_0_portc_w)
760744   },
761745   {
762      DEVCB_HANDLER(pmd85_ppi_1_porta_r),
763      DEVCB_HANDLER(pmd85_ppi_1_porta_w),
764      DEVCB_HANDLER(pmd85_ppi_1_portb_r),
765      DEVCB_HANDLER(pmd85_ppi_1_portb_w),
766      DEVCB_HANDLER(pmd85_ppi_1_portc_r),
767      DEVCB_HANDLER(pmd85_ppi_1_portc_w)
746      DEVCB_DRIVER_MEMBER(pmd85_state,pmd85_ppi_1_porta_r),
747      DEVCB_DRIVER_MEMBER(pmd85_state,pmd85_ppi_1_porta_w),
748      DEVCB_DRIVER_MEMBER(pmd85_state,pmd85_ppi_1_portb_r),
749      DEVCB_DRIVER_MEMBER(pmd85_state,pmd85_ppi_1_portb_w),
750      DEVCB_DRIVER_MEMBER(pmd85_state,pmd85_ppi_1_portc_r),
751      DEVCB_DRIVER_MEMBER(pmd85_state,pmd85_ppi_1_portc_w)
768752   },
769753   {
770      DEVCB_HANDLER(pmd85_ppi_2_porta_r),
771      DEVCB_HANDLER(pmd85_ppi_2_porta_w),
772      DEVCB_HANDLER(pmd85_ppi_2_portb_r),
773      DEVCB_HANDLER(pmd85_ppi_2_portb_w),
774      DEVCB_HANDLER(pmd85_ppi_2_portc_r),
775      DEVCB_HANDLER(pmd85_ppi_2_portc_w)
754      DEVCB_DRIVER_MEMBER(pmd85_state,pmd85_ppi_2_porta_r),
755      DEVCB_DRIVER_MEMBER(pmd85_state,pmd85_ppi_2_porta_w),
756      DEVCB_DRIVER_MEMBER(pmd85_state,pmd85_ppi_2_portb_r),
757      DEVCB_DRIVER_MEMBER(pmd85_state,pmd85_ppi_2_portb_w),
758      DEVCB_DRIVER_MEMBER(pmd85_state,pmd85_ppi_2_portc_r),
759      DEVCB_DRIVER_MEMBER(pmd85_state,pmd85_ppi_2_portc_w)
776760   }
777761};
778762
779763I8255_INTERFACE( mato_ppi8255_interface )
780764{
781   DEVCB_HANDLER(pmd85_ppi_0_porta_r),
782   DEVCB_HANDLER(pmd85_ppi_0_porta_w),
783   DEVCB_HANDLER(mato_ppi_0_portb_r),
784   DEVCB_HANDLER(pmd85_ppi_0_portb_w),
785   DEVCB_HANDLER(mato_ppi_0_portc_r),
786   DEVCB_HANDLER(mato_ppi_0_portc_w)
765   DEVCB_DRIVER_MEMBER(pmd85_state,pmd85_ppi_0_porta_r),
766   DEVCB_DRIVER_MEMBER(pmd85_state,pmd85_ppi_0_porta_w),
767   DEVCB_DRIVER_MEMBER(pmd85_state,mato_ppi_0_portb_r),
768   DEVCB_DRIVER_MEMBER(pmd85_state,pmd85_ppi_0_portb_w),
769   DEVCB_DRIVER_MEMBER(pmd85_state,mato_ppi_0_portc_r),
770   DEVCB_DRIVER_MEMBER(pmd85_state,mato_ppi_0_portc_w)
787771};
788772
789773
trunk/src/mess/machine/nascom1.c
r18257r18258
3939 *
4040 *************************************/
4141
42static WRITE_LINE_DEVICE_HANDLER( nascom2_fdc_intrq_w )
42WRITE_LINE_MEMBER(nascom1_state::nascom2_fdc_intrq_w)
4343{
44   nascom1_state *drvstate = device->machine().driver_data<nascom1_state>();
45   drvstate->m_nascom2_fdc.irq = state;
44   m_nascom2_fdc.irq = state;
4645}
4746
48static WRITE_LINE_DEVICE_HANDLER( nascom2_fdc_drq_w )
47WRITE_LINE_MEMBER(nascom1_state::nascom2_fdc_drq_w)
4948{
50   nascom1_state *drvstate = device->machine().driver_data<nascom1_state>();
51   drvstate->m_nascom2_fdc.drq = state;
49   m_nascom2_fdc.drq = state;
5250}
5351
5452const wd17xx_interface nascom2_wd17xx_interface =
5553{
5654   DEVCB_LINE_VCC,
57   DEVCB_LINE(nascom2_fdc_intrq_w),
58   DEVCB_LINE(nascom2_fdc_drq_w),
55   DEVCB_DRIVER_LINE_MEMBER(nascom1_state,nascom2_fdc_intrq_w),
56   DEVCB_DRIVER_LINE_MEMBER(nascom1_state,nascom2_fdc_drq_w),
5957   {FLOPPY_0, FLOPPY_1, FLOPPY_2, FLOPPY_3}
6058};
6159
r18257r18258
170168}
171169
172170
173READ8_DEVICE_HANDLER( nascom1_hd6402_si )
171READ8_MEMBER(nascom1_state::nascom1_hd6402_si)
174172{
175173   return 1;
176174}
177175
178176
179WRITE8_DEVICE_HANDLER( nascom1_hd6402_so )
177WRITE8_MEMBER(nascom1_state::nascom1_hd6402_so)
180178{
181179}
182180
trunk/src/mess/machine/samcoupe.c
r18257r18258
158158    REAL TIME CLOCK
159159***************************************************************************/
160160
161static READ8_DEVICE_HANDLER( samcoupe_rtc_r )
161READ8_MEMBER(samcoupe_state::samcoupe_rtc_r)
162162{
163   address_space &spaceio = space.machine().device("maincpu")->memory().space(AS_IO);
164   msm6242_device *rtc = dynamic_cast<msm6242_device*>(device);
163   address_space &spaceio = machine().device("maincpu")->memory().space(AS_IO);
164   msm6242_device *rtc = dynamic_cast<msm6242_device*>(machine().device("sambus_clock"));
165165   return rtc->read(spaceio,offset >> 12);
166166}
167167
168168
169static WRITE8_DEVICE_HANDLER( samcoupe_rtc_w )
169WRITE8_MEMBER(samcoupe_state::samcoupe_rtc_w)
170170{
171   address_space &spaceio = space.machine().device("maincpu")->memory().space(AS_IO);
172   msm6242_device *rtc = dynamic_cast<msm6242_device*>(device);
171   address_space &spaceio = machine().device("maincpu")->memory().space(AS_IO);
172   msm6242_device *rtc = dynamic_cast<msm6242_device*>(machine().device("sambus_clock"));
173173   rtc->write(spaceio,offset >> 12, data);
174174}
175175
r18257r18258
261261   if (machine().root_device().ioport("config")->read() & 0x01)
262262   {
263263      /* install RTC */
264      device_t *rtc = machine().device("sambus_clock");
265      spaceio.install_legacy_readwrite_handler(*rtc, 0xef, 0xef, 0xffff, 0xff00, FUNC(samcoupe_rtc_r), FUNC(samcoupe_rtc_w));
264      spaceio.install_readwrite_handler(0xef, 0xef, 0xffff, 0xff00, read8_delegate(FUNC(samcoupe_state::samcoupe_rtc_r),this), write8_delegate(FUNC(samcoupe_state::samcoupe_rtc_w),this));
266265   }
267266   else
268267   {
trunk/src/mess/machine/irisha.c
r18257r18258
117117   DEVCB_DRIVER_MEMBER(irisha_state, irisha_8255_portc_w),
118118};
119119
120static WRITE_LINE_DEVICE_HANDLER( irisha_pic_set_int_line )
120WRITE_LINE_MEMBER(irisha_state::irisha_pic_set_int_line)
121121{
122   device->machine().device("maincpu")->execute().set_input_line(0, state ? HOLD_LINE : CLEAR_LINE);
122   machine().device("maincpu")->execute().set_input_line(0, state ? HOLD_LINE : CLEAR_LINE);
123123}
124124
125125const struct pic8259_interface irisha_pic8259_config =
126126{
127   DEVCB_LINE(irisha_pic_set_int_line),
127   DEVCB_DRIVER_LINE_MEMBER(irisha_state,irisha_pic_set_int_line),
128128   DEVCB_LINE_VCC,
129129   DEVCB_NULL
130130};
trunk/src/mess/machine/orion.c
r18257r18258
2727
2828
2929
30static READ8_DEVICE_HANDLER (orion_romdisk_porta_r )
30READ8_MEMBER(orion_state::orion_romdisk_porta_r)
3131{
32   orion_state *state = space.machine().driver_data<orion_state>();
33   UINT8 *romdisk = state->memregion("maincpu")->base() + 0x10000;
34   return romdisk[state->m_romdisk_msb*256+state->m_romdisk_lsb];
32   UINT8 *romdisk = memregion("maincpu")->base() + 0x10000;
33   return romdisk[m_romdisk_msb*256+m_romdisk_lsb];
3534}
3635
37static WRITE8_DEVICE_HANDLER (orion_romdisk_portb_w )
36WRITE8_MEMBER(orion_state::orion_romdisk_portb_w)
3837{
39   orion_state *state = space.machine().driver_data<orion_state>();
40   state->m_romdisk_lsb = data;
38   m_romdisk_lsb = data;
4139}
4240
43static WRITE8_DEVICE_HANDLER (orion_romdisk_portc_w )
41WRITE8_MEMBER(orion_state::orion_romdisk_portc_w)
4442{
45   orion_state *state = space.machine().driver_data<orion_state>();
46   state->m_romdisk_msb = data;
43   m_romdisk_msb = data;
4744}
4845
4946I8255A_INTERFACE( orion128_ppi8255_interface_1)
5047{
51   DEVCB_HANDLER(orion_romdisk_porta_r),
48   DEVCB_DRIVER_MEMBER(orion_state,orion_romdisk_porta_r),
5249   DEVCB_NULL,
5350   DEVCB_NULL,
54   DEVCB_HANDLER(orion_romdisk_portb_w),
51   DEVCB_DRIVER_MEMBER(orion_state,orion_romdisk_portb_w),
5552   DEVCB_NULL,
56   DEVCB_HANDLER(orion_romdisk_portc_w)
53   DEVCB_DRIVER_MEMBER(orion_state,orion_romdisk_portc_w)
5754};
5855
5956
trunk/src/mess/machine/a7800.c
r18257r18258
3838    6532 RIOT
3939***************************************************************************/
4040
41static READ8_DEVICE_HANDLER( riot_joystick_r )
41READ8_MEMBER(a7800_state::riot_joystick_r)
4242{
43   return space.machine().root_device().ioport("joysticks")->read();
43   return machine().root_device().ioport("joysticks")->read();
4444}
4545
46static READ8_DEVICE_HANDLER( riot_console_button_r )
46READ8_MEMBER(a7800_state::riot_console_button_r)
4747{
48   return space.machine().root_device().ioport("console_buttons")->read();
48   return machine().root_device().ioport("console_buttons")->read();
4949}
5050
51static WRITE8_DEVICE_HANDLER( riot_button_pullup_w )
51WRITE8_MEMBER(a7800_state::riot_button_pullup_w)
5252{
53   a7800_state *state = space.machine().driver_data<a7800_state>();
54   state->m_p1_one_button = data & 0x04; // pin 6 of the controller port is held high by the riot chip when reading two-button controllers (from schematic)
55   state->m_p2_one_button = data & 0x10;
53   m_p1_one_button = data & 0x04; // pin 6 of the controller port is held high by the riot chip when reading two-button controllers (from schematic)
54   m_p2_one_button = data & 0x10;
5655}
5756
5857const riot6532_interface a7800_r6532_interface =
5958{
60   DEVCB_HANDLER(riot_joystick_r),
61   DEVCB_HANDLER(riot_console_button_r),
59   DEVCB_DRIVER_MEMBER(a7800_state,riot_joystick_r),
60   DEVCB_DRIVER_MEMBER(a7800_state,riot_console_button_r),
6261   DEVCB_NULL,
63   DEVCB_HANDLER(riot_button_pullup_w),
62   DEVCB_DRIVER_MEMBER(a7800_state,riot_button_pullup_w),
6463   DEVCB_NULL
6564};
6665
trunk/src/mess/machine/poly88.c
r18257r18258
218218   device.execute().set_input_line(0, HOLD_LINE);
219219}
220220
221static WRITE_LINE_DEVICE_HANDLER( poly88_usart_rxready )
221WRITE_LINE_MEMBER(poly88_state::poly88_usart_rxready)
222222{
223   //poly88_state *drvstate = device->machine().driver_data<poly88_state>();
224   //drvstate->m_int_vector = 0xe7;
225   //device->execute().set_input_line(0, HOLD_LINE);
223   //drvm_int_vector = 0xe7;
224   //execute().set_input_line(0, HOLD_LINE);
226225}
227226
228227const i8251_interface poly88_usart_interface=
r18257r18258
232231   DEVCB_NULL,
233232   DEVCB_NULL,
234233   DEVCB_NULL,
235   DEVCB_LINE(poly88_usart_rxready),
234   DEVCB_DRIVER_LINE_MEMBER(poly88_state,poly88_usart_rxready),
236235   DEVCB_NULL,
237236   DEVCB_NULL,
238237   DEVCB_NULL
trunk/src/mess/machine/svi318.c
r18257r18258
3434
3535/* Serial ports */
3636
37static WRITE_LINE_DEVICE_HANDLER( svi318_ins8250_interrupt )
37WRITE_LINE_MEMBER(svi318_state::svi318_ins8250_interrupt)
3838{
39   svi318_state *drvstate = device->machine().driver_data<svi318_state>();
40   if (drvstate->m_svi.bankLow != SVI_CART)
39   if (m_svi.bankLow != SVI_CART)
4140   {
42      device->machine().device("maincpu")->execute().set_input_line(0, (state ? HOLD_LINE : CLEAR_LINE));
41      machine().device("maincpu")->execute().set_input_line(0, (state ? HOLD_LINE : CLEAR_LINE));
4342   }
4443}
4544#if 0
r18257r18258
5554      DEVCB_NULL,
5655      DEVCB_NULL,
5756      DEVCB_NULL,
58      DEVCB_LINE(svi318_ins8250_interrupt),
57      DEVCB_DRIVER_LINE_MEMBER(svi318_state,svi318_ins8250_interrupt),
5958      DEVCB_NULL,
6059      DEVCB_NULL
6160   },
r18257r18258
6362      DEVCB_NULL,
6463      DEVCB_NULL,
6564      DEVCB_NULL,
66      DEVCB_LINE(svi318_ins8250_interrupt),
65      DEVCB_DRIVER_LINE_MEMBER(svi318_state,svi318_ins8250_interrupt),
6766      DEVCB_NULL,
6867      DEVCB_NULL
6968   }
r18257r18258
144143  8  CASR     Cassette, Read data
145144*/
146145
147static READ8_DEVICE_HANDLER ( svi318_ppi_port_a_r )
146READ8_MEMBER(svi318_state::svi318_ppi_port_a_r)
148147{
149148   int data = 0x0f;
150149
151   if ((space.machine().device<cassette_image_device>(CASSETTE_TAG))->input() > 0.0038)
150   if ((machine().device<cassette_image_device>(CASSETTE_TAG))->input() > 0.0038)
152151      data |= 0x80;
153   if (!svi318_cassette_present(space.machine(), 0))
152   if (!svi318_cassette_present(machine(), 0))
154153      data |= 0x40;
155   data |= space.machine().root_device().ioport("BUTTONS")->read() & 0x30;
154   data |= machine().root_device().ioport("BUTTONS")->read() & 0x30;
156155
157156   return data;
158157}
r18257r18258
170169  8  IN7  Keyboard, Column status of selected line
171170*/
172171
173static READ8_DEVICE_HANDLER ( svi318_ppi_port_b_r )
172READ8_MEMBER(svi318_state::svi318_ppi_port_b_r)
174173{
175   svi318_state *state = space.machine().driver_data<svi318_state>();
176174   int row;
177175   static const char *const keynames[] = {
178176      "LINE0", "LINE1", "LINE2", "LINE3", "LINE4", "LINE5",
179177      "LINE6", "LINE7", "LINE8", "LINE9", "LINE10"
180178   };
181179
182   row = state->m_svi.keyboard_row;
180   row = m_svi.keyboard_row;
183181   if (row <= 10)
184      return space.machine().root_device().ioport(keynames[row])->read();
182      return machine().root_device().ioport(keynames[row])->read();
185183
186184   return 0xff;
187185}
r18257r18258
199197  8  SOUND  Keyboard, Click sound bit (pulse)
200198*/
201199
202static WRITE8_DEVICE_HANDLER ( svi318_ppi_port_c_w )
200WRITE8_MEMBER(svi318_state::svi318_ppi_port_c_w)
203201{
204   svi318_state *state = space.machine().driver_data<svi318_state>();
205202   int val;
206203
207204   /* key click */
208205   val = (data & 0x80) ? 0x3e : 0;
209206   val += (data & 0x40) ? 0x3e : 0;
210   space.machine().device<dac_device>("dac")->write_signed8(val);
207   machine().device<dac_device>("dac")->write_signed8(val);
211208
212209   /* cassette motor on/off */
213   if (svi318_cassette_present(space.machine(), 0))
210   if (svi318_cassette_present(machine(), 0))
214211   {
215212
216         space.machine().device<cassette_image_device>(CASSETTE_TAG)->change_state(
213         machine().device<cassette_image_device>(CASSETTE_TAG)->change_state(
217214         (data & 0x10) ? CASSETTE_MOTOR_DISABLED : CASSETTE_MOTOR_ENABLED,
218215         CASSETTE_MOTOR_DISABLED);
219216   }
220217
221218   /* cassette signal write */
222   space.machine().device<cassette_image_device>(CASSETTE_TAG)->output((data & 0x20) ? -1.0 : +1.0);
219   machine().device<cassette_image_device>(CASSETTE_TAG)->output((data & 0x20) ? -1.0 : +1.0);
223220
224   state->m_svi.keyboard_row = data & 0x0F;
221   m_svi.keyboard_row = data & 0x0F;
225222}
226223
227224I8255_INTERFACE( svi318_ppi8255_interface )
228225{
229   DEVCB_HANDLER(svi318_ppi_port_a_r),
226   DEVCB_DRIVER_MEMBER(svi318_state,svi318_ppi_port_a_r),
230227   DEVCB_NULL,
231   DEVCB_HANDLER(svi318_ppi_port_b_r),
228   DEVCB_DRIVER_MEMBER(svi318_state,svi318_ppi_port_b_r),
232229   DEVCB_NULL,
233230   DEVCB_NULL,
234   DEVCB_HANDLER(svi318_ppi_port_c_w)
231   DEVCB_DRIVER_MEMBER(svi318_state,svi318_ppi_port_c_w)
235232};
236233
237234WRITE8_MEMBER(svi318_state::svi318_ppi_w)
r18257r18258
288285
289286/* Disk drives  */
290287
291static WRITE_LINE_DEVICE_HANDLER( svi_fdc_intrq_w )
288WRITE_LINE_MEMBER(svi318_state::svi_fdc_intrq_w)
292289{
293   svi318_state *drvstate = device->machine().driver_data<svi318_state>();
294   drvstate->m_fdc.irq = state;
290   m_fdc.irq = state;
295291}
296292
297static WRITE_LINE_DEVICE_HANDLER( svi_fdc_drq_w )
293WRITE_LINE_MEMBER(svi318_state::svi_fdc_drq_w)
298294{
299   svi318_state *drvstate = device->machine().driver_data<svi318_state>();
300   drvstate->m_fdc.drq = state;
295   m_fdc.drq = state;
301296}
302297
303298const wd17xx_interface svi_wd17xx_interface =
304299{
305300   DEVCB_NULL,
306   DEVCB_LINE(svi_fdc_intrq_w),
307   DEVCB_LINE(svi_fdc_drq_w),
301   DEVCB_DRIVER_LINE_MEMBER(svi318_state,svi_fdc_intrq_w),
302   DEVCB_DRIVER_LINE_MEMBER(svi318_state,svi_fdc_drq_w),
308303   {FLOPPY_0, FLOPPY_1, NULL, NULL}
309304};
310305
trunk/src/mess/machine/trs80.c
r18257r18258
667667   trs80_fdc_interrupt_internal(machine());
668668}
669669
670static WRITE_LINE_DEVICE_HANDLER( trs80_fdc_intrq_w )
670WRITE_LINE_MEMBER(trs80_state::trs80_fdc_intrq_w)
671671{
672   trs80_state *drvstate = device->machine().driver_data<trs80_state>();
673672   if (state)
674673   {
675      trs80_fdc_interrupt_internal(device->machine());
674      trs80_fdc_interrupt_internal(machine());
676675   }
677676   else
678677   {
679      if (drvstate->m_model4)
680         drvstate->m_nmi_data = 0;
678      if (m_model4)
679         m_nmi_data = 0;
681680      else
682         drvstate->m_irq &= ~IRQ_M1_FDC;
681         m_irq &= ~IRQ_M1_FDC;
683682   }
684683}
685684
686685const wd17xx_interface trs80_wd17xx_interface =
687686{
688687   DEVCB_NULL,
689   DEVCB_LINE(trs80_fdc_intrq_w),
688   DEVCB_DRIVER_LINE_MEMBER(trs80_state,trs80_fdc_intrq_w),
690689   DEVCB_NULL,
691690   {FLOPPY_0, FLOPPY_1, FLOPPY_2, FLOPPY_3}
692691};
trunk/src/mess/machine/z80ne.c
r18257r18258
609609   }
610610}
611611
612READ8_DEVICE_HANDLER( lx388_mc6847_videoram_r )
612READ8_MEMBER(z80ne_state::lx388_mc6847_videoram_r)
613613{
614   z80ne_state *state = space.machine().driver_data<z80ne_state>();
615614   if (offset == ~0) return 0xff;
616615
617   UINT8 *videoram = state->m_videoram;
616   UINT8 *videoram = m_videoram;
618617   int d6 = BIT(videoram[offset], 6);
619618   int d7 = BIT(videoram[offset], 7);
620619
621   state->m_vdg->inv_w(d6 && d7);
622   state->m_vdg->as_w(!d6 && d7);
623   state->m_vdg->intext_w(!d6 && d7);
620   m_vdg->inv_w(d6 && d7);
621   m_vdg->as_w(!d6 && d7);
622   m_vdg->intext_w(!d6 && d7);
624623
625624   return videoram[offset];
626625}
r18257r18258
648647 *
649648 */
650649
651WRITE8_DEVICE_HANDLER(lx390_motor_w)
650WRITE8_MEMBER(z80ne_state::lx390_motor_w)
652651{
653   z80ne_state *state = space.machine().driver_data<z80ne_state>();
654652   /* Selection of drive and parameters
655653     A write also causes the selected drive motor to turn on for about 3 seconds.
656654     When the motor turns off, the drive is deselected.
r18257r18258
677675      if (data & 8)
678676         drive = 3;
679677
680      state->m_wd17xx_state.head = (data & 32) ? 1 : 0;
681      state->m_wd17xx_state.drive = data & 0x0F;
678      m_wd17xx_state.head = (data & 32) ? 1 : 0;
679      m_wd17xx_state.drive = data & 0x0F;
682680
683681      /* no drive selected, turn off all leds */
684      if (!state->m_wd17xx_state.drive)
682      if (!m_wd17xx_state.drive)
685683      {
686684         output_set_value("drv0", 0);
687685         output_set_value("drv1", 0);
r18257r18258
690688      if (drive < 4)
691689      {
692690         LOG(("lx390_motor_w, set drive %1d\n", drive));
693         wd17xx_set_drive(device,drive);
694         LOG(("lx390_motor_w, set side %1d\n", state->m_wd17xx_state.head));
695         wd17xx_set_side(device, state->m_wd17xx_state.head);
691         wd17xx_set_drive(machine().device("wd1771"),drive);
692         LOG(("lx390_motor_w, set side %1d\n", m_wd17xx_state.head));
693         wd17xx_set_side(machine().device("wd1771"), m_wd17xx_state.head);
696694      }
697695}
698696
699READ8_DEVICE_HANDLER(lx390_reset_bank)
697READ8_MEMBER(z80ne_state::lx390_reset_bank)
700698{
701   z80ne_state *state = space.machine().driver_data<z80ne_state>();
702699   offs_t pc;
703700
704701   /* if PC is not in range, we are under integrated debugger control, DON'T SWAP */
705   pc = space.machine().device("z80ne")->safe_pc();
702   pc = machine().device("z80ne")->safe_pc();
706703   if((pc >= 0xf000) && (pc <=0xffff))
707704   {
708705      LOG(("lx390_reset_bank, reset memory bank 1\n"));
709      state->membank("bank1")->set_entry(0); /* RAM at 0x0000 (bank 1) */
706      membank("bank1")->set_entry(0); /* RAM at 0x0000 (bank 1) */
710707   }
711708   else
712709   {
r18257r18258
715712   return 0xff;
716713}
717714
718READ8_DEVICE_HANDLER(lx390_fdc_r)
715READ8_MEMBER(z80ne_state::lx390_fdc_r)
719716{
720717   UINT8 d;
721718
722719   switch(offset)
723720   {
724721   case 0:
725      d = wd17xx_status_r(device, space, 0) ^ 0xff;
722      d = wd17xx_status_r(machine().device("wd1771"), space, 0) ^ 0xff;
726723      LOG(("lx390_fdc_r, WD17xx status: %02x\n", d));
727724      break;
728725   case 1:
729      d = wd17xx_track_r(device, space, 0) ^ 0xff;
726      d = wd17xx_track_r(machine().device("wd1771"), space, 0) ^ 0xff;
730727      LOG(("lx390_fdc_r, WD17xx track:  %02x\n", d));
731728      break;
732729   case 2:
733      d = wd17xx_sector_r(device, space, 0) ^ 0xff;
730      d = wd17xx_sector_r(machine().device("wd1771"), space, 0) ^ 0xff;
734731      LOG(("lx390_fdc_r, WD17xx sector: %02x\n", d));
735732      break;
736733   case 3:
737      d = wd17xx_data_r(device, space, 0) ^ 0xff;
734      d = wd17xx_data_r(machine().device("wd1771"), space, 0) ^ 0xff;
738735      LOG(("lx390_fdc_r, WD17xx data3:  %02x\n", d));
739736      break;
740737   case 6:
741738      d = 0xff;
742      lx390_reset_bank(device, space, 0);
739      lx390_reset_bank(space, 0);
743740      break;
744741   case 7:
745      d = wd17xx_data_r(device, space, 3) ^ 0xff;
742      d = wd17xx_data_r(machine().device("wd1771"), space, 3) ^ 0xff;
746743      LOG(("lx390_fdc_r, WD17xx data7, force:  %02x\n", d));
747744      break;
748745   default:
r18257r18258
751748   return d;
752749}
753750
754WRITE8_DEVICE_HANDLER(lx390_fdc_w)
751WRITE8_MEMBER(z80ne_state::lx390_fdc_w)
755752{
756   z80ne_state *state = space.machine().driver_data<z80ne_state>();
757753   UINT8 d;
758754
759755   d = data;
r18257r18258
761757   {
762758   case 0:
763759      LOG(("lx390_fdc_w, WD17xx command: %02x\n", d));
764      wd17xx_command_w(device, space, offset, d ^ 0xff);
765      if (state->m_wd17xx_state.drive & 1)
760      wd17xx_command_w(machine().device("wd1771"), space, offset, d ^ 0xff);
761      if (m_wd17xx_state.drive & 1)
766762         output_set_value("drv0", 2);
767      else if (state->m_wd17xx_state.drive & 2)
763      else if (m_wd17xx_state.drive & 2)
768764         output_set_value("drv1", 2);
769765      break;
770766   case 1:
771767      LOG(("lx390_fdc_w, WD17xx track:   %02x\n", d));
772      wd17xx_track_w(device, space, offset, d ^ 0xff);
768      wd17xx_track_w(machine().device("wd1771"), space, offset, d ^ 0xff);
773769      break;
774770   case 2:
775771      LOG(("lx390_fdc_w, WD17xx sector:  %02x\n", d));
776      wd17xx_sector_w(device, space, offset, d ^ 0xff);
772      wd17xx_sector_w(machine().device("wd1771"), space, offset, d ^ 0xff);
777773      break;
778774   case 3:
779      wd17xx_data_w(device, space, 0, d ^ 0xff);
775      wd17xx_data_w(machine().device("wd1771"), space, 0, d ^ 0xff);
780776      LOG(("lx390_fdc_w, WD17xx data3:   %02x\n", d));
781777      break;
782778   case 6:
783779      LOG(("lx390_fdc_w, motor_w:   %02x\n", d));
784      lx390_motor_w(device, space, 0, d);
780      lx390_motor_w(space, 0, d);
785781      break;
786782   case 7:
787783      LOG(("lx390_fdc_w, WD17xx data7, force:   %02x\n", d));
788      wd17xx_data_w(device, space, 3, d ^ 0xff);
784      wd17xx_data_w(machine().device("wd1771"), space, 3, d ^ 0xff);
789785      break;
790786   }
791787}
trunk/src/mess/machine/kaypro.c
r18257r18258
1313
1414************************************************************/
1515
16static WRITE_LINE_DEVICE_HANDLER( kaypro_interrupt )
16WRITE_LINE_MEMBER(kaypro_state::kaypro_interrupt)
1717{
18   device->machine().device("maincpu")->execute().set_input_line(0, state);
18   machine().device("maincpu")->execute().set_input_line(0, state);
1919}
2020
2121READ8_MEMBER( kaypro_state::pio_system_r )
r18257r18258
227227
228228const z80sio_interface kaypro_sio_intf =
229229{
230   DEVCB_LINE(kaypro_interrupt),   /* interrupt handler */
230   DEVCB_DRIVER_LINE_MEMBER(kaypro_state,kaypro_interrupt),   /* interrupt handler */
231231   DEVCB_NULL,         /* DTR changed handler */
232232   DEVCB_NULL,         /* RTS changed handler */
233233   DEVCB_NULL,         /* BREAK changed handler */
r18257r18258
235235   DEVCB_NULL         /* receive handler - which channel is this for? */
236236};
237237
238READ8_DEVICE_HANDLER( kaypro_sio_r )
238READ8_MEMBER(kaypro_state::kaypro_sio_r)
239239{
240240   if (!offset)
241      return dynamic_cast<z80sio_device*>(device)->data_read(0);
241      return dynamic_cast<z80sio_device*>(machine().device("z80sio"))->data_read(0);
242242   else
243243   if (offset == 1)
244//      return z80sio_d_r(device, 1);
245      return kay_kbd_d_r(space.machine());
244//      return z80sio_d_r(machine().device("z80sio"), 1);
245      return kay_kbd_d_r(machine());
246246   else
247247   if (offset == 2)
248      return dynamic_cast<z80sio_device*>(device)->control_read(0);
248      return dynamic_cast<z80sio_device*>(machine().device("z80sio"))->control_read(0);
249249   else
250//      return z80sio_c_r(device, 1);
251      return kay_kbd_c_r(space.machine());
250//      return z80sio_c_r(machine().device("z80sio"), 1);
251      return kay_kbd_c_r(machine());
252252}
253253
254WRITE8_DEVICE_HANDLER( kaypro_sio_w )
254WRITE8_MEMBER(kaypro_state::kaypro_sio_w)
255255{
256256   if (!offset)
257      dynamic_cast<z80sio_device*>(device)->data_write(0, data);
257      dynamic_cast<z80sio_device*>(machine().device("z80sio"))->data_write(0, data);
258258   else
259259   if (offset == 1)
260//      z80sio_d_w(device, 1, data);
261      kay_kbd_d_w(space.machine(), data);
260//      z80sio_d_w(machine().device("z80sio"), 1, data);
261      kay_kbd_d_w(machine(), data);
262262   else
263263   if (offset == 2)
264      dynamic_cast<z80sio_device*>(device)->control_write(0, data);
264      dynamic_cast<z80sio_device*>(machine().device("z80sio"))->control_write(0, data);
265265   else
266      dynamic_cast<z80sio_device*>(device)->control_write(1, data);
266      dynamic_cast<z80sio_device*>(machine().device("z80sio"))->control_write(1, data);
267267}
268268
269269
trunk/src/mess/machine/partner.c
r18257r18258
2626   m_tape_value = 0x80;
2727}
2828
29static WRITE_LINE_DEVICE_HANDLER( partner_wd17xx_drq_w )
29WRITE_LINE_MEMBER(partner_state::partner_wd17xx_drq_w)
3030{
31   device_t *device = machine().device("dma8257");
3132   if (state)
3233      i8257_drq0_w(device, 1);
3334}
r18257r18258
3637{
3738   DEVCB_LINE_GND,
3839   DEVCB_NULL,
39   DEVCB_DEVICE_LINE("dma8257", partner_wd17xx_drq_w),
40   DEVCB_DRIVER_LINE_MEMBER(partner_state,partner_wd17xx_drq_w),
4041   {FLOPPY_0, FLOPPY_1, NULL, NULL}
4142};
4243
r18257r18258
357358   partner_bank_switch(machine());
358359}
359360
360static WRITE_LINE_DEVICE_HANDLER( hrq_w )
361WRITE_LINE_MEMBER(partner_state::hrq_w)
361362{
362363   /* HACK - this should be connected to the BUSREQ line of Z80 */
363   device->machine().device("maincpu")->execute().set_input_line(INPUT_LINE_HALT, state);
364   machine().device("maincpu")->execute().set_input_line(INPUT_LINE_HALT, state);
364365
365366   /* HACK - this should be connected to the BUSACK line of Z80 */
366   i8257_hlda_w(device, state);
367   i8257_hlda_w(machine().device("dma8257"), state);
367368}
368369
369370static UINT8 memory_read_byte(address_space &space, offs_t address, UINT8 mem_mask) { return space.read_byte(address); }
r18257r18258
371372
372373I8257_INTERFACE( partner_dma )
373374{
374   DEVCB_LINE(hrq_w),
375   DEVCB_DRIVER_LINE_MEMBER(partner_state,hrq_w),
375376   DEVCB_NULL,
376377   DEVCB_NULL,
377378   DEVCB_MEMORY_HANDLER("maincpu", PROGRAM, memory_read_byte),
trunk/src/mess/machine/ac1.c
r18257r18258
1111#include "imagedev/cassette.h"
1212#include "includes/ac1.h"
1313
14static READ8_DEVICE_HANDLER (ac1_port_b_r)
14READ8_MEMBER(ac1_state::ac1_port_b_r)
1515{
16   ac1_state *state = space.machine().driver_data<ac1_state>();
1716   UINT8 data = 0x7f;
1817
19   if (state->m_cassette->input() > 0.03)
18   if (m_cassette->input() > 0.03)
2019      data |= 0x80;
2120
2221   return data;
r18257r18258
2423
2524#define BNOT(x) ((x) ? 0 : 1)
2625
27static READ8_DEVICE_HANDLER (ac1_port_a_r)
26READ8_MEMBER(ac1_state::ac1_port_a_r)
2827{
29   UINT8 line0 = space.machine().root_device().ioport("LINE0")->read();
30   UINT8 line1 = space.machine().root_device().ioport("LINE1")->read();
31   UINT8 line2 = space.machine().root_device().ioport("LINE2")->read();
32   UINT8 line3 = space.machine().root_device().ioport("LINE3")->read();
33   UINT8 line4 = space.machine().root_device().ioport("LINE4")->read();
34   UINT8 line5 = space.machine().root_device().ioport("LINE5")->read();
35   UINT8 line6 = space.machine().root_device().ioport("LINE6")->read();
28   UINT8 line0 = machine().root_device().ioport("LINE0")->read();
29   UINT8 line1 = machine().root_device().ioport("LINE1")->read();
30   UINT8 line2 = machine().root_device().ioport("LINE2")->read();
31   UINT8 line3 = machine().root_device().ioport("LINE3")->read();
32   UINT8 line4 = machine().root_device().ioport("LINE4")->read();
33   UINT8 line5 = machine().root_device().ioport("LINE5")->read();
34   UINT8 line6 = machine().root_device().ioport("LINE6")->read();
3635
3736   UINT8 SH    = BNOT(BIT(line6,0));
3837   UINT8 CTRL  = BNOT(BIT(line6,1));
r18257r18258
7473   return td0 + (td1 << 1) +(td2 << 2) +(td3 << 3) +(td4 << 4) +(td5 << 5) +(td6 << 6) +(tast << 7);
7574}
7675
77static WRITE8_DEVICE_HANDLER (ac1_port_a_w)
76WRITE8_MEMBER(ac1_state::ac1_port_a_w)
7877{
7978}
8079
81static WRITE8_DEVICE_HANDLER (ac1_port_b_w)
80WRITE8_MEMBER(ac1_state::ac1_port_b_w)
8281{
8382   /*
8483
r18257r18258
9493        7       cassette in
9594
9695    */
97   ac1_state *state = space.machine().driver_data<ac1_state>();
98   state->m_cassette->output((data & 0x40) ? -1.0 : +1.0);
96   m_cassette->output((data & 0x40) ? -1.0 : +1.0);
9997}
10098
10199Z80PIO_INTERFACE( ac1_z80pio_intf )
102100{
103101   DEVCB_NULL,   /* callback when change interrupt status */
104   DEVCB_HANDLER(ac1_port_a_r),
105   DEVCB_HANDLER(ac1_port_a_w),
102   DEVCB_DRIVER_MEMBER(ac1_state,ac1_port_a_r),
103   DEVCB_DRIVER_MEMBER(ac1_state,ac1_port_a_w),
106104   DEVCB_NULL,
107   DEVCB_HANDLER(ac1_port_b_r),
108   DEVCB_HANDLER(ac1_port_b_w),
105   DEVCB_DRIVER_MEMBER(ac1_state,ac1_port_b_r),
106   DEVCB_DRIVER_MEMBER(ac1_state,ac1_port_b_w),
109107   DEVCB_NULL
110108};
111109
trunk/src/mess/machine/sym1.c
r18257r18258
3131******************************************************************************/
3232
3333
34static WRITE_LINE_DEVICE_HANDLER( sym1_74145_output_0_w )
34WRITE_LINE_MEMBER(sym1_state::sym1_74145_output_0_w)
3535{
36   sym1_state *drvstate = device->machine().driver_data<sym1_state>();
37   if (state) drvstate->m_led_update->adjust(LED_REFRESH_DELAY);
36   if (state) m_led_update->adjust(LED_REFRESH_DELAY);
3837}
3938
4039
41static WRITE_LINE_DEVICE_HANDLER( sym1_74145_output_1_w )
40WRITE_LINE_MEMBER(sym1_state::sym1_74145_output_1_w)
4241{
43   sym1_state *drvstate = device->machine().driver_data<sym1_state>();
44   if (state) drvstate->m_led_update->adjust(LED_REFRESH_DELAY, 1);
42   if (state) m_led_update->adjust(LED_REFRESH_DELAY, 1);
4543}
4644
4745
48static WRITE_LINE_DEVICE_HANDLER( sym1_74145_output_2_w )
46WRITE_LINE_MEMBER(sym1_state::sym1_74145_output_2_w)
4947{
50   sym1_state *drvstate = device->machine().driver_data<sym1_state>();
51   if (state) drvstate->m_led_update->adjust(LED_REFRESH_DELAY, 2);
48   if (state) m_led_update->adjust(LED_REFRESH_DELAY, 2);
5249}
5350
5451
55static WRITE_LINE_DEVICE_HANDLER( sym1_74145_output_3_w )
52WRITE_LINE_MEMBER(sym1_state::sym1_74145_output_3_w)
5653{
57   sym1_state *drvstate = device->machine().driver_data<sym1_state>();
58   if (state) drvstate->m_led_update->adjust(LED_REFRESH_DELAY, 3);
54   if (state) m_led_update->adjust(LED_REFRESH_DELAY, 3);
5955}
6056
6157
62static WRITE_LINE_DEVICE_HANDLER( sym1_74145_output_4_w )
58WRITE_LINE_MEMBER(sym1_state::sym1_74145_output_4_w)
6359{
64   sym1_state *drvstate = device->machine().driver_data<sym1_state>();
65   if (state) drvstate->m_led_update->adjust(LED_REFRESH_DELAY, 4);
60   if (state) m_led_update->adjust(LED_REFRESH_DELAY, 4);
6661}
6762
6863
69static WRITE_LINE_DEVICE_HANDLER( sym1_74145_output_5_w )
64WRITE_LINE_MEMBER(sym1_state::sym1_74145_output_5_w)
7065{
71   sym1_state *drvstate = device->machine().driver_data<sym1_state>();
72   if (state) drvstate->m_led_update->adjust(LED_REFRESH_DELAY, 5);
66   if (state) m_led_update->adjust(LED_REFRESH_DELAY, 5);
7367}
7468
7569
r18257r18258
7973}
8074
8175
82static READ8_DEVICE_HANDLER(sym1_riot_a_r)
76READ8_MEMBER(sym1_state::sym1_riot_a_r)
8377{
84   sym1_state *state = space.machine().driver_data<sym1_state>();
8578   int data = 0x7f;
8679
8780   /* scan keypad rows */
88   if (!(state->m_riot_port_a & 0x80)) data &= space.machine().root_device().ioport("ROW-0")->read();
89   if (!(state->m_riot_port_b & 0x01)) data &= space.machine().root_device().ioport("ROW-1")->read();
90   if (!(state->m_riot_port_b & 0x02)) data &= space.machine().root_device().ioport("ROW-2")->read();
91   if (!(state->m_riot_port_b & 0x04)) data &= space.machine().root_device().ioport("ROW-3")->read();
81   if (!(m_riot_port_a & 0x80)) data &= machine().root_device().ioport("ROW-0")->read();
82   if (!(m_riot_port_b & 0x01)) data &= machine().root_device().ioport("ROW-1")->read();
83   if (!(m_riot_port_b & 0x02)) data &= machine().root_device().ioport("ROW-2")->read();
84   if (!(m_riot_port_b & 0x04)) data &= machine().root_device().ioport("ROW-3")->read();
9285
9386   /* determine column */
94   if ( ((state->m_riot_port_a ^ 0xff) & (state->ioport("ROW-0")->read() ^ 0xff)) & 0x7f )
87   if ( ((m_riot_port_a ^ 0xff) & (ioport("ROW-0")->read() ^ 0xff)) & 0x7f )
9588      data &= ~0x80;
9689
9790   return data;
9891}
9992
10093
101static READ8_DEVICE_HANDLER(sym1_riot_b_r)
94READ8_MEMBER(sym1_state::sym1_riot_b_r)
10295{
103   sym1_state *state = space.machine().driver_data<sym1_state>();
10496   int data = 0xff;
10597
10698   /* determine column */
107   if ( ((state->m_riot_port_a ^ 0xff) & (space.machine().root_device().ioport("ROW-1")->read() ^ 0xff)) & 0x7f )
99   if ( ((m_riot_port_a ^ 0xff) & (machine().root_device().ioport("ROW-1")->read() ^ 0xff)) & 0x7f )
108100      data &= ~0x01;
109101
110   if ( ((state->m_riot_port_a ^ 0xff) & (space.machine().root_device().ioport("ROW-2")->read() ^ 0xff)) & 0x3f )
102   if ( ((m_riot_port_a ^ 0xff) & (machine().root_device().ioport("ROW-2")->read() ^ 0xff)) & 0x3f )
111103      data &= ~0x02;
112104
113   if ( ((state->m_riot_port_a ^ 0xff) & (state->ioport("ROW-3")->read() ^ 0xff)) & 0x1f )
105   if ( ((m_riot_port_a ^ 0xff) & (ioport("ROW-3")->read() ^ 0xff)) & 0x1f )
114106      data &= ~0x04;
115107
116108   data &= ~0x80; // else hangs 8b02
r18257r18258
119111}
120112
121113
122static WRITE8_DEVICE_HANDLER(sym1_riot_a_w)
114WRITE8_MEMBER(sym1_state::sym1_riot_a_w)
123115{
124   sym1_state *state = space.machine().driver_data<sym1_state>();
125   logerror("%x: riot_a_w 0x%02x\n", space.machine().device("maincpu") ->safe_pc( ), data);
116   logerror("%x: riot_a_w 0x%02x\n", machine().device("maincpu") ->safe_pc( ), data);
126117
127118   /* save for later use */
128   state->m_riot_port_a = data;
119   m_riot_port_a = data;
129120}
130121
131122
132static WRITE8_DEVICE_HANDLER(sym1_riot_b_w)
123WRITE8_MEMBER(sym1_state::sym1_riot_b_w)
133124{
134   sym1_state *state = space.machine().driver_data<sym1_state>();
135   logerror("%x: riot_b_w 0x%02x\n", space.machine().device("maincpu") ->safe_pc( ), data);
125   logerror("%x: riot_b_w 0x%02x\n", machine().device("maincpu") ->safe_pc( ), data);
136126
137127   /* save for later use */
138   state->m_riot_port_b = data;
128   m_riot_port_b = data;
139129
140130   /* first 4 pins are connected to the 74145 */
141   space.machine().device<ttl74145_device>("ttl74145")->write(data & 0x0f);
131   machine().device<ttl74145_device>("ttl74145")->write(data & 0x0f);
142132}
143133
144134
145135const riot6532_interface sym1_r6532_interface =
146136{
147   DEVCB_HANDLER(sym1_riot_a_r),
148   DEVCB_HANDLER(sym1_riot_b_r),
149   DEVCB_HANDLER(sym1_riot_a_w),
150   DEVCB_HANDLER(sym1_riot_b_w)
137   DEVCB_DRIVER_MEMBER(sym1_state,sym1_riot_a_r),
138   DEVCB_DRIVER_MEMBER(sym1_state,sym1_riot_b_r),
139   DEVCB_DRIVER_MEMBER(sym1_state,sym1_riot_a_w),
140   DEVCB_DRIVER_MEMBER(sym1_state,sym1_riot_b_w)
151141};
152142
153143
154144const ttl74145_interface sym1_ttl74145_intf =
155145{
156   DEVCB_LINE(sym1_74145_output_0_w),  /* connected to DS0 */
157   DEVCB_LINE(sym1_74145_output_1_w),  /* connected to DS1 */
158   DEVCB_LINE(sym1_74145_output_2_w),  /* connected to DS2 */
159   DEVCB_LINE(sym1_74145_output_3_w),  /* connected to DS3 */
160   DEVCB_LINE(sym1_74145_output_4_w),  /* connected to DS4 */
161   DEVCB_LINE(sym1_74145_output_5_w),  /* connected to DS5 */
146   DEVCB_DRIVER_LINE_MEMBER(sym1_state,sym1_74145_output_0_w),  /* connected to DS0 */
147   DEVCB_DRIVER_LINE_MEMBER(sym1_state,sym1_74145_output_1_w),  /* connected to DS1 */
148   DEVCB_DRIVER_LINE_MEMBER(sym1_state,sym1_74145_output_2_w),  /* connected to DS2 */
149   DEVCB_DRIVER_LINE_MEMBER(sym1_state,sym1_74145_output_3_w),  /* connected to DS3 */
150   DEVCB_DRIVER_LINE_MEMBER(sym1_state,sym1_74145_output_4_w),  /* connected to DS4 */
151   DEVCB_DRIVER_LINE_MEMBER(sym1_state,sym1_74145_output_5_w),  /* connected to DS5 */
162152   DEVCB_DEVICE_LINE(SPEAKER_TAG, speaker_level_w),
163153   DEVCB_NULL,   /* not connected */
164154   DEVCB_NULL,   /* not connected */
r18257r18258
177167}
178168
179169
180static READ8_DEVICE_HANDLER( sym1_via0_b_r )
170READ8_MEMBER(sym1_state::sym1_via0_b_r)
181171{
182172   return 0xff;
183173}
184174
185175
186static WRITE8_DEVICE_HANDLER( sym1_via0_b_w )
176WRITE8_MEMBER(sym1_state::sym1_via0_b_w)
187177{
188   logerror("%s: via0_b_w 0x%02x\n", space.machine().describe_context(), data);
178   logerror("%s: via0_b_w 0x%02x\n", machine().describe_context(), data);
189179}
190180
191181
r18257r18258
194184 * PA2: Write protect RAM 0x800-0xbff
195185 * PA3: Write protect RAM 0xc00-0xfff
196186 */
197static WRITE8_DEVICE_HANDLER( sym1_via2_a_w )
187WRITE8_MEMBER(sym1_state::sym1_via2_a_w)
198188{
199   address_space &cpu0space = space.machine().device( "maincpu")->memory().space( AS_PROGRAM );
189   address_space &cpu0space = machine().device( "maincpu")->memory().space( AS_PROGRAM );
200190
201191   logerror("SYM1 VIA2 W 0x%02x\n", data);
202192
203   if ((space.machine().root_device().ioport("WP")->read() & 0x01) && !(data & 0x01)) {
193   if ((machine().root_device().ioport("WP")->read() & 0x01) && !(data & 0x01)) {
204194      cpu0space.nop_write(0xa600, 0xa67f);
205195   } else {
206196      cpu0space.install_write_bank(0xa600, 0xa67f, "bank5");
207197   }
208   if ((space.machine().root_device().ioport("WP")->read() & 0x02) && !(data & 0x02)) {
198   if ((machine().root_device().ioport("WP")->read() & 0x02) && !(data & 0x02)) {
209199      cpu0space.nop_write(0x0400, 0x07ff);
210200   } else {
211201      cpu0space.install_write_bank(0x0400, 0x07ff, "bank2");
212202   }
213   if ((space.machine().root_device().ioport("WP")->read() & 0x04) && !(data & 0x04)) {
203   if ((machine().root_device().ioport("WP")->read() & 0x04) && !(data & 0x04)) {
214204      cpu0space.nop_write(0x0800, 0x0bff);
215205   } else {
216206      cpu0space.install_write_bank(0x0800, 0x0bff, "bank3");
217207   }
218   if ((space.machine().root_device().ioport("WP")->read() & 0x08) && !(data & 0x08)) {
208   if ((machine().root_device().ioport("WP")->read() & 0x08) && !(data & 0x08)) {
219209      cpu0space.nop_write(0x0c00, 0x0fff);
220210   } else {
221211      cpu0space.install_write_bank(0x0c00, 0x0fff, "bank4");
r18257r18258
226216const via6522_interface sym1_via0 =
227217{
228218   DEVCB_NULL,           /* VIA Port A Input */
229   DEVCB_HANDLER(sym1_via0_b_r),  /* VIA Port B Input */
219   DEVCB_DRIVER_MEMBER(sym1_state,sym1_via0_b_r),  /* VIA Port B Input */
230220   DEVCB_NULL,           /* VIA Port CA1 Input */
231221   DEVCB_NULL,           /* VIA Port CB1 Input */
232222   DEVCB_NULL,           /* VIA Port CA2 Input */
233223   DEVCB_NULL,           /* VIA Port CB2 Input */
234224   DEVCB_NULL,           /* VIA Port A Output */
235   DEVCB_HANDLER(sym1_via0_b_w),  /* VIA Port B Output */
225   DEVCB_DRIVER_MEMBER(sym1_state,sym1_via0_b_w),  /* VIA Port B Output */
236226   DEVCB_NULL,           /* VIA Port CA1 Output */
237227   DEVCB_NULL,           /* VIA Port CB1 Output */
238228   DEVCB_NULL,           /* VIA Port CA2 Output */
r18257r18258
267257   DEVCB_NULL,           /* VIA Port CB1 Input */
268258   DEVCB_NULL,           /* VIA Port CA2 Input */
269259   DEVCB_NULL,           /* VIA Port CB2 Input */
270   DEVCB_HANDLER(sym1_via2_a_w),  /* VIA Port A Output */
260   DEVCB_DRIVER_MEMBER(sym1_state,sym1_via2_a_w),  /* VIA Port A Output */
271261   DEVCB_NULL,           /* VIA Port B Output */
272262   DEVCB_NULL,           /* VIA Port CA1 Output */
273263   DEVCB_NULL,           /* VIA Port CB1 Output */
trunk/src/mess/machine/bebox.c
r18257r18258
521521 *
522522 *************************************************************/
523523
524static WRITE_LINE_DEVICE_HANDLER( bebox_pic8259_master_set_int_line )
524WRITE_LINE_MEMBER(bebox_state::bebox_pic8259_master_set_int_line)
525525{
526   bebox_set_irq_bit(device->machine(), 5, state);
526   bebox_set_irq_bit(machine(), 5, state);
527527}
528528
529static WRITE_LINE_DEVICE_HANDLER( bebox_pic8259_slave_set_int_line )
529WRITE_LINE_MEMBER(bebox_state::bebox_pic8259_slave_set_int_line)
530530{
531   bebox_state *drvstate = device->machine().driver_data<bebox_state>();
532   if (drvstate->m_devices.pic8259_master)
533      pic8259_ir2_w(drvstate->m_devices.pic8259_master, state);
531   if (m_devices.pic8259_master)
532      pic8259_ir2_w(m_devices.pic8259_master, state);
534533}
535534
536static READ8_DEVICE_HANDLER( get_slave_ack )
535READ8_MEMBER(bebox_state::get_slave_ack)
537536{
538   bebox_state *state = space.machine().driver_data<bebox_state>();
539537   if (offset==2) { // IRQ = 2
540      return pic8259_acknowledge(state->m_devices.pic8259_slave);
538      return pic8259_acknowledge(m_devices.pic8259_slave);
541539   }
542540   return 0x00;
543541}
544542
545543const struct pic8259_interface bebox_pic8259_master_config =
546544{
547   DEVCB_LINE(bebox_pic8259_master_set_int_line),
545   DEVCB_DRIVER_LINE_MEMBER(bebox_state,bebox_pic8259_master_set_int_line),
548546   DEVCB_LINE_VCC,
549   DEVCB_HANDLER(get_slave_ack)
547   DEVCB_DRIVER_MEMBER(bebox_state,get_slave_ack)
550548};
551549
552550const struct pic8259_interface bebox_pic8259_slave_config =
553551{
554   DEVCB_LINE(bebox_pic8259_slave_set_int_line),
552   DEVCB_DRIVER_LINE_MEMBER(bebox_state,bebox_pic8259_slave_set_int_line),
555553   DEVCB_LINE_GND,
556554   DEVCB_NULL
557555};
r18257r18258
753751}
754752
755753
756static WRITE_LINE_DEVICE_HANDLER( bebox_dma_hrq_changed )
754WRITE_LINE_MEMBER(bebox_state::bebox_dma_hrq_changed)
757755{
758   device->machine().device("ppc1")->execute().set_input_line(INPUT_LINE_HALT, state ? ASSERT_LINE : CLEAR_LINE);
756   machine().device("ppc1")->execute().set_input_line(INPUT_LINE_HALT, state ? ASSERT_LINE : CLEAR_LINE);
759757
760758   /* Assert HLDA */
761   i8237_hlda_w( device, state );
759   i8237_hlda_w( machine().device("dma8237_1"), state );
762760}
763761
764762
r18257r18258
780778}
781779
782780
783static READ8_DEVICE_HANDLER( bebox_dma8237_fdc_dack_r ) {
784   return pc_fdc_dack_r(space.machine(),space);
781READ8_MEMBER(bebox_state::bebox_dma8237_fdc_dack_r){
782   return pc_fdc_dack_r(machine(),space);
785783}
786784
787785
788static WRITE8_DEVICE_HANDLER( bebox_dma8237_fdc_dack_w ) {
789   pc_fdc_dack_w( space.machine(), space, data );
786WRITE8_MEMBER(bebox_state::bebox_dma8237_fdc_dack_w){
787   pc_fdc_dack_w( machine(), space, data );
790788}
791789
792790
793static WRITE_LINE_DEVICE_HANDLER( bebox_dma8237_out_eop ) {
794   pc_fdc_set_tc_state( device->machine(), state );
791WRITE_LINE_MEMBER(bebox_state::bebox_dma8237_out_eop){
792   pc_fdc_set_tc_state( machine(), state );
795793}
796794
797static void set_dma_channel(device_t *device, int channel, int state)
795static void set_dma_channel(running_machine &machine, int channel, int state)
798796{
799   bebox_state *drvstate = device->machine().driver_data<bebox_state>();
797   bebox_state *drvstate = machine.driver_data<bebox_state>();
800798   if (!state) drvstate->m_dma_channel = channel;
801799}
802800
803static WRITE_LINE_DEVICE_HANDLER( pc_dack0_w ) { set_dma_channel(device, 0, state); }
804static WRITE_LINE_DEVICE_HANDLER( pc_dack1_w ) { set_dma_channel(device, 1, state); }
805static WRITE_LINE_DEVICE_HANDLER( pc_dack2_w ) { set_dma_channel(device, 2, state); }
806static WRITE_LINE_DEVICE_HANDLER( pc_dack3_w ) { set_dma_channel(device, 3, state); }
801WRITE_LINE_MEMBER(bebox_state::pc_dack0_w){ set_dma_channel(machine(), 0, state); }
802WRITE_LINE_MEMBER(bebox_state::pc_dack1_w){ set_dma_channel(machine(), 1, state); }
803WRITE_LINE_MEMBER(bebox_state::pc_dack2_w){ set_dma_channel(machine(), 2, state); }
804WRITE_LINE_MEMBER(bebox_state::pc_dack3_w){ set_dma_channel(machine(), 3, state); }
807805
808806
809807I8237_INTERFACE( bebox_dma8237_1_config )
810808{
811   DEVCB_LINE(bebox_dma_hrq_changed),
812   DEVCB_LINE(bebox_dma8237_out_eop),
809   DEVCB_DRIVER_LINE_MEMBER(bebox_state,bebox_dma_hrq_changed),
810   DEVCB_DRIVER_LINE_MEMBER(bebox_state,bebox_dma8237_out_eop),
813811   DEVCB_MEMORY_HANDLER("ppc1", PROGRAM, bebox_dma_read_byte),
814812   DEVCB_MEMORY_HANDLER("ppc1", PROGRAM, bebox_dma_write_byte),
815   { DEVCB_NULL, DEVCB_NULL, DEVCB_HANDLER(bebox_dma8237_fdc_dack_r), DEVCB_NULL },
816   { DEVCB_NULL, DEVCB_NULL, DEVCB_HANDLER(bebox_dma8237_fdc_dack_w), DEVCB_NULL },
817   { DEVCB_LINE(pc_dack0_w), DEVCB_LINE(pc_dack1_w), DEVCB_LINE(pc_dack2_w), DEVCB_LINE(pc_dack3_w) }
813   { DEVCB_NULL, DEVCB_NULL, DEVCB_DRIVER_MEMBER(bebox_state,bebox_dma8237_fdc_dack_r), DEVCB_NULL },
814   { DEVCB_NULL, DEVCB_NULL, DEVCB_DRIVER_MEMBER(bebox_state,bebox_dma8237_fdc_dack_w), DEVCB_NULL },
815   { DEVCB_DRIVER_LINE_MEMBER(bebox_state,pc_dack0_w), DEVCB_DRIVER_LINE_MEMBER(bebox_state,pc_dack1_w), DEVCB_DRIVER_LINE_MEMBER(bebox_state,pc_dack2_w), DEVCB_DRIVER_LINE_MEMBER(bebox_state,pc_dack3_w) }
818816};
819817
820818
r18257r18258
836834 *
837835 *************************************/
838836
839static WRITE_LINE_DEVICE_HANDLER( bebox_timer0_w )
837WRITE_LINE_MEMBER(bebox_state::bebox_timer0_w)
840838{
841   bebox_state *drvstate = device->machine().driver_data<bebox_state>();
842   if (drvstate->m_devices.pic8259_master)
843      pic8259_ir0_w(drvstate->m_devices.pic8259_master, state);
839   if (m_devices.pic8259_master)
840      pic8259_ir0_w(m_devices.pic8259_master, state);
844841}
845842
846843
r18257r18258
850847      {
851848         4772720/4,            /* heartbeat IRQ */
852849         DEVCB_NULL,
853         DEVCB_LINE(bebox_timer0_w)
850         DEVCB_DRIVER_LINE_MEMBER(bebox_state,bebox_timer0_w)
854851      },
855852      {
856853         4772720/4,            /* dram refresh */
trunk/src/mess/machine/pecom.c
r18257r18258
111111
112112/* CDP1802 Interface */
113113
114static READ_LINE_DEVICE_HANDLER( clear_r )
114READ_LINE_MEMBER(pecom_state::clear_r)
115115{
116   pecom_state *state = device->machine().driver_data<pecom_state>();
117
118   return state->m_reset;
116   return m_reset;
119117}
120118
121static READ_LINE_DEVICE_HANDLER( ef2_r )
119READ_LINE_MEMBER(pecom_state::ef2_r)
122120{
123   int shift = BIT(device->machine().root_device().ioport("CNT")->read(), 1);
121   device_t *device = machine().device(CASSETTE_TAG);
122   int shift = BIT(machine().root_device().ioport("CNT")->read(), 1);
124123   double cas = dynamic_cast<cassette_image_device *>(device)->input();
125124
126125   return (cas > 0.0) | shift;
r18257r18258
148147    return flags;
149148}
150149*/
151static WRITE_LINE_DEVICE_HANDLER( pecom64_q_w )
150WRITE_LINE_MEMBER(pecom_state::pecom64_q_w)
152151{
152   device_t *device = machine().device(CASSETTE_TAG);
153153   dynamic_cast<cassette_image_device *>(device)->output(state ? -1.0 : +1.0);
154154}
155155
r18257r18258
176176COSMAC_INTERFACE( pecom64_cdp1802_config )
177177{
178178   DEVCB_LINE_VCC,
179   DEVCB_LINE(clear_r),
179   DEVCB_DRIVER_LINE_MEMBER(pecom_state,clear_r),
180180   DEVCB_NULL,
181   DEVCB_DEVICE_LINE(CASSETTE_TAG, ef2_r),
181   DEVCB_DRIVER_LINE_MEMBER(pecom_state,ef2_r),
182182   DEVCB_NULL,
183183   DEVCB_NULL,
184   DEVCB_DEVICE_LINE(CASSETTE_TAG, pecom64_q_w),
184   DEVCB_DRIVER_LINE_MEMBER(pecom_state,pecom64_q_w),
185185   DEVCB_NULL,
186186   DEVCB_NULL,
187187   pecom64_sc_w,
trunk/src/mess/machine/macpci.c
r18257r18258
2626
2727/* VIA1 Handlers */
2828
29static DECLARE_READ8_DEVICE_HANDLER(mac_via_in_a);
30static DECLARE_READ8_DEVICE_HANDLER(mac_via_in_b);
31static DECLARE_READ8_DEVICE_HANDLER(mac_adb_via_in_cb2);
32static DECLARE_WRITE8_DEVICE_HANDLER(mac_via_out_a);
33static DECLARE_WRITE8_DEVICE_HANDLER(mac_via_out_b);
34static DECLARE_WRITE8_DEVICE_HANDLER(mac_adb_via_out_cb2);
3529static void mac_via_irq(device_t *device, int state);
3630
3731const via6522_interface pcimac_via6522_intf =
3832{
39   DEVCB_HANDLER(mac_via_in_a), DEVCB_HANDLER(mac_via_in_b),
33   DEVCB_DRIVER_MEMBER(macpci_state,mac_via_in_a), DEVCB_DRIVER_MEMBER(macpci_state,mac_via_in_b),
4034   DEVCB_NULL, DEVCB_NULL,
41   DEVCB_NULL, DEVCB_HANDLER(mac_adb_via_in_cb2),
42   DEVCB_HANDLER(mac_via_out_a), DEVCB_HANDLER(mac_via_out_b),
35   DEVCB_NULL, DEVCB_DRIVER_MEMBER(macpci_state,mac_adb_via_in_cb2),
36   DEVCB_DRIVER_MEMBER(macpci_state,mac_via_out_a), DEVCB_DRIVER_MEMBER(macpci_state,mac_via_out_b),
4337   DEVCB_NULL, DEVCB_NULL,
44   DEVCB_NULL, DEVCB_HANDLER(mac_adb_via_out_cb2),
38   DEVCB_NULL, DEVCB_DRIVER_MEMBER(macpci_state,mac_adb_via_out_cb2),
4539   DEVCB_LINE(mac_via_irq)
4640};
4741
r18257r18258
4943{
5044}
5145
52static READ8_DEVICE_HANDLER(mac_via_in_a)
46READ8_MEMBER(macpci_state::mac_via_in_a)
5347{
54//  macpci_state *mac = space.machine().driver_data<macpci_state>();
55
5648//    printf("VIA1 IN_A (PC %x)\n", mac->m_maincpu->pc());
5749
5850   return 0x80;
5951}
6052
61static READ8_DEVICE_HANDLER(mac_via_in_b)
53READ8_MEMBER(macpci_state::mac_via_in_b)
6254{
6355   int val = 0;
64   macpci_state *mac = space.machine().driver_data<macpci_state>();
56    val |= m_cuda->get_treq()<<3;
6557
66    val |= mac->m_cuda->get_treq()<<3;
58//    printf("VIA1 IN B = %02x (PC %x)\n", val, m_maincpu->pc());
6759
68//    printf("VIA1 IN B = %02x (PC %x)\n", val, mac->m_maincpu->pc());
69
7060    return val;
7161}
7262
73static WRITE8_DEVICE_HANDLER(mac_via_out_a)
63WRITE8_MEMBER(macpci_state::mac_via_out_a)
7464{
75//  macpci_state *mac = space.machine().driver_data<macpci_state>();
76
77//    printf("VIA1 OUT A: %02x (PC %x)\n", data, mac->m_maincpu->pc());
65//    printf("VIA1 OUT A: %02x (PC %x)\n", data, m_maincpu->pc());
7866}
7967
80static WRITE8_DEVICE_HANDLER(mac_via_out_b)
68WRITE8_MEMBER(macpci_state::mac_via_out_b)
8169{
82   macpci_state *mac = space.machine().driver_data<macpci_state>();
70//    printf("VIA1 OUT B: %02x (PC %x)\n", data, m_maincpu->pc());
8371
84//    printf("VIA1 OUT B: %02x (PC %x)\n", data, mac->m_maincpu->pc());
85
8672    #if LOG_ADB
87    printf("PPC: New Cuda state: TIP %d BYTEACK %d (PC %x)\n", (data>>5)&1, (data>>4)&1, mac->m_maincpu->pc());
73    printf("PPC: New Cuda state: TIP %d BYTEACK %d (PC %x)\n", (data>>5)&1, (data>>4)&1, m_maincpu->pc());
8874    #endif
89    mac->m_cuda->set_byteack((data&0x10) ? 1 : 0);
90    mac->m_cuda->set_tip((data&0x20) ? 1 : 0);
75    m_cuda->set_byteack((data&0x10) ? 1 : 0);
76    m_cuda->set_tip((data&0x20) ? 1 : 0);
9177}
9278
9379READ16_MEMBER ( macpci_state::mac_via_r )
r18257r18258
122108   m_maincpu->adjust_icount(m_via_cycles);
123109}
124110
125static READ8_DEVICE_HANDLER(mac_adb_via_in_cb2)
111READ8_MEMBER(macpci_state::mac_adb_via_in_cb2)
126112{
127113   UINT8 ret;
128   macpci_state *mac = space.machine().driver_data<macpci_state>();
129
130    ret = mac->m_cuda->get_via_data();
114    ret = m_cuda->get_via_data();
131115    #if LOG_ADB
132116    printf("PPC: Read VIA_DATA %x\n", ret);
133117    #endif
r18257r18258
135119    return ret;
136120}
137121
138static WRITE8_DEVICE_HANDLER(mac_adb_via_out_cb2)
122WRITE8_MEMBER(macpci_state::mac_adb_via_out_cb2)
139123{
140   macpci_state *mac = space.machine().driver_data<macpci_state>();
141
142    mac->m_cuda->set_via_data(data & 1);
124    m_cuda->set_via_data(data & 1);
143125}
144126
145127void macpci_state::machine_start()
trunk/src/mess/machine/radio86.c
r18257r18258
4141   m_radio_ram_disk = auto_alloc_array(machine(), UINT8, 0x20000);
4242   memset(m_radio_ram_disk,0,0x20000);
4343}
44static READ8_DEVICE_HANDLER (radio86_8255_portb_r2 )
44READ8_MEMBER(radio86_state::radio86_8255_portb_r2)
4545{
46   radio86_state *state = space.machine().driver_data<radio86_state>();
4746   UINT8 key = 0xff;
48   if ((state->m_keyboard_mask & 0x01)!=0) { key &= state->ioport("LINE0")->read(); }
49   if ((state->m_keyboard_mask & 0x02)!=0) { key &= space.machine().root_device().ioport("LINE1")->read(); }
50   if ((state->m_keyboard_mask & 0x04)!=0) { key &= space.machine().root_device().ioport("LINE2")->read(); }
51   if ((state->m_keyboard_mask & 0x08)!=0) { key &= space.machine().root_device().ioport("LINE3")->read(); }
52   if ((state->m_keyboard_mask & 0x10)!=0) { key &= space.machine().root_device().ioport("LINE4")->read(); }
53   if ((state->m_keyboard_mask & 0x20)!=0) { key &= space.machine().root_device().ioport("LINE5")->read(); }
54   if ((state->m_keyboard_mask & 0x40)!=0) { key &= space.machine().root_device().ioport("LINE6")->read(); }
55   if ((state->m_keyboard_mask & 0x80)!=0) { key &= space.machine().root_device().ioport("LINE7")->read(); }
47   if ((m_keyboard_mask & 0x01)!=0) { key &= ioport("LINE0")->read(); }
48   if ((m_keyboard_mask & 0x02)!=0) { key &= machine().root_device().ioport("LINE1")->read(); }
49   if ((m_keyboard_mask & 0x04)!=0) { key &= machine().root_device().ioport("LINE2")->read(); }
50   if ((m_keyboard_mask & 0x08)!=0) { key &= machine().root_device().ioport("LINE3")->read(); }
51   if ((m_keyboard_mask & 0x10)!=0) { key &= machine().root_device().ioport("LINE4")->read(); }
52   if ((m_keyboard_mask & 0x20)!=0) { key &= machine().root_device().ioport("LINE5")->read(); }
53   if ((m_keyboard_mask & 0x40)!=0) { key &= machine().root_device().ioport("LINE6")->read(); }
54   if ((m_keyboard_mask & 0x80)!=0) { key &= machine().root_device().ioport("LINE7")->read(); }
5655   return key;
5756}
5857
59static READ8_DEVICE_HANDLER (radio86_8255_portc_r2 )
58READ8_MEMBER(radio86_state::radio86_8255_portc_r2)
6059{
61   radio86_state *state = space.machine().driver_data<radio86_state>();
62   double level = (space.machine().device<cassette_image_device>(CASSETTE_TAG)->input());
63   UINT8 dat = state->ioport("LINE8")->read();
60   double level = (machine().device<cassette_image_device>(CASSETTE_TAG)->input());
61   UINT8 dat = ioport("LINE8")->read();
6462   if (level <  0) {
65      dat ^= state->m_tape_value;
63      dat ^= m_tape_value;
6664   }
6765   return dat;
6866}
6967
70static WRITE8_DEVICE_HANDLER (radio86_8255_porta_w2 )
68WRITE8_MEMBER(radio86_state::radio86_8255_porta_w2)
7169{
72   radio86_state *state = space.machine().driver_data<radio86_state>();
73   state->m_keyboard_mask = data ^ 0xff;
70   m_keyboard_mask = data ^ 0xff;
7471}
7572
76static WRITE8_DEVICE_HANDLER (radio86_8255_portc_w2 )
73WRITE8_MEMBER(radio86_state::radio86_8255_portc_w2)
7774{
78   space.machine().device<cassette_image_device>(CASSETTE_TAG)->output(data & 0x01 ? 1 : -1);
75   machine().device<cassette_image_device>(CASSETTE_TAG)->output(data & 0x01 ? 1 : -1);
7976}
8077
8178
8279I8255A_INTERFACE( radio86_ppi8255_interface_1 )
8380{
8481   DEVCB_NULL,
85   DEVCB_HANDLER(radio86_8255_porta_w2),
86   DEVCB_HANDLER(radio86_8255_portb_r2),
82   DEVCB_DRIVER_MEMBER(radio86_state,radio86_8255_porta_w2),
83   DEVCB_DRIVER_MEMBER(radio86_state,radio86_8255_portb_r2),
8784   DEVCB_NULL,
88   DEVCB_HANDLER(radio86_8255_portc_r2),
89   DEVCB_HANDLER(radio86_8255_portc_w2),
85   DEVCB_DRIVER_MEMBER(radio86_state,radio86_8255_portc_r2),
86   DEVCB_DRIVER_MEMBER(radio86_state,radio86_8255_portc_w2),
9087};
9188
9289I8255A_INTERFACE( mikrosha_ppi8255_interface_1 )
9390{
94   DEVCB_HANDLER(radio86_8255_portb_r2),
91   DEVCB_DRIVER_MEMBER(radio86_state,radio86_8255_portb_r2),
9592   DEVCB_NULL,
9693   DEVCB_NULL,
97   DEVCB_HANDLER(radio86_8255_porta_w2),
98   DEVCB_HANDLER(radio86_8255_portc_r2),
99   DEVCB_HANDLER(radio86_8255_portc_w2),
94   DEVCB_DRIVER_MEMBER(radio86_state,radio86_8255_porta_w2),
95   DEVCB_DRIVER_MEMBER(radio86_state,radio86_8255_portc_r2),
96   DEVCB_DRIVER_MEMBER(radio86_state,radio86_8255_portc_w2),
10097};
10198
10299
103100
104static READ8_DEVICE_HANDLER (rk7007_8255_portc_r )
101READ8_MEMBER(radio86_state::rk7007_8255_portc_r)
105102{
106   radio86_state *state = space.machine().driver_data<radio86_state>();
107   double level = (space.machine().device<cassette_image_device>(CASSETTE_TAG)->input());
103   double level = (machine().device<cassette_image_device>(CASSETTE_TAG)->input());
108104   UINT8 key = 0xff;
109   if ((state->m_keyboard_mask & 0x01)!=0) { key &= state->ioport("CLINE0")->read(); }
110   if ((state->m_keyboard_mask & 0x02)!=0) { key &= space.machine().root_device().ioport("CLINE1")->read(); }
111   if ((state->m_keyboard_mask & 0x04)!=0) { key &= space.machine().root_device().ioport("CLINE2")->read(); }
112   if ((state->m_keyboard_mask & 0x08)!=0) { key &= space.machine().root_device().ioport("CLINE3")->read(); }
113   if ((state->m_keyboard_mask & 0x10)!=0) { key &= space.machine().root_device().ioport("CLINE4")->read(); }
114   if ((state->m_keyboard_mask & 0x20)!=0) { key &= space.machine().root_device().ioport("CLINE5")->read(); }
115   if ((state->m_keyboard_mask & 0x40)!=0) { key &= space.machine().root_device().ioport("CLINE6")->read(); }
116   if ((state->m_keyboard_mask & 0x80)!=0) { key &= space.machine().root_device().ioport("CLINE7")->read(); }
105   if ((m_keyboard_mask & 0x01)!=0) { key &= ioport("CLINE0")->read(); }
106   if ((m_keyboard_mask & 0x02)!=0) { key &= machine().root_device().ioport("CLINE1")->read(); }
107   if ((m_keyboard_mask & 0x04)!=0) { key &= machine().root_device().ioport("CLINE2")->read(); }
108   if ((m_keyboard_mask & 0x08)!=0) { key &= machine().root_device().ioport("CLINE3")->read(); }
109   if ((m_keyboard_mask & 0x10)!=0) { key &= machine().root_device().ioport("CLINE4")->read(); }
110   if ((m_keyboard_mask & 0x20)!=0) { key &= machine().root_device().ioport("CLINE5")->read(); }
111   if ((m_keyboard_mask & 0x40)!=0) { key &= machine().root_device().ioport("CLINE6")->read(); }
112   if ((m_keyboard_mask & 0x80)!=0) { key &= machine().root_device().ioport("CLINE7")->read(); }
117113   key &= 0xe0;
118114   if (level <  0) {
119      key ^= state->m_tape_value;
115      key ^= m_tape_value;
120116   }
121117   return key;
122118}
r18257r18258
124120I8255A_INTERFACE( rk7007_ppi8255_interface )
125121{
126122   DEVCB_NULL,
127   DEVCB_HANDLER(radio86_8255_porta_w2),
128   DEVCB_HANDLER(radio86_8255_portb_r2),
123   DEVCB_DRIVER_MEMBER(radio86_state,radio86_8255_porta_w2),
124   DEVCB_DRIVER_MEMBER(radio86_state,radio86_8255_portb_r2),
129125   DEVCB_NULL,
130   DEVCB_HANDLER(rk7007_8255_portc_r),
131   DEVCB_HANDLER(radio86_8255_portc_w2),
126   DEVCB_DRIVER_MEMBER(radio86_state,rk7007_8255_portc_r),
127   DEVCB_DRIVER_MEMBER(radio86_state,radio86_8255_portc_w2),
132128};
133129
134static WRITE_LINE_DEVICE_HANDLER( hrq_w )
130WRITE_LINE_MEMBER(radio86_state::hrq_w)
135131{
136132   /* HACK - this should be connected to the BUSREQ line of Z80 */
137   device->machine().device("maincpu")->execute().set_input_line(INPUT_LINE_HALT, state);
133   machine().device("maincpu")->execute().set_input_line(INPUT_LINE_HALT, state);
138134
139135   /* HACK - this should be connected to the BUSACK line of Z80 */
140   i8257_hlda_w(device, state);
136   i8257_hlda_w(machine().device("dma8257"), state);
141137}
142138
143139static UINT8 memory_read_byte(address_space &space, offs_t address, UINT8 mem_mask) { return space.read_byte(address); }
r18257r18258
145141
146142I8257_INTERFACE( radio86_dma )
147143{
148   DEVCB_LINE(hrq_w),
144   DEVCB_DRIVER_LINE_MEMBER(radio86_state,hrq_w),
149145   DEVCB_NULL,
150146   DEVCB_NULL,
151147   DEVCB_MEMORY_HANDLER("maincpu", PROGRAM, memory_read_byte),
r18257r18258
190186   m_disk_sel = data;
191187}
192188
193static READ8_DEVICE_HANDLER (radio86_romdisk_porta_r )
189READ8_MEMBER(radio86_state::radio86_romdisk_porta_r)
194190{
195   radio86_state *state = space.machine().driver_data<radio86_state>();
196   UINT8 *romdisk = state->memregion("maincpu")->base() + 0x10000;
197   if ((state->m_disk_sel & 0x0f) ==0) {
198      return romdisk[state->m_romdisk_msb*256+state->m_romdisk_lsb];
191   UINT8 *romdisk = memregion("maincpu")->base() + 0x10000;
192   if ((m_disk_sel & 0x0f) ==0) {
193      return romdisk[m_romdisk_msb*256+m_romdisk_lsb];
199194   } else {
200      if (state->m_disk_sel==0xdf) {
201         return state->m_radio_ram_disk[state->m_romdisk_msb*256+state->m_romdisk_lsb + 0x10000];
195      if (m_disk_sel==0xdf) {
196         return m_radio_ram_disk[m_romdisk_msb*256+m_romdisk_lsb + 0x10000];
202197      } else {
203         return state->m_radio_ram_disk[state->m_romdisk_msb*256+state->m_romdisk_lsb];
198         return m_radio_ram_disk[m_romdisk_msb*256+m_romdisk_lsb];
204199      }
205200   }
206201}
207202
208static WRITE8_DEVICE_HANDLER (radio86_romdisk_portb_w )
203WRITE8_MEMBER(radio86_state::radio86_romdisk_portb_w)
209204{
210   radio86_state *state = space.machine().driver_data<radio86_state>();
211   state->m_romdisk_lsb = data;
205   m_romdisk_lsb = data;
212206}
213207
214static WRITE8_DEVICE_HANDLER (radio86_romdisk_portc_w )
208WRITE8_MEMBER(radio86_state::radio86_romdisk_portc_w)
215209{
216   radio86_state *state = space.machine().driver_data<radio86_state>();
217   state->m_romdisk_msb = data;
210   m_romdisk_msb = data;
218211}
219212
220213I8255A_INTERFACE( radio86_ppi8255_interface_2 )
221214{
222   DEVCB_HANDLER(radio86_romdisk_porta_r),
215   DEVCB_DRIVER_MEMBER(radio86_state,radio86_romdisk_porta_r),
223216   DEVCB_NULL,
224217   DEVCB_NULL,
225   DEVCB_HANDLER(radio86_romdisk_portb_w),
218   DEVCB_DRIVER_MEMBER(radio86_state,radio86_romdisk_portb_w),
226219   DEVCB_NULL,
227   DEVCB_HANDLER(radio86_romdisk_portc_w)
220   DEVCB_DRIVER_MEMBER(radio86_state,radio86_romdisk_portc_w)
228221};
229222
230static WRITE8_DEVICE_HANDLER (mikrosha_8255_font_page_w )
223WRITE8_MEMBER(radio86_state::mikrosha_8255_font_page_w)
231224{
232   radio86_state *state = space.machine().driver_data<radio86_state>();
233   state->m_mikrosha_font_page = (data  > 7) & 1;
225   m_mikrosha_font_page = (data  > 7) & 1;
234226}
235227
236228I8255A_INTERFACE( mikrosha_ppi8255_interface_2 )
r18257r18258
238230   DEVCB_NULL,
239231   DEVCB_NULL,
240232   DEVCB_NULL,
241   DEVCB_HANDLER(mikrosha_8255_font_page_w),
233   DEVCB_DRIVER_MEMBER(radio86_state,mikrosha_8255_font_page_w),
242234   DEVCB_NULL,
243235   DEVCB_NULL
244236};
trunk/src/mess/machine/c64.c
r18257r18258
7878 *  see machine/cbm.c
7979 */
8080
81static READ8_DEVICE_HANDLER( c64_cia0_port_a_r )
81READ8_MEMBER(legacy_c64_state::c64_cia0_port_a_r)
8282{
83   UINT8 cia0portb = mos6526_pb_r(space.machine().device("cia_0"), space, 0);
83   UINT8 cia0portb = mos6526_pb_r(machine().device("cia_0"), space, 0);
8484
85   return cbm_common_cia0_port_a_r(device, cia0portb);
85   return cbm_common_cia0_port_a_r(machine().device("cia_0"), cia0portb);
8686}
8787
88static READ8_DEVICE_HANDLER( c64_cia0_port_b_r )
88READ8_MEMBER(legacy_c64_state::c64_cia0_port_b_r)
8989{
90   UINT8 cia0porta = mos6526_pa_r(space.machine().device("cia_0"), space, 0);
90   UINT8 cia0porta = mos6526_pa_r(machine().device("cia_0"), space, 0);
9191
92   return cbm_common_cia0_port_b_r(device, cia0porta);
92   return cbm_common_cia0_port_b_r(machine().device("cia_0"), cia0porta);
9393}
9494
95static WRITE8_DEVICE_HANDLER( c64_cia0_port_b_w )
95WRITE8_MEMBER(legacy_c64_state::c64_cia0_port_b_w)
9696{
97   device_t *vic2 = space.machine().device("vic2");
97   device_t *vic2 = machine().device("vic2");
9898   vic2_lightpen_write(vic2, data & 0x10);
9999}
100100
r18257r18258
133133   DEVCB_NULL,   /* pc_func */
134134   DEVCB_NULL,
135135   DEVCB_NULL,
136   DEVCB_HANDLER(c64_cia0_port_a_r),
136   DEVCB_DRIVER_MEMBER(legacy_c64_state,c64_cia0_port_a_r),
137137   DEVCB_NULL,
138   DEVCB_HANDLER(c64_cia0_port_b_r),
139   DEVCB_HANDLER(c64_cia0_port_b_w)
138   DEVCB_DRIVER_MEMBER(legacy_c64_state,c64_cia0_port_b_r),
139   DEVCB_DRIVER_MEMBER(legacy_c64_state,c64_cia0_port_b_w)
140140};
141141
142142const mos6526_interface c64_pal_cia0 =
r18257r18258
145145   DEVCB_NULL,   /* pc_func */
146146   DEVCB_NULL,
147147   DEVCB_NULL,
148   DEVCB_HANDLER(c64_cia0_port_a_r),
148   DEVCB_DRIVER_MEMBER(legacy_c64_state,c64_cia0_port_a_r),
149149   DEVCB_NULL,
150   DEVCB_HANDLER(c64_cia0_port_b_r),
151   DEVCB_HANDLER(c64_cia0_port_b_w)
150   DEVCB_DRIVER_MEMBER(legacy_c64_state,c64_cia0_port_b_r),
151   DEVCB_DRIVER_MEMBER(legacy_c64_state,c64_cia0_port_b_w)
152152};
153153
154154
r18257r18258
175175 * flag restore key or rs232 received data input
176176 * irq to nmi connected ?
177177 */
178static READ8_DEVICE_HANDLER( c64_cia1_port_a_r )
178READ8_MEMBER(legacy_c64_state::c64_cia1_port_a_r)
179179{
180   legacy_c64_state *state = space.machine().driver_data<legacy_c64_state>();
181
182180   UINT8 value = 0xff;
183181
184   if (!state->m_iec->clk_r())
182   if (!m_iec->clk_r())
185183      value &= ~0x40;
186184
187   if (!state->m_iec->data_r())
185   if (!m_iec->data_r())
188186      value &= ~0x80;
189187
190188   return value;
191189}
192190
193static WRITE8_DEVICE_HANDLER( c64_cia1_port_a_w )
191WRITE8_MEMBER(legacy_c64_state::c64_cia1_port_a_w)
194192{
195   legacy_c64_state *state = space.machine().driver_data<legacy_c64_state>();
196193   static const int helper[4] = {0xc000, 0x8000, 0x4000, 0x0000};
197194
198   state->m_iec->clk_w(!(data & 0x10));
199   state->m_iec->data_w(!(data & 0x20));
200   state->m_iec->atn_w(!(data & 0x08));
201   state->m_vicaddr = state->m_memory + helper[data & 0x03];
195   m_iec->clk_w(!(data & 0x10));
196   m_iec->data_w(!(data & 0x20));
197   m_iec->atn_w(!(data & 0x08));
198   m_vicaddr = m_memory + helper[data & 0x03];
202199}
203200
204201static void c64_cia1_interrupt( device_t *device, int level )
r18257r18258
212209   DEVCB_NULL,   /* pc_func */
213210   DEVCB_NULL,
214211   DEVCB_NULL,
215   DEVCB_HANDLER(c64_cia1_port_a_r),
216   DEVCB_HANDLER(c64_cia1_port_a_w),
212   DEVCB_DRIVER_MEMBER(legacy_c64_state,c64_cia1_port_a_r),
213   DEVCB_DRIVER_MEMBER(legacy_c64_state,c64_cia1_port_a_w),
217214   DEVCB_NULL,
218215   DEVCB_NULL
219216};
r18257r18258
224221   DEVCB_NULL,   /* pc_func */
225222   DEVCB_NULL,
226223   DEVCB_NULL,
227   DEVCB_HANDLER(c64_cia1_port_a_r),
228   DEVCB_HANDLER(c64_cia1_port_a_w),
224   DEVCB_DRIVER_MEMBER(legacy_c64_state,c64_cia1_port_a_r),
225   DEVCB_DRIVER_MEMBER(legacy_c64_state,c64_cia1_port_a_w),
229226   DEVCB_NULL,
230227   DEVCB_NULL
231228};
r18257r18258
530527   state->m_old_data = data;
531528}
532529
533/**
534  ddr bit 1 port line is output
535  port bit 1 port line is high
536
537  p0 output loram
538  p1 output hiram
539  p2 output charen
540  p3 output cassette data
541  p4 input cassette switch
542  p5 output cassette motor
543  p6,7 not available on M6510
544 */
545
546WRITE8_DEVICE_HANDLER(c64_m6510_port_write)
547{
548   legacy_c64_state *state = space.machine().driver_data<legacy_c64_state>();
549
550   UINT8 direction = offset; // HACK ALERT!
551
552   /* if line is marked as input then keep current value */
553   data = (state->m_port_data & ~direction) | (data & direction);
554
555   /* resistors make P0,P1,P2 go high when respective line is changed to input */
556   if (!(direction & 0x04))
557      data |= 0x04;
558
559   if (!(direction & 0x02))
560      data |= 0x02;
561
562   if (!(direction & 0x01))
563      data |= 0x01;
564
565   state->m_port_data = data;
566
567   if (state->m_tape_on)
568   {
569      if (direction & 0x08)
570      {
571         space.machine().device<cassette_image_device>(CASSETTE_TAG)->output((data & 0x08) ? -(0x5a9e >> 1) : +(0x5a9e >> 1));
572      }
573
574      if (direction & 0x20)
575      {
576         if(!(data & 0x20))
577         {
578            space.machine().device<cassette_image_device>(CASSETTE_TAG)->change_state(CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR);
579            state->m_datasette_timer->adjust(attotime::zero, 0, attotime::from_hz(44100));
580         }
581         else
582         {
583            space.machine().device<cassette_image_device>(CASSETTE_TAG)->change_state(CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR);
584            state->m_datasette_timer->reset();
585         }
586      }
587   }
588
589   if (!state->m_ultimax)
590      c64_bankswitch(space.machine(), 0);
591
592   state->m_memory[0x000] = device->memory().space(AS_PROGRAM).read_byte(0);
593   state->m_memory[0x001] = device->memory().space(AS_PROGRAM).read_byte(1);
594
595}
596
597READ8_DEVICE_HANDLER(c64_m6510_port_read)
598{
599   legacy_c64_state *state = space.machine().driver_data<legacy_c64_state>();
600   UINT8 data = state->m_port_data;
601
602   if (state->m_tape_on)
603   {
604      if ((space.machine().device<cassette_image_device>(CASSETTE_TAG)->get_state() & CASSETTE_MASK_UISTATE) != CASSETTE_STOPPED)
605         data &= ~0x10;
606      else
607         data |=  0x10;
608   }
609
610   return data;
611}
612
613
614530int c64_paddle_read( device_t *device, address_space &space, int which )
615531{
616532   running_machine &machine = device->machine();
trunk/src/mess/machine/bbc.c
r18257r18258
906906}
907907
908908
909static WRITE8_DEVICE_HANDLER( bbcb_via_system_write_porta )
909WRITE8_MEMBER(bbc_state::bbcb_via_system_write_porta)
910910{
911   bbc_state *state = space.machine().driver_data<bbc_state>();
912911   //logerror("SYSTEM write porta %d\n",data);
913912
914   state->m_via_system_porta = data;
915   if (state->m_b0_sound == 0)
913   m_via_system_porta = data;
914   if (m_b0_sound == 0)
916915   {
917916      //logerror("Doing an unsafe write to the sound chip %d \n",data);
918      state->m_sn->write(space, 0,state->m_via_system_porta);
917      m_sn->write(space, 0,m_via_system_porta);
919918   }
920   if (state->m_b3_keyboard == 0)
919   if (m_b3_keyboard == 0)
921920   {
922921      //logerror("Doing an unsafe write to the keyboard %d \n",data);
923      state->m_via_system_porta = bbc_keyboard(space, state->m_via_system_porta);
922      m_via_system_porta = bbc_keyboard(space, m_via_system_porta);
924923   }
925   if (state->m_Master) MC146818_set(space);
924   if (m_Master) MC146818_set(space);
926925}
927926
928927
929static WRITE8_DEVICE_HANDLER( bbcb_via_system_write_portb )
928WRITE8_MEMBER(bbc_state::bbcb_via_system_write_portb)
930929{
931   bbc_state *state = space.machine().driver_data<bbc_state>();
932930   int bit, value;
933931   bit = data & 0x07;
934932   value = (data >> 3) & 0x01;
r18257r18258
941939      switch (bit)
942940      {
943941      case 0:
944         if (state->m_b0_sound == 0)
942         if (m_b0_sound == 0)
945943         {
946            state->m_b0_sound = 1;
944            m_b0_sound = 1;
947945         }
948946         break;
949947      case 1:
950         if (state->m_Master)
948         if (m_Master)
951949         {
952            if (state->m_MC146818_WR == 0)
950            if (m_MC146818_WR == 0)
953951            {
954952               /* BBC MASTER has NV RAM Here */
955               state->m_MC146818_WR = 1;
953               m_MC146818_WR = 1;
956954               MC146818_set(space);
957955            }
958956         }
959957         else
960958         {
961            if (state->m_b1_speech_read == 0)
959            if (m_b1_speech_read == 0)
962960            {
963961               /* VSP TMS 5220 */
964               state->m_b1_speech_read = 1;
962               m_b1_speech_read = 1;
965963            }
966964         }
967965         break;
968966      case 2:
969         if (state->m_Master)
967         if (m_Master)
970968         {
971            if (state->m_MC146818_DS == 0)
969            if (m_MC146818_DS == 0)
972970            {
973971               /* BBC MASTER has NV RAM Here */
974               state->m_MC146818_DS = 1;
972               m_MC146818_DS = 1;
975973               MC146818_set(space);
976974            }
977975         }
978976         else
979977         {
980            if (state->m_b2_speech_write == 0)
978            if (m_b2_speech_write == 0)
981979            {
982980               /* VSP TMS 5220 */
983               state->m_b2_speech_write = 1;
981               m_b2_speech_write = 1;
984982            }
985983         }
986984         break;
987985      case 3:
988         if (state->m_b3_keyboard == 0)
986         if (m_b3_keyboard == 0)
989987         {
990            state->m_b3_keyboard = 1;
988            m_b3_keyboard = 1;
991989         }
992990         break;
993991      case 4:
994         if (state->m_b4_video0 == 0)
992         if (m_b4_video0 == 0)
995993         {
996            state->m_b4_video0 = 1;
994            m_b4_video0 = 1;
997995         }
998996         break;
999997      case 5:
1000         if (state->m_b5_video1 == 0)
998         if (m_b5_video1 == 0)
1001999         {
1002            state->m_b5_video1 = 1;
1000            m_b5_video1 = 1;
10031001         }
10041002         break;
10051003      case 6:
1006         if (state->m_b6_caps_lock_led == 0)
1004         if (m_b6_caps_lock_led == 0)
10071005         {
1008            state->m_b6_caps_lock_led = 1;
1006            m_b6_caps_lock_led = 1;
10091007            /* call caps lock led update */
10101008         }
10111009         break;
10121010      case 7:
1013         if (state->m_b7_shift_lock_led == 0)
1011         if (m_b7_shift_lock_led == 0)
10141012         {
1015            state->m_b7_shift_lock_led = 1;
1013            m_b7_shift_lock_led = 1;
10161014            /* call shift lock led update */
10171015         }
10181016         break;
r18257r18258
10231021      switch (bit)
10241022      {
10251023      case 0:
1026         if (state->m_b0_sound == 1)
1024         if (m_b0_sound == 1)
10271025         {
1028            state->m_b0_sound = 0;
1029            state->m_sn->write(space, 0, state->m_via_system_porta);
1026            m_b0_sound = 0;
1027            m_sn->write(space, 0, m_via_system_porta);
10301028         }
10311029         break;
10321030      case 1:
1033         if (state->m_Master)
1031         if (m_Master)
10341032         {
1035            if (state->m_MC146818_WR == 1)
1033            if (m_MC146818_WR == 1)
10361034            {
10371035               /* BBC MASTER has NV RAM Here */
1038               state->m_MC146818_WR = 0;
1036               m_MC146818_WR = 0;
10391037               MC146818_set(space);
10401038            }
10411039         }
10421040         else
10431041         {
1044            if (state->m_b1_speech_read == 1)
1042            if (m_b1_speech_read == 1)
10451043            {
10461044               /* VSP TMS 5220 */
1047               state->m_b1_speech_read = 0;
1045               m_b1_speech_read = 0;
10481046            }
10491047         }
10501048         break;
10511049      case 2:
1052         if (state->m_Master)
1050         if (m_Master)
10531051         {
1054            if (state->m_MC146818_DS == 1)
1052            if (m_MC146818_DS == 1)
10551053            {
10561054               /* BBC MASTER has NV RAM Here */
1057               state->m_MC146818_DS = 0;
1055               m_MC146818_DS = 0;
10581056               MC146818_set(space);
10591057            }
10601058         }
10611059         else
10621060         {
1063            if (state->m_b2_speech_write == 1)
1061            if (m_b2_speech_write == 1)
10641062            {
10651063               /* VSP TMS 5220 */
1066               state->m_b2_speech_write = 0;
1064               m_b2_speech_write = 0;
10671065            }
10681066         }
10691067         break;
10701068      case 3:
1071         if (state->m_b3_keyboard == 1)
1069         if (m_b3_keyboard == 1)
10721070         {
1073            state->m_b3_keyboard = 0;
1071            m_b3_keyboard = 0;
10741072            /* *** call keyboard enabled *** */
1075            state->m_via_system_porta=bbc_keyboard(space, state->m_via_system_porta);
1073            m_via_system_porta=bbc_keyboard(space, m_via_system_porta);
10761074         }
10771075         break;
10781076      case 4:
1079         if (state->m_b4_video0 == 1)
1077         if (m_b4_video0 == 1)
10801078         {
1081            state->m_b4_video0 = 0;
1079            m_b4_video0 = 0;
10821080         }
10831081         break;
10841082      case 5:
1085         if (state->m_b5_video1 == 1)
1083         if (m_b5_video1 == 1)
10861084         {
1087            state->m_b5_video1 = 0;
1085            m_b5_video1 = 0;
10881086         }
10891087         break;
10901088      case 6:
1091         if (state->m_b6_caps_lock_led == 1)
1089         if (m_b6_caps_lock_led == 1)
10921090         {
1093            state->m_b6_caps_lock_led = 0;
1091            m_b6_caps_lock_led = 0;
10941092            /* call caps lock led update */
10951093         }
10961094         break;
10971095      case 7:
1098         if (state->m_b7_shift_lock_led == 1)
1096         if (m_b7_shift_lock_led == 1)
10991097         {
1100            state->m_b7_shift_lock_led = 0;
1098            m_b7_shift_lock_led = 0;
11011099            /* call shift lock led update */
11021100         }
11031101         break;
r18257r18258
11061104
11071105
11081106
1109   if (state->m_Master)
1107   if (m_Master)
11101108   {
11111109      //set the Address Select
1112      if (state->m_MC146818_AS != ((data>>7)&1))
1110      if (m_MC146818_AS != ((data>>7)&1))
11131111      {
1114         state->m_MC146818_AS=(data>>7)&1;
1112         m_MC146818_AS=(data>>7)&1;
11151113         MC146818_set(space);
11161114      }
11171115
11181116      //if CE changes
1119      if (state->m_MC146818_CE != ((data>>6)&1))
1117      if (m_MC146818_CE != ((data>>6)&1))
11201118      {
1121         state->m_MC146818_CE=(data>>6)&1;
1119         m_MC146818_CE=(data>>6)&1;
11221120         MC146818_set(space);
11231121      }
11241122   }
11251123}
11261124
11271125
1128static READ8_DEVICE_HANDLER( bbcb_via_system_read_porta )
1126READ8_MEMBER(bbc_state::bbcb_via_system_read_porta)
11291127{
1130   bbc_state *state = space.machine().driver_data<bbc_state>();
1131   //logerror("SYSTEM read porta %d\n",state->m_via_system_porta);
1132   return state->m_via_system_porta;
1128   //logerror("SYSTEM read porta %d\n",m_via_system_porta);
1129   return m_via_system_porta;
11331130}
11341131
11351132// D4 of portb is joystick fire button 1
r18257r18258
11511148#endif
11521149
11531150
1154static READ8_DEVICE_HANDLER( bbcb_via_system_read_portb )
1151READ8_MEMBER(bbc_state::bbcb_via_system_read_portb)
11551152{
11561153   //TMSint=(!tms5220_int_r())&1;
11571154   //TMSrdy=(!tms5220_readyq_r())&1;
11581155
11591156   //logerror("SYSTEM read portb %d\n",0xf | input_port(machine, "IN0")|(TMSint<<6)|(TMSrdy<<7));
11601157
1161   return (0xf | space.machine().root_device().ioport("IN0")->read()|(TMSint<<6)|(TMSrdy<<7));
1158   return (0xf | machine().root_device().ioport("IN0")->read()|(TMSint<<6)|(TMSrdy<<7));
11621159}
11631160
11641161
11651162/* vertical sync pulse from video circuit */
1166static READ8_DEVICE_HANDLER( bbcb_via_system_read_ca1 )
1163READ8_MEMBER(bbc_state::bbcb_via_system_read_ca1)
11671164{
11681165   return 0x01;
11691166}
11701167
11711168
11721169/* joystick EOC */
1173static READ8_DEVICE_HANDLER( bbcb_via_system_read_cb1 )
1170READ8_MEMBER(bbc_state::bbcb_via_system_read_cb1)
11741171{
1175   return uPD7002_EOC_r(space.machine().device("upd7002"),space,0);
1172   return uPD7002_EOC_r(machine().device("upd7002"),space,0);
11761173}
11771174
11781175
11791176/* keyboard pressed detect */
1180static READ8_DEVICE_HANDLER( bbcb_via_system_read_ca2 )
1177READ8_MEMBER(bbc_state::bbcb_via_system_read_ca2)
11811178{
11821179   return 0x01;
11831180}
11841181
11851182
11861183/* light pen strobe detect (not emulated) */
1187static READ8_DEVICE_HANDLER( bbcb_via_system_read_cb2 )
1184READ8_MEMBER(bbc_state::bbcb_via_system_read_cb2)
11881185{
11891186   return 0x01;
11901187}
11911188
11921189
1193static WRITE_LINE_DEVICE_HANDLER( bbcb_via_system_irq_w )
1190WRITE_LINE_MEMBER(bbc_state::bbcb_via_system_irq_w)
11941191{
1195   bbc_state *driver_state = device->machine().driver_data<bbc_state>();
1196   driver_state->m_via_system_irq = state;
1192   m_via_system_irq = state;
11971193
1198   driver_state->check_interrupts();
1194   check_interrupts();
11991195}
12001196
12011197const via6522_interface bbcb_system_via =
12021198{
1203   DEVCB_HANDLER(bbcb_via_system_read_porta),
1204   DEVCB_HANDLER(bbcb_via_system_read_portb),
1205   DEVCB_HANDLER(bbcb_via_system_read_ca1),
1206   DEVCB_HANDLER(bbcb_via_system_read_cb1),
1207   DEVCB_HANDLER(bbcb_via_system_read_ca2),
1208   DEVCB_HANDLER(bbcb_via_system_read_cb2),
1209   DEVCB_HANDLER(bbcb_via_system_write_porta),
1210   DEVCB_HANDLER(bbcb_via_system_write_portb),
1199   DEVCB_DRIVER_MEMBER(bbc_state,bbcb_via_system_read_porta),
1200   DEVCB_DRIVER_MEMBER(bbc_state,bbcb_via_system_read_portb),
1201   DEVCB_DRIVER_MEMBER(bbc_state,bbcb_via_system_read_ca1),
1202   DEVCB_DRIVER_MEMBER(bbc_state,bbcb_via_system_read_cb1),
1203   DEVCB_DRIVER_MEMBER(bbc_state,bbcb_via_system_read_ca2),
1204   DEVCB_DRIVER_MEMBER(bbc_state,bbcb_via_system_read_cb2),
1205   DEVCB_DRIVER_MEMBER(bbc_state,bbcb_via_system_write_porta),
1206   DEVCB_DRIVER_MEMBER(bbc_state,bbcb_via_system_write_portb),
12111207   DEVCB_NULL,
12121208   DEVCB_NULL,
12131209   DEVCB_NULL,
12141210   DEVCB_NULL,
1215   DEVCB_LINE(bbcb_via_system_irq_w)
1211   DEVCB_DRIVER_LINE_MEMBER(bbc_state,bbcb_via_system_irq_w)
12161212};
12171213
12181214
r18257r18258
12261222***********************************************************************/
12271223
12281224/* USER VIA 6522 port B is connected to the BBC user port */
1229static READ8_DEVICE_HANDLER( bbcb_via_user_read_portb )
1225READ8_MEMBER(bbc_state::bbcb_via_user_read_portb)
12301226{
12311227   return 0xff;
12321228}
12331229
1234static WRITE8_DEVICE_HANDLER( bbcb_via_user_write_portb )
1230WRITE8_MEMBER(bbc_state::bbcb_via_user_write_portb)
12351231{
1236   bbc_state *state = space.machine().driver_data<bbc_state>();
1237   state->m_userport = data;
1232   m_userport = data;
12381233}
12391234
1240static WRITE_LINE_DEVICE_HANDLER( bbcb_via_user_irq_w )
1235WRITE_LINE_MEMBER(bbc_state::bbcb_via_user_irq_w)
12411236{
1242   bbc_state *driver_state = device->machine().driver_data<bbc_state>();
1243   driver_state->m_via_user_irq = state;
1237   m_via_user_irq = state;
12441238
1245   driver_state->check_interrupts();
1239   check_interrupts();
12461240}
12471241
12481242const via6522_interface bbcb_user_via =
12491243{
12501244   DEVCB_NULL,   //via_user_read_porta,
1251   DEVCB_HANDLER(bbcb_via_user_read_portb),
1245   DEVCB_DRIVER_MEMBER(bbc_state,bbcb_via_user_read_portb),
12521246   DEVCB_NULL,   //via_user_read_ca1,
12531247   DEVCB_NULL,   //via_user_read_cb1,
12541248   DEVCB_NULL,   //via_user_read_ca2,
12551249   DEVCB_NULL,   //via_user_read_cb2,
12561250   DEVCB_DEVICE_MEMBER("centronics", centronics_device, write),
1257   DEVCB_HANDLER(bbcb_via_user_write_portb),
1251   DEVCB_DRIVER_MEMBER(bbc_state,bbcb_via_user_write_portb),
12581252   DEVCB_NULL, //via_user_write_ca1
12591253   DEVCB_NULL, //via_user_write_cb1
12601254   DEVCB_DEVICE_LINE_MEMBER("centronics", centronics_device, strobe_w),
12611255   DEVCB_NULL,   //via_user_write_cb2,
1262   DEVCB_LINE(bbcb_via_user_irq_w)
1256   DEVCB_DRIVER_LINE_MEMBER(bbc_state,bbcb_via_user_irq_w)
12631257};
12641258
12651259
r18257r18258
15621556   drvstate->m_previous_wd177x_int_state = bbc_state;
15631557}
15641558
1565static WRITE_LINE_DEVICE_HANDLER( bbc_wd177x_intrq_w )
1559WRITE_LINE_MEMBER(bbc_state::bbc_wd177x_intrq_w)
15661560{
1567   bbc_state *drvstate = device->machine().driver_data<bbc_state>();
1568   drvstate->m_wd177x_irq_state = state;
1569   bbc_update_fdq_int(device->machine(), state);
1561   m_wd177x_irq_state = state;
1562   bbc_update_fdq_int(machine(), state);
15701563}
15711564
1572static WRITE_LINE_DEVICE_HANDLER( bbc_wd177x_drq_w )
1565WRITE_LINE_MEMBER(bbc_state::bbc_wd177x_drq_w)
15731566{
1574   bbc_state *drvstate = device->machine().driver_data<bbc_state>();
1575   drvstate->m_wd177x_drq_state = state;
1576   bbc_update_fdq_int(device->machine(), state);
1567   m_wd177x_drq_state = state;
1568   bbc_update_fdq_int(machine(), state);
15771569}
15781570
15791571const wd17xx_interface bbc_wd17xx_interface =
15801572{
15811573   DEVCB_NULL,
1582   DEVCB_LINE(bbc_wd177x_intrq_w),
1583   DEVCB_LINE(bbc_wd177x_drq_w),
1574   DEVCB_DRIVER_LINE_MEMBER(bbc_state,bbc_wd177x_intrq_w),
1575   DEVCB_DRIVER_LINE_MEMBER(bbc_state,bbc_wd177x_drq_w),
15841576   {FLOPPY_0, FLOPPY_1, NULL, NULL}
15851577};
15861578
trunk/src/mess/machine/pc.c
r18257r18258
5353      if(VERBOSE_PIO>=N) \
5454      { \
5555         if( M ) \
56            logerror("%11.6f: %-24s",machine.time().as_double(),(char*)M ); \
56            logerror("%11.6f: %-24s",machine().time().as_double(),(char*)M ); \
5757         logerror A; \
5858      } \
5959   } while (0)
r18257r18258
168168}
169169
170170
171static WRITE_LINE_DEVICE_HANDLER( pc_dma_hrq_changed )
171WRITE_LINE_MEMBER(pc_state::pc_dma_hrq_changed)
172172{
173   pc_state *st = device->machine().driver_data<pc_state>();
174   st->m_maincpu->set_input_line(INPUT_LINE_HALT, state ? ASSERT_LINE : CLEAR_LINE);
173   device_t *device = machine().device("dma8237");
174   m_maincpu->set_input_line(INPUT_LINE_HALT, state ? ASSERT_LINE : CLEAR_LINE);
175175
176176   /* Assert HLDA */
177177   i8237_hlda_w( device, state );
r18257r18258
200200}
201201
202202
203static READ8_DEVICE_HANDLER( pc_dma8237_fdc_dack_r )
203READ8_MEMBER(pc_state::pc_dma8237_fdc_dack_r)
204204{
205   return pc_fdc_dack_r(space.machine(), space);
205   return pc_fdc_dack_r(machine(), space);
206206}
207207
208208
209static READ8_DEVICE_HANDLER( pc_dma8237_hdc_dack_r )
209READ8_MEMBER(pc_state::pc_dma8237_hdc_dack_r)
210210{
211211   return 0xff;
212212}
213213
214214
215static WRITE8_DEVICE_HANDLER( pc_dma8237_fdc_dack_w )
215WRITE8_MEMBER(pc_state::pc_dma8237_fdc_dack_w)
216216{
217   pc_fdc_dack_w( space.machine(), space, data );
217   pc_fdc_dack_w( machine(), space, data );
218218}
219219
220220
221static WRITE8_DEVICE_HANDLER( pc_dma8237_hdc_dack_w )
221WRITE8_MEMBER(pc_state::pc_dma8237_hdc_dack_w)
222222{
223223}
224224
225225
226static WRITE8_DEVICE_HANDLER( pc_dma8237_0_dack_w )
226WRITE8_MEMBER(pc_state::pc_dma8237_0_dack_w)
227227{
228   pc_state *st = space.machine().driver_data<pc_state>();
229   st->m_u73_q2 = 0;
230   i8237_dreq0_w( st->m_dma8237, st->m_u73_q2 );
228   m_u73_q2 = 0;
229   i8237_dreq0_w( m_dma8237, m_u73_q2 );
231230}
232231
233232
234static WRITE_LINE_DEVICE_HANDLER( pc_dma8237_out_eop )
233WRITE_LINE_MEMBER(pc_state::pc_dma8237_out_eop)
235234{
236   pc_fdc_set_tc_state( device->machine(), state == ASSERT_LINE ? 0 : 1 );
235   pc_fdc_set_tc_state( machine(), state == ASSERT_LINE ? 0 : 1 );
237236}
238237
239static void set_dma_channel(device_t *device, int channel, int state)
238static void set_dma_channel(running_machine &machine, int channel, int state)
240239{
241   pc_state *st = device->machine().driver_data<pc_state>();
240   pc_state *st = machine.driver_data<pc_state>();
242241
243242   if (!state) st->m_dma_channel = channel;
244243}
245244
246static WRITE_LINE_DEVICE_HANDLER( pc_dack0_w ) { set_dma_channel(device, 0, state); }
247static WRITE_LINE_DEVICE_HANDLER( pc_dack1_w ) { set_dma_channel(device, 1, state); }
248static WRITE_LINE_DEVICE_HANDLER( pc_dack2_w ) { set_dma_channel(device, 2, state); }
249static WRITE_LINE_DEVICE_HANDLER( pc_dack3_w ) { set_dma_channel(device, 3, state); }
245WRITE_LINE_MEMBER(pc_state::pc_dack0_w){ set_dma_channel(machine(), 0, state); }
246WRITE_LINE_MEMBER(pc_state::pc_dack1_w){ set_dma_channel(machine(), 1, state); }
247WRITE_LINE_MEMBER(pc_state::pc_dack2_w){ set_dma_channel(machine(), 2, state); }
248WRITE_LINE_MEMBER(pc_state::pc_dack3_w){ set_dma_channel(machine(), 3, state); }
250249
251250I8237_INTERFACE( ibm5150_dma8237_config )
252251{
253   DEVCB_DEVICE_LINE("dma8237", pc_dma_hrq_changed),
254   DEVCB_DEVICE_LINE("dma8237", pc_dma8237_out_eop),
252   DEVCB_DRIVER_LINE_MEMBER(pc_state,pc_dma_hrq_changed),
253   DEVCB_DRIVER_LINE_MEMBER(pc_state,pc_dma8237_out_eop),
255254   DEVCB_DRIVER_MEMBER(pc_state, pc_dma_read_byte),
256255   DEVCB_DRIVER_MEMBER(pc_state, pc_dma_write_byte),
257   { DEVCB_NULL, DEVCB_NULL, DEVCB_DEVICE_HANDLER("dma8237", pc_dma8237_fdc_dack_r), DEVCB_DEVICE_HANDLER("dma8237", pc_dma8237_hdc_dack_r) },
258   { DEVCB_DEVICE_HANDLER("dma8237", pc_dma8237_0_dack_w), DEVCB_NULL, DEVCB_DEVICE_HANDLER("dma8237", pc_dma8237_fdc_dack_w), DEVCB_DEVICE_HANDLER("dma8237", pc_dma8237_hdc_dack_w) },
259   { DEVCB_DEVICE_LINE("dma8237", pc_dack0_w), DEVCB_DEVICE_LINE("dma8237", pc_dack1_w), DEVCB_DEVICE_LINE("dma8237", pc_dack2_w), DEVCB_DEVICE_LINE("dma8237", pc_dack3_w) }
256   { DEVCB_NULL, DEVCB_NULL, DEVCB_DRIVER_MEMBER(pc_state,pc_dma8237_fdc_dack_r), DEVCB_DRIVER_MEMBER(pc_state, pc_dma8237_hdc_dack_r) },
257   { DEVCB_DRIVER_MEMBER(pc_state, pc_dma8237_0_dack_w), DEVCB_NULL, DEVCB_DRIVER_MEMBER(pc_state,pc_dma8237_fdc_dack_w), DEVCB_DRIVER_MEMBER(pc_state, pc_dma8237_hdc_dack_w) },
258   { DEVCB_DRIVER_LINE_MEMBER(pc_state,pc_dack0_w), DEVCB_DRIVER_LINE_MEMBER(pc_state, pc_dack1_w), DEVCB_DRIVER_LINE_MEMBER(pc_state, pc_dack2_w), DEVCB_DRIVER_LINE_MEMBER(pc_state, pc_dack3_w) }
260259};
261260
262261
r18257r18258
296295    machine().firstcpu->set_input_line(0, param ? ASSERT_LINE : CLEAR_LINE);
297296}
298297
299static WRITE_LINE_DEVICE_HANDLER( pcjr_pic8259_set_int_line )
298WRITE_LINE_MEMBER(pc_state::pcjr_pic8259_set_int_line)
300299{
301   if ( device->machine().firstcpu->pc() == 0xF0454 )
300   if ( machine().firstcpu->pc() == 0xF0454 )
302301   {
303      pc_int_delay_timer->adjust( device->machine().firstcpu->cycles_to_attotime(1), state );
302      pc_int_delay_timer->adjust( machine().firstcpu->cycles_to_attotime(1), state );
304303   }
305304   else
306305   {
307      device->machine().firstcpu->set_input_line(0, state ? ASSERT_LINE : CLEAR_LINE);
306      machine().firstcpu->set_input_line(0, state ? ASSERT_LINE : CLEAR_LINE);
308307   }
309308}
310309
311310const struct pic8259_interface pcjr_pic8259_config =
312311{
313   DEVCB_LINE(pcjr_pic8259_set_int_line),
312   DEVCB_DRIVER_LINE_MEMBER(pc_state,pcjr_pic8259_set_int_line),
314313   DEVCB_LINE_VCC,
315314   DEVCB_NULL
316315};
r18257r18258
352351 *
353352 *************************************************************/
354353
355static WRITE_LINE_DEVICE_HANDLER( ibm5150_pit8253_out1_changed )
354WRITE_LINE_MEMBER(pc_state::ibm5150_pit8253_out1_changed)
356355{
357   pc_state *st = device->machine().driver_data<pc_state>();
358356   /* Trigger DMA channel #0 */
359   if ( st->m_out1 == 0 && state == 1 && st->m_u73_q2 == 0 )
357   if ( m_out1 == 0 && state == 1 && m_u73_q2 == 0 )
360358   {
361      st->m_u73_q2 = 1;
362      i8237_dreq0_w( st->m_dma8237, st->m_u73_q2 );
359      m_u73_q2 = 1;
360      i8237_dreq0_w( m_dma8237, m_u73_q2 );
363361   }
364   st->m_out1 = state;
362   m_out1 = state;
365363}
366364
367365
368static WRITE_LINE_DEVICE_HANDLER( ibm5150_pit8253_out2_changed )
366WRITE_LINE_MEMBER(pc_state::ibm5150_pit8253_out2_changed)
369367{
370   pc_speaker_set_input( device->machine(), state );
368   pc_speaker_set_input( machine(), state );
371369}
372370
373371
r18257r18258
381379      }, {
382380         XTAL_14_31818MHz/12,            /* dram refresh */
383381         DEVCB_NULL,
384         DEVCB_LINE(ibm5150_pit8253_out1_changed)
382         DEVCB_DRIVER_LINE_MEMBER(pc_state,ibm5150_pit8253_out1_changed)
385383      }, {
386384         XTAL_14_31818MHz/12,            /* pio port c pin 4, and speaker polling enough */
387385         DEVCB_NULL,
388         DEVCB_LINE(ibm5150_pit8253_out2_changed)
386         DEVCB_DRIVER_LINE_MEMBER(pc_state,ibm5150_pit8253_out2_changed)
389387      }
390388   }
391389};
r18257r18258
411409      }, {
412410         XTAL_14_31818MHz/12,              /* pio port c pin 4, and speaker polling enough */
413411         DEVCB_NULL,
414         DEVCB_LINE(ibm5150_pit8253_out2_changed)
412         DEVCB_DRIVER_LINE_MEMBER(pc_state,ibm5150_pit8253_out2_changed)
415413      }
416414   }
417415};
r18257r18258
432430      }, {
433431         XTAL_16MHz/12,              /* pio port c pin 4, and speaker polling enough */
434432         DEVCB_NULL,
435         DEVCB_LINE(ibm5150_pit8253_out2_changed)
433         DEVCB_DRIVER_LINE_MEMBER(pc_state,ibm5150_pit8253_out2_changed)
436434      }
437435   }
438436};
r18257r18258
444442 **********************************************************/
445443
446444/* called when a interrupt is set/cleared from com hardware */
447static WRITE_LINE_DEVICE_HANDLER( pc_com_interrupt_1 )
445WRITE_LINE_MEMBER(pc_state::pc_com_interrupt_1)
448446{
449   pc_state *st = device->machine().driver_data<pc_state>();
450   pic8259_ir4_w(st->m_pic8259, state);
447   pic8259_ir4_w(m_pic8259, state);
451448}
452449
453static WRITE_LINE_DEVICE_HANDLER( pc_com_interrupt_2 )
450WRITE_LINE_MEMBER(pc_state::pc_com_interrupt_2)
454451{
455   pc_state *st = device->machine().driver_data<pc_state>();
456   pic8259_ir3_w(st->m_pic8259, state);
452   pic8259_ir3_w(m_pic8259, state);
457453}
458454
459455const ins8250_interface ibm5150_com_interface[4]=
r18257r18258
462458      DEVCB_DEVICE_LINE_MEMBER("serport0", serial_port_device, tx),
463459      DEVCB_DEVICE_LINE_MEMBER("serport0", rs232_port_device, dtr_w),
464460      DEVCB_DEVICE_LINE_MEMBER("serport0", rs232_port_device, rts_w),
465      DEVCB_LINE(pc_com_interrupt_1),
461      DEVCB_DRIVER_LINE_MEMBER(pc_state,pc_com_interrupt_1),
466462      DEVCB_NULL,
467463      DEVCB_NULL
468464   },
r18257r18258
470466      DEVCB_DEVICE_LINE_MEMBER("serport1", serial_port_device, tx),
471467      DEVCB_DEVICE_LINE_MEMBER("serport1", rs232_port_device, dtr_w),
472468      DEVCB_DEVICE_LINE_MEMBER("serport1", rs232_port_device, rts_w),
473      DEVCB_LINE(pc_com_interrupt_2),
469      DEVCB_DRIVER_LINE_MEMBER(pc_state,pc_com_interrupt_2),
474470      DEVCB_NULL,
475471      DEVCB_NULL
476472   },
r18257r18258
478474      DEVCB_DEVICE_LINE_MEMBER("serport2", serial_port_device, tx),
479475      DEVCB_DEVICE_LINE_MEMBER("serport2", rs232_port_device, dtr_w),
480476      DEVCB_DEVICE_LINE_MEMBER("serport2", rs232_port_device, rts_w),
481      DEVCB_LINE(pc_com_interrupt_1),
477      DEVCB_DRIVER_LINE_MEMBER(pc_state,pc_com_interrupt_1),
482478      DEVCB_NULL,
483479      DEVCB_NULL
484480   },
r18257r18258
486482      DEVCB_DEVICE_LINE_MEMBER("serport3", serial_port_device, tx),
487483      DEVCB_DEVICE_LINE_MEMBER("serport3", rs232_port_device, dtr_w),
488484      DEVCB_DEVICE_LINE_MEMBER("serport3", rs232_port_device, rts_w),
489      DEVCB_LINE(pc_com_interrupt_2),
485      DEVCB_DRIVER_LINE_MEMBER(pc_state,pc_com_interrupt_2),
490486      DEVCB_NULL,
491487      DEVCB_NULL
492488   }
r18257r18258
756752}
757753
758754
759static READ8_DEVICE_HANDLER (ibm5160_ppi_porta_r)
755READ8_MEMBER(pc_state::ibm5160_ppi_porta_r)
760756{
761757   int data = 0xFF;
762   running_machine &machine = space.machine();
763   pc_state *st = space.machine().driver_data<pc_state>();
764
765758   /* KB port A */
766   if (st->m_ppi_keyboard_clear)
759   if (m_ppi_keyboard_clear)
767760   {
768761      /*   0  0 - no floppy drives
769762         *   1  Not used
r18257r18258
774767         *      01 - color 40x25
775768         * 6-7  The number of floppy disk drives
776769         */
777      data = space.machine().root_device().ioport("DSW0")->read();
770      data = machine().root_device().ioport("DSW0")->read();
778771   }
779772   else
780773   {
781      data = st->m_ppi_shift_register;
774      data = m_ppi_shift_register;
782775   }
783776    PIO_LOG(1,"PIO_A_r",("$%02x\n", data));
784777    return data;
785778}
786779
787780
788static READ8_DEVICE_HANDLER ( ibm5160_ppi_portc_r )
781READ8_MEMBER(pc_state::ibm5160_ppi_portc_r)
789782{
790   pc_state *st = space.machine().driver_data<pc_state>();
791   int timer2_output = pit8253_get_output( st->m_pit8253, 2 );
783   int timer2_output = pit8253_get_output( m_pit8253, 2 );
792784   int data=0xff;
793   running_machine &machine = space.machine();
794785
795786   data&=~0x80; // no parity error
796787   data&=~0x40; // no error on expansion board
797788   /* KB port C: equipment flags */
798789//  if (pc_port[0x61] & 0x08)
799   if (st->m_ppi_portc_switch_high)
790   if (m_ppi_portc_switch_high)
800791   {
801792      /* read hi nibble of S2 */
802      data = (data & 0xf0) | ((space.machine().root_device().ioport("DSW0")->read() >> 4) & 0x0f);
793      data = (data & 0xf0) | ((machine().root_device().ioport("DSW0")->read() >> 4) & 0x0f);
803794      PIO_LOG(1,"PIO_C_r (hi)",("$%02x\n", data));
804795   }
805796   else
806797   {
807798      /* read lo nibble of S2 */
808      data = (data & 0xf0) | (space.machine().root_device().ioport("DSW0")->read() & 0x0f);
799      data = (data & 0xf0) | (machine().root_device().ioport("DSW0")->read() & 0x0f);
809800      PIO_LOG(1,"PIO_C_r (lo)",("$%02x\n", data));
810801   }
811802
812   if ( st->m_ppi_portb & 0x01 )
803   if ( m_ppi_portb & 0x01 )
813804   {
814805      data = ( data & ~0x10 ) | ( timer2_output ? 0x10 : 0x00 );
815806   }
r18257r18258
819810}
820811
821812
822static WRITE8_DEVICE_HANDLER( ibm5160_ppi_portb_w )
813WRITE8_MEMBER(pc_state::ibm5160_ppi_portb_w)
823814{
824   pc_state *st = space.machine().driver_data<pc_state>();
825
826815   /* PPI controller port B*/
827   st->m_ppi_portb = data;
828   st->m_ppi_portc_switch_high = data & 0x08;
829   st->m_ppi_keyboard_clear = data & 0x80;
830   st->m_ppi_keyb_clock = data & 0x40;
831   pit8253_gate2_w(st->m_pit8253, BIT(data, 0));
832   pc_speaker_set_spkrdata( space.machine(), data & 0x02 );
816   m_ppi_portb = data;
817   m_ppi_portc_switch_high = data & 0x08;
818   m_ppi_keyboard_clear = data & 0x80;
819   m_ppi_keyb_clock = data & 0x40;
820   pit8253_gate2_w(m_pit8253, BIT(data, 0));
821   pc_speaker_set_spkrdata( machine(), data & 0x02 );
833822
834   st->m_ppi_clock_signal = ( st->m_ppi_keyb_clock ) ? 1 : 0;
835   st->m_pc_kbdc->clock_write_from_mb(st->m_ppi_clock_signal);
823   m_ppi_clock_signal = ( m_ppi_keyb_clock ) ? 1 : 0;
824   m_pc_kbdc->clock_write_from_mb(m_ppi_clock_signal);
836825
837826   /* If PB7 is set clear the shift register and reset the IRQ line */
838   if ( st->m_ppi_keyboard_clear )
827   if ( m_ppi_keyboard_clear )
839828   {
840      pic8259_ir1_w(st->m_pic8259, 0);
841      st->m_ppi_shift_register = 0;
842      st->m_ppi_shift_enable = 1;
829      pic8259_ir1_w(m_pic8259, 0);
830      m_ppi_shift_register = 0;
831      m_ppi_shift_enable = 1;
843832   }
844833}
845834
846835
847836I8255_INTERFACE( ibm5160_ppi8255_interface )
848837{
849   DEVCB_HANDLER(ibm5160_ppi_porta_r),
838   DEVCB_DRIVER_MEMBER(pc_state,ibm5160_ppi_porta_r),
850839   DEVCB_NULL,
851840   DEVCB_NULL,
852   DEVCB_HANDLER(ibm5160_ppi_portb_w),
853   DEVCB_HANDLER(ibm5160_ppi_portc_r),
841   DEVCB_DRIVER_MEMBER(pc_state,ibm5160_ppi_portb_w),
842   DEVCB_DRIVER_MEMBER(pc_state,ibm5160_ppi_portc_r),
854843   DEVCB_NULL
855844};
856845
857846
858static READ8_DEVICE_HANDLER (pc_ppi_porta_r)
847READ8_MEMBER(pc_state::pc_ppi_porta_r)
859848{
860849   int data = 0xFF;
861   running_machine &machine = space.machine();
862   pc_state *st = space.machine().driver_data<pc_state>();
863850
864851   /* KB port A */
865   if (st->m_ppi_keyboard_clear)
852   if (m_ppi_keyboard_clear)
866853   {
867854      /*   0  0 - no floppy drives
868855         *   1  Not used
r18257r18258
873860         *      01 - color 40x25
874861         * 6-7  The number of floppy disk drives
875862         */
876      data = space.machine().root_device().ioport("DSW0")->read();
863      data = machine().root_device().ioport("DSW0")->read();
877864   }
878865   else
879866   {
r18257r18258
884871}
885872
886873
887static WRITE8_DEVICE_HANDLER( pc_ppi_portb_w )
874WRITE8_MEMBER(pc_state::pc_ppi_portb_w)
888875{
889   pc_state *st = space.machine().driver_data<pc_state>();
890876   /* PPI controller port B*/
891   st->m_ppi_portb = data;
892   st->m_ppi_portc_switch_high = data & 0x08;
893   st->m_ppi_keyboard_clear = data & 0x80;
894   st->m_ppi_keyb_clock = data & 0x40;
895   pit8253_gate2_w(st->m_pit8253, BIT(data, 0));
896   pc_speaker_set_spkrdata( space.machine(), data & 0x02 );
897   pc_keyb_set_clock( st->m_ppi_keyb_clock );
877   m_ppi_portb = data;
878   m_ppi_portc_switch_high = data & 0x08;
879   m_ppi_keyboard_clear = data & 0x80;
880   m_ppi_keyb_clock = data & 0x40;
881   pit8253_gate2_w(m_pit8253, BIT(data, 0));
882   pc_speaker_set_spkrdata( machine(), data & 0x02 );
883   pc_keyb_set_clock( m_ppi_keyb_clock );
898884
899   if ( st->m_ppi_keyboard_clear )
885   if ( m_ppi_keyboard_clear )
900886      pc_keyb_clear();
901887}
902888
903889
904890I8255_INTERFACE( pc_ppi8255_interface )
905891{
906   DEVCB_HANDLER(pc_ppi_porta_r),
892   DEVCB_DRIVER_MEMBER(pc_state,pc_ppi_porta_r),
907893   DEVCB_NULL,
908894   DEVCB_NULL,
909   DEVCB_HANDLER(pc_ppi_portb_w),
910   DEVCB_HANDLER(ibm5160_ppi_portc_r),
895   DEVCB_DRIVER_MEMBER(pc_state,pc_ppi_portb_w),
896   DEVCB_DRIVER_MEMBER(pc_state,ibm5160_ppi_portc_r),
911897   DEVCB_NULL
912898};
913899
r18257r18258
958944   }
959945}
960946
961static READ8_DEVICE_HANDLER ( mc1502_ppi_porta_r )
947READ8_MEMBER(pc_state::mc1502_ppi_porta_r)
962948{
963   running_machine &machine = space.machine();
964
965   DBG_LOG(1,"mc1502_ppi_porta_r",("= %02X\n", mc1502_keyb.latch));
949//   DBG_LOG(1,"mc1502_ppi_porta_r",("= %02X\n", mc1502_keyb.latch));
966950   return mc1502_keyb.latch;
967951}
968952
969static WRITE8_DEVICE_HANDLER ( mc1502_ppi_porta_w )
953WRITE8_MEMBER(pc_state::mc1502_ppi_porta_w)
970954{
971   pc_state *st = space.machine().driver_data<pc_state>();
972   running_machine &machine = space.machine();
973
974   DBG_LOG(1,"mc1502_ppi_porta_w",("( %02X )\n", data));
955//   DBG_LOG(1,"mc1502_ppi_porta_w",("( %02X )\n", data));
975956   mc1502_keyb.latch = data;
976957   if (mc1502_keyb.pulsing)
977958      mc1502_keyb.pulsing--;
978   pic8259_ir1_w(st->m_pic8259, 0);
959   pic8259_ir1_w(m_pic8259, 0);
979960}
980961
981static WRITE8_DEVICE_HANDLER ( mc1502_ppi_portb_w )
962WRITE8_MEMBER(pc_state::mc1502_ppi_portb_w)
982963{
983   pc_state *st = space.machine().driver_data<pc_state>();
984   running_machine &machine = space.machine();
985
986   DBG_LOG(2,"mc1502_ppi_portb_w",("( %02X )\n", data));
987   st->m_ppi_portb = data;
988   pit8253_gate2_w(space.machine().device("pit8253"), BIT(data, 0));
989   pc_speaker_set_spkrdata( space.machine(), data & 0x02 );
964//   DBG_LOG(2,"mc1502_ppi_portb_w",("( %02X )\n", data));
965   m_ppi_portb = data;
966   pit8253_gate2_w(machine().device("pit8253"), BIT(data, 0));
967   pc_speaker_set_spkrdata( machine(), data & 0x02 );
990968}
991969
992static READ8_DEVICE_HANDLER ( mc1502_ppi_portc_r )
970READ8_MEMBER(pc_state::mc1502_ppi_portc_r)
993971{
994   running_machine &machine = space.machine();
995   pc_state *st = space.machine().driver_data<pc_state>();
996   int timer2_output = pit8253_get_output( space.machine().device("pit8253"), 2 );
972   int timer2_output = pit8253_get_output( machine().device("pit8253"), 2 );
997973   int data = 0xff;
998   double tap_val = (space.machine().device<cassette_image_device>(CASSETTE_TAG)->input());
974   double tap_val = (machine().device<cassette_image_device>(CASSETTE_TAG)->input());
999975
1000976//  0x80 -- serial RxD
1001977//  0x40 -- CASS IN, also loops back T2OUT (gated by CASWR)
1002   data = ( data & ~0x40 ) | ( tap_val < 0 ? 0x40 : 0x00 ) | ( (BIT(st->m_ppi_portb, 7) && timer2_output) ? 0x40 : 0x00 );
978   data = ( data & ~0x40 ) | ( tap_val < 0 ? 0x40 : 0x00 ) | ( (BIT(m_ppi_portb, 7) && timer2_output) ? 0x40 : 0x00 );
1003979//  0x20 -- T2OUT
1004980   data = ( data & ~0x20 ) | ( timer2_output ? 0x20 : 0x00 );
1005981//  0x10 -- SNDOUT
1006   data = ( data & ~0x10 ) | ( (BIT(st->m_ppi_portb, 1) && timer2_output) ? 0x10 : 0x00 );
982   data = ( data & ~0x10 ) | ( (BIT(m_ppi_portb, 1) && timer2_output) ? 0x10 : 0x00 );
1007983
1008   DBG_LOG(2,"mc1502_ppi_portc_r",("= %02X (tap_val %f t2out %d) at %s\n",
1009      data, tap_val, timer2_output, machine.describe_context()));
984//   DBG_LOG(2,"mc1502_ppi_portc_r",("= %02X (tap_val %f t2out %d) at %s\n",
985//      data, tap_val, timer2_output, machine().describe_context()));
1010986   return data;
1011987}
1012988
1013static READ8_DEVICE_HANDLER ( mc1502_kppi_porta_r )
989READ8_MEMBER(pc_state::mc1502_kppi_porta_r)
1014990{
1015   running_machine &machine = space.machine();
1016991   UINT8 key = 0;
1017992
1018   if (mc1502_keyb.mask & 0x0001) { key |= machine.root_device().ioport("Y1")->read(); }
1019   if (mc1502_keyb.mask & 0x0002) { key |= machine.root_device().ioport("Y2")->read(); }
1020   if (mc1502_keyb.mask & 0x0004) { key |= machine.root_device().ioport("Y3")->read(); }
1021   if (mc1502_keyb.mask & 0x0008) { key |= machine.root_device().ioport("Y4")->read(); }
1022   if (mc1502_keyb.mask & 0x0010) { key |= machine.root_device().ioport("Y5")->read(); }
1023   if (mc1502_keyb.mask & 0x0020) { key |= machine.root_device().ioport("Y6")->read(); }
1024   if (mc1502_keyb.mask & 0x0040) { key |= machine.root_device().ioport("Y7")->read(); }
1025   if (mc1502_keyb.mask & 0x0080) { key |= machine.root_device().ioport("Y8")->read(); }
1026   if (mc1502_keyb.mask & 0x0100) { key |= machine.root_device().ioport("Y9")->read(); }
1027   if (mc1502_keyb.mask & 0x0200) { key |= machine.root_device().ioport("Y10")->read(); }
1028   if (mc1502_keyb.mask & 0x0400) { key |= machine.root_device().ioport("Y11")->read(); }
1029   if (mc1502_keyb.mask & 0x0800) { key |= machine.root_device().ioport("Y12")->read(); }
993   if (mc1502_keyb.mask & 0x0001) { key |= machine().root_device().ioport("Y1")->read(); }
994   if (mc1502_keyb.mask & 0x0002) { key |= machine().root_device().ioport("Y2")->read(); }
995   if (mc1502_keyb.mask & 0x0004) { key |= machine().root_device().ioport("Y3")->read(); }
996   if (mc1502_keyb.mask & 0x0008) { key |= machine().root_device().ioport("Y4")->read(); }
997   if (mc1502_keyb.mask & 0x0010) { key |= machine().root_device().ioport("Y5")->read(); }
998   if (mc1502_keyb.mask & 0x0020) { key |= machine().root_device().ioport("Y6")->read(); }
999   if (mc1502_keyb.mask & 0x0040) { key |= machine().root_device().ioport("Y7")->read(); }
1000   if (mc1502_keyb.mask & 0x0080) { key |= machine().root_device().ioport("Y8")->read(); }
1001   if (mc1502_keyb.mask & 0x0100) { key |= machine().root_device().ioport("Y9")->read(); }
1002   if (mc1502_keyb.mask & 0x0200) { key |= machine().root_device().ioport("Y10")->read(); }
1003   if (mc1502_keyb.mask & 0x0400) { key |= machine().root_device().ioport("Y11")->read(); }
1004   if (mc1502_keyb.mask & 0x0800) { key |= machine().root_device().ioport("Y12")->read(); }
10301005   key ^= 0xff;
1031   DBG_LOG(2,"mc1502_kppi_porta_r",("= %02X\n", key));
1006//   DBG_LOG(2,"mc1502_kppi_porta_r",("= %02X\n", key));
10321007   return key;
10331008}
10341009
1035static WRITE8_DEVICE_HANDLER ( mc1502_kppi_portb_w )
1010WRITE8_MEMBER(pc_state::mc1502_kppi_portb_w)
10361011{
1037   running_machine &machine = space.machine();
1038
10391012   mc1502_keyb.mask &= ~255;
10401013   mc1502_keyb.mask |= data ^ 255;
10411014   if (!BIT(data, 0))
10421015      mc1502_keyb.mask |= 1 << 11;
10431016   else
10441017      mc1502_keyb.mask &= ~(1 << 11);
1045   DBG_LOG(2,"mc1502_kppi_portb_w",("( %02X -> %04X )\n", data, mc1502_keyb.mask));
1018//   DBG_LOG(2,"mc1502_kppi_portb_w",("( %02X -> %04X )\n", data, mc1502_keyb.mask));
10461019}
10471020
1048static WRITE8_DEVICE_HANDLER ( mc1502_kppi_portc_w )
1021WRITE8_MEMBER(pc_state::mc1502_kppi_portc_w)
10491022{
1050   running_machine &machine = space.machine();
1051
10521023   mc1502_keyb.mask &= ~(7 << 8);
10531024   mc1502_keyb.mask |= ((data ^ 7) & 7) << 8;
1054   DBG_LOG(2,"mc1502_kppi_portc_w",("( %02X -> %04X )\n", data, mc1502_keyb.mask));
1025//   DBG_LOG(2,"mc1502_kppi_portc_w",("( %02X -> %04X )\n", data, mc1502_keyb.mask));
10551026}
10561027
10571028
1058static WRITE8_DEVICE_HANDLER ( pcjr_ppi_portb_w )
1029WRITE8_MEMBER(pc_state::pcjr_ppi_portb_w)
10591030{
1060   pc_state *st = space.machine().driver_data<pc_state>();
10611031   /* KB controller port B */
1062   st->m_ppi_portb = data;
1063   st->m_ppi_portc_switch_high = data & 0x08;
1064   pit8253_gate2_w(space.machine().device("pit8253"), BIT(data, 0));
1065   pc_speaker_set_spkrdata( space.machine(), data & 0x02 );
1032   m_ppi_portb = data;
1033   m_ppi_portc_switch_high = data & 0x08;
1034   pit8253_gate2_w(machine().device("pit8253"), BIT(data, 0));
1035   pc_speaker_set_spkrdata( machine(), data & 0x02 );
10661036
1067   space.machine().device<cassette_image_device>(CASSETTE_TAG)->change_state(( data & 0x08 ) ? CASSETTE_MOTOR_DISABLED : CASSETTE_MOTOR_ENABLED,CASSETTE_MASK_MOTOR);
1037   machine().device<cassette_image_device>(CASSETTE_TAG)->change_state(( data & 0x08 ) ? CASSETTE_MOTOR_DISABLED : CASSETTE_MOTOR_ENABLED,CASSETTE_MASK_MOTOR);
10681038}
10691039
10701040
10711041/*
10721042 * On a PCJR none of the port A bits are connected.
10731043 */
1074static READ8_DEVICE_HANDLER (pcjr_ppi_porta_r )
1044READ8_MEMBER(pc_state::pcjr_ppi_porta_r)
10751045{
10761046   int data;
1077   running_machine &machine = space.machine();
10781047
10791048   data = 0xff;
10801049   PIO_LOG(1,"PIO_A_r",("$%02x\n", data));
r18257r18258
10931062 * PC6 - KYBD IN
10941063 * PC7 - (keyboard) CABLE CONNECTED
10951064 */
1096static READ8_DEVICE_HANDLER ( pcjr_ppi_portc_r )
1065READ8_MEMBER(pc_state::pcjr_ppi_portc_r)
10971066{
1098   pc_state *st = space.machine().driver_data<pc_state>();
1099   int timer2_output = pit8253_get_output( space.machine().device("pit8253"), 2 );
1067   int timer2_output = pit8253_get_output( machine().device("pit8253"), 2 );
11001068   int data=0xff;
11011069
11021070   data&=~0x80;
11031071   data &= ~0x04;      /* floppy drive installed */
1104   if ( space.machine().device<ram_device>(RAM_TAG)->size() > 64 * 1024 )   /* more than 64KB ram installed */
1072   if ( machine().device<ram_device>(RAM_TAG)->size() > 64 * 1024 )   /* more than 64KB ram installed */
11051073      data &= ~0x08;
11061074   data = ( data & ~0x01 ) | ( pcjr_keyb.latch ? 0x01: 0x00 );
1107   if ( ! ( st->m_ppi_portb & 0x08 ) )
1075   if ( ! ( m_ppi_portb & 0x08 ) )
11081076   {
1109      double tap_val = (space.machine().device<cassette_image_device>(CASSETTE_TAG)->input());
1077      double tap_val = (machine().device<cassette_image_device>(CASSETTE_TAG)->input());
11101078
11111079      if ( tap_val < 0 )
11121080      {
r18257r18258
11191087   }
11201088   else
11211089   {
1122      if ( st->m_ppi_portb & 0x01 )
1090      if ( m_ppi_portb & 0x01 )
11231091      {
11241092         data = ( data & ~0x10 ) | ( timer2_output ? 0x10 : 0x00 );
11251093      }
r18257r18258
11331101
11341102I8255_INTERFACE( pcjr_ppi8255_interface )
11351103{
1136   DEVCB_HANDLER(pcjr_ppi_porta_r),
1104   DEVCB_DRIVER_MEMBER(pc_state,pcjr_ppi_porta_r),
11371105   DEVCB_NULL,
11381106   DEVCB_NULL,
1139   DEVCB_HANDLER(pcjr_ppi_portb_w),
1140   DEVCB_HANDLER(pcjr_ppi_portc_r),
1107   DEVCB_DRIVER_MEMBER(pc_state,pcjr_ppi_portb_w),
1108   DEVCB_DRIVER_MEMBER(pc_state,pcjr_ppi_portc_r),
11411109   DEVCB_NULL
11421110};
11431111
11441112I8255_INTERFACE( mc1502_ppi8255_interface )
11451113{
1146   DEVCB_HANDLER(mc1502_ppi_porta_r),
1147   DEVCB_HANDLER(mc1502_ppi_porta_w),
1114   DEVCB_DRIVER_MEMBER(pc_state,mc1502_ppi_porta_r),
1115   DEVCB_DRIVER_MEMBER(pc_state,mc1502_ppi_porta_w),
11481116   DEVCB_NULL,
1149   DEVCB_HANDLER(mc1502_ppi_portb_w),
1150   DEVCB_HANDLER(mc1502_ppi_portc_r),
1117   DEVCB_DRIVER_MEMBER(pc_state,mc1502_ppi_portb_w),
1118   DEVCB_DRIVER_MEMBER(pc_state,mc1502_ppi_portc_r),
11511119   DEVCB_NULL
11521120};
11531121
11541122I8255_INTERFACE( mc1502_ppi8255_interface_2 )
11551123{
1156   DEVCB_HANDLER(mc1502_kppi_porta_r),
1124   DEVCB_DRIVER_MEMBER(pc_state,mc1502_kppi_porta_r),
11571125   DEVCB_NULL,
11581126   DEVCB_NULL,
1159   DEVCB_HANDLER(mc1502_kppi_portb_w),
1127   DEVCB_DRIVER_MEMBER(pc_state,mc1502_kppi_portb_w),
11601128   DEVCB_NULL,
1161   DEVCB_HANDLER(mc1502_kppi_portc_w)
1129   DEVCB_DRIVER_MEMBER(pc_state,mc1502_kppi_portc_w)
11621130};
11631131
11641132
r18257r18258
12321200 * MC1502 uses a FD1793 clone instead of uPD765
12331201 */
12341202
1235READ8_DEVICE_HANDLER( mc1502_wd17xx_aux_r )
1203READ8_MEMBER(pc_state::mc1502_wd17xx_aux_r)
12361204{
12371205   UINT8 data;
12381206
r18257r18258
12411209   return data;
12421210}
12431211
1244WRITE8_DEVICE_HANDLER( mc1502_wd17xx_aux_w )
1212WRITE8_MEMBER(pc_state::mc1502_wd17xx_aux_w)
12451213{
12461214   // master reset
1247   wd17xx_mr_w(device, BIT(data, 0));
1215   wd17xx_mr_w(machine().device("vg93"), BIT(data, 0));
12481216
12491217   // SIDE ONE
1250   wd17xx_set_side(device, BIT(data, 1));
1218   wd17xx_set_side(machine().device("vg93"), BIT(data, 1));
12511219
12521220   // bits 2, 3 -- motor on (drive 0, 1)
12531221
12541222   // DRIVE SEL
1255   wd17xx_set_drive(device, BIT(data, 4));
1223   wd17xx_set_drive(machine().device("vg93"), BIT(data, 4));
12561224}
12571225
12581226/*
12591227 * Accesses to this port block (halt the CPU until DRQ, INTRQ or MOTOR ON)
12601228 */
1261READ8_DEVICE_HANDLER( mc1502_wd17xx_drq_r )
1229READ8_MEMBER(pc_state::mc1502_wd17xx_drq_r)
12621230{
12631231   UINT8 data;
12641232   UINT64 newpc;
12651233
1266   data = wd17xx_drq_r(device);
1267   if (!data && !wd17xx_intrq_r(device)) {
1234   data = wd17xx_drq_r(machine().device("vg93"));
1235   if (!data && !wd17xx_intrq_r(machine().device("vg93"))) {
12681236      /* fake cpu halt by resetting PC one insn back */
1269      newpc = space.machine().firstcpu->pc();
1270      space.machine().firstcpu->set_pc( newpc - 1 );
1237      newpc = machine().firstcpu->pc();
1238      machine().firstcpu->set_pc( newpc - 1 );
12711239   }
12721240
12731241   return data;
12741242}
12751243
1276READ8_DEVICE_HANDLER( mc1502_wd17xx_motor_r )
1244READ8_MEMBER(pc_state::mc1502_wd17xx_motor_r)
12771245{
12781246   UINT8 data;
12791247
trunk/src/mess/machine/mc80.c
r18257r18258
3131{
3232}
3333
34static WRITE_LINE_DEVICE_HANDLER( ctc_z2_w )
34WRITE_LINE_MEMBER(mc80_state::ctc_z2_w)
3535{
36   downcast<z80ctc_device *>(device)->trg0(state);
37   downcast<z80ctc_device *>(device)->trg1(state);
36   downcast<z80ctc_device *>(machine().device("z80ctc"))->trg0(state);
37   downcast<z80ctc_device *>(machine().device("z80ctc"))->trg1(state);
3838}
3939
4040Z80CTC_INTERFACE( mc8020_ctc_intf )
r18257r18258
4242   DEVCB_CPU_INPUT_LINE("maincpu", INPUT_LINE_IRQ0),
4343   DEVCB_DRIVER_LINE_MEMBER(mc80_state, ctc_z0_w),
4444   DEVCB_DRIVER_LINE_MEMBER(mc80_state, ctc_z1_w),
45   DEVCB_LINE(ctc_z2_w)
45   DEVCB_DRIVER_LINE_MEMBER(mc80_state,ctc_z2_w)
4646};
4747
4848
trunk/src/mess/machine/c65.c
r18257r18258
7070 *  see machine/cbm.c
7171 */
7272
73static READ8_DEVICE_HANDLER( c65_cia0_port_a_r )
73READ8_MEMBER(c65_state::c65_cia0_port_a_r)
7474{
75   UINT8 cia0portb = mos6526_pb_r(space.machine().device("cia_0"), space, 0);
75   UINT8 cia0portb = mos6526_pb_r(machine().device("cia_0"), space, 0);
7676
77   return cbm_common_cia0_port_a_r(device, cia0portb);
77   return cbm_common_cia0_port_a_r(machine().device("cia_0"), cia0portb);
7878}
7979
80static READ8_DEVICE_HANDLER( c65_cia0_port_b_r )
80READ8_MEMBER(c65_state::c65_cia0_port_b_r)
8181{
82   c65_state *state = space.machine().driver_data<c65_state>();
8382   UINT8 value = 0xff;
84   UINT8 cia0porta = mos6526_pa_r(space.machine().device("cia_0"), space, 0);
83   UINT8 cia0porta = mos6526_pa_r(machine().device("cia_0"), space, 0);
8584
86   value &= cbm_common_cia0_port_b_r(device, cia0porta);
85   value &= cbm_common_cia0_port_b_r(machine().device("cia_0"), cia0porta);
8786
88   if (!(state->m_6511_port & 0x02))
89      value &= state->m_keyline;
87   if (!(m_6511_port & 0x02))
88      value &= m_keyline;
9089
9190   return value;
9291}
9392
94static WRITE8_DEVICE_HANDLER( c65_cia0_port_b_w )
93WRITE8_MEMBER(c65_state::c65_cia0_port_b_w)
9594{
9695//  was there lightpen support in c65 video chip?
97//  device_t *vic3 = space.machine().device("vic3");
96//  device_t *vic3 = machine().device("vic3");
9897//  vic3_lightpen_write(vic3, data & 0x10);
9998}
10099
r18257r18258
136135   DEVCB_NULL,   /* pc_func */
137136   DEVCB_NULL,
138137   DEVCB_NULL,
139   DEVCB_HANDLER(c65_cia0_port_a_r),
138   DEVCB_DRIVER_MEMBER(c65_state,c65_cia0_port_a_r),
140139   DEVCB_NULL,
141   DEVCB_HANDLER(c65_cia0_port_b_r),
142   DEVCB_HANDLER(c65_cia0_port_b_w)
140   DEVCB_DRIVER_MEMBER(c65_state,c65_cia0_port_b_r),
141   DEVCB_DRIVER_MEMBER(c65_state,c65_cia0_port_b_w)
143142};
144143
145144/*
r18257r18258
165164 * flag restore key or rs232 received data input
166165 * irq to nmi connected ?
167166 */
168static READ8_DEVICE_HANDLER( c65_cia1_port_a_r )
167READ8_MEMBER(c65_state::c65_cia1_port_a_r)
169168{
170   c65_state *state = space.machine().driver_data<c65_state>();
171169   UINT8 value = 0xff;
172170
173   if (!state->m_iec->clk_r())
171   if (!m_iec->clk_r())
174172      value &= ~0x40;
175173
176   if (!state->m_iec->data_r())
174   if (!m_iec->data_r())
177175      value &= ~0x80;
178176
179177   return value;
180178}
181179
182static WRITE8_DEVICE_HANDLER( c65_cia1_port_a_w )
180WRITE8_MEMBER(c65_state::c65_cia1_port_a_w)
183181{
184   c65_state *state = space.machine().driver_data<c65_state>();
185182   static const int helper[4] = {0xc000, 0x8000, 0x4000, 0x0000};
186183
187   state->m_iec->atn_w(!BIT(data, 3));
188   state->m_iec->clk_w(!BIT(data, 4));
189   state->m_iec->data_w(!BIT(data, 5));
184   m_iec->atn_w(!BIT(data, 3));
185   m_iec->clk_w(!BIT(data, 4));
186   m_iec->data_w(!BIT(data, 5));
190187
191   state->m_vicaddr = state->m_memory + helper[data & 0x03];
188   m_vicaddr = m_memory + helper[data & 0x03];
192189}
193190
194static WRITE_LINE_DEVICE_HANDLER( c65_cia1_interrupt )
191WRITE_LINE_MEMBER(c65_state::c65_cia1_interrupt)
195192{
196   c65_nmi(device->machine());
193   c65_nmi(machine());
197194}
198195
199196const mos6526_interface c65_cia1 =
200197{
201   DEVCB_LINE(c65_cia1_interrupt),
198   DEVCB_DRIVER_LINE_MEMBER(c65_state,c65_cia1_interrupt),
202199   DEVCB_NULL,   /* pc_func */
203200   DEVCB_NULL,
204201   DEVCB_NULL,
205   DEVCB_HANDLER(c65_cia1_port_a_r),
206   DEVCB_HANDLER(c65_cia1_port_a_w),
202   DEVCB_DRIVER_MEMBER(c65_state,c65_cia1_port_a_r),
203   DEVCB_DRIVER_MEMBER(c65_state,c65_cia1_port_a_w),
207204   DEVCB_NULL,
208205   DEVCB_NULL
209206};
trunk/src/mess/machine/amstrad.c
r18257r18258
215215}
216216
217217
218WRITE_LINE_DEVICE_HANDLER( aleste_interrupt )
218WRITE_LINE_MEMBER(amstrad_state::aleste_interrupt)
219219{
220   amstrad_state *drvstate = device->machine().driver_data<amstrad_state>();
221220   if(state == CLEAR_LINE)
222      drvstate->m_aleste_fdc_int = 0;
221      m_aleste_fdc_int = 0;
223222   else
224      drvstate->m_aleste_fdc_int = 1;
223      m_aleste_fdc_int = 1;
225224}
226225
227226
r18257r18258
827826}
828827
829828
830static WRITE_LINE_DEVICE_HANDLER( amstrad_hsync_changed )
829WRITE_LINE_MEMBER(amstrad_state::amstrad_hsync_changed)
831830{
832   amstrad_state *drvstate = device->machine().driver_data<amstrad_state>();
833   amstrad_update_video(device->machine());
831   amstrad_update_video(machine());
834832
835833   /* The gate array reacts to de-assertion of the hsycnc 6845 line */
836   if ( drvstate->m_gate_array.hsync && !state )
834   if ( m_gate_array.hsync && !state )
837835   {
838      drvstate->m_gate_array.hsync_counter++;
836      m_gate_array.hsync_counter++;
839837      /* Advance to next drawing line */
840      drvstate->m_gate_array.y++;
841      drvstate->m_gate_array.line_ticks = 0;
842      if ( drvstate->m_gate_array.y >= 0 && drvstate->m_gate_array.y < drvstate->m_gate_array.bitmap->height() )
838      m_gate_array.y++;
839      m_gate_array.line_ticks = 0;
840      if ( m_gate_array.y >= 0 && m_gate_array.y < m_gate_array.bitmap->height() )
843841      {
844         drvstate->m_gate_array.draw_p = &drvstate->m_gate_array.bitmap->pix16(drvstate->m_gate_array.y);
842         m_gate_array.draw_p = &m_gate_array.bitmap->pix16(m_gate_array.y);
845843      }
846844      else
847845      {
848         drvstate->m_gate_array.draw_p = NULL;
846         m_gate_array.draw_p = NULL;
849847      }
850848
851      if ( drvstate->m_gate_array.hsync_after_vsync_counter != 0 )  // counters still operate regardless of PRI state
849      if ( m_gate_array.hsync_after_vsync_counter != 0 )  // counters still operate regardless of PRI state
852850      {
853         drvstate->m_gate_array.hsync_after_vsync_counter--;
851         m_gate_array.hsync_after_vsync_counter--;
854852
855         if (drvstate->m_gate_array.hsync_after_vsync_counter == 0)
853         if (m_gate_array.hsync_after_vsync_counter == 0)
856854         {
857            if (drvstate->m_gate_array.hsync_counter >= 32)
855            if (m_gate_array.hsync_counter >= 32)
858856            {
859               device->machine().device("maincpu")->execute().set_input_line(0, ASSERT_LINE);
857               machine().device("maincpu")->execute().set_input_line(0, ASSERT_LINE);
860858            }
861            drvstate->m_gate_array.hsync_counter = 0;
859            m_gate_array.hsync_counter = 0;
862860         }
863861      }
864862
865      if ( drvstate->m_gate_array.hsync_counter >= 52 )
863      if ( m_gate_array.hsync_counter >= 52 )
866864      {
867         drvstate->m_gate_array.hsync_counter = 0;
868         device->machine().device("maincpu")->execute().set_input_line(0, ASSERT_LINE);
865         m_gate_array.hsync_counter = 0;
866         machine().device("maincpu")->execute().set_input_line(0, ASSERT_LINE);
869867      }
870868   }
871   drvstate->m_gate_array.hsync = state ? 1 : 0;
869   m_gate_array.hsync = state ? 1 : 0;
872870}
873871
874872
875static WRITE_LINE_DEVICE_HANDLER( amstrad_plus_hsync_changed )
873WRITE_LINE_MEMBER(amstrad_state::amstrad_plus_hsync_changed)
876874{
877   amstrad_state *drvstate = device->machine().driver_data<amstrad_state>();
878   amstrad_plus_update_video(device->machine());
875   amstrad_plus_update_video(machine());
879876
880   if ( drvstate->m_gate_array.hsync && !state )
877   if ( m_gate_array.hsync && !state )
881878   {
882      drvstate->m_gate_array.hsync_counter++;
879      m_gate_array.hsync_counter++;
883880      /* Advance to next drawing line */
884      drvstate->m_gate_array.y++;
885      drvstate->m_gate_array.line_ticks = 0;
886      if ( drvstate->m_gate_array.y >= 0 && drvstate->m_gate_array.y < drvstate->m_gate_array.bitmap->height() )
881      m_gate_array.y++;
882      m_gate_array.line_ticks = 0;
883      if ( m_gate_array.y >= 0 && m_gate_array.y < m_gate_array.bitmap->height() )
887884      {
888         drvstate->m_gate_array.draw_p = &drvstate->m_gate_array.bitmap->pix16(drvstate->m_gate_array.y);
885         m_gate_array.draw_p = &m_gate_array.bitmap->pix16(m_gate_array.y);
889886      }
890887      else
891888      {
892         drvstate->m_gate_array.draw_p = NULL;
889         m_gate_array.draw_p = NULL;
893890      }
894891
895      if ( drvstate->m_gate_array.hsync_after_vsync_counter != 0 )  // counters still operate regardless of PRI state
892      if ( m_gate_array.hsync_after_vsync_counter != 0 )  // counters still operate regardless of PRI state
896893      {
897         drvstate->m_gate_array.hsync_after_vsync_counter--;
894         m_gate_array.hsync_after_vsync_counter--;
898895
899         if (drvstate->m_gate_array.hsync_after_vsync_counter == 0)
896         if (m_gate_array.hsync_after_vsync_counter == 0)
900897         {
901            if (drvstate->m_gate_array.hsync_counter >= 32)
898            if (m_gate_array.hsync_counter >= 32)
902899            {
903               if( drvstate->m_asic.pri == 0 || drvstate->m_asic.enabled == 0)
900               if( m_asic.pri == 0 || m_asic.enabled == 0)
904901               {
905                  device->machine().device("maincpu")->execute().set_input_line(0, ASSERT_LINE);
902                  machine().device("maincpu")->execute().set_input_line(0, ASSERT_LINE);
906903               }
907904            }
908            drvstate->m_gate_array.hsync_counter = 0;
905            m_gate_array.hsync_counter = 0;
909906         }
910907      }
911908
912      if ( drvstate->m_gate_array.hsync_counter >= 52 )
909      if ( m_gate_array.hsync_counter >= 52 )
913910      {
914         drvstate->m_gate_array.hsync_counter = 0;
915         if ( drvstate->m_asic.pri == 0 || drvstate->m_asic.enabled == 0 )
911         m_gate_array.hsync_counter = 0;
912         if ( m_asic.pri == 0 || m_asic.enabled == 0 )
916913         {
917            device->machine().device("maincpu")->execute().set_input_line(0, ASSERT_LINE);
914            machine().device("maincpu")->execute().set_input_line(0, ASSERT_LINE);
918915         }
919916      }
920917
921      if ( drvstate->m_asic.enabled )
918      if ( m_asic.enabled )
922919      {
923920         // CPC+/GX4000 Programmable Raster Interrupt (disabled if &6800 in ASIC RAM is 0)
924         if ( drvstate->m_asic.pri != 0 )
921         if ( m_asic.pri != 0 )
925922         {
926            if ( drvstate->m_asic.pri == drvstate->m_asic.vpos - 1 )
923            if ( m_asic.pri == m_asic.vpos - 1 )
927924            {
928               logerror("PRI: triggered, scanline %d\n",drvstate->m_asic.pri);
929               device->machine().device("maincpu")->execute().set_input_line(0, ASSERT_LINE);
930               drvstate->m_plus_irq_cause = 0x06;  // raster interrupt vector
931               drvstate->m_gate_array.hsync_counter &= ~0x20;  // ASIC PRI resets the MSB of the raster counter
925               logerror("PRI: triggered, scanline %d\n",m_asic.pri);
926               machine().device("maincpu")->execute().set_input_line(0, ASSERT_LINE);
927               m_plus_irq_cause = 0x06;  // raster interrupt vector
928               m_gate_array.hsync_counter &= ~0x20;  // ASIC PRI resets the MSB of the raster counter
932929            }
933930         }
934931         // CPC+/GX4000 Split screen registers  (disabled if &6801 in ASIC RAM is 0)
935         if(drvstate->m_asic.ram[0x2801] != 0)
932         if(m_asic.ram[0x2801] != 0)
936933         {
937            if ( drvstate->m_asic.ram[0x2801] == drvstate->m_asic.vpos - 1 )   // split occurs here (hopefully)
934            if ( m_asic.ram[0x2801] == m_asic.vpos - 1 )   // split occurs here (hopefully)
938935            {
939               logerror("SSCR: Split screen occurred at scanline %d\n",drvstate->m_asic.ram[0x2801]);
936               logerror("SSCR: Split screen occurred at scanline %d\n",m_asic.ram[0x2801]);
940937            }
941938         }
942939         // CPC+/GX4000 DMA channels
943         amstrad_plus_handle_dma(device->machine());  // a DMA command is handled at the leading edge of HSYNC (every 64us)
944         if(drvstate->m_asic.de_start != 0)
945            drvstate->m_asic.vpos++;
940         amstrad_plus_handle_dma(machine());  // a DMA command is handled at the leading edge of HSYNC (every 64us)
941         if(m_asic.de_start != 0)
942            m_asic.vpos++;
946943      }
947944   }
948   drvstate->m_gate_array.hsync = state ? 1 : 0;
945   m_gate_array.hsync = state ? 1 : 0;
949946}
950947
951948
952static WRITE_LINE_DEVICE_HANDLER( amstrad_vsync_changed )
949WRITE_LINE_MEMBER(amstrad_state::amstrad_vsync_changed)
953950{
954   amstrad_state *drvstate = device->machine().driver_data<amstrad_state>();
955   amstrad_update_video(device->machine());
951   amstrad_update_video(machine());
956952
957   if ( ! drvstate->m_gate_array.vsync && state )
953   if ( ! m_gate_array.vsync && state )
958954   {
959955      /* Reset the amstrad_CRTC_HS_After_VS_Counter */
960      drvstate->m_gate_array.hsync_after_vsync_counter = 3;
956      m_gate_array.hsync_after_vsync_counter = 3;
961957
962958      /* Start of new frame */
963      drvstate->m_gate_array.y = -1;
964      drvstate->m_asic.vpos = 1;
965      drvstate->m_asic.de_start = 0;
959      m_gate_array.y = -1;
960      m_asic.vpos = 1;
961      m_asic.de_start = 0;
966962   }
967963
968   drvstate->m_gate_array.vsync = state ? 1 : 0;
964   m_gate_array.vsync = state ? 1 : 0;
969965
970966   /* Schedule a write to PC2 */
971   device->machine().scheduler().timer_set( attotime::zero, timer_expired_delegate(FUNC(amstrad_state::amstrad_pc2_low),drvstate));
967   machine().scheduler().timer_set( attotime::zero, timer_expired_delegate(FUNC(amstrad_state::amstrad_pc2_low),this));
972968}
973969
974970
975static WRITE_LINE_DEVICE_HANDLER( amstrad_plus_vsync_changed )
971WRITE_LINE_MEMBER(amstrad_state::amstrad_plus_vsync_changed)
976972{
977   amstrad_state *drvstate = device->machine().driver_data<amstrad_state>();
978   amstrad_plus_update_video(device->machine());
973   amstrad_plus_update_video(machine());
979974
980   if ( ! drvstate->m_gate_array.vsync && state )
975   if ( ! m_gate_array.vsync && state )
981976   {
982977      /* Reset the amstrad_CRTC_HS_After_VS_Counter */
983      drvstate->m_gate_array.hsync_after_vsync_counter = 3;
978      m_gate_array.hsync_after_vsync_counter = 3;
984979
985980      /* Start of new frame */
986      drvstate->m_gate_array.y = -1;
987      drvstate->m_asic.vpos = 1;
988      drvstate->m_asic.de_start = 0;
981      m_gate_array.y = -1;
982      m_asic.vpos = 1;
983      m_asic.de_start = 0;
989984   }
990985
991   drvstate->m_gate_array.vsync = state ? 1 : 0;
986   m_gate_array.vsync = state ? 1 : 0;
992987
993988   /* Schedule a write to PC2 */
994   device->machine().scheduler().timer_set( attotime::zero, timer_expired_delegate(FUNC(amstrad_state::amstrad_pc2_low),drvstate));
989   machine().scheduler().timer_set( attotime::zero, timer_expired_delegate(FUNC(amstrad_state::amstrad_pc2_low),this));
995990}
996991
997992
998static WRITE_LINE_DEVICE_HANDLER( amstrad_de_changed )
993WRITE_LINE_MEMBER(amstrad_state::amstrad_de_changed)
999994{
1000   amstrad_state *drvstate = device->machine().driver_data<amstrad_state>();
1001   amstrad_update_video(device->machine());
995   amstrad_update_video(machine());
1002996
1003   if ( ! drvstate->m_gate_array.de && state )
997   if ( ! m_gate_array.de && state )
1004998   {
1005999      /* DE became active, store the starting MA and RA signals */
1006      mc6845_device *mc6845 = drvstate->m_crtc;
1000      mc6845_device *mc6845 = m_crtc;
10071001
1008      drvstate->m_gate_array.ma = mc6845->get_ma();
1009      drvstate->m_gate_array.ra = mc6845->get_ra();
1010logerror("y = %d; ma = %02x; ra = %02x, address = %04x\n", drvstate->m_gate_array.y, drvstate->m_gate_array.ma, drvstate->m_gate_array.ra, ( ( drvstate->m_gate_array.ma & 0x3000 ) << 2 ) | ( ( drvstate->m_gate_array.ra & 0x07 ) << 11 ) | ( ( drvstate->m_gate_array.ma & 0x3ff ) << 1 ) );
1011      amstrad_gate_array_get_video_data(device->machine());
1012      drvstate->m_asic.de_start = 1;
1002      m_gate_array.ma = mc6845->get_ma();
1003      m_gate_array.ra = mc6845->get_ra();
1004logerror("y = %d; ma = %02x; ra = %02x, address = %04x\n", m_gate_array.y, m_gate_array.ma, m_gate_array.ra, ( ( m_gate_array.ma & 0x3000 ) << 2 ) | ( ( m_gate_array.ra & 0x07 ) << 11 ) | ( ( m_gate_array.ma & 0x3ff ) << 1 ) );
1005      amstrad_gate_array_get_video_data(machine());
1006      m_asic.de_start = 1;
10131007   }
10141008
1015   drvstate->m_gate_array.de = state ? 1 : 0;
1009   m_gate_array.de = state ? 1 : 0;
10161010}
10171011
10181012
1019static WRITE_LINE_DEVICE_HANDLER( amstrad_plus_de_changed )
1013WRITE_LINE_MEMBER(amstrad_state::amstrad_plus_de_changed)
10201014{
1021   amstrad_state *drvstate = device->machine().driver_data<amstrad_state>();
1022   amstrad_plus_update_video(device->machine());
1015   amstrad_plus_update_video(machine());
10231016
1024   if ( ! drvstate->m_gate_array.de && state )
1017   if ( ! m_gate_array.de && state )
10251018   {
10261019      /* DE became active, store the starting MA and RA signals */
1027      mc6845_device *mc6845 = drvstate->m_crtc;
1020      mc6845_device *mc6845 = m_crtc;
10281021
1029      drvstate->m_gate_array.ma = mc6845->get_ma();
1030      drvstate->m_gate_array.ra = mc6845->get_ra();
1031      drvstate->m_asic.h_start = drvstate->m_gate_array.line_ticks;
1032      drvstate->m_asic.de_start = 1;
1022      m_gate_array.ma = mc6845->get_ma();
1023      m_gate_array.ra = mc6845->get_ra();
1024      m_asic.h_start = m_gate_array.line_ticks;
1025      m_asic.de_start = 1;
10331026
10341027      /* Start of screen */
1035      if ( drvstate->m_asic.vpos == 1 )
1028      if ( m_asic.vpos == 1 )
10361029      {
1037         drvstate->m_asic.split_ma_base = 0x0000;
1038         drvstate->m_asic.split_ma_started = 0x0000;
1030         m_asic.split_ma_base = 0x0000;
1031         m_asic.split_ma_started = 0x0000;
10391032      }
10401033      /* Start of split screen section */
1041      else if ( drvstate->m_asic.enabled && drvstate->m_asic.ram[0x2801] != 0 && drvstate->m_asic.ram[0x2801] == drvstate->m_asic.vpos - 1 )
1034      else if ( m_asic.enabled && m_asic.ram[0x2801] != 0 && m_asic.ram[0x2801] == m_asic.vpos - 1 )
10421035      {
1043         drvstate->m_asic.split_ma_started = drvstate->m_gate_array.ma;
1044         drvstate->m_asic.split_ma_base = ( drvstate->m_asic.ram[0x2802] << 8 ) | drvstate->m_asic.ram[0x2803];
1036         m_asic.split_ma_started = m_gate_array.ma;
1037         m_asic.split_ma_base = ( m_asic.ram[0x2802] << 8 ) | m_asic.ram[0x2803];
10451038      }
10461039
1047      drvstate->m_gate_array.colour = drvstate->m_asic.ram[0x2420] + ( drvstate->m_asic.ram[0x2421] << 8 );
1048      drvstate->m_asic.hscroll = drvstate->m_asic.ram[0x2804] & 0x0f;
1040      m_gate_array.colour = m_asic.ram[0x2420] + ( m_asic.ram[0x2421] << 8 );
1041      m_asic.hscroll = m_asic.ram[0x2804] & 0x0f;
10491042
1050      if ( drvstate->m_asic.hscroll == 0 )
1051         amstrad_plus_gate_array_get_video_data(device->machine());
1043      if ( m_asic.hscroll == 0 )
1044         amstrad_plus_gate_array_get_video_data(machine());
10521045   }
10531046
1054   if ( drvstate->m_gate_array.de && ! state )
1047   if ( m_gate_array.de && ! state )
10551048   {
1056      drvstate->m_asic.h_end = drvstate->m_gate_array.line_ticks;
1057      amstrad_plus_update_video_sprites(device->machine());
1049      m_asic.h_end = m_gate_array.line_ticks;
1050      amstrad_plus_update_video_sprites(machine());
10581051   }
10591052
1060   drvstate->m_gate_array.de = state ? 1 : 0;
1053   m_gate_array.de = state ? 1 : 0;
10611054}
10621055
10631056
r18257r18258
10861079   NULL,                           /* begin_update */
10871080   NULL,                           /* update_row */
10881081   NULL,                           /* end_update */
1089   DEVCB_LINE(amstrad_de_changed),         /* on_de_changed */
1082   DEVCB_DRIVER_LINE_MEMBER(amstrad_state,amstrad_de_changed),         /* on_de_changed */
10901083   DEVCB_NULL,                        /* on_cur_changed */
1091   DEVCB_LINE(amstrad_hsync_changed),      /* on_hsync_changed */
1092   DEVCB_LINE(amstrad_vsync_changed),      /* on_vsync_changed */
1084   DEVCB_DRIVER_LINE_MEMBER(amstrad_state,amstrad_hsync_changed),      /* on_hsync_changed */
1085   DEVCB_DRIVER_LINE_MEMBER(amstrad_state,amstrad_vsync_changed),      /* on_vsync_changed */
10931086   NULL
10941087};
10951088
r18257r18258
11011094   NULL,                              /* begin_update */
11021095   NULL,                              /* update_row */
11031096   NULL,                              /* end_update */
1104   DEVCB_LINE(amstrad_plus_de_changed),      /* on_de_changed */
1097   DEVCB_DRIVER_LINE_MEMBER(amstrad_state,amstrad_plus_de_changed),      /* on_de_changed */
11051098   DEVCB_NULL,                           /* on_cur_changed */
1106   DEVCB_LINE(amstrad_plus_hsync_changed),      /* on_hsync_changed */
1107   DEVCB_LINE(amstrad_plus_vsync_changed),      /* on_vsync_changed */
1099   DEVCB_DRIVER_LINE_MEMBER(amstrad_state,amstrad_plus_hsync_changed),      /* on_hsync_changed */
1100   DEVCB_DRIVER_LINE_MEMBER(amstrad_state,amstrad_plus_vsync_changed),      /* on_vsync_changed */
11081101   NULL
11091102};
11101103
r18257r18258
25052498
25062499
25072500/* Read/Write 8255 PPI port A (connected to AY-3-8912 databus) */
2508READ8_DEVICE_HANDLER ( amstrad_ppi_porta_r )
2501READ8_MEMBER(amstrad_state::amstrad_ppi_porta_r)
25092502{
2510   amstrad_state *state = space.machine().driver_data<amstrad_state>();
2511   update_psg(space.machine());
2512   return state->m_ppi_port_inputs[amstrad_ppi_PortA];
2503   update_psg(machine());
2504   return m_ppi_port_inputs[amstrad_ppi_PortA];
25132505}
25142506
25152507
2516WRITE8_DEVICE_HANDLER ( amstrad_ppi_porta_w )
2508WRITE8_MEMBER(amstrad_state::amstrad_ppi_porta_w)
25172509{
2518   amstrad_state *state = space.machine().driver_data<amstrad_state>();
2519   state->m_ppi_port_outputs[amstrad_ppi_PortA] = data;
2520   update_psg(space.machine());
2510   m_ppi_port_outputs[amstrad_ppi_PortA] = data;
2511   update_psg(machine());
25212512}
25222513
25232514
r18257r18258
25472538*/
25482539
25492540
2550READ8_DEVICE_HANDLER (amstrad_ppi_portb_r)
2541READ8_MEMBER(amstrad_state::amstrad_ppi_portb_r)
25512542{
2552   amstrad_state *state = space.machine().driver_data<amstrad_state>();
25532543   int data = 0;
25542544/* Set b7 with cassette tape input */
2555   if(state->m_system_type != SYSTEM_GX4000)
2545   if(m_system_type != SYSTEM_GX4000)
25562546   {
2557      if (state->m_cassette->input() > 0.03)
2547      if (m_cassette->input() > 0.03)
25582548      {
25592549         data |= (1<<7);
25602550      }
25612551   }
25622552/* Set b6 with Parallel/Printer port ready */
2563   if(state->m_system_type != SYSTEM_GX4000)
2553   if(m_system_type != SYSTEM_GX4000)
25642554   {
2565      centronics_device *printer = state->m_centronics;
2555      centronics_device *printer = m_centronics;
25662556      data |= printer->busy_r() << 6;
25672557   }
25682558/* Set b4-b1 50Hz/60Hz state and manufacturer name defined by links on PCB */
2569   data |= (state->m_ppi_port_inputs[amstrad_ppi_PortB] & 0x1e);
2559   data |= (m_ppi_port_inputs[amstrad_ppi_PortB] & 0x1e);
25702560
25712561/*  Set b0 with VSync state from the CRTC */
2572   data |= state->m_gate_array.vsync;
2562   data |= m_gate_array.vsync;
25732563
2574   if(state->m_aleste_mode & 0x04)
2564   if(m_aleste_mode & 0x04)
25752565   {
2576      if(state->m_aleste_fdc_int == 0)
2566      if(m_aleste_fdc_int == 0)
25772567         data &= ~0x02;
25782568      else
25792569         data |= 0x02;
r18257r18258
25812571
25822572logerror("amstrad_ppi_portb_r\n");
25832573   /* Schedule a write to PC2 */
2584   space.machine().scheduler().timer_set( attotime::zero, timer_expired_delegate(FUNC(amstrad_state::amstrad_pc2_low),state));
2574   machine().scheduler().timer_set( attotime::zero, timer_expired_delegate(FUNC(amstrad_state::amstrad_pc2_low),this));
25852575
25862576   return data;
25872577}
r18257r18258
26012591
26022592/* previous_ppi_portc_w value */
26032593
2604WRITE8_DEVICE_HANDLER ( amstrad_ppi_portc_w )
2594WRITE8_MEMBER(amstrad_state::amstrad_ppi_portc_w)
26052595{
2606   amstrad_state *state = space.machine().driver_data<amstrad_state>();
26072596   int changed_data;
26082597
2609   state->m_previous_ppi_portc_w = state->m_ppi_port_outputs[amstrad_ppi_PortC];
2598   m_previous_ppi_portc_w = m_ppi_port_outputs[amstrad_ppi_PortC];
26102599/* Write the data to Port C */
2611   changed_data = state->m_previous_ppi_portc_w^data;
2600   changed_data = m_previous_ppi_portc_w^data;
26122601
2613   state->m_ppi_port_outputs[amstrad_ppi_PortC] = data;
2602   m_ppi_port_outputs[amstrad_ppi_PortC] = data;
26142603
26152604/* get b7 and b6 (PSG Function Selected */
2616   state->m_Psg_FunctionSelected = ((data & 0xC0)>>6);
2605   m_Psg_FunctionSelected = ((data & 0xC0)>>6);
26172606
26182607   /* MC146818 function */
2619   state->m_aleste_rtc_function = data & 0x07;
2608   m_aleste_rtc_function = data & 0x07;
26202609
26212610   /* Perform PSG function */
2622   update_psg(space.machine());
2611   update_psg(machine());
26232612
26242613   /* b5 Cassette Write data */
2625   if(state->m_system_type != SYSTEM_GX4000)
2614   if(m_system_type != SYSTEM_GX4000)
26262615   {
26272616      if ((changed_data & 0x20) != 0)
26282617      {
2629         state->m_cassette->output(((data & 0x20) ? -1.0 : +1.0));
2618         m_cassette->output(((data & 0x20) ? -1.0 : +1.0));
26302619      }
26312620   }
26322621
26332622   /* b4 Cassette Motor Control */
2634   if(state->m_system_type != SYSTEM_GX4000)
2623   if(m_system_type != SYSTEM_GX4000)
26352624   {
26362625      if ((changed_data & 0x10) != 0)
26372626      {
2638         state->m_cassette->change_state(
2627         m_cassette->change_state(
26392628               ((data & 0x10) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED),
26402629               CASSETTE_MASK_MOTOR);
26412630      }
trunk/src/mess/machine/b2m.c
r18257r18258
143143}
144144
145145
146static WRITE_LINE_DEVICE_HANDLER(bm2_pit_out1)
146WRITE_LINE_MEMBER(b2m_state::bm2_pit_out1)
147147{
148   b2m_state *st =  device->machine().driver_data<b2m_state>();
149   speaker_level_w(st->m_speaker, state);
148   speaker_level_w(m_speaker, state);
150149}
151150
152151const struct pit8253_config b2m_pit8253_intf =
r18257r18258
160159      {
161160         2000000,
162161         DEVCB_NULL,
163         DEVCB_DEVICE_LINE("pit8253", bm2_pit_out1)
162         DEVCB_DRIVER_LINE_MEMBER(b2m_state,bm2_pit_out1)
164163      },
165164      {
166165         2000000,
r18257r18258
170169   }
171170};
172171
173static WRITE8_DEVICE_HANDLER (b2m_8255_porta_w )
172WRITE8_MEMBER(b2m_state::b2m_8255_porta_w)
174173{
175   b2m_state *state = space.machine().driver_data<b2m_state>();
176   state->m_b2m_8255_porta = data;
174   m_b2m_8255_porta = data;
177175}
178static WRITE8_DEVICE_HANDLER (b2m_8255_portb_w )
176WRITE8_MEMBER(b2m_state::b2m_8255_portb_w)
179177{
180   b2m_state *state = space.machine().driver_data<b2m_state>();
181   state->m_b2m_video_scroll = data;
178   m_b2m_video_scroll = data;
182179}
183180
184static WRITE8_DEVICE_HANDLER (b2m_8255_portc_w )
181WRITE8_MEMBER(b2m_state::b2m_8255_portc_w)
185182{
186   b2m_state *state = space.machine().driver_data<b2m_state>();
187
188   state->m_b2m_8255_portc = data;
189   b2m_set_bank(space.machine(), state->m_b2m_8255_portc & 7);
190   state->m_b2m_video_page = (state->m_b2m_8255_portc >> 7) & 1;
183   m_b2m_8255_portc = data;
184   b2m_set_bank(machine(), m_b2m_8255_portc & 7);
185   m_b2m_video_page = (m_b2m_8255_portc >> 7) & 1;
191186}
192187
193static READ8_DEVICE_HANDLER (b2m_8255_portb_r )
188READ8_MEMBER(b2m_state::b2m_8255_portb_r)
194189{
195   b2m_state *state = space.machine().driver_data<b2m_state>();
196   return state->m_b2m_video_scroll;
190   return m_b2m_video_scroll;
197191}
198192
199193I8255A_INTERFACE( b2m_ppi8255_interface_1 )
200194{
201195   DEVCB_NULL,
202   DEVCB_DEVICE_HANDLER("ppi8255_1", b2m_8255_porta_w),
203   DEVCB_DEVICE_HANDLER("ppi8255_1", b2m_8255_portb_r),
204   DEVCB_DEVICE_HANDLER("ppi8255_1", b2m_8255_portb_w),
196   DEVCB_DRIVER_MEMBER(b2m_state,b2m_8255_porta_w),
197   DEVCB_DRIVER_MEMBER(b2m_state,b2m_8255_portb_r),
198   DEVCB_DRIVER_MEMBER(b2m_state,b2m_8255_portb_w),
205199   DEVCB_NULL,
206   DEVCB_DEVICE_HANDLER("ppi8255_1", b2m_8255_portc_w)
200   DEVCB_DRIVER_MEMBER(b2m_state,b2m_8255_portc_w)
207201};
208202
209203
210204
211static WRITE8_DEVICE_HANDLER (b2m_ext_8255_portc_w )
205WRITE8_MEMBER(b2m_state::b2m_ext_8255_portc_w)
212206{
213207   UINT8 drive = ((data >> 1) & 1) ^ 1;
214208   UINT8 side  = (data  & 1) ^ 1;
215   b2m_state *state = space.machine().driver_data<b2m_state>();
216   floppy_mon_w(floppy_get_device(space.machine(), 0), 1);
217   floppy_mon_w(floppy_get_device(space.machine(), 1), 1);
209   floppy_mon_w(floppy_get_device(machine(), 0), 1);
210   floppy_mon_w(floppy_get_device(machine(), 1), 1);
218211
219   if (state->m_b2m_drive!=drive) {
220      wd17xx_set_drive(state->m_fdc,drive);
221      floppy_mon_w(floppy_get_device(space.machine(), 0), 0);
222      floppy_drive_set_ready_state(floppy_get_device(space.machine(), 0), 1, 1);
223      state->m_b2m_drive = drive;
212   if (m_b2m_drive!=drive) {
213      wd17xx_set_drive(m_fdc,drive);
214      floppy_mon_w(floppy_get_device(machine(), 0), 0);
215      floppy_drive_set_ready_state(floppy_get_device(machine(), 0), 1, 1);
216      m_b2m_drive = drive;
224217   }
225   if (state->m_b2m_side!=side) {
226      wd17xx_set_side(state->m_fdc,side);
227      floppy_mon_w(floppy_get_device(space.machine(), 1), 0);
228      floppy_drive_set_ready_state(floppy_get_device(space.machine(), 1), 1, 1);
229      state->m_b2m_side = side;
218   if (m_b2m_side!=side) {
219      wd17xx_set_side(m_fdc,side);
220      floppy_mon_w(floppy_get_device(machine(), 1), 0);
221      floppy_drive_set_ready_state(floppy_get_device(machine(), 1), 1, 1);
222      m_b2m_side = side;
230223   }
231   wd17xx_dden_w(state->m_fdc, 0);
224   wd17xx_dden_w(m_fdc, 0);
232225}
233226
234227I8255A_INTERFACE( b2m_ppi8255_interface_2 )
r18257r18258
238231   DEVCB_NULL,
239232   DEVCB_NULL,
240233   DEVCB_NULL,
241   DEVCB_DEVICE_HANDLER("ppi8255_2", b2m_ext_8255_portc_w)
234   DEVCB_DRIVER_MEMBER(b2m_state,b2m_ext_8255_portc_w)
242235};
243236
244static READ8_DEVICE_HANDLER (b2m_romdisk_porta_r )
237READ8_MEMBER(b2m_state::b2m_romdisk_porta_r)
245238{
246   b2m_state *state = space.machine().driver_data<b2m_state>();
247
248   UINT8 *romdisk = state->memregion("maincpu")->base() + 0x12000;
249   return romdisk[state->m_b2m_romdisk_msb*256+state->m_b2m_romdisk_lsb];
239   UINT8 *romdisk = memregion("maincpu")->base() + 0x12000;
240   return romdisk[m_b2m_romdisk_msb*256+m_b2m_romdisk_lsb];
250241}
251242
252static WRITE8_DEVICE_HANDLER (b2m_romdisk_portb_w )
243WRITE8_MEMBER(b2m_state::b2m_romdisk_portb_w)
253244{
254   b2m_state *state = space.machine().driver_data<b2m_state>();
255   state->m_b2m_romdisk_lsb = data;
245   m_b2m_romdisk_lsb = data;
256246}
257247
258static WRITE8_DEVICE_HANDLER (b2m_romdisk_portc_w )
248WRITE8_MEMBER(b2m_state::b2m_romdisk_portc_w)
259249{
260   b2m_state *state = space.machine().driver_data<b2m_state>();
261   state->m_b2m_romdisk_msb = data & 0x7f;
250   m_b2m_romdisk_msb = data & 0x7f;
262251}
263252
264253I8255A_INTERFACE( b2m_ppi8255_interface_3 )
265254{
266   DEVCB_DEVICE_HANDLER("ppi8255_3", b2m_romdisk_porta_r),
255   DEVCB_DRIVER_MEMBER(b2m_state,b2m_romdisk_porta_r),
267256   DEVCB_NULL,
268257   DEVCB_NULL,
269   DEVCB_DEVICE_HANDLER("ppi8255_3", b2m_romdisk_portb_w),
258   DEVCB_DRIVER_MEMBER(b2m_state,b2m_romdisk_portb_w),
270259   DEVCB_NULL,
271   DEVCB_DEVICE_HANDLER("ppi8255_3", b2m_romdisk_portc_w)
260   DEVCB_DRIVER_MEMBER(b2m_state,b2m_romdisk_portc_w)
272261};
273262
274static WRITE_LINE_DEVICE_HANDLER( b2m_pic_set_int_line )
263WRITE_LINE_MEMBER(b2m_state::b2m_pic_set_int_line)
275264{
276   device->machine().device("maincpu")->execute().set_input_line(0, state ?  HOLD_LINE : CLEAR_LINE);
265   machine().device("maincpu")->execute().set_input_line(0, state ?  HOLD_LINE : CLEAR_LINE);
277266}
278267
279268/* Driver initialization */
r18257r18258
352341
353342const struct pic8259_interface b2m_pic8259_config =
354343{
355   DEVCB_LINE(b2m_pic_set_int_line),
344   DEVCB_DRIVER_LINE_MEMBER(b2m_state,b2m_pic_set_int_line),
356345   DEVCB_LINE_VCC,
357346   DEVCB_NULL
358347};
trunk/src/mess/machine/oric.c
r18257r18258
134134/* bit 0 = BC1 state */
135135
136136/* this port is also used to read printer data */
137static READ8_DEVICE_HANDLER ( oric_via_in_a_func )
137READ8_MEMBER(oric_state::oric_via_in_a_func)
138138{
139   oric_state *state = space.machine().driver_data<oric_state>();
140
141139   /*logerror("port a read\r\n"); */
142140
143141   /* access psg? */
144   if (state->m_psg_control!=0)
142   if (m_psg_control!=0)
145143   {
146144      /* if psg is in read register state return reg data */
147      if (state->m_psg_control==0x01)
148         return ay8910_r(space.machine().device("ay8912"), space, 0);
145      if (m_psg_control==0x01)
146         return ay8910_r(machine().device("ay8912"), space, 0);
149147
150148      /* return high-impedance */
151149      return 0x0ff;
152150   }
153151
154152   /* correct?? */
155   return state->m_via_port_a_data;
153   return m_via_port_a_data;
156154}
157155
158static READ8_DEVICE_HANDLER ( oric_via_in_b_func )
156READ8_MEMBER(oric_state::oric_via_in_b_func)
159157{
160   oric_state *state = space.machine().driver_data<oric_state>();
161158   int data;
162159
163   oric_keyboard_sense_refresh(space.machine());
160   oric_keyboard_sense_refresh(machine());
164161
165   data = state->m_key_sense_bit;
166   data |= state->m_keyboard_line & 0x07;
162   data = m_key_sense_bit;
163   data |= m_keyboard_line & 0x07;
167164
168165   return data;
169166}
r18257r18258
209206   }
210207}
211208
212static WRITE8_DEVICE_HANDLER ( oric_via_out_a_func )
209WRITE8_MEMBER(oric_state::oric_via_out_a_func)
213210{
214   oric_state *state = space.machine().driver_data<oric_state>();
215   state->m_via_port_a_data = data;
211   m_via_port_a_data = data;
216212
217213   oric_psg_connection_refresh(space);
218214
219215
220   if (state->m_psg_control==0)
216   if (m_psg_control==0)
221217   {
222218      /* if psg not selected, write to printer */
223      centronics_device *centronics = space.machine().device<centronics_device>("centronics");
224      centronics->write(space.machine().driver_data()->generic_space(), 0, data);
219      centronics_device *centronics = machine().device<centronics_device>("centronics");
220      centronics->write(machine().driver_data()->generic_space(), 0, data);
225221   }
226222}
227223
r18257r18258
281277   via_0->write_cb1(data);
282278}
283279
284static WRITE8_DEVICE_HANDLER ( oric_via_out_b_func )
280WRITE8_MEMBER(oric_state::oric_via_out_b_func)
285281{
286   oric_state *state = space.machine().driver_data<oric_state>();
287   centronics_device *centronics = space.machine().device<centronics_device>("centronics");
282   centronics_device *centronics = machine().device<centronics_device>("centronics");
288283
289284   /* KEYBOARD */
290   state->m_keyboard_line = data & 0x07;
285   m_keyboard_line = data & 0x07;
291286
292287   /* CASSETTE */
293288   /* cassette motor control */
294   cassette_device_image(space.machine())->change_state(
289   cassette_device_image(machine())->change_state(
295290      (data & 0x40) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED,
296291      CASSETTE_MOTOR_DISABLED);
297292
298293   /* cassette data out */
299   cassette_device_image(space.machine())->output((data & (1<<7)) ? -1.0 : +1.0);
294   cassette_device_image(machine())->output((data & (1<<7)) ? -1.0 : +1.0);
300295
301296   /* centronics STROBE is connected to PB4 */
302297   centronics->strobe_w(BIT(data, 4));
303298
304299   oric_psg_connection_refresh(space);
305   state->m_previous_portb_data = data;
300   m_previous_portb_data = data;
306301}
307302
308303
309static READ8_DEVICE_HANDLER ( oric_via_in_ca2_func )
304READ8_MEMBER(oric_state::oric_via_in_ca2_func)
310305{
311   oric_state *state = space.machine().driver_data<oric_state>();
312   return state->m_psg_control & 1;
306   return m_psg_control & 1;
313307}
314308
315static READ8_DEVICE_HANDLER ( oric_via_in_cb2_func )
309READ8_MEMBER(oric_state::oric_via_in_cb2_func)
316310{
317   oric_state *state = space.machine().driver_data<oric_state>();
318   return (state->m_psg_control>>1) & 1;
311   return (m_psg_control>>1) & 1;
319312}
320313
321static WRITE8_DEVICE_HANDLER ( oric_via_out_ca2_func )
314WRITE8_MEMBER(oric_state::oric_via_out_ca2_func)
322315{
323   oric_state *state = space.machine().driver_data<oric_state>();
324   state->m_psg_control &=~1;
316   m_psg_control &=~1;
325317
326318   if (data)
327      state->m_psg_control |=1;
319      m_psg_control |=1;
328320
329321   oric_psg_connection_refresh(space);
330322}
331323
332static WRITE8_DEVICE_HANDLER ( oric_via_out_cb2_func )
324WRITE8_MEMBER(oric_state::oric_via_out_cb2_func)
333325{
334   oric_state *state = space.machine().driver_data<oric_state>();
335   state->m_psg_control &=~2;
326   m_psg_control &=~2;
336327
337328   if (data)
338      state->m_psg_control |=2;
329      m_psg_control |=2;
339330
340331   oric_psg_connection_refresh(space);
341332}
r18257r18258
394385
395386const via6522_interface oric_6522_interface=
396387{
397   DEVCB_HANDLER(oric_via_in_a_func),
398   DEVCB_HANDLER(oric_via_in_b_func),
388   DEVCB_DRIVER_MEMBER(oric_state,oric_via_in_a_func),
389   DEVCB_DRIVER_MEMBER(oric_state,oric_via_in_b_func),
399390   DEVCB_NULL,            /* printer acknowledge - handled by callback*/
400391   DEVCB_NULL,            /* tape input - handled by timer */
401   DEVCB_HANDLER(oric_via_in_ca2_func),
402   DEVCB_HANDLER(oric_via_in_cb2_func),
403   DEVCB_HANDLER(oric_via_out_a_func),
404   DEVCB_HANDLER(oric_via_out_b_func),
392   DEVCB_DRIVER_MEMBER(oric_state,oric_via_in_ca2_func),
393   DEVCB_DRIVER_MEMBER(oric_state,oric_via_in_cb2_func),
394   DEVCB_DRIVER_MEMBER(oric_state,oric_via_out_a_func),
395   DEVCB_DRIVER_MEMBER(oric_state,oric_via_out_b_func),
405396   DEVCB_NULL,
406397   DEVCB_NULL,
407   DEVCB_HANDLER(oric_via_out_ca2_func),
408   DEVCB_HANDLER(oric_via_out_cb2_func),
398   DEVCB_DRIVER_MEMBER(oric_state,oric_via_out_ca2_func),
399   DEVCB_DRIVER_MEMBER(oric_state,oric_via_out_cb2_func),
409400   DEVCB_LINE(oric_via_irq_func),
410401};
411402
r18257r18258
658649}
659650
660651/* DRQ is connected to interrupt */
661static WRITE_LINE_DEVICE_HANDLER( oric_jasmin_wd179x_drq_w )
652WRITE_LINE_MEMBER(oric_state::oric_jasmin_wd179x_drq_w)
662653{
663   oric_state *drvstate = device->machine().driver_data<oric_state>();
664654   if (state)
665      drvstate->m_irqs |= (1<<1);
655      m_irqs |= (1<<1);
666656   else
667      drvstate->m_irqs &=~(1<<1);
657      m_irqs &=~(1<<1);
668658
669   oric_refresh_ints(device->machine());
659   oric_refresh_ints(machine());
670660}
671661
672662READ8_MEMBER(oric_state::oric_jasmin_r)
r18257r18258
795785   oric_refresh_ints(machine);
796786}
797787
798static WRITE_LINE_DEVICE_HANDLER( oric_microdisc_wd179x_intrq_w )
788WRITE_LINE_MEMBER(oric_state::oric_microdisc_wd179x_intrq_w)
799789{
800   oric_state *drvstate = device->machine().driver_data<oric_state>();
801   drvstate->m_wd179x_int_state = state;
790   m_wd179x_int_state = state;
802791
803792   if (state)
804      drvstate->m_port_314_r &= ~(1<<7);
793      m_port_314_r &= ~(1<<7);
805794   else
806      drvstate->m_port_314_r |=(1<<7);
795      m_port_314_r |=(1<<7);
807796
808   oric_microdisc_refresh_wd179x_ints(device->machine());
797   oric_microdisc_refresh_wd179x_ints(machine());
809798}
810799
811static WRITE_LINE_DEVICE_HANDLER( oric_microdisc_wd179x_drq_w )
800WRITE_LINE_MEMBER(oric_state::oric_microdisc_wd179x_drq_w)
812801{
813   oric_state *drvstate = device->machine().driver_data<oric_state>();
814802   if (state)
815      drvstate->m_port_318_r &=~(1<<7);
803      m_port_318_r &=~(1<<7);
816804   else
817      drvstate->m_port_318_r |= (1<<7);
805      m_port_318_r |= (1<<7);
818806}
819807
820808static void oric_microdisc_set_mem_0x0c000(running_machine &machine)
r18257r18258
999987
1000988/*********************************************************/
1001989
1002static WRITE_LINE_DEVICE_HANDLER( oric_wd179x_intrq_w )
990WRITE_LINE_MEMBER(oric_state::oric_wd179x_intrq_w)
1003991{
1004   if ((device->machine().root_device().ioport("FLOPPY")->read() & 0x07) == ORIC_FLOPPY_INTERFACE_MICRODISC)
1005      oric_microdisc_wd179x_intrq_w(device, state);
992   if ((machine().root_device().ioport("FLOPPY")->read() & 0x07) == ORIC_FLOPPY_INTERFACE_MICRODISC)
993      oric_microdisc_wd179x_intrq_w(state);
1006994}
1007995
1008static WRITE_LINE_DEVICE_HANDLER( oric_wd179x_drq_w )
996WRITE_LINE_MEMBER(oric_state::oric_wd179x_drq_w)
1009997{
1010   switch (device->machine().root_device().ioport("FLOPPY")->read() &  0x07)
998   switch (machine().root_device().ioport("FLOPPY")->read() &  0x07)
1011999   {
10121000      default:
10131001      case ORIC_FLOPPY_INTERFACE_NONE:
10141002      case ORIC_FLOPPY_INTERFACE_APPLE2:
10151003         return;
10161004      case ORIC_FLOPPY_INTERFACE_MICRODISC:
1017         oric_microdisc_wd179x_drq_w(device, state);
1005         oric_microdisc_wd179x_drq_w(state);
10181006         return;
10191007      case ORIC_FLOPPY_INTERFACE_JASMIN:
1020         oric_jasmin_wd179x_drq_w(device, state);
1008         oric_jasmin_wd179x_drq_w(state);
10211009         return;
10221010   }
10231011}
r18257r18258
10251013const wd17xx_interface oric_wd17xx_interface =
10261014{
10271015   DEVCB_NULL,
1028   DEVCB_LINE(oric_wd179x_intrq_w),
1029   DEVCB_LINE(oric_wd179x_drq_w),
1016   DEVCB_DRIVER_LINE_MEMBER(oric_state,oric_wd179x_intrq_w),
1017   DEVCB_DRIVER_LINE_MEMBER(oric_state,oric_wd179x_drq_w),
10301018   {FLOPPY_0, FLOPPY_1, FLOPPY_2, FLOPPY_3}
10311019};
10321020
r18257r18258
12781266   }
12791267}
12801268
1281static READ8_DEVICE_HANDLER(telestrat_via2_in_a_func)
1269READ8_MEMBER(oric_state::telestrat_via2_in_a_func)
12821270{
1283   oric_state *state = space.machine().driver_data<oric_state>();
1284   //logerror("via 2 - port a %02x\n",state->m_telestrat_via2_port_a_data);
1285   return state->m_telestrat_via2_port_a_data;
1271   //logerror("via 2 - port a %02x\n",m_telestrat_via2_port_a_data);
1272   return m_telestrat_via2_port_a_data;
12861273}
12871274
12881275
1289static WRITE8_DEVICE_HANDLER(telestrat_via2_out_a_func)
1276WRITE8_MEMBER(oric_state::telestrat_via2_out_a_func)
12901277{
1291   oric_state *state = space.machine().driver_data<oric_state>();
12921278   //logerror("via 2 - port a w: %02x\n",data);
12931279
1294   state->m_telestrat_via2_port_a_data = data;
1280   m_telestrat_via2_port_a_data = data;
12951281
1296   if (((data^state->m_telestrat_bank_selection) & 0x07)!=0)
1282   if (((data^m_telestrat_bank_selection) & 0x07)!=0)
12971283   {
1298      state->m_telestrat_bank_selection = data & 0x07;
1284      m_telestrat_bank_selection = data & 0x07;
12991285
1300      telestrat_refresh_mem(space.machine());
1286      telestrat_refresh_mem(machine());
13011287   }
13021288}
13031289
1304static READ8_DEVICE_HANDLER(telestrat_via2_in_b_func)
1290READ8_MEMBER(oric_state::telestrat_via2_in_b_func)
13051291{
1306   oric_state *state = space.machine().driver_data<oric_state>();
13071292   unsigned char data = 0x01f;
13081293
13091294   /* left joystick selected? */
1310   if (state->m_telestrat_via2_port_b_data & (1<<6))
1295   if (m_telestrat_via2_port_b_data & (1<<6))
13111296   {
1312      data &= state->ioport("JOY0")->read();
1297      data &= ioport("JOY0")->read();
13131298   }
13141299
13151300   /* right joystick selected? */
1316   if (state->m_telestrat_via2_port_b_data & (1<<7))
1301   if (m_telestrat_via2_port_b_data & (1<<7))
13171302   {
1318      data &= space.machine().root_device().ioport("JOY1")->read();
1303      data &= machine().root_device().ioport("JOY1")->read();
13191304   }
13201305
1321   data |= state->m_telestrat_via2_port_b_data & ((1<<7) | (1<<6) | (1<<5));
1306   data |= m_telestrat_via2_port_b_data & ((1<<7) | (1<<6) | (1<<5));
13221307
13231308   return data;
13241309}
13251310
1326static WRITE8_DEVICE_HANDLER(telestrat_via2_out_b_func)
1311WRITE8_MEMBER(oric_state::telestrat_via2_out_b_func)
13271312{
1328   oric_state *state = space.machine().driver_data<oric_state>();
1329   state->m_telestrat_via2_port_b_data = data;
1313   m_telestrat_via2_port_b_data = data;
13301314}
13311315
13321316
r18257r18258
13471331
13481332const via6522_interface telestrat_via2_interface=
13491333{
1350   DEVCB_HANDLER(telestrat_via2_in_a_func),
1351   DEVCB_HANDLER(telestrat_via2_in_b_func),
1334   DEVCB_DRIVER_MEMBER(oric_state,telestrat_via2_in_a_func),
1335   DEVCB_DRIVER_MEMBER(oric_state,telestrat_via2_in_b_func),
13521336   DEVCB_NULL,
13531337   DEVCB_NULL,
13541338   DEVCB_NULL,
13551339   DEVCB_NULL,
1356   DEVCB_HANDLER(telestrat_via2_out_a_func),
1357   DEVCB_HANDLER(telestrat_via2_out_b_func),
1340   DEVCB_DRIVER_MEMBER(oric_state,telestrat_via2_out_a_func),
1341   DEVCB_DRIVER_MEMBER(oric_state,telestrat_via2_out_b_func),
13581342   DEVCB_NULL,
13591343   DEVCB_NULL,
13601344   DEVCB_NULL,
trunk/src/mess/machine/pet.c
r18257r18258
4545  cb1 video sync in
4646  cb2 cassette 1 motor out
4747*/
48static READ8_DEVICE_HANDLER( pia0_pa_r )
48READ8_MEMBER(pet_state::pia0_pa_r)
4949{
50   pet_state *state = space.machine().driver_data<pet_state>();
5150   /*
5251
5352        bit     description
r18257r18258
6665   UINT8 data = 0;
6766
6867   /* key */
69   data |= state->m_keyline_select;
68   data |= m_keyline_select;
7069
7170   /* #1 cassette switch */
72   data |= ((space.machine().device<cassette_image_device>(CASSETTE_TAG)->get_state() & CASSETTE_MASK_UISTATE) == CASSETTE_STOPPED) << 4;
71   data |= ((machine().device<cassette_image_device>(CASSETTE_TAG)->get_state() & CASSETTE_MASK_UISTATE) == CASSETTE_STOPPED) << 4;
7372
7473   /* #2 cassette switch */
75   data |= ((space.machine().device<cassette_image_device>(CASSETTE2_TAG)->get_state() & CASSETTE_MASK_UISTATE) == CASSETTE_STOPPED) << 5;
74   data |= ((machine().device<cassette_image_device>(CASSETTE2_TAG)->get_state() & CASSETTE_MASK_UISTATE) == CASSETTE_STOPPED) << 5;
7675
7776   /* end or identify in */
78   data |= state->m_ieee->eoi_r() << 6;
77   data |= m_ieee->eoi_r() << 6;
7978
8079   /* diagnostic jumper */
8180   data |= 0x80;
r18257r18258
8382   return data;
8483}
8584
86static WRITE8_DEVICE_HANDLER( pia0_pa_w )
85WRITE8_MEMBER(pet_state::pia0_pa_w)
8786{
88   pet_state *state = space.machine().driver_data<pet_state>();
8987   /*
9088
9189        bit     description
r18257r18258
102100    */
103101
104102   /* key */
105   state->m_keyline_select = data & 0x0f;
103   m_keyline_select = data & 0x0f;
106104}
107105
108106/* Keyboard reading/handling for regular keyboard */
109static READ8_DEVICE_HANDLER( kin_r )
107READ8_MEMBER(pet_state::kin_r)
110108{
111   pet_state *state = space.machine().driver_data<pet_state>();
112109   /*
113110
114111        bit     description
r18257r18258
130127      "ROW5", "ROW6", "ROW7", "ROW8", "ROW9"
131128   };
132129
133   if (state->m_keyline_select < 10)
130   if (m_keyline_select < 10)
134131   {
135      data = space.machine().root_device().ioport(keynames[state->m_keyline_select])->read();
132      data = machine().root_device().ioport(keynames[m_keyline_select])->read();
136133      /* Check for left-shift lock */
137      if ((state->m_keyline_select == 8) && (space.machine().root_device().ioport("SPECIAL")->read() & 0x80))
134      if ((m_keyline_select == 8) && (machine().root_device().ioport("SPECIAL")->read() & 0x80))
138135         data &= 0xfe;
139136   }
140137   return data;
141138}
142139
143140/* Keyboard handling for business keyboard */
144static READ8_DEVICE_HANDLER( petb_kin_r )
141READ8_MEMBER(pet_state::petb_kin_r)
145142{
146143   UINT8 data = 0xff;
147   pet_state *state = space.machine().driver_data<pet_state>();
148144   static const char *const keynames[] = {
149145      "ROW0", "ROW1", "ROW2", "ROW3", "ROW4",
150146      "ROW5", "ROW6", "ROW7", "ROW8", "ROW9"
151147   };
152148
153   if (state->m_keyline_select < 10)
149   if (m_keyline_select < 10)
154150   {
155      data = space.machine().root_device().ioport(keynames[state->m_keyline_select])->read();
151      data = machine().root_device().ioport(keynames[m_keyline_select])->read();
156152      /* Check for left-shift lock */
157153      /* 2008-05 FP: For some reason, superpet read it in the opposite way!! */
158154      /* While waiting for confirmation from docs, we add a workaround here. */
159      if (state->m_superpet)
155      if (m_superpet)
160156      {
161         if ((state->m_keyline_select == 6) && !(space.machine().root_device().ioport("SPECIAL")->read() & 0x80))
157         if ((m_keyline_select == 6) && !(machine().root_device().ioport("SPECIAL")->read() & 0x80))
162158            data &= 0xfe;
163159      }
164160      else
165161      {
166         if ((state->m_keyline_select == 6) && (space.machine().root_device().ioport("SPECIAL")->read() & 0x80))
162         if ((m_keyline_select == 6) && (machine().root_device().ioport("SPECIAL")->read() & 0x80))
167163            data &= 0xfe;
168164      }
169165   }
170166   return data;
171167}
172168
173static READ8_DEVICE_HANDLER( cass1_r )
169READ8_MEMBER(pet_state::cass1_r)
174170{
175171   // cassette 1 read
176   return (space.machine().device<cassette_image_device>(CASSETTE_TAG)->input() > +0.0) ? 1 : 0;
172   return (machine().device<cassette_image_device>(CASSETTE_TAG)->input() > +0.0) ? 1 : 0;
177173}
178174
179static WRITE8_DEVICE_HANDLER( cass1_motor_w )
175WRITE8_MEMBER(pet_state::cass1_motor_w)
180176{
181   pet_state *state = space.machine().driver_data<pet_state>();
182177   if (!data)
183178   {
184      space.machine().device<cassette_image_device>(CASSETTE_TAG)->change_state(CASSETTE_MOTOR_ENABLED,CASSETTE_MASK_MOTOR);
185      state->m_datasette1_timer->adjust(attotime::zero, 0, attotime::from_hz(48000));   // I put 48000 because I was given some .wav with this freq
179      machine().device<cassette_image_device>(CASSETTE_TAG)->change_state(CASSETTE_MOTOR_ENABLED,CASSETTE_MASK_MOTOR);
180      m_datasette1_timer->adjust(attotime::zero, 0, attotime::from_hz(48000));   // I put 48000 because I was given some .wav with this freq
186181   }
187182   else
188183   {
189      space.machine().device<cassette_image_device>(CASSETTE_TAG)->change_state(CASSETTE_MOTOR_DISABLED ,CASSETTE_MASK_MOTOR);
190      state->m_datasette1_timer->reset();
184      machine().device<cassette_image_device>(CASSETTE_TAG)->change_state(CASSETTE_MOTOR_DISABLED ,CASSETTE_MASK_MOTOR);
185      m_datasette1_timer->reset();
191186   }
192187}
193188
194static WRITE_LINE_DEVICE_HANDLER( pia0_irq_w )
189WRITE_LINE_MEMBER(pet_state::pia0_irq_w)
195190{
196   pet_state *driver_state = device->machine().driver_data<pet_state>();
191   m_pia0_irq = state;
192   int level = (m_pia0_irq | m_pia1_irq | m_via_irq) ? ASSERT_LINE : CLEAR_LINE;
197193
198   driver_state->m_pia0_irq = state;
199   int level = (driver_state->m_pia0_irq | driver_state->m_pia1_irq | driver_state->m_via_irq) ? ASSERT_LINE : CLEAR_LINE;
200
201   device->machine().firstcpu->set_input_line(INPUT_LINE_IRQ0, level);
194   machine().firstcpu->set_input_line(INPUT_LINE_IRQ0, level);
202195}
203196
204197const pia6821_interface pet_pia0 =
205198{
206   DEVCB_HANDLER(pia0_pa_r),      /* in_a_func */
207   DEVCB_HANDLER(kin_r),         /* in_b_func */
208   DEVCB_HANDLER(cass1_r),         /* in_ca1_func */
199   DEVCB_DRIVER_MEMBER(pet_state,pia0_pa_r),      /* in_a_func */
200   DEVCB_DRIVER_MEMBER(pet_state,kin_r),         /* in_b_func */
201   DEVCB_DRIVER_MEMBER(pet_state,cass1_r),         /* in_ca1_func */
209202   DEVCB_NULL,                  /* in_cb1_func */
210203   DEVCB_NULL,                  /* in_ca2_func */
211204   DEVCB_NULL,                  /* in_cb2_func */
212   DEVCB_HANDLER(pia0_pa_w),      /* out_a_func */
205   DEVCB_DRIVER_MEMBER(pet_state,pia0_pa_w),      /* out_a_func */
213206   DEVCB_NULL,                  /* out_b_func */
214207   DEVCB_DEVICE_LINE_MEMBER(IEEE488_TAG, ieee488_device, eoi_w),         /* out_ca2_func */
215   DEVCB_HANDLER(cass1_motor_w),   /* out_cb2_func */
216   DEVCB_LINE(pia0_irq_w),         /* irq_a_func */
217   DEVCB_LINE(pia0_irq_w)         /* irq_b_func */
208   DEVCB_DRIVER_MEMBER(pet_state,cass1_motor_w),   /* out_cb2_func */
209   DEVCB_DRIVER_LINE_MEMBER(pet_state,pia0_irq_w),         /* irq_a_func */
210   DEVCB_DRIVER_LINE_MEMBER(pet_state,pia0_irq_w)         /* irq_b_func */
218211};
219212
220213const pia6821_interface petb_pia0 =
221214{
222   DEVCB_HANDLER(pia0_pa_r),      /* in_a_func */
223   DEVCB_HANDLER(petb_kin_r),      /* in_b_func */
224   DEVCB_HANDLER(cass1_r),         /* in_ca1_func */
215   DEVCB_DRIVER_MEMBER(pet_state,pia0_pa_r),      /* in_a_func */
216   DEVCB_DRIVER_MEMBER(pet_state,petb_kin_r),      /* in_b_func */
217   DEVCB_DRIVER_MEMBER(pet_state,cass1_r),         /* in_ca1_func */
225218   DEVCB_NULL,                  /* in_cb1_func */
226219   DEVCB_NULL,                  /* in_ca2_func */
227220   DEVCB_NULL,                  /* in_cb2_func */
228   DEVCB_HANDLER(pia0_pa_w),      /* out_a_func */
221   DEVCB_DRIVER_MEMBER(pet_state,pia0_pa_w),      /* out_a_func */
229222   DEVCB_NULL,                  /* out_b_func */
230223   DEVCB_DEVICE_LINE_MEMBER(IEEE488_TAG, ieee488_device, eoi_w),         /* out_ca2_func */
231   DEVCB_HANDLER(cass1_motor_w),   /* out_cb2_func */
232   DEVCB_LINE(pia0_irq_w),         /* irq_a_func */
233   DEVCB_LINE(pia0_irq_w)         /* irq_b_func */
224   DEVCB_DRIVER_MEMBER(pet_state,cass1_motor_w),   /* out_cb2_func */
225   DEVCB_DRIVER_LINE_MEMBER(pet_state,pia0_irq_w),         /* irq_a_func */
226   DEVCB_DRIVER_LINE_MEMBER(pet_state,pia0_irq_w)         /* irq_b_func */
234227};
235228
236229/* pia at 0xe820 (ieee488)
r18257r18258
242235  cb2 dav out
243236 */
244237
245static WRITE_LINE_DEVICE_HANDLER( pia1_irq_w )
238WRITE_LINE_MEMBER(pet_state::pia1_irq_w)
246239{
247   pet_state *driver_state = device->machine().driver_data<pet_state>();
240   m_pia1_irq = state;
241   int level = (m_pia0_irq | m_pia1_irq | m_via_irq) ? ASSERT_LINE : CLEAR_LINE;
248242
249   driver_state->m_pia1_irq = state;
250   int level = (driver_state->m_pia0_irq | driver_state->m_pia1_irq | driver_state->m_via_irq) ? ASSERT_LINE : CLEAR_LINE;
251
252   device->machine().firstcpu->set_input_line(INPUT_LINE_IRQ0, level);
243   machine().firstcpu->set_input_line(INPUT_LINE_IRQ0, level);
253244}
254245
255246const pia6821_interface pet_pia1 =
r18257r18258
264255   DEVCB_DEVICE_MEMBER(IEEE488_TAG, ieee488_device, dio_w),               /* out_b_func */
265256   DEVCB_DEVICE_LINE_MEMBER(IEEE488_TAG, ieee488_device, ndac_w),               /* out_ca2_func */
266257   DEVCB_DEVICE_LINE_MEMBER(IEEE488_TAG, ieee488_device, dav_w),               /* out_cb2_func */
267   DEVCB_LINE(pia1_irq_w),               /* irq_a_func */
268   DEVCB_LINE(pia1_irq_w)               /* irq_b_func */
258   DEVCB_DRIVER_LINE_MEMBER(pet_state,pia1_irq_w),               /* irq_a_func */
259   DEVCB_DRIVER_LINE_MEMBER(pet_state,pia1_irq_w)               /* irq_b_func */
269260};
270261
271262/* userport, cassettes, rest ieee488
r18257r18258
285276   cb1 cassettes
286277   cb2 user port
287278 */
288static READ8_DEVICE_HANDLER( via_pb_r )
279READ8_MEMBER(pet_state::via_pb_r)
289280{
290281   /*
291282
r18257r18258
302293
303294    */
304295
305   pet_state *state = space.machine().driver_data<pet_state>();
306296   UINT8 data = 0;
307297
308298   /* not data accepted in */
309   data |= state->m_ieee->ndac_r();
299   data |= m_ieee->ndac_r();
310300
311301   /* sync in */
312302
313303   /* not ready for data in */
314   data |= state->m_ieee->nrfd_r() << 6;
304   data |= m_ieee->nrfd_r() << 6;
315305
316306   /* data valid in */
317   data |= state->m_ieee->dav_r() << 7;
307   data |= m_ieee->dav_r() << 7;
318308
319309   return data;
320310}
321311
322static READ_LINE_DEVICE_HANDLER( cass2_r )
312READ_LINE_MEMBER(pet_state::cass2_r)
323313{
324314   // cassette 2 read
325   return (device->machine().device<cassette_image_device>(CASSETTE2_TAG)->input() > +0.0) ? 1 : 0;
315   return (machine().device<cassette_image_device>(CASSETTE2_TAG)->input() > +0.0) ? 1 : 0;
326316}
327317
328static WRITE8_DEVICE_HANDLER( via_pb_w )
318WRITE8_MEMBER(pet_state::via_pb_w)
329319{
330320   /*
331321
r18257r18258
342332
343333    */
344334
345   pet_state *state = space.machine().driver_data<pet_state>();
346
347335   /* not ready for data out */
348   state->m_ieee->nrfd_w(BIT(data, 1));
336   m_ieee->nrfd_w(BIT(data, 1));
349337
350338   /* attention out */
351   state->m_ieee->atn_w(BIT(data, 2));
339   m_ieee->atn_w(BIT(data, 2));
352340
353341   /* cassette write */
354   space.machine().device<cassette_image_device>(CASSETTE_TAG)->output(BIT(data, 3) ? -(0x5a9e >> 1) : +(0x5a9e >> 1));
355   space.machine().device<cassette_image_device>(CASSETTE2_TAG)->output(BIT(data, 3) ? -(0x5a9e >> 1) : +(0x5a9e >> 1));
342   machine().device<cassette_image_device>(CASSETTE_TAG)->output(BIT(data, 3) ? -(0x5a9e >> 1) : +(0x5a9e >> 1));
343   machine().device<cassette_image_device>(CASSETTE2_TAG)->output(BIT(data, 3) ? -(0x5a9e >> 1) : +(0x5a9e >> 1));
356344
357345   /* #2 cassette motor */
358346   if (BIT(data, 4))
359347   {
360      space.machine().device<cassette_image_device>(CASSETTE2_TAG)->change_state(CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR);
361      state->m_datasette2_timer->adjust(attotime::zero, 0, attotime::from_hz(48000));   // I put 48000 because I was given some .wav with this freq
348      machine().device<cassette_image_device>(CASSETTE2_TAG)->change_state(CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR);
349      m_datasette2_timer->adjust(attotime::zero, 0, attotime::from_hz(48000));   // I put 48000 because I was given some .wav with this freq
362350   }
363351   else
364352   {
365      space.machine().device<cassette_image_device>(CASSETTE2_TAG)->change_state(CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR);
366      state->m_datasette2_timer->reset();
353      machine().device<cassette_image_device>(CASSETTE2_TAG)->change_state(CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR);
354      m_datasette2_timer->reset();
367355   }
368356}
369357
370static WRITE_LINE_DEVICE_HANDLER( gb_w )
358WRITE_LINE_MEMBER(pet_state::gb_w)
371359{
372   pet_state *drvstate = device->machine().driver_data<pet_state>();
373   DBG_LOG(device->machine(), 1, "address line", ("%d\n", state));
374   if (state) drvstate->m_font |= 1;
375   else drvstate->m_font &= ~1;
360   DBG_LOG(machine(), 1, "address line", ("%d\n", state));
361   if (state) m_font |= 1;
362   else m_font &= ~1;
376363}
377364
378static WRITE_LINE_DEVICE_HANDLER( via_irq_w )
365WRITE_LINE_MEMBER(pet_state::via_irq_w)
379366{
380   pet_state *driver_state = device->machine().driver_data<pet_state>();
367   m_via_irq = state;
368   int level = (m_pia0_irq | m_pia1_irq | m_via_irq) ? ASSERT_LINE : CLEAR_LINE;
381369
382   driver_state->m_via_irq = state;
383   int level = (driver_state->m_pia0_irq | driver_state->m_pia1_irq | driver_state->m_via_irq) ? ASSERT_LINE : CLEAR_LINE;
384
385   device->machine().firstcpu->set_input_line(INPUT_LINE_IRQ0, level);
370   machine().firstcpu->set_input_line(INPUT_LINE_IRQ0, level);
386371}
387372
388373const via6522_interface pet_via =
389374{
390375   DEVCB_NULL,               /* in_a_func */
391   DEVCB_HANDLER(via_pb_r),   /* in_b_func */
376   DEVCB_DRIVER_MEMBER(pet_state,via_pb_r),   /* in_b_func */
392377   DEVCB_NULL,               /* in_ca1_func */
393   DEVCB_LINE(cass2_r),      /* in_cb1_func */
378   DEVCB_DRIVER_LINE_MEMBER(pet_state,cass2_r),      /* in_cb1_func */
394379   DEVCB_NULL,               /* in_ca2_func */
395380   DEVCB_NULL,               /* in_cb2_func */
396381   DEVCB_NULL,               /* out_a_func */
397   DEVCB_HANDLER(via_pb_w),   /* out_b_func */
382   DEVCB_DRIVER_MEMBER(pet_state,via_pb_w),   /* out_b_func */
398383   DEVCB_NULL,               /* out_ca1_func */
399   DEVCB_LINE(gb_w),         /* out_ca2_func */
384   DEVCB_DRIVER_LINE_MEMBER(pet_state,gb_w),         /* out_ca2_func */
400385   DEVCB_NULL,               /* out_ca2_func */
401386   DEVCB_NULL,               /* out_cb2_func */
402   DEVCB_LINE(via_irq_w)      /* out_irq_func */
387   DEVCB_DRIVER_LINE_MEMBER(pet_state,via_irq_w)      /* out_irq_func */
403388};
404389
405390
trunk/src/mess/machine/concept.c
r18257r18258
3939/*static int ready;*/         /* ready line from monochip, role unknown */
4040
4141/* Via */
42static DECLARE_READ8_DEVICE_HANDLER(via_in_a);
43static DECLARE_WRITE8_DEVICE_HANDLER(via_out_a);
44static DECLARE_READ8_DEVICE_HANDLER(via_in_b);
45static DECLARE_WRITE8_DEVICE_HANDLER(via_out_b);
46static DECLARE_WRITE8_DEVICE_HANDLER(via_out_cb2);
4742static void via_irq_func(device_t *device, int state);
4843
4944
5045const via6522_interface concept_via6522_intf =
5146{   /* main via */
52   DEVCB_HANDLER(via_in_a), DEVCB_HANDLER(via_in_b),
47   DEVCB_DRIVER_MEMBER(concept_state,via_in_a), DEVCB_DRIVER_MEMBER(concept_state,via_in_b),
5348   DEVCB_NULL, DEVCB_NULL,
5449   DEVCB_NULL, DEVCB_NULL,
55   DEVCB_HANDLER(via_out_a), DEVCB_HANDLER(via_out_b),
50   DEVCB_DRIVER_MEMBER(concept_state,via_out_a), DEVCB_DRIVER_MEMBER(concept_state,via_out_b),
5651   DEVCB_NULL, DEVCB_NULL,
57   DEVCB_NULL, DEVCB_HANDLER(via_out_cb2),
52   DEVCB_NULL, DEVCB_DRIVER_MEMBER(concept_state,via_out_cb2),
5853   DEVCB_LINE(via_irq_func)
5954};
6055
r18257r18258
195190    6: DCD1 (I)
196191    7: IOX (O)
197192*/
198static  READ8_DEVICE_HANDLER(via_in_a)
193READ8_MEMBER(concept_state::via_in_a)
199194{
200195   LOG(("via_in_a: VIA port A (Omninet and COMM port status) read\n"));
201196   return 1;      /* omninet ready always 1 */
202197}
203198
204static WRITE8_DEVICE_HANDLER(via_out_a)
199WRITE8_MEMBER(concept_state::via_out_a)
205200{
206201   LOG(("via_out_a: VIA port A status written: data=0x%2.2x\n", data));
207202   /*iox = (data & 0x80) != 0;*/
r18257r18258
219214    6: boot switch 0 (I)
220215    7: boot switch 1 (I)
221216*/
222static READ8_DEVICE_HANDLER(via_in_b)
217READ8_MEMBER(concept_state::via_in_b)
223218{
224219   UINT8 status;
225220
226   status = ((space.machine().root_device().ioport("DSW0")->read() & 0x80) >> 1) | ((space.machine().root_device().ioport("DSW0")->read() & 0x40) << 1);
221   status = ((machine().root_device().ioport("DSW0")->read() & 0x80) >> 1) | ((machine().root_device().ioport("DSW0")->read() & 0x40) << 1);
227222   LOG(("via_in_b: VIA port B (DIP switches, Video, Comm Rate) - status: 0x%2.2x\n", status));
228223   return status;
229224}
230225
231static WRITE8_DEVICE_HANDLER(via_out_b)
226WRITE8_MEMBER(concept_state::via_out_b)
232227{
233228   VLOG(("via_out_b: VIA port B (Video Control and COMM rate select) written: data=0x%2.2x\n", data));
234229}
r18257r18258
236231/*
237232    VIA CB2: used as sound output
238233*/
239static WRITE8_DEVICE_HANDLER(via_out_cb2)
234WRITE8_MEMBER(concept_state::via_out_cb2)
240235{
241236   LOG(("via_out_cb2: Sound control written: data=0x%2.2x\n", data));
242237}
r18257r18258
551546   install_expansion_slot(slot, read8_delegate(FUNC(concept_state::concept_fdc_reg_r),this), write8_delegate(FUNC(concept_state::concept_fdc_reg_w),this), read8_delegate(FUNC(concept_state::concept_fdc_rom_r),this), write8_delegate());
552547}
553548
554static WRITE_LINE_DEVICE_HANDLER( concept_fdc_intrq_w )
549WRITE_LINE_MEMBER(concept_state::concept_fdc_intrq_w)
555550{
556   concept_state *drvstate = device->machine().driver_data<concept_state>();
557551   if (state)
558      drvstate->m_fdc_local_status |= LS_INT_mask;
552      m_fdc_local_status |= LS_INT_mask;
559553   else
560      drvstate->m_fdc_local_status &= ~LS_INT_mask;
554      m_fdc_local_status &= ~LS_INT_mask;
561555}
562556
563static WRITE_LINE_DEVICE_HANDLER( concept_fdc_drq_w )
557WRITE_LINE_MEMBER(concept_state::concept_fdc_drq_w)
564558{
565   concept_state *drvstate = device->machine().driver_data<concept_state>();
566559   if (state)
567      drvstate->m_fdc_local_status |= LS_DRQ_mask;
560      m_fdc_local_status |= LS_DRQ_mask;
568561   else
569      drvstate->m_fdc_local_status &= ~LS_DRQ_mask;
562      m_fdc_local_status &= ~LS_DRQ_mask;
570563}
571564
572565const wd17xx_interface concept_wd17xx_interface =
573566{
574567   DEVCB_NULL,
575   DEVCB_LINE(concept_fdc_intrq_w),
576   DEVCB_LINE(concept_fdc_drq_w),
568   DEVCB_DRIVER_LINE_MEMBER(concept_state,concept_fdc_intrq_w),
569   DEVCB_DRIVER_LINE_MEMBER(concept_state,concept_fdc_drq_w),
577570   {FLOPPY_0, FLOPPY_1, FLOPPY_2, FLOPPY_3}
578571};
579572
trunk/src/mess/machine/sms.c
r18257r18258
770770 Check if the pause button is pressed.
771771 If the gamegear is in sms mode, check if the start button is pressed.
772772 */
773WRITE_LINE_DEVICE_HANDLER( sms_pause_callback )
773WRITE_LINE_MEMBER(sms_state::sms_pause_callback)
774774{
775   sms_state *driver_state = device->machine().driver_data<sms_state>();
776
777   if (driver_state->m_is_gamegear && !(driver_state->m_cartridge[driver_state->m_current_cartridge].features & CF_GG_SMS_MODE))
775   if (m_is_gamegear && !(m_cartridge[m_current_cartridge].features & CF_GG_SMS_MODE))
778776      return;
779777
780   if (!(driver_state->ioport(driver_state->m_is_gamegear ? "START" : "PAUSE")->read() & 0x80))
778   if (!(ioport(m_is_gamegear ? "START" : "PAUSE")->read() & 0x80))
781779   {
782      if (!driver_state->m_paused)
780      if (!m_paused)
783781      {
784         device->machine().device("maincpu")->execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE);
782         machine().device("maincpu")->execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE);
785783      }
786      driver_state->m_paused = 1;
784      m_paused = 1;
787785   }
788786   else
789787   {
790      driver_state->m_paused = 0;
788      m_paused = 0;
791789   }
792790
793791   /* clear Light Phaser latch flags for next frame */
794   driver_state->m_lphaser_1_latch = 0;
795   driver_state->m_lphaser_2_latch = 0;
792   m_lphaser_1_latch = 0;
793   m_lphaser_2_latch = 0;
796794}
797795
798796READ8_MEMBER(sms_state::sms_input_port_0_r)
r18257r18258
20952093   m_store_control = data;
20962094}
20972095
2098WRITE_LINE_DEVICE_HANDLER( sms_store_int_callback )
2096WRITE_LINE_MEMBER(sms_state::sms_store_int_callback)
20992097{
2100   sms_state *driver_state = device->machine().driver_data<sms_state>();
2101   (driver_state->m_store_control & 0x01 ? driver_state->m_control_cpu : driver_state->m_main_cpu)->execute().set_input_line(0, state);
2098   (m_store_control & 0x01 ? m_control_cpu : m_main_cpu)->execute().set_input_line(0, state);
21022099}
21032100
21042101
trunk/src/mess/machine/super80.c
r18257r18258
1212   m_keylatch = data;
1313};
1414
15static READ8_DEVICE_HANDLER( pio_port_b_r ) // cannot be modernised yet as super80 hangs at start
15READ8_MEMBER(super80_state::pio_port_b_r)// cannot be modernised yet as super80 hangs at start
1616{
17   super80_state *state = space.machine().driver_data<super80_state>();
1817   char kbdrow[6];
1918   UINT8 i;
2019   UINT8 data = 0xff;
r18257r18258
2221   for (i = 0; i < 8; i++)
2322   {
2423      sprintf(kbdrow,"X%d",i);
25      if (!BIT(state->m_keylatch, i)) data &= state->ioport(kbdrow)->read();
24      if (!BIT(m_keylatch, i)) data &= ioport(kbdrow)->read();
2625   }
2726
2827   return data;
r18257r18258
3433   DEVCB_NULL,
3534   DEVCB_DRIVER_MEMBER(super80_state, pio_port_a_w),
3635   DEVCB_NULL,         /* portA ready active callback (not used in super80) */
37   DEVCB_HANDLER(pio_port_b_r),
36   DEVCB_DRIVER_MEMBER(super80_state,pio_port_b_r),
3837   DEVCB_NULL,
3938   DEVCB_NULL         /* portB ready active callback (not used in super80) */
4039};
r18257r18258
9392      m_cass_data[1] = 0;
9493   }
9594
96   m_pio->port_b_write(pio_port_b_r(m_pio,generic_space(),0,0xff));
95   m_pio->port_b_write(pio_port_b_r(generic_space(),0,0xff));
9796}
9897
9998/* after the first 4 bytes have been read from ROM, switch the ram back in */
trunk/src/mess/machine/cgenie.c
r18257r18258
419419   }
420420}
421421
422static WRITE_LINE_DEVICE_HANDLER( cgenie_fdc_intrq_w )
422WRITE_LINE_MEMBER(cgenie_state::cgenie_fdc_intrq_w)
423423{
424   cgenie_state *drvstate = device->machine().driver_data<cgenie_state>();
425424   /* if disc hardware is not enabled, do not cause an int */
426   if (!( drvstate->ioport("DSW0")->read() & 0x80 ))
425   if (!( ioport("DSW0")->read() & 0x80 ))
427426      return;
428427
429428   if (state)
430429   {
431      if( (drvstate->m_irq_status & IRQ_FDC) == 0 )
430      if( (m_irq_status & IRQ_FDC) == 0 )
432431      {
433         drvstate->m_irq_status |= IRQ_FDC;
434         device->machine().device("maincpu")->execute().set_input_line(0, HOLD_LINE);
432         m_irq_status |= IRQ_FDC;
433         machine().device("maincpu")->execute().set_input_line(0, HOLD_LINE);
435434      }
436435   }
437436   else
438437   {
439      drvstate->m_irq_status &= ~IRQ_FDC;
438      m_irq_status &= ~IRQ_FDC;
440439   }
441440}
442441
443442const wd17xx_interface cgenie_wd17xx_interface =
444443{
445444   DEVCB_NULL,
446   DEVCB_LINE(cgenie_fdc_intrq_w),
445   DEVCB_DRIVER_LINE_MEMBER(cgenie_state,cgenie_fdc_intrq_w),
447446   DEVCB_NULL,
448447   {FLOPPY_0, FLOPPY_1, FLOPPY_2, FLOPPY_3}
449448};
r18257r18258
601600}
602601
603602
604READ8_DEVICE_HANDLER( cgenie_sh_control_port_r )
603READ8_MEMBER(cgenie_state::cgenie_sh_control_port_r)
605604{
606   cgenie_state *state = space.machine().driver_data<cgenie_state>();
607   return state->m_control_port;
605   return m_control_port;
608606}
609607
610WRITE8_DEVICE_HANDLER( cgenie_sh_control_port_w )
608WRITE8_MEMBER(cgenie_state::cgenie_sh_control_port_w)
611609{
612   cgenie_state *state = space.machine().driver_data<cgenie_state>();
613   state->m_control_port = data;
614   ay8910_address_w(device, space, offset, data);
610   m_control_port = data;
611   ay8910_address_w(machine().device("ay8910"), space, offset, data);
615612}
trunk/src/mess/machine/mz700.c
r18257r18258
3636   } while (0)
3737
3838
39static DECLARE_READ8_DEVICE_HANDLER ( pio_port_b_r );
40static DECLARE_READ8_DEVICE_HANDLER ( pio_port_c_r );
41static DECLARE_WRITE8_DEVICE_HANDLER ( pio_port_a_w );
42static DECLARE_WRITE8_DEVICE_HANDLER ( pio_port_c_w );
43
4439I8255_INTERFACE( mz700_ppi8255_interface )
4540{
4641   DEVCB_NULL,
47   DEVCB_DEVICE_HANDLER("ls145", pio_port_a_w),
48   DEVCB_DEVICE_HANDLER("ls145", pio_port_b_r),
42   DEVCB_DRIVER_MEMBER(mz_state,pio_port_a_w),
43   DEVCB_DRIVER_MEMBER(mz_state,pio_port_b_r),
4944   DEVCB_NULL,
50   DEVCB_DEVICE_HANDLER("ppi8255", pio_port_c_r),
51   DEVCB_DEVICE_HANDLER("ppi8255", pio_port_c_w)
45   DEVCB_DRIVER_MEMBER(mz_state,pio_port_c_r),
46   DEVCB_DRIVER_MEMBER(mz_state,pio_port_c_w)
5247};
5348
5449
55static WRITE_LINE_DEVICE_HANDLER( pit_out0_changed );
56static WRITE_LINE_DEVICE_HANDLER( pit_irq_2 );
5750
51
52
5853const struct pit8253_config mz700_pit8253_config =
5954{
6055   {
6156      /* clockin             gate            callback */
62      { XTAL_17_73447MHz/20, DEVCB_NULL,     DEVCB_DEVICE_LINE("pit8253", pit_out0_changed) },
57      { XTAL_17_73447MHz/20, DEVCB_NULL,     DEVCB_DRIVER_LINE_MEMBER(mz_state,pit_out0_changed) },
6358      {             15611.0, DEVCB_LINE_VCC, DEVCB_DEVICE_LINE("pit8253", pit8253_clk2_w)   },
64      {                  0, DEVCB_LINE_VCC, DEVCB_DEVICE_LINE("pit8253", pit_irq_2)        },
59      {                  0, DEVCB_LINE_VCC, DEVCB_DRIVER_LINE_MEMBER(mz_state,pit_irq_2)        },
6560   }
6661};
6762
r18257r18258
6964{
7065   {
7166      /* clockin             gate            callback */
72      { XTAL_17_73447MHz/16, DEVCB_NULL,     DEVCB_DEVICE_LINE("pit8253", pit_out0_changed) },
67      { XTAL_17_73447MHz/16, DEVCB_NULL,     DEVCB_DRIVER_LINE_MEMBER(mz_state,pit_out0_changed) },
7368      {             15611.0, DEVCB_LINE_VCC, DEVCB_DEVICE_LINE("pit8253", pit8253_clk2_w)   },
74      {                  0, DEVCB_LINE_VCC, DEVCB_DEVICE_LINE("pit8253", pit_irq_2)        },
69      {                  0, DEVCB_LINE_VCC, DEVCB_DRIVER_LINE_MEMBER(mz_state,pit_irq_2)        },
7570   }
7671};
7772
r18257r18258
407402
408403/* Timer 0 is the clock for the speaker output */
409404
410static WRITE_LINE_DEVICE_HANDLER( pit_out0_changed )
405WRITE_LINE_MEMBER(mz_state::pit_out0_changed)
411406{
412   mz_state *drvstate = device->machine().driver_data<mz_state>();
413   device_t *speaker = device->machine().device(SPEAKER_TAG);
414   if((drvstate->m_prev_state==0) && (state==1)) {
415      drvstate->m_speaker_level ^= 1;
407   device_t *speaker = machine().device(SPEAKER_TAG);
408   if((m_prev_state==0) && (state==1)) {
409      m_speaker_level ^= 1;
416410   }
417   drvstate->m_prev_state = state;
418   speaker_level_w( speaker, drvstate->m_speaker_level);
411   m_prev_state = state;
412   speaker_level_w( speaker, m_speaker_level);
419413}
420414
421415/* timer 2 is the AM/PM (12 hour) interrupt */
422static WRITE_LINE_DEVICE_HANDLER( pit_irq_2 )
416WRITE_LINE_MEMBER(mz_state::pit_irq_2)
423417{
424   mz_state *mz = device->machine().driver_data<mz_state>();
425
426   if (!mz->m_intmsk)
427      device->machine().device("maincpu")->execute().set_input_line(0, state);
418   if (!m_intmsk)
419      machine().device("maincpu")->execute().set_input_line(0, state);
428420}
429421
430422
r18257r18258
432424    8255 PPI
433425***************************************************************************/
434426
435static READ8_DEVICE_HANDLER( pio_port_b_r )
427READ8_MEMBER(mz_state::pio_port_b_r)
436428{
429   device_t *device = machine().device("ls145");
437430   int key_line = dynamic_cast<ttl74145_device *>(device)->read();
438431   const char *const keynames[10] = { "ROW0", "ROW1", "ROW2", "ROW3", "ROW4", "ROW5", "ROW6", "ROW7", "ROW8", "ROW9" };
439432   int i;
r18257r18258
442435   for(i=0;i<10;i++)
443436   {
444437      if(key_line & (1 << i))
445         res |= space.machine().root_device().ioport(keynames[i])->read();
438         res |= machine().root_device().ioport(keynames[i])->read();
446439   }
447440
448441    return res;
r18257r18258
454447 * bit 5 in     tape data (RDATA)
455448 * bit 4 in     motor (1 = on)
456449 */
457static READ8_DEVICE_HANDLER( pio_port_c_r )
450READ8_MEMBER(mz_state::pio_port_c_r)
458451{
459   cassette_image_device *cas = space.machine().device<cassette_image_device>(CASSETTE_TAG);
460   mz_state *mz = space.machine().driver_data<mz_state>();
452   cassette_image_device *cas = machine().device<cassette_image_device>(CASSETTE_TAG);
461453   UINT8 data = 0;
462454
463455   /* note: this is actually connected to Q output of the motor-control flip-flop (see below) */
r18257r18258
467459   if ((cas)->input() > 0.0038)
468460      data |= 0x20;       /* set the RDATA status */
469461
470   data |= mz->m_cursor_timer << 6;
471   data |= space.machine().primary_screen->vblank() << 7;
462   data |= m_cursor_timer << 6;
463   data |= machine().primary_screen->vblank() << 7;
472464
473   LOG(2,"mz700_pio_port_c_r",("%02X\n", data),space.machine());
465   LOG(2,"mz700_pio_port_c_r",("%02X\n", data),machine());
474466
475467   return data;
476468}
477469
478470
479static WRITE8_DEVICE_HANDLER( pio_port_a_w )
471WRITE8_MEMBER(mz_state::pio_port_a_w)
480472{
481   timer_device *timer = space.machine().device<timer_device>("cursor");
473   device_t *device = machine().device("ls145");
474   timer_device *timer = machine().device<timer_device>("cursor");
482475
483   LOG(2,"mz700_pio_port_a_w",("%02X\n", data),space.machine());
476   LOG(2,"mz700_pio_port_a_w",("%02X\n", data),machine());
484477
485478   /* the ls145 is connected to PA0-PA3 */
486479   dynamic_cast<ttl74145_device *>(device)->write(data & 0x07);
r18257r18258
490483}
491484
492485
493static WRITE8_DEVICE_HANDLER( pio_port_c_w )
486WRITE8_MEMBER(mz_state::pio_port_c_w)
494487{
495488    /*
496489     * bit 3 out    motor control (0 = on)
r18257r18258
499492     * bit 0 out    unused
500493     */
501494
502//  UINT8 state = cassette_get_state(space.machine().device<cassette_image_device>(CASSETTE_TAG));
495//  UINT8 state = cassette_get_state(machine().device<cassette_image_device>(CASSETTE_TAG));
503496//  UINT8 action = ((~pio_port_c_output & 8) & (data & 8));     /* detect low-to-high transition */
504497
505498   /* The motor control circuit consists of a resistor, capacitor, invertor, nand-gate, and D flip-flop.
r18257r18258
512505        If you load from the command-line or the software-picker, type in L <enter> immediately. */
513506#if 0
514507
515      space.machine().device<cassette_image_device>(CASSETTE_TAG)->change_state(
508      machine().device<cassette_image_device>(CASSETTE_TAG)->change_state(
516509      ((data & 0x08) && mz700_motor_on) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED,
517510      CASSETTE_MOTOR_DISABLED);
518511
519512#endif
520513
521   LOG(2,"mz700_pio_port_c_w",("%02X\n", data),space.machine());
514   LOG(2,"mz700_pio_port_c_w",("%02X\n", data),machine());
522515
523   space.machine().device<cassette_image_device>(CASSETTE_TAG)->output((data & 0x02) ? +1.0 : -1.0);
516   machine().device<cassette_image_device>(CASSETTE_TAG)->output((data & 0x02) ? +1.0 : -1.0);
524517}
525518
526519
r18257r18258
543536   device->machine().device("maincpu")->execute().set_input_line(0, which);
544537}
545538
546static READ8_DEVICE_HANDLER( mz800_z80pio_port_a_r )
539READ8_MEMBER(mz_state::mz800_z80pio_port_a_r)
547540{
548   centronics_device *centronics = space.machine().device<centronics_device>("centronics");
541   centronics_device *centronics = machine().device<centronics_device>("centronics");
549542   UINT8 result = 0;
550543
551544   result |= centronics->busy_r();
552545   result |= centronics->pe_r() << 1;
553   result |= space.machine().primary_screen->hblank() << 5;
546   result |= machine().primary_screen->hblank() << 5;
554547
555548   return result;
556549}
557550
558static WRITE8_DEVICE_HANDLER( mz800_z80pio_port_a_w )
551WRITE8_MEMBER(mz_state::mz800_z80pio_port_a_w)
559552{
560   centronics_device *centronics = space.machine().device<centronics_device>("centronics");
553   centronics_device *centronics = machine().device<centronics_device>("centronics");
561554
562555   centronics->init_prime_w(BIT(data, 6));
563556   centronics->strobe_w(BIT(data, 7));
r18257r18258
566559const z80pio_interface mz800_z80pio_config =
567560{
568561   DEVCB_DEVICE_LINE("z80pio", mz800_z80pio_irq),
569   DEVCB_DEVICE_HANDLER("z80pio", mz800_z80pio_port_a_r),
570   DEVCB_DEVICE_HANDLER("z80pio", mz800_z80pio_port_a_w),
562   DEVCB_DRIVER_MEMBER(mz_state,mz800_z80pio_port_a_r),
563   DEVCB_DRIVER_MEMBER(mz_state,mz800_z80pio_port_a_w),
571564   DEVCB_NULL,
572565   DEVCB_NULL,
573566   DEVCB_DEVICE_MEMBER("centronics", centronics_device, write),
trunk/src/mess/machine/rmnimbus.c
r18257r18258
6767
6868#include "includes/rmnimbus.h"
6969
70static WRITE_LINE_DEVICE_HANDLER( sio_interrupt );
71//static DECLARE_WRITE8_DEVICE_HANDLER( sio_dtr_w );
72static DECLARE_WRITE16_DEVICE_HANDLER( sio_serial_transmit );
73static DECLARE_READ16_DEVICE_HANDLER( sio_serial_receive );
7470
7571
7672/*-------------------------------------------------------------------------*/
r18257r18258
113109
114110const z80sio_interface nimbus_sio_intf =
115111{
116   DEVCB_LINE(sio_interrupt),         /* interrupt handler */
112   DEVCB_DRIVER_LINE_MEMBER(rmnimbus_state,sio_interrupt),         /* interrupt handler */
117113   DEVCB_NULL, //sio_dtr_w,             /* DTR changed handler */
118114   DEVCB_NULL,                  /* RTS changed handler */
119115   DEVCB_NULL,                  /* BREAK changed handler */
120   DEVCB_HANDLER(sio_serial_transmit),   /* transmit handler */
121   DEVCB_HANDLER(sio_serial_receive)      /* receive handler */
116   DEVCB_DRIVER_MEMBER16(rmnimbus_state,sio_serial_transmit),   /* transmit handler */
117   DEVCB_DRIVER_MEMBER16(rmnimbus_state,sio_serial_receive)      /* receive handler */
122118};
123119
124120/* Floppy drives WD2793 */
125121
126static WRITE_LINE_DEVICE_HANDLER( nimbus_fdc_intrq_w );
127static WRITE_LINE_DEVICE_HANDLER( nimbus_fdc_drq_w );
128122
123
124
129125const wd17xx_interface nimbus_wd17xx_interface =
130126{
131127   DEVCB_LINE_GND,
132   DEVCB_LINE(nimbus_fdc_intrq_w),
133   DEVCB_LINE(nimbus_fdc_drq_w),
128   DEVCB_DRIVER_LINE_MEMBER(rmnimbus_state,nimbus_fdc_intrq_w),
129   DEVCB_DRIVER_LINE_MEMBER(rmnimbus_state,nimbus_fdc_drq_w),
134130   {FLOPPY_0, FLOPPY_1, FLOPPY_2, FLOPPY_3}
135131};
136132
r18257r18258
21822178
21832179/* Z80 SIO/2 */
21842180
2185static WRITE_LINE_DEVICE_HANDLER( sio_interrupt )
2181WRITE_LINE_MEMBER(rmnimbus_state::sio_interrupt)
21862182{
2187   rmnimbus_state *drvstate = device->machine().driver_data<rmnimbus_state>();
21882183    if(LOG_SIO)
21892184        logerror("SIO Interrupt state=%02X\n",state);
21902185
21912186    // Don't re-trigger if already active !
2192    if(state!=drvstate->m_sio_int_state)
2187    if(state!=m_sio_int_state)
21932188    {
2194        drvstate->m_sio_int_state=state;
2189        m_sio_int_state=state;
21952190
21962191        if(state)
2197            external_int(device->machine(),0,EXTERNAL_INT_Z80SIO);
2192            external_int(machine(),0,EXTERNAL_INT_Z80SIO);
21982193    }
21992194}
22002195
22012196#ifdef UNUSED_FUNCTION
2202WRITE8_DEVICE_HANDLER( sio_dtr_w )
2197WRITE8_MEMBER(rmnimbus_state::sio_dtr_w)
22032198{
22042199   if (offset == 1)
22052200   {
r18257r18258
22072202}
22082203#endif
22092204
2210static WRITE16_DEVICE_HANDLER( sio_serial_transmit )
2205WRITE16_MEMBER(rmnimbus_state::sio_serial_transmit)
22112206{
22122207}
22132208
2214static READ16_DEVICE_HANDLER( sio_serial_receive )
2209READ16_MEMBER(rmnimbus_state::sio_serial_receive)
22152210{
22162211    if(offset==0)
22172212    {
2218        return keyboard_queue_read(space.machine());
2213        return keyboard_queue_read(machine());
22192214    }
22202215    else
22212216        return -1;
r18257r18258
22502245    }
22512246}
22522247
2253static WRITE_LINE_DEVICE_HANDLER( nimbus_fdc_intrq_w )
2248WRITE_LINE_MEMBER(rmnimbus_state::nimbus_fdc_intrq_w)
22542249{
2255    set_disk_int(device->machine(),state);
2250    set_disk_int(machine(),state);
22562251}
22572252
2258static WRITE_LINE_DEVICE_HANDLER( nimbus_fdc_drq_w )
2253WRITE_LINE_MEMBER(rmnimbus_state::nimbus_fdc_drq_w)
22592254{
2260   rmnimbus_state *drvstate = device->machine().driver_data<rmnimbus_state>();
2261
22622255    if(LOG_DISK)
22632256        logerror("nimbus_drives_drq_w(%d)\n", state);
22642257
2265    if(state && FDC_DRQ_ENABLED(drvstate))
2266        drq_callback(device->machine(),1);
2258    if(state && FDC_DRQ_ENABLED(this))
2259        drq_callback(machine(),1);
22672260}
22682261
22692262static UINT8 fdc_driveno(UINT8 drivesel)
r18257r18258
30173010***********************************************************************/
30183011
30193012/* USER VIA 6522 port B is connected to the BBC user port */
3020static READ8_DEVICE_HANDLER( nimbus_via_read_portb )
3013READ8_MEMBER(rmnimbus_state::nimbus_via_read_portb)
30213014{
30223015   return 0xff;
30233016}
30243017
3025static WRITE8_DEVICE_HANDLER( nimbus_via_write_portb )
3018WRITE8_MEMBER(rmnimbus_state::nimbus_via_write_portb)
30263019{
30273020}
30283021
3029static WRITE_LINE_DEVICE_HANDLER( nimbus_via_irq_w )
3022WRITE_LINE_MEMBER(rmnimbus_state::nimbus_via_irq_w)
30303023{
30313024   if(state)
3032      external_int(device->machine(),VIA_INT,0x00);
3025      external_int(machine(),VIA_INT,0x00);
30333026}
30343027
30353028const via6522_interface nimbus_via =
30363029{
30373030   DEVCB_NULL,   //via_user_read_porta,
3038   DEVCB_HANDLER(nimbus_via_read_portb),
3031   DEVCB_DRIVER_MEMBER(rmnimbus_state,nimbus_via_read_portb),
30393032   DEVCB_NULL,   //via_user_read_ca1,
30403033   DEVCB_NULL,   //via_user_read_cb1,
30413034   DEVCB_NULL,   //via_user_read_ca2,
30423035   DEVCB_NULL,   //via_user_read_cb2,
30433036   DEVCB_DEVICE_MEMBER(CENTRONICS_TAG, centronics_device, write),
3044   DEVCB_HANDLER(nimbus_via_write_portb),
3037   DEVCB_DRIVER_MEMBER(rmnimbus_state,nimbus_via_write_portb),
30453038   DEVCB_NULL, //via_user_write_ca1
30463039   DEVCB_NULL, //via_user_write_cb1
30473040   DEVCB_DEVICE_LINE_MEMBER(CENTRONICS_TAG, centronics_device, strobe_w),
30483041   DEVCB_NULL,   //via_user_write_cb2,
3049   DEVCB_LINE(nimbus_via_irq_w)
3042   DEVCB_DRIVER_LINE_MEMBER(rmnimbus_state,nimbus_via_irq_w)
30503043};
30513044
3052WRITE_LINE_DEVICE_HANDLER(nimbus_ack_w)
3045WRITE_LINE_MEMBER(rmnimbus_state::nimbus_ack_w)
30533046{
3054   via6522_device *via_1 = device->machine().device<via6522_device>(VIA_TAG);
3047   via6522_device *via_1 = machine().device<via6522_device>(VIA_TAG);
30553048   via_1->write_ca1(!state); /* ack seems to be inverted? */
30563049}
30573050
trunk/src/mess/machine/mac.c
r18257r18258
104104#include "machine/ram.h"
105105#include "debugger.h"
106106
107#define AUDIO_IS_CLASSIC (mac->m_model <= MODEL_MAC_CLASSIC)
107#define AUDIO_IS_CLASSIC (m_model <= MODEL_MAC_CLASSIC)
108108#define MAC_HAS_VIA2   ((m_model >= MODEL_MAC_II) && (m_model != MODEL_MAC_IIFX))
109109
110110#define ASC_INTS_RBV   ((mac->m_model >= MODEL_MAC_IICI) && (mac->m_model <= MODEL_MAC_IIVI)) || ((mac->m_model >= MODEL_MAC_LC) && (mac->m_model <= MODEL_MAC_COLOR_CLASSIC))
r18257r18258
132132static int scan_keyboard(running_machine &machine);
133133
134134static void keyboard_receive(running_machine &machine, int val);
135static DECLARE_READ8_DEVICE_HANDLER(mac_via_in_a);
136static DECLARE_READ8_DEVICE_HANDLER(mac_via_in_b);
137static DECLARE_READ8_DEVICE_HANDLER(mac_adb_via_in_cb2);
138static DECLARE_WRITE8_DEVICE_HANDLER(mac_via_out_a);
139static DECLARE_WRITE8_DEVICE_HANDLER(mac_via_out_b);
140static DECLARE_WRITE8_DEVICE_HANDLER(mac_adb_via_out_cb2);
141static DECLARE_WRITE8_DEVICE_HANDLER(mac_via_out_cb2);
142static DECLARE_READ8_DEVICE_HANDLER(mac_via2_in_a);
143static DECLARE_READ8_DEVICE_HANDLER(mac_via2_in_b);
144static DECLARE_WRITE8_DEVICE_HANDLER(mac_via2_out_a);
145static DECLARE_WRITE8_DEVICE_HANDLER(mac_via2_out_b);
135
146136static void mac_via_irq(device_t *device, int state);
147137static void mac_via2_irq(device_t *device, int state);
148138static offs_t mac_dasm_override(device_t &device, char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, int options);
149139
150140const via6522_interface mac_via6522_intf =
151141{
152   DEVCB_HANDLER(mac_via_in_a), DEVCB_HANDLER(mac_via_in_b),
142   DEVCB_DRIVER_MEMBER(mac_state,mac_via_in_a), DEVCB_DRIVER_MEMBER(mac_state,mac_via_in_b),
153143   DEVCB_NULL, DEVCB_NULL,
154144   DEVCB_NULL, DEVCB_NULL,
155   DEVCB_HANDLER(mac_via_out_a), DEVCB_HANDLER(mac_via_out_b),
145   DEVCB_DRIVER_MEMBER(mac_state,mac_via_out_a), DEVCB_DRIVER_MEMBER(mac_state,mac_via_out_b),
156146   DEVCB_NULL, DEVCB_NULL,
157   DEVCB_NULL, DEVCB_HANDLER(mac_via_out_cb2),
147   DEVCB_NULL, DEVCB_DRIVER_MEMBER(mac_state,mac_via_out_cb2),
158148   DEVCB_LINE(mac_via_irq)
159149};
160150
161151const via6522_interface mac_via6522_adb_intf =
162152{
163   DEVCB_HANDLER(mac_via_in_a), DEVCB_HANDLER(mac_via_in_b),
153   DEVCB_DRIVER_MEMBER(mac_state,mac_via_in_a), DEVCB_DRIVER_MEMBER(mac_state,mac_via_in_b),
164154   DEVCB_NULL, DEVCB_NULL,
165   DEVCB_NULL, DEVCB_HANDLER(mac_adb_via_in_cb2),
166   DEVCB_HANDLER(mac_via_out_a), DEVCB_HANDLER(mac_via_out_b),
155   DEVCB_NULL, DEVCB_DRIVER_MEMBER(mac_state,mac_adb_via_in_cb2),
156   DEVCB_DRIVER_MEMBER(mac_state,mac_via_out_a), DEVCB_DRIVER_MEMBER(mac_state,mac_via_out_b),
167157   DEVCB_NULL, DEVCB_NULL,
168   DEVCB_NULL, DEVCB_HANDLER(mac_adb_via_out_cb2),
158   DEVCB_NULL, DEVCB_DRIVER_MEMBER(mac_state,mac_adb_via_out_cb2),
169159   DEVCB_LINE(mac_via_irq)
170160};
171161
172162const via6522_interface mac_via6522_2_intf =
173163{
174   DEVCB_HANDLER(mac_via2_in_a), DEVCB_HANDLER(mac_via2_in_b),
164   DEVCB_DRIVER_MEMBER(mac_state,mac_via2_in_a), DEVCB_DRIVER_MEMBER(mac_state,mac_via2_in_b),
175165   DEVCB_NULL, DEVCB_NULL,
176166   DEVCB_NULL, DEVCB_NULL,
177   DEVCB_HANDLER(mac_via2_out_a), DEVCB_HANDLER(mac_via2_out_b),
167   DEVCB_DRIVER_MEMBER(mac_state,mac_via2_out_a), DEVCB_DRIVER_MEMBER(mac_state,mac_via2_out_b),
178168   DEVCB_NULL, DEVCB_NULL,
179169   DEVCB_NULL, DEVCB_NULL,
180170   DEVCB_LINE(mac_via2_irq)
r18257r18258
735725   }
736726}
737727
738static WRITE8_DEVICE_HANDLER(mac_via_out_cb2)
728WRITE8_MEMBER(mac_state::mac_via_out_cb2)
739729{
740   mac_state *mac = space.machine().driver_data<mac_state>();
741
742   if (mac->m_kbd_comm == FALSE && data == 0)
730   if (m_kbd_comm == FALSE && data == 0)
743731   {
744732      /* Mac pulls CB2 down to initiate communication */
745      mac->m_kbd_comm = TRUE;
746      mac->m_kbd_receive = TRUE;
747      space.machine().scheduler().timer_set(attotime::from_usec(100), timer_expired_delegate(FUNC(mac_state::kbd_clock),mac));
733      m_kbd_comm = TRUE;
734      m_kbd_receive = TRUE;
735      machine().scheduler().timer_set(attotime::from_usec(100), timer_expired_delegate(FUNC(mac_state::kbd_clock),this));
748736   }
749   if (mac->m_kbd_comm == TRUE && mac->m_kbd_receive == TRUE)
737   if (m_kbd_comm == TRUE && m_kbd_receive == TRUE)
750738   {
751739      /* Shift in what mac is sending */
752      mac->m_kbd_shift_reg = (mac->m_kbd_shift_reg & ~1) | data;
740      m_kbd_shift_reg = (m_kbd_shift_reg & ~1) | data;
753741   }
754742}
755743
r18257r18258
11751163      applefdc_w(fdc, space, (offset >> 8), data>>8);
11761164}
11771165
1178static READ8_DEVICE_HANDLER(mac_adb_via_in_cb2)
1166READ8_MEMBER(mac_state::mac_adb_via_in_cb2)
11791167{
11801168   UINT8 ret;
1181   mac_state *mac = space.machine().driver_data<mac_state>();
1182
11831169    if (ADB_IS_EGRET)
11841170    {
1185        ret = mac->m_egret->get_via_data();
1171        ret = m_egret->get_via_data();
11861172      #if LOG_ADB
11871173      printf("68K: Read VIA_DATA %x\n", ret);
11881174      #endif
11891175    }
11901176   else if (ADB_IS_CUDA)
11911177   {
1192        ret = mac->m_cuda->get_via_data();
1178        ret = m_cuda->get_via_data();
11931179      #if LOG_ADB
11941180      printf("68K: Read VIA_DATA %x\n", ret);
11951181      #endif
11961182   }
11971183    else
11981184    {
1199        ret = (mac->m_adb_send & 0x80)>>7;
1200        mac->m_adb_send <<= 1;
1185        ret = (m_adb_send & 0x80)>>7;
1186        m_adb_send <<= 1;
12011187    }
12021188
12031189//  printf("VIA IN CB2 = %x\n", ret);
r18257r18258
12051191   return ret;
12061192}
12071193
1208static WRITE8_DEVICE_HANDLER(mac_adb_via_out_cb2)
1194WRITE8_MEMBER(mac_state::mac_adb_via_out_cb2)
12091195{
1210   mac_state *mac = space.machine().driver_data<mac_state>();
1211
12121196//        printf("VIA OUT CB2 = %x\n", data);
12131197    if (ADB_IS_EGRET)
12141198    {
1215        mac->m_egret->set_via_data(data & 1);
1199        m_egret->set_via_data(data & 1);
12161200    }
12171201    else if (ADB_IS_CUDA)
12181202    {
1219        mac->m_cuda->set_via_data(data & 1);
1203        m_cuda->set_via_data(data & 1);
12201204    }
12211205    else
12221206    {
1223        mac->m_adb_command <<= 1;
1224        mac->m_adb_command |= data & 1;
1207        m_adb_command <<= 1;
1208        m_adb_command |= data & 1;
12251209    }
12261210}
12271211
r18257r18258
12611245#define PA2 0x04
12621246#define PA1 0x02
12631247
1264static READ8_DEVICE_HANDLER(mac_via_in_a)
1248READ8_MEMBER(mac_state::mac_via_in_a)
12651249{
1266   mac_state *mac = space.machine().driver_data<mac_state>();
1250//  printf("VIA1 IN_A (PC %x)\n", machine().device("maincpu")->safe_pc());
12671251
1268//  printf("VIA1 IN_A (PC %x)\n", space.machine().device("maincpu")->safe_pc());
1269
1270   switch (mac->m_model)
1252   switch (m_model)
12711253   {
12721254      case MODEL_MAC_PORTABLE:
12731255      case MODEL_MAC_PB100:
12741256         #if LOG_ADB
1275//          printf("Read PM data %x\n", mac->m_pm_data_recv);
1257//          printf("Read PM data %x\n", m_pm_data_recv);
12761258         #endif
1277         return mac->m_pm_data_recv;
1259         return m_pm_data_recv;
12781260
12791261      case MODEL_MAC_CLASSIC:
12801262      case MODEL_MAC_II:
r18257r18258
13281310   return 0x80;
13291311}
13301312
1331static READ8_DEVICE_HANDLER(mac_via_in_b)
1313READ8_MEMBER(mac_state::mac_via_in_b)
13321314{
13331315   int val = 0;
1334   mac_state *mac = space.machine().driver_data<mac_state>();
1335
13361316   // portable/PB100 is pretty different
1337   if (mac->m_model >= MODEL_MAC_PORTABLE && mac->m_model <= MODEL_MAC_PB100)
1317   if (m_model >= MODEL_MAC_PORTABLE && m_model <= MODEL_MAC_PB100)
13381318   {
1339//      printf("Read VIA B: PM_ACK %x\n", mac->m_pm_ack);
1340      val = 0x80 | 0x04 | mac->m_pm_ack;   // SCC wait/request (bit 2 must be set at 900c1a or startup tests always fail)
1319//      printf("Read VIA B: PM_ACK %x\n", m_pm_ack);
1320      val = 0x80 | 0x04 | m_pm_ack;   // SCC wait/request (bit 2 must be set at 900c1a or startup tests always fail)
13411321   }
13421322   else
13431323   {
13441324      /* video beam in display (! VBLANK && ! HBLANK basically) */
1345      if (space.machine().primary_screen->vpos() >= MAC_V_VIS)
1325      if (machine().primary_screen->vpos() >= MAC_V_VIS)
13461326         val |= 0x40;
13471327
1348      if (ADB_IS_BITBANG)
1328      if (ADB_IS_BITBANG_CLASS)
13491329      {
1350         val |= mac->m_adb_state<<4;
1330         val |= m_adb_state<<4;
13511331
1352         if (!mac->m_adb_irq_pending)
1332         if (!m_adb_irq_pending)
13531333         {
13541334            val |= 0x08;
13551335         }
13561336      }
13571337      else if (ADB_IS_EGRET)
13581338        {
1359            val |= mac->m_egret->get_xcvr_session()<<3;
1339            val |= m_egret->get_xcvr_session()<<3;
13601340      }
13611341      else if (ADB_IS_CUDA)
13621342        {
1363            val |= mac->m_cuda->get_treq()<<3;
1343            val |= m_cuda->get_treq()<<3;
13641344      }
13651345      else
13661346      {
1367         if (mac->m_mouse_bit_y)   /* Mouse Y2 */
1347         if (m_mouse_bit_y)   /* Mouse Y2 */
13681348            val |= 0x20;
1369         if (mac->m_mouse_bit_x)   /* Mouse X2 */
1349         if (m_mouse_bit_x)   /* Mouse X2 */
13701350            val |= 0x10;
1371         if ((space.machine().root_device().ioport("MOUSE0")->read() & 0x01) == 0)
1351         if ((machine().root_device().ioport("MOUSE0")->read() & 0x01) == 0)
13721352            val |= 0x08;
13731353      }
1374      if (mac->m_rtc_data_out)
1354      if (m_rtc_data_out)
13751355         val |= 1;
13761356   }
13771357
1378//  printf("VIA1 IN_B = %02x (PC %x)\n", val, space.machine().device("maincpu")->safe_pc());
1358//  printf("VIA1 IN_B = %02x (PC %x)\n", val, machine().device("maincpu")->safe_pc());
13791359
13801360   return val;
13811361}
13821362
1383static WRITE8_DEVICE_HANDLER(mac_via_out_a)
1363WRITE8_MEMBER(mac_state::mac_via_out_a)
13841364{
1385   device_t *sound = space.machine().device("custom");
1386   device_t *fdc = space.machine().device("fdc");
1387   mac_state *mac = space.machine().driver_data<mac_state>();
1365   device_t *sound = machine().device("custom");
1366   device_t *fdc = machine().device("fdc");
1367//  printf("VIA1 OUT A: %02x (PC %x)\n", data, machine().device("maincpu")->safe_pc());
13881368
1389//  printf("VIA1 OUT A: %02x (PC %x)\n", data, space.machine().device("maincpu")->safe_pc());
1390
13911369   if (ADB_IS_PM_VIA1)
13921370   {
13931371      #if LOG_ADB
13941372//      printf("%02x to PM\n", data);
13951373      #endif
1396      mac->m_pm_data_send = data;
1374      m_pm_data_send = data;
13971375      return;
13981376   }
13991377
14001378   set_scc_waitrequest((data & 0x80) >> 7);
1401   mac->m_screen_buffer = (data & 0x40) >> 6;
1379   m_screen_buffer = (data & 0x40) >> 6;
14021380   sony_set_sel_line(fdc,(data & 0x20) >> 5);
1403   if (mac->m_model == MODEL_MAC_SE)   // on SE this selects which floppy drive (0 = upper, 1 = lower)
1381   if (m_model == MODEL_MAC_SE)   // on SE this selects which floppy drive (0 = upper, 1 = lower)
14041382   {
1405      mac->m_drive_select = ((data & 0x10) >> 4);
1383      m_drive_select = ((data & 0x10) >> 4);
14061384   }
14071385
1408   if (mac->m_model < MODEL_MAC_SE)   // SE no longer has dual buffers
1386   if (m_model < MODEL_MAC_SE)   // SE no longer has dual buffers
14091387   {
14101388      mac_set_sound_buffer(sound, (data & 0x08) >> 3);
14111389   }
14121390
1413   if (mac->m_model < MODEL_MAC_II)
1391   if (m_model < MODEL_MAC_II)
14141392   {
14151393      mac_set_volume(sound, data & 0x07);
14161394   }
r18257r18258
14181396   /* Early Mac models had VIA A4 control overlaying.  In the Mac SE (and
14191397     * possibly later models), overlay was set on reset, but cleared on the
14201398     * first access to the ROM. */
1421   if (mac->m_model < MODEL_MAC_SE)
1399   if (m_model < MODEL_MAC_SE)
14221400   {
1423      mac->set_memory_overlay((data & 0x10) >> 4);
1401      set_memory_overlay((data & 0x10) >> 4);
14241402   }
14251403}
14261404
1427static WRITE8_DEVICE_HANDLER(mac_via_out_b)
1405WRITE8_MEMBER(mac_state::mac_via_out_b)
14281406{
1429   device_t *sound = space.machine().device("custom");
1407   device_t *sound = machine().device("custom");
14301408   int new_rtc_rTCClk;
1431   mac_state *mac = space.machine().driver_data<mac_state>();
1409//  printf("VIA1 OUT B: %02x (PC %x)\n", data, machine().device("maincpu")->safe_pc());
14321410
1433//  printf("VIA1 OUT B: %02x (PC %x)\n", data, space.machine().device("maincpu")->safe_pc());
1434
14351411   if (ADB_IS_PM_VIA1)
14361412   {
1437      device_t *fdc = space.machine().device("fdc");
1413      device_t *fdc = machine().device("fdc");
14381414
14391415      sony_set_sel_line(fdc,(data & 0x20) >> 5);
1440      mac->m_drive_select = ((data & 0x10) >> 4);
1416      m_drive_select = ((data & 0x10) >> 4);
14411417
1442      if ((data & 1) && !(mac->m_pm_req & 1))
1418      if ((data & 1) && !(m_pm_req & 1))
14431419      {
14441420         #if LOG_ADB
14451421         printf("PM: 68k dropping /REQ\n");
14461422         #endif
14471423
1448         if (mac->m_pm_state == 0)    // do this in receive state only
1424         if (m_pm_state == 0)    // do this in receive state only
14491425         {
1450            mac->m_pm_data_recv = 0xff;
1451            mac->m_pm_ack |= 2;
1426            m_pm_data_recv = 0xff;
1427            m_pm_ack |= 2;
14521428
14531429            // check if length byte matches
1454            if ((mac->m_pm_dptr >= 2) && (mac->m_pm_cmd[1] == (mac->m_pm_dptr-2)))
1430            if ((m_pm_dptr >= 2) && (m_pm_cmd[1] == (m_pm_dptr-2)))
14551431            {
1456               mac->pmu_exec();
1432               pmu_exec();
14571433               #if LOG_ADB
1458               printf("PMU exec: command %02x length %d\n", mac->m_pm_cmd[0], mac->m_pm_cmd[1]);
1434               printf("PMU exec: command %02x length %d\n", m_pm_cmd[0], m_pm_cmd[1]);
14591435               #endif
14601436            }
14611437         }
14621438      }
1463      else if (!(data & 1) && (mac->m_pm_req & 1))
1439      else if (!(data & 1) && (m_pm_req & 1))
14641440      {
1465         if (mac->m_pm_state == 0)
1441         if (m_pm_state == 0)
14661442         {
14671443            #if LOG_ADB
1468            printf("PM: 68k asserting /REQ, clocking in byte [%d] = %02x\n", mac->m_pm_dptr, mac->m_pm_data_send);
1444            printf("PM: 68k asserting /REQ, clocking in byte [%d] = %02x\n", m_pm_dptr, m_pm_data_send);
14691445            #endif
1470            mac->m_pm_ack &= ~2;   // clear, we're waiting for more bytes
1471            mac->m_pm_cmd[mac->m_pm_dptr++] = mac->m_pm_data_send;
1446            m_pm_ack &= ~2;   // clear, we're waiting for more bytes
1447            m_pm_cmd[m_pm_dptr++] = m_pm_data_send;
14721448         }
14731449         else   // receiving, so this is different
14741450         {
1475            mac->m_pm_data_recv = mac->m_pm_out[mac->m_pm_sptr++];
1476            mac->m_pm_slen--;
1477            mac->m_pm_ack |= 2;   // raise ACK to indicate available byte
1451            m_pm_data_recv = m_pm_out[m_pm_sptr++];
1452            m_pm_slen--;
1453            m_pm_ack |= 2;   // raise ACK to indicate available byte
14781454            #if LOG_ADB
1479            printf("PM: 68k asserted /REQ, sending byte %02x\n", mac->m_pm_data_recv);
1455            printf("PM: 68k asserted /REQ, sending byte %02x\n", m_pm_data_recv);
14801456            #endif
14811457
14821458            // another byte to send?
1483            if (mac->m_pm_slen)
1459            if (m_pm_slen)
14841460            {
1485               mac->m_pmu_send_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(100)));
1461               m_pmu_send_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(100)));
14861462            }
14871463            else
14881464            {
1489               mac->m_pm_state = 0;   // back to receive state
1490               mac->m_pmu_send_timer->adjust(attotime::never);
1465               m_pm_state = 0;   // back to receive state
1466               m_pmu_send_timer->adjust(attotime::never);
14911467            }
14921468         }
14931469      }
14941470
1495      mac->m_pm_req = data & 1;
1471      m_pm_req = data & 1;
14961472      return;
14971473   }
14981474
r18257r18258
15021478   }
15031479
15041480   // SE and Classic have SCSI enable/disable here
1505   if ((mac->m_model == MODEL_MAC_SE) || (mac->m_model == MODEL_MAC_CLASSIC))
1481   if ((m_model == MODEL_MAC_SE) || (m_model == MODEL_MAC_CLASSIC))
15061482   {
1507      mac->m_scsiirq_enable = (data & 0x40) ? 0 : 1;
1508//      printf("VIAB & 0x40 = %02x, IRQ enable %d\n", data & 0x40, mac->m_scsiirq_enable);
1483      m_scsiirq_enable = (data & 0x40) ? 0 : 1;
1484//      printf("VIAB & 0x40 = %02x, IRQ enable %d\n", data & 0x40, m_scsiirq_enable);
15091485   }
15101486
1511   if (mac->m_model == MODEL_MAC_SE30)
1487   if (m_model == MODEL_MAC_SE30)
15121488   {
15131489      // 0x40 = 0 means enable vblank on SE/30
1514      mac->m_se30_vbl_enable = (data & 0x40) ? 0 : 1;
1490      m_se30_vbl_enable = (data & 0x40) ? 0 : 1;
15151491
15161492      // clear the interrupt if we disabled it
1517      if (!mac->m_se30_vbl_enable)
1493      if (!m_se30_vbl_enable)
15181494      {
1519         mac->nubus_slot_interrupt(0xe, 0);
1495         nubus_slot_interrupt(0xe, 0);
15201496      }
15211497   }
15221498
1523   mac->rtc_write_rTCEnb(data & 0x04);
1499   rtc_write_rTCEnb(data & 0x04);
15241500   new_rtc_rTCClk = (data >> 1) & 0x01;
1525   if ((! new_rtc_rTCClk) && (mac->m_rtc_rTCClk))
1526      mac->rtc_shift_data(data & 0x01);
1527   mac->m_rtc_rTCClk = new_rtc_rTCClk;
1501   if ((! new_rtc_rTCClk) && (m_rtc_rTCClk))
1502      rtc_shift_data(data & 0x01);
1503   m_rtc_rTCClk = new_rtc_rTCClk;
15281504
1529   if (ADB_IS_BITBANG)
1505   if (ADB_IS_BITBANG_CLASS)
15301506   {
1531      mac->mac_adb_newaction((data & 0x30) >> 4);
1507      mac_adb_newaction((data & 0x30) >> 4);
15321508   }
15331509   else if (ADB_IS_EGRET)
15341510   {
15351511      #if LOG_ADB
1536      printf("68K: New Egret state: SS %d VF %d (PC %x)\n", (data>>5)&1, (data>>4)&1, mac->m_maincpu->pc());
1512      printf("68K: New Egret state: SS %d VF %d (PC %x)\n", (data>>5)&1, (data>>4)&1, m_maincpu->pc());
15371513      #endif
1538        mac->m_egret->set_via_full((data&0x10) ? 1 : 0);
1539        mac->m_egret->set_sys_session((data&0x20) ? 1 : 0);
1514        m_egret->set_via_full((data&0x10) ? 1 : 0);
1515        m_egret->set_sys_session((data&0x20) ? 1 : 0);
15401516   }
15411517   else if (ADB_IS_CUDA)
15421518   {
15431519      #if LOG_ADB
1544      printf("68K: New Cuda state: TIP %d BYTEACK %d (PC %x)\n", (data>>5)&1, (data>>4)&1, mac->m_maincpu->pc());
1520      printf("68K: New Cuda state: TIP %d BYTEACK %d (PC %x)\n", (data>>5)&1, (data>>4)&1, m_maincpu->pc());
15451521      #endif
1546        mac->m_cuda->set_byteack((data&0x10) ? 1 : 0);
1547        mac->m_cuda->set_tip((data&0x20) ? 1 : 0);
1522        m_cuda->set_byteack((data&0x10) ? 1 : 0);
1523        m_cuda->set_tip((data&0x20) ? 1 : 0);
15481524   }
15491525}
15501526
r18257r18258
16281604}
16291605
16301606
1631static READ8_DEVICE_HANDLER(mac_via2_in_a)
1607READ8_MEMBER(mac_state::mac_via2_in_a)
16321608{
16331609   UINT8 result;
1634   mac_state *mac = space.machine().driver_data<mac_state>();
1635
16361610   if (ADB_IS_PM_VIA2)
16371611   {
1638      result = mac->m_pm_data_recv;
1612      result = m_pm_data_recv;
16391613   }
1640   else if ((mac->m_model == MODEL_MAC_QUADRA_700) || (mac->m_model == MODEL_MAC_QUADRA_900) || (mac->m_model == MODEL_MAC_QUADRA_950))
1614   else if ((m_model == MODEL_MAC_QUADRA_700) || (m_model == MODEL_MAC_QUADRA_900) || (m_model == MODEL_MAC_QUADRA_950))
16411615   {
1642      result = 0x80 | mac->m_nubus_irq_state;
1616      result = 0x80 | m_nubus_irq_state;
16431617   }
16441618   else
16451619   {
1646      result = 0xc0 | mac->m_nubus_irq_state;
1620      result = 0xc0 | m_nubus_irq_state;
16471621   }
16481622
16491623   return result;
16501624}
16511625
1652static READ8_DEVICE_HANDLER(mac_via2_in_b)
1626READ8_MEMBER(mac_state::mac_via2_in_b)
16531627{
1654   mac_state *mac =space.machine().driver_data<mac_state>();
1628//  logerror("VIA2 IN B (PC %x)\n", machine().device("maincpu")->safe_pc());
16551629
1656//  logerror("VIA2 IN B (PC %x)\n", space.machine().device("maincpu")->safe_pc());
1657
16581630   if (ADB_IS_PM_VIA2)
16591631   {
1660      if (mac->m_pm_ack == 2)
1632      if (m_pm_ack == 2)
16611633      {
16621634         return 0xcf;
16631635      }
r18257r18258
16671639      }
16681640   }
16691641
1670   if ((mac->m_model == MODEL_MAC_LC) || (mac->m_model == MODEL_MAC_LC_II) || (mac->m_model == MODEL_MAC_CLASSIC_II))
1642   if ((m_model == MODEL_MAC_LC) || (m_model == MODEL_MAC_LC_II) || (m_model == MODEL_MAC_CLASSIC_II))
16711643   {
16721644      return 0x4f;
16731645   }
16741646
1675   if ((mac->m_model == MODEL_MAC_SE30) || (mac->m_model == MODEL_MAC_IIX))
1647   if ((m_model == MODEL_MAC_SE30) || (m_model == MODEL_MAC_IIX))
16761648   {
16771649      return 0x87;   // bits 3 and 6 are tied low on SE/30
16781650   }
r18257r18258
16801652   return 0xcf;      // indicate no NuBus transaction error
16811653}
16821654
1683static WRITE8_DEVICE_HANDLER(mac_via2_out_a)
1655WRITE8_MEMBER(mac_state::mac_via2_out_a)
16841656{
1685   mac_state *mac = space.machine().driver_data<mac_state>();
1686
1687//  logerror("VIA2 OUT A: %02x (PC %x)\n", data, space.machine().device("maincpu")->safe_pc());
1657//  logerror("VIA2 OUT A: %02x (PC %x)\n", data, machine().device("maincpu")->safe_pc());
16881658   if (ADB_IS_PM_VIA2)
16891659   {
1690      mac->m_pm_data_send = data;
1660      m_pm_data_send = data;
16911661      return;
16921662   }
16931663}
16941664
1695static WRITE8_DEVICE_HANDLER(mac_via2_out_b)
1665WRITE8_MEMBER(mac_state::mac_via2_out_b)
16961666{
1697   mac_state *mac = space.machine().driver_data<mac_state>();
1667//  logerror("VIA2 OUT B: %02x (PC %x)\n", data, machine().device("maincpu")->safe_pc());
16981668
1699//  logerror("VIA2 OUT B: %02x (PC %x)\n", data, space.machine().device("maincpu")->safe_pc());
1700
17011669   if (ADB_IS_PM_VIA2)
17021670   {
1703      if ((data & 4) && !(mac->m_pm_req & 4))
1671      if ((data & 4) && !(m_pm_req & 4))
17041672      {
17051673         #if LOG_ADB
17061674         printf("PM: 68k dropping /REQ\n");
17071675         #endif
17081676
1709         if (mac->m_pm_state == 0)    // do this in receive state only
1677         if (m_pm_state == 0)    // do this in receive state only
17101678         {
1711            mac->m_pm_data_recv = 0xff;
1712            mac->m_pm_ack |= 2;
1679            m_pm_data_recv = 0xff;
1680            m_pm_ack |= 2;
17131681
17141682            // check if length byte matches
1715            if ((mac->m_pm_dptr >= 2) && (mac->m_pm_cmd[1] == (mac->m_pm_dptr-2)))
1683            if ((m_pm_dptr >= 2) && (m_pm_cmd[1] == (m_pm_dptr-2)))
17161684            {
1717               mac->pmu_exec();
1685               pmu_exec();
17181686               #if LOG_ADB
1719               printf("PMU exec: command %02x length %d\n", mac->m_pm_cmd[0], mac->m_pm_cmd[1]);
1687               printf("PMU exec: command %02x length %d\n", m_pm_cmd[0], m_pm_cmd[1]);
17201688               #endif
17211689            }
17221690         }
17231691      }
1724      else if (!(data & 4) && (mac->m_pm_req & 4))
1692      else if (!(data & 4) && (m_pm_req & 4))
17251693      {
1726         if (mac->m_pm_state == 0)
1694         if (m_pm_state == 0)
17271695         {
17281696            #if LOG_ADB
1729            printf("PM: 68k asserting /REQ, clocking in byte [%d] = %02x\n", mac->m_pm_dptr, mac->m_pm_data_send);
1697            printf("PM: 68k asserting /REQ, clocking in byte [%d] = %02x\n", m_pm_dptr, m_pm_data_send);
17301698            #endif
1731            mac->m_pm_ack &= ~2;   // clear, we're waiting for more bytes
1732            mac->m_pm_cmd[mac->m_pm_dptr++] = mac->m_pm_data_send;
1699            m_pm_ack &= ~2;   // clear, we're waiting for more bytes
1700            m_pm_cmd[m_pm_dptr++] = m_pm_data_send;
17331701         }
17341702         else   // receiving, so this is different
17351703         {
1736            mac->m_pm_data_recv = mac->m_pm_out[mac->m_pm_sptr++];
1737            mac->m_pm_slen--;
1738            mac->m_pm_ack |= 2;   // raise ACK to indicate available byte
1704            m_pm_data_recv = m_pm_out[m_pm_sptr++];
1705            m_pm_slen--;
1706            m_pm_ack |= 2;   // raise ACK to indicate available byte
17391707            #if LOG_ADB
1740            printf("PM: 68k asserted /REQ, sending byte %02x\n", mac->m_pm_data_recv);
1708            printf("PM: 68k asserted /REQ, sending byte %02x\n", m_pm_data_recv);
17411709            #endif
17421710
17431711            // another byte to send?
1744            if (mac->m_pm_slen)
1712            if (m_pm_slen)
17451713            {
1746               mac->m_pmu_send_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(100)));
1714               m_pmu_send_timer->adjust(attotime(0, ATTOSECONDS_IN_USEC(100)));
17471715            }
17481716            else
17491717            {
1750               mac->m_pm_state = 0;   // back to receive state
1751               mac->m_pmu_send_timer->adjust(attotime::never);
1718               m_pm_state = 0;   // back to receive state
1719               m_pmu_send_timer->adjust(attotime::never);
17521720            }
17531721         }
17541722      }
17551723
1756      mac->m_pm_req = data & 4;
1724      m_pm_req = data & 4;
17571725      return;
17581726   }
17591727   else
17601728   {
17611729      // chain 60.15 Hz to VIA1
1762      mac->m_via1->write_ca1(data>>7);
1730      m_via1->write_ca1(data>>7);
17631731   }
17641732
1765   if (mac->m_model == MODEL_MAC_II)
1733   if (m_model == MODEL_MAC_II)
17661734   {
1767      m68k_set_hmmu_enable(mac->m_maincpu, (data & 0x8) ? M68K_HMMU_DISABLE : M68K_HMMU_ENABLE_II);
1735      m68k_set_hmmu_enable(m_maincpu, (data & 0x8) ? M68K_HMMU_DISABLE : M68K_HMMU_ENABLE_II);
17681736   }
17691737}
17701738
trunk/src/mess/machine/apple1.c
r18257r18258
5151#include "imagedev/cassette.h"
5252#include "machine/ram.h"
5353
54
55
56
57static DECLARE_READ8_DEVICE_HANDLER( apple1_pia0_kbdin );
58static DECLARE_WRITE8_DEVICE_HANDLER( apple1_pia0_dspout );
59static DECLARE_WRITE8_DEVICE_HANDLER( apple1_pia0_dsp_write_signal );
60
61
62
63
6454/*****************************************************************************
6555**  Structures
6656*****************************************************************************/
r18257r18258
7262
7363const pia6821_interface apple1_pia0 =
7464{
75   DEVCB_DEVICE_HANDLER("pia", apple1_pia0_kbdin),            /* Port A input (keyboard) */
65   DEVCB_DRIVER_MEMBER(apple1_state,apple1_pia0_kbdin),            /* Port A input (keyboard) */
7666   DEVCB_NULL,                              /* Port B input (display status) */
7767   DEVCB_NULL,                              /* CA1 input (key pressed) */
7868   DEVCB_NULL,                              /* CB1 input (display ready) */
7969   DEVCB_NULL,                              /* CA2 not used as input */
8070   DEVCB_NULL,                              /* CB2 not used as input */
8171   DEVCB_NULL,                              /* Port A not used as output */
82   DEVCB_DEVICE_HANDLER("pia", apple1_pia0_dspout),            /* Port B output (display) */
72   DEVCB_DRIVER_MEMBER(apple1_state,apple1_pia0_dspout),            /* Port B output (display) */
8373   DEVCB_NULL,                              /* CA2 not used as output */
84   DEVCB_DEVICE_HANDLER("pia", apple1_pia0_dsp_write_signal),   /* CB2 output (display write) */
74   DEVCB_DRIVER_MEMBER(apple1_state,apple1_pia0_dsp_write_signal),   /* CB2 output (display write) */
8575   DEVCB_NULL,                              /* IRQA not connected */
8676   DEVCB_NULL                              /* IRQB not connected */
8777};
r18257r18258
381371/*****************************************************************************
382372**  READ/WRITE HANDLERS
383373*****************************************************************************/
384static READ8_DEVICE_HANDLER( apple1_pia0_kbdin )
374READ8_MEMBER(apple1_state::apple1_pia0_kbdin)
385375{
386   apple1_state *state = space.machine().driver_data<apple1_state>();
387376   /* Bit 7 of the keyboard input is permanently wired high.  This is
388377       what the ROM Monitor software expects. */
389   return state->m_kbd_data | 0x80;
378   return m_kbd_data | 0x80;
390379}
391380
392static WRITE8_DEVICE_HANDLER( apple1_pia0_dspout )
381WRITE8_MEMBER(apple1_state::apple1_pia0_dspout)
393382{
394383   /* Send an ASCII character to the video hardware. */
395   apple1_vh_dsp_w(space.machine(), data);
384   apple1_vh_dsp_w(machine(), data);
396385}
397386
398static WRITE8_DEVICE_HANDLER( apple1_pia0_dsp_write_signal )
387WRITE8_MEMBER(apple1_state::apple1_pia0_dsp_write_signal)
399388{
389   device_t *device = machine().device("pia");
400390   /* PIA output CB2 is inverted to become the DA signal, used to
401391       signal a display write to the video hardware. */
402392
r18257r18258
411401       Only then will it assert \RDA to signal readiness for another
412402       write.  Thus the write delay depends on the cursor position and
413403       where the display is in the refresh cycle. */
414   apple1_state *state = space.machine().driver_data<apple1_state>();     
415404   if (!data)
416      space.machine().scheduler().timer_set(apple1_vh_dsp_time_to_ready(space.machine()), timer_expired_delegate(FUNC(apple1_state::apple1_dsp_ready_start),state));
405      machine().scheduler().timer_set(apple1_vh_dsp_time_to_ready(machine()), timer_expired_delegate(FUNC(apple1_state::apple1_dsp_ready_start),this));
417406}
418407
419408TIMER_CALLBACK_MEMBER(apple1_state::apple1_dsp_ready_start)
trunk/src/mess/machine/lisa.c
r18257r18258
9191    a hard disk
9292*/
9393
94static DECLARE_READ8_DEVICE_HANDLER(COPS_via_in_b);
95static DECLARE_WRITE8_DEVICE_HANDLER(COPS_via_out_a);
96static DECLARE_WRITE8_DEVICE_HANDLER(COPS_via_out_b);
97static DECLARE_WRITE8_DEVICE_HANDLER(COPS_via_out_ca2);
98static DECLARE_WRITE8_DEVICE_HANDLER(COPS_via_out_cb2);
9994static void COPS_via_irq_func(device_t *device, int val);
100static DECLARE_READ8_DEVICE_HANDLER(parallel_via_in_b);
10195
10296
10397const via6522_interface lisa_via6522_0_intf =
10498{
10599   /* COPS via */
106   DEVCB_NULL, DEVCB_HANDLER(COPS_via_in_b),
100   DEVCB_NULL, DEVCB_DRIVER_MEMBER(lisa_state,COPS_via_in_b),
107101   DEVCB_NULL, DEVCB_NULL,
108102   DEVCB_NULL, DEVCB_NULL,
109   DEVCB_HANDLER(COPS_via_out_a), DEVCB_HANDLER(COPS_via_out_b),
110   DEVCB_HANDLER(COPS_via_out_ca2), DEVCB_HANDLER(COPS_via_out_cb2),
103   DEVCB_DRIVER_MEMBER(lisa_state,COPS_via_out_a), DEVCB_DRIVER_MEMBER(lisa_state,COPS_via_out_b),
104   DEVCB_DRIVER_MEMBER(lisa_state,COPS_via_out_ca2), DEVCB_DRIVER_MEMBER(lisa_state,COPS_via_out_cb2),
111105   DEVCB_NULL, DEVCB_NULL,
112106   DEVCB_LINE(COPS_via_irq_func),
113107};
r18257r18258
115109const via6522_interface lisa_via6522_1_intf =
116110{
117111   /* parallel interface via - incomplete */
118   DEVCB_NULL, DEVCB_HANDLER(parallel_via_in_b),
112   DEVCB_NULL, DEVCB_DRIVER_MEMBER(lisa_state,parallel_via_in_b),
119113   DEVCB_NULL, DEVCB_NULL,
120114   DEVCB_NULL, DEVCB_NULL,
121115   DEVCB_NULL, DEVCB_NULL,
r18257r18258
676670    CA1 (I) : COPS sending valid data
677671    CA2 (O) : VIA -> COPS handshake
678672*/
679static WRITE8_DEVICE_HANDLER(COPS_via_out_a)
673WRITE8_MEMBER(lisa_state::COPS_via_out_a)
680674{
681   lisa_state *state = space.machine().driver_data<lisa_state>();
682675//    printf("VIA A = %02x\n", data);
683    state->m_COPS_command = data;
676    m_COPS_command = data;
684677}
685678
686static WRITE8_DEVICE_HANDLER(COPS_via_out_ca2)
679WRITE8_MEMBER(lisa_state::COPS_via_out_ca2)
687680{
688   lisa_state *state = space.machine().driver_data<lisa_state>();
689   state->m_hold_COPS_data = data;
681   m_hold_COPS_data = data;
690682
691683   /*logerror("COPS CA2 line state : %d\n", val);*/
692684
693685   /*logerror("COPS_via_out_ca2 : trying to send data to VIA\n");*/
694   COPS_send_data_if_possible(space.machine());
686   COPS_send_data_if_possible(machine());
695687}
696688
697689/*
r18257r18258
708700    CB1 : not used
709701    CB2 (O) : sound output
710702*/
711static READ8_DEVICE_HANDLER(COPS_via_in_b)
703READ8_MEMBER(lisa_state::COPS_via_in_b)
712704{
713   lisa_state *state = space.machine().driver_data<lisa_state>();
714705   int val = 0;
715706
716   if (state->m_COPS_Ready)
707   if (m_COPS_Ready)
717708      val |= 0x40;
718709
719   if (state->m_FDIR)
710   if (m_FDIR)
720711      val |= 0x10;
721712
722713   return val;
723714}
724715
725static WRITE8_DEVICE_HANDLER(COPS_via_out_b)
716WRITE8_MEMBER(lisa_state::COPS_via_out_b)
726717{
727   lisa_state *state = space.machine().driver_data<lisa_state>();
728   via6522_device *via_0 = space.machine().device<via6522_device>("via6522_0");
718   via6522_device *via_0 = machine().device<via6522_device>("via6522_0");
729719
730720   /* pull-up */
731721   data |= (~ via_0->read(space,VIA_DDRA)) & 0x01;
732722
733723   if (data & 0x01)
734724   {
735      if (state->m_COPS_force_unplug)
725      if (m_COPS_force_unplug)
736726      {
737         state->m_COPS_force_unplug = 0;
738         plug_keyboard(space.machine());
727         m_COPS_force_unplug = 0;
728         plug_keyboard(machine());
739729      }
740730   }
741731   else
742732   {
743      if (! state->m_COPS_force_unplug)
733      if (! m_COPS_force_unplug)
744734      {
745         state->m_COPS_force_unplug = 1;
746         unplug_keyboard(space.machine());
735         m_COPS_force_unplug = 1;
736         unplug_keyboard(machine());
747737         //reset_COPS(state);
748738      }
749739   }
750740}
751741
752static WRITE8_DEVICE_HANDLER(COPS_via_out_cb2)
742WRITE8_MEMBER(lisa_state::COPS_via_out_cb2)
753743{
754   device_t *speaker = space.machine().device(SPEAKER_TAG);
744   device_t *speaker = machine().device(SPEAKER_TAG);
755745   speaker_level_w(speaker, data);
756746}
757747
r18257r18258
785775    CB1 : not used
786776    CB2 (I) : current parity latch value
787777*/
788static READ8_DEVICE_HANDLER(parallel_via_in_b)
778READ8_MEMBER(lisa_state::parallel_via_in_b)
789779{
790   lisa_state *state = space.machine().driver_data<lisa_state>();
791780   int val = 0;
792781
793   if (state->m_DISK_DIAG)
782   if (m_DISK_DIAG)
794783      val |= 0x40;
795784
796785   /* tell there is no hard disk : */
r18257r18258
10671056   init_COPS(machine());
10681057
10691058   {
1070      via6522_device *via_0 = machine().device<via6522_device>("via6522_0");
1071      COPS_via_out_ca2(via_0, generic_space(), 0, 0);   /* VIA core forgets to do so */
1059      COPS_via_out_ca2(generic_space(), 0, 0);   /* VIA core forgets to do so */
10721060   }
10731061
10741062   /* initialize floppy */
trunk/src/mess/machine/msx.c
r18257r18258
620620   m_psg_b = data;
621621}
622622
623WRITE8_DEVICE_HANDLER( msx_printer_strobe_w )
623WRITE8_MEMBER(msx_state::msx_printer_strobe_w)
624624{
625   space.machine().device<centronics_device>("centronics")->strobe_w(BIT(data, 1));
625   machine().device<centronics_device>("centronics")->strobe_w(BIT(data, 1));
626626}
627627
628WRITE8_DEVICE_HANDLER( msx_printer_data_w )
628WRITE8_MEMBER(msx_state::msx_printer_data_w)
629629{
630   if (space.machine().root_device().ioport("DSW")->read() & 0x80)
630   if (machine().root_device().ioport("DSW")->read() & 0x80)
631631      /* SIMPL emulation */
632      space.machine().device<dac_device>("dac")->write_signed8(data);
632      machine().device<dac_device>("dac")->write_signed8(data);
633633   else
634      space.machine().device<centronics_device>("centronics")->write(space.machine().driver_data()->generic_space(), 0, data);
634      machine().device<centronics_device>("centronics")->write(machine().driver_data()->generic_space(), 0, data);
635635}
636636
637READ8_DEVICE_HANDLER( msx_printer_status_r )
637READ8_MEMBER(msx_state::msx_printer_status_r)
638638{
639639   UINT8 result = 0xfd;
640640
641   if (space.machine().root_device().ioport("DSW")->read() & 0x80)
641   if (machine().root_device().ioport("DSW")->read() & 0x80)
642642      return 0xff;
643643
644   result |= space.machine().device<centronics_device>("centronics")->busy_r() << 1;
644   result |= machine().device<centronics_device>("centronics")->busy_r() << 1;
645645
646646   return result;
647647}
trunk/src/mess/machine/lviv.c
r18257r18258
5353   return address;
5454}
5555
56static READ8_DEVICE_HANDLER ( lviv_ppi_0_porta_r )
56READ8_MEMBER(lviv_state::lviv_ppi_0_porta_r)
5757{
5858   return 0xff;
5959}
6060
61static READ8_DEVICE_HANDLER ( lviv_ppi_0_portb_r )
61READ8_MEMBER(lviv_state::lviv_ppi_0_portb_r)
6262{
6363   return 0xff;
6464}
6565
66static READ8_DEVICE_HANDLER ( lviv_ppi_0_portc_r )
66READ8_MEMBER(lviv_state::lviv_ppi_0_portc_r)
6767{
68   lviv_state *state = space.machine().driver_data<lviv_state>();
69   UINT8 data = state->m_ppi_port_outputs[0][2] & 0x0f;
70   if (space.machine().device<cassette_image_device>(CASSETTE_TAG)->input() > 0.038)
68   UINT8 data = m_ppi_port_outputs[0][2] & 0x0f;
69   if (machine().device<cassette_image_device>(CASSETTE_TAG)->input() > 0.038)
7170      data |= 0x10;
72   if (state->m_ppi_port_outputs[0][0] & state->ioport("JOY")->read())
71   if (m_ppi_port_outputs[0][0] & ioport("JOY")->read())
7372      data |= 0x80;
7473   return data;
7574}
7675
77static WRITE8_DEVICE_HANDLER ( lviv_ppi_0_porta_w )
76WRITE8_MEMBER(lviv_state::lviv_ppi_0_porta_w)
7877{
79   lviv_state *state = space.machine().driver_data<lviv_state>();
80   state->m_ppi_port_outputs[0][0] = data;
78   m_ppi_port_outputs[0][0] = data;
8179}
8280
83static WRITE8_DEVICE_HANDLER ( lviv_ppi_0_portb_w )
81WRITE8_MEMBER(lviv_state::lviv_ppi_0_portb_w)
8482{
85   lviv_state *state = space.machine().driver_data<lviv_state>();
86   state->m_ppi_port_outputs[0][1] = data;
87   lviv_update_palette(space.machine(), data&0x7f);
83   m_ppi_port_outputs[0][1] = data;
84   lviv_update_palette(machine(), data&0x7f);
8885}
8986
90static WRITE8_DEVICE_HANDLER ( lviv_ppi_0_portc_w )   /* tape in/out, video memory on/off */
87WRITE8_MEMBER(lviv_state::lviv_ppi_0_portc_w)/* tape in/out, video memory on/off */
9188{
92   lviv_state *state = space.machine().driver_data<lviv_state>();
93   device_t *speaker = space.machine().device(SPEAKER_TAG);
94   state->m_ppi_port_outputs[0][2] = data;
95   if (state->m_ppi_port_outputs[0][1]&0x80)
89   device_t *speaker = machine().device(SPEAKER_TAG);
90   m_ppi_port_outputs[0][2] = data;
91   if (m_ppi_port_outputs[0][1]&0x80)
9692      speaker_level_w(speaker, data&0x01);
97   space.machine().device<cassette_image_device>(CASSETTE_TAG)->output((data & 0x01) ? -1.0 : 1.0);
98   lviv_update_memory(space.machine());
93   machine().device<cassette_image_device>(CASSETTE_TAG)->output((data & 0x01) ? -1.0 : 1.0);
94   lviv_update_memory(machine());
9995}
10096
101static READ8_DEVICE_HANDLER ( lviv_ppi_1_porta_r )
97READ8_MEMBER(lviv_state::lviv_ppi_1_porta_r)
10298{
10399   return 0xff;
104100}
105101
106static READ8_DEVICE_HANDLER ( lviv_ppi_1_portb_r )   /* keyboard reading */
102READ8_MEMBER(lviv_state::lviv_ppi_1_portb_r)/* keyboard reading */
107103{
108   lviv_state *state = space.machine().driver_data<lviv_state>();
109   return   ((state->m_ppi_port_outputs[1][0] & 0x01) ? 0xff : space.machine().root_device().ioport("KEY0")->read()) &
110      ((state->m_ppi_port_outputs[1][0] & 0x02) ? 0xff : space.machine().root_device().ioport("KEY1")->read()) &
111      ((state->m_ppi_port_outputs[1][0] & 0x04) ? 0xff : space.machine().root_device().ioport("KEY2")->read()) &
112      ((state->m_ppi_port_outputs[1][0] & 0x08) ? 0xff : space.machine().root_device().ioport("KEY3")->read()) &
113      ((state->m_ppi_port_outputs[1][0] & 0x10) ? 0xff : space.machine().root_device().ioport("KEY4")->read()) &
114      ((state->m_ppi_port_outputs[1][0] & 0x20) ? 0xff : space.machine().root_device().ioport("KEY5")->read()) &
115      ((state->m_ppi_port_outputs[1][0] & 0x40) ? 0xff : space.machine().root_device().ioport("KEY6")->read()) &
116      ((state->m_ppi_port_outputs[1][0] & 0x80) ? 0xff : state->ioport("KEY7")->read());
104   return   ((m_ppi_port_outputs[1][0] & 0x01) ? 0xff : machine().root_device().ioport("KEY0")->read()) &
105      ((m_ppi_port_outputs[1][0] & 0x02) ? 0xff : machine().root_device().ioport("KEY1")->read()) &
106      ((m_ppi_port_outputs[1][0] & 0x04) ? 0xff : machine().root_device().ioport("KEY2")->read()) &
107      ((m_ppi_port_outputs[1][0] & 0x08) ? 0xff : machine().root_device().ioport("KEY3")->read()) &
108      ((m_ppi_port_outputs[1][0] & 0x10) ? 0xff : machine().root_device().ioport("KEY4")->read()) &
109      ((m_ppi_port_outputs[1][0] & 0x20) ? 0xff : machine().root_device().ioport("KEY5")->read()) &
110      ((m_ppi_port_outputs[1][0] & 0x40) ? 0xff : machine().root_device().ioport("KEY6")->read()) &
111      ((m_ppi_port_outputs[1][0] & 0x80) ? 0xff : ioport("KEY7")->read());
117112}
118113
119static READ8_DEVICE_HANDLER ( lviv_ppi_1_portc_r )     /* keyboard reading */
114READ8_MEMBER(lviv_state::lviv_ppi_1_portc_r)/* keyboard reading */
120115{
121   lviv_state *state = space.machine().driver_data<lviv_state>();
122   return   ((state->m_ppi_port_outputs[1][2] & 0x01) ? 0xff : space.machine().root_device().ioport("KEY8")->read()) &
123      ((state->m_ppi_port_outputs[1][2] & 0x02) ? 0xff : space.machine().root_device().ioport("KEY9" )->read()) &
124      ((state->m_ppi_port_outputs[1][2] & 0x04) ? 0xff : space.machine().root_device().ioport("KEY10")->read()) &
125      ((state->m_ppi_port_outputs[1][2] & 0x08) ? 0xff : state->ioport("KEY11")->read());
116   return   ((m_ppi_port_outputs[1][2] & 0x01) ? 0xff : machine().root_device().ioport("KEY8")->read()) &
117      ((m_ppi_port_outputs[1][2] & 0x02) ? 0xff : machine().root_device().ioport("KEY9" )->read()) &
118      ((m_ppi_port_outputs[1][2] & 0x04) ? 0xff : machine().root_device().ioport("KEY10")->read()) &
119      ((m_ppi_port_outputs[1][2] & 0x08) ? 0xff : ioport("KEY11")->read());
126120}
127121
128static WRITE8_DEVICE_HANDLER ( lviv_ppi_1_porta_w )   /* kayboard scaning */
122WRITE8_MEMBER(lviv_state::lviv_ppi_1_porta_w)/* kayboard scaning */
129123{
130   lviv_state *state = space.machine().driver_data<lviv_state>();
131   state->m_ppi_port_outputs[1][0] = data;
124   m_ppi_port_outputs[1][0] = data;
132125}
133126
134static WRITE8_DEVICE_HANDLER ( lviv_ppi_1_portb_w )
127WRITE8_MEMBER(lviv_state::lviv_ppi_1_portb_w)
135128{
136   lviv_state *state = space.machine().driver_data<lviv_state>();
137   state->m_ppi_port_outputs[1][1] = data;
129   m_ppi_port_outputs[1][1] = data;
138130}
139131
140static WRITE8_DEVICE_HANDLER ( lviv_ppi_1_portc_w )   /* kayboard scaning */
132WRITE8_MEMBER(lviv_state::lviv_ppi_1_portc_w)/* kayboard scaning */
141133{
142   lviv_state *state = space.machine().driver_data<lviv_state>();
143   state->m_ppi_port_outputs[1][2] = data;
134   m_ppi_port_outputs[1][2] = data;
144135}
145136
146137
r18257r18258
212203
213204I8255A_INTERFACE( lviv_ppi8255_interface_0 )
214205{
215   DEVCB_HANDLER(lviv_ppi_0_porta_r),
216   DEVCB_HANDLER(lviv_ppi_0_porta_w),
217   DEVCB_HANDLER(lviv_ppi_0_portb_r),
218   DEVCB_HANDLER(lviv_ppi_0_portb_w),
219   DEVCB_HANDLER(lviv_ppi_0_portc_r),
220   DEVCB_HANDLER(lviv_ppi_0_portc_w)
206   DEVCB_DRIVER_MEMBER(lviv_state,lviv_ppi_0_porta_r),
207   DEVCB_DRIVER_MEMBER(lviv_state,lviv_ppi_0_porta_w),
208   DEVCB_DRIVER_MEMBER(lviv_state,lviv_ppi_0_portb_r),
209   DEVCB_DRIVER_MEMBER(lviv_state,lviv_ppi_0_portb_w),
210   DEVCB_DRIVER_MEMBER(lviv_state,lviv_ppi_0_portc_r),
211   DEVCB_DRIVER_MEMBER(lviv_state,lviv_ppi_0_portc_w)
221212};
222213
223214I8255A_INTERFACE( lviv_ppi8255_interface_1 )
224215{
225   DEVCB_HANDLER(lviv_ppi_1_porta_r),
226   DEVCB_HANDLER(lviv_ppi_1_porta_w),
227   DEVCB_HANDLER(lviv_ppi_1_portb_r),
228   DEVCB_HANDLER(lviv_ppi_1_portb_w),
229   DEVCB_HANDLER(lviv_ppi_1_portc_r),
230   DEVCB_HANDLER(lviv_ppi_1_portc_w)
216   DEVCB_DRIVER_MEMBER(lviv_state,lviv_ppi_1_porta_r),
217   DEVCB_DRIVER_MEMBER(lviv_state,lviv_ppi_1_porta_w),
218   DEVCB_DRIVER_MEMBER(lviv_state,lviv_ppi_1_portb_r),
219   DEVCB_DRIVER_MEMBER(lviv_state,lviv_ppi_1_portb_w),
220   DEVCB_DRIVER_MEMBER(lviv_state,lviv_ppi_1_portc_r),
221   DEVCB_DRIVER_MEMBER(lviv_state,lviv_ppi_1_portc_w)
231222};
232223
233224void lviv_state::machine_reset()
trunk/src/mess/machine/dgn_beta.c
r18257r18258
9292
9393/* Debugging variables */
9494
95static DECLARE_READ8_DEVICE_HANDLER(d_pia0_pa_r);
96static DECLARE_WRITE8_DEVICE_HANDLER(d_pia0_pa_w);
97static DECLARE_READ8_DEVICE_HANDLER(d_pia0_pb_r);
98static DECLARE_WRITE8_DEVICE_HANDLER(d_pia0_pb_w);
99static DECLARE_WRITE8_DEVICE_HANDLER(d_pia0_cb2_w);
100static WRITE_LINE_DEVICE_HANDLER(d_pia0_irq_a);
101static WRITE_LINE_DEVICE_HANDLER(d_pia0_irq_b);
102static DECLARE_READ8_DEVICE_HANDLER(d_pia1_pa_r);
103static DECLARE_WRITE8_DEVICE_HANDLER(d_pia1_pa_w);
104static DECLARE_READ8_DEVICE_HANDLER(d_pia1_pb_r);
105static DECLARE_WRITE8_DEVICE_HANDLER(d_pia1_pb_w);
106static WRITE_LINE_DEVICE_HANDLER(d_pia1_irq_a);
107static WRITE_LINE_DEVICE_HANDLER(d_pia1_irq_b);
108static DECLARE_READ8_DEVICE_HANDLER(d_pia2_pa_r);
109static DECLARE_WRITE8_DEVICE_HANDLER(d_pia2_pa_w);
110static DECLARE_READ8_DEVICE_HANDLER(d_pia2_pb_r);
111static DECLARE_WRITE8_DEVICE_HANDLER(d_pia2_pb_w);
112static WRITE_LINE_DEVICE_HANDLER(d_pia2_irq_a);
113static WRITE_LINE_DEVICE_HANDLER(d_pia2_irq_b);
11495
96
11597static void cpu0_recalc_irq(running_machine &machine, int state);
11698static void cpu0_recalc_firq(running_machine &machine, int state);
11799
r18257r18258
128110   /* PIA 0 at $FC20-$FC23 I46 */
129111   {
130112      /*inputs : A/B,CA/B1,CA/B2 */
131      DEVCB_HANDLER(d_pia0_pa_r),
132      DEVCB_HANDLER(d_pia0_pb_r),
113      DEVCB_DRIVER_MEMBER(dgn_beta_state,d_pia0_pa_r),
114      DEVCB_DRIVER_MEMBER(dgn_beta_state,d_pia0_pb_r),
133115      DEVCB_NULL,
134116      DEVCB_NULL,
135117      DEVCB_NULL,
136118      DEVCB_NULL,
137119      /*outputs: A/B,CA/B2       */
138      DEVCB_HANDLER(d_pia0_pa_w),
139      DEVCB_HANDLER(d_pia0_pb_w),
120      DEVCB_DRIVER_MEMBER(dgn_beta_state,d_pia0_pa_w),
121      DEVCB_DRIVER_MEMBER(dgn_beta_state,d_pia0_pb_w),
140122      DEVCB_NULL,
141      DEVCB_HANDLER(d_pia0_cb2_w),
123      DEVCB_DRIVER_MEMBER(dgn_beta_state,d_pia0_cb2_w),
142124      /*irqs   : A/B         */
143      DEVCB_LINE(d_pia0_irq_a),
144      DEVCB_LINE(d_pia0_irq_b)
125      DEVCB_DRIVER_LINE_MEMBER(dgn_beta_state,d_pia0_irq_a),
126      DEVCB_DRIVER_LINE_MEMBER(dgn_beta_state,d_pia0_irq_b)
145127   },
146128
147129   /* PIA 1 at $FC24-$FC27 I63 */
148130   {
149131      /*inputs : A/B,CA/B1,CA/B2 */
150      DEVCB_HANDLER(d_pia1_pa_r),
151      DEVCB_HANDLER(d_pia1_pb_r),
132      DEVCB_DRIVER_MEMBER(dgn_beta_state,d_pia1_pa_r),
133      DEVCB_DRIVER_MEMBER(dgn_beta_state,d_pia1_pb_r),
152134      DEVCB_NULL,
153135      DEVCB_NULL,
154136      DEVCB_NULL,
155137      DEVCB_NULL,
156138      /*outputs: A/B,CA/B2       */
157      DEVCB_HANDLER(d_pia1_pa_w),
158      DEVCB_HANDLER(d_pia1_pb_w),
139      DEVCB_DRIVER_MEMBER(dgn_beta_state,d_pia1_pa_w),
140      DEVCB_DRIVER_MEMBER(dgn_beta_state,d_pia1_pb_w),
159141      DEVCB_NULL,
160142      DEVCB_NULL,
161143      /*irqs   : A/B         */
162      DEVCB_LINE(d_pia1_irq_a),
163      DEVCB_LINE(d_pia1_irq_b)
144      DEVCB_DRIVER_LINE_MEMBER(dgn_beta_state,d_pia1_irq_a),
145      DEVCB_DRIVER_LINE_MEMBER(dgn_beta_state,d_pia1_irq_b)
164146   },
165147
166148   /* PIA 2 at FCC0-FCC3 I28 */
r18257r18258
168150   /* from the WD2797 */
169151   {
170152      /*inputs : A/B,CA/B1,CA/B2 */
171      DEVCB_HANDLER(d_pia2_pa_r),
172      DEVCB_HANDLER(d_pia2_pb_r),
153      DEVCB_DRIVER_MEMBER(dgn_beta_state,d_pia2_pa_r),
154      DEVCB_DRIVER_MEMBER(dgn_beta_state,d_pia2_pb_r),
173155      DEVCB_NULL,
174156      DEVCB_NULL,
175157      DEVCB_NULL,
176158      DEVCB_NULL,
177159      /*outputs: A/B,CA/B2       */
178      DEVCB_HANDLER(d_pia2_pa_w),
179      DEVCB_HANDLER(d_pia2_pb_w),
160      DEVCB_DRIVER_MEMBER(dgn_beta_state,d_pia2_pa_w),
161      DEVCB_DRIVER_MEMBER(dgn_beta_state,d_pia2_pb_w),
180162      DEVCB_NULL,
181163      DEVCB_NULL,
182164      /*irqs   : A/B         */
183      DEVCB_LINE(d_pia2_irq_a),
184      DEVCB_LINE(d_pia2_irq_b)
165      DEVCB_DRIVER_LINE_MEMBER(dgn_beta_state,d_pia2_irq_a),
166      DEVCB_DRIVER_LINE_MEMBER(dgn_beta_state,d_pia2_irq_b)
185167   }
186168};
187169
r18257r18258
534516        CB1 I36/39/6845(Horz Sync)
535517        CB2 Keyboard (out) Low loads input shift reg
536518*/
537static READ8_DEVICE_HANDLER(d_pia0_pa_r)
519READ8_MEMBER(dgn_beta_state::d_pia0_pa_r)
538520{
539521   return 0;
540522}
541523
542static WRITE8_DEVICE_HANDLER(d_pia0_pa_w)
524WRITE8_MEMBER(dgn_beta_state::d_pia0_pa_w)
543525{
544526}
545527
546static READ8_DEVICE_HANDLER(d_pia0_pb_r)
528READ8_MEMBER(dgn_beta_state::d_pia0_pb_r)
547529{
548   dgn_beta_state *state = space.machine().driver_data<dgn_beta_state>();
549530   int RetVal;
550531   int Idx;
551532   int Selected;
r18257r18258
556537
557538   LOG_KEYBOARD(("PB Read\n"));
558539
559   state->m_KAny_next = 0;
540   m_KAny_next = 0;
560541
561   Selected = SelectedKeyrow(state, state->m_RowShifter);
542   Selected = SelectedKeyrow(this, m_RowShifter);
562543
563544   /* Scan the whole keyboard, if output shifter is all low */
564545   /* This actually scans in the keyboard */
565   if(state->m_RowShifter == 0x00)
546   if(m_RowShifter == 0x00)
566547   {
567548      for(Idx=0; Idx<NoKeyrows; Idx++)
568549      {
569         state->m_Keyboard[Idx] = space.machine().root_device().ioport(keynames[Idx])->read();
550         m_Keyboard[Idx] = machine().root_device().ioport(keynames[Idx])->read();
570551
571         if(state->m_Keyboard[Idx] != 0x7F)
572            state->m_KAny_next = 1;
552         if(m_Keyboard[Idx] != 0x7F)
553            m_KAny_next = 1;
573554      }
574555   }
575556   else   /* Just scan current row, from previously read values */
576557   {
577      if(GetKeyRow(state, Selected) != NO_KEY_PRESSED)
578         state->m_KAny_next = 1;
558      if(GetKeyRow(this, Selected) != NO_KEY_PRESSED)
559         m_KAny_next = 1;
579560   }
580561
581   RetVal = (state->m_KInDat_next<<5) | (state->m_KAny_next<<2);
562   RetVal = (m_KInDat_next<<5) | (m_KAny_next<<2);
582563
583   LOG_KEYBOARD(("FC22=$%02X KAny=%d\n", RetVal, state->m_KAny_next));
564   LOG_KEYBOARD(("FC22=$%02X KAny=%d\n", RetVal, m_KAny_next));
584565
585566   return RetVal;
586567}
587568
588static WRITE8_DEVICE_HANDLER(d_pia0_pb_w)
569WRITE8_MEMBER(dgn_beta_state::d_pia0_pb_w)
589570{
590   dgn_beta_state *state = space.machine().driver_data<dgn_beta_state>();
591571   int   InClkState;
592572   //int   OutClkState;
593573
r18257r18258
596576   InClkState   = data & KInClk;
597577   //OutClkState   = data & KOutClk;
598578
599   LOG_KEYBOARD(("InClkState=$%02X OldInClkState=$%02X Keyrow=$%02X ",InClkState,(state->m_d_pia0_pb_last & KInClk),state->m_Keyrow));
579   LOG_KEYBOARD(("InClkState=$%02X OldInClkState=$%02X Keyrow=$%02X ",InClkState,(m_d_pia0_pb_last & KInClk),m_Keyrow));
600580
601581   /* Input clock bit has changed state */
602   if ((InClkState) != (state->m_d_pia0_pb_last & KInClk))
582   if ((InClkState) != (m_d_pia0_pb_last & KInClk))
603583   {
604584      /* Clock in bit */
605585      if(InClkState)
606586      {
607         state->m_KInDat_next=(~state->m_Keyrow & 0x40)>>6;
608         state->m_Keyrow = ((state->m_Keyrow<<1) | 0x01) & 0x7F ;
609         LOG_KEYBOARD(("Keyrow=$%02X KInDat_next=%X\n",state->m_Keyrow,state->m_KInDat_next));
587         m_KInDat_next=(~m_Keyrow & 0x40)>>6;
588         m_Keyrow = ((m_Keyrow<<1) | 0x01) & 0x7F ;
589         LOG_KEYBOARD(("Keyrow=$%02X KInDat_next=%X\n",m_Keyrow,m_KInDat_next));
610590      }
611591   }
612592
613   state->m_d_pia0_pb_last=data;
593   m_d_pia0_pb_last=data;
614594}
615595
616static WRITE8_DEVICE_HANDLER(d_pia0_cb2_w)
596WRITE8_MEMBER(dgn_beta_state::d_pia0_cb2_w)
617597{
618   dgn_beta_state *state = space.machine().driver_data<dgn_beta_state>();
619598   int   RowNo;
620599   LOG_KEYBOARD(("\nCB2 Write\n"));
621600
622601   /* load keyrow on rising edge of CB2 */
623   if((data==1) && (state->m_d_pia0_cb2_last==0))
602   if((data==1) && (m_d_pia0_cb2_last==0))
624603   {
625      RowNo=SelectedKeyrow(state, state->m_RowShifter);
626      state->m_Keyrow=GetKeyRow(state, RowNo);
604      RowNo=SelectedKeyrow(this, m_RowShifter);
605      m_Keyrow=GetKeyRow(this, RowNo);
627606
628607      /* Output clock rising edge, clock CB2 value into rowshifterlow to high transition */
629608      /* In the beta the shift registers are a cmos 4015, and a cmos 4013 in series */
630      state->m_RowShifter = (state->m_RowShifter<<1) | ((state->m_d_pia0_pb_last & KOutDat)>>4);
631      state->m_RowShifter &= 0x3FF;
632      LOG_KEYBOARD(("Rowshifter=$%02X Keyrow=$%02X\n",state->m_RowShifter,state->m_Keyrow));
633      if (VERBOSE) debug_console_printf(space.machine(), "rowshifter clocked, value=%3X, RowNo=%d, Keyrow=%2X\n",state->m_RowShifter,RowNo,state->m_Keyrow);
609      m_RowShifter = (m_RowShifter<<1) | ((m_d_pia0_pb_last & KOutDat)>>4);
610      m_RowShifter &= 0x3FF;
611      LOG_KEYBOARD(("Rowshifter=$%02X Keyrow=$%02X\n",m_RowShifter,m_Keyrow));
612      if (VERBOSE) debug_console_printf(machine(), "rowshifter clocked, value=%3X, RowNo=%d, Keyrow=%2X\n",m_RowShifter,RowNo,m_Keyrow);
634613   }
635614
636   state->m_d_pia0_cb2_last=data;
615   m_d_pia0_cb2_last=data;
637616}
638617
639618
640static WRITE_LINE_DEVICE_HANDLER( d_pia0_irq_a )
619WRITE_LINE_MEMBER(dgn_beta_state::d_pia0_irq_a)
641620{
642   cpu0_recalc_irq(device->machine(), state);
621   cpu0_recalc_irq(machine(), state);
643622}
644623
645static WRITE_LINE_DEVICE_HANDLER( d_pia0_irq_b )
624WRITE_LINE_MEMBER(dgn_beta_state::d_pia0_irq_b)
646625{
647   cpu0_recalc_firq(device->machine(), state);
626   cpu0_recalc_firq(machine(), state);
648627}
649628
650629/* PIA #1 at $FC24-$FC27 I63
r18257r18258
657636        Baud rate               PB1..PB5 ????
658637*/
659638
660static READ8_DEVICE_HANDLER(d_pia1_pa_r)
639READ8_MEMBER(dgn_beta_state::d_pia1_pa_r)
661640{
662641   return 0;
663642}
664643
665static WRITE8_DEVICE_HANDLER(d_pia1_pa_w)
644WRITE8_MEMBER(dgn_beta_state::d_pia1_pa_w)
666645{
667   dgn_beta_state *state = space.machine().driver_data<dgn_beta_state>();
668646   int   HALT_DMA;
669   device_t *fdc = space.machine().device(FDC_TAG);
647   device_t *fdc = machine().device(FDC_TAG);
670648
671649   /* Only play with halt line if halt bit changed since last write */
672   if((data & 0x80) != state->m_d_pia1_pa_last)
650   if((data & 0x80) != m_d_pia1_pa_last)
673651   {
674652      /* Bit 7 of $FF24, seems to control HALT on second CPU (through an inverter) */
675653      if(data & 0x80)
r18257r18258
678656         HALT_DMA = CLEAR_LINE;
679657
680658      LOG_HALT(("DMA_CPU HALT=%d\n", HALT_DMA));
681      space.machine().device(DMACPU_TAG)->execute().set_input_line(INPUT_LINE_HALT, HALT_DMA);
659      machine().device(DMACPU_TAG)->execute().set_input_line(INPUT_LINE_HALT, HALT_DMA);
682660
683661      /* CPU un-halted let it run ! */
684662      if (HALT_DMA == CLEAR_LINE)
685         space.machine().device(MAINCPU_TAG)->execute().yield();
663         machine().device(MAINCPU_TAG)->execute().yield();
686664
687      state->m_d_pia1_pa_last = data & 0x80;
665      m_d_pia1_pa_last = data & 0x80;
688666   }
689667
690668   /* Drive selects are binary encoded on PA0 & PA1 */
r18257r18258
695673   LOG_DISK(("Set density %s\n", BIT(data, 6) ? "low" : "high"));
696674}
697675
698static READ8_DEVICE_HANDLER(d_pia1_pb_r)
676READ8_MEMBER(dgn_beta_state::d_pia1_pb_r)
699677{
700678   return 0;
701679}
702680
703static WRITE8_DEVICE_HANDLER(d_pia1_pb_w)
681WRITE8_MEMBER(dgn_beta_state::d_pia1_pb_w)
704682{
705   dgn_beta_state *state = space.machine().driver_data<dgn_beta_state>();
706683   int   HALT_CPU;
707684
708685   /* Only play with halt line if halt bit changed since last write */
709   if((data & 0x02) != state->m_d_pia1_pb_last)
686   if((data & 0x02) != m_d_pia1_pb_last)
710687   {
711688      /* Bit 1 of $FF26, seems to control HALT on primary CPU */
712689      if(data & 0x02)
r18257r18258
715692         HALT_CPU = ASSERT_LINE;
716693
717694      LOG_HALT(("MAIN_CPU HALT=%d\n", HALT_CPU));
718      space.machine().device(MAINCPU_TAG)->execute().set_input_line(INPUT_LINE_HALT, HALT_CPU);
695      machine().device(MAINCPU_TAG)->execute().set_input_line(INPUT_LINE_HALT, HALT_CPU);
719696
720      state->m_d_pia1_pb_last = data & 0x02;
697      m_d_pia1_pb_last = data & 0x02;
721698
722699      /* CPU un-halted let it run ! */
723700      if (HALT_CPU == CLEAR_LINE)
724         space.machine().device(DMACPU_TAG)->execute().yield();
701         machine().device(DMACPU_TAG)->execute().yield();
725702   }
726703}
727704
728static WRITE_LINE_DEVICE_HANDLER( d_pia1_irq_a )
705WRITE_LINE_MEMBER(dgn_beta_state::d_pia1_irq_a)
729706{
730   cpu0_recalc_irq(device->machine(), state);
707   cpu0_recalc_irq(machine(), state);
731708}
732709
733static WRITE_LINE_DEVICE_HANDLER( d_pia1_irq_b )
710WRITE_LINE_MEMBER(dgn_beta_state::d_pia1_irq_b)
734711{
735   cpu0_recalc_irq(device->machine(), state);
712   cpu0_recalc_irq(machine(), state);
736713}
737714
738715/* PIA #2 at FCC0-FCC3 I28
r18257r18258
744721        Graphics control PB0..PB7 ???
745722        VSYNC intutrupt CB2
746723*/
747static READ8_DEVICE_HANDLER(d_pia2_pa_r)
724READ8_MEMBER(dgn_beta_state::d_pia2_pa_r)
748725{
749726   return 0;
750727}
751728
752static WRITE8_DEVICE_HANDLER(d_pia2_pa_w)
729WRITE8_MEMBER(dgn_beta_state::d_pia2_pa_w)
753730{
754   dgn_beta_state *state = space.machine().driver_data<dgn_beta_state>();
755731   int OldTask;
756732   int OldEnableMap;
757733   int NMI;
r18257r18258
762738   NMI=(data & 0x80);
763739
764740   /* only take action if NMI changed */
765   if(NMI != state->m_DMA_NMI_LAST)
741   if(NMI != m_DMA_NMI_LAST)
766742   {
767743      LOG_INTS(("cpu1 NMI : %d\n", NMI));
768744      if(!NMI)
769745      {
770         space.machine().device(DMACPU_TAG)->execute().set_input_line(INPUT_LINE_NMI, ASSERT_LINE);
746         machine().device(DMACPU_TAG)->execute().set_input_line(INPUT_LINE_NMI, ASSERT_LINE);
771747         logerror("device_yield()\n");
772         space.machine().device(DMACPU_TAG)->execute().yield();   /* Let DMA CPU run */
748         machine().device(DMACPU_TAG)->execute().yield();   /* Let DMA CPU run */
773749      }
774750      else
775751      {
776         space.machine().device(DMACPU_TAG)->execute().set_input_line(INPUT_LINE_NMI, CLEAR_LINE);
752         machine().device(DMACPU_TAG)->execute().set_input_line(INPUT_LINE_NMI, CLEAR_LINE);
777753      }
778754
779      state->m_DMA_NMI_LAST = NMI;   /* Save it for next time */
755      m_DMA_NMI_LAST = NMI;   /* Save it for next time */
780756   }
781757
782   OldEnableMap = state->m_EnableMapRegs;
758   OldEnableMap = m_EnableMapRegs;
783759   /* Bit 6 seems to enable memory paging */
784760   if(data & 0x40)
785      state->m_EnableMapRegs = 0;
761      m_EnableMapRegs = 0;
786762   else
787      state->m_EnableMapRegs = 1;
763      m_EnableMapRegs = 1;
788764
789765   /* Bits 0..3 seem to control which task register is selected */
790   OldTask = state->m_PIATaskReg;
791   state->m_PIATaskReg = data & 0x0F;
766   OldTask = m_PIATaskReg;
767   m_PIATaskReg = data & 0x0F;
792768
793   LOG_TASK(("OldTask=$%02X EnableMapRegs=%d OldEnableMap=%d\n", OldTask, state->m_EnableMapRegs, OldEnableMap));
769   LOG_TASK(("OldTask=$%02X EnableMapRegs=%d OldEnableMap=%d\n", OldTask, m_EnableMapRegs, OldEnableMap));
794770
795771   // Maping was enabled or disabled, select apropreate task reg
796772   // and map it in
797   if (state->m_EnableMapRegs != OldEnableMap)
773   if (m_EnableMapRegs != OldEnableMap)
798774   {
799      if(state->m_EnableMapRegs)
800         state->m_TaskReg = state->m_PIATaskReg;
775      if(m_EnableMapRegs)
776         m_TaskReg = m_PIATaskReg;
801777      else
802         state->m_TaskReg = NoPagingTask;
778         m_TaskReg = NoPagingTask;
803779
804      UpdateBanks(space.machine(), 0, IOPage + 1);
780      UpdateBanks(machine(), 0, IOPage + 1);
805781   }
806782   else
807783   {
808784      // Update ram banks only if task reg changed and mapping enabled
809      if ((state->m_PIATaskReg != OldTask) && (state->m_EnableMapRegs))
785      if ((m_PIATaskReg != OldTask) && (m_EnableMapRegs))
810786      {
811         state->m_TaskReg = state->m_PIATaskReg;
812         UpdateBanks(space.machine(), 0, IOPage + 1);
787         m_TaskReg = m_PIATaskReg;
788         UpdateBanks(machine(), 0, IOPage + 1);
813789      }
814790   }
815   LOG_TASK(("TaskReg=$%02X PIATaskReg=$%02X\n", state->m_TaskReg, state->m_PIATaskReg));
791   LOG_TASK(("TaskReg=$%02X PIATaskReg=$%02X\n", m_TaskReg, m_PIATaskReg));
816792}
817793
818static READ8_DEVICE_HANDLER(d_pia2_pb_r)
794READ8_MEMBER(dgn_beta_state::d_pia2_pb_r)
819795{
820796   return 0;
821797}
822798
823static WRITE8_DEVICE_HANDLER(d_pia2_pb_w)
799WRITE8_MEMBER(dgn_beta_state::d_pia2_pb_w)
824800{
825801   /* Update top video address lines */
826   dgnbeta_vid_set_gctrl(space.machine(), data);
802   dgnbeta_vid_set_gctrl(machine(), data);
827803}
828804
829static WRITE_LINE_DEVICE_HANDLER( d_pia2_irq_a )
805WRITE_LINE_MEMBER(dgn_beta_state::d_pia2_irq_a)
830806{
831   cpu0_recalc_irq(device->machine(), state);
807   cpu0_recalc_irq(machine(), state);
832808}
833809
834static WRITE_LINE_DEVICE_HANDLER( d_pia2_irq_b )
810WRITE_LINE_MEMBER(dgn_beta_state::d_pia2_irq_b)
835811{
836   cpu0_recalc_irq(device->machine(), state);
812   cpu0_recalc_irq(machine(), state);
837813}
838814
839815/************************************ Recalculate CPU inturrupts ****************************/
r18257r18258
888864/********************************************************************************************/
889865
890866/* The INTRQ line goes through pia2 ca1, in exactly the same way as DRQ from DragonDos does */
891static WRITE_LINE_DEVICE_HANDLER( dgnbeta_fdc_intrq_w )
867WRITE_LINE_MEMBER(dgn_beta_state::dgnbeta_fdc_intrq_w)
892868{
893   dgn_beta_state *drvstate = device->machine().driver_data<dgn_beta_state>();
869   device_t *device = machine().device(PIA_2_TAG);
894870   LOG_DISK(("dgnbeta_fdc_intrq_w(%d)\n", state));
895    if(drvstate->m_wd2797_written)
871    if(m_wd2797_written)
896872       downcast<pia6821_device *>(device)->ca1_w(state);
897873}
898874
899875/* DRQ is routed through various logic to the FIRQ inturrupt line on *BOTH* CPUs */
900static WRITE_LINE_DEVICE_HANDLER( dgnbeta_fdc_drq_w )
876WRITE_LINE_MEMBER(dgn_beta_state::dgnbeta_fdc_drq_w)
901877{
902878   LOG_DISK(("dgnbeta_fdc_drq_w(%d)\n", state));
903   cpu1_recalc_firq(device->machine(), state);
879   cpu1_recalc_firq(machine(), state);
904880}
905881
906882const wd17xx_interface dgnbeta_wd17xx_interface =
907883{
908884   DEVCB_NULL,
909   DEVCB_DEVICE_LINE(PIA_2_TAG, dgnbeta_fdc_intrq_w),
910   DEVCB_LINE(dgnbeta_fdc_drq_w),
885   DEVCB_DRIVER_LINE_MEMBER(dgn_beta_state,dgnbeta_fdc_intrq_w),
886   DEVCB_DRIVER_LINE_MEMBER(dgn_beta_state,dgnbeta_fdc_drq_w),
911887   {FLOPPY_0, FLOPPY_1, FLOPPY_2, FLOPPY_3}
912888};
913889
trunk/src/mess/machine/pokemini.c
r18257r18258
381381}
382382
383383
384WRITE8_DEVICE_HANDLER( pokemini_hwreg_w )
384WRITE8_MEMBER(pokemini_state::pokemini_hwreg_w)
385385{
386   pokemini_state *state = space.machine().driver_data<pokemini_state>();
387386   static const int timer_to_cycles_fast[8] = { 2, 8, 32, 64, 128, 256, 1024, 4096 };
388387   static const int timer_to_cycles_slow[8] = { 128, 256, 512, 1024, 2048, 4096, 8192, 16384 };
389388
r18257r18258
401400   case 0x02:   /* CPU related?
402401               Bit 0-7 R/W Unknown
403402            */
404      logerror( "%0X: Write to unknown hardware address: %02X, %02X\n", space.machine().firstcpu->pc( ), offset, data );
403      logerror( "%0X: Write to unknown hardware address: %02X, %02X\n", machine().firstcpu->pc( ), offset, data );
405404      break;
406405   case 0x08:   /* Seconds-timer control
407406               Bit 0   R/W Timer enable
r18257r18258
410409            */
411410      if ( data & 0x02 )
412411      {
413         state->m_pm_reg[0x09] = 0x00;
414         state->m_pm_reg[0x0A] = 0x00;
415         state->m_pm_reg[0x0B] = 0x00;
412         m_pm_reg[0x09] = 0x00;
413         m_pm_reg[0x0A] = 0x00;
414         m_pm_reg[0x0B] = 0x00;
416415         data &= ~0x02;
417416      }
418417      break;
r18257r18258
433432               Bit 5   R   Battery status: 0 - battery OK, 1 - battery low
434433               Bit 6-7     Unused
435434            */
436      logerror( "%0X: Write to unknown hardware address: %02X, %02X\n", space.machine().firstcpu->pc( ), offset, data );
435      logerror( "%0X: Write to unknown hardware address: %02X, %02X\n", machine().firstcpu->pc( ), offset, data );
437436      break;
438437   case 0x18:   /* Timer 1 pre-scale + enable
439438               Bit 0-2 R/W low timer 1 prescaler select
r18257r18258
450449               Bit 7   R/W Enable high counting
451450            */
452451      /* Check for prescaler change for the low counter */
453      if ( ( data & 0x07 ) != ( state->m_pm_reg[0x18] & 0x07 ) )
452      if ( ( data & 0x07 ) != ( m_pm_reg[0x18] & 0x07 ) )
454453      {
455454         int index = data & 0x07;
456         int cycles = ( state->m_pm_reg[0x19] & 0x01 ) ? timer_to_cycles_slow[index] : timer_to_cycles_fast[index];
455         int cycles = ( m_pm_reg[0x19] & 0x01 ) ? timer_to_cycles_slow[index] : timer_to_cycles_fast[index];
457456
458         state->m_timers.timer1->adjust(attotime::zero, 0, space.machine().device<cpu_device>("maincpu")->cycles_to_attotime(cycles));
457         m_timers.timer1->adjust(attotime::zero, 0, machine().device<cpu_device>("maincpu")->cycles_to_attotime(cycles));
459458      }
460459
461460      /* Check for prescaler change for the high counter */
462      if ( ( data & 0x70 ) != ( state->m_pm_reg[0x18] & 0x70 ) )
461      if ( ( data & 0x70 ) != ( m_pm_reg[0x18] & 0x70 ) )
463462      {
464463         int index = ( data >> 4 ) & 0x07;
465         int cycles = ( state->m_pm_reg[0x19] & 0x02 ) ? timer_to_cycles_slow[index] : timer_to_cycles_fast[index];
464         int cycles = ( m_pm_reg[0x19] & 0x02 ) ? timer_to_cycles_slow[index] : timer_to_cycles_fast[index];
466465
467         state->m_timers.timer1_hi->adjust(attotime::zero, 0, space.machine().device<cpu_device>("maincpu")->cycles_to_attotime(cycles));
466         m_timers.timer1_hi->adjust(attotime::zero, 0, machine().device<cpu_device>("maincpu")->cycles_to_attotime(cycles));
468467      }
469468
470469      /* Check if timer1 low should be enabled */
471      if ( ( data & 0x08 ) && ( state->m_pm_reg[0x30] & 0x04 ) &&
472           ( ( ( state->m_pm_reg[0x19] & 0x10 ) && ( state->m_pm_reg[0x19] & 0x01 ) ) ||
473             ( ( state->m_pm_reg[0x19] & 0x20 ) && ! ( state->m_pm_reg[0x19] & 0x01 ) ) ) )
470      if ( ( data & 0x08 ) && ( m_pm_reg[0x30] & 0x04 ) &&
471           ( ( ( m_pm_reg[0x19] & 0x10 ) && ( m_pm_reg[0x19] & 0x01 ) ) ||
472             ( ( m_pm_reg[0x19] & 0x20 ) && ! ( m_pm_reg[0x19] & 0x01 ) ) ) )
474473      {
475         state->m_timers.timer1->enable( 1 );
474         m_timers.timer1->enable( 1 );
476475      }
477476      else
478477      {
479         state->m_timers.timer1->enable( 0 );
478         m_timers.timer1->enable( 0 );
480479      }
481480
482481      /* Check if timer1 high should be enabled */
483      if ( ( data & 0x80 ) && ( state->m_pm_reg[0x31] & 0x04 ) && ! ( state->m_pm_reg[0x30] & 0x80 ) &&
484           ( ( ( state->m_pm_reg[0x19] & 0x10 ) && ( state->m_pm_reg[0x19] & 0x02 ) ) ||
485             ( ( state->m_pm_reg[0x19] & 0x20 ) && ! ( state->m_pm_reg[0x19] & 0x02 ) ) ) )
482      if ( ( data & 0x80 ) && ( m_pm_reg[0x31] & 0x04 ) && ! ( m_pm_reg[0x30] & 0x80 ) &&
483           ( ( ( m_pm_reg[0x19] & 0x10 ) && ( m_pm_reg[0x19] & 0x02 ) ) ||
484             ( ( m_pm_reg[0x19] & 0x20 ) && ! ( m_pm_reg[0x19] & 0x02 ) ) ) )
486485      {
487         state->m_timers.timer1_hi->enable( 1 );
486         m_timers.timer1_hi->enable( 1 );
488487      }
489488      else
490489      {
491         state->m_timers.timer1_hi->enable( 0 );
490         m_timers.timer1_hi->enable( 0 );
492491      }
493492      break;
494493   case 0x19:   /* Timers 1 speed
r18257r18258
500499               Bit 6-7     Unused
501500            */
502501      /* Check for prescaler change for the high counter */
503      if ( ( data & 0x01 ) != ( state->m_pm_reg[0x19] & 0x01 ) )
502      if ( ( data & 0x01 ) != ( m_pm_reg[0x19] & 0x01 ) )
504503      {
505         int index = state->m_pm_reg[0x18] & 0x07;
504         int index = m_pm_reg[0x18] & 0x07;
506505         int cycles = ( data & 0x01 ) ? timer_to_cycles_slow[index] : timer_to_cycles_fast[index];
507506
508         state->m_timers.timer1->adjust(attotime::zero, 0, space.machine().device<cpu_device>("maincpu")->cycles_to_attotime(cycles));
507         m_timers.timer1->adjust(attotime::zero, 0, machine().device<cpu_device>("maincpu")->cycles_to_attotime(cycles));
509508      }
510509
511510      /* Check for prescaler change for the low counter */
512      if ( ( data & 0x02 ) != ( state->m_pm_reg[0x19] & 0x02 ) )
511      if ( ( data & 0x02 ) != ( m_pm_reg[0x19] & 0x02 ) )
513512      {
514         int index = ( state->m_pm_reg[0x18] >> 4 ) & 0x07;
513         int index = ( m_pm_reg[0x18] >> 4 ) & 0x07;
515514         int cycles = ( data & 0x02 ) ? timer_to_cycles_slow[index] : timer_to_cycles_fast[index];
516515
517         state->m_timers.timer1_hi->adjust(attotime::zero, 0, space.machine().device<cpu_device>("maincpu")->cycles_to_attotime(cycles));
516         m_timers.timer1_hi->adjust(attotime::zero, 0, machine().device<cpu_device>("maincpu")->cycles_to_attotime(cycles));
518517      }
519518
520519      {
r18257r18258
525524         /* Check which fast timers should be enabled */
526525         if ( data & 0x20 )
527526         {
528            if ( ( state->m_pm_reg[0x18] & 0x08 ) && ( state->m_pm_reg[0x30] & 0x04 ) && ! ( data & 0x01 ) )
527            if ( ( m_pm_reg[0x18] & 0x08 ) && ( m_pm_reg[0x30] & 0x04 ) && ! ( data & 0x01 ) )
529528               timer1_enable = 1;
530529
531            if ( ( state->m_pm_reg[0x18] & 0x80 ) && ( state->m_pm_reg[0x31] & 0x04 ) && ! ( state->m_pm_reg[0x30] & 0x80 ) && ! ( data & 0x02 ) )
530            if ( ( m_pm_reg[0x18] & 0x80 ) && ( m_pm_reg[0x31] & 0x04 ) && ! ( m_pm_reg[0x30] & 0x80 ) && ! ( data & 0x02 ) )
532531               timer1_hi_enable = 1;
533532
534            if ( ( state->m_pm_reg[0x1A] & 0x08 ) && ( state->m_pm_reg[0x38] & 0x04 ) && ! ( state->m_pm_reg[0x1B] & 0x01 ) )
533            if ( ( m_pm_reg[0x1A] & 0x08 ) && ( m_pm_reg[0x38] & 0x04 ) && ! ( m_pm_reg[0x1B] & 0x01 ) )
535534               timer2_enable = 1;
536535
537            if ( ( state->m_pm_reg[0x1A] & 0x80 ) && ( state->m_pm_reg[0x39] & 0x04 ) && ! ( state->m_pm_reg[0x38] & 0x80 ) && ! ( state->m_pm_reg[0x1B] & 0x02 ) )
536            if ( ( m_pm_reg[0x1A] & 0x80 ) && ( m_pm_reg[0x39] & 0x04 ) && ! ( m_pm_reg[0x38] & 0x80 ) && ! ( m_pm_reg[0x1B] & 0x02 ) )
538537               timer2_hi_enable = 1;
539538
540            if ( ( state->m_pm_reg[0x1C] & 0x08 ) && ( state->m_pm_reg[0x48] & 0x04 ) && ! ( state->m_pm_reg[0x1D] & 0x01 ) )
539            if ( ( m_pm_reg[0x1C] & 0x08 ) && ( m_pm_reg[0x48] & 0x04 ) && ! ( m_pm_reg[0x1D] & 0x01 ) )
541540               timer3_enable = 1;
542541
543            if ( ( state->m_pm_reg[0x1C] & 0x80 ) && ( state->m_pm_reg[0x49] & 0x04 ) && ! ( state->m_pm_reg[0x48] & 0x80 ) && ! ( state->m_pm_reg[0x1D] & 0x02 ) )
542            if ( ( m_pm_reg[0x1C] & 0x80 ) && ( m_pm_reg[0x49] & 0x04 ) && ! ( m_pm_reg[0x48] & 0x80 ) && ! ( m_pm_reg[0x1D] & 0x02 ) )
544543               timer3_hi_enable = 1;
545544         }
546545
547546         /* Check which slow timers should be enabled */
548547         if ( data & 0x10 )
549548         {
550            if ( ( state->m_pm_reg[0x18] & 0x08 ) && ( data & 0x01 ) )
549            if ( ( m_pm_reg[0x18] & 0x08 ) && ( data & 0x01 ) )
551550               timer1_enable = 1;
552551
553            if ( ( state->m_pm_reg[0x1A] & 0x08 ) && ( state->m_pm_reg[0x1B] & 0x01 ) )
552            if ( ( m_pm_reg[0x1A] & 0x08 ) && ( m_pm_reg[0x1B] & 0x01 ) )
554553               timer2_enable = 1;
555554
556            if ( ( state->m_pm_reg[0x1C] & 0x08 ) && ( state->m_pm_reg[0x1D] & 0x01 ) )
555            if ( ( m_pm_reg[0x1C] & 0x08 ) && ( m_pm_reg[0x1D] & 0x01 ) )
557556               timer3_enable = 1;
558557         }
559         state->m_timers.timer1->enable( timer1_enable );
560         state->m_timers.timer1_hi->enable( timer1_hi_enable );
561         state->m_timers.timer2->enable( timer2_enable );
562         state->m_timers.timer2_hi->enable( timer2_hi_enable );
563         state->m_timers.timer3->enable( timer3_enable );
564         state->m_timers.timer3_hi->enable( timer3_hi_enable );
558         m_timers.timer1->enable( timer1_enable );
559         m_timers.timer1_hi->enable( timer1_hi_enable );
560         m_timers.timer2->enable( timer2_enable );
561         m_timers.timer2_hi->enable( timer2_hi_enable );
562         m_timers.timer3->enable( timer3_enable );
563         m_timers.timer3_hi->enable( timer3_hi_enable );
565564      }
566565      break;
567566   case 0x1A:   /* Timer 2 pre-scale + enable
r18257r18258
579578               Bit 7   R/W Enable high counting
580579            */
581580      /* Check for prescaler change for the low counter */
582      if ( ( data & 0x07 ) != ( state->m_pm_reg[0x1A] & 0x07 ) )
581      if ( ( data & 0x07 ) != ( m_pm_reg[0x1A] & 0x07 ) )
583582      {
584583         int index = data & 0x07;
585         int cycles = ( state->m_pm_reg[0x1B] & 0x01 ) ? timer_to_cycles_slow[index] : timer_to_cycles_fast[index];
584         int cycles = ( m_pm_reg[0x1B] & 0x01 ) ? timer_to_cycles_slow[index] : timer_to_cycles_fast[index];
586585
587         state->m_timers.timer2->adjust(attotime::zero, 0, space.machine().device<cpu_device>("maincpu")->cycles_to_attotime(cycles));
586         m_timers.timer2->adjust(attotime::zero, 0, machine().device<cpu_device>("maincpu")->cycles_to_attotime(cycles));
588587      }
589588
590589      /* Check for prescaler change for the high counter */
591      if ( ( data & 0x70 ) != ( state->m_pm_reg[0x1A] & 0x70 ) )
590      if ( ( data & 0x70 ) != ( m_pm_reg[0x1A] & 0x70 ) )
592591      {
593592         int index = ( data >> 4 ) & 0x07;
594         int cycles = ( state->m_pm_reg[0x1B] & 0x02 ) ? timer_to_cycles_slow[index] : timer_to_cycles_fast[index];
593         int cycles = ( m_pm_reg[0x1B] & 0x02 ) ? timer_to_cycles_slow[index] : timer_to_cycles_fast[index];
595594
596         state->m_timers.timer2_hi->adjust(attotime::zero, 0, space.machine().device<cpu_device>("maincpu")->cycles_to_attotime(cycles));
595         m_timers.timer2_hi->adjust(attotime::zero, 0, machine().device<cpu_device>("maincpu")->cycles_to_attotime(cycles));
597596      }
598597
599598      /* Check if timer2 low should be enabled */
600      if ( ( data & 0x08 ) && ( state->m_pm_reg[0x38] & 0x04 ) &&
601           ( ( ( state->m_pm_reg[0x19] & 0x10 ) && ( state->m_pm_reg[0x1B] & 0x01 ) ) ||
602             ( ( state->m_pm_reg[0x19] & 0x20 ) && ! ( state->m_pm_reg[0x1B] & 0x01 ) ) ) )
599      if ( ( data & 0x08 ) && ( m_pm_reg[0x38] & 0x04 ) &&
600           ( ( ( m_pm_reg[0x19] & 0x10 ) && ( m_pm_reg[0x1B] & 0x01 ) ) ||
601             ( ( m_pm_reg[0x19] & 0x20 ) && ! ( m_pm_reg[0x1B] & 0x01 ) ) ) )
603602      {
604         state->m_timers.timer2->enable( 1 );
603         m_timers.timer2->enable( 1 );
605604      }
606605      else
607606      {
608         state->m_timers.timer2->enable( 0 );
607         m_timers.timer2->enable( 0 );
609608      }
610609
611610      /* Check if timer2 high should be enabled */
612      if ( ( data & 0x80 ) && ( state->m_pm_reg[0x39] & 0x04 ) && ! ( state->m_pm_reg[0x38] & 0x80 ) &&
613           ( ( ( state->m_pm_reg[0x19] & 0x10 ) && ( state->m_pm_reg[0x1B] & 0x02 ) ) ||
614             ( ( state->m_pm_reg[0x19] & 0x20 ) && ! ( state->m_pm_reg[0x1B] & 0x02 ) ) ) )
611      if ( ( data & 0x80 ) && ( m_pm_reg[0x39] & 0x04 ) && ! ( m_pm_reg[0x38] & 0x80 ) &&
612           ( ( ( m_pm_reg[0x19] & 0x10 ) && ( m_pm_reg[0x1B] & 0x02 ) ) ||
613             ( ( m_pm_reg[0x19] & 0x20 ) && ! ( m_pm_reg[0x1B] & 0x02 ) ) ) )
615614      {
616         state->m_timers.timer2_hi->enable( 1 );
615         m_timers.timer2_hi->enable( 1 );
617616      }
618617      else
619618      {
620         state->m_timers.timer2_hi->enable( 0 );
619         m_timers.timer2_hi->enable( 0 );
621620      }
622621      break;
623622   case 0x1B:   /* Timer 2 speeds
r18257r18258
625624               Bit 1   R/W Select slow timer for timer 2 hi
626625            */
627626      /* Check for prescaler change for the high counter */
628      if ( ( data & 0x01 ) != ( state->m_pm_reg[0x1B] & 0x01 ) )
627      if ( ( data & 0x01 ) != ( m_pm_reg[0x1B] & 0x01 ) )
629628      {
630         int index = state->m_pm_reg[0x1A] & 0x07;
629         int index = m_pm_reg[0x1A] & 0x07;
631630         int cycles = ( data & 0x01 ) ? timer_to_cycles_slow[index] : timer_to_cycles_fast[index];
632631
633         state->m_timers.timer2->adjust(attotime::zero, 0, space.machine().device<cpu_device>("maincpu")->cycles_to_attotime(cycles));
632         m_timers.timer2->adjust(attotime::zero, 0, machine().device<cpu_device>("maincpu")->cycles_to_attotime(cycles));
634633
635         if ( ( state->m_pm_reg[0x1A] & 0x08 ) && ( state->m_pm_reg[0x38] & 0x04 ) &&
636              ( ( ( state->m_pm_reg[0x19] & 0x10 ) && ( data & 0x01 ) ) ||
637                ( ( state->m_pm_reg[0x19] & 0x20 ) && ! ( data & 0x01 ) ) ) )
634         if ( ( m_pm_reg[0x1A] & 0x08 ) && ( m_pm_reg[0x38] & 0x04 ) &&
635              ( ( ( m_pm_reg[0x19] & 0x10 ) && ( data & 0x01 ) ) ||
636                ( ( m_pm_reg[0x19] & 0x20 ) && ! ( data & 0x01 ) ) ) )
638637         {
639            state->m_timers.timer2->enable( 1 );
638            m_timers.timer2->enable( 1 );
640639         }
641640         else
642641         {
643            state->m_timers.timer2->enable( 0 );
642            m_timers.timer2->enable( 0 );
644643         }
645644      }
646645
647646      /* Check for prescaler change for the low counter */
648      if ( ( data & 0x02 ) != ( state->m_pm_reg[0x1B] & 0x02 ) )
647      if ( ( data & 0x02 ) != ( m_pm_reg[0x1B] & 0x02 ) )
649648      {
650         int index = ( state->m_pm_reg[0x1A] >> 4 ) & 0x07;
649         int index = ( m_pm_reg[0x1A] >> 4 ) & 0x07;
651650         int cycles = ( data & 0x02 ) ? timer_to_cycles_slow[index] : timer_to_cycles_fast[index];
652651
653         state->m_timers.timer2_hi->adjust(attotime::zero, 0, space.machine().device<cpu_device>("maincpu")->cycles_to_attotime(cycles));
652         m_timers.timer2_hi->adjust(attotime::zero, 0, machine().device<cpu_device>("maincpu")->cycles_to_attotime(cycles));
654653
655         if ( ( state->m_pm_reg[0x1A] & 0x80 ) && ( state->m_pm_reg[0x39] & 0x04 ) && ! ( state->m_pm_reg[0x38] & 0x80 ) &&
656              ( ( ( state->m_pm_reg[0x19] & 0x10 ) && ( data & 0x02 ) ) ||
657                ( ( state->m_pm_reg[0x19] & 0x20 ) && ! ( data & 0x02 ) ) ) )
654         if ( ( m_pm_reg[0x1A] & 0x80 ) && ( m_pm_reg[0x39] & 0x04 ) && ! ( m_pm_reg[0x38] & 0x80 ) &&
655              ( ( ( m_pm_reg[0x19] & 0x10 ) && ( data & 0x02 ) ) ||
656                ( ( m_pm_reg[0x19] & 0x20 ) && ! ( data & 0x02 ) ) ) )
658657         {
659            state->m_timers.timer2_hi->enable( 1 );
658            m_timers.timer2_hi->enable( 1 );
660659         }
661660         else
662661         {
663            state->m_timers.timer2_hi->enable( 0 );
662            m_timers.timer2_hi->enable( 0 );
664663         }
665664      }
666665      break;
r18257r18258
679678               Bit 7   R/W Enable high counting
680679            */
681680      /* Check for prescaler change for the low counter */
682      if ( ( data & 0x07 ) != ( state->m_pm_reg[0x1C] & 0x07 ) )
681      if ( ( data & 0x07 ) != ( m_pm_reg[0x1C] & 0x07 ) )
683682      {
684683         int index = data & 0x07;
685         int cycles = ( state->m_pm_reg[0x1D] & 0x01 ) ? timer_to_cycles_slow[index] : timer_to_cycles_fast[index];
684         int cycles = ( m_pm_reg[0x1D] & 0x01 ) ? timer_to_cycles_slow[index] : timer_to_cycles_fast[index];
686685
687         state->m_timers.timer3->adjust(attotime::zero, 0, space.machine().device<cpu_device>("maincpu")->cycles_to_attotime(cycles));
686         m_timers.timer3->adjust(attotime::zero, 0, machine().device<cpu_device>("maincpu")->cycles_to_attotime(cycles));
688687      }
689688
690689      /* Check for prescaler change for the high counter */
691      if ( ( data & 0x70 ) != ( state->m_pm_reg[0x1C] & 0x70 ) )
690      if ( ( data & 0x70 ) != ( m_pm_reg[0x1C] & 0x70 ) )
692691      {
693692         int index = ( data >> 4 ) & 0x07;
694         int cycles = ( state->m_pm_reg[0x1D] & 0x02 ) ? timer_to_cycles_slow[index] : timer_to_cycles_fast[index];
693         int cycles = ( m_pm_reg[0x1D] & 0x02 ) ? timer_to_cycles_slow[index] : timer_to_cycles_fast[index];
695694
696         state->m_timers.timer3_hi->adjust(attotime::zero, 0, space.machine().device<cpu_device>("maincpu")->cycles_to_attotime(cycles));
695         m_timers.timer3_hi->adjust(attotime::zero, 0, machine().device<cpu_device>("maincpu")->cycles_to_attotime(cycles));
697696      }
698697
699698      /* Check if timer2 low should be enabled */
700      if ( ( data & 0x08 ) && ( state->m_pm_reg[0x48] & 0x04 ) &&
701           ( ( ( state->m_pm_reg[0x19] & 0x10 ) && ( state->m_pm_reg[0x1D] & 0x01 ) ) ||
702             ( ( state->m_pm_reg[0x19] & 0x20 ) && ! ( state->m_pm_reg[0x1D] & 0x01 ) ) ) )
699      if ( ( data & 0x08 ) && ( m_pm_reg[0x48] & 0x04 ) &&
700           ( ( ( m_pm_reg[0x19] & 0x10 ) && ( m_pm_reg[0x1D] & 0x01 ) ) ||
701             ( ( m_pm_reg[0x19] & 0x20 ) && ! ( m_pm_reg[0x1D] & 0x01 ) ) ) )
703702      {
704         state->m_timers.timer3->enable( 1 );
703         m_timers.timer3->enable( 1 );
705704      }
706705      else
707706      {
708         state->m_timers.timer3->enable( 0 );
707         m_timers.timer3->enable( 0 );
709708      }
710709
711710      /* Check if timer2 high should be enabled */
712      if ( ( data & 0x80 ) && ( state->m_pm_reg[0x49] & 0x04 ) && ! ( state->m_pm_reg[0x48] & 0x80 ) &&
713           ( ( ( state->m_pm_reg[0x19] & 0x10 ) && ( state->m_pm_reg[0x1D] & 0x02 ) ) ||
714             ( ( state->m_pm_reg[0x19] & 0x20 ) && ! ( state->m_pm_reg[0x1D] & 0x02 ) ) ) )
711      if ( ( data & 0x80 ) && ( m_pm_reg[0x49] & 0x04 ) && ! ( m_pm_reg[0x48] & 0x80 ) &&
712           ( ( ( m_pm_reg[0x19] & 0x10 ) && ( m_pm_reg[0x1D] & 0x02 ) ) ||
713             ( ( m_pm_reg[0x19] & 0x20 ) && ! ( m_pm_reg[0x1D] & 0x02 ) ) ) )
715714      {
716         state->m_timers.timer3_hi->enable( 1 );
715         m_timers.timer3_hi->enable( 1 );
717716      }
718717      else
719718      {
720         state->m_timers.timer3_hi->enable( 0 );
719         m_timers.timer3_hi->enable( 0 );
721720      }
722721      break;
723722   case 0x1D:   /* Timer 3 speeds
r18257r18258
725724               Bit 1   R/W Select slow timer for timer 3 hi
726725            */
727726      /* Check for prescaler change for the high counter */
728      if ( ( data & 0x01 ) != ( state->m_pm_reg[0x1D] & 0x01 ) )
727      if ( ( data & 0x01 ) != ( m_pm_reg[0x1D] & 0x01 ) )
729728      {
730         int index = state->m_pm_reg[0x1C] & 0x07;
729         int index = m_pm_reg[0x1C] & 0x07;
731730         int cycles = ( data & 0x01 ) ? timer_to_cycles_slow[index] : timer_to_cycles_fast[index];
732731
733         state->m_timers.timer3->adjust(attotime::zero, 0, space.machine().device<cpu_device>("maincpu")->cycles_to_attotime(cycles));
732         m_timers.timer3->adjust(attotime::zero, 0, machine().device<cpu_device>("maincpu")->cycles_to_attotime(cycles));
734733
735         if ( ( state->m_pm_reg[0x1C] & 0x08 ) && ( state->m_pm_reg[0x48] & 0x04 ) &&
736              ( ( ( state->m_pm_reg[0x19] & 0x10 ) && ( data & 0x01 ) ) ||
737                ( ( state->m_pm_reg[0x19] & 0x20 ) && ! ( data & 0x01 ) ) ) )
734         if ( ( m_pm_reg[0x1C] & 0x08 ) && ( m_pm_reg[0x48] & 0x04 ) &&
735              ( ( ( m_pm_reg[0x19] & 0x10 ) && ( data & 0x01 ) ) ||
736                ( ( m_pm_reg[0x19] & 0x20 ) && ! ( data & 0x01 ) ) ) )
738737         {
739            state->m_timers.timer3->enable( 1 );
738            m_timers.timer3->enable( 1 );
740739         }
741740         else
742741         {
743            state->m_timers.timer3->enable( 0 );
742            m_timers.timer3->enable( 0 );
744743         }
745744      }
746745
747746      /* Check for prescaler change for the low counter */
748      if ( ( data & 0x02 ) != ( state->m_pm_reg[0x1D] & 0x02 ) )
747      if ( ( data & 0x02 ) != ( m_pm_reg[0x1D] & 0x02 ) )
749748      {
750         int index = ( state->m_pm_reg[0x1C] >> 4 ) & 0x07;
749         int index = ( m_pm_reg[0x1C] >> 4 ) & 0x07;
751750         int cycles = ( data & 0x02 ) ? timer_to_cycles_slow[index] : timer_to_cycles_fast[index];
752751
753         state->m_timers.timer3_hi->adjust(attotime::zero, 0, space.machine().device<cpu_device>("maincpu")->cycles_to_attotime(cycles));
752         m_timers.timer3_hi->adjust(attotime::zero, 0, machine().device<cpu_device>("maincpu")->cycles_to_attotime(cycles));
754753
755         if ( ( state->m_pm_reg[0x1C] & 0x80 ) && ( state->m_pm_reg[0x49] & 0x04 ) && ! ( state->m_pm_reg[0x48] & 0x80 ) &&
756              ( ( ( state->m_pm_reg[0x19] & 0x10 ) && ( data & 0x02 ) ) ||
757                ( ( state->m_pm_reg[0x19] & 0x20 ) && ! ( data & 0x02 ) ) ) )
754         if ( ( m_pm_reg[0x1C] & 0x80 ) && ( m_pm_reg[0x49] & 0x04 ) && ! ( m_pm_reg[0x48] & 0x80 ) &&
755              ( ( ( m_pm_reg[0x19] & 0x10 ) && ( data & 0x02 ) ) ||
756                ( ( m_pm_reg[0x19] & 0x20 ) && ! ( data & 0x02 ) ) ) )
758757         {
759            state->m_timers.timer3_hi->enable( 1 );
758            m_timers.timer3_hi->enable( 1 );
760759         }
761760         else
762761         {
763            state->m_timers.timer3_hi->enable( 0 );
762            m_timers.timer3_hi->enable( 0 );
764763         }
765764      }
766765      break;
r18257r18258
770769               Bit 4-5 R/W Timer 2 overflow Interrupt #3-#4
771770               Bit 6-7 R/W VDraw/VBlank trigger Interrupt #1-#2
772771            */
773      state->m_pm_reg[0x20] = data;
774      pokemini_check_irqs(space.machine());
772      m_pm_reg[0x20] = data;
773      pokemini_check_irqs(machine());
775774      break;
776775   case 0x21:   /* Event #15-#22 priority
777776               Bit 0-1 R/W Unknown
778777               Bit 2-3 R/W All keypad interrupts - Interrupt #15-#22
779778               Bit 4-7 R/W Unknown
780779            */
781      state->m_pm_reg[0x21] = data;
782      pokemini_check_irqs(space.machine());
780      m_pm_reg[0x21] = data;
781      pokemini_check_irqs(machine());
783782      break;
784783   case 0x22:   /* Event #9-#14 priority
785784               Bit 0-1 R/W All #9 - #14 events - Interrupt #9-#14
786785               Bit 2-7     Unused
787786            */
788      state->m_pm_reg[0x22] = data;
789      pokemini_check_irqs(space.machine());
787      m_pm_reg[0x22] = data;
788      pokemini_check_irqs(machine());
790789      break;
791790   case 0x23:   /* Event #1-#8 enable
792791               Bit 0   R/W Timer 3 overflow (mirror) - Enable Interrupt #8
r18257r18258
798797               Bit 6   R/W V-Draw trigger - Enable Interrupt #2
799798               Bit 7   R/W V-Blank trigger - Enable Interrupt #1
800799            */
801      state->m_pm_reg[0x23] = data;
802      pokemini_check_irqs(space.machine());
800      m_pm_reg[0x23] = data;
801      pokemini_check_irqs(machine());
803802      break;
804803   case 0x24:   /* Event #9-#12 enable
805804               Bit 0-5 R/W Unknown
806805               Bit 6-7     Unused
807806            */
808      state->m_pm_reg[0x24] = data;
809      pokemini_check_irqs(space.machine());
807      m_pm_reg[0x24] = data;
808      pokemini_check_irqs(machine());
810809      break;
811810   case 0x25:   /* Event #15-#22 enable
812811               Bit 0   R/W Press key "A" event - Enable interrupt #22
r18257r18258
818817               Bit 6   R/W Press D-pad right key event - Enable interrupt #16
819818               Bit 7   R/W Press power button event - Enable interrupt #15
820819            */
821      state->m_pm_reg[0x25] = data;
822      pokemini_check_irqs(space.machine());
820      m_pm_reg[0x25] = data;
821      pokemini_check_irqs(machine());
823822      break;
824823   case 0x26:   /* Event #13-#14 enable
825824               Bit 0-2 R/W Unknown
r18257r18258
828827               Bit 6   R/W Shock detector trigger - Enable interrupt #14
829828               Bit 7   R/W IR receiver - low to high trigger - Enable interrupt #13
830829            */
831      state->m_pm_reg[0x26] = data;
832      pokemini_check_irqs(space.machine());
830      m_pm_reg[0x26] = data;
831      pokemini_check_irqs(machine());
833832      break;
834833   case 0x27:   /* Interrupt active flag #1-#8
835834               Bit 0       Timer 3 overflow (mirror) / Clear interrupt #8
r18257r18258
841840               Bit 6       VDraw trigger / Clear interrupt #2
842841               Bit 7       VBlank trigger / Clear interrupt #1
843842            */
844      state->m_pm_reg[0x27] &= ~data;
845      pokemini_check_irqs(space.machine());
843      m_pm_reg[0x27] &= ~data;
844      pokemini_check_irqs(machine());
846845      return;
847846   case 0x28:   /* Interrupt active flag #9-#12
848847               Bit 0-1     Unknown
r18257r18258
852851               Bit 5       Unknown / Clear interrupt #9
853852               Bit 6-7     Unknown
854853            */
855      state->m_pm_reg[0x28] &= ~data;
856      pokemini_check_irqs(space.machine());
854      m_pm_reg[0x28] &= ~data;
855      pokemini_check_irqs(machine());
857856      return;
858857   case 0x29:   /* Interrupt active flag #15-#22
859858               Bit 0       Press key "A" event / Clear interrupt #22
r18257r18258
865864               Bit 6       Press D-pad right key event / Clear interrupt #16
866865               Bit 7       Press power button event / Clear interrupt #15
867866            */
868      state->m_pm_reg[0x29] &= ~data;
869      pokemini_check_irqs(space.machine());
867      m_pm_reg[0x29] &= ~data;
868      pokemini_check_irqs(machine());
870869      return;
871870   case 0x2A:   /* Interrupt active flag #13-#14
872871               Bit 0-5     Unknown
873872               Bit 6       Shock detector trigger / Clear interrupt #14
874873               Bit 7       Unknown / Clear interrupt #13
875874            */
876      state->m_pm_reg[0x2A] &= ~data;
877      pokemini_check_irqs(space.machine());
875      m_pm_reg[0x2A] &= ~data;
876      pokemini_check_irqs(machine());
878877      return;
879878   case 0x30:   /* Timer 1 control 1
880879               Bit 0   R/W Unknown
r18257r18258
886885            */
887886      if ( data & 0x02 )
888887      {
889         state->m_pm_reg[0x36] = state->m_pm_reg[0x32];
888         m_pm_reg[0x36] = m_pm_reg[0x32];
890889         data &= ~0x02;
891890      }
892891
893      if ( ( data & 0x04 ) && ( state->m_pm_reg[0x18] & 0x08 ) &&
894           ( ( ( state->m_pm_reg[0x19] & 0x20 ) && ! ( state->m_pm_reg[0x19] & 0x01 ) ) ||
895             ( ( state->m_pm_reg[0x19] & 0x10 ) && ( state->m_pm_reg[0x19] & 0x01 ) ) ) )
892      if ( ( data & 0x04 ) && ( m_pm_reg[0x18] & 0x08 ) &&
893           ( ( ( m_pm_reg[0x19] & 0x20 ) && ! ( m_pm_reg[0x19] & 0x01 ) ) ||
894             ( ( m_pm_reg[0x19] & 0x10 ) && ( m_pm_reg[0x19] & 0x01 ) ) ) )
896895      {
897         state->m_timers.timer1->enable( 1 );
896         m_timers.timer1->enable( 1 );
898897      }
899898      else
900899      {
901         state->m_timers.timer1->enable( 0 );
900         m_timers.timer1->enable( 0 );
902901      }
903902
904      if ( ( state->m_pm_reg[0x31] & 0x04 ) && ! ( data & 0x80 ) && ( state->m_pm_reg[0x18] & 0x80 ) &&
905           ( ( ( state->m_pm_reg[0x19] & 0x20 ) && ! ( state->m_pm_reg[0x19] & 0x02 ) ) ||
906             ( ( state->m_pm_reg[0x19] & 0x10 ) && ( state->m_pm_reg[0x19] & 0x02 ) ) ) )
903      if ( ( m_pm_reg[0x31] & 0x04 ) && ! ( data & 0x80 ) && ( m_pm_reg[0x18] & 0x80 ) &&
904           ( ( ( m_pm_reg[0x19] & 0x20 ) && ! ( m_pm_reg[0x19] & 0x02 ) ) ||
905             ( ( m_pm_reg[0x19] & 0x10 ) && ( m_pm_reg[0x19] & 0x02 ) ) ) )
907906      {
908         state->m_timers.timer1_hi->enable( 1 );
907         m_timers.timer1_hi->enable( 1 );
909908      }
910909      else
911910      {
912         state->m_timers.timer1_hi->enable( 0 );
911         m_timers.timer1_hi->enable( 0 );
913912      }
914913      break;
915914   case 0x31:   /* Timer 1 control 2
r18257r18258
921920            */
922921      if ( data & 0x02 )
923922      {
924         state->m_pm_reg[0x37] = state->m_pm_reg[0x33];
923         m_pm_reg[0x37] = m_pm_reg[0x33];
925924         data &= ~0x02;
926925      }
927926
928      if ( ( data & 0x04 ) && ! ( state->m_pm_reg[0x30] & 0x80 ) && ( state->m_pm_reg[0x18] & 0x80 ) &&
929           ( ( ( state->m_pm_reg[0x19] & 0x20 ) && ! ( state->m_pm_reg[0x19] & 0x02 ) ) ||
930             ( ( state->m_pm_reg[0x19] & 0x10 ) && ( state->m_pm_reg[0x19] & 0x02 ) ) ) )
927      if ( ( data & 0x04 ) && ! ( m_pm_reg[0x30] & 0x80 ) && ( m_pm_reg[0x18] & 0x80 ) &&
928           ( ( ( m_pm_reg[0x19] & 0x20 ) && ! ( m_pm_reg[0x19] & 0x02 ) ) ||
929             ( ( m_pm_reg[0x19] & 0x10 ) && ( m_pm_reg[0x19] & 0x02 ) ) ) )
931930      {
932         state->m_timers.timer1_hi->enable( 1 );
931         m_timers.timer1_hi->enable( 1 );
933932      }
934933      else
935934      {
936         state->m_timers.timer1_hi->enable( 0 );
935         m_timers.timer1_hi->enable( 0 );
937936      }
938937      break;
939938   case 0x32:   /* Timer 1 preset value (low)
r18257r18258
948947            */
949948   case 0x35:   /* Timer 1 sound-pivot (high, unused)
950949            */
951      logerror( "%0X: Write to unknown hardware address: %02X, %02X\n", space.machine().firstcpu->pc( ), offset, data );
950      logerror( "%0X: Write to unknown hardware address: %02X, %02X\n", machine().firstcpu->pc( ), offset, data );
952951      break;
953952   case 0x36:   /* Timer 1 counter (low), read only
954953            */
r18257r18258
966965            */
967966      if ( data & 0x02 )
968967      {
969         state->m_pm_reg[0x3E] = state->m_pm_reg[0x3A];
968         m_pm_reg[0x3E] = m_pm_reg[0x3A];
970969         data &= ~0x02;
971970      }
972971
973      if ( ( data & 0x04 ) && ( state->m_pm_reg[0x1A] & 0x08 ) &&
974           ( ( ( state->m_pm_reg[0x19] & 0x20 ) && ! ( state->m_pm_reg[0x1A] & 0x01 ) ) ||
975             ( ( state->m_pm_reg[0x19] & 0x10 ) && ( state->m_pm_reg[0x1A] & 0x01 ) ) ) )
972      if ( ( data & 0x04 ) && ( m_pm_reg[0x1A] & 0x08 ) &&
973           ( ( ( m_pm_reg[0x19] & 0x20 ) && ! ( m_pm_reg[0x1A] & 0x01 ) ) ||
974             ( ( m_pm_reg[0x19] & 0x10 ) && ( m_pm_reg[0x1A] & 0x01 ) ) ) )
976975      {
977         state->m_timers.timer2->enable( 1 );
976         m_timers.timer2->enable( 1 );
978977      }
979978      else
980979      {
981         state->m_timers.timer2->enable( 0 );
980         m_timers.timer2->enable( 0 );
982981      }
983      if ( ( state->m_pm_reg[0x39] & 0x04 ) && ! ( data & 0x80 ) && ( state->m_pm_reg[0x1A] & 0x80 ) &&
984           ( ( ( state->m_pm_reg[0x19] & 0x20 ) && ! ( state->m_pm_reg[0x1B] & 0x02 ) ) ||
985             ( ( state->m_pm_reg[0x19] & 0x10 ) && ( state->m_pm_reg[0x1B] & 0x02 ) ) ) )
982      if ( ( m_pm_reg[0x39] & 0x04 ) && ! ( data & 0x80 ) && ( m_pm_reg[0x1A] & 0x80 ) &&
983           ( ( ( m_pm_reg[0x19] & 0x20 ) && ! ( m_pm_reg[0x1B] & 0x02 ) ) ||
984             ( ( m_pm_reg[0x19] & 0x10 ) && ( m_pm_reg[0x1B] & 0x02 ) ) ) )
986985      {
987         state->m_timers.timer2_hi->enable( 1 );
986         m_timers.timer2_hi->enable( 1 );
988987      }
989988      else
990989      {
991         state->m_timers.timer2_hi->enable( 0 );
990         m_timers.timer2_hi->enable( 0 );
992991      }
993992      break;
994993   case 0x39:   /* Timer 2 control 2
r18257r18258
1000999            */
10011000      if ( data & 0x02 )
10021001      {
1003         state->m_pm_reg[0x3F] = state->m_pm_reg[0x3A];
1002         m_pm_reg[0x3F] = m_pm_reg[0x3A];
10041003         data &= ~0x02;
10051004      }
10061005
1007      if ( ( data & 0x04 ) && ! ( state->m_pm_reg[0x38] & 0x80 ) && ( state->m_pm_reg[0x1A] & 0x80 ) &&
1008           ( ( ( state->m_pm_reg[0x19] & 0x20 ) && ! ( state->m_pm_reg[0x1B] & 0x02 ) ) ||
1009             ( ( state->m_pm_reg[0x19] & 0x10 ) && ( state->m_pm_reg[0x1B] & 0x02 ) ) ) )
1006      if ( ( data & 0x04 ) && ! ( m_pm_reg[0x38] & 0x80 ) && ( m_pm_reg[0x1A] & 0x80 ) &&
1007           ( ( ( m_pm_reg[0x19] & 0x20 ) && ! ( m_pm_reg[0x1B] & 0x02 ) ) ||
1008             ( ( m_pm_reg[0x19] & 0x10 ) && ( m_pm_reg[0x1B] & 0x02 ) ) ) )
10101009      {
1011         state->m_timers.timer2_hi->enable( 1 );
1010         m_timers.timer2_hi->enable( 1 );
10121011      }
10131012      else
10141013      {
1015         state->m_timers.timer2_hi->enable( 0 );
1014         m_timers.timer2_hi->enable( 0 );
10161015      }
10171016      break;
10181017   case 0x3A:   /* Timer 2 preset value (low)
r18257r18258
10271026            */
10281027   case 0x3D:   /* Timer 2 sound-pivot (high, unused)
10291028            */
1030      logerror( "%0X: Write to unknown hardware address: %02X, %02X\n", space.machine().firstcpu->pc( ), offset, data );
1029      logerror( "%0X: Write to unknown hardware address: %02X, %02X\n", machine().firstcpu->pc( ), offset, data );
10311030      break;
10321031   case 0x3E:   /* Timer 2 counter (low), read only
10331032               Bit 0-7 R/W Timer 2 counter value bit 0-7
r18257r18258
10441043            */
10451044      if ( data & 0x02 )
10461045      {
1047         state->m_pm_reg[0x41] = 0;
1046         m_pm_reg[0x41] = 0;
10481047         data &= ~0x02;
10491048      }
10501049      break;
r18257r18258
10621061            */
10631062      if ( data & 0x02 )
10641063      {
1065         state->m_pm_reg[0x4E] = state->m_pm_reg[0x4A];
1064         m_pm_reg[0x4E] = m_pm_reg[0x4A];
10661065         data &= ~0x02;
10671066      }
10681067
1069      if ( ( data & 0x04 ) && ( state->m_pm_reg[0x1C] & 0x08 ) &&
1070           ( ( ( state->m_pm_reg[0x19] & 0x20 ) && ! ( state->m_pm_reg[0x1D] & 0x01 ) ) ||
1071             ( ( state->m_pm_reg[0x19] & 0x10 ) && ( state->m_pm_reg[0x1D] & 0x01 ) ) ) )
1068      if ( ( data & 0x04 ) && ( m_pm_reg[0x1C] & 0x08 ) &&
1069           ( ( ( m_pm_reg[0x19] & 0x20 ) && ! ( m_pm_reg[0x1D] & 0x01 ) ) ||
1070             ( ( m_pm_reg[0x19] & 0x10 ) && ( m_pm_reg[0x1D] & 0x01 ) ) ) )
10721071      {
1073         state->m_timers.timer3->enable( 1 );
1072         m_timers.timer3->enable( 1 );
10741073      }
10751074      else
10761075      {
1077         state->m_timers.timer3->enable( 0 );
1076         m_timers.timer3->enable( 0 );
10781077      }
1079      if ( ( state->m_pm_reg[0x49] & 0x04 ) && ! ( data & 0x80 ) && ( state->m_pm_reg[0x1C] & 0x80 ) &&
1080           ( ( ( state->m_pm_reg[0x19] & 0x20 ) && ! ( state->m_pm_reg[0x1D] & 0x02 ) ) ||
1081             ( ( state->m_pm_reg[0x19] & 0x10 ) && ( state->m_pm_reg[0x1D] & 0x02 ) ) ) )
1078      if ( ( m_pm_reg[0x49] & 0x04 ) && ! ( data & 0x80 ) && ( m_pm_reg[0x1C] & 0x80 ) &&
1079           ( ( ( m_pm_reg[0x19] & 0x20 ) && ! ( m_pm_reg[0x1D] & 0x02 ) ) ||
1080             ( ( m_pm_reg[0x19] & 0x10 ) && ( m_pm_reg[0x1D] & 0x02 ) ) ) )
10821081      {
1083         state->m_timers.timer3_hi->enable( 1 );
1082         m_timers.timer3_hi->enable( 1 );
10841083      }
10851084      else
10861085      {
1087         state->m_timers.timer3_hi->enable( 0 );
1086         m_timers.timer3_hi->enable( 0 );
10881087      }
1089      state->m_pm_reg[0x48] = data;
1090      pokemini_update_sound(space.machine());
1088      m_pm_reg[0x48] = data;
1089      pokemini_update_sound(machine());
10911090      break;
10921091   case 0x49:   /* Timer 3 control 2
10931092               Bit 0   R/W Unknown
r18257r18258
10981097            */
10991098      if ( data & 0x02 )
11001099      {
1101         state->m_pm_reg[0x4F] = state->m_pm_reg[0x4B];
1100         m_pm_reg[0x4F] = m_pm_reg[0x4B];
11021101         data &= ~0x02;
11031102      }
11041103
1105      if ( ( data & 0x04 ) && ! ( state->m_pm_reg[0x48] & 0x80 ) && ( state->m_pm_reg[0x1C] & 0x80 ) &&
1106           ( ( ( state->m_pm_reg[0x19] & 0x20 ) && ! ( state->m_pm_reg[0x1D] & 0x02 ) ) ||
1107             ( ( state->m_pm_reg[0x19] & 0x10 ) && ( state->m_pm_reg[0x1D] & 0x02 ) ) ) )
1104      if ( ( data & 0x04 ) && ! ( m_pm_reg[0x48] & 0x80 ) && ( m_pm_reg[0x1C] & 0x80 ) &&
1105           ( ( ( m_pm_reg[0x19] & 0x20 ) && ! ( m_pm_reg[0x1D] & 0x02 ) ) ||
1106             ( ( m_pm_reg[0x19] & 0x10 ) && ( m_pm_reg[0x1D] & 0x02 ) ) ) )
11081107      {
1109         state->m_timers.timer3_hi->enable( 1 );
1108         m_timers.timer3_hi->enable( 1 );
11101109      }
11111110      else
11121111      {
1113         state->m_timers.timer3_hi->enable( 0 );
1112         m_timers.timer3_hi->enable( 0 );
11141113      }
1115      state->m_pm_reg[0x49] = data;
1116      pokemini_update_sound(space.machine());
1114      m_pm_reg[0x49] = data;
1115      pokemini_update_sound(machine());
11171116      break;
11181117   case 0x4A:   /* Timer 3 preset value (low)
11191118               Bit 0-7 R/W Timer 3 preset value bit 0-7
11201119            */
1121      state->m_pm_reg[0x4A] = data;
1122      pokemini_update_sound(space.machine());
1120      m_pm_reg[0x4A] = data;
1121      pokemini_update_sound(machine());
11231122      break;
11241123   case 0x4B:   /* Timer 3 preset value (high)
11251124               Bit 0-7 R/W Timer 3 preset value bit 8-15
11261125            */
1127      state->m_pm_reg[0x4B] = data;
1128      pokemini_update_sound(space.machine());
1126      m_pm_reg[0x4B] = data;
1127      pokemini_update_sound(machine());
11291128      break;
11301129   case 0x4C:   /* Timer 3 sound-pivot (low)
11311130               Bit 0-7 R/W Timer 3 sound-pivot value bit 0-7
11321131            */
1133      state->m_pm_reg[0x4C] = data;
1134      pokemini_update_sound(space.machine());
1132      m_pm_reg[0x4C] = data;
1133      pokemini_update_sound(machine());
11351134      break;
11361135   case 0x4D:   /* Timer 3 sound-pivot (high)
11371136               Bit 0-7 R/W Timer 3 sound-pivot value bit 8-15
r18257r18258
11411140               Pulse-Width of 50% = Half of preset-value
11421141               Pulse-Width of 100% = Same as preset-value
11431142            */
1144      state->m_pm_reg[0x4D] = data;
1145      pokemini_update_sound(space.machine());
1143      m_pm_reg[0x4D] = data;
1144      pokemini_update_sound(machine());
11461145      break;
11471146   case 0x4E:   /* Timer 3 counter (low), read only
11481147               Bit 0-7 R/W Timer 3 counter value bit 0-7
r18257r18258
11841183               Bit 6       Always 1
11851184               Bit 7   R/W IR received bit (mirror, if device not selected: 0)
11861185            */
1187      if ( state->m_pm_reg[0x60] & 0x04 )
1188         i2cmem_sda_write(device, ( data & 0x04 ) ? 1 : 0 );
1186      if ( m_pm_reg[0x60] & 0x04 )
1187         i2cmem_sda_write(machine().device("i2cmem"), ( data & 0x04 ) ? 1 : 0 );
11891188
1190      if ( state->m_pm_reg[0x60] & 0x08 )
1191         i2cmem_scl_write(device, ( data & 0x08 ) ? 1 : 0 );
1189      if ( m_pm_reg[0x60] & 0x08 )
1190         i2cmem_scl_write(machine().device("i2cmem"), ( data & 0x08 ) ? 1 : 0 );
11921191      break;
11931192   case 0x70:   /* Sound related */
1194      state->m_pm_reg[0x70] = data;
1195      pokemini_update_sound(space.machine());
1193      m_pm_reg[0x70] = data;
1194      pokemini_update_sound(machine());
11961195      break;
11971196   case 0x71:   /* Sound volume
11981197               Bit 0-1 R/W Sound volume
r18257r18258
12031202               Bit 2   R/W Always set to 0
12041203               Bit 3-7     Unused
12051204            */
1206      state->m_pm_reg[0x71] = data;
1207      pokemini_update_sound(space.machine());
1205      m_pm_reg[0x71] = data;
1206      pokemini_update_sound(machine());
12081207      break;
12091208   case 0x80:   /* LCD control
12101209               Bit 0   R/W Invert colors; 0 - normal, 1 - inverted
r18257r18258
12181217                           11 - 24x8 (prohibited code)
12191218              Bit 6-7      Unused
12201219            */
1221      state->m_prc.colors_inverted = ( data & 0x01 ) ? 1 : 0;
1222      state->m_prc.background_enabled = ( data & 0x02 ) ? 1 : 0;
1223      state->m_prc.sprites_enabled = ( data & 0x04 ) ? 1 : 0;
1224      state->m_prc.copy_enabled = ( data & 0x08 ) ? 1 : 0;
1225      state->m_prc.map_size = ( data >> 4 ) & 0x03;
1226      switch( state->m_prc.map_size )
1220      m_prc.colors_inverted = ( data & 0x01 ) ? 1 : 0;
1221      m_prc.background_enabled = ( data & 0x02 ) ? 1 : 0;
1222      m_prc.sprites_enabled = ( data & 0x04 ) ? 1 : 0;
1223      m_prc.copy_enabled = ( data & 0x08 ) ? 1 : 0;
1224      m_prc.map_size = ( data >> 4 ) & 0x03;
1225      switch( m_prc.map_size )
12271226      {
12281227      case 0:
1229         state->m_prc.map_size_x = 12; break;
1228         m_prc.map_size_x = 12; break;
12301229      case 1:
1231         state->m_prc.map_size_x = 16; break;
1230         m_prc.map_size_x = 16; break;
12321231      case 2:
12331232      case 3:
1234         state->m_prc.map_size_x = 24; break;
1233         m_prc.map_size_x = 24; break;
12351234      }
12361235      break;
12371236   case 0x81:   /* LCD render refresh rate
r18257r18258
12491248            */
12501249      switch ( data & 0x0E )
12511250      {
1252      case 0x00:   state->m_prc.max_frame_count = 3; break;
1253      case 0x02:   state->m_prc.max_frame_count = 6; break;
1254      case 0x04:   state->m_prc.max_frame_count = 9; break;
1255      case 0x06:   state->m_prc.max_frame_count = 12; break;
1256      case 0x08:   state->m_prc.max_frame_count = 2; break;
1257      case 0x0A:   state->m_prc.max_frame_count = 4; break;
1258      case 0x0C:   state->m_prc.max_frame_count = 6; break;
1259      case 0x0E:   state->m_prc.max_frame_count = 8; break;
1251      case 0x00:   m_prc.max_frame_count = 3; break;
1252      case 0x02:   m_prc.max_frame_count = 6; break;
1253      case 0x04:   m_prc.max_frame_count = 9; break;
1254      case 0x06:   m_prc.max_frame_count = 12; break;
1255      case 0x08:   m_prc.max_frame_count = 2; break;
1256      case 0x0A:   m_prc.max_frame_count = 4; break;
1257      case 0x0C:   m_prc.max_frame_count = 6; break;
1258      case 0x0E:   m_prc.max_frame_count = 8; break;
12601259      }
12611260      break;
12621261   case 0x82:   /* BG tile data memory offset (low)
r18257r18258
12641263               Bit 3-7 R/W BG tile data memory offset bit 3-7
12651264            */
12661265      data &= 0xF8;
1267      state->m_prc.bg_tiles = ( state->m_prc.bg_tiles & 0xFFFF00 ) | data;
1266      m_prc.bg_tiles = ( m_prc.bg_tiles & 0xFFFF00 ) | data;
12681267      break;
12691268   case 0x83:   /* BG tile data memory offset (mid)
12701269               Bit 0-7 R/W BG tile data memory offset bit 8-15
12711270            */
1272      state->m_prc.bg_tiles = ( state->m_prc.bg_tiles & 0xFF00FF ) | ( data << 8 );
1271      m_prc.bg_tiles = ( m_prc.bg_tiles & 0xFF00FF ) | ( data << 8 );
12731272      break;
12741273   case 0x84:   /* BG tile data memory offset (high)
12751274               Bit 0-4 R/W BG tile data memory offset bit 16-20
12761275               Bit 5-7     Unused
12771276            */
12781277      data &= 0x1F;
1279      state->m_prc.bg_tiles = ( state->m_prc.bg_tiles & 0x00FFFF ) | ( data << 16 );
1278      m_prc.bg_tiles = ( m_prc.bg_tiles & 0x00FFFF ) | ( data << 16 );
12801279      break;
12811280   case 0x85:   /* BG vertical move
12821281               Bit 0-6 R/W Move the background up, move range:
r18257r18258
12921291                           Map size 2: 0x00 to 0x60
12931292               Bit 7       Unused
12941293            */
1295      logerror( "%0X: Write to unknown hardware address: %02X, %02X\n", space.machine().firstcpu->pc( ), offset, data );
1294      logerror( "%0X: Write to unknown hardware address: %02X, %02X\n", machine().firstcpu->pc( ), offset, data );
12961295      break;
12971296   case 0x87:   /* Sprite tile data memory offset (low)
12981297               Bit 0-5     Always "0"
12991298               Bit 6-7 R/W Sprite tile data memory offset bit 6-7
13001299            */
13011300      data &= 0xC0;
1302      state->m_prc.spr_tiles = ( state->m_prc.spr_tiles & 0xFFFF00 ) | data;
1301      m_prc.spr_tiles = ( m_prc.spr_tiles & 0xFFFF00 ) | data;
13031302      break;
13041303   case 0x88:   /* Sprite tile data memory offset (med)
13051304               Bit 0-7 R/W Sprite tile data memory offset bit 8-15
13061305            */
1307      state->m_prc.spr_tiles = ( state->m_prc.spr_tiles & 0xFF00FF ) | ( data << 8 );
1306      m_prc.spr_tiles = ( m_prc.spr_tiles & 0xFF00FF ) | ( data << 8 );
13081307      break;
13091308   case 0x89:   /* Sprite tile data memory offset (high)
13101309               Bit 0-4 R/W Sprite tile data memory offset bit 16-20
13111310               Bit 5-7     Unused
13121311            */
13131312      data &= 0x1F;
1314      state->m_prc.spr_tiles = ( state->m_prc.spr_tiles & 0x00FFFF ) | ( data << 16 );
1313      m_prc.spr_tiles = ( m_prc.spr_tiles & 0x00FFFF ) | ( data << 16 );
13151314      break;
13161315   case 0x8A:   /* LCD status
13171316               Bit 0   R   Unknown
r18257r18258
13331332//      lcd_data_w( data );
13341333      break;
13351334   default:
1336      logerror( "%0X: Write to unknown hardware address: %02X, %02X\n", space.machine().firstcpu->pc( ), offset, data );
1335      logerror( "%0X: Write to unknown hardware address: %02X, %02X\n", machine().firstcpu->pc( ), offset, data );
13371336      break;
13381337   }
1339   state->m_pm_reg[offset] = data;
1338   m_pm_reg[offset] = data;
13401339}
13411340
1342READ8_DEVICE_HANDLER( pokemini_hwreg_r )
1341READ8_MEMBER(pokemini_state::pokemini_hwreg_r)
13431342{
1344   pokemini_state *state = space.machine().driver_data<pokemini_state>();
1345   UINT8 data = state->m_pm_reg[offset];
1343   UINT8 data = m_pm_reg[offset];
13461344
13471345   switch( offset )
13481346   {
1349   case 0x52:   return state->ioport("INPUTS")->read();
1347   case 0x52:   return ioport("INPUTS")->read();
13501348   case 0x61:
1351      if ( ! ( state->m_pm_reg[0x60] & 0x04 ) )
1349      if ( ! ( m_pm_reg[0x60] & 0x04 ) )
13521350      {
1353         data = ( data & ~ 0x04 ) | ( i2cmem_sda_read( device) ? 0x04 : 0x00 );
1351         data = ( data & ~ 0x04 ) | ( i2cmem_sda_read( machine().device("i2cmem")) ? 0x04 : 0x00 );
13541352      }
13551353
1356      if ( ! ( state->m_pm_reg[0x60] & 0x08 ) )
1354      if ( ! ( m_pm_reg[0x60] & 0x08 ) )
13571355      {
13581356         data &= ~0x08;
13591357      }
13601358      break;
1361   case 0x81:   return ( state->m_pm_reg[offset] & 0x0F ) | ( state->m_prc.frame_count << 4 );
1362   case 0x8A:   return state->m_prc.count;
1359   case 0x81:   return ( m_pm_reg[offset] & 0x0F ) | ( m_prc.frame_count << 4 );
1360   case 0x8A:   return m_prc.count;
13631361   }
13641362   return data;
13651363}
trunk/src/mess/machine/pk8020.c
r18257r18258
846846   }
847847}
848848
849static READ8_DEVICE_HANDLER(pk8020_porta_r)
849READ8_MEMBER(pk8020_state::pk8020_porta_r)
850850{
851   pk8020_state *state = space.machine().driver_data<pk8020_state>();
852   return 0xf0 | (state->m_takt <<1) | (state->m_text_attr)<<3;
851   return 0xf0 | (m_takt <<1) | (m_text_attr)<<3;
853852}
854853
855static WRITE8_DEVICE_HANDLER(pk8020_portc_w)
854WRITE8_MEMBER(pk8020_state::pk8020_portc_w)
856855{
857   pk8020_state *state = space.machine().driver_data<pk8020_state>();
858   state->m_video_page_access =(data>>6) & 3;
859   state->m_attr = (data >> 4) & 3;
860   state->m_wide = (data >> 3) & 1;
861   state->m_font = (data >> 2) & 1;
862   state->m_video_page = (data & 3);
856   m_video_page_access =(data>>6) & 3;
857   m_attr = (data >> 4) & 3;
858   m_wide = (data >> 3) & 1;
859   m_font = (data >> 2) & 1;
860   m_video_page = (data & 3);
863861
864862
865   state->m_portc_data = data;
863   m_portc_data = data;
866864}
867865
868static WRITE8_DEVICE_HANDLER(pk8020_portb_w)
866WRITE8_MEMBER(pk8020_state::pk8020_portb_w)
869867{
870   device_t *fdc = space.machine().device("wd1793");
868   device_t *fdc = machine().device("wd1793");
871869   // Turn all motors off
872   floppy_mon_w(floppy_get_device(space.machine(), 0), 1);
873   floppy_mon_w(floppy_get_device(space.machine(), 1), 1);
874   floppy_mon_w(floppy_get_device(space.machine(), 2), 1);
875   floppy_mon_w(floppy_get_device(space.machine(), 3), 1);
870   floppy_mon_w(floppy_get_device(machine(), 0), 1);
871   floppy_mon_w(floppy_get_device(machine(), 1), 1);
872   floppy_mon_w(floppy_get_device(machine(), 2), 1);
873   floppy_mon_w(floppy_get_device(machine(), 3), 1);
876874   wd17xx_set_side(fdc,BIT(data,4));
877875   if (BIT(data,0)) {
878876      wd17xx_set_drive(fdc,0);
879      floppy_mon_w(floppy_get_device(space.machine(), 0), 0);
880      floppy_drive_set_ready_state(floppy_get_device(space.machine(), 0), 1, 1);
877      floppy_mon_w(floppy_get_device(machine(), 0), 0);
878      floppy_drive_set_ready_state(floppy_get_device(machine(), 0), 1, 1);
881879   } else if (BIT(data,1)) {
882880      wd17xx_set_drive(fdc,1);
883      floppy_mon_w(floppy_get_device(space.machine(), 1), 0);
884      floppy_drive_set_ready_state(floppy_get_device(space.machine(), 1), 1, 1);
881      floppy_mon_w(floppy_get_device(machine(), 1), 0);
882      floppy_drive_set_ready_state(floppy_get_device(machine(), 1), 1, 1);
885883   } else if (BIT(data,2)) {
886884      wd17xx_set_drive(fdc,2);
887      floppy_mon_w(floppy_get_device(space.machine(), 2), 0);
888      floppy_drive_set_ready_state(floppy_get_device(space.machine(), 2), 1, 1);
885      floppy_mon_w(floppy_get_device(machine(), 2), 0);
886      floppy_drive_set_ready_state(floppy_get_device(machine(), 2), 1, 1);
889887   } else if (BIT(data,3)) {
890888      wd17xx_set_drive(fdc,3);
891      floppy_mon_w(floppy_get_device(space.machine(), 3), 0);
892      floppy_drive_set_ready_state(floppy_get_device(space.machine(), 3), 1, 1);
889      floppy_mon_w(floppy_get_device(machine(), 3), 0);
890      floppy_drive_set_ready_state(floppy_get_device(machine(), 3), 1, 1);
893891   }
894892}
895893
896static READ8_DEVICE_HANDLER(pk8020_portc_r)
894READ8_MEMBER(pk8020_state::pk8020_portc_r)
897895{
898   pk8020_state *state = space.machine().driver_data<pk8020_state>();
899   return state->m_portc_data;
896   return m_portc_data;
900897}
901898
902899
903900I8255A_INTERFACE( pk8020_ppi8255_interface_1 )
904901{
905   DEVCB_HANDLER(pk8020_porta_r),
902   DEVCB_DRIVER_MEMBER(pk8020_state,pk8020_porta_r),
906903   DEVCB_NULL,
907904   DEVCB_NULL,
908   DEVCB_HANDLER(pk8020_portb_w),
909   DEVCB_HANDLER(pk8020_portc_r),
910   DEVCB_HANDLER(pk8020_portc_w)
905   DEVCB_DRIVER_MEMBER(pk8020_state,pk8020_portb_w),
906   DEVCB_DRIVER_MEMBER(pk8020_state,pk8020_portc_r),
907   DEVCB_DRIVER_MEMBER(pk8020_state,pk8020_portc_w)
911908};
912909
913static WRITE8_DEVICE_HANDLER(pk8020_2_portc_w)
910WRITE8_MEMBER(pk8020_state::pk8020_2_portc_w)
914911{
915   pk8020_state *state = space.machine().driver_data<pk8020_state>();
916   device_t *speaker = space.machine().device(SPEAKER_TAG);
912   device_t *speaker = machine().device(SPEAKER_TAG);
917913
918   state->m_sound_gate = BIT(data,3);
914   m_sound_gate = BIT(data,3);
919915
920   speaker_level_w(speaker, state->m_sound_gate ? state->m_sound_level : 0);
916   speaker_level_w(speaker, m_sound_gate ? m_sound_level : 0);
921917}
922918
923919I8255A_INTERFACE( pk8020_ppi8255_interface_2 )
r18257r18258
927923   DEVCB_NULL,
928924   DEVCB_NULL,
929925   DEVCB_NULL,
930   DEVCB_HANDLER(pk8020_2_portc_w)
926   DEVCB_DRIVER_MEMBER(pk8020_state,pk8020_2_portc_w)
931927};
932928
933929I8255A_INTERFACE( pk8020_ppi8255_interface_3 )
r18257r18258
940936   DEVCB_NULL
941937};
942938
943static WRITE_LINE_DEVICE_HANDLER( pk8020_pit_out0 )
939WRITE_LINE_MEMBER(pk8020_state::pk8020_pit_out0)
944940{
945   pk8020_state *drvstate = device->machine().driver_data<pk8020_state>();
946   device_t *speaker = device->machine().device(SPEAKER_TAG);
941   device_t *speaker = machine().device(SPEAKER_TAG);
947942
948   drvstate->m_sound_level = state;
943   m_sound_level = state;
949944
950   speaker_level_w(speaker, drvstate->m_sound_gate ? drvstate->m_sound_level : 0);
945   speaker_level_w(speaker, m_sound_gate ? m_sound_level : 0);
951946}
952947
953948
954static WRITE_LINE_DEVICE_HANDLER(pk8020_pit_out1)
949WRITE_LINE_MEMBER(pk8020_state::pk8020_pit_out1)
955950{
956951}
957952
r18257r18258
962957      {
963958         XTAL_20MHz / 10,
964959         DEVCB_NULL,
965         DEVCB_LINE(pk8020_pit_out0)
960         DEVCB_DRIVER_LINE_MEMBER(pk8020_state,pk8020_pit_out0)
966961      },
967962      {
968963         XTAL_20MHz / 10,
969964         DEVCB_NULL,
970         DEVCB_LINE(pk8020_pit_out1)
965         DEVCB_DRIVER_LINE_MEMBER(pk8020_state,pk8020_pit_out1)
971966      },
972967      {
973968         (XTAL_20MHz / 8) / 164,
r18257r18258
977972   }
978973};
979974
980static WRITE_LINE_DEVICE_HANDLER( pk8020_pic_set_int_line )
975WRITE_LINE_MEMBER(pk8020_state::pk8020_pic_set_int_line)
981976{
982   device->machine().device("maincpu")->execute().set_input_line(0, state ? HOLD_LINE : CLEAR_LINE);
977   machine().device("maincpu")->execute().set_input_line(0, state ? HOLD_LINE : CLEAR_LINE);
983978}
984979
985980const struct pic8259_interface pk8020_pic8259_config =
986981{
987   DEVCB_LINE(pk8020_pic_set_int_line),
982   DEVCB_DRIVER_LINE_MEMBER(pk8020_state,pk8020_pic_set_int_line),
988983   DEVCB_LINE_VCC,
989984   DEVCB_NULL
990985};
trunk/src/mess/machine/mtx.c
r18257r18258
2727    mtx_strobe_r - centronics strobe
2828-------------------------------------------------*/
2929
30READ8_DEVICE_HANDLER( mtx_strobe_r )
30READ8_MEMBER(mtx_state::mtx_strobe_r)
3131{
32   centronics_device *centronics = space.machine().device<centronics_device>(CENTRONICS_TAG);
32   centronics_device *centronics = machine().device<centronics_device>(CENTRONICS_TAG);
3333   /* set STROBE low */
3434   centronics->strobe_w(FALSE);
3535
r18257r18258
117117READ8_MEMBER(mtx_state::mtx_sound_strobe_r)
118118{
119119   m_sn->write(space, 0, m_sound_latch);
120
121120   return 0xff;
122121}
123122
r18257r18258
134133    mtx_cst_w - cassette write
135134-------------------------------------------------*/
136135
137WRITE8_DEVICE_HANDLER( mtx_cst_w )
136WRITE8_MEMBER(mtx_state::mtx_cst_w)
138137{
139   dynamic_cast<cassette_image_device *>(device)->output( BIT(data, 0) ? -1 : 1);
138   dynamic_cast<cassette_image_device *>(machine().device(CASSETTE_TAG))->output( BIT(data, 0) ? -1 : 1);
140139}
141140
142141/*-------------------------------------------------
143142    mtx_prt_r - centronics status
144143-------------------------------------------------*/
145144
146READ8_DEVICE_HANDLER( mtx_prt_r )
145READ8_MEMBER(mtx_state::mtx_prt_r)
147146{
148   centronics_device *centronics = space.machine().device<centronics_device>(CENTRONICS_TAG);
147   centronics_device *centronics = machine().device<centronics_device>(CENTRONICS_TAG);
149148
150149   /*
151150
trunk/src/mess/machine/pp01.c
r18257r18258
156156}
157157
158158
159static WRITE_LINE_DEVICE_HANDLER( pp01_pit_out0 )
159WRITE_LINE_MEMBER(pp01_state::pp01_pit_out0)
160160{
161161}
162162
163static WRITE_LINE_DEVICE_HANDLER( pp01_pit_out1 )
163WRITE_LINE_MEMBER(pp01_state::pp01_pit_out1)
164164{
165165}
166166
r18257r18258
170170      {
171171         0,
172172         DEVCB_NULL,
173         DEVCB_DEVICE_LINE("pit8253", pp01_pit_out0)
173         DEVCB_DRIVER_LINE_MEMBER(pp01_state,pp01_pit_out0)
174174      },
175175      {
176176         2000000,
177177         DEVCB_NULL,
178         DEVCB_DEVICE_LINE("pit8253", pp01_pit_out1)
178         DEVCB_DRIVER_LINE_MEMBER(pp01_state,pp01_pit_out1)
179179      },
180180      {
181181         2000000,
r18257r18258
185185   }
186186};
187187
188static READ8_DEVICE_HANDLER (pp01_8255_porta_r )
188READ8_MEMBER(pp01_state::pp01_8255_porta_r)
189189{
190   pp01_state *state = space.machine().driver_data<pp01_state>();
191   return state->m_video_scroll;
190   return m_video_scroll;
192191}
193static WRITE8_DEVICE_HANDLER (pp01_8255_porta_w )
192WRITE8_MEMBER(pp01_state::pp01_8255_porta_w)
194193{
195   pp01_state *state = space.machine().driver_data<pp01_state>();
196   state->m_video_scroll = data;
194   m_video_scroll = data;
197195}
198196
199static READ8_DEVICE_HANDLER (pp01_8255_portb_r )
197READ8_MEMBER(pp01_state::pp01_8255_portb_r)
200198{
201   pp01_state *state = space.machine().driver_data<pp01_state>();
202199   static const char *const keynames[] = {
203200      "LINE0", "LINE1", "LINE2", "LINE3", "LINE4", "LINE5", "LINE6", "LINE7",
204201      "LINE8", "LINE9", "LINEA", "LINEB", "LINEC", "LINED", "LINEE", "LINEF"
205202   };
206203
207   return (space.machine().root_device().ioport(keynames[state->m_key_line])->read() & 0x3F) | (space.machine().root_device().ioport("LINEALL")->read() & 0xC0);
204   return (machine().root_device().ioport(keynames[m_key_line])->read() & 0x3F) | (machine().root_device().ioport("LINEALL")->read() & 0xC0);
208205}
209static WRITE8_DEVICE_HANDLER (pp01_8255_portb_w )
206WRITE8_MEMBER(pp01_state::pp01_8255_portb_w)
210207{
211208   //logerror("pp01_8255_portb_w %02x\n",data);
212209
213210}
214211
215static WRITE8_DEVICE_HANDLER (pp01_8255_portc_w )
212WRITE8_MEMBER(pp01_state::pp01_8255_portc_w)
216213{
217   pp01_state *state = space.machine().driver_data<pp01_state>();
218   state->m_key_line = data & 0x0f;
214   m_key_line = data & 0x0f;
219215}
220216
221static READ8_DEVICE_HANDLER (pp01_8255_portc_r )
217READ8_MEMBER(pp01_state::pp01_8255_portc_r)
222218{
223219   return 0xff;
224220}
r18257r18258
227223
228224I8255A_INTERFACE( pp01_ppi8255_interface )
229225{
230   DEVCB_DEVICE_HANDLER("ppi8255", pp01_8255_porta_r),
231   DEVCB_DEVICE_HANDLER("ppi8255", pp01_8255_porta_w),
232   DEVCB_DEVICE_HANDLER("ppi8255", pp01_8255_portb_r),
233   DEVCB_DEVICE_HANDLER("ppi8255", pp01_8255_portb_w),
234   DEVCB_DEVICE_HANDLER("ppi8255", pp01_8255_portc_r),
235   DEVCB_DEVICE_HANDLER("ppi8255", pp01_8255_portc_w)
226   DEVCB_DRIVER_MEMBER(pp01_state,pp01_8255_porta_r),
227   DEVCB_DRIVER_MEMBER(pp01_state,pp01_8255_porta_w),
228   DEVCB_DRIVER_MEMBER(pp01_state,pp01_8255_portb_r),
229   DEVCB_DRIVER_MEMBER(pp01_state,pp01_8255_portb_w),
230   DEVCB_DRIVER_MEMBER(pp01_state,pp01_8255_portc_r),
231   DEVCB_DRIVER_MEMBER(pp01_state,pp01_8255_portc_w)
236232};
237233
trunk/src/mess/machine/apple3.c
r18257r18258
467467
468468
469469/* these are here to appease the Apple /// confidence tests */
470static READ8_DEVICE_HANDLER(apple3_via_1_in_a) { return ~0; }
471static READ8_DEVICE_HANDLER(apple3_via_1_in_b) { return ~0; }
470READ8_MEMBER(apple3_state::apple3_via_1_in_a){ return ~0; }
471READ8_MEMBER(apple3_state::apple3_via_1_in_b){ return ~0; }
472472
473static WRITE8_DEVICE_HANDLER(apple3_via_0_out_a)
473WRITE8_MEMBER(apple3_state::apple3_via_0_out_a)
474474{
475   apple3_state *state = space.machine().driver_data<apple3_state>();
476   apple3_via_out(space.machine(), &state->m_via_0_a, data);
475   apple3_via_out(machine(), &m_via_0_a, data);
477476}
478477
479static WRITE8_DEVICE_HANDLER(apple3_via_0_out_b)
478WRITE8_MEMBER(apple3_state::apple3_via_0_out_b)
480479{
481   apple3_state *state = space.machine().driver_data<apple3_state>();
482   apple3_via_out(space.machine(), &state->m_via_0_b, data);
480   apple3_via_out(machine(), &m_via_0_b, data);
483481}
484482
485static WRITE8_DEVICE_HANDLER(apple3_via_1_out_a)
483WRITE8_MEMBER(apple3_state::apple3_via_1_out_a)
486484{
487   apple3_state *state = space.machine().driver_data<apple3_state>();
488   apple3_via_out(space.machine(), &state->m_via_1_a, data);
485   apple3_via_out(machine(), &m_via_1_a, data);
489486}
490487
491static WRITE8_DEVICE_HANDLER(apple3_via_1_out_b)
488WRITE8_MEMBER(apple3_state::apple3_via_1_out_b)
492489{
493   apple3_state *state = space.machine().driver_data<apple3_state>();
494   apple3_via_out(space.machine(), &state->m_via_1_b, data);
490   apple3_via_out(machine(), &m_via_1_b, data);
495491}
496492
497493static void apple2_via_1_irq_func(device_t *device, int state)
r18257r18258
513509   DEVCB_NULL,               /* in_cb1_func */
514510   DEVCB_NULL,               /* in_ca2_func */
515511   DEVCB_NULL,               /* in_cb2_func */
516   DEVCB_HANDLER(apple3_via_0_out_a),      /* out_a_func */
517   DEVCB_HANDLER(apple3_via_0_out_b),      /* out_b_func */
512   DEVCB_DRIVER_MEMBER(apple3_state,apple3_via_0_out_a),      /* out_a_func */
513   DEVCB_DRIVER_MEMBER(apple3_state,apple3_via_0_out_b),      /* out_b_func */
518514   DEVCB_NULL,               /* out_ca1_func */
519515   DEVCB_NULL,               /* out_cb1_func */
520516   DEVCB_NULL,               /* out_ca2_func */
r18257r18258
524520
525521const via6522_interface apple3_via_1_intf =
526522{
527   DEVCB_HANDLER(apple3_via_1_in_a),      /* in_a_func */
528   DEVCB_HANDLER(apple3_via_1_in_b),      /* in_b_func */
523   DEVCB_DRIVER_MEMBER(apple3_state,apple3_via_1_in_a),      /* in_a_func */
524   DEVCB_DRIVER_MEMBER(apple3_state,apple3_via_1_in_b),      /* in_b_func */
529525   DEVCB_NULL,               /* in_ca1_func */
530526   DEVCB_NULL,               /* in_cb1_func */
531527   DEVCB_NULL,               /* in_ca2_func */
532528   DEVCB_NULL,               /* in_cb2_func */
533   DEVCB_HANDLER(apple3_via_1_out_a),      /* out_a_func */
534   DEVCB_HANDLER(apple3_via_1_out_b),      /* out_b_func */
529   DEVCB_DRIVER_MEMBER(apple3_state,apple3_via_1_out_a),      /* out_a_func */
530   DEVCB_DRIVER_MEMBER(apple3_state,apple3_via_1_out_b),      /* out_b_func */
535531   DEVCB_NULL,               /* out_ca1_func */
536532   DEVCB_NULL,               /* out_cb1_func */
537533   DEVCB_NULL,               /* out_ca2_func */
trunk/src/mess/machine/kramermc.c
r18257r18258
1212#include "includes/kramermc.h"
1313
1414
15static READ8_DEVICE_HANDLER (kramermc_port_a_r)
15READ8_MEMBER(kramermc_state::kramermc_port_a_r)
1616{
1717   return 0xff;
1818}
1919
20static READ8_DEVICE_HANDLER (kramermc_port_b_r)
20READ8_MEMBER(kramermc_state::kramermc_port_b_r)
2121{
22   kramermc_state *state = space.machine().driver_data<kramermc_state>();
2322   static const char *const keynames[] = { "LINE0", "LINE1", "LINE2", "LINE3", "LINE4", "LINE5", "LINE6", "LINE7" };
2423
25   return space.machine().root_device().ioport(keynames[state->m_key_row])->read();
24   return machine().root_device().ioport(keynames[m_key_row])->read();
2625}
2726
28static WRITE8_DEVICE_HANDLER (kramermc_port_a_w)
27WRITE8_MEMBER(kramermc_state::kramermc_port_a_w)
2928{
30   kramermc_state *state = space.machine().driver_data<kramermc_state>();
31   state->m_key_row = ((data >> 1) & 0x07);
29   m_key_row = ((data >> 1) & 0x07);
3230}
3331
3432Z80PIO_INTERFACE( kramermc_z80pio_intf )
3533{
3634   DEVCB_NULL,   /* callback when change interrupt status */
37   DEVCB_HANDLER(kramermc_port_a_r),
38   DEVCB_HANDLER(kramermc_port_a_w),
35   DEVCB_DRIVER_MEMBER(kramermc_state,kramermc_port_a_r),
36   DEVCB_DRIVER_MEMBER(kramermc_state,kramermc_port_a_w),
3937   DEVCB_NULL,
40   DEVCB_HANDLER(kramermc_port_b_r),
38   DEVCB_DRIVER_MEMBER(kramermc_state,kramermc_port_b_r),
4139   DEVCB_NULL,
4240   DEVCB_NULL
4341};
trunk/src/mess/includes/mz700.h
r18257r18258
8383   UINT32 screen_update_mz800(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
8484   TIMER_DEVICE_CALLBACK_MEMBER(ne556_cursor_callback);
8585   TIMER_DEVICE_CALLBACK_MEMBER(ne556_other_callback);
86   DECLARE_WRITE_LINE_MEMBER(pit_out0_changed);
87   DECLARE_WRITE_LINE_MEMBER(pit_irq_2);
88   DECLARE_READ8_MEMBER(pio_port_b_r);
89   DECLARE_READ8_MEMBER(pio_port_c_r);
90   DECLARE_WRITE8_MEMBER(pio_port_a_w);
91   DECLARE_WRITE8_MEMBER(pio_port_c_w);
92   DECLARE_READ8_MEMBER(mz800_z80pio_port_a_r);
93   DECLARE_WRITE8_MEMBER(mz800_z80pio_port_a_w);
8694};
8795
8896
trunk/src/mess/includes/bullet.h
r18257r18258
9494   int m_exrdy1;
9595   int m_exrdy2;
9696   TIMER_DEVICE_CALLBACK_MEMBER(ctc_tick);
97   DECLARE_WRITE_LINE_MEMBER(dart_rxtxca_w);
9798};
9899
99100class bulletf_state : public bullet_state
trunk/src/mess/includes/x1.h
r18257r18258
205205   TIMER_CALLBACK_MEMBER(x1_rtc_increment);
206206   TIMER_DEVICE_CALLBACK_MEMBER(x1_cmt_wind_timer);
207207   TIMER_DEVICE_CALLBACK_MEMBER(x1_keyboard_callback);
208   DECLARE_WRITE_LINE_MEMBER(fdc_drq_w);
208209};
209210
210211/*----------- defined in machine/x1.c -----------*/
trunk/src/mess/includes/pmd85.h
r18257r18258
4343   TIMER_CALLBACK_MEMBER(pmd85_cassette_timer_callback);
4444   TIMER_CALLBACK_MEMBER(pmd_reset);
4545   TIMER_CALLBACK_MEMBER(setup_machine_state);
46   DECLARE_READ8_MEMBER(pmd85_ppi_0_porta_r);
47   DECLARE_READ8_MEMBER(pmd85_ppi_0_portb_r);
48   DECLARE_READ8_MEMBER(pmd85_ppi_0_portc_r);
49   DECLARE_WRITE8_MEMBER(pmd85_ppi_0_porta_w);
50   DECLARE_WRITE8_MEMBER(pmd85_ppi_0_portb_w);
51   DECLARE_WRITE8_MEMBER(pmd85_ppi_0_portc_w);
52   DECLARE_READ8_MEMBER(mato_ppi_0_portb_r);
53   DECLARE_READ8_MEMBER(mato_ppi_0_portc_r);
54   DECLARE_WRITE8_MEMBER(mato_ppi_0_portc_w);
55   DECLARE_READ8_MEMBER(pmd85_ppi_1_porta_r);
56   DECLARE_READ8_MEMBER(pmd85_ppi_1_portb_r);
57   DECLARE_READ8_MEMBER(pmd85_ppi_1_portc_r);
58   DECLARE_WRITE8_MEMBER(pmd85_ppi_1_porta_w);
59   DECLARE_WRITE8_MEMBER(pmd85_ppi_1_portb_w);
60   DECLARE_WRITE8_MEMBER(pmd85_ppi_1_portc_w);
61   DECLARE_READ8_MEMBER(pmd85_ppi_2_porta_r);
62   DECLARE_READ8_MEMBER(pmd85_ppi_2_portb_r);
63   DECLARE_READ8_MEMBER(pmd85_ppi_2_portc_r);
64   DECLARE_WRITE8_MEMBER(pmd85_ppi_2_porta_w);
65   DECLARE_WRITE8_MEMBER(pmd85_ppi_2_portb_w);
66   DECLARE_WRITE8_MEMBER(pmd85_ppi_2_portc_w);
67   DECLARE_READ8_MEMBER(pmd85_ppi_3_porta_r);
68   DECLARE_READ8_MEMBER(pmd85_ppi_3_portb_r);
69   DECLARE_READ8_MEMBER(pmd85_ppi_3_portc_r);
70   DECLARE_WRITE8_MEMBER(pmd85_ppi_3_porta_w);
71   DECLARE_WRITE8_MEMBER(pmd85_ppi_3_portb_w);
72   DECLARE_WRITE8_MEMBER(pmd85_ppi_3_portc_w);
4673};
4774
4875
trunk/src/mess/includes/portfoli.h
r18257r18258
8888   TIMER_DEVICE_CALLBACK_MEMBER(keyboard_tick);
8989   TIMER_DEVICE_CALLBACK_MEMBER(system_tick);
9090   TIMER_DEVICE_CALLBACK_MEMBER(counter_tick);
91   DECLARE_READ8_MEMBER(hd61830_rd_r);
9192};
9293
9394#endif
trunk/src/mess/includes/poly88.h
r18257r18258
3939   TIMER_CALLBACK_MEMBER(keyboard_callback);
4040   TIMER_CALLBACK_MEMBER(poly88_cassette_timer_callback);
4141   TIMER_CALLBACK_MEMBER(setup_machine_state);
42   DECLARE_WRITE_LINE_MEMBER(poly88_usart_rxready);
4243};
4344
4445
trunk/src/mess/includes/mtx.h
r18257r18258
5252   /* timers */
5353   device_t *m_cassette_timer;
5454
55   DECLARE_READ8_MEMBER(mtx_sound_strobe_r);
5655   DECLARE_WRITE8_MEMBER(mtx_bankswitch_w);
5756   DECLARE_WRITE8_MEMBER(mtx_sound_latch_w);
5857   DECLARE_WRITE8_MEMBER(mtx_sense_w);
r18257r18258
6766   DECLARE_MACHINE_RESET(mtx512);
6867   TIMER_DEVICE_CALLBACK_MEMBER(ctc_tick);
6968   TIMER_DEVICE_CALLBACK_MEMBER(cassette_tick);
69   DECLARE_WRITE_LINE_MEMBER(ctc_trg1_w);
70   DECLARE_WRITE_LINE_MEMBER(ctc_trg2_w);
71   DECLARE_WRITE_LINE_MEMBER(mtx_tms9929a_interrupt);
72   DECLARE_READ8_MEMBER(mtx_strobe_r);
73   DECLARE_READ8_MEMBER(mtx_sound_strobe_r);
74   DECLARE_WRITE8_MEMBER(mtx_cst_w);
75   DECLARE_READ8_MEMBER(mtx_prt_r);
7076};
7177
7278/*----------- defined in machine/mtx.c -----------*/
7379
7480SNAPSHOT_LOAD( mtx );
7581
76/* Cassette */
77DECLARE_WRITE8_DEVICE_HANDLER( mtx_cst_w );
78
79/* Printer */
80DECLARE_READ8_DEVICE_HANDLER( mtx_strobe_r );
81DECLARE_READ8_DEVICE_HANDLER( mtx_prt_r );
82
83
8482#endif /* __MTX_H__ */
trunk/src/mess/includes/apple2.h
r18257r18258
243243   DECLARE_MACHINE_START(space84);
244244   UINT32 screen_update_apple2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
245245   TIMER_DEVICE_CALLBACK_MEMBER(apple2_interrupt);
246   DECLARE_WRITE8_MEMBER(a2bus_irq_w);
247   DECLARE_WRITE8_MEMBER(a2bus_nmi_w);
248   DECLARE_WRITE8_MEMBER(a2bus_inh_w);
246249};
247250
248251
trunk/src/mess/includes/super6.h
r18257r18258
7878   UINT8 m_bank0;
7979   UINT8 m_bank1;
8080   TIMER_DEVICE_CALLBACK_MEMBER(ctc_tick);
81   DECLARE_WRITE8_MEMBER(dummy_w);
8182};
8283
8384#endif
trunk/src/mess/includes/concept.h
r18257r18258
6969   DECLARE_READ8_MEMBER(concept_hdc_reg_r);
7070   DECLARE_WRITE8_MEMBER(concept_hdc_reg_w);
7171   DECLARE_READ8_MEMBER(concept_hdc_rom_r);   
72   DECLARE_READ8_MEMBER(via_in_a);
73   DECLARE_WRITE8_MEMBER(via_out_a);
74   DECLARE_READ8_MEMBER(via_in_b);
75   DECLARE_WRITE8_MEMBER(via_out_b);
76   DECLARE_WRITE8_MEMBER(via_out_cb2);
77   DECLARE_WRITE_LINE_MEMBER(concept_fdc_intrq_w);
78   DECLARE_WRITE_LINE_MEMBER(concept_fdc_drq_w);
7279};
7380
7481
trunk/src/mess/includes/svi318.h
r18257r18258
7575   DECLARE_MACHINE_RESET(svi328_806);
7676   DECLARE_VIDEO_START(svi328_806);
7777   DECLARE_MACHINE_START(svi318_ntsc);
78   DECLARE_WRITE_LINE_MEMBER(vdp_interrupt);
79   DECLARE_WRITE_LINE_MEMBER(svi318_ins8250_interrupt);
80   DECLARE_READ8_MEMBER(svi318_ppi_port_a_r);
81   DECLARE_READ8_MEMBER(svi318_ppi_port_b_r);
82   DECLARE_WRITE8_MEMBER(svi318_ppi_port_c_w);
83   DECLARE_WRITE_LINE_MEMBER(svi_fdc_intrq_w);
84   DECLARE_WRITE_LINE_MEMBER(svi_fdc_drq_w);
7885};
7986
8087
trunk/src/mess/includes/sms.h
r18257r18258
190190   TIMER_CALLBACK_MEMBER(lightgun_tick);
191191   TIMER_CALLBACK_MEMBER(lphaser_1_callback);
192192   TIMER_CALLBACK_MEMBER(lphaser_2_callback);
193   DECLARE_WRITE_LINE_MEMBER(sms_int_callback);
194   DECLARE_WRITE_LINE_MEMBER(sms_pause_callback);
195   DECLARE_WRITE_LINE_MEMBER(sms_store_int_callback);
193196};
194197
195198
196199/*----------- defined in machine/sms.c -----------*/
197200
198/* Function prototypes */
199
200WRITE_LINE_DEVICE_HANDLER( sms_pause_callback );
201WRITE_LINE_DEVICE_HANDLER( sms_store_int_callback );
202
203201DEVICE_START( sms_cart );
204202DEVICE_IMAGE_LOAD( sms_cart );
205203
trunk/src/mess/includes/adam.h
r18257r18258
127127   int m_wr1;
128128   int m_track;
129129   TIMER_DEVICE_CALLBACK_MEMBER(paddle_tick);
130   DECLARE_WRITE_LINE_MEMBER(adam_vdp_interrupt);
130131};
131132
132133#endif
trunk/src/mess/includes/mc80.h
r18257r18258
4545   UINT32 screen_update_mc8020(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
4646   UINT32 screen_update_mc8030(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
4747   TIMER_DEVICE_CALLBACK_MEMBER(mc8020_kbd);
48   DECLARE_WRITE_LINE_MEMBER(ctc_z2_w);
4849};
4950
5051
trunk/src/mess/includes/v1050.h
r18257r18258
162162   TIMER_DEVICE_CALLBACK_MEMBER(sasi_rst_tick);
163163   TIMER_DEVICE_CALLBACK_MEMBER(kb_8251_tick);
164164   TIMER_DEVICE_CALLBACK_MEMBER(sio_8251_tick);
165   DECLARE_WRITE_LINE_MEMBER(pic_int_w);
166   DECLARE_WRITE8_MEMBER(disp_ppi_pc_w);
167   DECLARE_WRITE8_MEMBER(m6502_ppi_pc_w);
168   DECLARE_WRITE8_MEMBER(misc_ppi_pb_w);
169   DECLARE_READ8_MEMBER(misc_ppi_pc_r);
165170};
166171
167172//----------- defined in video/v1050.c -----------
trunk/src/mess/includes/bw12.h
r18257r18258
9090   int m_motor0;
9191   int m_motor1;
9292   TIMER_DEVICE_CALLBACK_MEMBER(floppy_motor_off_tick);
93   DECLARE_WRITE_LINE_MEMBER(pit_out0_w);
9394};
9495
9596#endif
trunk/src/mess/includes/microtan.h
r18257r18258
5555   INTERRUPT_GEN_MEMBER(microtan_interrupt);
5656   TIMER_CALLBACK_MEMBER(microtan_read_cassette);
5757   TIMER_CALLBACK_MEMBER(microtan_pulse_nmi);
58   DECLARE_READ8_MEMBER(via_0_in_a);
59   DECLARE_READ8_MEMBER(via_0_in_b);
60   DECLARE_READ8_MEMBER(via_0_in_ca1);
61   DECLARE_READ8_MEMBER(via_0_in_cb1);
62   DECLARE_READ8_MEMBER(via_0_in_ca2);
63   DECLARE_READ8_MEMBER(via_0_in_cb2);
64   DECLARE_WRITE8_MEMBER(via_0_out_a);
65   DECLARE_WRITE8_MEMBER(via_0_out_b);
66   DECLARE_WRITE8_MEMBER(via_0_out_ca2);
67   DECLARE_WRITE8_MEMBER(via_0_out_cb2);
68   DECLARE_READ8_MEMBER(via_1_in_a);
69   DECLARE_READ8_MEMBER(via_1_in_b);
70   DECLARE_READ8_MEMBER(via_1_in_ca1);
71   DECLARE_READ8_MEMBER(via_1_in_cb1);
72   DECLARE_READ8_MEMBER(via_1_in_ca2);
73   DECLARE_READ8_MEMBER(via_1_in_cb2);
74   DECLARE_WRITE8_MEMBER(via_1_out_a);
75   DECLARE_WRITE8_MEMBER(via_1_out_b);
76   DECLARE_WRITE8_MEMBER(via_1_out_ca2);
77   DECLARE_WRITE8_MEMBER(via_1_out_cb2);
5878};
5979
6080
trunk/src/mess/includes/radio86.h
r18257r18258
4040   DECLARE_PALETTE_INIT(radio86);
4141   UINT32 screen_update_radio86(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
4242   TIMER_CALLBACK_MEMBER(radio86_reset);
43   DECLARE_READ8_MEMBER(radio86_8255_portb_r2);
44   DECLARE_READ8_MEMBER(radio86_8255_portc_r2);
45   DECLARE_WRITE8_MEMBER(radio86_8255_porta_w2);
46   DECLARE_WRITE8_MEMBER(radio86_8255_portc_w2);
47   DECLARE_READ8_MEMBER(rk7007_8255_portc_r);
48   DECLARE_WRITE_LINE_MEMBER(hrq_w);
49   DECLARE_READ8_MEMBER(radio86_romdisk_porta_r);
50   DECLARE_WRITE8_MEMBER(radio86_romdisk_portb_w);
51   DECLARE_WRITE8_MEMBER(radio86_romdisk_portc_w);
52   DECLARE_WRITE8_MEMBER(mikrosha_8255_font_page_w);
4353};
4454
4555
trunk/src/mess/includes/einstein.h
r18257r18258
8585   UINT32 screen_update_einstein2(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
8686   TIMER_DEVICE_CALLBACK_MEMBER(einstein_keyboard_timer_callback);
8787   TIMER_DEVICE_CALLBACK_MEMBER(einstein_ctc_trigger_callback);
88   DECLARE_WRITE_LINE_MEMBER(einstein_6845_de_changed);
89   DECLARE_WRITE8_MEMBER(einstein_drsel_w);
90   DECLARE_WRITE_LINE_MEMBER(einstein_serial_transmit_clock);
91   DECLARE_WRITE_LINE_MEMBER(einstein_serial_receive_clock);
8892};
8993
9094
trunk/src/mess/includes/pk8020.h
r18257r18258
4646   virtual void palette_init();
4747   UINT32 screen_update_pk8020(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
4848   INTERRUPT_GEN_MEMBER(pk8020_interrupt);
49   DECLARE_READ8_MEMBER(pk8020_porta_r);
50   DECLARE_WRITE8_MEMBER(pk8020_portc_w);
51   DECLARE_WRITE8_MEMBER(pk8020_portb_w);
52   DECLARE_READ8_MEMBER(pk8020_portc_r);
53   DECLARE_WRITE8_MEMBER(pk8020_2_portc_w);
54   DECLARE_WRITE_LINE_MEMBER(pk8020_pit_out0);
55   DECLARE_WRITE_LINE_MEMBER(pk8020_pit_out1);
56   DECLARE_WRITE_LINE_MEMBER(pk8020_pic_set_int_line);
4957};
5058
5159
trunk/src/mess/includes/orion.h
r18257r18258
6464   DECLARE_MACHINE_RESET(orionpro);
6565   UINT32 screen_update_orion128(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
6666   INTERRUPT_GEN_MEMBER(orionz80_interrupt);
67   DECLARE_READ8_MEMBER(orion_romdisk_porta_r);
68   DECLARE_WRITE8_MEMBER(orion_romdisk_portb_w);
69   DECLARE_WRITE8_MEMBER(orion_romdisk_portc_w);
6770};
6871
6972/*----------- defined in machine/orion.c -----------*/
trunk/src/mess/includes/ssystem3.h
r18257r18258
4848   virtual void video_start();
4949   virtual void palette_init();
5050   UINT32 screen_update_ssystem3(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
51   DECLARE_WRITE8_MEMBER(ssystem3_via_write_a);
52   DECLARE_READ8_MEMBER(ssystem3_via_read_a);
53   DECLARE_READ8_MEMBER(ssystem3_via_read_b);
54   DECLARE_WRITE8_MEMBER(ssystem3_via_write_b);
5155};
5256
5357
trunk/src/mess/includes/rmnimbus.h
r18257r18258
232232   TIMER_CALLBACK_MEMBER(dma_timer_callback);
233233   TIMER_CALLBACK_MEMBER(keyscan_callback);
234234   TIMER_CALLBACK_MEMBER(mouse_callback);
235   DECLARE_WRITE_LINE_MEMBER(sio_interrupt);
236   DECLARE_WRITE8_MEMBER(sio_dtr_w);
237   DECLARE_WRITE16_MEMBER(sio_serial_transmit);
238   DECLARE_READ16_MEMBER(sio_serial_receive);
239   DECLARE_WRITE_LINE_MEMBER(nimbus_fdc_intrq_w);
240   DECLARE_WRITE_LINE_MEMBER(nimbus_fdc_drq_w);
241   DECLARE_READ8_MEMBER(nimbus_via_read_portb);
242   DECLARE_WRITE8_MEMBER(nimbus_via_write_portb);
243   DECLARE_WRITE_LINE_MEMBER(nimbus_via_irq_w);
244   DECLARE_WRITE_LINE_MEMBER(nimbus_ack_w);
235245};
236246
237247
r18257r18258
435445
436446extern const via6522_interface nimbus_via;
437447
438WRITE_LINE_DEVICE_HANDLER(nimbus_ack_w);
439448
440
441449/*----------- defined in video/rmnimbus.c -----------*/
442450
443451
trunk/src/mess/includes/bebox.h
r18257r18258
4242   virtual void machine_start();
4343   virtual void machine_reset();
4444   TIMER_CALLBACK_MEMBER(bebox_get_devices);
45   DECLARE_WRITE_LINE_MEMBER(bebox_pic8259_master_set_int_line);
46   DECLARE_WRITE_LINE_MEMBER(bebox_pic8259_slave_set_int_line);
47   DECLARE_READ8_MEMBER(get_slave_ack);
48   DECLARE_WRITE_LINE_MEMBER(bebox_dma_hrq_changed);
49   DECLARE_READ8_MEMBER(bebox_dma8237_fdc_dack_r);
50   DECLARE_WRITE8_MEMBER(bebox_dma8237_fdc_dack_w);
51   DECLARE_WRITE_LINE_MEMBER(bebox_dma8237_out_eop);
52   DECLARE_WRITE_LINE_MEMBER(pc_dack0_w);
53   DECLARE_WRITE_LINE_MEMBER(pc_dack1_w);
54   DECLARE_WRITE_LINE_MEMBER(pc_dack2_w);
55   DECLARE_WRITE_LINE_MEMBER(pc_dack3_w);
56   DECLARE_WRITE_LINE_MEMBER(bebox_timer0_w);
4557};
4658
4759
trunk/src/mess/includes/a7800.h
r18257r18258
6767   DECLARE_PALETTE_INIT(a7800p);
6868   UINT32 screen_update_a7800(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
6969   TIMER_DEVICE_CALLBACK_MEMBER(a7800_interrupt);
70   DECLARE_READ8_MEMBER(riot_joystick_r);
71   DECLARE_READ8_MEMBER(riot_console_button_r);
72   DECLARE_WRITE8_MEMBER(riot_button_pullup_w);
7073};
7174
7275/*----------- defined in machine/a7800.c -----------*/
trunk/src/mess/includes/super80.h
r18257r18258
8989   TIMER_CALLBACK_MEMBER(super80_timer);
9090   TIMER_CALLBACK_MEMBER(super80_reset);
9191   TIMER_CALLBACK_MEMBER(super80_halfspeed);
92   DECLARE_READ8_MEMBER(pio_port_b_r);
9293};
9394
9495
trunk/src/mess/includes/pce.h
r18257r18258
149149   TIMER_CALLBACK_MEMBER(pce_cd_adpcm_fadein_callback);
150150   TIMER_CALLBACK_MEMBER(pce_cd_clear_ack);
151151   TIMER_CALLBACK_MEMBER(pce_cd_adpcm_dma_timer_callback);
152   DECLARE_WRITE_LINE_MEMBER(pce_irq_changed);
152153};
153154
154155
trunk/src/mess/includes/samcoupe.h
r18257r18258
8686   TIMER_CALLBACK_MEMBER(irq_off);
8787   TIMER_CALLBACK_MEMBER(samcoupe_mouse_reset);
8888   TIMER_CALLBACK_MEMBER(sam_video_update_callback);
89   DECLARE_READ8_MEMBER(samcoupe_lpt1_busy_r);
90   DECLARE_WRITE8_MEMBER(samcoupe_lpt1_strobe_w);
91   DECLARE_READ8_MEMBER(samcoupe_lpt2_busy_r);
92   DECLARE_WRITE8_MEMBER(samcoupe_lpt2_strobe_w);
93   DECLARE_READ8_MEMBER(samcoupe_rtc_r);
94   DECLARE_WRITE8_MEMBER(samcoupe_rtc_w);
8995};
9096
9197
trunk/src/mess/includes/ql.h
r18257r18258
133133   int      m_disk_io_base;
134134   UINT8   m_disk_io_byte;
135135   UINT8   m_printer_char;
136   DECLARE_READ_LINE_MEMBER(disk_io_dden_r);
137   DECLARE_WRITE_LINE_MEMBER(disk_io_intrq_w);
138   DECLARE_WRITE_LINE_MEMBER(disk_io_drq_w);
136139};
137140
138141#endif
trunk/src/mess/includes/c64_legacy.h
r18257r18258
9191   DECLARE_DRIVER_INIT( c64gs );
9292   DECLARE_DRIVER_INIT( sx64 );
9393   INTERRUPT_GEN_MEMBER(c64_frame_interrupt);
94   DECLARE_READ8_MEMBER(c64_cia0_port_a_r);
95   DECLARE_READ8_MEMBER(c64_cia0_port_b_r);
96   DECLARE_WRITE8_MEMBER(c64_cia0_port_b_w);
97   DECLARE_READ8_MEMBER(c64_cia1_port_a_r);
98   DECLARE_WRITE8_MEMBER(c64_cia1_port_a_w);
9499};
95100
96101
r18257r18258
98103
99104/* private area */
100105
101extern DECLARE_READ8_DEVICE_HANDLER(c64_m6510_port_read);
102extern DECLARE_WRITE8_DEVICE_HANDLER(c64_m6510_port_write);
103
104106DECLARE_READ8_HANDLER ( c64_colorram_read );
105107DECLARE_WRITE8_HANDLER ( c64_colorram_write );
106108
trunk/src/mess/includes/apple3.h
r18257r18258
6161   DECLARE_VIDEO_START(apple3);
6262   UINT32 screen_update_apple3(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
6363   INTERRUPT_GEN_MEMBER(apple3_interrupt);
64   DECLARE_READ8_MEMBER(apple3_via_1_in_a);
65   DECLARE_READ8_MEMBER(apple3_via_1_in_b);
66   DECLARE_WRITE8_MEMBER(apple3_via_0_out_a);
67   DECLARE_WRITE8_MEMBER(apple3_via_0_out_b);
68   DECLARE_WRITE8_MEMBER(apple3_via_1_out_a);
69   DECLARE_WRITE8_MEMBER(apple3_via_1_out_b);
6470};
6571
6672
trunk/src/mess/includes/bbc.h
r18257r18258
286286   INTERRUPT_GEN_MEMBER(bbcb_keyscan);
287287   INTERRUPT_GEN_MEMBER(bbcm_keyscan);
288288   TIMER_CALLBACK_MEMBER(bbc_tape_timer_cb);
289   DECLARE_WRITE_LINE_MEMBER(bbcb_ack_w);
290   DECLARE_WRITE_LINE_MEMBER(bbcb_acia6850_irq_w);
291   DECLARE_WRITE_LINE_MEMBER(econet_clk_w);
292   DECLARE_WRITE8_MEMBER(bbcb_via_system_write_porta);
293   DECLARE_WRITE8_MEMBER(bbcb_via_system_write_portb);
294   DECLARE_READ8_MEMBER(bbcb_via_system_read_porta);
295   DECLARE_READ8_MEMBER(bbcb_via_system_read_portb);
296   DECLARE_READ8_MEMBER(bbcb_via_system_read_ca1);
297   DECLARE_READ8_MEMBER(bbcb_via_system_read_cb1);
298   DECLARE_READ8_MEMBER(bbcb_via_system_read_ca2);
299   DECLARE_READ8_MEMBER(bbcb_via_system_read_cb2);
300   DECLARE_WRITE_LINE_MEMBER(bbcb_via_system_irq_w);
301   DECLARE_READ8_MEMBER(bbcb_via_user_read_portb);
302   DECLARE_WRITE8_MEMBER(bbcb_via_user_write_portb);
303   DECLARE_WRITE_LINE_MEMBER(bbcb_via_user_irq_w);
304   DECLARE_WRITE_LINE_MEMBER(bbc_wd177x_intrq_w);
305   DECLARE_WRITE_LINE_MEMBER(bbc_wd177x_drq_w);
306   DECLARE_WRITE_LINE_MEMBER(bbc_vsync);
289307};
290308
291309
trunk/src/mess/includes/lisa.h
r18257r18258
168168   TIMER_CALLBACK_MEMBER(handle_mouse);
169169   TIMER_CALLBACK_MEMBER(read_COPS_command);
170170   TIMER_CALLBACK_MEMBER(set_COPS_ready);
171   DECLARE_WRITE8_MEMBER(COPS_via_out_a);
172   DECLARE_WRITE8_MEMBER(COPS_via_out_ca2);
173   DECLARE_READ8_MEMBER(COPS_via_in_b);
174   DECLARE_WRITE8_MEMBER(COPS_via_out_b);
175   DECLARE_WRITE8_MEMBER(COPS_via_out_cb2);
176   DECLARE_READ8_MEMBER(parallel_via_in_b);
171177};
172178
173179
trunk/src/mess/includes/fm7.h
r18257r18258
246246   TIMER_CALLBACK_MEMBER(fm7_keyboard_poll);
247247   TIMER_CALLBACK_MEMBER(fm77av_alu_task_end);
248248   TIMER_CALLBACK_MEMBER(fm77av_vsync);
249   DECLARE_WRITE_LINE_MEMBER(fm7_fdc_intrq_w);
250   DECLARE_WRITE_LINE_MEMBER(fm7_fdc_drq_w);
251   DECLARE_READ8_MEMBER(fm77av_joy_1_r);
252   DECLARE_READ8_MEMBER(fm77av_joy_2_r);
249253};
250254
251255#endif /*FM7_H_*/
trunk/src/mess/includes/sym1.h
r18257r18258
4242   DECLARE_DRIVER_INIT(sym1);
4343   virtual void machine_reset();
4444   TIMER_CALLBACK_MEMBER(led_refresh);
45   DECLARE_WRITE_LINE_MEMBER(sym1_74145_output_0_w);
46   DECLARE_WRITE_LINE_MEMBER(sym1_74145_output_1_w);
47   DECLARE_WRITE_LINE_MEMBER(sym1_74145_output_2_w);
48   DECLARE_WRITE_LINE_MEMBER(sym1_74145_output_3_w);
49   DECLARE_WRITE_LINE_MEMBER(sym1_74145_output_4_w);
50   DECLARE_WRITE_LINE_MEMBER(sym1_74145_output_5_w);
51   DECLARE_READ8_MEMBER(sym1_riot_a_r);
52   DECLARE_READ8_MEMBER(sym1_riot_b_r);
53   DECLARE_WRITE8_MEMBER(sym1_riot_a_w);
54   DECLARE_WRITE8_MEMBER(sym1_riot_b_w);
55   DECLARE_READ8_MEMBER(sym1_via0_b_r);
56   DECLARE_WRITE8_MEMBER(sym1_via0_b_w);
57   DECLARE_WRITE8_MEMBER(sym1_via2_a_w);
4558};
4659
4760/*----------- defined in machine/sym1.c -----------*/
trunk/src/mess/includes/macpci.h
r18257r18258
159159   emu_timer *m_scanline_timer;
160160   UINT32 screen_update_pippin(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
161161   TIMER_CALLBACK_MEMBER(mac_6015_tick);
162   DECLARE_READ8_MEMBER(mac_via_in_a);
163   DECLARE_READ8_MEMBER(mac_via_in_b);
164   DECLARE_WRITE8_MEMBER(mac_via_out_a);
165   DECLARE_WRITE8_MEMBER(mac_via_out_b);
166   DECLARE_READ8_MEMBER(mac_adb_via_in_cb2);
167   DECLARE_WRITE8_MEMBER(mac_adb_via_out_cb2);
162168};
163169
164170#endif /* PCIMAC_H_ */
trunk/src/mess/includes/xerox820.h
r18257r18258
8585   TIMER_CALLBACK_MEMBER(bigboard_beepoff);
8686   TIMER_DEVICE_CALLBACK_MEMBER(xerox820_keyboard_tick);
8787   TIMER_DEVICE_CALLBACK_MEMBER(ctc_tick);
88   DECLARE_WRITE_LINE_MEMBER(ctc_z0_w);
89   DECLARE_WRITE_LINE_MEMBER(ctc_z2_w);
8890};
8991
9092class xerox820ii_state : public xerox820_state
trunk/src/mess/includes/x68k.h
r18257r18258
285285   TIMER_CALLBACK_MEMBER(x68k_crtc_raster_end);
286286   TIMER_CALLBACK_MEMBER(x68k_crtc_raster_irq);
287287   TIMER_CALLBACK_MEMBER(x68k_crtc_vblank_irq);
288   DECLARE_READ8_MEMBER(ppi_port_a_r);
289   DECLARE_READ8_MEMBER(ppi_port_b_r);
290   DECLARE_READ8_MEMBER(ppi_port_c_r);
291   DECLARE_WRITE8_MEMBER(ppi_port_c_w);
292   DECLARE_WRITE_LINE_MEMBER(fdc_irq);
293   DECLARE_WRITE_LINE_MEMBER(fdc_drq);
294   DECLARE_WRITE8_MEMBER(x68k_ct_w);
295   DECLARE_WRITE_LINE_MEMBER(x68k_rtc_alarm_irq);
296   DECLARE_WRITE8_MEMBER(x68030_adpcm_w);
297   DECLARE_WRITE_LINE_MEMBER(mfp_irq_callback);
298   DECLARE_WRITE_LINE_MEMBER(x68k_scsi_irq);
299   DECLARE_WRITE_LINE_MEMBER(x68k_scsi_drq);
288300};
289301
290302
trunk/src/mess/includes/partner.h
r18257r18258
2626   DECLARE_DRIVER_INIT(partner);
2727   DECLARE_MACHINE_START(partner);
2828   DECLARE_MACHINE_RESET(partner);
29   DECLARE_WRITE_LINE_MEMBER(partner_wd17xx_drq_w);
30   DECLARE_WRITE_LINE_MEMBER(hrq_w);
2931};
3032
3133
trunk/src/mess/includes/trs80.h
r18257r18258
125125   INTERRUPT_GEN_MEMBER(trs80_rtc_interrupt);
126126   INTERRUPT_GEN_MEMBER(trs80_fdc_interrupt);
127127   TIMER_CALLBACK_MEMBER(cassette_data_callback);
128   DECLARE_WRITE_LINE_MEMBER(trs80_fdc_intrq_w);
128129};
129130
130131
trunk/src/mess/includes/lviv.h
r18257r18258
2828   virtual void palette_init();
2929   UINT32 screen_update_lviv(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
3030   TIMER_CALLBACK_MEMBER(lviv_reset);
31   DECLARE_READ8_MEMBER(lviv_ppi_0_porta_r);
32   DECLARE_READ8_MEMBER(lviv_ppi_0_portb_r);
33   DECLARE_READ8_MEMBER(lviv_ppi_0_portc_r);
34   DECLARE_WRITE8_MEMBER(lviv_ppi_0_porta_w);
35   DECLARE_WRITE8_MEMBER(lviv_ppi_0_portb_w);
36   DECLARE_WRITE8_MEMBER(lviv_ppi_0_portc_w);
37   DECLARE_READ8_MEMBER(lviv_ppi_1_porta_r);
38   DECLARE_READ8_MEMBER(lviv_ppi_1_portb_r);
39   DECLARE_READ8_MEMBER(lviv_ppi_1_portc_r);
40   DECLARE_WRITE8_MEMBER(lviv_ppi_1_porta_w);
41   DECLARE_WRITE8_MEMBER(lviv_ppi_1_portb_w);
42   DECLARE_WRITE8_MEMBER(lviv_ppi_1_portc_w);
3143};
3244
3345
trunk/src/mess/includes/xor100.h
r18257r18258
6666   int m_fdc_irq;
6767   int m_fdc_drq;
6868   int m_fdc_dden;
69   DECLARE_WRITE_LINE_MEMBER(com5016_fr_w);
70   DECLARE_WRITE_LINE_MEMBER(com5016_ft_w);
71   DECLARE_READ8_MEMBER(i8255_pc_r);
72   DECLARE_WRITE_LINE_MEMBER(ctc_z0_w);
73   DECLARE_WRITE_LINE_MEMBER(ctc_z1_w);
74   DECLARE_WRITE_LINE_MEMBER(ctc_z2_w);
75   DECLARE_WRITE8_MEMBER(xor100_kbd_put);
6976};
7077
7178#endif
trunk/src/mess/includes/oric.h
r18257r18258
110110   UINT32 screen_update_oric(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
111111   TIMER_CALLBACK_MEMBER(oric_refresh_tape);
112112   TIMER_CALLBACK_MEMBER(oric_vh_timer_callback);
113   DECLARE_READ8_MEMBER(oric_via_in_a_func);
114   DECLARE_READ8_MEMBER(oric_via_in_b_func);
115   DECLARE_WRITE8_MEMBER(oric_via_out_a_func);
116   DECLARE_WRITE8_MEMBER(oric_via_out_b_func);
117   DECLARE_READ8_MEMBER(oric_via_in_ca2_func);
118   DECLARE_READ8_MEMBER(oric_via_in_cb2_func);
119   DECLARE_WRITE8_MEMBER(oric_via_out_ca2_func);
120   DECLARE_WRITE8_MEMBER(oric_via_out_cb2_func);
121   DECLARE_WRITE_LINE_MEMBER(oric_jasmin_wd179x_drq_w);
122   DECLARE_WRITE_LINE_MEMBER(oric_microdisc_wd179x_intrq_w);
123   DECLARE_WRITE_LINE_MEMBER(oric_microdisc_wd179x_drq_w);
124   DECLARE_WRITE_LINE_MEMBER(oric_wd179x_intrq_w);
125   DECLARE_WRITE_LINE_MEMBER(oric_wd179x_drq_w);
126   DECLARE_READ8_MEMBER(telestrat_via2_in_a_func);
127   DECLARE_WRITE8_MEMBER(telestrat_via2_out_a_func);
128   DECLARE_READ8_MEMBER(telestrat_via2_in_b_func);
129   DECLARE_WRITE8_MEMBER(telestrat_via2_out_b_func);
113130};
114131
115132/*----------- defined in machine/oric.c -----------*/
trunk/src/mess/includes/fmtowns.h
r18257r18258
281281   TIMER_CALLBACK_MEMBER(towns_delay_cdda);
282282   TIMER_CALLBACK_MEMBER(towns_sprite_done);
283283   TIMER_CALLBACK_MEMBER(towns_vblank_end);
284   DECLARE_WRITE_LINE_MEMBER(towns_scsi_irq);
285   DECLARE_WRITE_LINE_MEMBER(towns_scsi_drq);
286   DECLARE_WRITE_LINE_MEMBER(towns_pic_irq);
287   DECLARE_WRITE_LINE_MEMBER(towns_pit_out0_changed);
288   DECLARE_WRITE_LINE_MEMBER(towns_pit_out1_changed);
289   DECLARE_READ8_MEMBER(get_slave_ack);
284290};
285291
286292class marty_state : public towns_state
trunk/src/mess/includes/c65.h
r18257r18258
6767   UINT32 screen_update_c65(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
6868   INTERRUPT_GEN_MEMBER(vic3_raster_irq);
6969   INTERRUPT_GEN_MEMBER(c65_frame_interrupt);
70   DECLARE_READ8_MEMBER(c65_cia0_port_a_r);
71   DECLARE_READ8_MEMBER(c65_cia0_port_b_r);
72   DECLARE_WRITE8_MEMBER(c65_cia0_port_b_w);
73   DECLARE_READ8_MEMBER(c65_cia1_port_a_r);
74   DECLARE_WRITE8_MEMBER(c65_cia1_port_a_w);
75   DECLARE_WRITE_LINE_MEMBER(c65_cia1_interrupt);
7076};
7177
7278
trunk/src/mess/includes/mac.h
r18257r18258
2828// model helpers
2929#define ADB_IS_BITBANG   ((mac->m_model == MODEL_MAC_SE || mac->m_model == MODEL_MAC_CLASSIC) || (mac->m_model >= MODEL_MAC_II && mac->m_model <= MODEL_MAC_IICI) || (mac->m_model == MODEL_MAC_SE30) || (mac->m_model == MODEL_MAC_QUADRA_700))
3030#define ADB_IS_BITBANG_CLASS   ((m_model == MODEL_MAC_SE || m_model == MODEL_MAC_CLASSIC) || (m_model >= MODEL_MAC_II && m_model <= MODEL_MAC_IICI) || (m_model == MODEL_MAC_SE30) || (m_model == MODEL_MAC_QUADRA_700))
31#define ADB_IS_EGRET   (mac->m_model >= MODEL_MAC_LC && mac->m_model <= MODEL_MAC_CLASSIC_II) || ((mac->m_model >= MODEL_MAC_IISI) && (mac->m_model <= MODEL_MAC_IIVI))
32#define ADB_IS_CUDA       ((mac->m_model >= MODEL_MAC_COLOR_CLASSIC && mac->m_model <= MODEL_MAC_LC_580) || ((mac->m_model >= MODEL_MAC_QUADRA_660AV) && (mac->m_model <= MODEL_MAC_QUADRA_630)) || (mac->m_model >= MODEL_MAC_POWERMAC_6100))
33#define ADB_IS_PM_VIA1   (mac->m_model >= MODEL_MAC_PORTABLE && mac->m_model <= MODEL_MAC_PB100)
34#define ADB_IS_PM_VIA2   (mac->m_model >= MODEL_MAC_PB140 && mac->m_model <= MODEL_MAC_PBDUO_270c)
31#define ADB_IS_EGRET   (m_model >= MODEL_MAC_LC && m_model <= MODEL_MAC_CLASSIC_II) || ((m_model >= MODEL_MAC_IISI) && (m_model <= MODEL_MAC_IIVI))
32#define ADB_IS_CUDA       ((m_model >= MODEL_MAC_COLOR_CLASSIC && m_model <= MODEL_MAC_LC_580) || ((m_model >= MODEL_MAC_QUADRA_660AV) && (m_model <= MODEL_MAC_QUADRA_630)) || (m_model >= MODEL_MAC_POWERMAC_6100))
33#define ADB_IS_PM_VIA1   (m_model >= MODEL_MAC_PORTABLE && m_model <= MODEL_MAC_PB100)
34#define ADB_IS_PM_VIA2   (m_model >= MODEL_MAC_PB140 && m_model <= MODEL_MAC_PBDUO_270c)
3535#define ADB_IS_PM_VIA1_CLASS   (m_model >= MODEL_MAC_PORTABLE && m_model <= MODEL_MAC_PB100)
3636#define ADB_IS_PM_VIA2_CLASS   (m_model >= MODEL_MAC_PB140 && m_model <= MODEL_MAC_PBDUO_270c)
3737#define ADB_IS_PM_CLASS   ((m_model >= MODEL_MAC_PORTABLE && m_model <= MODEL_MAC_PB100) || (m_model >= MODEL_MAC_PB140 && m_model <= MODEL_MAC_PBDUO_270c))
r18257r18258
529529   TIMER_CALLBACK_MEMBER(mac_scanline_tick);
530530   TIMER_CALLBACK_MEMBER(dafb_vbl_tick);
531531   TIMER_CALLBACK_MEMBER(dafb_cursor_tick);
532   DECLARE_WRITE8_MEMBER(mac_via_out_cb2);
533   DECLARE_READ8_MEMBER(mac_adb_via_in_cb2);
534   DECLARE_WRITE8_MEMBER(mac_adb_via_out_cb2);
535   DECLARE_READ8_MEMBER(mac_via_in_a);
536   DECLARE_READ8_MEMBER(mac_via_in_b);
537   DECLARE_WRITE8_MEMBER(mac_via_out_a);
538   DECLARE_WRITE8_MEMBER(mac_via_out_b);
539   DECLARE_READ8_MEMBER(mac_via2_in_a);
540   DECLARE_READ8_MEMBER(mac_via2_in_b);
541   DECLARE_WRITE8_MEMBER(mac_via2_out_a);
542   DECLARE_WRITE8_MEMBER(mac_via2_out_b);
532543};
533544
534545#endif /* MAC_H_ */
trunk/src/mess/includes/nascom1.h
r18257r18258
5050   virtual void machine_reset();
5151   UINT32 screen_update_nascom1(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
5252   UINT32 screen_update_nascom2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
53   DECLARE_WRITE_LINE_MEMBER(nascom2_fdc_intrq_w);
54   DECLARE_WRITE_LINE_MEMBER(nascom2_fdc_drq_w);
55   DECLARE_READ8_MEMBER(nascom1_hd6402_si);
56   DECLARE_WRITE8_MEMBER(nascom1_hd6402_so);
5357};
5458
5559
r18257r18258
6064DEVICE_IMAGE_LOAD( nascom1_cassette );
6165DEVICE_IMAGE_UNLOAD( nascom1_cassette );
6266SNAPSHOT_LOAD( nascom1 );
63
64DECLARE_READ8_DEVICE_HANDLER( nascom1_hd6402_si );
65DECLARE_WRITE8_DEVICE_HANDLER( nascom1_hd6402_so );
66
6767#endif /* NASCOM1_H_ */
trunk/src/mess/includes/pecom.h
r18257r18258
4141   DECLARE_VIDEO_START(pecom);
4242   DECLARE_INPUT_CHANGED_MEMBER(ef_w);
4343   TIMER_CALLBACK_MEMBER(reset_tick);
44   DECLARE_READ_LINE_MEMBER(clear_r);
45   DECLARE_READ_LINE_MEMBER(ef2_r);
46   DECLARE_WRITE_LINE_MEMBER(pecom64_q_w);
47   DECLARE_WRITE_LINE_MEMBER(pecom_prd_w);
4448};
4549
4650/*----------- defined in machine/pecom.c -----------*/
trunk/src/mess/includes/dgn_beta.h
r18257r18258
161161   DECLARE_WRITE8_MEMBER(dgnbeta_ram_bE_w);
162162   DECLARE_WRITE8_MEMBER(dgnbeta_ram_bF_w);
163163   DECLARE_WRITE8_MEMBER(dgnbeta_ram_bG_w);
164   DECLARE_READ8_MEMBER(d_pia0_pa_r);
165   DECLARE_WRITE8_MEMBER(d_pia0_pa_w);
166   DECLARE_READ8_MEMBER(d_pia0_pb_r);
167   DECLARE_WRITE8_MEMBER(d_pia0_pb_w);
168   DECLARE_WRITE8_MEMBER(d_pia0_cb2_w);
169   DECLARE_WRITE_LINE_MEMBER(d_pia0_irq_a);
170   DECLARE_WRITE_LINE_MEMBER(d_pia0_irq_b);
171   DECLARE_READ8_MEMBER(d_pia1_pa_r);
172   DECLARE_WRITE8_MEMBER(d_pia1_pa_w);
173   DECLARE_READ8_MEMBER(d_pia1_pb_r);
174   DECLARE_WRITE8_MEMBER(d_pia1_pb_w);
175   DECLARE_WRITE_LINE_MEMBER(d_pia1_irq_a);
176   DECLARE_WRITE_LINE_MEMBER(d_pia1_irq_b);
177   DECLARE_READ8_MEMBER(d_pia2_pa_r);
178   DECLARE_WRITE8_MEMBER(d_pia2_pa_w);
179   DECLARE_READ8_MEMBER(d_pia2_pb_r);
180   DECLARE_WRITE8_MEMBER(d_pia2_pb_w);
181   DECLARE_WRITE_LINE_MEMBER(d_pia2_irq_a);
182   DECLARE_WRITE_LINE_MEMBER(d_pia2_irq_b);
183   DECLARE_WRITE_LINE_MEMBER(dgnbeta_fdc_intrq_w);
184   DECLARE_WRITE_LINE_MEMBER(dgnbeta_fdc_drq_w);
185   DECLARE_WRITE_LINE_MEMBER(dgnbeta_vsync_changed);
164186};
165187
166188
trunk/src/mess/includes/ac1.h
r18257r18258
2222   virtual void video_start();
2323   UINT32 screen_update_ac1(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
2424   UINT32 screen_update_ac1_32(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
25   DECLARE_READ8_MEMBER(ac1_port_b_r);
26   DECLARE_READ8_MEMBER(ac1_port_a_r);
27   DECLARE_WRITE8_MEMBER(ac1_port_a_w);
28   DECLARE_WRITE8_MEMBER(ac1_port_b_w);
2529};
2630
2731
trunk/src/mess/includes/tsispch.h
r18257r18258
4343   DECLARE_READ16_MEMBER(dsp_status_r);
4444   DECLARE_WRITE16_MEMBER(dsp_status_w);
4545   DECLARE_DRIVER_INIT(prose2k);
46   DECLARE_WRITE_LINE_MEMBER(i8251_rxrdy_int);
47   DECLARE_WRITE_LINE_MEMBER(i8251_txempty_int);
48   DECLARE_WRITE_LINE_MEMBER(i8251_txrdy_int);
49   DECLARE_WRITE_LINE_MEMBER(pic8259_set_int_line);
4650};
4751
4852
trunk/src/mess/includes/apple2gs.h
r18257r18258
145145   TIMER_CALLBACK_MEMBER(apple2gs_clock_tick);
146146   TIMER_CALLBACK_MEMBER(apple2gs_qsecond_tick);
147147   TIMER_CALLBACK_MEMBER(apple2gs_scanline_tick);
148   DECLARE_WRITE8_MEMBER(a2bus_irq_w);
149   DECLARE_WRITE8_MEMBER(a2bus_nmi_w);
150   DECLARE_WRITE8_MEMBER(a2bus_inh_w);
148151};
149152
150153
trunk/src/mess/includes/nes.h
r18257r18258
126126   UINT32 screen_update_nes(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
127127   TIMER_CALLBACK_MEMBER(nes_irq_callback);
128128   TIMER_CALLBACK_MEMBER(lightgun_tick);
129   DECLARE_READ8_MEMBER(psg_4015_r);
130   DECLARE_WRITE8_MEMBER(psg_4015_w);
131   DECLARE_WRITE8_MEMBER(psg_4017_w);
129132};
130133
131134/*----------- defined in machine/nes.c -----------*/
trunk/src/mess/includes/pes.h
r18257r18258
3939   DECLARE_READ8_MEMBER(port1_r);
4040   DECLARE_READ8_MEMBER(port3_r);
4141   DECLARE_DRIVER_INIT(pes);
42   DECLARE_WRITE8_MEMBER(pes_kbd_input);
4243};
4344
4445
trunk/src/mess/includes/cgenie.h
r18257r18258
7474   INTERRUPT_GEN_MEMBER(cgenie_timer_interrupt);
7575   INTERRUPT_GEN_MEMBER(cgenie_frame_interrupt);
7676   TIMER_CALLBACK_MEMBER(handle_cassette_input);
77   DECLARE_WRITE_LINE_MEMBER(cgenie_fdc_intrq_w);
78   DECLARE_READ8_MEMBER(cgenie_sh_control_port_r);
79   DECLARE_WRITE8_MEMBER(cgenie_sh_control_port_w);
7780};
7881
7982
8083/*----------- defined in machine/cgenie.c -----------*/
8184
82DECLARE_READ8_DEVICE_HANDLER( cgenie_sh_control_port_r );
83DECLARE_WRITE8_DEVICE_HANDLER( cgenie_sh_control_port_w );
8485
8586extern const wd17xx_interface cgenie_wd17xx_interface;
8687
trunk/src/mess/includes/amstrad.h
r18257r18258
173173   TIMER_CALLBACK_MEMBER(amstrad_pc2_low);
174174   TIMER_CALLBACK_MEMBER(amstrad_video_update_timer);
175175   TIMER_CALLBACK_MEMBER(cb_set_resolution);
176   DECLARE_WRITE_LINE_MEMBER(aleste_interrupt);
177   DECLARE_WRITE_LINE_MEMBER(amstrad_hsync_changed);
178   DECLARE_WRITE_LINE_MEMBER(amstrad_plus_hsync_changed);
179   DECLARE_WRITE_LINE_MEMBER(amstrad_vsync_changed);
180   DECLARE_WRITE_LINE_MEMBER(amstrad_plus_vsync_changed);
181   DECLARE_WRITE_LINE_MEMBER(amstrad_de_changed);
182   DECLARE_WRITE_LINE_MEMBER(amstrad_plus_de_changed);
183   DECLARE_READ8_MEMBER(amstrad_ppi_porta_r);
184   DECLARE_WRITE8_MEMBER(amstrad_ppi_porta_w);
185   DECLARE_READ8_MEMBER(amstrad_ppi_portb_r);
186   DECLARE_WRITE8_MEMBER(amstrad_ppi_portc_w);
176187};
177188
178189
179190/*----------- defined in machine/amstrad.c -----------*/
180191
181192
182
183DECLARE_READ8_DEVICE_HANDLER( amstrad_ppi_porta_r );
184DECLARE_READ8_DEVICE_HANDLER( amstrad_ppi_portb_r );
185DECLARE_WRITE8_DEVICE_HANDLER( amstrad_ppi_porta_w );
186DECLARE_WRITE8_DEVICE_HANDLER( amstrad_ppi_portc_w );
187
188
189WRITE_LINE_DEVICE_HANDLER( aleste_interrupt );
190193WRITE_LINE_DEVICE_HANDLER( cpc_irq_w );
191194WRITE_LINE_DEVICE_HANDLER( cpc_nmi_w );
192195WRITE_LINE_DEVICE_HANDLER( cpc_romdis );
193196WRITE_LINE_DEVICE_HANDLER( cpc_romen );
194197
195
196
197
198
199
200
201
202
203
204
205
206198SNAPSHOT_LOAD( amstrad );
207199
208200DEVICE_IMAGE_LOAD(amstrad_plus_cartridge);
trunk/src/mess/includes/kyocera.h
r18257r18258
115115   int m_bell;            /* bell output */
116116
117117   DECLARE_PALETTE_INIT(kc85);
118   DECLARE_WRITE_LINE_MEMBER(kc85_sod_w);
119   DECLARE_READ_LINE_MEMBER(kc85_sid_r);
118120};
119121
120122class trsm100_state : public kc85_state
trunk/src/mess/includes/pc.h
r18257r18258
9191   TIMER_DEVICE_CALLBACK_MEMBER(pc_frame_interrupt);
9292   TIMER_DEVICE_CALLBACK_MEMBER(pc_vga_frame_interrupt);
9393   TIMER_DEVICE_CALLBACK_MEMBER(pcjr_frame_interrupt);
94   DECLARE_WRITE_LINE_MEMBER(pc_dma_hrq_changed);
95   DECLARE_READ8_MEMBER(pc_dma8237_fdc_dack_r);
96   DECLARE_READ8_MEMBER(pc_dma8237_hdc_dack_r);
97   DECLARE_WRITE8_MEMBER(pc_dma8237_fdc_dack_w);
98   DECLARE_WRITE8_MEMBER(pc_dma8237_hdc_dack_w);
99   DECLARE_WRITE8_MEMBER(pc_dma8237_0_dack_w);
100   DECLARE_WRITE_LINE_MEMBER(pc_dma8237_out_eop);
101   DECLARE_WRITE_LINE_MEMBER(pc_dack0_w);
102   DECLARE_WRITE_LINE_MEMBER(pc_dack1_w);
103   DECLARE_WRITE_LINE_MEMBER(pc_dack2_w);
104   DECLARE_WRITE_LINE_MEMBER(pc_dack3_w);
105   DECLARE_WRITE_LINE_MEMBER(pcjr_pic8259_set_int_line);
106   DECLARE_WRITE_LINE_MEMBER(ibm5150_pit8253_out1_changed);
107   DECLARE_WRITE_LINE_MEMBER(ibm5150_pit8253_out2_changed);
108   DECLARE_WRITE_LINE_MEMBER(pc_com_interrupt_1);
109   DECLARE_WRITE_LINE_MEMBER(pc_com_interrupt_2);
110   DECLARE_READ8_MEMBER(ibm5160_ppi_porta_r);
111   DECLARE_READ8_MEMBER(ibm5160_ppi_portc_r);
112   DECLARE_WRITE8_MEMBER(ibm5160_ppi_portb_w);
113   DECLARE_READ8_MEMBER(pc_ppi_porta_r);
114   DECLARE_WRITE8_MEMBER(pc_ppi_portb_w);
115   DECLARE_READ8_MEMBER(mc1502_ppi_porta_r);
116   DECLARE_WRITE8_MEMBER(mc1502_ppi_porta_w);
117   DECLARE_WRITE8_MEMBER(mc1502_ppi_portb_w);
118   DECLARE_READ8_MEMBER(mc1502_ppi_portc_r);
119   DECLARE_READ8_MEMBER(mc1502_kppi_porta_r);
120   DECLARE_WRITE8_MEMBER(mc1502_kppi_portb_w);
121   DECLARE_WRITE8_MEMBER(mc1502_kppi_portc_w);
122   DECLARE_WRITE8_MEMBER(pcjr_ppi_portb_w);
123   DECLARE_READ8_MEMBER(pcjr_ppi_porta_r);
124   DECLARE_READ8_MEMBER(pcjr_ppi_portc_r);
125   DECLARE_READ8_MEMBER(mc1502_wd17xx_aux_r);
126   DECLARE_WRITE8_MEMBER(mc1502_wd17xx_aux_w);
127   DECLARE_READ8_MEMBER(mc1502_wd17xx_drq_r);
128   DECLARE_READ8_MEMBER(mc1502_wd17xx_motor_r);
94129};
95130
96131/*----------- defined in machine/pc.c -----------*/
r18257r18258
117152void mess_init_pc_common( running_machine &machine, UINT32 flags, void (*set_keyb_int_func)(running_machine &, int), void (*set_hdc_int_func)(running_machine &,int,int));
118153
119154
120
121DECLARE_READ8_DEVICE_HANDLER( mc1502_wd17xx_drq_r );
122DECLARE_READ8_DEVICE_HANDLER( mc1502_wd17xx_aux_r );
123DECLARE_READ8_DEVICE_HANDLER( mc1502_wd17xx_motor_r );
124DECLARE_WRITE8_DEVICE_HANDLER( mc1502_wd17xx_aux_w );
125
126155DEVICE_IMAGE_LOAD( pcjr_cartridge );
127156
128157void pc_rtc_init(running_machine &machine);
trunk/src/mess/includes/z80ne.h
r18257r18258
108108   DECLARE_INPUT_CHANGED_MEMBER(z80ne_nmi);
109109   TIMER_CALLBACK_MEMBER(z80ne_cassette_tc);
110110   TIMER_CALLBACK_MEMBER(z80ne_kbd_scan);
111   DECLARE_READ8_MEMBER(lx388_mc6847_videoram_r);
112   DECLARE_WRITE8_MEMBER(lx390_motor_w);
113   DECLARE_READ8_MEMBER(lx390_reset_bank);
114   DECLARE_READ8_MEMBER(lx390_fdc_r);
115   DECLARE_WRITE8_MEMBER(lx390_fdc_w);
111116};
112117
113
114/*----------- defined in machine/z80ne.c -----------*/
115
116DECLARE_READ8_DEVICE_HANDLER(lx388_mc6847_videoram_r);
117DECLARE_READ8_DEVICE_HANDLER(lx390_fdc_r);
118DECLARE_WRITE8_DEVICE_HANDLER(lx390_fdc_w);
119DECLARE_READ8_DEVICE_HANDLER(lx390_reset_bank);
120DECLARE_WRITE8_DEVICE_HANDLER(lx390_motor_w);
121
122118#endif /* Z80NE_H_ */
trunk/src/mess/includes/kaypro.h
r18257r18258
8080   UINT32 screen_update_omni2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
8181   INTERRUPT_GEN_MEMBER(kay_kbd_interrupt);
8282   TIMER_CALLBACK_MEMBER(kaypro_timer_callback);
83   DECLARE_WRITE_LINE_MEMBER(kaypro_interrupt);
84   DECLARE_READ8_MEMBER(kaypro_sio_r);
85   DECLARE_WRITE8_MEMBER(kaypro_sio_w);
8386};
8487
8588
r18257r18258
100103extern const z80sio_interface kaypro_sio_intf;
101104extern const wd17xx_interface kaypro_wd1793_interface;
102105
103DECLARE_READ8_DEVICE_HANDLER( kaypro_sio_r );
104DECLARE_WRITE8_DEVICE_HANDLER( kaypro_sio_w );
105106
106
107107QUICKLOAD_LOAD( kayproii );
108108QUICKLOAD_LOAD( kaypro2x );
109109
trunk/src/mess/includes/msx.h
r18257r18258
126126   DECLARE_MACHINE_RESET(msx2);
127127   INTERRUPT_GEN_MEMBER(msx_interrupt);
128128   TIMER_DEVICE_CALLBACK_MEMBER(msx2_interrupt);
129   DECLARE_WRITE8_MEMBER(msx_ay8910_w);
130   DECLARE_WRITE8_MEMBER(msx_printer_strobe_w);
131   DECLARE_WRITE8_MEMBER(msx_printer_data_w);
132   DECLARE_READ8_MEMBER(msx_printer_status_r);
129133};
130134
131135
r18257r18258
141145void msx_vdp_interrupt(device_t *, v99x8_device &device, int i);
142146
143147/* I/O functions */
144DECLARE_READ8_DEVICE_HANDLER( msx_printer_status_r );
145DECLARE_WRITE8_DEVICE_HANDLER( msx_printer_strobe_w );
146DECLARE_WRITE8_DEVICE_HANDLER( msx_printer_data_w );
147148
148
149149#endif /* __MSX_H__ */
trunk/src/mess/includes/sg1000.h
r18257r18258
7373   /* TV Draw state */
7474   UINT8 m_tvdraw_data;
7575   TIMER_CALLBACK_MEMBER(lightgun_tick);
76   DECLARE_WRITE_LINE_MEMBER(sg1000_vdp_interrupt);
7677};
7778
7879class sc3000_state : public sg1000_state
r18257r18258
114115   DECLARE_READ8_MEMBER( ppi_pa_r );
115116   DECLARE_WRITE8_MEMBER( ppi_pc_w );
116117   DECLARE_WRITE_LINE_MEMBER( fdc_intrq_w );
118   DECLARE_WRITE_LINE_MEMBER(sf7000_fdc_index_callback);
117119
118120   /* floppy state */
119121   int m_fdc_irq;
trunk/src/mess/includes/pokemini.h
r18257r18258
7373   TIMER_CALLBACK_MEMBER(pokemini_timer3_callback);
7474   TIMER_CALLBACK_MEMBER(pokemini_timer3_hi_callback);
7575   TIMER_CALLBACK_MEMBER(pokemini_prc_counter_callback);
76   DECLARE_WRITE8_MEMBER(pokemini_hwreg_w);
77   DECLARE_READ8_MEMBER(pokemini_hwreg_r);
7678};
7779
7880
7981/*----------- defined in machine/pokemini.c -----------*/
80
81DECLARE_WRITE8_DEVICE_HANDLER( pokemini_hwreg_w );
82DECLARE_READ8_DEVICE_HANDLER( pokemini_hwreg_r );
83
8482DEVICE_IMAGE_LOAD( pokemini_cart );
8583
8684#endif /* POKEMINI_H */
trunk/src/mess/includes/b2m.h
r18257r18258
5050   virtual void palette_init();
5151   UINT32 screen_update_b2m(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
5252   INTERRUPT_GEN_MEMBER(b2m_vblank_interrupt);
53   DECLARE_WRITE_LINE_MEMBER(bm2_pit_out1);
54   DECLARE_WRITE8_MEMBER(b2m_8255_porta_w);
55   DECLARE_WRITE8_MEMBER(b2m_8255_portb_w);
56   DECLARE_WRITE8_MEMBER(b2m_8255_portc_w);
57   DECLARE_READ8_MEMBER(b2m_8255_portb_r);
58   DECLARE_WRITE8_MEMBER(b2m_ext_8255_portc_w);
59   DECLARE_READ8_MEMBER(b2m_romdisk_porta_r);
60   DECLARE_WRITE8_MEMBER(b2m_romdisk_portb_w);
61   DECLARE_WRITE8_MEMBER(b2m_romdisk_portc_w);
62   DECLARE_WRITE_LINE_MEMBER(b2m_pic_set_int_line);
5363};
5464
5565/*----------- defined in machine/b2m.c -----------*/
trunk/src/mess/includes/ace.h
r18257r18258
6060   UINT32 screen_update_ace(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
6161   TIMER_DEVICE_CALLBACK_MEMBER(set_irq);
6262   TIMER_DEVICE_CALLBACK_MEMBER(clear_irq);
63   DECLARE_READ8_MEMBER(pio_ad_r);
64   DECLARE_READ8_MEMBER(pio_bd_r);
65   DECLARE_READ8_MEMBER(pio_ac_r);
66   DECLARE_READ8_MEMBER(pio_bc_r);
67   DECLARE_WRITE8_MEMBER(pio_ad_w);
68   DECLARE_WRITE8_MEMBER(pio_bd_w);
69   DECLARE_WRITE8_MEMBER(pio_ac_w);
70   DECLARE_WRITE8_MEMBER(pio_bc_w);
71   DECLARE_READ8_MEMBER(sby_r);
72   DECLARE_WRITE8_MEMBER(ald_w);
6373};
6474
6575#endif /* ACE_H_ */
trunk/src/mess/includes/enterp.h
r18257r18258
3232   virtual void video_start();
3333   virtual void palette_init();
3434   UINT32 screen_update_epnick(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
35   DECLARE_WRITE8_MEMBER(enterprise_dave_reg_write);
36   DECLARE_READ8_MEMBER(enterprise_dave_reg_read);
37   DECLARE_WRITE_LINE_MEMBER(enterp_wd1770_intrq_w);
38   DECLARE_WRITE_LINE_MEMBER(enterp_wd1770_drq_w);
3539};
3640
3741
trunk/src/mess/includes/coleco.h
r18257r18258
4747   TIMER_CALLBACK_MEMBER(paddle_irqreset_callback);
4848   TIMER_CALLBACK_MEMBER(paddle_pulse_callback);
4949   TIMER_DEVICE_CALLBACK_MEMBER(paddle_update_callback);
50   DECLARE_WRITE_LINE_MEMBER(coleco_vdp_interrupt);
5051};
5152
5253#endif
trunk/src/mess/includes/ob68k1a.h
r18257r18258
4141   DECLARE_WRITE8_MEMBER( com8116_w );
4242   DECLARE_READ8_MEMBER( pia_r );
4343   DECLARE_WRITE8_MEMBER( pia_w );
44   DECLARE_WRITE_LINE_MEMBER(rx_tx_0_w);
45   DECLARE_WRITE_LINE_MEMBER(rx_tx_1_w);
4446};
4547
4648#endif
trunk/src/mess/includes/tandy2k.h
r18257r18258
136136   /* sound state */
137137   int m_outspkr;
138138   int m_spkrdata;
139   DECLARE_READ8_MEMBER(fldtc_r);
140   DECLARE_WRITE8_MEMBER(fldtc_w);
139141};
140142
141143#endif
trunk/src/mess/includes/irisha.h
r18257r18258
4848   virtual void video_start();
4949   UINT32 screen_update_irisha(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
5050   TIMER_CALLBACK_MEMBER(irisha_key);
51   DECLARE_WRITE_LINE_MEMBER(irisha_pic_set_int_line);
5152};
5253
5354
trunk/src/mess/includes/pp01.h
r18257r18258
3434   virtual void video_start();
3535   virtual void palette_init();
3636   UINT32 screen_update_pp01(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
37   DECLARE_WRITE_LINE_MEMBER(pp01_pit_out0);
38   DECLARE_WRITE_LINE_MEMBER(pp01_pit_out1);
39   DECLARE_READ8_MEMBER(pp01_8255_porta_r);
40   DECLARE_WRITE8_MEMBER(pp01_8255_porta_w);
41   DECLARE_READ8_MEMBER(pp01_8255_portb_r);
42   DECLARE_WRITE8_MEMBER(pp01_8255_portb_w);
43   DECLARE_WRITE8_MEMBER(pp01_8255_portc_w);
44   DECLARE_READ8_MEMBER(pp01_8255_portc_r);
3745};
3846
3947
trunk/src/mess/includes/m5.h
r18257r18258
7070   int m_obfa;
7171   DECLARE_DRIVER_INIT(pal);
7272   DECLARE_DRIVER_INIT(ntsc);
73   DECLARE_WRITE_LINE_MEMBER(sordm5_video_interrupt_callback);
7374};
7475
7576#endif
trunk/src/mess/includes/apple1.h
r18257r18258
5252   TIMER_CALLBACK_MEMBER(apple1_kbd_strobe_end);
5353   TIMER_CALLBACK_MEMBER(apple1_dsp_ready_start);
5454   TIMER_CALLBACK_MEMBER(apple1_dsp_ready_end);
55   DECLARE_READ8_MEMBER(apple1_pia0_kbdin);
56   DECLARE_WRITE8_MEMBER(apple1_pia0_dspout);
57   DECLARE_WRITE8_MEMBER(apple1_pia0_dsp_write_signal);
5558};
5659
5760
trunk/src/mess/includes/huebler.h
r18257r18258
5252   required_shared_ptr<UINT8> m_video_ram;
5353   const UINT8 *m_char_rom;
5454   TIMER_DEVICE_CALLBACK_MEMBER(keyboard_tick);
55   DECLARE_WRITE_LINE_MEMBER(ctc_z0_w);
56   DECLARE_WRITE_LINE_MEMBER(ctc_z2_w);
57   DECLARE_READ_LINE_MEMBER(cassette_r);
58   DECLARE_WRITE_LINE_MEMBER(cassette_w);
5559};
5660
5761#endif
trunk/src/mess/includes/pet.h
r18257r18258
6060   TIMER_CALLBACK_MEMBER(pet_interrupt);
6161   TIMER_CALLBACK_MEMBER(pet_tape1_timer);
6262   TIMER_CALLBACK_MEMBER(pet_tape2_timer);
63   DECLARE_READ8_MEMBER(pia0_pa_r);
64   DECLARE_WRITE8_MEMBER(pia0_pa_w);
65   DECLARE_READ8_MEMBER(kin_r);
66   DECLARE_READ8_MEMBER(petb_kin_r);
67   DECLARE_READ8_MEMBER(cass1_r);
68   DECLARE_WRITE8_MEMBER(cass1_motor_w);
69   DECLARE_WRITE_LINE_MEMBER(pia0_irq_w);
70   DECLARE_WRITE_LINE_MEMBER(pia1_irq_w);
71   DECLARE_READ8_MEMBER(via_pb_r);
72   DECLARE_READ_LINE_MEMBER(cass2_r);
73   DECLARE_WRITE8_MEMBER(via_pb_w);
74   DECLARE_WRITE_LINE_MEMBER(gb_w);
75   DECLARE_WRITE_LINE_MEMBER(via_irq_w);
76   DECLARE_WRITE_LINE_MEMBER(pet_display_enable_changed);
6377};
6478
6579/*----------- defined in video/pet.c -----------*/
r18257r18258
7185
7286MC6845_UPDATE_ROW( pet40_update_row );
7387MC6845_UPDATE_ROW( pet80_update_row );
74WRITE_LINE_DEVICE_HANDLER( pet_display_enable_changed );
7588
7689
7790/*----------- defined in machine/pet.c -----------*/
trunk/src/mess/includes/pcw.h
r18257r18258
106106   TIMER_CALLBACK_MEMBER(pcw_pins_callback);
107107   TIMER_CALLBACK_MEMBER(setup_beep);
108108   TIMER_DEVICE_CALLBACK_MEMBER(pcw_timer_interrupt);
109   DECLARE_WRITE_LINE_MEMBER(pcw_fdc_interrupt);
109110};
110111
111112#endif /* PCW_H_ */
trunk/src/mess/includes/osi.h
r18257r18258
6565   /* floppy state */
6666   int m_fdc_index;
6767   TIMER_CALLBACK_MEMBER(setup_beep);
68   DECLARE_WRITE_LINE_MEMBER(osi470_index_callback);
6869};
6970
7071class c1p_state : public sb2m600_state
trunk/src/mess/includes/nc.h
r18257r18258
8383   TIMER_CALLBACK_MEMBER(nc_keyboard_timer_callback);
8484   TIMER_CALLBACK_MEMBER(nc_serial_timer_callback);
8585   TIMER_DEVICE_CALLBACK_MEMBER(dummy_timer_callback);
86   DECLARE_WRITE_LINE_MEMBER(nc100_tc8521_alarm_callback);
87   DECLARE_WRITE_LINE_MEMBER(nc100_txrdy_callback);
88   DECLARE_WRITE_LINE_MEMBER(nc100_rxrdy_callback);
89   DECLARE_WRITE_LINE_MEMBER(nc100_centronics_ack_w);
90   DECLARE_WRITE_LINE_MEMBER(nc200_centronics_ack_w);
91   DECLARE_WRITE_LINE_MEMBER(nc200_txrdy_callback);
92   DECLARE_WRITE_LINE_MEMBER(nc200_rxrdy_callback);
93   DECLARE_WRITE_LINE_MEMBER(nc200_fdc_interrupt);
8694};
8795
8896
trunk/src/mess/includes/pcw16.h
r18257r18258
101101   TIMER_DEVICE_CALLBACK_MEMBER(pcw16_timer_callback);
102102   TIMER_DEVICE_CALLBACK_MEMBER(pcw16_keyboard_timer_callback);
103103   TIMER_DEVICE_CALLBACK_MEMBER(rtc_timer_callback);
104   DECLARE_WRITE_LINE_MEMBER(pcw16_com_interrupt_1);
105   DECLARE_WRITE_LINE_MEMBER(pcw16_com_interrupt_2);
106   DECLARE_WRITE_LINE_MEMBER(pcw16_com_tx_0);
107   DECLARE_WRITE_LINE_MEMBER(pcw16_com_dtr_0);
108   DECLARE_WRITE_LINE_MEMBER(pcw16_com_rts_0);
109   DECLARE_WRITE_LINE_MEMBER(pcw16_com_tx_1);
110   DECLARE_WRITE_LINE_MEMBER(pcw16_com_dtr_1);
111   DECLARE_WRITE_LINE_MEMBER(pcw16_com_rts_1);
104112};
105113
106114#endif /* PCW16_H_ */
trunk/src/mess/includes/kramermc.h
r18257r18258
2020   virtual void machine_reset();
2121   virtual void video_start();
2222   UINT32 screen_update_kramermc(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);   
23   DECLARE_READ8_MEMBER(kramermc_port_a_r);
24   DECLARE_READ8_MEMBER(kramermc_port_b_r);
25   DECLARE_WRITE8_MEMBER(kramermc_port_a_w);
2326};
2427
2528
trunk/src/mess/includes/victor9k.h
r18257r18258
125125   int m_se[2];                  /* stepper enable */
126126   int m_drive;                  /* selected drive */
127127   int m_side;                     /* selected side */
128   DECLARE_WRITE_LINE_MEMBER(mux_serial_b_w);
129   DECLARE_WRITE_LINE_MEMBER(mux_serial_a_w);
128130};
129131
130132#endif
trunk/src/mess/video/pecom.c
r18257r18258
7070   return BIT(pmd, 7);
7171}
7272
73static WRITE_LINE_DEVICE_HANDLER( pecom_prd_w )
73WRITE_LINE_MEMBER(pecom_state::pecom_prd_w)
7474{
75   pecom_state *driver_state = device->machine().driver_data<pecom_state>();
76
7775   // every other PRD triggers a DMAOUT request
78   if (driver_state->m_dma)
76   if (m_dma)
7977   {
80      device->machine().device(CDP1802_TAG)->execute().set_input_line(COSMAC_INPUT_LINE_DMAOUT, HOLD_LINE);
78      machine().device(CDP1802_TAG)->execute().set_input_line(COSMAC_INPUT_LINE_DMAOUT, HOLD_LINE);
8179   }
8280
83   driver_state->m_dma = !driver_state->m_dma;
81   m_dma = !m_dma;
8482}
8583
8684static CDP1869_INTERFACE( pecom_cdp1869_intf )
r18257r18258
9189   pecom_pcb_r,
9290   pecom_char_ram_r,
9391   pecom_char_ram_w,
94   DEVCB_LINE(pecom_prd_w)
92   DEVCB_DRIVER_LINE_MEMBER(pecom_state,pecom_prd_w)
9593};
9694
9795VIDEO_START_MEMBER(pecom_state,pecom)
trunk/src/mess/video/bbc.c
r18257r18258
276276   }
277277}
278278
279static WRITE_LINE_DEVICE_HANDLER( bbc_vsync )
279WRITE_LINE_MEMBER(bbc_state::bbc_vsync)
280280{
281   bbc_state *bstate = device->machine().driver_data<bbc_state>();
282   bstate->m_trom->dew_w(state);
281   m_trom->dew_w(state);
283282}
284283
285284
r18257r18258
293292   DEVCB_NULL,                  /* on_de_changed */
294293   DEVCB_NULL,                  /* on_cur_changed */
295294   DEVCB_NULL,                  /* on_hsync_changed */
296   DEVCB_LINE(bbc_vsync),         /* on_vsync_changed */
295   DEVCB_DRIVER_LINE_MEMBER(bbc_state,bbc_vsync),         /* on_vsync_changed */
297296   NULL
298297};
299298
trunk/src/mess/video/pet.c
r18257r18258
106106   }
107107}
108108
109WRITE_LINE_DEVICE_HANDLER( pet_display_enable_changed )
109WRITE_LINE_MEMBER(pet_state::pet_display_enable_changed)
110110{
111111}
112112
trunk/src/mess/video/dgn_beta.c
r18257r18258
240240
241241}
242242
243static WRITE_LINE_DEVICE_HANDLER( dgnbeta_vsync_changed )
243WRITE_LINE_MEMBER(dgn_beta_state::dgnbeta_vsync_changed)
244244{
245   dgn_beta_state *st = device->machine().driver_data<dgn_beta_state>();
246
247   st->m_beta_VSync=state;
248   if (!st->m_beta_VSync)
245   m_beta_VSync=state;
246   if (!m_beta_VSync)
249247   {
250      st->m_FlashCount++;
251      if(st->m_FlashCount==10)
248      m_FlashCount++;
249      if(m_FlashCount==10)
252250      {
253         st->m_FlashCount=0;         // Reset counter
254         st->m_FlashBit=(!st->m_FlashBit) & 0x01;   // Invert flash bit.
251         m_FlashCount=0;         // Reset counter
252         m_FlashBit=(!m_FlashBit) & 0x01;   // Invert flash bit.
255253      }
256254   }
257255
258   dgn_beta_frame_interrupt(device->machine(), state);
256   dgn_beta_frame_interrupt(machine(), state);
259257}
260258
261259const mc6845_interface dgnbeta_crtc6845_interface =
r18257r18258
268266   DEVCB_NULL,
269267   DEVCB_NULL,
270268   DEVCB_NULL,
271   DEVCB_LINE(dgnbeta_vsync_changed),
269   DEVCB_DRIVER_LINE_MEMBER(dgn_beta_state,dgnbeta_vsync_changed),
272270   NULL
273271};
274272
trunk/src/mess/drivers/bullet.c
r18257r18258
683683   m_ctc->trg2(0);
684684}
685685
686static WRITE_LINE_DEVICE_HANDLER( dart_rxtxca_w )
686WRITE_LINE_MEMBER(bullet_state::dart_rxtxca_w)
687687{
688   device_t *device = machine().device(Z80DART_TAG);
688689   z80dart_txca_w(device, state);
689690   z80dart_rxca_w(device, state);
690691}
r18257r18258
692693static Z80CTC_INTERFACE( ctc_intf )
693694{
694695   DEVCB_CPU_INPUT_LINE(Z80_TAG, INPUT_LINE_IRQ0),      // interrupt handler
695   DEVCB_DEVICE_LINE(Z80DART_TAG, dart_rxtxca_w),      // ZC/TO0 callback
696   DEVCB_DRIVER_LINE_MEMBER(bullet_state,dart_rxtxca_w),      // ZC/TO0 callback
696697   DEVCB_DEVICE_LINE(Z80DART_TAG, z80dart_rxtxcb_w),   // ZC/TO1 callback
697698   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF, z80ctc_device, trg3)                     // ZC/TO2 callback
698699};
trunk/src/mess/drivers/fm7.c
r18257r18258
396396 *  Main CPU: I/O ports 0xfd18 - 0xfd1f
397397 *  Floppy Disk Controller (MB8877A)
398398 */
399static WRITE_LINE_DEVICE_HANDLER( fm7_fdc_intrq_w )
399WRITE_LINE_MEMBER(fm7_state::fm7_fdc_intrq_w)
400400{
401   fm7_state *drvstate = device->machine().driver_data<fm7_state>();
402   drvstate->m_fdc_irq_flag = state;
401   m_fdc_irq_flag = state;
403402}
404403
405static WRITE_LINE_DEVICE_HANDLER( fm7_fdc_drq_w )
404WRITE_LINE_MEMBER(fm7_state::fm7_fdc_drq_w)
406405{
407   fm7_state *drvstate = device->machine().driver_data<fm7_state>();
408   drvstate->m_fdc_drq_flag = state;
406   m_fdc_drq_flag = state;
409407}
410408
411409READ8_MEMBER(fm7_state::fm7_fdc_r)
r18257r18258
940938   return ret;
941939}
942940
943static READ8_DEVICE_HANDLER( fm77av_joy_1_r )
941READ8_MEMBER(fm7_state::fm77av_joy_1_r)
944942{
945   return space.machine().root_device().ioport("joy1")->read();
943   return machine().root_device().ioport("joy1")->read();
946944}
947945
948static READ8_DEVICE_HANDLER( fm77av_joy_2_r )
946READ8_MEMBER(fm7_state::fm77av_joy_2_r)
949947{
950   return space.machine().root_device().ioport("joy2")->read();
948   return machine().root_device().ioport("joy2")->read();
951949}
952950
953951READ8_MEMBER(fm7_state::fm7_unknown_r)
r18257r18258
19711969static const wd17xx_interface fm7_mb8877a_interface =
19721970{
19731971   DEVCB_NULL,
1974   DEVCB_LINE(fm7_fdc_intrq_w),
1975   DEVCB_LINE(fm7_fdc_drq_w),
1972   DEVCB_DRIVER_LINE_MEMBER(fm7_state,fm7_fdc_intrq_w),
1973   DEVCB_DRIVER_LINE_MEMBER(fm7_state,fm7_fdc_drq_w),
19761974   {FLOPPY_0, FLOPPY_1, FLOPPY_2, FLOPPY_3}
19771975};
19781976
r18257r18258
19911989   {
19921990      AY8910_LEGACY_OUTPUT,
19931991      AY8910_DEFAULT_LOADS,
1994      DEVCB_HANDLER(fm77av_joy_1_r),
1995      DEVCB_HANDLER(fm77av_joy_2_r),
1992      DEVCB_DRIVER_MEMBER(fm7_state,fm77av_joy_1_r),
1993      DEVCB_DRIVER_MEMBER(fm7_state,fm77av_joy_2_r),
19961994      DEVCB_NULL,               /* portA write */
19971995      DEVCB_NULL               /* portB write */
19981996   },
trunk/src/mess/drivers/svi318.c
r18257r18258
260260   DEVCB_DRIVER_MEMBER(svi318_state, svi318_psg_port_b_w)
261261};
262262
263static WRITE_LINE_DEVICE_HANDLER(vdp_interrupt)
263WRITE_LINE_MEMBER(svi318_state::vdp_interrupt)
264264{
265    device->machine().device("maincpu")->execute().set_input_line(0, (state ? HOLD_LINE : CLEAR_LINE));
265    machine().device("maincpu")->execute().set_input_line(0, (state ? HOLD_LINE : CLEAR_LINE));
266266}
267267
268268static TMS9928A_INTERFACE(svi318_tms9928a_interface)
269269{
270270   "screen",
271271    0x4000,
272    DEVCB_LINE(vdp_interrupt)
272    DEVCB_DRIVER_LINE_MEMBER(svi318_state,vdp_interrupt)
273273};
274274
275275static const cassette_interface svi318_cassette_interface =
trunk/src/mess/drivers/pc.c
r18257r18258
157157   AM_RANGE(0x0040, 0x0043) AM_DEVREADWRITE_LEGACY("pit8253", pit8253_r, pit8253_w)
158158   AM_RANGE(0x0060, 0x0063) AM_DEVREADWRITE("ppi8255", i8255_device, read, write)
159159   AM_RANGE(0x0068, 0x006B) AM_DEVREADWRITE("ppi8255n2", i8255_device, read, write)   // keyboard poll
160   AM_RANGE(0x0100, 0x0100) AM_DEVREADWRITE_LEGACY("vg93", mc1502_wd17xx_aux_r, mc1502_wd17xx_aux_w)
161   AM_RANGE(0x0108, 0x0108) AM_DEVREAD_LEGACY("vg93", mc1502_wd17xx_drq_r)         // blocking read!
162   AM_RANGE(0x010a, 0x010a) AM_DEVREAD_LEGACY("vg93", mc1502_wd17xx_motor_r)
160   AM_RANGE(0x0100, 0x0100) AM_READWRITE(mc1502_wd17xx_aux_r, mc1502_wd17xx_aux_w)
161   AM_RANGE(0x0108, 0x0108) AM_READ(mc1502_wd17xx_drq_r)         // blocking read!
162   AM_RANGE(0x010a, 0x010a) AM_READ(mc1502_wd17xx_motor_r)
163163   AM_RANGE(0x010c, 0x010c) AM_DEVREADWRITE_LEGACY("vg93", wd17xx_status_r, wd17xx_command_w)
164164   AM_RANGE(0x010d, 0x010d) AM_DEVREADWRITE_LEGACY("vg93", wd17xx_track_r, wd17xx_track_w)
165165   AM_RANGE(0x010e, 0x010e) AM_DEVREADWRITE_LEGACY("vg93", wd17xx_sector_r, wd17xx_sector_w)
trunk/src/mess/drivers/victor9k.c
r18257r18258
123123
124124// Intel 8253 Interface
125125
126static WRITE_LINE_DEVICE_HANDLER( mux_serial_b_w )
126WRITE_LINE_MEMBER(victor9k_state::mux_serial_b_w)
127127{
128128}
129129
130static WRITE_LINE_DEVICE_HANDLER( mux_serial_a_w )
130WRITE_LINE_MEMBER(victor9k_state::mux_serial_a_w)
131131{
132132}
133133
r18257r18258
137137      {
138138         2500000,
139139         DEVCB_LINE_VCC,
140         DEVCB_LINE(mux_serial_b_w)
140         DEVCB_DRIVER_LINE_MEMBER(victor9k_state,mux_serial_b_w)
141141      }, {
142142         2500000,
143143         DEVCB_LINE_VCC,
144         DEVCB_LINE(mux_serial_a_w)
144         DEVCB_DRIVER_LINE_MEMBER(victor9k_state,mux_serial_a_w)
145145      }, {
146146         100000,
147147         DEVCB_LINE_VCC,
trunk/src/mess/drivers/nes.c
r18257r18258
2121#include "formats/nes_dsk.h"
2222
2323
24static READ8_DEVICE_HANDLER( psg_4015_r )
24READ8_MEMBER(nes_state::psg_4015_r)
2525{
26   device_t *device = machine().device("nessound");
2627   return nes_psg_r(device, space, 0x15);
2728}
2829
29static WRITE8_DEVICE_HANDLER( psg_4015_w )
30WRITE8_MEMBER(nes_state::psg_4015_w)
3031{
32   device_t *device = machine().device("nessound");
3133   nes_psg_w(device, space, 0x15, data);
3234}
3335
34static WRITE8_DEVICE_HANDLER( psg_4017_w )
36WRITE8_MEMBER(nes_state::psg_4017_w)
3537{
38   device_t *device = machine().device("nessound");
3639   nes_psg_w(device, space, 0x17, data);
3740}
3841
r18257r18258
4649   AM_RANGE(0x2000, 0x3fff) AM_DEVREADWRITE("ppu", ppu2c0x_device, read, write)      /* PPU registers */
4750   AM_RANGE(0x4000, 0x4013) AM_DEVREADWRITE_LEGACY("nessound", nes_psg_r, nes_psg_w)      /* PSG primary registers */
4851   AM_RANGE(0x4014, 0x4014) AM_WRITE(nes_vh_sprite_dma_w)            /* stupid address space hole */
49   AM_RANGE(0x4015, 0x4015) AM_DEVREADWRITE_LEGACY("nessound", psg_4015_r, psg_4015_w)      /* PSG status / first control register */
52   AM_RANGE(0x4015, 0x4015) AM_READWRITE(psg_4015_r, psg_4015_w)      /* PSG status / first control register */
5053   AM_RANGE(0x4016, 0x4016) AM_READWRITE(nes_IN0_r, nes_IN0_w)         /* IN0 - input port 1 */
5154   AM_RANGE(0x4017, 0x4017) AM_READ(nes_IN1_r)                     /* IN1 - input port 2 */
52   AM_RANGE(0x4017, 0x4017) AM_DEVWRITE_LEGACY("nessound", psg_4017_w)      /* PSG second control register */
55   AM_RANGE(0x4017, 0x4017) AM_WRITE(psg_4017_w)      /* PSG second control register */
5356   AM_RANGE(0x4100, 0x5fff) AM_READWRITE(nes_low_mapper_r, nes_low_mapper_w)   /* Perform unholy acts on the machine */
5457ADDRESS_MAP_END
5558
trunk/src/mess/drivers/portfoli.c
r18257r18258
649649//  HD61830_INTERFACE( lcdc_intf )
650650//-------------------------------------------------
651651
652static READ8_DEVICE_HANDLER( hd61830_rd_r )
652READ8_MEMBER(portfolio_state::hd61830_rd_r)
653653{
654654   UINT16 address = ((offset & 0xff) << 3) | ((offset >> 12) & 0x07);
655   UINT8 data = space.machine().root_device().memregion(HD61830_TAG)->base()[address];
655   UINT8 data = machine().root_device().memregion(HD61830_TAG)->base()[address];
656656
657657   return data;
658658}
r18257r18258
660660static HD61830_INTERFACE( lcdc_intf )
661661{
662662   SCREEN_TAG,
663   DEVCB_HANDLER(hd61830_rd_r)
663   DEVCB_DRIVER_MEMBER(portfolio_state,hd61830_rd_r)
664664};
665665
666666//-------------------------------------------------
trunk/src/mess/drivers/msx.c
r18257r18258
341341ADDRESS_MAP_END
342342
343343
344static WRITE8_DEVICE_HANDLER( msx_ay8910_w )
344WRITE8_MEMBER(msx_state::msx_ay8910_w)
345345{
346   device_t *device = machine().device("ay8910");
346347   if ( offset & 1 )
347348      ay8910_data_w( device, space, offset, data );
348349   else
r18257r18258
355356   ADDRESS_MAP_GLOBAL_MASK(0xff)
356357   AM_RANGE( 0x77, 0x77) AM_WRITE(msx_90in1_w)
357358   AM_RANGE( 0x7c, 0x7d) AM_WRITE(msx_fmpac_w)
358   AM_RANGE( 0x90, 0x90) AM_DEVREADWRITE_LEGACY("centronics", msx_printer_status_r, msx_printer_strobe_w)
359   AM_RANGE( 0x91, 0x91) AM_DEVWRITE_LEGACY("centronics", msx_printer_data_w)
360   AM_RANGE( 0xa0, 0xa7) AM_DEVREADWRITE_LEGACY("ay8910", ay8910_r, msx_ay8910_w)
359   AM_RANGE( 0x90, 0x90) AM_READWRITE(msx_printer_status_r, msx_printer_strobe_w)
360   AM_RANGE( 0x91, 0x91) AM_WRITE(msx_printer_data_w)
361   AM_RANGE( 0xa0, 0xa7) AM_DEVREAD_LEGACY("ay8910", ay8910_r) AM_WRITE(msx_ay8910_w)
361362   AM_RANGE( 0xa8, 0xab) AM_DEVREADWRITE("ppi8255", i8255_device, read, write)
362363   AM_RANGE( 0x98, 0x98) AM_DEVREADWRITE("tms9928a", tms9928a_device, vram_read, vram_write)
363364   AM_RANGE( 0x99, 0x99) AM_DEVREADWRITE("tms9928a", tms9928a_device, register_read, register_write)
r18257r18258
370371   ADDRESS_MAP_GLOBAL_MASK(0xff)
371372   AM_RANGE( 0x77, 0x77) AM_WRITE(msx_90in1_w)
372373   AM_RANGE( 0x7c, 0x7d) AM_WRITE(msx_fmpac_w)
373   AM_RANGE( 0x90, 0x90) AM_DEVREADWRITE_LEGACY("centronics", msx_printer_status_r, msx_printer_strobe_w)
374   AM_RANGE( 0x91, 0x91) AM_DEVWRITE_LEGACY("centronics", msx_printer_data_w)
375   AM_RANGE( 0xa0, 0xa7) AM_DEVREADWRITE_LEGACY("ay8910", ay8910_r, msx_ay8910_w)
374   AM_RANGE( 0x90, 0x90) AM_READWRITE(msx_printer_status_r, msx_printer_strobe_w)
375   AM_RANGE( 0x91, 0x91) AM_WRITE(msx_printer_data_w)
376   AM_RANGE( 0xa0, 0xa7) AM_DEVREAD_LEGACY("ay8910", ay8910_r) AM_WRITE(msx_ay8910_w)
376377   AM_RANGE( 0xa8, 0xab) AM_DEVREADWRITE("ppi8255", i8255_device, read, write)
377378   AM_RANGE( 0x98, 0x9b) AM_DEVREADWRITE("v9938", v9938_device, read, write)
378379   AM_RANGE( 0xb4, 0xb4) AM_WRITE(msx_rtc_latch_w)
trunk/src/mess/drivers/x1.c
r18257r18258
10581058   {FLOPPY_0, FLOPPY_1, FLOPPY_2, FLOPPY_3}
10591059};
10601060
1061static WRITE_LINE_DEVICE_HANDLER( fdc_drq_w )
1061WRITE_LINE_MEMBER(x1_state::fdc_drq_w)
10621062{
1063   z80dma_rdy_w(device->machine().device("dma"), state ^ 1);
1063   z80dma_rdy_w(machine().device("dma"), state ^ 1);
10641064}
10651065
10661066static const wd17xx_interface x1turbo_mb8877a_interface =
10671067{
10681068   DEVCB_NULL,
10691069   DEVCB_NULL,
1070   DEVCB_DEVICE_LINE("fdc", fdc_drq_w),
1070   DEVCB_DRIVER_LINE_MEMBER(x1_state,fdc_drq_w),
10711071   {FLOPPY_0, FLOPPY_1, FLOPPY_2, FLOPPY_3}
10721072};
10731073
trunk/src/mess/drivers/rmnimbus.c
r18257r18258
9090
9191static const centronics_interface nimbus_centronics_config =
9292{
93   DEVCB_DEVICE_LINE(VIA_TAG,nimbus_ack_w),
93   DEVCB_DRIVER_LINE_MEMBER(rmnimbus_state, nimbus_ack_w),
9494   DEVCB_NULL,
9595   DEVCB_NULL
9696};
trunk/src/mess/drivers/cgenie.c
r18257r18258
6060
6161static ADDRESS_MAP_START (cgenie_io, AS_IO, 8, cgenie_state )
6262   ADDRESS_MAP_GLOBAL_MASK(0xff)
63   AM_RANGE(0xf8, 0xf8) AM_DEVREADWRITE_LEGACY("ay8910", cgenie_sh_control_port_r, cgenie_sh_control_port_w )
63   AM_RANGE(0xf8, 0xf8) AM_READWRITE(cgenie_sh_control_port_r, cgenie_sh_control_port_w )
6464   AM_RANGE(0xf9, 0xf9) AM_DEVREADWRITE_LEGACY("ay8910", ay8910_r, ay8910_data_w )
6565   AM_RANGE(0xfa, 0xfa) AM_READWRITE_LEGACY(cgenie_index_r, cgenie_index_w )
6666   AM_RANGE(0xfb, 0xfb) AM_READWRITE_LEGACY(cgenie_register_r, cgenie_register_w )
trunk/src/mess/drivers/fmtowns.c
r18257r18258
133133};
134134
135135
136static WRITE_LINE_DEVICE_HANDLER( towns_pic_irq );
137136
137
138138INLINE UINT8 byte_to_bcd(UINT8 val)
139139{
140140   return ((val / 10) << 4) | (val % 10);
r18257r18258
18921892   state->m_scsi->fmscsi_data_w(data & 0xff);
18931893}
18941894
1895static WRITE_LINE_DEVICE_HANDLER( towns_scsi_irq )
1895WRITE_LINE_MEMBER(towns_state::towns_scsi_irq)
18961896{
1897   towns_state* tstate = device->machine().driver_data<towns_state>();
1898   pic8259_ir0_w(tstate->m_pic_slave, state);
1897   pic8259_ir0_w(m_pic_slave, state);
18991898   if(IRQ_LOG)
19001899      logerror("PIC: IRQ8 (SCSI) set to %i\n",state);
19011900}
19021901
1903static WRITE_LINE_DEVICE_HANDLER( towns_scsi_drq )
1902WRITE_LINE_MEMBER(towns_state::towns_scsi_drq)
19041903{
1905   towns_state* tstate = device->machine().driver_data<towns_state>();
1906   upd71071_dmarq(tstate->m_dma_1,state,1);  // SCSI HDs use channel 1
1904   upd71071_dmarq(m_dma_1,state,1);  // SCSI HDs use channel 1
19071905}
19081906
19091907
r18257r18258
20022000   }
20032001}
20042002
2005static WRITE_LINE_DEVICE_HANDLER( towns_pic_irq )
2003WRITE_LINE_MEMBER(towns_state::towns_pic_irq)
20062004{
2007   device->machine().device("maincpu")->execute().set_input_line(0, state ? HOLD_LINE : CLEAR_LINE);
2005   machine().device("maincpu")->execute().set_input_line(0, state ? HOLD_LINE : CLEAR_LINE);
20082006//  logerror("PIC#1: set IRQ line to %i\n",interrupt);
20092007}
20102008
2011static WRITE_LINE_DEVICE_HANDLER( towns_pit_out0_changed )
2009WRITE_LINE_MEMBER(towns_state::towns_pit_out0_changed)
20122010{
2013   towns_state* tstate = device->machine().driver_data<towns_state>();
2014   device_t* dev = tstate->m_pic_master;
2011   device_t* dev = m_pic_master;
20152012
2016   if(tstate->m_towns_timer_mask & 0x01)
2013   if(m_towns_timer_mask & 0x01)
20172014   {
2018      tstate->m_timer0 = state;
2015      m_timer0 = state;
20192016      if(IRQ_LOG) logerror("PIC: IRQ0 (PIT Timer ch0) set to %i\n",state);
20202017   }
20212018   else
2022      tstate->m_timer0 = 0;
2019      m_timer0 = 0;
20232020
2024   pic8259_ir0_w(dev, tstate->m_timer0 || tstate->m_timer1);
2021   pic8259_ir0_w(dev, m_timer0 || m_timer1);
20252022}
20262023
2027static WRITE_LINE_DEVICE_HANDLER( towns_pit_out1_changed )
2024WRITE_LINE_MEMBER(towns_state::towns_pit_out1_changed)
20282025{
2029   towns_state* tstate = device->machine().driver_data<towns_state>();
2030   device_t* dev = tstate->m_pic_master;
2026   device_t* dev = m_pic_master;
20312027
2032   if(tstate->m_towns_timer_mask & 0x02)
2028   if(m_towns_timer_mask & 0x02)
20332029   {
2034      tstate->m_timer1 = state;
2030      m_timer1 = state;
20352031      if(IRQ_LOG) logerror("PIC: IRQ0 (PIT Timer ch1) set to %i\n",state);
20362032   }
20372033   else
2038      tstate->m_timer1 = 0;
2034      m_timer1 = 0;
20392035
2040   pic8259_ir0_w(dev, tstate->m_timer0 || tstate->m_timer1);
2036   pic8259_ir0_w(dev, m_timer0 || m_timer1);
20412037}
20422038
20432039WRITE_LINE_MEMBER( towns_state::pit_out2_changed )
r18257r18258
25152511      {
25162512         307200,
25172513         DEVCB_NULL,
2518         DEVCB_LINE(towns_pit_out0_changed)
2514         DEVCB_DRIVER_LINE_MEMBER(towns_state,towns_pit_out0_changed)
25192515      },
25202516      {
25212517         307200,
25222518         DEVCB_NULL,
2523         DEVCB_LINE(towns_pit_out1_changed)
2519         DEVCB_DRIVER_LINE_MEMBER(towns_state,towns_pit_out1_changed)
25242520      },
25252521      {
25262522         307200,
r18257r18258
25512547   }
25522548};
25532549
2554static READ8_DEVICE_HANDLER( get_slave_ack )
2550READ8_MEMBER(towns_state::get_slave_ack)
25552551{
2556   towns_state* state = space.machine().driver_data<towns_state>();
25572552   if (offset==7) { // IRQ = 7
2558      return pic8259_acknowledge(state->m_pic_slave);
2553      return pic8259_acknowledge(m_pic_slave);
25592554   }
25602555   return 0x00;
25612556}
25622557static const struct pic8259_interface towns_pic8259_master_config =
25632558{
2564   DEVCB_LINE(towns_pic_irq),
2559   DEVCB_DRIVER_LINE_MEMBER(towns_state,towns_pic_irq),
25652560   DEVCB_LINE_VCC,
2566   DEVCB_HANDLER(get_slave_ack)
2561   DEVCB_DRIVER_MEMBER(towns_state,get_slave_ack)
25672562};
25682563
25692564
r18257r18258
26242619
26252620static const FMSCSIinterface towns_scsi_config =
26262621{
2627   DEVCB_LINE(towns_scsi_irq),
2628   DEVCB_LINE(towns_scsi_drq)
2622   DEVCB_DRIVER_LINE_MEMBER(towns_state,towns_scsi_irq),
2623   DEVCB_DRIVER_LINE_MEMBER(towns_state,towns_scsi_drq)
26292624};
26302625
26312626static const gfx_layout fnt_chars_16x16 =
trunk/src/mess/drivers/xerox820.c
r18257r18258
557557   m_ctc->trg0(0);
558558}
559559
560static WRITE_LINE_DEVICE_HANDLER( ctc_z0_w )
560WRITE_LINE_MEMBER(xerox820_state::ctc_z0_w)
561561{
562//   device_t *device = machine().device(Z80CTC_TAG);
562563//  z80ctc_trg1_w(device, state);
563564}
564565
565static WRITE_LINE_DEVICE_HANDLER( ctc_z2_w )
566WRITE_LINE_MEMBER(xerox820_state::ctc_z2_w)
566567{
568//   device_t *device = machine().device(Z80CTC_TAG);
569
567570//  z80ctc_trg3_w(device, state);
568571}
569572
570573static Z80CTC_INTERFACE( ctc_intf )
571574{
572575   DEVCB_CPU_INPUT_LINE(Z80_TAG, INPUT_LINE_IRQ0),   /* interrupt handler */
573   DEVCB_DEVICE_LINE(Z80CTC_TAG, ctc_z0_w),      /* ZC/TO0 callback */
576   DEVCB_DRIVER_LINE_MEMBER(xerox820_state,ctc_z0_w),      /* ZC/TO0 callback */
574577   DEVCB_DEVICE_LINE_MEMBER(Z80CTC_TAG, z80ctc_device, trg2),   /* ZC/TO1 callback */
575   DEVCB_DEVICE_LINE(Z80CTC_TAG, ctc_z2_w)      /* ZC/TO2 callback */
578   DEVCB_DRIVER_LINE_MEMBER(xerox820_state,ctc_z2_w)      /* ZC/TO2 callback */
576579};
577580
578581/* Z80 Daisy Chain */
trunk/src/mess/drivers/nascom1.c
r18257r18258
257257   AY_3_1015,
258258   ( XTAL_16MHz / 16 ) / 256,
259259   ( XTAL_16MHz / 16 ) / 256,
260   DEVCB_HANDLER(nascom1_hd6402_si),
261   DEVCB_HANDLER(nascom1_hd6402_so),
260   DEVCB_DRIVER_MEMBER(nascom1_state, nascom1_hd6402_si),
261   DEVCB_DRIVER_MEMBER(nascom1_state, nascom1_hd6402_so),
262262   DEVCB_NULL
263263};
264264
trunk/src/mess/drivers/kaypro.c
r18257r18258
5050   ADDRESS_MAP_GLOBAL_MASK(0xff)
5151   ADDRESS_MAP_UNMAP_HIGH
5252   AM_RANGE(0x00, 0x03) AM_DEVWRITE("brg", com8116_device, stt_w)
53   AM_RANGE(0x04, 0x07) AM_DEVREADWRITE_LEGACY("z80sio", kaypro_sio_r, kaypro_sio_w)
53   AM_RANGE(0x04, 0x07) AM_READWRITE(kaypro_sio_r, kaypro_sio_w)
5454   AM_RANGE(0x08, 0x0b) AM_DEVREADWRITE("z80pio_g", z80pio_device, read_alt, write_alt)
5555   AM_RANGE(0x0c, 0x0f) AM_DEVWRITE("brg", com8116_device, str_w)
5656   AM_RANGE(0x10, 0x13) AM_DEVREADWRITE_LEGACY("wd1793", wd17xx_r, wd17xx_w)
r18257r18258
6161   ADDRESS_MAP_GLOBAL_MASK(0xff)
6262   ADDRESS_MAP_UNMAP_HIGH
6363   AM_RANGE(0x00, 0x03) AM_DEVWRITE("brg", com8116_device, str_w)
64   AM_RANGE(0x04, 0x07) AM_DEVREADWRITE_LEGACY("z80sio", kaypro_sio_r, kaypro_sio_w)
64   AM_RANGE(0x04, 0x07) AM_READWRITE(kaypro_sio_r, kaypro_sio_w)
6565   AM_RANGE(0x08, 0x0b) AM_DEVWRITE("brg", com8116_device, stt_w)
6666   AM_RANGE(0x0c, 0x0f) AM_DEVREADWRITE("z80sio_2x", z80sio_device, read, write)
6767   AM_RANGE(0x10, 0x13) AM_DEVREADWRITE_LEGACY("wd1793", wd17xx_r, wd17xx_w)
trunk/src/mess/drivers/mtx.c
r18257r18258
5656
5757static ADDRESS_MAP_START( mtx_io, AS_IO, 8, mtx_state )
5858   ADDRESS_MAP_GLOBAL_MASK(0xff)
59   AM_RANGE(0x00, 0x00) AM_DEVREAD_LEGACY(CENTRONICS_TAG, mtx_strobe_r) AM_WRITE(mtx_bankswitch_w)
59   AM_RANGE(0x00, 0x00) AM_READWRITE(mtx_strobe_r, mtx_bankswitch_w)
6060   AM_RANGE(0x01, 0x01) AM_DEVREADWRITE("tms9929a", tms9929a_device, vram_read, vram_write)
6161   AM_RANGE(0x02, 0x02) AM_DEVREADWRITE("tms9929a", tms9929a_device, register_read, register_write)
62   AM_RANGE(0x03, 0x03) AM_READ(mtx_sound_strobe_r) AM_DEVWRITE_LEGACY(CASSETTE_TAG, mtx_cst_w)
63   AM_RANGE(0x04, 0x04) AM_DEVREAD_LEGACY(CENTRONICS_TAG, mtx_prt_r)
62   AM_RANGE(0x03, 0x03) AM_READWRITE(mtx_sound_strobe_r, mtx_cst_w)
63   AM_RANGE(0x04, 0x04) AM_READ(mtx_prt_r)
6464   AM_RANGE(0x04, 0x04) AM_DEVWRITE(CENTRONICS_TAG, centronics_device, write)
6565   AM_RANGE(0x05, 0x05) AM_READWRITE(mtx_key_lo_r, mtx_sense_w)
6666   AM_RANGE(0x06, 0x06) AM_READWRITE(mtx_key_hi_r, mtx_sound_latch_w)
r18257r18258
218218   m_z80ctc->trg2(0);
219219}
220220
221static WRITE_LINE_DEVICE_HANDLER( ctc_trg1_w )
221WRITE_LINE_MEMBER(mtx_state::ctc_trg1_w)
222222{
223   mtx_state *driver_state = device->machine().driver_data<mtx_state>();
224
225   if (driver_state->m_z80dart != NULL)
223   if (m_z80dart != NULL)
226224   {
227      z80dart_rxca_w(driver_state->m_z80dart, state);
228      z80dart_txca_w(driver_state->m_z80dart, state);
225      z80dart_rxca_w(m_z80dart, state);
226      z80dart_txca_w(m_z80dart, state);
229227   }
230228}
231229
232static WRITE_LINE_DEVICE_HANDLER( ctc_trg2_w )
230WRITE_LINE_MEMBER(mtx_state::ctc_trg2_w)
233231{
234   mtx_state *driver_state = device->machine().driver_data<mtx_state>();
235
236   if (driver_state->m_z80dart != NULL)
232   if (m_z80dart != NULL)
237233   {
238      z80dart_rxtxcb_w(driver_state->m_z80dart, state);
234      z80dart_rxtxcb_w(m_z80dart, state);
239235   }
240236}
241237
r18257r18258
243239{
244240   DEVCB_CPU_INPUT_LINE(Z80_TAG, INPUT_LINE_IRQ0),
245241   DEVCB_NULL,
246   DEVCB_LINE(ctc_trg1_w),
247   DEVCB_LINE(ctc_trg2_w)
242   DEVCB_DRIVER_LINE_MEMBER(mtx_state,ctc_trg1_w),
243   DEVCB_DRIVER_LINE_MEMBER(mtx_state,ctc_trg2_w)
248244};
249245
250246/*-------------------------------------------------
r18257r18258
320316    mtx_tms9928a_interface
321317-------------------------------------------------*/
322318
323static WRITE_LINE_DEVICE_HANDLER(mtx_tms9929a_interrupt)
319WRITE_LINE_MEMBER(mtx_state::mtx_tms9929a_interrupt)
324320{
325    mtx_state *drv_state = device->machine().driver_data<mtx_state>();
326
327    drv_state->m_z80ctc->trg0(state ? 0 : 1);
321   m_z80ctc->trg0(state ? 0 : 1);
328322}
329323
330324static TMS9928A_INTERFACE(mtx_tms9928a_interface)
331325{
332326   "screen",
333327    0x4000,
334    DEVCB_LINE(mtx_tms9929a_interrupt)
328    DEVCB_DRIVER_LINE_MEMBER(mtx_state,mtx_tms9929a_interrupt)
335329};
336330
337331/*-------------------------------------------------
trunk/src/mess/drivers/amstrad.c
r18257r18258
126126   -----------------------------*/
127127static I8255_INTERFACE( amstrad_ppi8255_interface )
128128{
129   DEVCB_HANDLER(amstrad_ppi_porta_r),   /* port A read */
130   DEVCB_HANDLER(amstrad_ppi_porta_w),   /* port A write */
131   DEVCB_HANDLER(amstrad_ppi_portb_r),   /* port B read */
129   DEVCB_DRIVER_MEMBER(amstrad_state,amstrad_ppi_porta_r),   /* port A read */
130   DEVCB_DRIVER_MEMBER(amstrad_state,amstrad_ppi_porta_w),   /* port A write */
131   DEVCB_DRIVER_MEMBER(amstrad_state,amstrad_ppi_portb_r),   /* port B read */
132132   DEVCB_NULL,                     /* port B write */
133133   DEVCB_NULL,                     /* port C read */
134   DEVCB_HANDLER(amstrad_ppi_portc_w)   /* port C write */
134   DEVCB_DRIVER_MEMBER(amstrad_state,amstrad_ppi_portc_w)   /* port C write */
135135};
136136
137137
r18257r18258
148148/* Aleste uses an 8272A, with the interrupt flag visible on PPI port B */
149149static const upd765_interface aleste_8272_interface =
150150{
151   DEVCB_LINE(aleste_interrupt),
151   DEVCB_DRIVER_LINE_MEMBER(amstrad_state,aleste_interrupt),
152152   DEVCB_NULL,
153153   NULL,
154154   UPD765_RDY_PIN_CONNECTED,
trunk/src/mess/drivers/kyocera.c
r18257r18258
12691269   NULL
12701270};
12711271
1272static WRITE_LINE_DEVICE_HANDLER( kc85_sod_w )
1272WRITE_LINE_MEMBER(kc85_state::kc85_sod_w)
12731273{
1274   device_t *device = machine().device(CASSETTE_TAG);
12741275   dynamic_cast<cassette_image_device *>(device)->output(state ? +1.0 : -1.0);
12751276}
12761277
1277static READ_LINE_DEVICE_HANDLER( kc85_sid_r )
1278READ_LINE_MEMBER(kc85_state::kc85_sid_r)
12781279{
1280   device_t *device = machine().device(CASSETTE_TAG);
12791281   return dynamic_cast<cassette_image_device *>(device)->input() > 0.0;
12801282}
12811283
r18257r18258
12831285{
12841286   DEVCB_NULL,            /* STATUS changed callback */
12851287   DEVCB_NULL,            /* INTE changed callback */
1286   DEVCB_DEVICE_LINE(CASSETTE_TAG, kc85_sid_r),   /* SID changed callback (I8085A only) */
1287   DEVCB_DEVICE_LINE(CASSETTE_TAG, kc85_sod_w)   /* SOD changed callback (I8085A only) */
1288   DEVCB_DRIVER_LINE_MEMBER(kc85_state,kc85_sid_r),   /* SID changed callback (I8085A only) */
1289   DEVCB_DRIVER_LINE_MEMBER(kc85_state,kc85_sod_w)   /* SOD changed callback (I8085A only) */
12881290};
12891291
12901292TIMER_DEVICE_CALLBACK_MEMBER(tandy200_state::tandy200_tp_tick)
trunk/src/mess/drivers/enterp.c
r18257r18258
9898
9999
100100/* EP specific handling of dave register write */
101static WRITE8_DEVICE_HANDLER( enterprise_dave_reg_write )
101WRITE8_MEMBER(ep_state::enterprise_dave_reg_write)
102102{
103   ep_state *ep = space.machine().driver_data<ep_state>();
104
105103   switch (offset)
106104   {
107105   case 0x10:
108106   case 0x11:
109107   case 0x12:
110108   case 0x13:
111      enterprise_update_memory_page(space.machine().device("maincpu")->memory().space(AS_PROGRAM), offset - 0x0f, data);
109      enterprise_update_memory_page(machine().device("maincpu")->memory().space(AS_PROGRAM), offset - 0x0f, data);
112110      break;
113111
114112   case 0x15:
115      ep->keyboard_line = data & 15;
113      keyboard_line = data & 15;
116114      break;
117115   }
118116}
119117
120118
121static READ8_DEVICE_HANDLER( enterprise_dave_reg_read )
119READ8_MEMBER(ep_state::enterprise_dave_reg_read)
122120{
123121   static const char *const keynames[] =
124122   {
r18257r18258
126124      "LINE5", "LINE6", "LINE7", "LINE8", "LINE9"
127125   };
128126
129   ep_state *ep = space.machine().driver_data<ep_state>();
130
131127   switch (offset)
132128   {
133129      case 0x015:
134130         /* read keyboard line */
135         dave_set_reg(device, 0x015, space.machine().root_device().ioport(keynames[ep->keyboard_line])->read());
131         dave_set_reg(machine().device("custom"), 0x015, machine().root_device().ioport(keynames[keyboard_line])->read());
136132         break;
137133
138134      case 0x016:
139135      {
140136         int ExternalJoystickInputs;
141         int ExternalJoystickPortInput = space.machine().root_device().ioport("JOY1")->read();
137         int ExternalJoystickPortInput = machine().root_device().ioport("JOY1")->read();
142138
143         if (ep->keyboard_line <= 4)
139         if (keyboard_line <= 4)
144140         {
145            ExternalJoystickInputs = ExternalJoystickPortInput>>(4-(ep->keyboard_line));
141            ExternalJoystickInputs = ExternalJoystickPortInput>>(4-(keyboard_line));
146142         }
147143         else
148144         {
149145            ExternalJoystickInputs = 1;
150146         }
151147
152         dave_set_reg(device, 0x016, (0x0fe | (ExternalJoystickInputs & 0x01)));
148         dave_set_reg(machine().device("custom"), 0x016, (0x0fe | (ExternalJoystickInputs & 0x01)));
153149      }
154150      break;
155151
r18257r18258
164160whats going on. */
165161static const dave_interface enterprise_dave_interface =
166162{
167   DEVCB_HANDLER(enterprise_dave_reg_read),
168   DEVCB_HANDLER(enterprise_dave_reg_write),
163   DEVCB_DRIVER_MEMBER(ep_state,enterprise_dave_reg_read),
164   DEVCB_DRIVER_MEMBER(ep_state,enterprise_dave_reg_write),
169165   DEVCB_CPU_INPUT_LINE("maincpu", 0)
170166};
171167
r18257r18258
180176    FLOPPY/EXDOS
181177***************************************************************************/
182178
183static WRITE_LINE_DEVICE_HANDLER( enterp_wd1770_intrq_w )
179WRITE_LINE_MEMBER(ep_state::enterp_wd1770_intrq_w)
184180{
185   ep_state *ep = device->machine().driver_data<ep_state>();
186
187181   if (state)
188      ep->exdos_card_value |= 0x02;
182      exdos_card_value |= 0x02;
189183   else
190      ep->exdos_card_value &= ~0x02;
184      exdos_card_value &= ~0x02;
191185}
192186
193static WRITE_LINE_DEVICE_HANDLER( enterp_wd1770_drq_w )
187WRITE_LINE_MEMBER(ep_state::enterp_wd1770_drq_w)
194188{
195   ep_state *ep = device->machine().driver_data<ep_state>();
196
197189   if (state)
198      ep->exdos_card_value |= 0x80;
190      exdos_card_value |= 0x80;
199191   else
200      ep->exdos_card_value &= ~0x80;
192      exdos_card_value &= ~0x80;
201193}
202194
203195
r18257r18258
417409static const wd17xx_interface enterp_wd1770_interface =
418410{
419411   DEVCB_NULL,
420   DEVCB_LINE(enterp_wd1770_intrq_w),
421   DEVCB_LINE(enterp_wd1770_drq_w),
412   DEVCB_DRIVER_LINE_MEMBER(ep_state,enterp_wd1770_intrq_w),
413   DEVCB_DRIVER_LINE_MEMBER(ep_state,enterp_wd1770_drq_w),
422414   {FLOPPY_0, FLOPPY_1, FLOPPY_2, FLOPPY_3}
423415};
424416
trunk/src/mess/drivers/coleco.c
r18257r18258
165165
166166/* Interrupts */
167167
168static WRITE_LINE_DEVICE_HANDLER(coleco_vdp_interrupt)
168WRITE_LINE_MEMBER(coleco_state::coleco_vdp_interrupt)
169169{
170   coleco_state *drvstate = device->machine().driver_data<coleco_state>();
171
172170    // NMI on rising edge
173   if (state && !drvstate->m_last_nmi_state)
174      drvstate->m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE);
171   if (state && !m_last_nmi_state)
172      m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE);
175173
176   drvstate->m_last_nmi_state = state;
174   m_last_nmi_state = state;
177175}
178176
179177TIMER_CALLBACK_MEMBER(coleco_state::paddle_d7reset_callback)
r18257r18258
240238{
241239   "screen",
242240   0x4000,
243   DEVCB_LINE(coleco_vdp_interrupt)
241   DEVCB_DRIVER_LINE_MEMBER(coleco_state,coleco_vdp_interrupt)
244242};
245243
246244
trunk/src/mess/drivers/ql.c
r18257r18258
364364   }
365365}
366366
367static READ_LINE_DEVICE_HANDLER( disk_io_dden_r )
367READ_LINE_MEMBER(ql_state::disk_io_dden_r)
368368{
369   ql_state *state = device->machine().driver_data<ql_state>();
370
371   if(state->m_disk_type==DISK_TYPE_SANDY)
372      return ((state->m_disk_io_byte & SANDY_DDEN_MASK) >> SANDY_DDEN_SHIFT);
369   if(m_disk_type==DISK_TYPE_SANDY)
370      return ((m_disk_io_byte & SANDY_DDEN_MASK) >> SANDY_DDEN_SHIFT);
373371   else
374372      return 0;
375373}
376374
377static WRITE_LINE_DEVICE_HANDLER( disk_io_intrq_w )
375WRITE_LINE_MEMBER(ql_state::disk_io_intrq_w)
378376{
379377   //logerror("DiskIO:intrq = %d\n",state);
380378}
381379
382static WRITE_LINE_DEVICE_HANDLER( disk_io_drq_w )
380WRITE_LINE_MEMBER(ql_state::disk_io_drq_w)
383381{
384382   //logerror("DiskIO:drq = %d\n",state);
385383}
r18257r18258
846844
847845wd17xx_interface ql_wd17xx_interface =
848846{
849   DEVCB_LINE(disk_io_dden_r),
850   DEVCB_LINE(disk_io_intrq_w),
851   DEVCB_LINE(disk_io_drq_w),
847   DEVCB_DRIVER_LINE_MEMBER(ql_state,disk_io_dden_r),
848   DEVCB_DRIVER_LINE_MEMBER(ql_state,disk_io_intrq_w),
849   DEVCB_DRIVER_LINE_MEMBER(ql_state,disk_io_drq_w),
852850   {FLOPPY_0, FLOPPY_1, FLOPPY_2, FLOPPY_3}
853851};
854852
trunk/src/mess/drivers/pce.c
r18257r18258
501501}
502502
503503
504static WRITE_LINE_DEVICE_HANDLER( pce_irq_changed )
504WRITE_LINE_MEMBER(pce_state::pce_irq_changed)
505505{
506   device->machine().device("maincpu")->execute().set_input_line(0, state);
506   machine().device("maincpu")->execute().set_input_line(0, state);
507507}
508508
509509
510510static const huc6270_interface pce_huc6270_config =
511511{
512512   0x10000,
513   DEVCB_LINE(pce_irq_changed)
513   DEVCB_DRIVER_LINE_MEMBER(pce_state,pce_irq_changed)
514514};
515515
516516
r18257r18258
527527static const huc6270_interface sgx_huc6270_0_config =
528528{
529529   0x10000,
530   DEVCB_LINE(pce_irq_changed)
530   DEVCB_DRIVER_LINE_MEMBER(pce_state,pce_irq_changed)
531531};
532532
533533
534534static const huc6270_interface sgx_huc6270_1_config =
535535{
536536   0x10000,
537   DEVCB_LINE(pce_irq_changed)
537   DEVCB_DRIVER_LINE_MEMBER(pce_state,pce_irq_changed)
538538};
539539
540540
trunk/src/mess/drivers/ob68k1a.c
r18257r18258
251251//  COM8116_INTERFACE( dbrg_intf )
252252//-------------------------------------------------
253253
254static WRITE_LINE_DEVICE_HANDLER( rx_tx_w )
254WRITE_LINE_MEMBER(ob68k1a_state::rx_tx_0_w)
255255{
256   device_t *device = machine().device(MC6850_0_TAG);
256257   downcast<acia6850_device *>(device)->rx_clock_in();
257258   downcast<acia6850_device *>(device)->tx_clock_in();
258259}
259260
261WRITE_LINE_MEMBER(ob68k1a_state::rx_tx_1_w)
262{
263   device_t *device = machine().device(MC6850_1_TAG);
264   downcast<acia6850_device *>(device)->rx_clock_in();
265   downcast<acia6850_device *>(device)->tx_clock_in();
266}
267
260268static COM8116_INTERFACE( dbrg_intf )
261269{
262270   DEVCB_NULL,      /* fX/4 output */
263   DEVCB_DEVICE_LINE(MC6850_0_TAG, rx_tx_w),
264   DEVCB_DEVICE_LINE(MC6850_1_TAG, rx_tx_w),
271   DEVCB_DRIVER_LINE_MEMBER(ob68k1a_state,rx_tx_0_w),
272   DEVCB_DRIVER_LINE_MEMBER(ob68k1a_state,rx_tx_1_w),
265273   { 101376, 67584, 46080, 37686, 33792, 16896, 8448, 4224, 2816, 2534, 2112, 1408, 1056, 704, 528, 264 },         /* receiver divisor ROM */
266274   { 101376, 67584, 46080, 37686, 33792, 16896, 8448, 4224, 2816, 2534, 2112, 1408, 1056, 704, 528, 264 },         /* transmitter divisor ROM */
267275};
trunk/src/mess/drivers/bw12.c
r18257r18258
541541
542542/* PIT8253 Interface */
543543
544static WRITE_LINE_DEVICE_HANDLER( pit_out0_w )
544WRITE_LINE_MEMBER(bw12_state::pit_out0_w)
545545{
546   device_t *device = machine().device("DEVCB_DRIVER_LINE_MEMBER(Z80SIO_TAG, bw12_state,pit_out0_w)");
546547   z80dart_txca_w(device, state);
547548   z80dart_rxca_w(device, state);
548549}
r18257r18258
558559      {
559560         XTAL_1_8432MHz,
560561         DEVCB_NULL,
561         DEVCB_DEVICE_LINE(Z80SIO_TAG, pit_out0_w)
562         DEVCB_DRIVER_LINE_MEMBER(bw12_state,pit_out0_w)
562563      },
563564      {
564565         XTAL_1_8432MHz,
trunk/src/mess/drivers/pokemini.c
r18257r18258
1313static ADDRESS_MAP_START( pokemini_mem_map, AS_PROGRAM, 8, pokemini_state )
1414   AM_RANGE( 0x000000, 0x000FFF )  AM_ROM                     /* bios */
1515   AM_RANGE( 0x001000, 0x001FFF )   AM_RAM AM_SHARE("p_ram")            /* VRAM/RAM */
16   AM_RANGE( 0x002000, 0x0020FF )  AM_DEVREADWRITE_LEGACY("i2cmem", pokemini_hwreg_r, pokemini_hwreg_w )   /* hardware registers */
16   AM_RANGE( 0x002000, 0x0020FF )  AM_READWRITE(pokemini_hwreg_r, pokemini_hwreg_w )   /* hardware registers */
1717   AM_RANGE( 0x002100, 0x1FFFFF )  AM_ROM                     /* cartridge area */
1818ADDRESS_MAP_END
1919
trunk/src/mess/drivers/tandy2k.c
r18257r18258
195195   }
196196}
197197
198static READ8_DEVICE_HANDLER( fldtc_r )
198READ8_MEMBER(tandy2k_state::fldtc_r)
199199{
200   device_t *device = machine().device("AM_RANGE(0x00004, 0x00005) AM_READWRITE8(I8272A_TAG, fldtc_r, fldtc_w, 0x00ff)");
200201   upd765_tc_w(device, 1);
201202   upd765_tc_w(device, 0);
202203
203204   return 0;
204205}
205206
206static WRITE8_DEVICE_HANDLER( fldtc_w )
207WRITE8_MEMBER(tandy2k_state::fldtc_w)
207208{
209   device_t *device = machine().device(I8272A_TAG);
208210   upd765_tc_w(device, 1);
209211   upd765_tc_w(device, 0);
210212}
r18257r18258
269271   ADDRESS_MAP_UNMAP_HIGH
270272   AM_RANGE(0x00000, 0x00001) AM_READWRITE8(enable_r, enable_w, 0x00ff)
271273   AM_RANGE(0x00002, 0x00003) AM_WRITE8(dma_mux_w, 0x00ff)
272   AM_RANGE(0x00004, 0x00005) AM_DEVREADWRITE8_LEGACY(I8272A_TAG, fldtc_r, fldtc_w, 0x00ff)
274   AM_RANGE(0x00004, 0x00005) AM_READWRITE8(fldtc_r, fldtc_w, 0x00ff)
273275   AM_RANGE(0x00010, 0x00013) AM_DEVREADWRITE8(I8251A_TAG, i8251_device, data_r, data_w, 0x00ff)
274276   AM_RANGE(0x00030, 0x00031) AM_DEVREAD8_LEGACY(I8272A_TAG, upd765_status_r, 0x00ff)
275277   AM_RANGE(0x00032, 0x00033) AM_DEVREADWRITE8_LEGACY(I8272A_TAG, upd765_data_r, upd765_data_w, 0x00ff)
trunk/src/mess/drivers/huebler.c
r18257r18258
247247
248248/* Z80-CTC Interface */
249249
250static WRITE_LINE_DEVICE_HANDLER( ctc_z0_w )
250WRITE_LINE_MEMBER(amu880_state::ctc_z0_w)
251251{
252252}
253253
254static WRITE_LINE_DEVICE_HANDLER( ctc_z2_w )
254WRITE_LINE_MEMBER(amu880_state::ctc_z2_w)
255255{
256256   /* cassette transmit/receive clock */
257257}
r18257r18258
259259static Z80CTC_INTERFACE( ctc_intf )
260260{
261261   DEVCB_CPU_INPUT_LINE(Z80_TAG, INPUT_LINE_IRQ0),   /* interrupt handler */
262   DEVCB_LINE(ctc_z0_w),   /* ZC/TO0 callback */
262   DEVCB_DRIVER_LINE_MEMBER(amu880_state,ctc_z0_w),   /* ZC/TO0 callback */
263263   DEVCB_DEVICE_LINE(Z80SIO_TAG, z80dart_rxtxcb_w),   /* ZC/TO1 callback */
264   DEVCB_LINE(ctc_z2_w)   /* ZC/TO2 callback */
264   DEVCB_DRIVER_LINE_MEMBER(amu880_state,ctc_z2_w)   /* ZC/TO2 callback */
265265};
266266
267267/* Z80-PIO Interface */
r18257r18258
290290
291291/* Z80-SIO Interface */
292292
293static READ_LINE_DEVICE_HANDLER( cassette_r )
293READ_LINE_MEMBER(amu880_state::cassette_r)
294294{
295   device_t *device = machine().device(CASSETTE_TAG);
295296   cassette_image_device* dev = dynamic_cast<cassette_image_device*>(device);
296297   return dev->input() < 0.0;
297298}
298299
299static WRITE_LINE_DEVICE_HANDLER( cassette_w )
300WRITE_LINE_MEMBER(amu880_state::cassette_w)
300301{
302   device_t *device = machine().device(CASSETTE_TAG);
301303   cassette_image_device* dev = dynamic_cast<cassette_image_device*>(device);
302304   dev->output(state ? -1.0 : +1.0);
303305}
r18257r18258
306308{
307309   0, 0, 0, 0,
308310
309   DEVCB_DEVICE_LINE(CASSETTE_TAG, cassette_r),
310   DEVCB_DEVICE_LINE(CASSETTE_TAG, cassette_w),
311   DEVCB_DRIVER_LINE_MEMBER(amu880_state, cassette_r),
312   DEVCB_DRIVER_LINE_MEMBER(amu880_state, cassette_w),
311313   DEVCB_NULL,
312314   DEVCB_NULL,
313315   DEVCB_NULL,
trunk/src/mess/drivers/bbc.c
r18257r18258
717717};
718718
719719
720static WRITE_LINE_DEVICE_HANDLER(bbcb_ack_w)
720WRITE_LINE_MEMBER(bbc_state::bbcb_ack_w)
721721{
722   via6522_device *via_1 = device->machine().device<via6522_device>("via6522_1");
722   via6522_device *via_1 = machine().device<via6522_device>("via6522_1");
723723   via_1->write_ca1(!state); /* ack seems to be inverted? */
724724}
725725
726726static const centronics_interface bbcb_centronics_config =
727727{
728   DEVCB_DEVICE_LINE("via6522_1",bbcb_ack_w),
728   DEVCB_DRIVER_LINE_MEMBER(bbc_state,bbcb_ack_w),
729729   DEVCB_NULL,
730730   DEVCB_NULL
731731};
732732
733static WRITE_LINE_DEVICE_HANDLER( bbcb_acia6850_irq_w )
733WRITE_LINE_MEMBER(bbc_state::bbcb_acia6850_irq_w)
734734{
735   bbc_state *driver_state = device->machine().driver_data<bbc_state>();
736   driver_state->m_acia_irq = state;
735   m_acia_irq = state;
737736
738   driver_state->check_interrupts();
737   check_interrupts();
739738}
740739
741740static ACIA6850_INTERFACE( bbc_acia6850_interface )
r18257r18258
747746   DEVCB_NULL,
748747   DEVCB_NULL,
749748   DEVCB_NULL,
750   DEVCB_LINE(bbcb_acia6850_irq_w)
749   DEVCB_DRIVER_LINE_MEMBER(bbc_state,bbcb_acia6850_irq_w)
751750};
752751
753752static LEGACY_FLOPPY_OPTIONS_START(bbc)
r18257r18258
798797    DEVCB_NULL
799798};
800799
801static WRITE_LINE_DEVICE_HANDLER( econet_clk_w )
800WRITE_LINE_MEMBER(bbc_state::econet_clk_w)
802801{
802   device_t *device = machine().device("mc6854");
803803   mc6854_rxc_w(device, state);
804804   mc6854_txc_w(device, state);
805805}
806806
807807static ECONET_INTERFACE( econet_intf )
808808{
809   DEVCB_DEVICE_LINE("mc6854", econet_clk_w),
809   DEVCB_DRIVER_LINE_MEMBER(bbc_state,econet_clk_w),
810810   DEVCB_NULL
811811};
812812
trunk/src/mess/drivers/v1050.c
r18257r18258
594594
595595// 8214 Interface
596596
597static WRITE_LINE_DEVICE_HANDLER( pic_int_w )
597WRITE_LINE_MEMBER(v1050_state::pic_int_w)
598598{
599599   if (state == ASSERT_LINE)
600600   {
601      device->execute().set_input_line(INPUT_LINE_IRQ0, ASSERT_LINE);
601      execute().set_input_line(INPUT_LINE_IRQ0, ASSERT_LINE);
602602   }
603603}
604604
605605static I8214_INTERFACE( pic_intf )
606606{
607   DEVCB_DEVICE_LINE(Z80_TAG, pic_int_w),
607   DEVCB_DRIVER_LINE_MEMBER(v1050_state,pic_int_w),
608608   DEVCB_NULL
609609};
610610
r18257r18258
617617
618618// Display 8255A Interface
619619
620static WRITE8_DEVICE_HANDLER( disp_ppi_pc_w )
620WRITE8_MEMBER(v1050_state::disp_ppi_pc_w)
621621{
622   device_t *device = machine().device(I8255A_M6502_TAG);
622623   i8255_device *ppi = static_cast<i8255_device*>(device);
623624
624625   ppi->pc2_w(BIT(data, 6));
r18257r18258
632633   DEVCB_NULL,                     // Port B read
633634   DEVCB_NULL,                     // Port B write
634635   DEVCB_NULL,                     // Port C read
635   DEVCB_DEVICE_HANDLER(I8255A_M6502_TAG, disp_ppi_pc_w)      // Port C write
636   DEVCB_DRIVER_MEMBER(v1050_state,disp_ppi_pc_w)      // Port C write
636637};
637638
638static WRITE8_DEVICE_HANDLER( m6502_ppi_pc_w )
639WRITE8_MEMBER(v1050_state::m6502_ppi_pc_w)
639640{
641   device_t *device = machine().device(I8255A_DISP_TAG);
640642   i8255_device *ppi = static_cast<i8255_device*>(device);
641643
642644   ppi->pc2_w(BIT(data, 7));
r18257r18258
650652   DEVCB_NULL,                     // Port B read
651653   DEVCB_NULL,                     // Port B write
652654   DEVCB_NULL,                     // Port C read
653   DEVCB_DEVICE_HANDLER(I8255A_DISP_TAG, m6502_ppi_pc_w)   // Port C write
655   DEVCB_DRIVER_MEMBER(v1050_state,m6502_ppi_pc_w)   // Port C write
654656};
655657
656658// Miscellanous 8255A Interface
r18257r18258
693695   wd17xx_dden_w(m_fdc, BIT(data, 7));
694696}
695697
696static WRITE8_DEVICE_HANDLER( misc_ppi_pb_w )
698WRITE8_MEMBER(v1050_state::misc_ppi_pb_w)
697699{
698   centronics_device *centronics = space.machine().device<centronics_device>(CENTRONICS_TAG);
699   centronics->write( space.machine().driver_data()->generic_space() , 0, ~data & 0xff);
700   centronics_device *centronics = machine().device<centronics_device>(CENTRONICS_TAG);
701   centronics->write( machine().driver_data()->generic_space() , 0, ~data & 0xff);
700702}
701703
702static READ8_DEVICE_HANDLER( misc_ppi_pc_r )
704READ8_MEMBER(v1050_state::misc_ppi_pc_r)
703705{
704706   /*
705707
r18257r18258
717719    */
718720
719721   UINT8 data = 0;
720   centronics_device *centronics = space.machine().device<centronics_device>(CENTRONICS_TAG);
722   centronics_device *centronics = machine().device<centronics_device>(CENTRONICS_TAG);
721723   data |= centronics->not_busy_r() << 4;
722724   data |= centronics->pe_r() << 5;
723725
r18257r18258
779781   DEVCB_NULL,                     // Port A read
780782   DEVCB_DRIVER_MEMBER(v1050_state, misc_ppi_pa_w),      // Port A write
781783   DEVCB_NULL,                     // Port B read
782   DEVCB_DEVICE_HANDLER(CENTRONICS_TAG, misc_ppi_pb_w),      // Port B write
783   DEVCB_DEVICE_HANDLER(CENTRONICS_TAG, misc_ppi_pc_r),      // Port C read
784   DEVCB_DRIVER_MEMBER(v1050_state,misc_ppi_pb_w),      // Port B write
785   DEVCB_DRIVER_MEMBER(v1050_state,misc_ppi_pc_r),      // Port C read
784786   DEVCB_DRIVER_MEMBER(v1050_state, misc_ppi_pc_w)      // Port C write
785787};
786788
trunk/src/mess/drivers/apple2.c
r18257r18258
222222#define PADDLE_SENSITIVITY      10
223223#define PADDLE_AUTOCENTER       0
224224
225static WRITE8_DEVICE_HANDLER(a2bus_irq_w)
225WRITE8_MEMBER(apple2_state::a2bus_irq_w)
226226{
227    apple2_state *a2 = space.machine().driver_data<apple2_state>();
228
229    a2->m_maincpu->set_input_line(M6502_IRQ_LINE, data);
227    m_maincpu->set_input_line(M6502_IRQ_LINE, data);
230228}
231229
232static WRITE8_DEVICE_HANDLER(a2bus_nmi_w)
230WRITE8_MEMBER(apple2_state::a2bus_nmi_w)
233231{
234    apple2_state *a2 = space.machine().driver_data<apple2_state>();
235
236    a2->m_maincpu->set_input_line(INPUT_LINE_NMI, data);
232    m_maincpu->set_input_line(INPUT_LINE_NMI, data);
237233}
238234
239static WRITE8_DEVICE_HANDLER(a2bus_inh_w)
235WRITE8_MEMBER(apple2_state::a2bus_inh_w)
240236{
241    apple2_state *a2 = space.machine().driver_data<apple2_state>();
242
243    a2->m_inh_slot = data;
244    apple2_update_memory(space.machine());
237    m_inh_slot = data;
238    apple2_update_memory(machine());
245239}
246240
247241/***************************************************************************
r18257r18258
596590static const struct a2bus_interface a2bus_intf =
597591{
598592   // interrupt lines
599   DEVCB_HANDLER(a2bus_irq_w),
600   DEVCB_HANDLER(a2bus_nmi_w),
601    DEVCB_HANDLER(a2bus_inh_w)
593   DEVCB_DRIVER_MEMBER(apple2_state,a2bus_irq_w),
594   DEVCB_DRIVER_MEMBER(apple2_state,a2bus_nmi_w),
595    DEVCB_DRIVER_MEMBER(apple2_state,a2bus_inh_w)
602596};
603597
604598static const struct a2eauxslot_interface a2eauxbus_intf =
605599{
606600   // interrupt lines
607   DEVCB_HANDLER(a2bus_irq_w),
608   DEVCB_HANDLER(a2bus_nmi_w)
601   DEVCB_DRIVER_MEMBER(apple2_state,a2bus_irq_w),
602   DEVCB_DRIVER_MEMBER(apple2_state,a2bus_nmi_w)
609603};
610604
611605static SLOT_INTERFACE_START(apple2_slot0_cards)
trunk/src/mess/drivers/super6.c
r18257r18258
509509//  GENERIC_TERMINAL_INTERFACE( terminal_intf )
510510//-------------------------------------------------
511511
512static WRITE8_DEVICE_HANDLER( dummy_w )
512WRITE8_MEMBER(super6_state::dummy_w)
513513{
514514   // handled in Z80DART_INTERFACE
515515}
516516
517517static GENERIC_TERMINAL_INTERFACE( terminal_intf )
518518{
519   DEVCB_HANDLER(dummy_w)
519   DEVCB_DRIVER_MEMBER(super6_state,dummy_w)
520520};
521521
522522
trunk/src/mess/drivers/x68k.c
r18257r18258
856856}
857857
858858// Judging from the XM6 source code, PPI ports A and B are joystick inputs
859static READ8_DEVICE_HANDLER( ppi_port_a_r )
859READ8_MEMBER(x68k_state::ppi_port_a_r)
860860{
861   x68k_state *state = space.machine().driver_data<x68k_state>();
862   int ctrl = space.machine().root_device().ioport("ctrltype")->read() & 0x0f;
861   int ctrl = machine().root_device().ioport("ctrltype")->read() & 0x0f;
863862
864863   switch(ctrl)
865864   {
866865      case 0x00:  // standard MSX/FM-Towns joystick
867         if(state->m_joy.joy1_enable == 0)
868            return state->ioport("joy1")->read();
866         if(m_joy.joy1_enable == 0)
867            return ioport("joy1")->read();
869868         else
870869            return 0xff;
871870      case 0x01:  // 3-button Megadrive gamepad
872         return md_3button_r(device,1);
871         return md_3button_r(machine().device("ppi8255"),1);
873872      case 0x02:  // 6-button Megadrive gamepad
874         return md_6button_r(device,1);
873         return md_6button_r(machine().device("ppi8255"),1);
875874      case 0x03:  // XPD-1LR
876         return xpd1lr_r(device,1);
875         return xpd1lr_r(machine().device("ppi8255"),1);
877876   }
878877
879878   return 0xff;
880879}
881880
882static READ8_DEVICE_HANDLER( ppi_port_b_r )
881READ8_MEMBER(x68k_state::ppi_port_b_r)
883882{
884   x68k_state *state = space.machine().driver_data<x68k_state>();
885   int ctrl = space.machine().root_device().ioport("ctrltype")->read() & 0xf0;
883   int ctrl = machine().root_device().ioport("ctrltype")->read() & 0xf0;
886884
887885   switch(ctrl)
888886   {
889887      case 0x00:  // standard MSX/FM-Towns joystick
890         if(state->m_joy.joy2_enable == 0)
891            return state->ioport("joy2")->read();
888         if(m_joy.joy2_enable == 0)
889            return ioport("joy2")->read();
892890         else
893891            return 0xff;
894892      case 0x10:  // 3-button Megadrive gamepad
895         return md_3button_r(device,2);
893         return md_3button_r(machine().device("ppi8255"),2);
896894      case 0x20:  // 6-button Megadrive gamepad
897         return md_6button_r(device,2);
895         return md_6button_r(machine().device("ppi8255"),2);
898896      case 0x30:  // XPD-1LR
899         return xpd1lr_r(device,2);
897         return xpd1lr_r(machine().device("ppi8255"),2);
900898   }
901899
902900   return 0xff;
903901}
904902
905static READ8_DEVICE_HANDLER( ppi_port_c_r )
903READ8_MEMBER(x68k_state::ppi_port_c_r)
906904{
907   x68k_state *state = space.machine().driver_data<x68k_state>();
908   return state->m_ppi_port[2];
905   return m_ppi_port[2];
909906}
910907
911908/* PPI port C (Joystick control, R/W)
r18257r18258
916913   bits 3,2 - ADPCM Sample rate
917914   bits 1,0 - ADPCM Pan
918915*/
919static WRITE8_DEVICE_HANDLER( ppi_port_c_w )
916WRITE8_MEMBER(x68k_state::ppi_port_c_w)
920917{
921   x68k_state *state = space.machine().driver_data<x68k_state>();
922918   // ADPCM / Joystick control
923   device_t *oki = space.machine().device("okim6258");
919   device_t *oki = machine().device("okim6258");
924920
925   state->m_ppi_port[2] = data;
926   if((data & 0x0f) != (state->m_ppi_prev & 0x0f))
921   m_ppi_port[2] = data;
922   if((data & 0x0f) != (m_ppi_prev & 0x0f))
927923   {
928      state->m_adpcm.pan = data & 0x03;
929      state->m_adpcm.rate = data & 0x0c;
930      x68k_set_adpcm(space.machine());
924      m_adpcm.pan = data & 0x03;
925      m_adpcm.rate = data & 0x0c;
926      x68k_set_adpcm(machine());
931927      okim6258_set_divider(oki, (data >> 2) & 3);
932928   }
933929
934930   // The joystick enable bits also handle the multiplexer for various controllers
935   state->m_joy.joy1_enable = data & 0x10;
936   state->m_mdctrl.mux1 = data & 0x10;
937   if((state->m_ppi_prev & 0x10) == 0x00 && (data & 0x10) == 0x10)
931   m_joy.joy1_enable = data & 0x10;
932   m_mdctrl.mux1 = data & 0x10;
933   if((m_ppi_prev & 0x10) == 0x00 && (data & 0x10) == 0x10)
938934   {
939      state->m_mdctrl.seq1++;
940      state->m_mdctrl.io_timeout1->adjust(space.machine().device<cpu_device>("maincpu")->cycles_to_attotime(8192));
935      m_mdctrl.seq1++;
936      m_mdctrl.io_timeout1->adjust(machine().device<cpu_device>("maincpu")->cycles_to_attotime(8192));
941937   }
942938
943   state->m_joy.joy2_enable = data & 0x20;
944   state->m_mdctrl.mux2 = data & 0x20;
945   if((state->m_ppi_prev & 0x20) == 0x00 && (data & 0x20) == 0x20)
939   m_joy.joy2_enable = data & 0x20;
940   m_mdctrl.mux2 = data & 0x20;
941   if((m_ppi_prev & 0x20) == 0x00 && (data & 0x20) == 0x20)
946942   {
947      state->m_mdctrl.seq2++;
948      state->m_mdctrl.io_timeout2->adjust(space.machine().device<cpu_device>("maincpu")->cycles_to_attotime(8192));
943      m_mdctrl.seq2++;
944      m_mdctrl.io_timeout2->adjust(machine().device<cpu_device>("maincpu")->cycles_to_attotime(8192));
949945   }
950   state->m_ppi_prev = data;
946   m_ppi_prev = data;
951947
952   state->m_joy.ioc6 = data & 0x40;
953   state->m_joy.ioc7 = data & 0x80;
948   m_joy.ioc6 = data & 0x40;
949   m_joy.ioc7 = data & 0x80;
954950}
955951
956952
r18257r18258
10731069   }
10741070}
10751071
1076static WRITE_LINE_DEVICE_HANDLER( fdc_irq )
1072WRITE_LINE_MEMBER(x68k_state::fdc_irq)
10771073{
1078   x68k_state *drvstate = device->machine().driver_data<x68k_state>();
1079   if((drvstate->m_ioc.irqstatus & 0x04) && state == ASSERT_LINE)
1074   if((m_ioc.irqstatus & 0x04) && state == ASSERT_LINE)
10801075   {
1081      drvstate->m_current_vector[1] = drvstate->m_ioc.fdcvector;
1082      drvstate->m_ioc.irqstatus |= 0x80;
1083      drvstate->m_current_irq_line = 1;
1076      m_current_vector[1] = m_ioc.fdcvector;
1077      m_ioc.irqstatus |= 0x80;
1078      m_current_irq_line = 1;
10841079      logerror("FDC: IRQ triggered\n");
1085      device->machine().device("maincpu")->execute().set_input_line_and_vector(1, ASSERT_LINE, drvstate->m_current_vector[1]);
1080      machine().device("maincpu")->execute().set_input_line_and_vector(1, ASSERT_LINE, m_current_vector[1]);
10861081   }
10871082}
10881083
r18257r18258
11041099   upd765_dack_w(fdc, machine.driver_data()->generic_space(), 0, data);
11051100}
11061101
1107static WRITE_LINE_DEVICE_HANDLER ( fdc_drq )
1102WRITE_LINE_MEMBER(x68k_state::fdc_drq)
11081103{
1109   x68k_state *drvstate = device->machine().driver_data<x68k_state>();
1110   drvstate->m_fdc.drq_state = state;
1104   m_fdc.drq_state = state;
11111105}
11121106
11131107static WRITE16_HANDLER( x68k_fm_w )
r18257r18258
11291123   return 0xffff;
11301124}
11311125
1132static WRITE8_DEVICE_HANDLER( x68k_ct_w )
1126WRITE8_MEMBER(x68k_state::x68k_ct_w)
11331127{
1134   x68k_state *state = space.machine().driver_data<x68k_state>();
1135   device_t *fdc = space.machine().device("upd72065");
1136   device_t *okim = space.machine().device("okim6258");
1128   device_t *fdc = machine().device("upd72065");
1129   device_t *okim = machine().device("okim6258");
11371130
11381131   // CT1 and CT2 bits from YM2151 port 0x1b
11391132   // CT1 - ADPCM clock - 0 = 8MHz, 1 = 4MHz
11401133   // CT2 - 1 = Set ready state of FDC
11411134   upd765_ready_w(fdc,data & 0x01);
1142   state->m_adpcm.clock = data & 0x02;
1143   x68k_set_adpcm(space.machine());
1135   m_adpcm.clock = data & 0x02;
1136   x68k_set_adpcm(machine());
11441137   okim6258_set_clock(okim, data & 0x02 ? 4000000 : 8000000);
11451138}
11461139
r18257r18258
15031496   state->m_rtc->write(space, offset, data);
15041497}
15051498
1506static WRITE_LINE_DEVICE_HANDLER( x68k_rtc_alarm_irq )
1499WRITE_LINE_MEMBER(x68k_state::x68k_rtc_alarm_irq)
15071500{
1508   x68k_state *drvstate = device->machine().driver_data<x68k_state>();
1509
1510   if(drvstate->m_mfp.aer & 0x01)
1501   if(m_mfp.aer & 0x01)
15111502   {
15121503      if(state == 1)
15131504      {
1514         drvstate->m_mfp.gpio |= 0x01;
1515         drvstate->m_mfpdev->i0_w(1);
1505         m_mfp.gpio |= 0x01;
1506         m_mfpdev->i0_w(1);
15161507         //mfp_trigger_irq(MFP_IRQ_GPIP0);  // RTC ALARM
15171508      }
15181509   }
r18257r18258
15201511   {
15211512      if(state == 0)
15221513      {
1523         drvstate->m_mfp.gpio &= ~0x01;
1524         drvstate->m_mfpdev->i0_w(0);
1514         m_mfp.gpio &= ~0x01;
1515         m_mfpdev->i0_w(0);
15251516         //mfp_trigger_irq(MFP_IRQ_GPIP0);  // RTC ALARM
15261517      }
15271518   }
r18257r18258
18581849   return data;
18591850}
18601851
1861static WRITE8_DEVICE_HANDLER( x68030_adpcm_w )
1852WRITE8_MEMBER(x68k_state::x68030_adpcm_w)
18621853{
1854   device_t *device = machine().device("okim6258");
18631855   switch(offset)
18641856   {
18651857      case 0x00:
r18257r18258
18711863   }
18721864}
18731865
1874static WRITE_LINE_DEVICE_HANDLER( mfp_irq_callback )
1866WRITE_LINE_MEMBER(x68k_state::mfp_irq_callback)
18751867{
1876   x68k_state *drvstate = device->machine().driver_data<x68k_state>();
1877   if(drvstate->m_mfp_prev == CLEAR_LINE && state == CLEAR_LINE)  // eliminate unnecessary calls to set the IRQ line for speed reasons
1868   if(m_mfp_prev == CLEAR_LINE && state == CLEAR_LINE)  // eliminate unnecessary calls to set the IRQ line for speed reasons
18781869      return;
18791870   if(state != CLEAR_LINE)
18801871      state = HOLD_LINE;  // to get around erroneous spurious interrupt
1881//  if((state->m_ioc.irqstatus & 0xc0) != 0)  // if the FDC is busy, then we don't want to miss that IRQ
1872//  if((m_ioc.irqstatus & 0xc0) != 0)  // if the FDC is busy, then we don't want to miss that IRQ
18821873//      return;
1883   device->machine().device("maincpu")->execute().set_input_line(6, state);
1884   drvstate->m_current_vector[6] = 0;
1885   drvstate->m_mfp_prev = state;
1874   machine().device("maincpu")->execute().set_input_line(6, state);
1875   m_current_vector[6] = 0;
1876   m_mfp_prev = state;
18861877}
18871878
18881879INTERRUPT_GEN_MEMBER(x68k_state::x68k_vsync_irq)
r18257r18258
19331924   return state->m_current_vector[irqline];
19341925}
19351926
1936static WRITE_LINE_DEVICE_HANDLER( x68k_scsi_irq )
1927WRITE_LINE_MEMBER(x68k_state::x68k_scsi_irq)
19371928{
1938   x68k_state *tstate = device->machine().driver_data<x68k_state>();
19391929   // TODO : Internal SCSI IRQ vector 0x6c, External SCSI IRQ vector 0xf6, IRQs go through the IOSC (IRQ line 1)
19401930   if(state != 0)
19411931   {
1942      tstate->m_current_vector[1] = 0x6c;
1943      tstate->m_current_irq_line = 1;
1944      device->machine().device("maincpu")->execute().set_input_line_and_vector(1,ASSERT_LINE,tstate->m_current_vector[1]);
1932      m_current_vector[1] = 0x6c;
1933      m_current_irq_line = 1;
1934      machine().device("maincpu")->execute().set_input_line_and_vector(1,ASSERT_LINE,m_current_vector[1]);
19451935   }
19461936}
19471937
1948static WRITE_LINE_DEVICE_HANDLER( x68k_scsi_drq )
1938WRITE_LINE_MEMBER(x68k_state::x68k_scsi_drq)
19491939{
19501940   // TODO
19511941}
r18257r18258
20422032//  AM_RANGE(0xe8c000, 0xe8dfff) AM_READWRITE_LEGACY(x68k_printer_r, x68k_printer_w)
20432033   AM_RANGE(0xe8e000, 0xe8ffff) AM_READWRITE16_LEGACY(x68k_sysport_r, x68k_sysport_w,0xffffffff)
20442034   AM_RANGE(0xe90000, 0xe91fff) AM_READWRITE16_LEGACY(x68k_fm_r, x68k_fm_w,0xffffffff)
2045   AM_RANGE(0xe92000, 0xe92003) AM_DEVREADWRITE8_LEGACY("okim6258", okim6258_status_r, x68030_adpcm_w, 0x00ff00ff)
2035   AM_RANGE(0xe92000, 0xe92003) AM_DEVREAD8_LEGACY("okim6258", okim6258_status_r, 0x00ff00ff) AM_WRITE8(x68030_adpcm_w, 0x00ff00ff)
20462036   AM_RANGE(0xe94000, 0xe95fff) AM_READWRITE16_LEGACY(x68k_fdc_r, x68k_fdc_w,0xffffffff)
20472037//  AM_RANGE(0xe96000, 0xe9601f) AM_DEVREADWRITE16_LEGACY("x68k_hdc",x68k_hdc_r, x68k_hdc_w,0xffffffff)
20482038   AM_RANGE(0xe96020, 0xe9603f) AM_DEVREADWRITE8("scsi:mb89352",mb89352_device,mb89352_r,mb89352_w,0x00ff00ff)
r18257r18258
20742064   4000000,                                 /* timer clock */
20752065   0,                                       /* receive clock */
20762066   0,                                       /* transmit clock */
2077   DEVCB_LINE(mfp_irq_callback),                  /* interrupt */
2067   DEVCB_DRIVER_LINE_MEMBER(x68k_state,mfp_irq_callback),                  /* interrupt */
20782068   DEVCB_DRIVER_MEMBER(x68k_state, mfp_gpio_r),      /* GPIO read */
20792069   DEVCB_NULL,                                 /* GPIO write */
20802070   DEVCB_NULL,                                 /* TAO */
r18257r18258
20892079
20902080static I8255A_INTERFACE( ppi_interface )
20912081{
2092   DEVCB_HANDLER(ppi_port_a_r),
2082   DEVCB_DRIVER_MEMBER(x68k_state,ppi_port_a_r),
20932083   DEVCB_NULL,
2094   DEVCB_HANDLER(ppi_port_b_r),
2084   DEVCB_DRIVER_MEMBER(x68k_state,ppi_port_b_r),
20952085   DEVCB_NULL,
2096   DEVCB_HANDLER(ppi_port_c_r),
2097   DEVCB_HANDLER(ppi_port_c_w)
2086   DEVCB_DRIVER_MEMBER(x68k_state,ppi_port_c_r),
2087   DEVCB_DRIVER_MEMBER(x68k_state,ppi_port_c_w)
20982088};
20992089
21002090static const hd63450_intf dmac_interface =
r18257r18258
21122102
21132103static const upd765_interface fdc_interface =
21142104{
2115   DEVCB_LINE(fdc_irq),
2116   DEVCB_LINE(fdc_drq),
2105   DEVCB_DRIVER_LINE_MEMBER(x68k_state,fdc_irq),
2106   DEVCB_DRIVER_LINE_MEMBER(x68k_state,fdc_drq),
21172107   NULL,
21182108   UPD765_RDY_PIN_CONNECTED,
21192109   {FLOPPY_0,FLOPPY_1,FLOPPY_2,FLOPPY_3}
r18257r18258
21222112static const ym2151_interface x68k_ym2151_interface =
21232113{
21242114   DEVCB_LINE(x68k_fm_irq),
2125   DEVCB_HANDLER(x68k_ct_w)  // CT1, CT2 from YM2151 port 0x1b
2115   DEVCB_DRIVER_MEMBER(x68k_state,x68k_ct_w)  // CT1, CT2 from YM2151 port 0x1b
21262116};
21272117
21282118static const okim6258_interface x68k_okim6258_interface =
r18257r18258
21342124
21352125static RP5C15_INTERFACE( rtc_intf )
21362126{
2137   DEVCB_LINE(x68k_rtc_alarm_irq),
2127   DEVCB_DRIVER_LINE_MEMBER(x68k_state,x68k_rtc_alarm_irq),
21382128   DEVCB_NULL
21392129};
21402130
r18257r18258
25192509
25202510static const mb89352_interface x68k_scsi_intf =
25212511{
2522   DEVCB_LINE(x68k_scsi_irq),
2523   DEVCB_LINE(x68k_scsi_drq)
2512   DEVCB_DRIVER_LINE_MEMBER(x68k_state,x68k_scsi_irq),
2513   DEVCB_DRIVER_LINE_MEMBER(x68k_state,x68k_scsi_drq)
25242514};
25252515
25262516static X68K_EXPANSION_INTERFACE(x68k_exp_intf)
trunk/src/mess/drivers/pes.c
r18257r18258
6565#include "machine/terminal.h"
6666
6767/* Devices */
68static WRITE8_DEVICE_HANDLER( pes_kbd_input )
68WRITE8_MEMBER(pes_state::pes_kbd_input)
6969{
70   pes_state *state = space.machine().driver_data<pes_state>();
7170#ifdef DEBUG_FIFO
7271   fprintf(stderr,"keyboard input: %c, ", data);
7372#endif
7473   // if fifo is full (head ptr = tail ptr-1), do not increment the head ptr and do not store the data
75   if (((state->m_infifo_tail_ptr-1)&0x1F) == state->m_infifo_head_ptr)
74   if (((m_infifo_tail_ptr-1)&0x1F) == m_infifo_head_ptr)
7675   {
7776      logerror("infifo was full, write ignored!\n");
7877#ifdef DEBUG_FIFO
r18257r18258
8079#endif
8180      return;
8281   }
83   state->m_infifo[state->m_infifo_head_ptr] = data;
84   state->m_infifo_head_ptr++;
85   state->m_infifo_head_ptr&=0x1F;
82   m_infifo[m_infifo_head_ptr] = data;
83   m_infifo_head_ptr++;
84   m_infifo_head_ptr&=0x1F;
8685#ifdef DEBUG_FIFO
87   fprintf(stderr,"kb input fifo fullness: %d\n",(state->m_infifo_head_ptr-state->m_infifo_tail_ptr)&0x1F);
86   fprintf(stderr,"kb input fifo fullness: %d\n",(m_infifo_head_ptr-m_infifo_tail_ptr)&0x1F);
8887#endif
8988   // todo: following two should be set so clear happens after one cpu cycle
90   space.machine().device("maincpu")->execute().set_input_line(MCS51_RX_LINE, ASSERT_LINE);
91   space.machine().device("maincpu")->execute().set_input_line(MCS51_RX_LINE, CLEAR_LINE);
89   machine().device("maincpu")->execute().set_input_line(MCS51_RX_LINE, ASSERT_LINE);
90   machine().device("maincpu")->execute().set_input_line(MCS51_RX_LINE, CLEAR_LINE);
9291}
9392
9493static GENERIC_TERMINAL_INTERFACE( pes_terminal_intf )
9594{
96   DEVCB_HANDLER(pes_kbd_input)
95   DEVCB_DRIVER_MEMBER(pes_state,pes_kbd_input)
9796};
9897
9998/* Helper Functions */
trunk/src/mess/drivers/m5.c
r18257r18258
432432//  TMS9928a_interface vdp_intf
433433//-------------------------------------------------
434434
435static WRITE_LINE_DEVICE_HANDLER(sordm5_video_interrupt_callback)
435WRITE_LINE_MEMBER(m5_state::sordm5_video_interrupt_callback)
436436{
437   m5_state *driver_state = device->machine().driver_data<m5_state>();
438
439437   if (state)
440438   {
441      driver_state->m_ctc->trg3(1);
442      driver_state->m_ctc->trg3(0);
439      m_ctc->trg3(1);
440      m_ctc->trg3(0);
443441   }
444442}
445443
r18257r18258
447445{
448446   "screen",
449447   0x4000,
450   DEVCB_LINE(sordm5_video_interrupt_callback)
448   DEVCB_DRIVER_LINE_MEMBER(m5_state,sordm5_video_interrupt_callback)
451449};
452450
453451
trunk/src/mess/drivers/ace.c
r18257r18258
160160//   pio_r -
161161//-------------------------------------------------
162162
163static READ8_DEVICE_HANDLER( pio_ad_r )
163READ8_MEMBER(ace_state::pio_ad_r)
164164{
165   device_t *device = machine().device(Z80PIO_TAG);
165166   return dynamic_cast<z80pio_device*>(device)->data_read(0);
166167}
167168
168static READ8_DEVICE_HANDLER( pio_bd_r )
169READ8_MEMBER(ace_state::pio_bd_r)
169170{
171   device_t *device = machine().device(Z80PIO_TAG);
170172   return dynamic_cast<z80pio_device*>(device)->data_read(1);
171173}
172174
173static READ8_DEVICE_HANDLER( pio_ac_r )
175READ8_MEMBER(ace_state::pio_ac_r)
174176{
177   device_t *device = machine().device(Z80PIO_TAG);
175178   return dynamic_cast<z80pio_device*>(device)->control_read();
176179}
177180
178static READ8_DEVICE_HANDLER( pio_bc_r )
181READ8_MEMBER(ace_state::pio_bc_r)
179182{
183   device_t *device = machine().device(Z80PIO_TAG);
180184   return dynamic_cast<z80pio_device*>(device)->control_read();
181185}
182186
r18257r18258
185189//   pio_w -
186190//-------------------------------------------------
187191
188static WRITE8_DEVICE_HANDLER( pio_ad_w )
192WRITE8_MEMBER(ace_state::pio_ad_w)
189193{
194   device_t *device = machine().device(Z80PIO_TAG);
190195   dynamic_cast<z80pio_device*>(device)->data_write(0, data);
191196}
192197
193static WRITE8_DEVICE_HANDLER( pio_bd_w )
198WRITE8_MEMBER(ace_state::pio_bd_w)
194199{
200   device_t *device = machine().device(Z80PIO_TAG);
195201   dynamic_cast<z80pio_device*>(device)->data_write(1, data);
196202}
197203
198static WRITE8_DEVICE_HANDLER( pio_ac_w )
204WRITE8_MEMBER(ace_state::pio_ac_w)
199205{
206   device_t *device = machine().device(Z80PIO_TAG);
200207   dynamic_cast<z80pio_device*>(device)->control_write(0, data);
201208}
202209
203static WRITE8_DEVICE_HANDLER( pio_bc_w )
210WRITE8_MEMBER(ace_state::pio_bc_w)
204211{
212   device_t *device = machine().device(Z80PIO_TAG);
205213   dynamic_cast<z80pio_device*>(device)->control_write(1, data);
206214}
207215
r18257r18258
235243   AM_RANGE(0x43, 0x43) AM_MIRROR(0xff80) AM_READWRITE(ppi_pb_r, ppi_pb_w)
236244   AM_RANGE(0x45, 0x45) AM_MIRROR(0xff80) AM_READWRITE(ppi_pc_r, ppi_pc_w)
237245   AM_RANGE(0x47, 0x47) AM_MIRROR(0xff80) AM_READWRITE(ppi_control_r, ppi_control_w)
238   AM_RANGE(0x81, 0x81) AM_MIRROR(0xff38) AM_DEVREADWRITE_LEGACY(Z80PIO_TAG, pio_ad_r, pio_ad_w)
239   AM_RANGE(0x83, 0x83) AM_MIRROR(0xff38) AM_DEVREADWRITE_LEGACY(Z80PIO_TAG, pio_bd_r, pio_bd_w)
240   AM_RANGE(0x85, 0x85) AM_MIRROR(0xff38) AM_DEVREADWRITE_LEGACY(Z80PIO_TAG, pio_ac_r, pio_ac_w)
241   AM_RANGE(0x87, 0x87) AM_MIRROR(0xff38) AM_DEVREADWRITE_LEGACY(Z80PIO_TAG, pio_bc_r, pio_bc_w)
246   AM_RANGE(0x81, 0x81) AM_MIRROR(0xff38) AM_READWRITE(pio_ad_r, pio_ad_w)
247   AM_RANGE(0x83, 0x83) AM_MIRROR(0xff38) AM_READWRITE(pio_bd_r, pio_bd_w)
248   AM_RANGE(0x85, 0x85) AM_MIRROR(0xff38) AM_READWRITE(pio_ac_r, pio_ac_w)
249   AM_RANGE(0x87, 0x87) AM_MIRROR(0xff38) AM_READWRITE(pio_bc_r, pio_bc_w)
242250   AM_RANGE(0xfd, 0xfd) AM_MIRROR(0xff00) AM_DEVWRITE_LEGACY(AY8910_TAG, ay8910_address_w)
243251   AM_RANGE(0xff, 0xff) AM_MIRROR(0xff00) AM_DEVREADWRITE_LEGACY(AY8910_TAG, ay8910_r, ay8910_data_w)
244252ADDRESS_MAP_END
r18257r18258
468476//  I8255A_INTERFACE( ppi_intf )
469477//-------------------------------------------------
470478
471static READ8_DEVICE_HANDLER( sby_r )
479READ8_MEMBER(ace_state::sby_r)
472480{
481   device_t *device = machine().device(SP0256AL2_TAG);
473482   /*
474483
475484        bit     description
r18257r18258
488497   return sp0256_sby_r(device);
489498}
490499
491static WRITE8_DEVICE_HANDLER( ald_w )
500WRITE8_MEMBER(ace_state::ald_w)
492501{
502   device_t *device = machine().device(SP0256AL2_TAG);
493503   /*
494504
495505        bit     description
r18257r18258
515525{
516526   DEVCB_NULL,
517527   DEVCB_NULL,
518   DEVCB_DEVICE_HANDLER(SP0256AL2_TAG, sby_r),
519   DEVCB_DEVICE_HANDLER(SP0256AL2_TAG, ald_w),
528   DEVCB_DRIVER_MEMBER(ace_state,sby_r),
529   DEVCB_DRIVER_MEMBER(ace_state,ald_w),
520530   DEVCB_NULL,
521531   DEVCB_NULL
522532};
trunk/src/mess/drivers/nc.c
r18257r18258
837837}
838838
839839
840static WRITE_LINE_DEVICE_HANDLER(nc100_tc8521_alarm_callback)
840WRITE_LINE_MEMBER(nc_state::nc100_tc8521_alarm_callback)
841841{
842842   // TODO
843843}
844844
845static WRITE_LINE_DEVICE_HANDLER( nc100_txrdy_callback )
845WRITE_LINE_MEMBER(nc_state::nc100_txrdy_callback)
846846{
847   nc_state *drvstate = device->machine().driver_data<nc_state>();
848   drvstate->m_irq_latch &= ~(1 << 1);
847   m_irq_latch &= ~(1 << 1);
849848
850849   /* uart on? */
851   if ((drvstate->m_uart_control & (1 << 3)) == 0)
850   if ((m_uart_control & (1 << 3)) == 0)
852851   {
853852      if (state)
854853      {
855854         logerror("tx ready\n");
856         drvstate->m_irq_latch |= (1 << 1);
855         m_irq_latch |= (1 << 1);
857856      }
858857   }
859858
860   nc_update_interrupts(device->machine());
859   nc_update_interrupts(machine());
861860}
862861
863static WRITE_LINE_DEVICE_HANDLER( nc100_rxrdy_callback )
862WRITE_LINE_MEMBER(nc_state::nc100_rxrdy_callback)
864863{
865   nc_state *drvstate = device->machine().driver_data<nc_state>();
866   drvstate->m_irq_latch &= ~(1<<0);
864   m_irq_latch &= ~(1<<0);
867865
868   if ((drvstate->m_uart_control & (1<<3))==0)
866   if ((m_uart_control & (1<<3))==0)
869867   {
870868      if (state)
871869      {
872870         logerror("rx ready\n");
873         drvstate->m_irq_latch |= (1<<0);
871         m_irq_latch |= (1<<0);
874872      }
875873   }
876874
877   nc_update_interrupts(device->machine());
875   nc_update_interrupts(machine());
878876}
879877
880878
881879static RP5C01_INTERFACE( rtc_intf )
882880{
883   DEVCB_LINE(nc100_tc8521_alarm_callback)
881   DEVCB_DRIVER_LINE_MEMBER(nc_state,nc100_tc8521_alarm_callback)
884882};
885883
886884static const i8251_interface nc100_uart_interface =
r18257r18258
890888   DEVCB_NULL,
891889   DEVCB_NULL,
892890   DEVCB_NULL,
893   DEVCB_LINE(nc100_rxrdy_callback),
894   DEVCB_LINE(nc100_txrdy_callback),
891   DEVCB_DRIVER_LINE_MEMBER(nc_state,nc100_rxrdy_callback),
892   DEVCB_DRIVER_LINE_MEMBER(nc_state,nc100_txrdy_callback),
895893   DEVCB_NULL,
896894   DEVCB_NULL
897895};
898896
899897
900static WRITE_LINE_DEVICE_HANDLER( nc100_centronics_ack_w )
898WRITE_LINE_MEMBER(nc_state::nc100_centronics_ack_w)
901899{
902   nc_state *drvstate = device->machine().driver_data<nc_state>();
903900   if (state)
904      drvstate->m_irq_status |= 0x04;
901      m_irq_status |= 0x04;
905902   else
906      drvstate->m_irq_status &= ~0x04;
903      m_irq_status &= ~0x04;
907904
908905   /* trigger an int if the irq is set */
909   nc_update_interrupts(device->machine());
906   nc_update_interrupts(machine());
910907}
911908
912909static const centronics_interface nc100_centronics_config =
913910{
914   DEVCB_LINE(nc100_centronics_ack_w),
911   DEVCB_DRIVER_LINE_MEMBER(nc_state,nc100_centronics_ack_w),
915912   DEVCB_NULL,
916913   DEVCB_NULL
917914};
r18257r18258
11831180#endif
11841181
11851182
1186static WRITE_LINE_DEVICE_HANDLER( nc200_centronics_ack_w )
1183WRITE_LINE_MEMBER(nc_state::nc200_centronics_ack_w)
11871184{
1188   nc_state *drvstate = device->machine().driver_data<nc_state>();
11891185   if (state)
1190      drvstate->m_irq_status |= 0x01;
1186      m_irq_status |= 0x01;
11911187   else
1192      drvstate->m_irq_status &= ~0x01;
1188      m_irq_status &= ~0x01;
11931189
11941190   /* trigger an int if the irq is set */
1195   nc_update_interrupts(device->machine());
1191   nc_update_interrupts(machine());
11961192}
11971193
11981194static const centronics_interface nc200_centronics_config =
11991195{
1200   DEVCB_LINE(nc200_centronics_ack_w),
1196   DEVCB_DRIVER_LINE_MEMBER(nc_state,nc200_centronics_ack_w),
12011197   DEVCB_NULL,
12021198   DEVCB_NULL
12031199};
r18257r18258
12221218   nc_update_interrupts(machine);
12231219}
12241220
1225static WRITE_LINE_DEVICE_HANDLER( nc200_txrdy_callback )
1221WRITE_LINE_MEMBER(nc_state::nc200_txrdy_callback)
12261222{
1227   //nc_state *drvstate = machine.driver_data<nc_state>();
1228//  drvstate->m_nc200_uart_interrupt_irq &=~(1<<0);
1223   //nc_state *drvstate = machine().driver_data<nc_state>();
1224//  m_nc200_uart_interrupt_irq &=~(1<<0);
12291225//
12301226//  if (state)
12311227//  {
1232//      drvstate->m_nc200_uart_interrupt_irq |=(1<<0);
1228//      m_nc200_uart_interrupt_irq |=(1<<0);
12331229//  }
12341230//
1235//  nc200_refresh_uart_interrupt(device->machine());
1231//  nc200_refresh_uart_interrupt(machine());
12361232}
12371233
1238static WRITE_LINE_DEVICE_HANDLER( nc200_rxrdy_callback )
1234WRITE_LINE_MEMBER(nc_state::nc200_rxrdy_callback)
12391235{
1240   nc_state *drvstate = device->machine().driver_data<nc_state>();
1241   drvstate->m_nc200_uart_interrupt_irq &=~(1<<1);
1236   m_nc200_uart_interrupt_irq &=~(1<<1);
12421237
12431238   if (state)
12441239   {
1245      drvstate->m_nc200_uart_interrupt_irq |=(1<<1);
1240      m_nc200_uart_interrupt_irq |=(1<<1);
12461241   }
12471242
1248   nc200_refresh_uart_interrupt(device->machine());
1243   nc200_refresh_uart_interrupt(machine());
12491244}
12501245
12511246static const i8251_interface nc200_uart_interface=
r18257r18258
12551250   DEVCB_NULL,
12561251   DEVCB_NULL,
12571252   DEVCB_NULL,
1258   DEVCB_LINE(nc200_rxrdy_callback),
1259   DEVCB_LINE(nc200_txrdy_callback),
1253   DEVCB_DRIVER_LINE_MEMBER(nc_state,nc200_rxrdy_callback),
1254   DEVCB_DRIVER_LINE_MEMBER(nc_state,nc200_txrdy_callback),
12601255   DEVCB_NULL,
12611256   DEVCB_NULL
12621257};
12631258
12641259
1265static WRITE_LINE_DEVICE_HANDLER( nc200_fdc_interrupt )
1260WRITE_LINE_MEMBER(nc_state::nc200_fdc_interrupt)
12661261{
1267   nc_state *drvstate = device->machine().driver_data<nc_state>();
12681262#if 0
1269    drvstate->m_irq_latch &=~(1<<5);
1263    m_irq_latch &=~(1<<5);
12701264
12711265    if (state)
12721266    {
1273            drvstate->m_irq_latch |=(1<<5);
1267            m_irq_latch |=(1<<5);
12741268    }
12751269#endif
1276    drvstate->m_irq_status &=~(1<<5);
1270    m_irq_status &=~(1<<5);
12771271
12781272    if (state)
12791273    {
1280            drvstate->m_irq_status |=(1<<5);
1274            m_irq_status |=(1<<5);
12811275    }
12821276
1283    nc_update_interrupts(device->machine());
1277    nc_update_interrupts(machine());
12841278}
12851279
12861280static const upd765_interface nc200_upd765_interface=
12871281{
1288    DEVCB_LINE(nc200_fdc_interrupt),
1282    DEVCB_DRIVER_LINE_MEMBER(nc_state,nc200_fdc_interrupt),
12891283    DEVCB_NULL,
12901284    NULL,
12911285    UPD765_RDY_PIN_CONNECTED,
trunk/src/mess/drivers/einstein.c
r18257r18258
132132   }
133133}
134134
135static WRITE_LINE_DEVICE_HANDLER( einstein_6845_de_changed )
135WRITE_LINE_MEMBER(einstein_state::einstein_6845_de_changed)
136136{
137   einstein_state *einstein = device->machine().driver_data<einstein_state>();
138   einstein->m_de=state;
137   m_de=state;
139138}
140139
141140/* bit 0 - latched display enabled (DE) from 6845
r18257r18258
236235    FLOPPY DRIVES
237236***************************************************************************/
238237
239static WRITE8_DEVICE_HANDLER( einstein_drsel_w )
238WRITE8_MEMBER(einstein_state::einstein_drsel_w)
240239{
241   einstein_state *einstein = space.machine().driver_data<einstein_state>();
242240   if(VERBOSE_DISK)
243      logerror("%s: einstein_drsel_w %02x\n", space.machine().describe_context(), data);
241      logerror("%s: einstein_drsel_w %02x\n", machine().describe_context(), data);
244242
245243   /* bit 0 to 3 select the drive */
246244   static const char *names[] = { "fd0", "fd1", "fd2", "fd3" };
247245   floppy_image_device *floppy = 0;
248246   for(int i=0; i<4; i++) {
249247      if(BIT(data, i)) {
250         floppy_connector *con = space.machine().device<floppy_connector>(names[i]);
248         floppy_connector *con = machine().device<floppy_connector>(names[i]);
251249         if(con)
252250            floppy = con->get_device();
253251      }
254252   }
255253
256254   /* double sided drive connected? */
257   if (space.machine().root_device().ioport("config")->read() & data)
255   if (machine().root_device().ioport("config")->read() & data)
258256   {
259257      /* bit 4 selects the side then */
260258      //floppy->ss_w(BIT(data, 4));
261259   }
262260   if (floppy) floppy->ss_w(0);
263   einstein->m_fdc->set_floppy(floppy);
261   m_fdc->set_floppy(floppy);
264262}
265263
266264
r18257r18258
283281    UART
284282***************************************************************************/
285283
286static WRITE_LINE_DEVICE_HANDLER( einstein_serial_transmit_clock )
284WRITE_LINE_MEMBER(einstein_state::einstein_serial_transmit_clock)
287285{
288   i8251_device *uart = device->machine().device<i8251_device>(IC_I060);
286   i8251_device *uart = machine().device<i8251_device>(IC_I060);
289287   uart->transmit_clock();
290288}
291289
292static WRITE_LINE_DEVICE_HANDLER( einstein_serial_receive_clock )
290WRITE_LINE_MEMBER(einstein_state::einstein_serial_receive_clock)
293291{
294   i8251_device *uart = device->machine().device<i8251_device>(IC_I060);
292   i8251_device *uart = machine().device<i8251_device>(IC_I060);
295293   uart->receive_clock();
296294}
297295
r18257r18258
521519   /* block 4, internal controls */
522520   AM_RANGE(0x20, 0x20) AM_MIRROR(0xff00) AM_READWRITE(einstein_kybintmsk_r, einstein_kybintmsk_w)
523521   AM_RANGE(0x21, 0x21) AM_MIRROR(0xff00) AM_WRITE(einstein_adcintmsk_w)
524   AM_RANGE(0x23, 0x23) AM_MIRROR(0xff00) AM_DEVWRITE_LEGACY(IC_I042, einstein_drsel_w)
522   AM_RANGE(0x23, 0x23) AM_MIRROR(0xff00) AM_WRITE(einstein_drsel_w)
525523   AM_RANGE(0x24, 0x24) AM_MIRROR(0xff00) AM_WRITE(einstein_rom_w)
526524   AM_RANGE(0x25, 0x25) AM_MIRROR(0xff00) AM_WRITE(einstein_fire_int_w)
527525   /* block 5, z80ctc */
r18257r18258
692690static Z80CTC_INTERFACE( einstein_ctc_intf )
693691{
694692   DEVCB_NULL,
695   DEVCB_LINE(einstein_serial_transmit_clock),
696   DEVCB_LINE(einstein_serial_receive_clock),
693   DEVCB_DRIVER_LINE_MEMBER(einstein_state,einstein_serial_transmit_clock),
694   DEVCB_DRIVER_LINE_MEMBER(einstein_state,einstein_serial_receive_clock),
697695   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF, z80ctc_device, trg3)
698696};
699697
r18257r18258
733731   NULL,
734732   einstein_6845_update_row,
735733   NULL,
736   DEVCB_LINE(einstein_6845_de_changed),
734   DEVCB_DRIVER_LINE_MEMBER(einstein_state,einstein_6845_de_changed),
737735   DEVCB_NULL,
738736   DEVCB_NULL,
739737   DEVCB_NULL,
trunk/src/mess/drivers/pet.c
r18257r18258
603603   NULL,
604604   pet40_update_row,
605605   NULL,
606   DEVCB_LINE(pet_display_enable_changed),
606   DEVCB_DRIVER_LINE_MEMBER(pet_state, pet_display_enable_changed),
607607   DEVCB_NULL,
608608   DEVCB_NULL,
609609   DEVCB_NULL,
r18257r18258
616616   NULL,
617617   pet80_update_row,
618618   NULL,
619   DEVCB_LINE(pet_display_enable_changed),
619   DEVCB_DRIVER_LINE_MEMBER(pet_state, pet_display_enable_changed),
620620   DEVCB_NULL,
621621   DEVCB_NULL,
622622   DEVCB_NULL,
trunk/src/mess/drivers/pcw.c
r18257r18258
113113static const UINT8 half_step_table[4] = { 0x01, 0x02, 0x04, 0x08 };
114114static const UINT8 full_step_table[4] = { 0x03, 0x06, 0x0c, 0x09 };
115115
116static WRITE_LINE_DEVICE_HANDLER( pcw_fdc_interrupt );
117116
117
118118static void pcw_update_interrupt_counter(pcw_state *state)
119119{
120120   /* never increments past 15! */
r18257r18258
129129/NMI depending on choice (see system control below) */
130130static const upd765_interface pcw_upd765_interface =
131131{
132   DEVCB_LINE(pcw_fdc_interrupt),
132   DEVCB_DRIVER_LINE_MEMBER(pcw_state,pcw_fdc_interrupt),
133133   DEVCB_NULL,
134134   NULL,
135135   UPD765_RDY_PIN_CONNECTED,
r18257r18258
179179}
180180
181181/* fdc interrupt callback. set/clear fdc int */
182static WRITE_LINE_DEVICE_HANDLER( pcw_fdc_interrupt )
182WRITE_LINE_MEMBER(pcw_state::pcw_fdc_interrupt)
183183{
184   pcw_state *drvstate = device->machine().driver_data<pcw_state>();
185184   if (state == CLEAR_LINE)
186      drvstate->m_system_status &= ~(1<<5);
185      m_system_status &= ~(1<<5);
187186   else
188187   {
189      drvstate->m_system_status |= (1<<5);
190      if(drvstate->m_fdc_interrupt_code == 0)  // NMI is held until interrupt type is changed
191         drvstate->m_nmi_flag = 1;
188      m_system_status |= (1<<5);
189      if(m_fdc_interrupt_code == 0)  // NMI is held until interrupt type is changed
190         m_nmi_flag = 1;
192191   }
193192}
194193
trunk/src/mess/drivers/xor100.c
r18257r18258
360360
361361/* COM5016 Interface */
362362
363static WRITE_LINE_DEVICE_HANDLER( com5016_fr_w )
363WRITE_LINE_MEMBER(xor100_state::com5016_fr_w)
364364{
365   device_t *device = machine().device(I8251_A_TAG);
365366   i8251_device* uart = dynamic_cast<i8251_device*>(device);
366367   uart->transmit_clock();
367368   uart->receive_clock();
368369}
369370
370static WRITE_LINE_DEVICE_HANDLER( com5016_ft_w )
371WRITE_LINE_MEMBER(xor100_state::com5016_ft_w)
371372{
373   device_t *device = machine().device(I8251_B_TAG);
372374   i8251_device* uart = dynamic_cast<i8251_device*>(device);
373375   uart->transmit_clock();
374376   uart->receive_clock();
r18257r18258
377379static COM8116_INTERFACE( com5016_intf )
378380{
379381   DEVCB_NULL,               /* fX/4 output */
380   DEVCB_DEVICE_LINE(I8251_A_TAG, com5016_fr_w),   /* fR output */
381   DEVCB_DEVICE_LINE(I8251_B_TAG, com5016_ft_w),   /* fT output */
382   DEVCB_DRIVER_LINE_MEMBER(xor100_state,com5016_fr_w),   /* fR output */
383   DEVCB_DRIVER_LINE_MEMBER(xor100_state,com5016_ft_w),   /* fT output */
382384   { 101376, 67584, 46080, 37686, 33792, 16896, 8448, 4224, 2816, 2534, 2112, 1408, 1056, 704, 528, 264 },   // WRONG?
383385   { 101376, 67584, 46080, 37686, 33792, 16896, 8448, 4224, 2816, 2534, 2112, 1408, 1056, 704, 528, 264 },   // WRONG?
384386};
r18257r18258
415417
416418/* Printer 8255A Interface */
417419
418static READ8_DEVICE_HANDLER( i8255_pc_r )
420READ8_MEMBER(xor100_state::i8255_pc_r)
419421{
420   centronics_device *centronics = space.machine().device<centronics_device>("centronics");
422   centronics_device *centronics = machine().device<centronics_device>("centronics");
421423   /*
422424
423425        bit     description
r18257r18258
450452   DEVCB_DEVICE_MEMBER(CENTRONICS_TAG, centronics_device, write),
451453   DEVCB_NULL,
452454   DEVCB_DEVICE_LINE_MEMBER(CENTRONICS_TAG, centronics_device, strobe_w),
453   DEVCB_DEVICE_HANDLER(CENTRONICS_TAG, i8255_pc_r),
455   DEVCB_DRIVER_MEMBER(xor100_state,i8255_pc_r),
454456   DEVCB_NULL
455457};
456458
r18257r18258
463465
464466/* Z80-CTC Interface */
465467
466static WRITE_LINE_DEVICE_HANDLER( ctc_z0_w )
468WRITE_LINE_MEMBER(xor100_state::ctc_z0_w)
467469{
468470}
469471
470static WRITE_LINE_DEVICE_HANDLER( ctc_z1_w )
472WRITE_LINE_MEMBER(xor100_state::ctc_z1_w)
471473{
472474}
473475
474static WRITE_LINE_DEVICE_HANDLER( ctc_z2_w )
476WRITE_LINE_MEMBER(xor100_state::ctc_z2_w)
475477{
476478}
477479
478480static Z80CTC_INTERFACE( ctc_intf )
479481{
480482   DEVCB_CPU_INPUT_LINE(Z80_TAG, INPUT_LINE_IRQ0),   /* interrupt handler */
481   DEVCB_LINE(ctc_z0_w),         /* ZC/TO0 callback */
482   DEVCB_LINE(ctc_z1_w),         /* ZC/TO1 callback */
483   DEVCB_LINE(ctc_z2_w)          /* ZC/TO2 callback */
483   DEVCB_DRIVER_LINE_MEMBER(xor100_state,ctc_z0_w),         /* ZC/TO0 callback */
484   DEVCB_DRIVER_LINE_MEMBER(xor100_state,ctc_z1_w),         /* ZC/TO1 callback */
485   DEVCB_DRIVER_LINE_MEMBER(xor100_state,ctc_z2_w)          /* ZC/TO2 callback */
484486};
485487
486488/* WD1795-02 Interface */
r18257r18258
518520
519521/* Terminal Interface */
520522
521static WRITE8_DEVICE_HANDLER( xor100_kbd_put )
523WRITE8_MEMBER(xor100_state::xor100_kbd_put)
522524{
523   i8251_device* uart = dynamic_cast<i8251_device*>(device);
525   i8251_device* uart = dynamic_cast<i8251_device*>(machine().device(I8251_B_TAG));
524526   uart->receive_character(data);
525527}
526528
527529static GENERIC_TERMINAL_INTERFACE( xor100_terminal_intf )
528530{
529   DEVCB_DEVICE_HANDLER(I8251_B_TAG, xor100_kbd_put)
531   DEVCB_DRIVER_MEMBER(xor100_state,xor100_kbd_put)
530532};
531533
532534/* Machine Initialization */
trunk/src/mess/drivers/ssystem3.c
r18257r18258
117117   *ready=FALSE;
118118}
119119
120static WRITE8_DEVICE_HANDLER(ssystem3_via_write_a)
120WRITE8_MEMBER(ssystem3_state::ssystem3_via_write_a)
121121{
122   ssystem3_state *state = space.machine().driver_data<ssystem3_state>();
123   state->m_porta=data;
122   m_porta=data;
124123  //  logerror("%.4x via port a write %02x\n",(int)activecpu_get_pc(), data);
125124}
126125
127static READ8_DEVICE_HANDLER(ssystem3_via_read_a)
126READ8_MEMBER(ssystem3_state::ssystem3_via_read_a)
128127{
129   ssystem3_state *state = space.machine().driver_data<ssystem3_state>();
130128  UINT8 data=0xff;
131129#if 1 // time switch
132  if (!(state->m_porta&0x10)) data&=space.machine().root_device().ioport("matrix1")->read()|0xf1;
133  if (!(state->m_porta&0x20)) data&=space.machine().root_device().ioport("matrix2")->read()|0xf1;
134  if (!(state->m_porta&0x40)) data&=space.machine().root_device().ioport("matrix3")->read()|0xf1;
135  if (!(state->m_porta&0x80)) data&=space.machine().root_device().ioport("matrix4")->read()|0xf1;
130  if (!(m_porta&0x10)) data&=machine().root_device().ioport("matrix1")->read()|0xf1;
131  if (!(m_porta&0x20)) data&=machine().root_device().ioport("matrix2")->read()|0xf1;
132  if (!(m_porta&0x40)) data&=machine().root_device().ioport("matrix3")->read()|0xf1;
133  if (!(m_porta&0x80)) data&=machine().root_device().ioport("matrix4")->read()|0xf1;
136134#else
137  if (!(state->m_porta&0x10)) data&=space.machine().root_device().ioport("matrix1")->read()|0xf0;
138  if (!(state->m_porta&0x20)) data&=space.machine().root_device().ioport("matrix2")->read()|0xf0;
139  if (!(state->m_porta&0x40)) data&=space.machine().root_device().ioport("matrix3")->read()|0xf0;
140  if (!(state->m_porta&0x80)) data&=space.machine().root_device().ioport("matrix4")->read()|0xf0;
135  if (!(m_porta&0x10)) data&=machine().root_device().ioport("matrix1")->read()|0xf0;
136  if (!(m_porta&0x20)) data&=machine().root_device().ioport("matrix2")->read()|0xf0;
137  if (!(m_porta&0x40)) data&=machine().root_device().ioport("matrix3")->read()|0xf0;
138  if (!(m_porta&0x80)) data&=machine().root_device().ioport("matrix4")->read()|0xf0;
141139#endif
142  if (!(state->m_porta&1)) {
143    if (!(space.machine().root_device().ioport("matrix1")->read()&1)) data&=~0x10;
144    if (!(space.machine().root_device().ioport("matrix2")->read()&1)) data&=~0x20;
145    if (!(space.machine().root_device().ioport("matrix3")->read()&1)) data&=~0x40;
146    if (!(state->ioport("matrix4")->read()&1)) data&=~0x80;
140  if (!(m_porta&1)) {
141    if (!(machine().root_device().ioport("matrix1")->read()&1)) data&=~0x10;
142    if (!(machine().root_device().ioport("matrix2")->read()&1)) data&=~0x20;
143    if (!(machine().root_device().ioport("matrix3")->read()&1)) data&=~0x40;
144    if (!(ioport("matrix4")->read()&1)) data&=~0x80;
147145  }
148  if (!(state->m_porta&2)) {
149    if (!(space.machine().root_device().ioport("matrix1")->read()&2)) data&=~0x10;
150    if (!(space.machine().root_device().ioport("matrix2")->read()&2)) data&=~0x20;
151    if (!(space.machine().root_device().ioport("matrix3")->read()&2)) data&=~0x40;
152    if (!(space.machine().root_device().ioport("matrix4")->read()&2)) data&=~0x80;
146  if (!(m_porta&2)) {
147    if (!(machine().root_device().ioport("matrix1")->read()&2)) data&=~0x10;
148    if (!(machine().root_device().ioport("matrix2")->read()&2)) data&=~0x20;
149    if (!(machine().root_device().ioport("matrix3")->read()&2)) data&=~0x40;
150    if (!(machine().root_device().ioport("matrix4")->read()&2)) data&=~0x80;
153151  }
154  if (!(state->m_porta&4)) {
155    if (!(space.machine().root_device().ioport("matrix1")->read()&4)) data&=~0x10;
156    if (!(space.machine().root_device().ioport("matrix2")->read()&4)) data&=~0x20;
157    if (!(space.machine().root_device().ioport("matrix3")->read()&4)) data&=~0x40;
158    if (!(space.machine().root_device().ioport("matrix4")->read()&4)) data&=~0x80;
152  if (!(m_porta&4)) {
153    if (!(machine().root_device().ioport("matrix1")->read()&4)) data&=~0x10;
154    if (!(machine().root_device().ioport("matrix2")->read()&4)) data&=~0x20;
155    if (!(machine().root_device().ioport("matrix3")->read()&4)) data&=~0x40;
156    if (!(machine().root_device().ioport("matrix4")->read()&4)) data&=~0x80;
159157  }
160  if (!(state->m_porta&8)) {
161    if (!(space.machine().root_device().ioport("matrix1")->read()&8)) data&=~0x10;
162    if (!(space.machine().root_device().ioport("matrix2")->read()&8)) data&=~0x20;
163    if (!(space.machine().root_device().ioport("matrix3")->read()&8)) data&=~0x40;
164    if (!(space.machine().root_device().ioport("matrix4")->read()&8)) data&=~0x80;
158  if (!(m_porta&8)) {
159    if (!(machine().root_device().ioport("matrix1")->read()&8)) data&=~0x10;
160    if (!(machine().root_device().ioport("matrix2")->read()&8)) data&=~0x20;
161    if (!(machine().root_device().ioport("matrix3")->read()&8)) data&=~0x40;
162    if (!(machine().root_device().ioport("matrix4")->read()&8)) data&=~0x80;
165163  }
166164  //  logerror("%.4x via port a read %02x\n",(int)activecpu_get_pc(), data);
167165  return data;
r18257r18258
189187   bit 5: input low x/$37 4 (else 1)
190188
191189 */
192static READ8_DEVICE_HANDLER(ssystem3_via_read_b)
190READ8_MEMBER(ssystem3_state::ssystem3_via_read_b)
193191{
194192   UINT8 data=0xff;
195193   int on, ready;
196   ssystem3_playfield_read(space.machine(), &on, &ready);
194   ssystem3_playfield_read(machine(), &on, &ready);
197195   if (!on) data&=~0x20;
198196   if (!ready) data&=~0x10;
199197   return data;
200198}
201199
202static WRITE8_DEVICE_HANDLER(ssystem3_via_write_b)
200WRITE8_MEMBER(ssystem3_state::ssystem3_via_write_b)
203201{
204   via6522_device *via_0 = space.machine().device<via6522_device>("via6522_0");
202   via6522_device *via_0 = machine().device<via6522_device>("via6522_0");
205203   UINT8 d;
206204
207   ssystem3_playfield_write(space.machine(), data&1, data&8);
208   ssystem3_lcd_write(space.machine(), data&4, data&2);
205   ssystem3_playfield_write(machine(), data&1, data&8);
206   ssystem3_lcd_write(machine(), data&4, data&2);
209207
210   d=ssystem3_via_read_b(via_0, space, 0, mem_mask)&~0x40;
208   d=ssystem3_via_read_b(space, 0, mem_mask)&~0x40;
211209   if (data&0x80) d|=0x40;
212210   //  d&=~0x8f;
213211   via_0->write_portb(space,0, d );
r18257r18258
215213
216214static const via6522_interface ssystem3_via_config=
217215{
218   DEVCB_HANDLER(ssystem3_via_read_a),//read8_machine_func in_a_func;
219   DEVCB_HANDLER(ssystem3_via_read_b),//read8_machine_func in_b_func;
216   DEVCB_DRIVER_MEMBER(ssystem3_state,ssystem3_via_read_a),//read8_machine_func in_a_func;
217   DEVCB_DRIVER_MEMBER(ssystem3_state,ssystem3_via_read_b),//read8_machine_func in_b_func;
220218   DEVCB_NULL,//read8_machine_func in_ca1_func;
221219   DEVCB_NULL,//read8_machine_func in_cb1_func;
222220   DEVCB_NULL,//read8_machine_func in_ca2_func;
223221   DEVCB_NULL,//read8_machine_func in_cb2_func;
224   DEVCB_HANDLER(ssystem3_via_write_a),//write8_machine_func out_a_func;
225   DEVCB_HANDLER(ssystem3_via_write_b),//write8_machine_func out_b_func;
222   DEVCB_DRIVER_MEMBER(ssystem3_state,ssystem3_via_write_a),//write8_machine_func out_a_func;
223   DEVCB_DRIVER_MEMBER(ssystem3_state,ssystem3_via_write_b),//write8_machine_func out_b_func;
226224   DEVCB_NULL,//write8_machine_func out_ca2_func;
227225   DEVCB_NULL,//write8_machine_func out_cb2_func;
228226   DEVCB_NULL,//void (*irq_func)(int state);
trunk/src/mess/drivers/osi.c
r18257r18258
362362    C011 ACIAIO         DISK CONTROLLER ACIA I/O PORT
363363*/
364364
365static WRITE_LINE_DEVICE_HANDLER(osi470_index_callback)
365WRITE_LINE_MEMBER(sb2m600_state::osi470_index_callback)
366366{
367   sb2m600_state *driver_state = device->machine().driver_data<sb2m600_state>();
368
369   driver_state->m_fdc_index = state;
367   m_fdc_index = state;
370368}
371369
372370READ8_MEMBER( c1pmf_state::osi470_pia_pa_r )
r18257r18258
741739
742740static const floppy_interface osi_floppy_interface =
743741{
744   DEVCB_LINE(osi470_index_callback),
742   DEVCB_DRIVER_LINE_MEMBER(sb2m600_state,osi470_index_callback),
745743   DEVCB_NULL,
746744   DEVCB_NULL,
747745   DEVCB_NULL,
trunk/src/mess/drivers/z80ne.c
r18257r18258
171171
172172static ADDRESS_MAP_START( z80netf_io, AS_IO, 8, z80ne_state )
173173   ADDRESS_MAP_GLOBAL_MASK(0xff)
174   AM_RANGE(0xd0, 0xd7) AM_DEVREADWRITE_LEGACY("wd1771", lx390_fdc_r, lx390_fdc_w)
174   AM_RANGE(0xd0, 0xd7) AM_READWRITE(lx390_fdc_r, lx390_fdc_w)
175175   AM_RANGE(0xea, 0xea) AM_READ(lx388_data_r )
176176   AM_RANGE(0xeb, 0xeb) AM_READ(lx388_read_field_sync )
177177   AM_RANGE(0xee, 0xee) AM_READWRITE(lx385_data_r, lx385_data_w )
r18257r18258
455455static const mc6847_interface z80net_mc6847_intf =
456456{
457457   "lx388",
458   DEVCB_HANDLER(lx388_mc6847_videoram_r),
458   DEVCB_DRIVER_MEMBER(z80ne_state, lx388_mc6847_videoram_r),
459459   DEVCB_NULL,
460460   DEVCB_NULL,
461461
trunk/src/mess/drivers/samcoupe.c
r18257r18258
265265   return m_attribute;
266266}
267267
268static READ8_DEVICE_HANDLER( samcoupe_lpt1_busy_r )
268READ8_MEMBER(samcoupe_state::samcoupe_lpt1_busy_r)
269269{
270   centronics_device *centronics = space.machine().device<centronics_device>("lpt1");
270   centronics_device *centronics = machine().device<centronics_device>("lpt1");
271271   return centronics->busy_r();
272272}
273273
274static WRITE8_DEVICE_HANDLER( samcoupe_lpt1_strobe_w )
274WRITE8_MEMBER(samcoupe_state::samcoupe_lpt1_strobe_w)
275275{
276   centronics_device *centronics = space.machine().device<centronics_device>("lpt1");
276   centronics_device *centronics = machine().device<centronics_device>("lpt1");
277277   centronics->strobe_w(data);
278278}
279279
280static READ8_DEVICE_HANDLER( samcoupe_lpt2_busy_r )
280READ8_MEMBER(samcoupe_state::samcoupe_lpt2_busy_r)
281281{
282   centronics_device *centronics = space.machine().device<centronics_device>("lpt2");
282   centronics_device *centronics = machine().device<centronics_device>("lpt2");
283283   return centronics->busy_r();
284284}
285285
286static WRITE8_DEVICE_HANDLER( samcoupe_lpt2_strobe_w )
286WRITE8_MEMBER(samcoupe_state::samcoupe_lpt2_strobe_w)
287287{
288   centronics_device *centronics = space.machine().device<centronics_device>("lpt2");
288   centronics_device *centronics = machine().device<centronics_device>("lpt2");
289289   centronics->strobe_w(data);
290290}
291291
r18257r18258
305305   AM_RANGE(0x0080, 0x0081) AM_MIRROR(0xff00) AM_MASK(0xffff) AM_WRITE(samcoupe_ext_mem_w)
306306   AM_RANGE(0x00e0, 0x00e7) AM_MIRROR(0xff10) AM_MASK(0xffff) AM_READWRITE(samcoupe_disk_r, samcoupe_disk_w)
307307   AM_RANGE(0x00e8, 0x00e8) AM_MIRROR(0xff00) AM_MASK(0xffff) AM_DEVWRITE("lpt1", centronics_device, write)
308   AM_RANGE(0x00e9, 0x00e9) AM_MIRROR(0xff00) AM_MASK(0xffff) AM_DEVREADWRITE_LEGACY("lpt1", samcoupe_lpt1_busy_r, samcoupe_lpt1_strobe_w)
308   AM_RANGE(0x00e9, 0x00e9) AM_MIRROR(0xff00) AM_MASK(0xffff) AM_READWRITE(samcoupe_lpt1_busy_r, samcoupe_lpt1_strobe_w)
309309   AM_RANGE(0x00ea, 0x00ea) AM_MIRROR(0xff00) AM_MASK(0xffff) AM_DEVWRITE("lpt2", centronics_device, write)
310   AM_RANGE(0x00eb, 0x00eb) AM_MIRROR(0xff00) AM_MASK(0xffff) AM_DEVREADWRITE_LEGACY("lpt2", samcoupe_lpt2_busy_r, samcoupe_lpt2_strobe_w)
310   AM_RANGE(0x00eb, 0x00eb) AM_MIRROR(0xff00) AM_MASK(0xffff) AM_READWRITE(samcoupe_lpt2_busy_r, samcoupe_lpt2_strobe_w)
311311   AM_RANGE(0x00f8, 0x00f8) AM_MIRROR(0xff00) AM_MASK(0xffff) AM_READWRITE(samcoupe_pen_r, samcoupe_clut_w)
312312   AM_RANGE(0x00f9, 0x00f9) AM_MIRROR(0xff00) AM_MASK(0xffff) AM_READWRITE(samcoupe_status_r, samcoupe_line_int_w)
313313   AM_RANGE(0x00fa, 0x00fa) AM_MIRROR(0xff00) AM_MASK(0xffff) AM_READWRITE(samcoupe_lmpr_r, samcoupe_lmpr_w)
trunk/src/mess/drivers/sg1000.c
r18257r18258
517517    TMS9928a_interface tms9928a_interface
518518-------------------------------------------------*/
519519
520static WRITE_LINE_DEVICE_HANDLER(sg1000_vdp_interrupt)
520WRITE_LINE_MEMBER(sg1000_state::sg1000_vdp_interrupt)
521521{
522   device->machine().device(Z80_TAG)->execute().set_input_line(INPUT_LINE_IRQ0, state);
522   machine().device(Z80_TAG)->execute().set_input_line(INPUT_LINE_IRQ0, state);
523523}
524524
525525static TMS9928A_INTERFACE(sg1000_tms9918a_interface)
526526{
527527   "screen",
528528   0x4000,
529   DEVCB_LINE(sg1000_vdp_interrupt)
529   DEVCB_DRIVER_LINE_MEMBER(sg1000_state,sg1000_vdp_interrupt)
530530};
531531
532532/*-------------------------------------------------
r18257r18258
984984    sf7000_fdc_index_callback -
985985-------------------------------------------------*/
986986
987static WRITE_LINE_DEVICE_HANDLER(sf7000_fdc_index_callback)
987WRITE_LINE_MEMBER(sf7000_state::sf7000_fdc_index_callback)
988988{
989   sf7000_state *driver_state = device->machine().driver_data<sf7000_state>();
990
991   driver_state->m_fdc_index = state;
989   m_fdc_index = state;
992990}
993991
994992/*-------------------------------------------------
r18257r18258
997995
998996static const floppy_interface sf7000_floppy_interface =
999997{
1000   DEVCB_LINE(sf7000_fdc_index_callback),
998   DEVCB_DRIVER_LINE_MEMBER(sf7000_state,sf7000_fdc_index_callback),
1001999   DEVCB_NULL,
10021000   DEVCB_NULL,
10031001   DEVCB_NULL,
trunk/src/mess/drivers/tsispch.c
r18257r18258
127127/*****************************************************************************
128128 USART 8251 and Terminal stuff
129129*****************************************************************************/
130static WRITE_LINE_DEVICE_HANDLER( i8251_rxrdy_int )
130WRITE_LINE_MEMBER(tsispch_state::i8251_rxrdy_int)
131131{
132   pic8259_ir1_w(device->machine().device("pic8259"), state);
132   pic8259_ir1_w(machine().device("pic8259"), state);
133133}
134134
135static WRITE_LINE_DEVICE_HANDLER( i8251_txempty_int )
135WRITE_LINE_MEMBER(tsispch_state::i8251_txempty_int)
136136{
137   pic8259_ir2_w(device->machine().device("pic8259"), state);
137   pic8259_ir2_w(machine().device("pic8259"), state);
138138}
139139
140static WRITE_LINE_DEVICE_HANDLER( i8251_txrdy_int )
140WRITE_LINE_MEMBER(tsispch_state::i8251_txrdy_int)
141141{
142   pic8259_ir3_w(device->machine().device("pic8259"), state);
142   pic8259_ir3_w(machine().device("pic8259"), state);
143143}
144144
145145const i8251_interface i8251_config =
r18257r18258
149149   DEVCB_NULL, // in dsr
150150   DEVCB_NULL, // out dtr
151151   DEVCB_NULL, // out rts
152   DEVCB_LINE(i8251_rxrdy_int), // out rxrdy
153   DEVCB_LINE(i8251_txrdy_int), // out txrdy
154   DEVCB_LINE(i8251_txempty_int), // out txempty
152   DEVCB_DRIVER_LINE_MEMBER(tsispch_state,i8251_rxrdy_int), // out rxrdy
153   DEVCB_DRIVER_LINE_MEMBER(tsispch_state,i8251_txrdy_int), // out txrdy
154   DEVCB_DRIVER_LINE_MEMBER(tsispch_state,i8251_txempty_int), // out txempty
155155   DEVCB_NULL  // out syndet
156156};
157157
r18257r18258
168168/*****************************************************************************
169169 PIC 8259 stuff
170170*****************************************************************************/
171static WRITE_LINE_DEVICE_HANDLER( pic8259_set_int_line )
171WRITE_LINE_MEMBER(tsispch_state::pic8259_set_int_line)
172172{
173   device->machine().device("maincpu")->execute().set_input_line(0, state ? HOLD_LINE : CLEAR_LINE);
173   machine().device("maincpu")->execute().set_input_line(0, state ? HOLD_LINE : CLEAR_LINE);
174174}
175175
176176static const struct pic8259_interface pic8259_config =
177177{
178   DEVCB_LINE(pic8259_set_int_line),
178   DEVCB_DRIVER_LINE_MEMBER(tsispch_state,pic8259_set_int_line),
179179   DEVCB_LINE_VCC,
180180   DEVCB_NULL
181181};
trunk/src/mess/drivers/pcw16.c
r18257r18258
13121312};
13131313
13141314
1315static WRITE_LINE_DEVICE_HANDLER( pcw16_com_interrupt_1 )
1315WRITE_LINE_MEMBER(pcw16_state::pcw16_com_interrupt_1)
13161316{
1317   pcw16_state *drvstate = device->machine().driver_data<pcw16_state>();
1318   drvstate->m_system_status &= ~(1 << 4);
1317   m_system_status &= ~(1 << 4);
13191318
13201319   if ( state ) {
1321      drvstate->m_system_status |= (1 << 4);
1320      m_system_status |= (1 << 4);
13221321   }
13231322
1324   drvstate->pcw16_refresh_ints();
1323   pcw16_refresh_ints();
13251324}
13261325
13271326
1328static WRITE_LINE_DEVICE_HANDLER( pcw16_com_interrupt_2 )
1327WRITE_LINE_MEMBER(pcw16_state::pcw16_com_interrupt_2)
13291328{
1330   pcw16_state *drvstate = device->machine().driver_data<pcw16_state>();
1331   drvstate->m_system_status &= ~(1 << 3);
1329   m_system_status &= ~(1 << 3);
13321330
13331331   if ( state ) {
1334      drvstate->m_system_status |= (1 << 3);
1332      m_system_status |= (1 << 3);
13351333   }
13361334
1337   drvstate->pcw16_refresh_ints();
1335   pcw16_refresh_ints();
13381336}
13391337
1340static WRITE_LINE_DEVICE_HANDLER( pcw16_com_tx_0 ) { }
1341static WRITE_LINE_DEVICE_HANDLER( pcw16_com_dtr_0 ) { }
1342static WRITE_LINE_DEVICE_HANDLER( pcw16_com_rts_0 ) { }
1338WRITE_LINE_MEMBER(pcw16_state::pcw16_com_tx_0){ }
1339WRITE_LINE_MEMBER(pcw16_state::pcw16_com_dtr_0){ }
1340WRITE_LINE_MEMBER(pcw16_state::pcw16_com_rts_0){ }
13431341
1344static WRITE_LINE_DEVICE_HANDLER( pcw16_com_tx_1 ) { }
1345static WRITE_LINE_DEVICE_HANDLER( pcw16_com_dtr_1 ) { }
1346static WRITE_LINE_DEVICE_HANDLER( pcw16_com_rts_1 ) { }
1342WRITE_LINE_MEMBER(pcw16_state::pcw16_com_tx_1){ }
1343WRITE_LINE_MEMBER(pcw16_state::pcw16_com_dtr_1){ }
1344WRITE_LINE_MEMBER(pcw16_state::pcw16_com_rts_1){ }
13471345
13481346static const ins8250_interface pcw16_com_interface[2]=
13491347{
13501348   {
1351      DEVCB_LINE(pcw16_com_tx_0),
1352      DEVCB_LINE(pcw16_com_dtr_0),
1353      DEVCB_LINE(pcw16_com_rts_0),
1354      DEVCB_LINE(pcw16_com_interrupt_1),
1349      DEVCB_DRIVER_LINE_MEMBER(pcw16_state,pcw16_com_tx_0),
1350      DEVCB_DRIVER_LINE_MEMBER(pcw16_state,pcw16_com_dtr_0),
1351      DEVCB_DRIVER_LINE_MEMBER(pcw16_state,pcw16_com_rts_0),
1352      DEVCB_DRIVER_LINE_MEMBER(pcw16_state,pcw16_com_interrupt_1),
13551353      DEVCB_NULL,
13561354      DEVCB_NULL
13571355   },
13581356   {
1359      DEVCB_LINE(pcw16_com_tx_1),
1360      DEVCB_LINE(pcw16_com_dtr_1),
1361      DEVCB_LINE(pcw16_com_rts_1),
1362      DEVCB_LINE(pcw16_com_interrupt_2),
1357      DEVCB_DRIVER_LINE_MEMBER(pcw16_state,pcw16_com_tx_1),
1358      DEVCB_DRIVER_LINE_MEMBER(pcw16_state,pcw16_com_dtr_1),
1359      DEVCB_DRIVER_LINE_MEMBER(pcw16_state,pcw16_com_rts_1),
1360      DEVCB_DRIVER_LINE_MEMBER(pcw16_state,pcw16_com_interrupt_2),
13631361      DEVCB_NULL,
13641362      DEVCB_NULL
13651363   }
trunk/src/mess/drivers/sms.c
r18257r18258
306306INPUT_PORTS_END
307307
308308
309static WRITE_LINE_DEVICE_HANDLER( sms_int_callback )
309WRITE_LINE_MEMBER(sms_state::sms_int_callback)
310310{
311   device->machine().device("maincpu")->execute().set_input_line(0, state);
311   machine().device("maincpu")->execute().set_input_line(0, state);
312312}
313313
314314static const sega315_5124_interface _315_5124_ntsc_intf =
315315{
316316   false,
317317   "screen",
318   DEVCB_LINE(sms_int_callback),
319   DEVCB_LINE(sms_pause_callback)
318   DEVCB_DRIVER_LINE_MEMBER(sms_state,sms_int_callback),
319   DEVCB_DRIVER_LINE_MEMBER(sms_state,sms_pause_callback)
320320};
321321
322322static const sega315_5124_interface _315_5124_pal_intf =
323323{
324324   true,
325325   "screen",
326   DEVCB_LINE(sms_int_callback),
327   DEVCB_LINE(sms_pause_callback)
326   DEVCB_DRIVER_LINE_MEMBER(sms_state,sms_int_callback),
327   DEVCB_DRIVER_LINE_MEMBER(sms_state,sms_pause_callback)
328328};
329329
330330static const sega315_5124_interface sms_store_intf =
331331{
332332   false,
333333   "screen",
334   DEVCB_LINE(sms_store_int_callback),
335   DEVCB_LINE(sms_pause_callback)
334   DEVCB_DRIVER_LINE_MEMBER(sms_state,sms_store_int_callback),
335   DEVCB_DRIVER_LINE_MEMBER(sms_state,sms_pause_callback)
336336};
337337
338338
trunk/src/mess/drivers/apple2gs.c
r18257r18258
182182   /* nothing in the address map - everything is added dynamically */
183183ADDRESS_MAP_END
184184
185static WRITE8_DEVICE_HANDLER(a2bus_irq_w)
185WRITE8_MEMBER(apple2gs_state::a2bus_irq_w)
186186{
187187    if (data)
188188    {
189        apple2gs_add_irq(space.machine(), IRQ_SLOT);
189        apple2gs_add_irq(machine(), IRQ_SLOT);
190190    }
191191    else
192192    {
193        apple2gs_remove_irq(space.machine(), IRQ_SLOT);
193        apple2gs_remove_irq(machine(), IRQ_SLOT);
194194    }
195195}
196196
197static WRITE8_DEVICE_HANDLER(a2bus_nmi_w)
197WRITE8_MEMBER(apple2gs_state::a2bus_nmi_w)
198198{
199    apple2gs_state *a2 = space.machine().driver_data<apple2gs_state>();
200
201    a2->m_maincpu->set_input_line(INPUT_LINE_NMI, data);
199    m_maincpu->set_input_line(INPUT_LINE_NMI, data);
202200}
203201
204static WRITE8_DEVICE_HANDLER(a2bus_inh_w)
202WRITE8_MEMBER(apple2gs_state::a2bus_inh_w)
205203{
206    apple2_state *a2 = space.machine().driver_data<apple2_state>();
207
208    a2->m_inh_slot = data;
209    apple2_update_memory(space.machine());
204    m_inh_slot = data;
205    apple2_update_memory(machine());
210206}
211207
212208static const struct a2bus_interface a2bus_intf =
213209{
214210    // interrupt lines
215    DEVCB_HANDLER(a2bus_irq_w),
216    DEVCB_HANDLER(a2bus_nmi_w),
217    DEVCB_HANDLER(a2bus_inh_w)
211    DEVCB_DRIVER_MEMBER(apple2gs_state,a2bus_irq_w),
212    DEVCB_DRIVER_MEMBER(apple2gs_state,a2bus_nmi_w),
213    DEVCB_DRIVER_MEMBER(apple2gs_state,a2bus_inh_w)
218214};
219215
220216static SLOT_INTERFACE_START(apple2_cards)
trunk/src/mess/drivers/adam.c
r18257r18258
14971497//  TMS9928a_interface tms9928a_interface
14981498//-------------------------------------------------
14991499
1500static WRITE_LINE_DEVICE_HANDLER(adam_vdp_interrupt)
1500WRITE_LINE_MEMBER(adam_state::adam_vdp_interrupt)
15011501{
1502   adam_state *driver_state = device->machine().driver_data<adam_state>();
1503
1504   if (state && !driver_state->m_vdp_nmi)
1502   if (state && !m_vdp_nmi)
15051503   {
1506      device->machine().device(Z80_TAG)->execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE);
1504      machine().device(Z80_TAG)->execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE);
15071505   }
15081506
1509   driver_state->m_vdp_nmi = state;
1507   m_vdp_nmi = state;
15101508}
15111509
15121510static TMS9928A_INTERFACE(adam_tms9928a_interface)
15131511{
15141512   "screen",
15151513   0x4000,
1516   DEVCB_LINE(adam_vdp_interrupt)
1514   DEVCB_DRIVER_LINE_MEMBER(adam_state,adam_vdp_interrupt)
15171515};
15181516
15191517//-------------------------------------------------

Previous 199869 Revisions Next


© 1997-2024 The MAME Team