Previous 15994 Revisions Next

r14716 Wednesday 7th March, 2012 at 18:47:37 UTC by Curt Coder
Refactored YM3526 to use devcb. (nw)
[src/emu/sound]3526intf.c 3526intf.h
[src/mame/drivers]battlane.c brkthru.c dec8.c exprraid.c fantland.c karnov.c matmania.c metlclsh.c missb2.c renegade.c sidepckt.c snk.c suna16.c
[src/mess/machine]c64_sfx_sound_expander.c

src/mame/drivers/karnov.c
r14715r14716
756756   device_set_input_line(device, 7, HOLD_LINE);   /* VBL */
757757}
758758
759static void sound_irq( device_t *device, int linestate )
760{
761   karnov_state *state = device->machine().driver_data<karnov_state>();
762   device_set_input_line(state->m_audiocpu, 0, linestate); /* IRQ */
763}
764
765759static const ym3526_interface ym3526_config =
766760{
767   sound_irq
761   DEVCB_CPU_INPUT_LINE("audiocpu", M6502_IRQ_LINE)
768762};
769763
770764/*************************************
src/mame/drivers/snk.c
r14715r14716
457457
458458
459459
460static void ymirq_callback_1(device_t *device, int irq)
460static WRITE_LINE_DEVICE_HANDLER( ymirq_callback_1 )
461461{
462   if (irq)
462   if (state)
463463      device->machine().scheduler().synchronize(FUNC(sndirq_update_callback), YM1IRQ_ASSERT);
464464}
465465
466static void ymirq_callback_2(device_t *device, int irq)
466static WRITE_LINE_DEVICE_HANDLER( ymirq_callback_2 )
467467{
468   if (irq)
468   if (state)
469469      device->machine().scheduler().synchronize(FUNC(sndirq_update_callback), YM2IRQ_ASSERT);
470470}
471471
472472
473473static const ym3526_interface ym3526_config_1 =
474474{
475   ymirq_callback_1
475   DEVCB_LINE(ymirq_callback_1)
476476};
477477
478478static const ym3526_interface ym3526_config_2 =
479479{
480   ymirq_callback_2
480   DEVCB_LINE(ymirq_callback_2)
481481};
482482
483483static const ym3812_interface ym3812_config_1 =
src/mame/drivers/missb2.c
r14715r14716
407407/* Sound Interfaces */
408408
409409// Handler called by the 3526 emulator when the internal timers cause an IRQ
410static void irqhandler(device_t *device, int irq)
410static WRITE_LINE_DEVICE_HANDLER( irqhandler )
411411{
412412   logerror("YM3526 firing an IRQ\n");
413413//  cputag_set_input_line(device->machine(), "audiocpu", 0, irq ? ASSERT_LINE : CLEAR_LINE);
r14715r14716
415415
416416static const ym3526_interface ym3526_config =
417417{
418   irqhandler
418   DEVCB_LINE(irqhandler)
419419};
420420
421421/* Interrupt Generator */
src/mame/drivers/renegade.c
r14715r14716
890890GFXDECODE_END
891891
892892
893
894/* handler called by the 3526 emulator when the internal timers cause an IRQ */
895static void irqhandler(device_t *device, int linestate)
896{
897   cputag_set_input_line(device->machine(), "audiocpu", M6809_FIRQ_LINE, linestate);
898}
899
900893static const ym3526_interface ym3526_config =
901894{
902   irqhandler
895   DEVCB_CPU_INPUT_LINE("audiocpu", M6809_FIRQ_LINE)
903896};
904897
905898
src/mame/drivers/fantland.c
r14715r14716
10471047MACHINE_CONFIG_END
10481048
10491049
1050
1051static void wheelrun_ym3526_irqhandler( device_t *device, int state )
1052{
1053   fantland_state *driver = device->machine().driver_data<fantland_state>();
1054   device_set_input_line(driver->m_audio_cpu, INPUT_LINE_IRQ0, state);
1055}
1056
10571050static const ym3526_interface wheelrun_ym3526_interface =
10581051{
1059   wheelrun_ym3526_irqhandler
1052   DEVCB_CPU_INPUT_LINE("audiocpu", INPUT_LINE_IRQ0)
10601053};
10611054
10621055static MACHINE_CONFIG_START( wheelrun, fantland_state )
src/mame/drivers/matmania.c
r14715r14716
350350MACHINE_CONFIG_END
351351
352352
353
354/* handler called by the 3526 emulator when the internal timers cause an IRQ */
355static void irqhandler(device_t *device, int linestate)
356{
357   matmania_state *state = device->machine().driver_data<matmania_state>();
358   device_set_input_line(state->m_audiocpu, 1, linestate);
359}
360
361353static const ym3526_interface ym3526_config =
362354{
363   irqhandler
355   DEVCB_CPU_INPUT_LINE("audiocpu", M6809_FIRQ_LINE)
364356};
365357
366358
src/mame/drivers/brkthru.c
r14715r14716
354354 *
355355 *************************************/
356356
357/* handler called by the 3812 emulator when the internal timers cause an IRQ */
358static void irqhandler( device_t *device, int linestate )
359{
360   brkthru_state *state = device->machine().driver_data<brkthru_state>();
361   device_set_input_line(state->m_audiocpu, M6809_IRQ_LINE, linestate);
362}
363
364357static const ym3526_interface ym3526_config =
365358{
366   irqhandler
359   DEVCB_CPU_INPUT_LINE("audiocpu", M6809_IRQ_LINE)
367360};
368361
369362
src/mame/drivers/sidepckt.c
r14715r14716
245245GFXDECODE_END
246246
247247
248
249/* handler called by the 3526 emulator when the internal timers cause an IRQ */
250static void irqhandler(device_t *device, int linestate)
251{
252   cputag_set_input_line(device->machine(), "audiocpu", 0, linestate);
253}
254
255248static const ym3526_interface ym3526_config =
256249{
257   irqhandler
250   DEVCB_CPU_INPUT_LINE("audiocpu", M6502_IRQ_LINE)
258251};
259252
260253
src/mame/drivers/metlclsh.c
r14715r14716
259259
260260***************************************************************************/
261261
262static void metlclsh_irqhandler(device_t *device, int linestate)
263{
264   metlclsh_state *state = device->machine().driver_data<metlclsh_state>();
265   device_set_input_line(state->m_maincpu, M6809_IRQ_LINE, linestate);
266}
267
268262static const ym3526_interface ym3526_config =
269263{
270   metlclsh_irqhandler
264   DEVCB_CPU_INPUT_LINE("maincpu", M6809_IRQ_LINE)
271265};
272266
273267
src/mame/drivers/suna16.c
r14715r14716
910910                            Best Of Best
911911***************************************************************************/
912912
913static void bestbest_ym3526_irqhandler(device_t *device, int state)
914{
915   cputag_set_input_line(device->machine(), "audiocpu", INPUT_LINE_IRQ0, state);
916}
917
918913static const ym3526_interface bestbest_ym3526_interface =
919914{
920   bestbest_ym3526_irqhandler
915   DEVCB_CPU_INPUT_LINE("audiocpu", INPUT_LINE_IRQ0)
921916};
922917
923918static WRITE8_DEVICE_HANDLER( bestbest_ay8910_port_a_w )
src/mame/drivers/exprraid.c
r14715r14716
439439
440440
441441/* handler called by the 3812 emulator when the internal timers cause an IRQ */
442static void irqhandler( device_t *device, int linestate )
442static WRITE_LINE_DEVICE_HANDLER( irqhandler )
443443{
444   exprraid_state *state = device->machine().driver_data<exprraid_state>();
445   device_set_input_line_and_vector(state->m_slave, 0, linestate, 0xff);
444   exprraid_state *driver_state = device->machine().driver_data<exprraid_state>();
445   device_set_input_line_and_vector(driver_state->m_slave, 0, state, 0xff);
446446}
447447
448448static const ym3526_interface ym3526_config =
449449{
450   irqhandler
450   DEVCB_LINE(irqhandler)
451451};
452452
453453#if 0
src/mame/drivers/dec8.c
r14715r14716
19111911
19121912static const ym3526_interface ym3526_config =
19131913{
1914   irqhandler
1914   DEVCB_CPU_INPUT_LINE("audiocpu", M6502_IRQ_LINE)
19151915};
19161916
19171917static const ym3812_interface ym3812_config =
src/mame/drivers/battlane.c
r14715r14716
256256 *
257257 *************************************/
258258
259static void irqhandler( device_t *device, int irq )
260{
261   battlane_state *state = device->machine().driver_data<battlane_state>();
262   device_set_input_line(state->m_maincpu, M6809_FIRQ_LINE, irq ? ASSERT_LINE : CLEAR_LINE);
263}
264
265259static const ym3526_interface ym3526_config =
266260{
267   irqhandler
261   DEVCB_CPU_INPUT_LINE("maincpu", M6809_FIRQ_LINE)
268262};
269263
270264
src/emu/sound/3526intf.c
r14715r14716
3030   void *         chip;
3131   const ym3526_interface *intf;
3232   device_t *device;
33
34   devcb_resolved_write_line out_int_func;
3335};
3436
3537
r14715r14716
4547static void IRQHandler(void *param,int irq)
4648{
4749   ym3526_state *info = (ym3526_state *)param;
48   if (info->intf->handler) (info->intf->handler)(info->device, irq ? ASSERT_LINE : CLEAR_LINE);
50   info->out_int_func(irq ? ASSERT_LINE : CLEAR_LINE);
4951}
5052/* Timer overflow callback from timer.c */
5153static TIMER_CALLBACK( timer_callback_0 )
r14715r14716
8890
8991static DEVICE_START( ym3526 )
9092{
91   static const ym3526_interface dummy = { 0 };
93   static const ym3526_interface dummy = { DEVCB_NULL };
9294   ym3526_state *info = get_safe_token(device);
9395   int rate = device->clock()/72;
9496
9597   info->intf = device->static_config() ? (const ym3526_interface *)device->static_config() : &dummy;
9698   info->device = device;
9799
100   // resolve callbacks
101   info->out_int_func.resolve(info->intf->out_int_func, *device);
102
98103   /* stream system initialize */
99104   info->chip = ym3526_init(device,device->clock(),rate);
100105   assert_always(info->chip != NULL, "Error creating YM3526 chip");
src/emu/sound/3526intf.h
r14715r14716
88typedef struct _ym3526_interface ym3526_interface;
99struct _ym3526_interface
1010{
11   void (*handler)(device_t *device, int linestate);
11   devcb_write_line out_int_func;
1212};
1313
1414READ8_DEVICE_HANDLER( ym3526_r );
src/mess/machine/c64_sfx_sound_expander.c
r14715r14716
2222//  ym3526_interface ym3526_config
2323//-------------------------------------------------
2424 
25static void irqhandler(device_t *device, int linestate)
26{
27/*  c64_sfx_sound_expander_cartridge_device *me = downcast<c64_sfx_sound_expander_cartridge_device*>(device->owner());
28 
29    me->m_slot->irq_w(linestate);*/
30}
31 
3225static const ym3526_interface ym3526_config =
3326{
34   irqhandler
27   DEVCB_LINE_MEMBER(c64_sfx_sound_expander_cartridge_device, irq_w)
3528};
3629 
3730 

Previous 15994 Revisions Next


© 1998-2018 The MESS Team