Previous 199869 Revisions Next

r22787 Sunday 12th May, 2013 at 15:09:50 UTC by smf
modernised the YM3526, which also required adding write lines to the 6502, 6809 and z80 [smf]
[src/emu/cpu/m6502]m6502.c m6502.h
[src/emu/cpu/m6809]m6809.c m6809.h
[src/emu/cpu/z80]z80.c z80.h
[src/emu/sound]3526intf.c 3526intf.h
[src/mame/drivers]battlane.c brkthru.c bublbobl.c cop01.c dec8.c exprraid.c fantland.c firetrap.c galivan.c karnov.c matmania.c metlclsh.c missb2.c renegade.c sidepckt.c snk.c suna16.c terracre.c

trunk/src/mame/drivers/snk.c
r22786r22787
468468}
469469
470470
471static const ym3526_interface ym3526_config_1 =
472{
473   DEVCB_DRIVER_LINE_MEMBER(snk_state,ymirq_callback_1)
474};
475
476static const ym3526_interface ym3526_config_2 =
477{
478   DEVCB_DRIVER_LINE_MEMBER(snk_state,ymirq_callback_2)
479};
480
481471static const ym3812_interface ym3812_config_1 =
482472{
483473   DEVCB_DRIVER_LINE_MEMBER(snk_state,ymirq_callback_1)
r22786r22787
14301420   AM_RANGE(0x8000, 0x87ff) AM_RAM
14311421   AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_byte_r)
14321422   AM_RANGE(0xc000, 0xc000) AM_READ(tnk3_busy_clear_r)
1433   AM_RANGE(0xe000, 0xe001) AM_DEVREADWRITE_LEGACY("ym1", ym3526_r, ym3526_w)
1423   AM_RANGE(0xe000, 0xe001) AM_DEVREADWRITE("ym1", ym3526_device, read, write)
14341424   AM_RANGE(0xe004, 0xe004) AM_READ(tnk3_cmdirq_ack_r)
14351425   AM_RANGE(0xe006, 0xe006) AM_READ(tnk3_ymirq_ack_r)
14361426ADDRESS_MAP_END
r22786r22787
14401430   AM_RANGE(0xc000, 0xc7ff) AM_RAM
14411431   AM_RANGE(0xd000, 0xd000) AM_READ(soundlatch_byte_r)
14421432   AM_RANGE(0xe000, 0xe000) AM_READ(tnk3_busy_clear_r)
1443   AM_RANGE(0xf000, 0xf001) AM_DEVREADWRITE_LEGACY("ym1", ym3526_r, ym3526_w)
1433   AM_RANGE(0xf000, 0xf001) AM_DEVREADWRITE("ym1", ym3526_device, read, write)
14441434//  AM_RANGE(0xf002, 0xf002) AM_READNOP unknown
14451435   AM_RANGE(0xf004, 0xf004) AM_READ(tnk3_cmdirq_ack_r)
14461436   AM_RANGE(0xf006, 0xf006) AM_READ(tnk3_ymirq_ack_r)
r22786r22787
14501440   AM_RANGE(0x0000, 0xbfff) AM_ROM
14511441   AM_RANGE(0xc000, 0xcfff) AM_RAM
14521442   AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_byte_r)
1453   AM_RANGE(0xe800, 0xe800) AM_DEVREADWRITE_LEGACY("ym1", ym3526_status_port_r, ym3526_control_port_w)
1454   AM_RANGE(0xec00, 0xec00) AM_DEVWRITE_LEGACY("ym1", ym3526_write_port_w)
1455   AM_RANGE(0xf000, 0xf000) AM_DEVREADWRITE_LEGACY("ym2", ym3526_status_port_r, ym3526_control_port_w)
1456   AM_RANGE(0xf400, 0xf400) AM_DEVWRITE_LEGACY("ym2", ym3526_write_port_w)
1443   AM_RANGE(0xe800, 0xe800) AM_DEVREADWRITE("ym1", ym3526_device, status_port_r, control_port_w)
1444   AM_RANGE(0xec00, 0xec00) AM_DEVWRITE("ym1", ym3526_device, write_port_w)
1445   AM_RANGE(0xf000, 0xf000) AM_DEVREADWRITE("ym2", ym3526_device, status_port_r, control_port_w)
1446   AM_RANGE(0xf400, 0xf400) AM_DEVWRITE("ym2", ym3526_device, write_port_w)
14571447   AM_RANGE(0xf800, 0xf800) AM_READWRITE(snk_sound_status_r, snk_sound_status_w)
14581448ADDRESS_MAP_END
14591449
r22786r22787
14701460   AM_RANGE(0x0000, 0xbfff) AM_ROM
14711461   AM_RANGE(0xc000, 0xcfff) AM_RAM
14721462   AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_byte_r)
1473   AM_RANGE(0xe800, 0xe800) AM_DEVREADWRITE_LEGACY("ym1", ym3526_status_port_r, ym3526_control_port_w)
1474   AM_RANGE(0xec00, 0xec00) AM_DEVWRITE_LEGACY("ym1", ym3526_write_port_w)
1463   AM_RANGE(0xe800, 0xe800) AM_DEVREADWRITE("ym1", ym3526_device, status_port_r, control_port_w)
1464   AM_RANGE(0xec00, 0xec00) AM_DEVWRITE("ym1", ym3526_device, write_port_w)
14751465   AM_RANGE(0xf000, 0xf000) AM_DEVREADWRITE_LEGACY("ym2", y8950_status_port_r, y8950_control_port_w)
14761466   AM_RANGE(0xf400, 0xf400) AM_DEVWRITE_LEGACY("ym2", y8950_write_port_w)
14771467   AM_RANGE(0xf800, 0xf800) AM_READWRITE(snk_sound_status_r, snk_sound_status_w)
r22786r22787
38083798   MCFG_SPEAKER_STANDARD_MONO("mono")
38093799
38103800   MCFG_SOUND_ADD("ym1", YM3526, XTAL_8MHz/2) /* verified on pcb */
3811   MCFG_SOUND_CONFIG(ym3526_config_1)
3801   MCFG_YM3526_IRQ_HANDLER(WRITELINE(snk_state, ymirq_callback_1))
38123802   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 2.0)
38133803MACHINE_CONFIG_END
38143804
r22786r22787
38383828
38393829   /* sound hardware */
38403830   MCFG_SOUND_ADD("ym2", YM3526, XTAL_8MHz/2) /* verified on pcb */
3841   MCFG_SOUND_CONFIG(ym3526_config_2)
3831   MCFG_YM3526_IRQ_HANDLER(WRITELINE(snk_state, ymirq_callback_2))
38423832   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 2.0)
38433833MACHINE_CONFIG_END
38443834
r22786r22787
38923882   MCFG_SPEAKER_STANDARD_MONO("mono")
38933883
38943884   MCFG_SOUND_ADD("ym1", YM3526, XTAL_8MHz/2) /* verified on pcb */
3895   MCFG_SOUND_CONFIG(ym3526_config_1)
3885   MCFG_YM3526_IRQ_HANDLER(WRITELINE(snk_state, ymirq_callback_1))
38963886   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 2.0)
38973887
38983888   MCFG_SOUND_ADD("ym2", YM3526, XTAL_8MHz/2) /* verified on pcb */
3899   MCFG_SOUND_CONFIG(ym3526_config_2)
3889   MCFG_YM3526_IRQ_HANDLER(WRITELINE(snk_state, ymirq_callback_2))
39003890   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 2.0)
39013891MACHINE_CONFIG_END
39023892
r22786r22787
39483938   MCFG_SPEAKER_STANDARD_MONO("mono")
39493939
39503940   MCFG_SOUND_ADD("ym1", YM3526, XTAL_8MHz/2) /* verified on pcb */
3951   MCFG_SOUND_CONFIG(ym3526_config_1)
3941   MCFG_YM3526_IRQ_HANDLER(WRITELINE(snk_state, ymirq_callback_1))
39523942   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 2.0)
39533943
39543944   MCFG_SOUND_ADD("ym2", Y8950, XTAL_8MHz/2) /* verified on pcb */
r22786r22787
40524042   MCFG_SPEAKER_STANDARD_MONO("mono")
40534043
40544044   MCFG_SOUND_ADD("ym1", YM3526, 4000000)
4055   MCFG_SOUND_CONFIG(ym3526_config_1)
4045   MCFG_YM3526_IRQ_HANDLER(WRITELINE(snk_state, ymirq_callback_1))
40564046   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
40574047
40584048   MCFG_SOUND_ADD("ym2", Y8950, 4000000)
trunk/src/mame/drivers/suna16.c
r22786r22787
267267
268268static ADDRESS_MAP_START( bestbest_sound_map, AS_PROGRAM, 8, suna16_state )
269269   AM_RANGE( 0x0000, 0xbfff ) AM_ROM                                   // ROM
270   AM_RANGE( 0xc000, 0xc001 ) AM_DEVWRITE_LEGACY("ymsnd", ym3526_w)    //
270   AM_RANGE( 0xc000, 0xc001 ) AM_DEVWRITE("ymsnd", ym3526_device, write)
271271   AM_RANGE( 0xc002, 0xc003 ) AM_DEVWRITE("aysnd", ay8910_device, address_data_w)   // AY8910
272272   AM_RANGE( 0xe000, 0xe7ff ) AM_RAM                                   // RAM
273273   AM_RANGE( 0xf000, 0xf000 ) AM_WRITE(soundlatch2_byte_w              )   // To PCM Z80
r22786r22787
948948                            Best Of Best
949949***************************************************************************/
950950
951static const ym3526_interface bestbest_ym3526_interface =
952{
953   DEVCB_CPU_INPUT_LINE("audiocpu", INPUT_LINE_IRQ0)
954};
955
956951WRITE8_MEMBER(suna16_state::bestbest_ay8910_port_a_w)
957952{
958953   // ?
r22786r22787
10051000   MCFG_SOUND_ROUTE(1, "rspeaker", 1.0)
10061001
10071002   MCFG_SOUND_ADD("ymsnd", YM3526, XTAL_24MHz/8)   /* 3MHz */
1008   MCFG_SOUND_CONFIG(bestbest_ym3526_interface)
1003   MCFG_YM3526_IRQ_HANDLER(DEVWRITELINE("audiocpu", z80_device, irq_line))
10091004   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 1.0)
10101005   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.0)
10111006
trunk/src/mame/drivers/battlane.c
r22786r22787
102102   AM_RANGE(0x1c01, 0x1c01) AM_READ_PORT("P2") AM_WRITE(battlane_scrollx_w)
103103   AM_RANGE(0x1c02, 0x1c02) AM_READ_PORT("DSW1") AM_WRITE(battlane_scrolly_w)
104104   AM_RANGE(0x1c03, 0x1c03) AM_READ_PORT("DSW2") AM_WRITE(battlane_cpu_command_w)
105   AM_RANGE(0x1c04, 0x1c05) AM_DEVREADWRITE_LEGACY("ymsnd", ym3526_r, ym3526_w)
105   AM_RANGE(0x1c04, 0x1c05) AM_DEVREADWRITE("ymsnd", ym3526_device, read, write)
106106   AM_RANGE(0x1e00, 0x1e3f) AM_WRITE(battlane_palette_w)
107107   AM_RANGE(0x2000, 0x3fff) AM_RAM_WRITE(battlane_bitmap_w) AM_SHARE("share4")
108108   AM_RANGE(0x4000, 0xffff) AM_ROM
r22786r22787
248248
249249/*************************************
250250 *
251 *  Sound interface
252 *
253 *************************************/
254
255static const ym3526_interface ym3526_config =
256{
257   DEVCB_CPU_INPUT_LINE("maincpu", M6809_FIRQ_LINE)
258};
259
260
261/*************************************
262 *
263251 *  Machine driver
264252 *
265253 *************************************/
r22786r22787
305293   MCFG_SPEAKER_STANDARD_MONO("mono")
306294
307295   MCFG_SOUND_ADD("ymsnd", YM3526, 3000000)
308   MCFG_SOUND_CONFIG(ym3526_config)
296   MCFG_YM3526_IRQ_HANDLER(DEVWRITELINE("maincpu", m6809_device, firq_line))
309297   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
310298MACHINE_CONFIG_END
311299
trunk/src/mame/drivers/bublbobl.c
r22786r22787
307307   AM_RANGE(0x0000, 0x7fff) AM_ROM
308308   AM_RANGE(0x8000, 0x8fff) AM_RAM
309309   AM_RANGE(0x9000, 0x9001) AM_DEVREADWRITE("ym1", ym2203_device, read, write)
310   AM_RANGE(0xa000, 0xa001) AM_DEVREADWRITE_LEGACY("ym2", ym3526_r, ym3526_w)
310   AM_RANGE(0xa000, 0xa001) AM_DEVREADWRITE("ym2", ym3526_device, read, write)
311311   AM_RANGE(0xb000, 0xb000) AM_READ(soundlatch_byte_r) AM_WRITE(bublbobl_sound_status_w)
312312   AM_RANGE(0xb001, 0xb001) AM_WRITE(bublbobl_sh_nmi_enable_w) AM_READNOP
313313   AM_RANGE(0xb002, 0xb002) AM_WRITE(bublbobl_sh_nmi_disable_w)
trunk/src/mame/drivers/terracre.c
r22786r22787
234234
235235static ADDRESS_MAP_START( sound_3526_io_map, AS_IO, 8, terracre_state )
236236   ADDRESS_MAP_GLOBAL_MASK(0xff)
237   AM_RANGE(0x00, 0x01) AM_DEVWRITE_LEGACY("ymsnd", ym3526_w)
237   AM_RANGE(0x00, 0x01) AM_DEVWRITE("ymsnd", ym3526_device, write)
238238   AM_RANGE(0x02, 0x02) AM_DEVWRITE("dac1", dac_device, write_signed8)
239239   AM_RANGE(0x03, 0x03) AM_DEVWRITE("dac2", dac_device, write_signed8)
240240   AM_RANGE(0x04, 0x04) AM_READ(soundlatch_clear_r)
trunk/src/mame/drivers/karnov.c
r22786r22787
434434   AM_RANGE(0x0000, 0x05ff) AM_RAM
435435   AM_RANGE(0x0800, 0x0800) AM_READ(soundlatch_byte_r)
436436   AM_RANGE(0x1000, 0x1001) AM_DEVWRITE("ym1", ym2203_device, write)
437   AM_RANGE(0x1800, 0x1801) AM_DEVWRITE_LEGACY("ym2", ym3526_w)
437   AM_RANGE(0x1800, 0x1801) AM_DEVWRITE("ym2", ym3526_device, write)
438438   AM_RANGE(0x8000, 0xffff) AM_ROM
439439ADDRESS_MAP_END
440440
r22786r22787
745745   device.execute().set_input_line(7, HOLD_LINE);  /* VBL */
746746}
747747
748static const ym3526_interface ym3526_config =
749{
750   DEVCB_CPU_INPUT_LINE("audiocpu", M6502_IRQ_LINE)
751};
752
753748/*************************************
754749 *
755750 *  Machine driver
r22786r22787
823818   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
824819
825820   MCFG_SOUND_ADD("ym2", YM3526, 3000000)
826   MCFG_SOUND_CONFIG(ym3526_config)
821   MCFG_YM3526_IRQ_HANDLER(DEVWRITELINE("audiocpu", m6502_device, irq_line))
827822   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
828823MACHINE_CONFIG_END
829824
r22786r22787
864859   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
865860
866861   MCFG_SOUND_ADD("ym2", YM3526, 3000000)
867   MCFG_SOUND_CONFIG(ym3526_config)
862   MCFG_YM3526_IRQ_HANDLER(DEVWRITELINE("audiocpu", m6502_device, irq_line))
868863   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
869864MACHINE_CONFIG_END
870865
trunk/src/mame/drivers/renegade.c
r22786r22787
705705   AM_RANGE(0x1000, 0x1000) AM_READ(soundlatch_byte_r)
706706   AM_RANGE(0x1800, 0x1800) AM_WRITENOP // this gets written the same values as 0x2000
707707   AM_RANGE(0x2000, 0x2000) AM_WRITE(adpcm_play_w)
708   AM_RANGE(0x2800, 0x2801) AM_DEVREADWRITE_LEGACY("ymsnd", ym3526_r,ym3526_w)
708   AM_RANGE(0x2800, 0x2801) AM_DEVREADWRITE("ymsnd", ym3526_device, read, write)
709709   AM_RANGE(0x3000, 0x3000) AM_WRITENOP /* adpcm related? stereo pan? */
710710   AM_RANGE(0x8000, 0xffff) AM_ROM
711711ADDRESS_MAP_END
r22786r22787
915915GFXDECODE_END
916916
917917
918static const ym3526_interface ym3526_config =
919{
920   DEVCB_CPU_INPUT_LINE("audiocpu", M6809_FIRQ_LINE)
921};
922
923
924918void renegade_state::machine_reset()
925919{
926920   m_bank = 0;
r22786r22787
958952   MCFG_SPEAKER_STANDARD_MONO("mono")
959953
960954   MCFG_SOUND_ADD("ymsnd", YM3526, 12000000/4)
961   MCFG_SOUND_CONFIG(ym3526_config)
955   MCFG_YM3526_IRQ_HANDLER(DEVWRITELINE("audiocpu", m6809_device, firq_line))
962956   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
963957
964958   MCFG_SOUND_ADD("adpcm", RENEGADE_ADPCM, 8000)
trunk/src/mame/drivers/cop01.c
r22786r22787
173173
174174static ADDRESS_MAP_START( mightguy_audio_io_map, AS_IO, 8, cop01_state )
175175   ADDRESS_MAP_GLOBAL_MASK(0xff)
176   AM_RANGE(0x00, 0x01) AM_DEVWRITE_LEGACY("ymsnd", ym3526_w)
176   AM_RANGE(0x00, 0x01) AM_DEVWRITE("ymsnd", ym3526_device, write)
177177   AM_RANGE(0x02, 0x02) AM_WRITENOP    /* 1412M2? */
178178   AM_RANGE(0x03, 0x03) AM_WRITENOP    /* 1412M2? */
179179   AM_RANGE(0x03, 0x03) AM_READ(kludge)    /* 1412M2? */
trunk/src/mame/drivers/fantland.c
r22786r22787
411411static ADDRESS_MAP_START( wheelrun_sound_map, AS_PROGRAM, 8, fantland_state )
412412   AM_RANGE(0x0000, 0x7fff) AM_ROM
413413   AM_RANGE(0x8000, 0x87ff) AM_RAM
414   AM_RANGE(0xa000, 0xa001) AM_DEVREADWRITE_LEGACY("ymsnd", ym3526_r, ym3526_w )
414   AM_RANGE(0xa000, 0xa001) AM_DEVREADWRITE("ymsnd", ym3526_device, read, write)
415415
416416   AM_RANGE(0xb000, 0xb000) AM_WRITENOP    // on a car crash / hit
417417   AM_RANGE(0xc000, 0xc000) AM_WRITENOP    // ""
r22786r22787
10151015MACHINE_CONFIG_END
10161016
10171017
1018static const ym3526_interface wheelrun_ym3526_interface =
1019{
1020   DEVCB_CPU_INPUT_LINE("audiocpu", INPUT_LINE_IRQ0)
1021};
1022
10231018static MACHINE_CONFIG_START( wheelrun, fantland_state )
10241019
10251020   /* basic machine hardware */
r22786r22787
10491044   MCFG_SPEAKER_STANDARD_MONO("mono")
10501045
10511046   MCFG_SOUND_ADD("ymsnd", YM3526, XTAL_14MHz/4)
1052   MCFG_SOUND_CONFIG(wheelrun_ym3526_interface)
1047   MCFG_YM3526_IRQ_HANDLER(DEVWRITELINE("audiocpu", z80_device, irq_line))
10531048   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
10541049MACHINE_CONFIG_END
10551050
trunk/src/mame/drivers/missb2.c
r22786r22787
207207   AM_RANGE(0x0000, 0x7fff) AM_ROM
208208   AM_RANGE(0x8000, 0x8fff) AM_RAM
209209   AM_RANGE(0x9000, 0x9000) AM_DEVREADWRITE("oki", okim6295_device, read, write)
210   AM_RANGE(0xa000, 0xa001) AM_DEVREADWRITE_LEGACY("ymsnd", ym3526_r, ym3526_w)
210   AM_RANGE(0xa000, 0xa001) AM_DEVREADWRITE("ymsnd", ym3526_device, read, write)
211211   AM_RANGE(0xb000, 0xb000) AM_READ(soundlatch_byte_r) AM_WRITENOP // message for main cpu
212212   AM_RANGE(0xb001, 0xb001) AM_READNOP AM_WRITE(bublbobl_sh_nmi_enable_w)  // bit 0: message pending for main cpu, bit 1: message pending for sound cpu
213213   AM_RANGE(0xb002, 0xb002) AM_WRITE(bublbobl_sh_nmi_disable_w)
r22786r22787
422422//  m_audiocpu->set_input_line(0, irq ? ASSERT_LINE : CLEAR_LINE);
423423}
424424
425static const ym3526_interface ym3526_config =
426{
427   DEVCB_DRIVER_LINE_MEMBER(missb2_state,irqhandler)
428};
429
430425/* Interrupt Generator */
431426
432427INTERRUPT_GEN_MEMBER(missb2_state::missb2_interrupt)
r22786r22787
487482   MCFG_SPEAKER_STANDARD_MONO("mono")
488483
489484   MCFG_SOUND_ADD("ymsnd", YM3526, MAIN_XTAL/8)
490   MCFG_SOUND_CONFIG(ym3526_config)
485   MCFG_YM3526_IRQ_HANDLER(WRITELINE(missb2_state, irqhandler))
491486   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.40)
492487
493488   MCFG_OKIM6295_ADD("oki", 1056000, OKIM6295_PIN7_HIGH) // clock frequency & pin 7 not verified
trunk/src/mame/drivers/dec8.c
r22786r22787
855855static ADDRESS_MAP_START( oscar_s_map, AS_PROGRAM, 8, dec8_state )
856856   AM_RANGE(0x0000, 0x05ff) AM_RAM
857857   AM_RANGE(0x2000, 0x2001) AM_DEVWRITE("ym1", ym2203_device, write)
858   AM_RANGE(0x4000, 0x4001) AM_DEVWRITE_LEGACY("ym2", ym3526_w)
858   AM_RANGE(0x4000, 0x4001) AM_DEVWRITE("ym2", ym3526_device, write)
859859   AM_RANGE(0x6000, 0x6000) AM_READ(soundlatch_byte_r)
860860   AM_RANGE(0x8000, 0xffff) AM_ROM
861861ADDRESS_MAP_END
r22786r22787
864864static ADDRESS_MAP_START( ym3526_s_map, AS_PROGRAM, 8, dec8_state )
865865   AM_RANGE(0x0000, 0x05ff) AM_RAM
866866   AM_RANGE(0x0800, 0x0801) AM_DEVWRITE("ym1", ym2203_device, write)
867   AM_RANGE(0x1000, 0x1001) AM_DEVWRITE_LEGACY("ym2", ym3526_w)
867   AM_RANGE(0x1000, 0x1001) AM_DEVWRITE("ym2", ym3526_device, write)
868868   AM_RANGE(0x3000, 0x3000) AM_READ(soundlatch_byte_r)
869869   AM_RANGE(0x8000, 0xffff) AM_ROM
870870ADDRESS_MAP_END
r22786r22787
873873static ADDRESS_MAP_START( csilver_s_map, AS_PROGRAM, 8, dec8_state )
874874   AM_RANGE(0x0000, 0x07ff) AM_RAM
875875   AM_RANGE(0x0800, 0x0801) AM_DEVWRITE("ym1", ym2203_device, write)
876   AM_RANGE(0x1000, 0x1001) AM_DEVWRITE_LEGACY("ym2", ym3526_w)
876   AM_RANGE(0x1000, 0x1001) AM_DEVWRITE("ym2", ym3526_device, write)
877877   AM_RANGE(0x1800, 0x1800) AM_WRITE(csilver_adpcm_data_w) /* ADPCM data for the MSM5205 chip */
878878   AM_RANGE(0x2000, 0x2000) AM_WRITE(csilver_sound_bank_w)
879879   AM_RANGE(0x3000, 0x3000) AM_READ(soundlatch_byte_r)
r22786r22787
19081908   m_audiocpu->set_input_line(0, state); /* M6502_IRQ_LINE */
19091909}
19101910
1911static const ym3526_interface ym3526_config =
1912{
1913   DEVCB_CPU_INPUT_LINE("audiocpu", M6502_IRQ_LINE)
1914};
1915
19161911static const ym3812_interface ym3812_config =
19171912{
19181913   DEVCB_DRIVER_LINE_MEMBER(dec8_state,irqhandler)
r22786r22787
20452040   MCFG_SOUND_ROUTE(3, "mono", 0.20)
20462041
20472042   MCFG_SOUND_ADD("ym2", YM3526, 3000000)
2048   MCFG_SOUND_CONFIG(ym3526_config)
2043   MCFG_YM3526_IRQ_HANDLER(DEVWRITELINE("audiocpu", m6502_device, irq_line))
20492044   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.70)
20502045MACHINE_CONFIG_END
20512046
r22786r22787
20942089   MCFG_SOUND_ROUTE(3, "mono", 0.20)
20952090
20962091   MCFG_SOUND_ADD("ym2", YM3526, 3000000)
2097   MCFG_SOUND_CONFIG(ym3526_config)
2092   MCFG_YM3526_IRQ_HANDLER(DEVWRITELINE("audiocpu", m6502_device, irq_line))
20982093   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.70)
20992094MACHINE_CONFIG_END
21002095
r22786r22787
21432138   MCFG_SOUND_ROUTE(3, "mono", 0.20)
21442139
21452140   MCFG_SOUND_ADD("ym2", YM3526, 3000000)
2146   MCFG_SOUND_CONFIG(ym3526_config)
2141   MCFG_YM3526_IRQ_HANDLER(DEVWRITELINE("audiocpu", m6502_device, irq_line))
21472142   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.70)
21482143MACHINE_CONFIG_END
21492144
r22786r22787
21922187   MCFG_SOUND_ROUTE(3, "mono", 0.20)
21932188
21942189   MCFG_SOUND_ADD("ym2", YM3526, 3000000)
2195   MCFG_SOUND_CONFIG(ym3526_config)
2190   MCFG_YM3526_IRQ_HANDLER(DEVWRITELINE("audiocpu", m6502_device, irq_line))
21962191   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.70)
21972192MACHINE_CONFIG_END
21982193
r22786r22787
22942289   MCFG_SOUND_ROUTE(3, "mono", 0.20)
22952290
22962291   MCFG_SOUND_ADD("ym2", YM3526, XTAL_12MHz/4) /* verified on pcb */
2297   MCFG_SOUND_CONFIG(ym3526_config)
2292   MCFG_YM3526_IRQ_HANDLER(DEVWRITELINE("audiocpu", m6502_device, irq_line))
22982293   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.70)
22992294
23002295   MCFG_SOUND_ADD("msm", MSM5205, XTAL_384kHz) /* verified on pcb */
r22786r22787
23502345   MCFG_SOUND_ROUTE(3, "mono", 0.20)
23512346
23522347   MCFG_SOUND_ADD("ym2", YM3526, XTAL_12MHz/4) /* verified on pcb */
2353   MCFG_SOUND_CONFIG(ym3526_config)
2348   MCFG_YM3526_IRQ_HANDLER(DEVWRITELINE("audiocpu", m6502_device, irq_line))
23542349   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.70)
23552350MACHINE_CONFIG_END
23562351
trunk/src/mame/drivers/matmania.c
r22786r22787
111111
112112static ADDRESS_MAP_START( maniach_sound_map, AS_PROGRAM, 8, matmania_state )
113113   AM_RANGE(0x0000, 0x0fff) AM_RAM
114   AM_RANGE(0x2000, 0x2001) AM_DEVWRITE_LEGACY("ymsnd", ym3526_w)
114   AM_RANGE(0x2000, 0x2001) AM_DEVWRITE("ymsnd", ym3526_device, write)
115115   AM_RANGE(0x2002, 0x2002) AM_DEVWRITE("dac", dac_device, write_signed8)
116116   AM_RANGE(0x2004, 0x2004) AM_READ(soundlatch_byte_r)
117117   AM_RANGE(0x4000, 0xffff) AM_ROM
r22786r22787
341341MACHINE_CONFIG_END
342342
343343
344static const ym3526_interface ym3526_config =
345{
346   DEVCB_CPU_INPUT_LINE("audiocpu", M6809_FIRQ_LINE)
347};
348
349
350344MACHINE_START_MEMBER(matmania_state,maniach)
351345{
352346   MACHINE_START_CALL_MEMBER(matmania);
r22786r22787
418412   MCFG_SPEAKER_STANDARD_MONO("mono")
419413
420414   MCFG_SOUND_ADD("ymsnd", YM3526, 3600000)
421   MCFG_SOUND_CONFIG(ym3526_config)
415   MCFG_YM3526_IRQ_HANDLER(DEVWRITELINE("audiocpu", m6809_device, firq_line))
422416   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
423417
424418   MCFG_DAC_ADD("dac")
trunk/src/mame/drivers/sidepckt.c
r22786r22787
246246static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, sidepckt_state )
247247   AM_RANGE(0x0000, 0x0fff) AM_RAM
248248   AM_RANGE(0x1000, 0x1001) AM_DEVWRITE("ym1", ym2203_device, write)
249   AM_RANGE(0x2000, 0x2001) AM_DEVWRITE_LEGACY("ym2", ym3526_w)
249   AM_RANGE(0x2000, 0x2001) AM_DEVWRITE("ym2", ym3526_device, write)
250250   AM_RANGE(0x3000, 0x3000) AM_READ(soundlatch_byte_r)
251251   AM_RANGE(0x8000, 0xffff) AM_ROM
252252ADDRESS_MAP_END
r22786r22787
378378GFXDECODE_END
379379
380380
381static const ym3526_interface ym3526_config =
382{
383   DEVCB_CPU_INPUT_LINE("audiocpu", M6502_IRQ_LINE)
384};
385381
386
387
388382static MACHINE_CONFIG_START( sidepckt, sidepckt_state )
389383
390384   /* basic machine hardware */
r22786r22787
415409   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
416410
417411   MCFG_SOUND_ADD("ym2", YM3526, 3000000)
418   MCFG_SOUND_CONFIG(ym3526_config)
412   MCFG_YM3526_IRQ_HANDLER(DEVWRITELINE("audiocpu", m6502_device, irq_line))
419413   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
420414MACHINE_CONFIG_END
421415
trunk/src/mame/drivers/metlclsh.c
r22786r22787
6969/**/AM_RANGE(0xcc00, 0xcc2f) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_byte_split_hi_w) AM_SHARE("paletteram2")
7070   AM_RANGE(0xd000, 0xd001) AM_DEVREADWRITE("ym1", ym2203_device, read, write)
7171/**/AM_RANGE(0xd800, 0xdfff) AM_RAM_WRITE(metlclsh_fgram_w) AM_SHARE("fgram")
72   AM_RANGE(0xe000, 0xe001) AM_DEVWRITE_LEGACY("ym2", ym3526_w )
72   AM_RANGE(0xe000, 0xe001) AM_DEVWRITE("ym2", ym3526_device, write)
7373   AM_RANGE(0xe800, 0xe9ff) AM_RAM AM_SHARE("spriteram")
7474   AM_RANGE(0xfff0, 0xffff) AM_ROM                                 // Reset/IRQ vectors
7575ADDRESS_MAP_END
r22786r22787
254254
255255***************************************************************************/
256256
257static const ym3526_interface ym3526_config =
258{
259   DEVCB_CPU_INPUT_LINE("maincpu", M6809_IRQ_LINE)
260};
261
262
263257void metlclsh_state::machine_start()
264258{
265259   save_item(NAME(m_write_mask));
r22786r22787
308302   MCFG_SOUND_ROUTE(3, "mono", 0.50)
309303
310304   MCFG_SOUND_ADD("ym2", YM3526, 3000000)
311   MCFG_SOUND_CONFIG(ym3526_config)
305   MCFG_YM3526_IRQ_HANDLER(DEVWRITELINE("maincpu", m6809_device, irq_line))
312306   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
313307MACHINE_CONFIG_END
314308
trunk/src/mame/drivers/galivan.c
r22786r22787
113113
114114static ADDRESS_MAP_START( sound_io_map, AS_IO, 8, galivan_state )
115115   ADDRESS_MAP_GLOBAL_MASK(0xff)
116   AM_RANGE(0x00, 0x01) AM_DEVWRITE_LEGACY("ymsnd", ym3526_w)
116   AM_RANGE(0x00, 0x01) AM_DEVWRITE("ymsnd", ym3526_device, write)
117117   AM_RANGE(0x02, 0x02) AM_DEVWRITE("dac1", dac_device, write_unsigned8)
118118   AM_RANGE(0x03, 0x03) AM_DEVWRITE("dac2", dac_device, write_unsigned8)
119119   AM_RANGE(0x04, 0x04) AM_READ(soundlatch_clear_r)
trunk/src/mame/drivers/brkthru.c
r22786r22787
147147
148148static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, brkthru_state )
149149   AM_RANGE(0x0000, 0x1fff) AM_RAM
150   AM_RANGE(0x2000, 0x2001) AM_DEVWRITE_LEGACY("ym2", ym3526_w)
150   AM_RANGE(0x2000, 0x2001) AM_DEVWRITE("ym2", ym3526_device, write)
151151   AM_RANGE(0x4000, 0x4000) AM_READ(soundlatch_byte_r)
152152   AM_RANGE(0x6000, 0x6001) AM_DEVREADWRITE("ym1", ym2203_device, read, write)
153153   AM_RANGE(0x8000, 0xffff) AM_ROM
r22786r22787
342342GFXDECODE_END
343343
344344
345/*************************************
346 *
347 *  Sound interface
348 *
349 *************************************/
350345
351static const ym3526_interface ym3526_config =
352{
353   DEVCB_CPU_INPUT_LINE("audiocpu", M6809_IRQ_LINE)
354};
355
356
357
358346/*************************************
359347 *
360348 *  Machine driver
r22786r22787
412400   MCFG_SOUND_ROUTE(3, "mono", 0.50)
413401
414402   MCFG_SOUND_ADD("ym2", YM3526, MASTER_CLOCK/4)
415   MCFG_SOUND_CONFIG(ym3526_config)
403   MCFG_YM3526_IRQ_HANDLER(DEVWRITELINE("audiocpu", m6809_device, irq_line))
416404   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
417405MACHINE_CONFIG_END
418406
r22786r22787
459447   MCFG_SOUND_ROUTE(3, "mono", 0.50)
460448
461449   MCFG_SOUND_ADD("ym2", YM3526, MASTER_CLOCK/4)
462   MCFG_SOUND_CONFIG(ym3526_config)
450   MCFG_YM3526_IRQ_HANDLER(DEVWRITELINE("audiocpu", m6809_device, irq_line))
463451   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
464452MACHINE_CONFIG_END
465453
trunk/src/mame/drivers/firetrap.c
r22786r22787
394394
395395static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, firetrap_state )
396396   AM_RANGE(0x0000, 0x07ff) AM_RAM
397   AM_RANGE(0x1000, 0x1001) AM_DEVWRITE_LEGACY("ymsnd", ym3526_w)
397   AM_RANGE(0x1000, 0x1001) AM_DEVWRITE("ymsnd", ym3526_device, write)
398398   AM_RANGE(0x2000, 0x2000) AM_WRITE(firetrap_adpcm_data_w)    /* ADPCM data for the MSM5205 chip */
399399   AM_RANGE(0x2400, 0x2400) AM_WRITE(firetrap_sound_2400_w)
400400   AM_RANGE(0x2800, 0x2800) AM_WRITE(firetrap_sound_bankselect_w)
trunk/src/mame/drivers/exprraid.c
r22786r22787
270270static ADDRESS_MAP_START( slave_map, AS_PROGRAM, 8, exprraid_state )
271271   AM_RANGE(0x0000, 0x1fff) AM_RAM
272272   AM_RANGE(0x2000, 0x2001) AM_DEVREADWRITE("ym1", ym2203_device, read, write)
273   AM_RANGE(0x4000, 0x4001) AM_DEVREADWRITE_LEGACY("ym2", ym3526_r, ym3526_w)
273   AM_RANGE(0x4000, 0x4001) AM_DEVREADWRITE("ym2", ym3526_device, read, write)
274274   AM_RANGE(0x6000, 0x6000) AM_READ(soundlatch_byte_r)
275275   AM_RANGE(0x8000, 0xffff) AM_ROM
276276ADDRESS_MAP_END
r22786r22787
439439   m_slave->set_input_line_and_vector(0, state, 0xff);
440440}
441441
442static const ym3526_interface ym3526_config =
443{
444   DEVCB_DRIVER_LINE_MEMBER(exprraid_state,irqhandler)
445};
446
447442#if 0
448443INTERRUPT_GEN_MEMBER(exprraid_state::exprraid_interrupt)
449444{
r22786r22787
509504   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30)
510505
511506   MCFG_SOUND_ADD("ym2", YM3526, 3600000)
512   MCFG_SOUND_CONFIG(ym3526_config)
507   MCFG_YM3526_IRQ_HANDLER(WRITELINE(exprraid_state, irqhandler))
513508   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.60)
514509MACHINE_CONFIG_END
515510
trunk/src/emu/cpu/z80/z80.h
r22786r22787
2626   Z80_GENPCBASE = STATE_GENPCBASE
2727};
2828
29DECLARE_LEGACY_CPU_DEVICE(Z80, z80);
30DECLARE_LEGACY_CPU_DEVICE(NSC800, nsc800);
29class z80_device : public legacy_cpu_device
30{
31public:
32   z80_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, UINT32 clock);
3133
34   DECLARE_WRITE_LINE_MEMBER( irq_line );
35
36protected:
37   z80_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, UINT32 clock, cpu_get_info_func info);
38};
39
40extern const device_type Z80;
41
42class nsc800_device : public z80_device
43{
44public:
45   nsc800_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, UINT32 clock);
46};
47
48extern const device_type NSC800;
49
50CPU_GET_INFO( z80 );
51CPU_GET_INFO( nsc800 );
3252CPU_DISASSEMBLE( z80 );
3353
3454void z80_set_cycle_tables(device_t *device, const UINT8 *op, const UINT8 *cb, const UINT8 *ed, const UINT8 *xy, const UINT8 *xycb, const UINT8 *ex);
trunk/src/emu/cpu/z80/z80.c
r22786r22787
39263926   }
39273927}
39283928
3929DEFINE_LEGACY_CPU_DEVICE(Z80, z80);
3930DEFINE_LEGACY_CPU_DEVICE(NSC800, nsc800);
3929z80_device::z80_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, UINT32 clock, cpu_get_info_func info)
3930   : legacy_cpu_device(mconfig, type, tag, owner, clock, info)
3931{
3932}
3933
3934z80_device::z80_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, UINT32 clock)
3935   : legacy_cpu_device(mconfig, type, tag, owner, clock, CPU_GET_INFO_NAME(z80))
3936{
3937}
3938
3939const device_type Z80 = &legacy_device_creator<z80_device>;
3940
3941nsc800_device::nsc800_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, UINT32 clock)
3942   : z80_device(mconfig, type, tag, owner, clock, CPU_GET_INFO_NAME(nsc800))
3943{
3944}
3945
3946const device_type NSC800 = &legacy_device_creator<nsc800_device>;
3947
3948WRITE_LINE_MEMBER( z80_device::irq_line )
3949{
3950   set_input_line( INPUT_LINE_IRQ0, state );
3951}
trunk/src/emu/cpu/m6502/m6502.c
r22786r22787
721721   return read(adr);
722722}
723723
724WRITE_LINE_MEMBER( m6502_device::irq_line )
725{
726   set_input_line( M6502_IRQ_LINE, state );
727}
728
724729#include "cpu/m6502/m6502.inc"
trunk/src/emu/cpu/m6502/m6502.h
r22786r22787
5555   m6502_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
5656   m6502_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source);
5757
58   DECLARE_WRITE_LINE_MEMBER( irq_line );
59
5860   UINT64 get_cycle();
5961   bool get_sync() const { return sync; }
6062   void disable_direct() { direct_disabled = true; }
trunk/src/emu/cpu/m6809/m6809.h
r22786r22787
5151   // inline configuration helpers
5252   static void static_set_config(device_t &device, const m6809_config &config);
5353
54   DECLARE_WRITE_LINE_MEMBER( irq_line );
55   DECLARE_WRITE_LINE_MEMBER( firq_line );
56
5457protected:
5558   // device-level overrides
5659   virtual void device_start();
trunk/src/emu/cpu/m6809/m6809.c
r22786r22787
577577      : m6809_base_device(mconfig, "M6809E", tag, owner, clock, M6809E, 4)
578578{
579579}
580
581WRITE_LINE_MEMBER( m6809_base_device::irq_line )
582{
583   set_input_line( M6809_IRQ_LINE, state );
584}
585
586WRITE_LINE_MEMBER( m6809_base_device::firq_line )
587{
588   set_input_line( M6809_FIRQ_LINE, state );
589}
trunk/src/emu/sound/3526intf.c
r22786r22787
2222#include "sound/fmopl.h"
2323
2424
25struct ym3526_state
25/* IRQ Handler */
26static void IRQHandler(void *param,int irq)
2627{
27   sound_stream *  stream;
28   emu_timer *     timer[2];
29   void *          chip;
30   const ym3526_interface *intf;
31   device_t *device;
32
33   devcb_resolved_write_line out_int_func;
34};
35
36
37INLINE ym3526_state *get_safe_token(device_t *device)
38{
39   assert(device != NULL);
40   assert(device->type() == YM3526);
41   return (ym3526_state *)downcast<ym3526_device *>(device)->token();
28   ym3526_device *ym3526 = (ym3526_device *) param;
29   ym3526->_IRQHandler(irq);
4230}
4331
44
45/* IRQ Handler */
46static void IRQHandler(void *param,int irq)
32void ym3526_device::_IRQHandler(int irq)
4733{
48   ym3526_state *info = (ym3526_state *)param;
49   info->out_int_func(irq ? ASSERT_LINE : CLEAR_LINE);
34   if (!m_irq_handler.isnull())
35      m_irq_handler(irq);
5036}
37
5138/* Timer overflow callback from timer.c */
52static TIMER_CALLBACK( timer_callback_0 )
39void ym3526_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
5340{
54   ym3526_state *info = (ym3526_state *)ptr;
55   ym3526_timer_over(info->chip,0);
41   switch(id)
42   {
43   case 0:
44      ym3526_timer_over(m_chip,0);
45      break;
46
47   case 1:
48      ym3526_timer_over(m_chip,1);
49      break;
50   }
5651}
57static TIMER_CALLBACK( timer_callback_1 )
52
53static void timer_handler(void *param,int c,attotime period)
5854{
59   ym3526_state *info = (ym3526_state *)ptr;
60   ym3526_timer_over(info->chip,1);
55   ym3526_device *ym3526 = (ym3526_device *) param;
56   ym3526->_timer_handler(c, period);
6157}
62/* TimerHandler from fm.c */
63static void TimerHandler(void *param,int c,attotime period)
58
59void ym3526_device::_timer_handler(int c,attotime period)
6460{
65   ym3526_state *info = (ym3526_state *)param;
6661   if( period == attotime::zero )
6762   {   /* Reset FM Timer */
68      info->timer[c]->enable(false);
63      m_timer[c]->enable(false);
6964   }
7065   else
7166   {   /* Start FM Timer */
72      info->timer[c]->adjust(period);
67      m_timer[c]->adjust(period);
7368   }
7469}
7570
76
77static STREAM_UPDATE( ym3526_stream_update )
71/* update request from fm.c */
72void ym3526_update_request(void *param, int interval)
7873{
79   ym3526_state *info = (ym3526_state *)param;
80   ym3526_update_one(info->chip, outputs[0], samples);
74   ym3526_device *ym3526 = (ym3526_device *) param;
75   ym3526->_ym3526_update_request();
8176}
8277
83static void _stream_update(void *param, int interval)
78void ym3526_device::_ym3526_update_request()
8479{
85   ym3526_state *info = (ym3526_state *)param;
86   info->stream->update();
80   m_stream->update();
8781}
8882
8983
90static DEVICE_START( ym3526 )
84
85//-------------------------------------------------
86//  sound_stream_update - handle a stream update
87//-------------------------------------------------
88
89void ym3526_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
9190{
92   static const ym3526_interface dummy = { DEVCB_NULL };
93   ym3526_state *info = get_safe_token(device);
94   int rate = device->clock()/72;
91   ym3526_update_one(m_chip, outputs[0], samples);
92}
9593
96   info->intf = device->static_config() ? (const ym3526_interface *)device->static_config() : &dummy;
97   info->device = device;
9894
95//-------------------------------------------------
96//  device_start - device-specific startup
97//-------------------------------------------------
98
99void ym3526_device::device_start()
100{
101   int rate = clock()/72;
102
99103   // resolve callbacks
100   info->out_int_func.resolve(info->intf->out_int_func, *device);
104   m_irq_handler.resolve();
101105
102106   /* stream system initialize */
103   info->chip = ym3526_init(device,device->clock(),rate);
104   assert_always(info->chip != NULL, "Error creating YM3526 chip");
107   m_chip = ym3526_init(this,clock(),rate);
108   assert_always(m_chip != NULL, "Error creating YM3526 chip");
105109
106   info->stream = device->machine().sound().stream_alloc(*device,0,1,rate,info,ym3526_stream_update);
110   m_stream = machine().sound().stream_alloc(*this,0,1,rate);
107111   /* YM3526 setup */
108   ym3526_set_timer_handler (info->chip, TimerHandler, info);
109   ym3526_set_irq_handler   (info->chip, IRQHandler, info);
110   ym3526_set_update_handler(info->chip, _stream_update, info);
112   ym3526_set_timer_handler (m_chip, timer_handler, this);
113   ym3526_set_irq_handler   (m_chip, IRQHandler, this);
114   ym3526_set_update_handler(m_chip, ym3526_update_request, this);
111115
112   info->timer[0] = device->machine().scheduler().timer_alloc(FUNC(timer_callback_0), info);
113   info->timer[1] = device->machine().scheduler().timer_alloc(FUNC(timer_callback_1), info);
116   m_timer[0] = timer_alloc(0);
117   m_timer[1] = timer_alloc(1);
114118}
115119
116static DEVICE_STOP( ym3526 )
120//-------------------------------------------------
121//  device_stop - device-specific stop
122//-------------------------------------------------
123
124void ym3526_device::device_stop()
117125{
118   ym3526_state *info = get_safe_token(device);
119   ym3526_shutdown(info->chip);
126   ym3526_shutdown(m_chip);
120127}
121128
122static DEVICE_RESET( ym3526 )
129//-------------------------------------------------
130//  device_reset - device-specific reset
131//-------------------------------------------------
132
133void ym3526_device::device_reset()
123134{
124   ym3526_state *info = get_safe_token(device);
125   ym3526_reset_chip(info->chip);
135   ym3526_reset_chip(m_chip);
126136}
127137
128138
129READ8_DEVICE_HANDLER( ym3526_r )
139READ8_MEMBER( ym3526_device::read )
130140{
131   ym3526_state *info = get_safe_token(device);
132   return ym3526_read(info->chip, offset & 1);
141   return ym3526_read(m_chip, offset & 1);
133142}
134143
135WRITE8_DEVICE_HANDLER( ym3526_w )
144WRITE8_MEMBER( ym3526_device::write )
136145{
137   ym3526_state *info = get_safe_token(device);
138   ym3526_write(info->chip, offset & 1, data);
146   ym3526_write(m_chip, offset & 1, data);
139147}
140148
141READ8_DEVICE_HANDLER( ym3526_status_port_r ) { return ym3526_r(device, space, 0); }
142READ8_DEVICE_HANDLER( ym3526_read_port_r ) { return ym3526_r(device, space, 1); }
143WRITE8_DEVICE_HANDLER( ym3526_control_port_w ) { ym3526_w(device, space, 0, data); }
144WRITE8_DEVICE_HANDLER( ym3526_write_port_w ) { ym3526_w(device, space, 1, data); }
149READ8_MEMBER( ym3526_device::status_port_r ) { return read(space, 0); }
150READ8_MEMBER( ym3526_device::read_port_r ) { return read(space, 1); }
151WRITE8_MEMBER( ym3526_device::control_port_w ) { write(space, 0, data); }
152WRITE8_MEMBER( ym3526_device::write_port_w ) { write(space, 1, data); }
145153
146154
147155const device_type YM3526 = &device_creator<ym3526_device>;
148156
149157ym3526_device::ym3526_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
150158   : device_t(mconfig, YM3526, "YM3526", tag, owner, clock),
151      device_sound_interface(mconfig, *this)
159      device_sound_interface(mconfig, *this),
160      m_irq_handler(*this)
152161{
153   m_token = global_alloc_clear(ym3526_state);
154162}
155163
156164//-------------------------------------------------
r22786r22787
162170void ym3526_device::device_config_complete()
163171{
164172}
165
166//-------------------------------------------------
167//  device_start - device-specific startup
168//-------------------------------------------------
169
170void ym3526_device::device_start()
171{
172   DEVICE_START_NAME( ym3526 )(this);
173}
174
175//-------------------------------------------------
176//  device_reset - device-specific reset
177//-------------------------------------------------
178
179void ym3526_device::device_reset()
180{
181   DEVICE_RESET_NAME( ym3526 )(this);
182}
183
184//-------------------------------------------------
185//  device_stop - device-specific stop
186//-------------------------------------------------
187
188void ym3526_device::device_stop()
189{
190   DEVICE_STOP_NAME( ym3526 )(this);
191}
192
193//-------------------------------------------------
194//  sound_stream_update - handle a stream update
195//-------------------------------------------------
196
197void ym3526_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
198{
199   // should never get here
200   fatalerror("sound_stream_update called; not applicable to legacy sound devices\n");
201}
trunk/src/emu/sound/3526intf.h
r22786r22787
33#ifndef __3526INTF_H__
44#define __3526INTF_H__
55
6#include "devlegcy.h"
6#include "emu.h"
77
8struct ym3526_interface
9{
10   devcb_write_line out_int_func;
11};
8#define MCFG_YM3526_IRQ_HANDLER(_devcb) \
9   devcb = &ym3526_device::set_irq_handler(*device, DEVCB2_##_devcb);
1210
13DECLARE_READ8_DEVICE_HANDLER( ym3526_r );
14DECLARE_WRITE8_DEVICE_HANDLER( ym3526_w );
15
16DECLARE_READ8_DEVICE_HANDLER( ym3526_status_port_r );
17DECLARE_READ8_DEVICE_HANDLER( ym3526_read_port_r );
18DECLARE_WRITE8_DEVICE_HANDLER( ym3526_control_port_w );
19DECLARE_WRITE8_DEVICE_HANDLER( ym3526_write_port_w );
20
2111class ym3526_device : public device_t,
2212                           public device_sound_interface
2313{
2414public:
2515   ym3526_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
26   ~ym3526_device() { global_free(m_token); }
2716
28   // access to legacy token
29   void *token() const { assert(m_token != NULL); return m_token; }
17   // static configuration helpers
18   template<class _Object> static devcb2_base &set_irq_handler(device_t &device, _Object object) { return downcast<ym3526_device &>(device).m_irq_handler.set_callback(object); }
19
20   DECLARE_READ8_MEMBER( read );
21   DECLARE_WRITE8_MEMBER( write );
22
23   DECLARE_READ8_MEMBER( status_port_r );
24   DECLARE_READ8_MEMBER( read_port_r );
25   DECLARE_WRITE8_MEMBER( control_port_w );
26   DECLARE_WRITE8_MEMBER( write_port_w );
27
28   void _IRQHandler(int irq);
29   void _timer_handler(int c,attotime period);
30   void _ym3526_update_request();
31
3032protected:
3133   // device-level overrides
3234   virtual void device_config_complete();
r22786r22787
3436   virtual void device_stop();
3537   virtual void device_reset();
3638
39   virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
40
3741   // sound stream update overrides
3842   virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples);
43
3944private:
4045   // internal state
41   void *m_token;
46   sound_stream *  m_stream;
47   emu_timer *     m_timer[2];
48   void *          m_chip;
49   devcb2_write_line m_irq_handler;
4250};
4351
4452extern const device_type YM3526;

Previous 199869 Revisions Next


© 1997-2024 The MAME Team